X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=it%2Fotf.git;a=blobdiff_plain;f=oran-ric-test-head%2Fworkflows%2FDeploy_xAPP_Test.bpmn;fp=oran-ric-test-head%2Fworkflows%2FDeploy_xAPP_Test.bpmn;h=bf2b3d9f278e8426d0b264edcbc4875e07c65669;hp=0000000000000000000000000000000000000000;hb=3d33edd3ef5f8ee668efdf5db6dd670a7b217f23;hpb=392cca7a80edc84824d6521e85b54f693765bd60 diff --git a/oran-ric-test-head/workflows/Deploy_xAPP_Test.bpmn b/oran-ric-test-head/workflows/Deploy_xAPP_Test.bpmn new file mode 100644 index 0000000..bf2b3d9 --- /dev/null +++ b/oran-ric-test-head/workflows/Deploy_xAPP_Test.bpmn @@ -0,0 +1,463 @@ + + + + + SequenceFlow_0st7o3p + + + + + + ${ready} + + + + + + + + + + + + + ${deployed} + + + + ${validInput} + + + + ${!alreadyDeployed} + + + + + SequenceFlow_0j9397y + SequenceFlow_0e1kt1e + var System = java.lang.System + +var readyVthId = 'ready' +var testData = execution.getVariable("testData") +var vthInput = execution.getVariable("vthInput") +var ready = false; +var testResultMessage = "RIC VTH reported that xAppManager is not ready." + + + +try { + //get output from ready call + var testExecution = execution.getVariable('otf-execution-testExecution'); + var data = null; + testExecution.testHeadResults.forEach(function(item, index, array) { + if(item.bpmnVthTaskId == readyVthId ){ + data = item['testHeadResponse']['vthResponse']['resultData']['statusCode']; + } + }) + + if(data === 200){ + ready = true + testResultMessage = "RIC VTH reported that xAppManager is ready." + } + +} +catch(err) { + ready = false +} + +execution.setVariable("ready", ready); +execution.setVariable("testResultMessage", testResultMessage); + + + SequenceFlow_1chkfad + SequenceFlow_0nfij3v + SequenceFlow_0g7zkcv + SequenceFlow_0dscvt7 + SequenceFlow_1u9jrl1 + execution.setVariable("testResult", "FAILED") + + + SequenceFlow_08hkwrc + SequenceFlow_18bpwal + execution.setVariable("testResult", "SUCCESS") + + + SequenceFlow_07jnolr + SequenceFlow_08wazou + var System = java.lang.System + +var deploy = 'deploy' +var secondList = 'second_list' +var testData = execution.getVariable("testData") +var vthInput = execution.getVariable("vthInput") +var deployed = false; +var testResultMessage = "RIC VTH reported that xApp is not deployed." +var appName = testData['appName'] + + + +try { + //get output from deploy call + var testExecution = execution.getVariable('otf-execution-testExecution'); + data = null; + testExecution.testHeadResults.forEach(function(item, index, array) { + if(item.bpmnVthTaskId == deploy ){ + data = item['testHeadResponse']['vthResponse']['resultData']['statusCode']; + } + }) + + if(data === 201){ + testResultMessage = "RIC VTH reported that xAppManager deployment call succeeded." + + //get output from secondList call + var testExecution = execution.getVariable('otf-execution-testExecution'); + data = null; + testExecution.testHeadResults.forEach(function(item, index, array) { + if(item.bpmnVthTaskId == secondList ){ + data = item['testHeadResponse']['vthResponse']['resultData']['resultOutput']; + } + }) + + instance = null + data.forEach(function(item, index, array) { + if(item.name === appName){ + instance = item + testResultMessage = "RIC VTH reported that xApp is present." + } + }) + + if(instance !== null && instance.status === 'deployed'){ + deployed = true + testResultMessage = "RIC VTH reported that xApp is deployed." + testDetails = execution.getVariable("testDetails") + testDetails.put("instance", instance); + execution.setVariable("testDetails", testDetails) + } + else{ + deployed = false + testResultMessage = "RIC VTH reported that xApp was deployed, but xApp instance was either null or not deployed. See vth results for further information." + } + + } + +} +catch(err) { + deployed = false + testResultMessage = "Couldn't verify is xApp was deployed. Check Test Results" + err +} + +execution.setVariable("deployed", deployed); +execution.setVariable("testResultMessage", testResultMessage); + + + SequenceFlow_0st7o3p + SequenceFlow_18luk66 + var System = java.lang.System + +var deployVthId = 'deploy' +var testData = execution.getVariable("testData") +var vthInput = execution.getVariable("vthInput") +var validInput = false; +var testResultMessage = ""; + +try{ + + var appName = testData['appName']; + var waitDurationSec = testData['waitDurationSec']; + + if(typeof appName !== 'string' || appName.trim() === ''){ + System.out.println("appName is not a string, or empty string") + throw Error("appName is not a string, or empty string") + } + + if(typeof waitDurationSec !== 'number' || waitDurationSec < 0){ + System.out.println("not a number") + throw Error("waitDurationSec is not a number greater than 0") + } + + validInput = true + + vthInput[deployVthId].name = appName + var timer = "PT" + waitDurationSec + "S" + System.out.println("timer " + timer) + execution.setVariable("timer", timer) +} +catch(err){ + System.out.println(err) + validInput = false + testResultMessage = "Invalid input params. error: " + err; + execution.setVariable("testResult", "FAILED"); +} + +execution.setVariable("validInput", validInput) +execution.setVariable("testResultMessage", testResultMessage) + + + SequenceFlow_0s6ntyv + SequenceFlow_0i3et2n + var System = java.lang.System + +var firstList = 'first_list' +var testData = execution.getVariable("testData") +var vthInput = execution.getVariable("vthInput") +var alreadyDeployed = true; +var testResultMessage = "RIC VTH reported that xApp is already deployed." +var appName = testData['appName'] + + + +try { + //get output from firstList call + var testExecution = execution.getVariable('otf-execution-testExecution'); + var data = null; + testExecution.testHeadResults.forEach(function(item, index, array) { + if(item.bpmnVthTaskId == firstList ){ + data = item['testHeadResponse']['vthResponse']['resultData']['resultOutput']; + } + }) + + var instance = null + data.forEach(function(item, index, array) { + if(item.name === appName){ + instance = item + testResultMessage = "RIC VTH reported that xApp is already present." + } + }) + + if(instance === null){ + alreadyDeployed = false + testResultMessage = "RIC VTH reported that xApp is not present." + } + + +} +catch(err) { + alreadyDeployed = true + testResultMessage = "Couldn't verify is xApp was already deployed." +} + +execution.setVariable("alreadyDeployed", alreadyDeployed); +execution.setVariable("testResultMessage", testResultMessage); + + + SequenceFlow_0e1kt1e + SequenceFlow_0zxo4fr + SequenceFlow_1chkfad + + + SequenceFlow_08wazou + SequenceFlow_0nfij3v + SequenceFlow_08hkwrc + + + SequenceFlow_18luk66 + SequenceFlow_1y69zdb + SequenceFlow_0g7zkcv + + + SequenceFlow_0i3et2n + SequenceFlow_08v4jva + SequenceFlow_0dscvt7 + + + SequenceFlow_1oze54u + SequenceFlow_07rma3l + + ${timer} + + + + SequenceFlow_01cc25d + + + + SequenceFlow_1y69zdb + SequenceFlow_0j9397y + + + SequenceFlow_0zxo4fr + SequenceFlow_0s6ntyv + + + SequenceFlow_08v4jva + SequenceFlow_1oze54u + + + SequenceFlow_07rma3l + SequenceFlow_07jnolr + + + SequenceFlow_18bpwal + SequenceFlow_1u9jrl1 + SequenceFlow_01cc25d + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +