diff options
author | Rob Daugherty <rd472p@att.com> | 2018-03-09 15:02:18 -0500 |
---|---|---|
committer | Rob Daugherty <rd472p@att.com> | 2018-03-09 15:08:14 -0500 |
commit | 96b5a685d0c3afddb632e4a68ca7483f933b55dc (patch) | |
tree | 246399de05a3d429bf45ef1e5af2b9b0218d99f3 /bpmn/MSOInfrastructureBPMN/src/test/java | |
parent | 4475278c81668109b2b37a1d2720d8f2910641c4 (diff) |
Revert Reduce log noise/warnings
This reverts commit 327b17ab250b4c17cf3f91f5e4cd9bffd89f3d1e.
It is seriously impeding our ability complete the promised merge of AT&T
1802 code.
While I'm all for coding standards, if we are serious about using spaces
instead of tabs, then I think we need to (1) agree with the community when
this will happen, (2) do consistently in all files, and (3) enforce it.
Change-Id: Ib9b996f6b6c7d81ac9ac95d58b0c7d8cc39675ff
Issue-ID: SO-368
Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/test/java')
42 files changed, 8346 insertions, 8337 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java index 314f8e9075..549664588e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateGenericALaCarteServiceInstanceTest.java @@ -49,81 +49,81 @@ import org.openecomp.mso.bpmn.mock.FileUtil; */ public class CreateGenericALaCarteServiceInstanceTest extends WorkflowTest { - private final CallbackSet callbacks = new CallbackSet(); - - public CreateGenericALaCarteServiceInstanceTest() throws IOException { - callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCSITopologyAssignCallback.xml")); - } - - /** - * Sunny day VID scenario. - * - * @throws Exception - */ - //@Ignore // File not found - unable to run the test. Also, Stubs need updating.. - @Test - @Deployment(resources = { - "process/CreateGenericALaCarteServiceInstance.bpmn", - "subprocess/DoCreateServiceInstance.bpmn", - "subprocess/DoCreateServiceInstanceRollback.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericPutService.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn"}) - public void sunnyDayAlaCarte() throws Exception { - - logStart(); - - //AAI - MockGetCustomer("MCBH-1610", "CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml"); - MockPutServiceInstance("MCBH-1610", "viprsvc", "RaaTest-1-id", ""); - MockGetServiceInstance("MCBH-1610", "viprsvc", "RaaTest-1-id", "GenericFlows/getServiceInstance.xml"); - MockNodeQueryServiceInstanceByName("RAATest-1", null); - MockNodeQueryServiceInstanceById("RaaTest-1-id", null); - //SDNC - mockSDNCAdapter(200); - //DB - mockUpdateRequestDB(200, "DBUpdateResponse.xml"); - - - String businessKey = UUID.randomUUID().toString(); - - //String createVfModuleRequest = FileUtil.readResourceFile("__files/SIRequest.json"); - - Map<String, String> variables = setupVariables(); - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateGenericALaCarteServiceInstance", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "WorkflowResponse"); - //assertNotNull(workflowResp); - System.out.println("Workflow (Synch) Response:\n" + workflowResp); - String workflowException = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "WorkflowException"); - String completionReq = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "completionRequest"); - System.out.println("completionReq:\n" + completionReq); - System.out.println("workflowException:\n" + workflowException); - assertNotNull(completionReq); - assertEquals(null, workflowException); - - - //injectSDNCCallbacks(callbacks, "assign"); - - logEnd(); - } - - // Success Scenario - private Map<String, String> setupVariables() { - Map<String, String> variables = new HashMap<>(); - variables.put("isDebugLogEnabled", "true"); - variables.put("bpmnRequest", getRequest()); - variables.put("mso-request-id", "RaaCSIRequestId-1"); - variables.put("serviceInstanceId", "RaaTest-1-id"); - return variables; - } - - public String getRequest() { - String request = "{\"requestDetails\":{\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelVersionUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"},\"subscriberInfo\":{\"globalSubscriberId\":\"MCBH-1610\",\"subscriberName\":\"Kaneohe\"},\"requestInfo\":{\"instanceName\":\"RAATest-1\",\"source\":\"VID\",\"suppressRollback\":\"true\",\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"mdt1\",\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\"},\"requestParameters\":{\"subscriptionServiceType\":\"viprsvc\",\"aLaCarte\":\"false\",\"userParams\":[]}}}"; - return request; - } + private final CallbackSet callbacks = new CallbackSet(); + + public CreateGenericALaCarteServiceInstanceTest() throws IOException { + callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCSITopologyAssignCallback.xml")); + } + + /** + * Sunny day VID scenario. + * + * @throws Exception + */ + //@Ignore // File not found - unable to run the test. Also, Stubs need updating.. + @Test + @Deployment(resources = { + "process/CreateGenericALaCarteServiceInstance.bpmn", + "subprocess/DoCreateServiceInstance.bpmn", + "subprocess/DoCreateServiceInstanceRollback.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/GenericPutService.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/FalloutHandler.bpmn" }) + public void sunnyDayAlaCarte() throws Exception { + + logStart(); + + //AAI + MockGetCustomer("MCBH-1610", "CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml"); + MockPutServiceInstance("MCBH-1610", "viprsvc", "RaaTest-1-id", ""); + MockGetServiceInstance("MCBH-1610", "viprsvc", "RaaTest-1-id", "GenericFlows/getServiceInstance.xml"); + MockNodeQueryServiceInstanceByName("RAATest-1", null); + MockNodeQueryServiceInstanceById("RaaTest-1-id", null); + //SDNC + mockSDNCAdapter(200); + //DB + mockUpdateRequestDB(200, "DBUpdateResponse.xml"); + + + String businessKey = UUID.randomUUID().toString(); + + //String createVfModuleRequest = FileUtil.readResourceFile("__files/SIRequest.json"); + + Map<String, String> variables = setupVariables(); + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateGenericALaCarteServiceInstance", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "WorkflowResponse"); + //assertNotNull(workflowResp); + System.out.println("Workflow (Synch) Response:\n" + workflowResp); + String workflowException = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "WorkflowException"); + String completionReq = BPMNUtil.getVariable(processEngineRule, "CreateGenericALaCarteServiceInstance", "completionRequest"); + System.out.println("completionReq:\n" + completionReq); + System.out.println("workflowException:\n" + workflowException); + assertNotNull(completionReq); + assertEquals(null, workflowException); + + + //injectSDNCCallbacks(callbacks, "assign"); + + logEnd(); + } + + // Success Scenario + private Map<String, String> setupVariables() { + Map<String, String> variables = new HashMap<>(); + variables.put("isDebugLogEnabled", "true"); + variables.put("bpmnRequest", getRequest()); + variables.put("mso-request-id", "RaaCSIRequestId-1"); + variables.put("serviceInstanceId","RaaTest-1-id"); + return variables; + } + + public String getRequest() { + String request = "{\"requestDetails\":{\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelVersionUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"},\"subscriberInfo\":{\"globalSubscriberId\":\"MCBH-1610\",\"subscriberName\":\"Kaneohe\"},\"requestInfo\":{\"instanceName\":\"RAATest-1\",\"source\":\"VID\",\"suppressRollback\":\"true\",\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"mdt1\",\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\"},\"requestParameters\":{\"subscriptionServiceType\":\"viprsvc\",\"aLaCarte\":\"false\",\"userParams\":[]}}}"; + return request; + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java index 32ed557b9b..b95ebb5fc7 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateNetworkInstanceTest.java @@ -27,7 +27,6 @@ import static org.openecomp.mso.bpmn.mock.StubResponseNetworkAdapter.MockNetwork // new mock methods import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapterTopology; import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter_500; - import org.openecomp.mso.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer; import static org.openecomp.mso.bpmn.common.BPMNUtil.executeAsyncWorkflow; @@ -50,616 +49,617 @@ import com.github.tomakehurst.wiremock.extension.ResponseTransformer; /** * Unit test cases for CreateNetworkInstance.bpmn + * */ public class CreateNetworkInstanceTest extends WorkflowTest { - @WorkflowTestTransformer - public static final ResponseTransformer sdncAdapterMockTransformer = - new SDNCAdapterNetworkTopologyMockTransformer(); - - @Rule - public final SDNCAdapterCallbackRule sdncAdapterCallbackRule = - new SDNCAdapterCallbackRule(processEngineRule); - - /** - * End-to-End flow - Unit test for CreateNetworkInstance.bpmn - * - String input & String response - */ - - - @Test - //@Ignore - @Deployment(resources = {"process/CreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstanceRollback.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceCreateNetworkInstance_vIPER_Success1() throws Exception { - - System.out.println("-----------------------------------------------------------------"); - System.out.println(" Success vIPER 1 - CreateNetworkInstance flow Started! "); - System.out.println("-----------------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign"); - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate"); - MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest"); - MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); - - Map<String, String> variables = setupVariables1(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - System.out.println("----------------------------------------------------------"); - System.out.println("- got workflow response -"); - System.out.println("----------------------------------------------------------"); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); - assertEquals("true", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); - Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest")); - - String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateNetworkInstance", "WorkflowResponse"); - Assert.assertNotNull(workflowResp); - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success vIPER 1 - CreateNetworkInstance flow Completed "); - System.out.println("----------------------------------------------------------"); - - } - - @Test - //@Ignore - @Deployment(resources = {"process/CreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstanceRollback.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceCreateNetworkInstance_vIPER_Success2() throws Exception { - - System.out.println("----------------------------------------------------------------"); - System.out.println(" Success viPER 2 - CreateNetworkInstance flow Started! "); - System.out.println("----------------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign"); - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate"); - MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest"); - MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); - - Map<String, String> variables = setupVariables2(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); - assertEquals("true", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); - Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest")); - - String completeMsoProcessRequest = - "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n' - + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n' - + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n' - + " <request-info>" + '\n' - + " <request-id>testRequestId</request-id>" + '\n' - + " <action>CREATE</action>" + '\n' - + " <source>VID</source>" + '\n' - + " </request-info>" + '\n' - + " <aetgt:status-message>Network has been created successfully.</aetgt:status-message>" + '\n' - + " <aetgt:mso-bpel-name>BPMN Network action: CREATE</aetgt:mso-bpel-name>" + '\n' - + "</aetgt:MsoCompletionRequest>"; - - Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest")); - - System.out.println("---------------------------------------------------------"); - System.out.println(" Success viPER 2 - CreateNetworkInstance flow Completed "); - System.out.println("---------------------------------------------------------"); - - } - - @Test - //@Ignore - @Deployment(resources = {"process/CreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstanceRollback.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceCreateNetworkInstance_VID_1610_Network_SDNC_Rollback() throws Exception { - - System.out.println("--------------------------------------------------------------------------"); - System.out.println(" Network and SDNC Rollback - CreateNetworkInstance flow Started! "); - System.out.println("--------------------------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>assign"); - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>rollback"); - MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest"); - MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); - MockNetworkAdapterRestRollbackDelete("deleteNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); - - Map<String, String> variables = setupVariablesVID1(); - executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); - assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); - Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest")); - - System.out.println("--------------------------------------------------------------------"); - System.out.println(" Network and SCNC Rollback - CreateNetworkInstance flow Completed "); - System.out.println("--------------------------------------------------------------------"); - - } - - @Test - //@Ignore - @Deployment(resources = {"process/CreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstanceRollback.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceCreateNetworkInstance_vIPER_1702_Network_SDNC_Rollback() throws Exception { - - System.out.println("--------------------------------------------------------------------------"); - System.out.println(" Network and SDNC Rollback - CreateNetworkInstance flow Started! "); - System.out.println("--------------------------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign"); - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>unassign"); - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate"); - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>deactivate"); - MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest"); - MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); - MockNetworkAdapterRestRollbackDelete("deleteNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); - - Map<String, String> variables = setupVariables1(); - executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); - assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); - Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest")); - - System.out.println("--------------------------------------------------------------------"); - System.out.println(" Network and SCNC Rollback - CreateNetworkInstance flow Completed "); - System.out.println("--------------------------------------------------------------------"); - - } - - @Test - //@Ignore - @Deployment(resources = {"process/CreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstanceRollback.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceCreateNetworkInstance_sdncFailure() throws Exception { - - System.out.println("----------------------------------------------------------------"); - System.out.println(" SNDC Failure - CreateNetworkInstance flow Started! "); - System.out.println("----------------------------------------------------------------"); - - // setup simulators - mockSDNCAdapter_500("SvcAction>query"); - MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); - - Map<String, String> variables = setupVariables2(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); - assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); - Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest")); - - System.out.println("---------------------------------------------------------"); - System.out.println(" SNDC Failure - CreateNetworkInstance flow Completed "); - System.out.println("---------------------------------------------------------"); - - } - - @Test - //@Ignore - @Deployment(resources = {"process/CreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstanceRollback.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceCreateNetworkInstance_queryServiceInstance404() throws Exception { - - System.out.println("----------------------------------------------------------------------------------"); - System.out.println(" Query ServiceIntance Not found - CreateNetworkInstance flow Started! "); - System.out.println("----------------------------------------------------------------------------------"); - - //setup simulators - mockSDNCAdapter_500("SvcAction>query"); - MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - MockNodeQueryServiceInstanceById_404("f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - - Map<String, String> variables = setupVariables2(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); - assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); - Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest")); - - System.out.println("---------------------------------------------------------------------------------"); - System.out.println(" Query ServiceIntance Not found - CreateNetworkInstance flow Completed "); - System.out.println("---------------------------------------------------------------------------------"); - - } - - @Test - //@Ignore - @Deployment(resources = {"process/CreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstance.bpmn", - "subprocess/DoCreateNetworkInstanceRollback.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceCreateNetworkInstance_VID_Success1() throws Exception { - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success VID1 - CreateNetworkInstance flow Started! "); - System.out.println("----------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>assign"); - MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest"); - MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); - - Map<String, String> variables = setupVariablesVID1(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); - System.out.println("----------------------------------------------------------"); - System.out.println("- got workflow response -"); - System.out.println("----------------------------------------------------------"); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); - Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest")); - - String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateNetworkInstance", "WorkflowResponse"); - Assert.assertNotNull(workflowResp); - - System.out.println("-----------------------------------------------------------"); - System.out.println(" Success VID1 - CreateNetworkInstanceInfra flow Completed "); - System.out.println("-----------------------------------------------------------"); - - } - - // ***************** - // Utility Section - // ***************** - - String networkModelInfo = - " {\"modelUuid\": \"mod-inst-uuid-123\", " + '\n' + - " \"modelName\": \"mod_inst_z_123\", " + '\n' + - " \"modelVersion\": \"mod-inst-uuid-123\", " + '\n' + - " \"modelCustomizationUuid\": \"z_network_123\", " + '\n' + - " \"modelInvariantUuid\": \"mod-invar-uuid-123\" " + '\n' + - " }"; - - String serviceModelInfo = - " {\"modelUuid\": \"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6\", " + '\n' + - " \"modelName\": \"HNGW Protected OAM\", " + '\n' + - " \"modelVersion\": \"1.0\", " + '\n' + - " \"modelInvariantUuid\": \"fcc85cb0-ad74-45d7-a5a1-17c8744fdb71\" " + '\n' + - " }"; - - // Success Scenario - private Map<String, String> setupVariables1() { - Map<String, String> variables = new HashMap<>(); - variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("msoRequestId", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("networkId", "networkId"); - variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_1"); - variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); - variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("disableRollback", "false"); // macro - variables.put("failIfExists", "false"); - variables.put("sdncVersion", "1702"); - variables.put("subscriptionServiceType", "MSO-dev-service-type"); - variables.put("globalSubscriberId", "globalId_45678905678"); - variables.put("networkModelInfo", networkModelInfo); - variables.put("serviceModelInfo", serviceModelInfo); - - - return variables; - - } - - // Success Scenario 2 - private Map<String, String> setupVariables2() { - Map<String, String> variables = new HashMap<>(); - variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("networkId", "networkId"); - variables.put("networkName", "myOwn_Network"); // Name Not found in AA&I - variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); - variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("disableRollback", "false"); // 1702 - variables.put("failIfExists", "false"); - //variables.put("sdncVersion", "1702"); - variables.put("sdncVersion", "1707"); - variables.put("subscriptionServiceType", "MSO-dev-service-type"); - variables.put("globalSubscriberId", "globalId_45678905678"); - variables.put("networkModelInfo", networkModelInfo); - variables.put("serviceModelInfo", serviceModelInfo); - - return variables; - - } - - // Active Scenario - private Map<String, String> setupVariablesActive() { - Map<String, String> variables = new HashMap<>(); - variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("networkId", "networkId"); - variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_2"); // Unique name for Active - variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); - variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("suppressRollback", "false"); - variables.put("disableRollback", "false"); - variables.put("failIfExists", "false"); - variables.put("sdncVersion", "1702"); - variables.put("subscriptionServiceType", "MSO-dev-service-type"); - variables.put("globalSubscriberId", "globalId_45678905678"); - variables.put("networkModelInfo", networkModelInfo); - variables.put("serviceModelInfo", serviceModelInfo); - - return variables; - - } - - // Missing Name Scenario - private Map<String, String> setupVariablesMissingName() { - Map<String, String> variables = new HashMap<>(); - //variables.put("bpmnRequest", getCreateNetworkRequestMissingName()); - variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("networkId", "networkId"); - // variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_2"); // Missing 'name' variable - // variables.put("networkName", ""); // Missing 'value' of name variable - variables.put("modelName", "CONTRAIL_EXTERNAL"); - variables.put("cloudConfiguration", "RDM2WAGPLCP"); - variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("suppressRollback", "true"); - variables.put("failIfExists", "false"); - - return variables; - - } - - // SDNC Rollback Scenario - private Map<String, String> setupVariablesSDNCRollback() { - Map<String, String> variables = new HashMap<>(); - variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("networkId", "networkId"); - variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_3"); // Unique name for Rollback - variables.put("modelName", "CONTRAIL_EXTERNAL"); - variables.put("cloudConfiguration", "RDM2WAGPLCP"); - variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("suppressRollback", "true"); - variables.put("disableRollback", "false"); - - return variables; - - } - - // old - public String getCreateNetworkRequestActive() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelId\": \"modelId\", " + '\n' + - " \"modelCustomizationUuid\": \"modelCustUuid\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_2\", " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"callbackUrl\": \"\", " + '\n' + - " \"suppressRollback\": \"false\" ," + '\n' + - " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"userParams\": [] " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - - return request; - - } - - public String getCreateNetworkRequestSDNCRollback() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelId\": \"modelId\", " + '\n' + - " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_3\", " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"callbackUrl\": \"\", " + '\n' + - " \"suppressRollback\": \"true\" ," + '\n' + - " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"userParams\": [] " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - - - return request; - } - - - // VID json input - private Map<String, String> setupVariablesVID1() { - Map<String, String> variables = new HashMap<>(); - variables.put("bpmnRequest", getCreateNetworkRequestVID1()); - variables.put("mso-request-id", "testRequestId"); - //variables.put("msoRequestId", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("isBaseVfModule", "true"); - variables.put("recipeTimeout", "0"); - variables.put("requestAction", "CREATE"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", ""); - variables.put("vfModuleId", ""); - variables.put("volumeGroupId", ""); - //variables.put("networkId", "networkId"); - variables.put("serviceType", "vMOG"); - variables.put("vfModuleType", ""); - variables.put("networkType", "modelName"); - - return variables; - - } - - public String getCreateNetworkRequestVID1() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1.0\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_1\", " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"callbackUrl\": \"\", " + '\n' + - " \"suppressRollback\": \"false\" ," + '\n' + - " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"backoutOnFailure\": false, " + '\n' + - " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' + - " \"userParams\": [] " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - - return request; - } + @WorkflowTestTransformer + public static final ResponseTransformer sdncAdapterMockTransformer = + new SDNCAdapterNetworkTopologyMockTransformer(); + + @Rule + public final SDNCAdapterCallbackRule sdncAdapterCallbackRule = + new SDNCAdapterCallbackRule(processEngineRule); + + /** + * End-to-End flow - Unit test for CreateNetworkInstance.bpmn + * - String input & String response + */ + + + @Test + //@Ignore + @Deployment(resources = {"process/CreateNetworkInstance.bpmn", + "subprocess/DoCreateNetworkInstance.bpmn", + "subprocess/DoCreateNetworkInstanceRollback.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceCreateNetworkInstance_vIPER_Success1() throws Exception { + + System.out.println("-----------------------------------------------------------------"); + System.out.println(" Success vIPER 1 - CreateNetworkInstance flow Started! "); + System.out.println("-----------------------------------------------------------------"); + + // setup simulators + mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign"); + mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate"); + MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest"); + MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml"); + MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); + MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); + MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); + MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); + MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1"); + MockUpdateRequestDB("DBUpdateResponse.xml"); + //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); + + Map<String, String> variables = setupVariables1(); + //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); + executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); + System.out.println("----------------------------------------------------------"); + System.out.println("- got workflow response -"); + System.out.println("----------------------------------------------------------"); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); + assertEquals("true", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); + Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest")); + + String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateNetworkInstance", "WorkflowResponse"); + Assert.assertNotNull(workflowResp); + + System.out.println("----------------------------------------------------------"); + System.out.println(" Success vIPER 1 - CreateNetworkInstance flow Completed "); + System.out.println("----------------------------------------------------------"); + + } + + @Test + //@Ignore + @Deployment(resources = {"process/CreateNetworkInstance.bpmn", + "subprocess/DoCreateNetworkInstance.bpmn", + "subprocess/DoCreateNetworkInstanceRollback.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceCreateNetworkInstance_vIPER_Success2() throws Exception { + + System.out.println("----------------------------------------------------------------"); + System.out.println(" Success viPER 2 - CreateNetworkInstance flow Started! "); + System.out.println("----------------------------------------------------------------"); + + // setup simulators + mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign"); + mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate"); + MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest"); + MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network"); + MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); + MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); + MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); + MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); + MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1"); + MockUpdateRequestDB("DBUpdateResponse.xml"); + //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); + + Map<String, String> variables = setupVariables2(); + //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); + executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); + assertEquals("true", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); + Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest")); + + String completeMsoProcessRequest = + "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n' + + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n' + + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n' + + " <request-info>" + '\n' + + " <request-id>testRequestId</request-id>" + '\n' + + " <action>CREATE</action>" + '\n' + + " <source>VID</source>" + '\n' + + " </request-info>" + '\n' + + " <aetgt:status-message>Network has been created successfully.</aetgt:status-message>" + '\n' + + " <aetgt:mso-bpel-name>BPMN Network action: CREATE</aetgt:mso-bpel-name>" + '\n' + + "</aetgt:MsoCompletionRequest>"; + + Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest")); + + System.out.println("---------------------------------------------------------"); + System.out.println(" Success viPER 2 - CreateNetworkInstance flow Completed "); + System.out.println("---------------------------------------------------------"); + + } + + @Test + //@Ignore + @Deployment(resources = {"process/CreateNetworkInstance.bpmn", + "subprocess/DoCreateNetworkInstance.bpmn", + "subprocess/DoCreateNetworkInstanceRollback.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceCreateNetworkInstance_VID_1610_Network_SDNC_Rollback() throws Exception { + + System.out.println("--------------------------------------------------------------------------"); + System.out.println(" Network and SDNC Rollback - CreateNetworkInstance flow Started! "); + System.out.println("--------------------------------------------------------------------------"); + + // setup simulators + mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>assign"); + mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>rollback"); + MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest"); + MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml"); + MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); + MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); + MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); + MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); + MockUpdateRequestDB("DBUpdateResponse.xml"); + //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); + MockNetworkAdapterRestRollbackDelete("deleteNetworkResponse_Success.xml","49c86598-f766-46f8-84f8-8d1c1b10f9b4"); + + Map<String, String> variables = setupVariablesVID1(); + executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); + //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); + assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); + Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest")); + + System.out.println("--------------------------------------------------------------------"); + System.out.println(" Network and SCNC Rollback - CreateNetworkInstance flow Completed "); + System.out.println("--------------------------------------------------------------------"); + + } + + @Test + //@Ignore + @Deployment(resources = {"process/CreateNetworkInstance.bpmn", + "subprocess/DoCreateNetworkInstance.bpmn", + "subprocess/DoCreateNetworkInstanceRollback.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceCreateNetworkInstance_vIPER_1702_Network_SDNC_Rollback() throws Exception { + + System.out.println("--------------------------------------------------------------------------"); + System.out.println(" Network and SDNC Rollback - CreateNetworkInstance flow Started! "); + System.out.println("--------------------------------------------------------------------------"); + + // setup simulators + mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologyRsrcAssignResponse.xml", "SvcAction>assign"); + mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>unassign"); + mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate"); + mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>deactivate"); + MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest"); + MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml"); + MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); + MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); + MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); + MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); + MockUpdateRequestDB("DBUpdateResponse.xml"); + //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); + MockNetworkAdapterRestRollbackDelete("deleteNetworkResponse_Success.xml","49c86598-f766-46f8-84f8-8d1c1b10f9b4"); + + Map<String, String> variables = setupVariables1(); + executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); + //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); + assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); + Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest")); + + System.out.println("--------------------------------------------------------------------"); + System.out.println(" Network and SCNC Rollback - CreateNetworkInstance flow Completed "); + System.out.println("--------------------------------------------------------------------"); + + } + + @Test + //@Ignore + @Deployment(resources = {"process/CreateNetworkInstance.bpmn", + "subprocess/DoCreateNetworkInstance.bpmn", + "subprocess/DoCreateNetworkInstanceRollback.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceCreateNetworkInstance_sdncFailure() throws Exception { + + System.out.println("----------------------------------------------------------------"); + System.out.println(" SNDC Failure - CreateNetworkInstance flow Started! "); + System.out.println("----------------------------------------------------------------"); + + // setup simulators + mockSDNCAdapter_500("SvcAction>query"); + MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network"); + MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); + MockUpdateRequestDB("DBUpdateResponse.xml"); + //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); + + Map<String, String> variables = setupVariables2(); + //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); + executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); + assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); + Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest")); + + System.out.println("---------------------------------------------------------"); + System.out.println(" SNDC Failure - CreateNetworkInstance flow Completed "); + System.out.println("---------------------------------------------------------"); + + } + + @Test + //@Ignore + @Deployment(resources = {"process/CreateNetworkInstance.bpmn", + "subprocess/DoCreateNetworkInstance.bpmn", + "subprocess/DoCreateNetworkInstanceRollback.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceCreateNetworkInstance_queryServiceInstance404() throws Exception { + + System.out.println("----------------------------------------------------------------------------------"); + System.out.println(" Query ServiceIntance Not found - CreateNetworkInstance flow Started! "); + System.out.println("----------------------------------------------------------------------------------"); + + //setup simulators + mockSDNCAdapter_500("SvcAction>query"); + MockGetNetworkByName_404("CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml", "myOwn_Network"); + MockUpdateRequestDB("DBUpdateResponse.xml"); + MockNodeQueryServiceInstanceById_404("f70e927b-6087-4974-9ef8-c5e4d5847ca4"); + + Map<String, String> variables = setupVariables2(); + //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); + executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("false", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); + assertEquals("false", getVariable(processEngineRule, "DoCreateNetworkInstance", "CRENWKI_Success")); + Assert.assertNotNull("CRENI_FalloutHandlerRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_FalloutHandlerRequest")); + + System.out.println("---------------------------------------------------------------------------------"); + System.out.println(" Query ServiceIntance Not found - CreateNetworkInstance flow Completed "); + System.out.println("---------------------------------------------------------------------------------"); + + } + + @Test + //@Ignore + @Deployment(resources = {"process/CreateNetworkInstance.bpmn", + "subprocess/DoCreateNetworkInstance.bpmn", + "subprocess/DoCreateNetworkInstanceRollback.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceCreateNetworkInstance_VID_Success1() throws Exception { + + System.out.println("----------------------------------------------------------"); + System.out.println(" Success VID1 - CreateNetworkInstance flow Started! "); + System.out.println("----------------------------------------------------------"); + + // setup simulators + mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>assign"); + MockNetworkAdapterPost("CreateNetworkV2/createNetworkResponse_Success.xml", "createNetworkRequest"); + MockGetNetworkByName("MNS-25180-L-01-dmz_direct_net_1", "CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml"); + MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); + MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + MockGetNetworkVpnBinding("CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + MockGetNetworkPolicy("CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); + MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); + MockGetNetworkTableReference("CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); + MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1"); + MockUpdateRequestDB("DBUpdateResponse.xml"); + //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml", "v8"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "CreateNetworkV2/createNetwork_queryInstance_Success.xml"); + + Map<String, String> variables = setupVariablesVID1(); + //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); + executeAsyncWorkflow(processEngineRule, "CreateNetworkInstance", variables); + System.out.println("----------------------------------------------------------"); + System.out.println("- got workflow response -"); + System.out.println("----------------------------------------------------------"); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("true", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_Success")); + Assert.assertNotNull("CRENI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "CreateNetworkInstance", "CRENI_CompleteMsoProcessRequest")); + + String workflowResp = BPMNUtil.getVariable(processEngineRule, "CreateNetworkInstance", "WorkflowResponse"); + Assert.assertNotNull(workflowResp); + + System.out.println("-----------------------------------------------------------"); + System.out.println(" Success VID1 - CreateNetworkInstanceInfra flow Completed "); + System.out.println("-----------------------------------------------------------"); + + } + + // ***************** + // Utility Section + // ***************** + + String networkModelInfo = + " {\"modelUuid\": \"mod-inst-uuid-123\", " + '\n' + + " \"modelName\": \"mod_inst_z_123\", " + '\n' + + " \"modelVersion\": \"mod-inst-uuid-123\", " + '\n' + + " \"modelCustomizationUuid\": \"z_network_123\", " + '\n' + + " \"modelInvariantUuid\": \"mod-invar-uuid-123\" " + '\n' + + " }"; + + String serviceModelInfo = + " {\"modelUuid\": \"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6\", " + '\n' + + " \"modelName\": \"HNGW Protected OAM\", " + '\n' + + " \"modelVersion\": \"1.0\", " + '\n' + + " \"modelInvariantUuid\": \"fcc85cb0-ad74-45d7-a5a1-17c8744fdb71\" " + '\n' + + " }"; + + // Success Scenario + private Map<String, String> setupVariables1() { + Map<String, String> variables = new HashMap<>(); + variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); + variables.put("msoRequestId", "testRequestId"); + variables.put("requestId", "testRequestId"); + variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); + variables.put("networkId", "networkId"); + variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_1"); + variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); + variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); + variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + variables.put("disableRollback", "false"); // macro + variables.put("failIfExists", "false"); + variables.put("sdncVersion", "1702"); + variables.put("subscriptionServiceType", "MSO-dev-service-type"); + variables.put("globalSubscriberId", "globalId_45678905678"); + variables.put("networkModelInfo", networkModelInfo); + variables.put("serviceModelInfo", serviceModelInfo); + + + return variables; + + } + + // Success Scenario 2 + private Map<String, String> setupVariables2() { + Map<String, String> variables = new HashMap<>(); + variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); + variables.put("networkId", "networkId"); + variables.put("networkName", "myOwn_Network"); // Name Not found in AA&I + variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); + variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); + variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + variables.put("disableRollback", "false"); // 1702 + variables.put("failIfExists", "false"); + //variables.put("sdncVersion", "1702"); + variables.put("sdncVersion", "1707"); + variables.put("subscriptionServiceType", "MSO-dev-service-type"); + variables.put("globalSubscriberId", "globalId_45678905678"); + variables.put("networkModelInfo", networkModelInfo); + variables.put("serviceModelInfo", serviceModelInfo); + + return variables; + + } + + // Active Scenario + private Map<String, String> setupVariablesActive() { + Map<String, String> variables = new HashMap<>(); + variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); + variables.put("networkId", "networkId"); + variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_2"); // Unique name for Active + variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); + variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); + variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + variables.put("suppressRollback", "false"); + variables.put("disableRollback", "false"); + variables.put("failIfExists", "false"); + variables.put("sdncVersion", "1702"); + variables.put("subscriptionServiceType", "MSO-dev-service-type"); + variables.put("globalSubscriberId", "globalId_45678905678"); + variables.put("networkModelInfo", networkModelInfo); + variables.put("serviceModelInfo", serviceModelInfo); + + return variables; + + } + + // Missing Name Scenario + private Map<String, String> setupVariablesMissingName() { + Map<String, String> variables = new HashMap<>(); + //variables.put("bpmnRequest", getCreateNetworkRequestMissingName()); + variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); + variables.put("networkId", "networkId"); + // variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_2"); // Missing 'name' variable + // variables.put("networkName", ""); // Missing 'value' of name variable + variables.put("modelName", "CONTRAIL_EXTERNAL"); + variables.put("cloudConfiguration", "RDM2WAGPLCP"); + variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); + variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + variables.put("suppressRollback", "true"); + variables.put("failIfExists", "false"); + + return variables; + + } + + // SDNC Rollback Scenario + private Map<String, String> setupVariablesSDNCRollback() { + Map<String, String> variables = new HashMap<>(); + variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); + variables.put("networkId", "networkId"); + variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_3"); // Unique name for Rollback + variables.put("modelName", "CONTRAIL_EXTERNAL"); + variables.put("cloudConfiguration", "RDM2WAGPLCP"); + variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); + variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + variables.put("suppressRollback", "true"); + variables.put("disableRollback", "false"); + + return variables; + + } + + // old + public String getCreateNetworkRequestActive() { + + String request = + "{ \"requestDetails\": { " + '\n' + + " \"modelInfo\": { " + '\n' + + " \"modelType\": \"modelType\", " + '\n' + + " \"modelId\": \"modelId\", " + '\n' + + " \"modelCustomizationUuid\": \"modelCustUuid\", " + '\n' + + " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + + " \"modelVersion\": \"1\" " + '\n' + + " }, " + '\n' + + " \"cloudConfiguration\": { " + '\n' + + " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + + " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + + " }, " + '\n' + + " \"requestInfo\": { " + '\n' + + " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_2\", " + '\n' + + " \"source\": \"VID\", " + '\n' + + " \"callbackUrl\": \"\", " + '\n' + + " \"suppressRollback\": \"false\" ," + '\n' + + " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + + " }, " + '\n' + + " \"requestParameters\": { " + '\n' + + " \"userParams\": [] " + '\n' + + " } " + '\n' + + " } " + '\n' + + "}"; + + return request; + + } + + public String getCreateNetworkRequestSDNCRollback() { + + String request = + "{ \"requestDetails\": { " + '\n' + + " \"modelInfo\": { " + '\n' + + " \"modelType\": \"modelType\", " + '\n' + + " \"modelId\": \"modelId\", " + '\n' + + " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' + + " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + + " \"modelVersion\": \"1\" " + '\n' + + " }, " + '\n' + + " \"cloudConfiguration\": { " + '\n' + + " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + + " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + + " }, " + '\n' + + " \"requestInfo\": { " + '\n' + + " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_3\", " + '\n' + + " \"source\": \"VID\", " + '\n' + + " \"callbackUrl\": \"\", " + '\n' + + " \"suppressRollback\": \"true\" ," + '\n' + + " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + + " }, " + '\n' + + " \"requestParameters\": { " + '\n' + + " \"userParams\": [] " + '\n' + + " } " + '\n' + + " } " + '\n' + + "}"; + + + return request; + } + + + // VID json input + private Map<String, String> setupVariablesVID1() { + Map<String, String> variables = new HashMap<>(); + variables.put("bpmnRequest", getCreateNetworkRequestVID1()); + variables.put("mso-request-id", "testRequestId"); + //variables.put("msoRequestId", "testRequestId"); + variables.put("requestId", "testRequestId"); + variables.put("isBaseVfModule", "true"); + variables.put("recipeTimeout", "0"); + variables.put("requestAction", "CREATE"); + variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); + variables.put("vnfId", ""); + variables.put("vfModuleId", ""); + variables.put("volumeGroupId", ""); + //variables.put("networkId", "networkId"); + variables.put("serviceType", "vMOG"); + variables.put("vfModuleType", ""); + variables.put("networkType", "modelName"); + + return variables; + + } + + public String getCreateNetworkRequestVID1() { + + String request = + "{ \"requestDetails\": { " + '\n' + + " \"modelInfo\": { " + '\n' + + " \"modelType\": \"modelType\", " + '\n' + + " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' + + " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + + " \"modelVersion\": \"1.0\" " + '\n' + + " }, " + '\n' + + " \"cloudConfiguration\": { " + '\n' + + " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + + " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + + " }, " + '\n' + + " \"requestInfo\": { " + '\n' + + " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_1\", " + '\n' + + " \"source\": \"VID\", " + '\n' + + " \"callbackUrl\": \"\", " + '\n' + + " \"suppressRollback\": \"false\" ," + '\n' + + " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + + " }, " + '\n' + + " \"requestParameters\": { " + '\n' + + " \"backoutOnFailure\": false, " + '\n' + + " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' + + " \"userParams\": [] " + '\n' + + " } " + '\n' + + " } " + '\n' + + "}"; + + return request; + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java index a4d92a9b5b..a28e95ad0d 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -31,7 +31,6 @@ import java.io.IOException; import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import org.junit.Ignore;
import org.camunda.bpm.engine.test.Deployment;
import org.junit.Test;
@@ -43,250 +42,250 @@ import org.openecomp.mso.bpmn.mock.FileUtil; * Unit test cases for CreateVfModuleInfra.bpmn
*/
public class CreateVfModuleInfraTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public CreateVfModuleInfraTest() throws IOException {
- callbacks.put("assign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfCreate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
- }
-
-
- /**
- * Sunny day VID scenario with preloads.
- *
- * @throws Exception
- */
- @Test
- @Deployment(resources = {
- "process/CreateVfModuleInfra.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
- public void sunnyDayVIDWithPreloads() throws Exception {
-
- logStart();
-
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- MockSDNCAdapterVfModule();
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleRequest =
- FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
- "v1", businessKey, createVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "assign, query");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
-
- logEnd();
- }
-
- /**
- * Sunny day VID scenario with no preloads.
- *
- * @throws Exception
- */
- @Test
- @Deployment(resources = {
- "process/CreateVfModuleInfra.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
- public void sunnyDayVIDNoPreloads() throws Exception {
-
- logStart();
-
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- MockSDNCAdapterVfModule();
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleRequest =
- FileUtil.readResourceFile("__files/CreateVfModule_VID_request_noPreloads.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
- "v1", businessKey, createVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "assign, query");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- //variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", false);
- variables.put("isDebugLogEnabled", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "CREATE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfType", "vSAMP12");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- return variables;
-
- }
-
- /**
- * Sunny day VID with volume attach scenario.
- *
- * @throws Exception
- */
- @Test
- @Ignore
- @Deployment(resources = {
- "process/CreateVfModuleInfra.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
-
- public void sunnyDayVIDWithVolumeGroupAttach() throws Exception {
-
- logStart();
-
-
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- MockSDNCAdapterVfModule();
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleRequest =
- FileUtil.readResourceFile("__files/CreateVfModuleVolumeGroup_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVIDWVolumeAttach();
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
- "v1", businessKey, createVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "assign, query");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVIDWVolumeAttach() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", false);
- variables.put("isDebugLogEnabled", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "CREATE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfType", "vSAMP12");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "78987");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- return variables;
-
- }
-
-
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public CreateVfModuleInfraTest() throws IOException {
+ callbacks.put("assign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("vnfCreate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
+ }
+
+
+ /**
+ * Sunny day VID scenario with preloads.
+ *
+ * @throws Exception
+ */
+ @Test
+ @Deployment(resources = {
+ "process/CreateVfModuleInfra.bpmn",
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericNotificationService.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn"
+ })
+ public void sunnyDayVIDWithPreloads() throws Exception {
+
+ logStart();
+
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ MockSDNCAdapterVfModule();
+ MockVNFAdapterRestVfModule();
+ MockDBUpdateVfModule();
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleRequest =
+ FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json");
+
+ Map<String, Object> variables = setupVariablesSunnyDayVID();
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
+ "v1", businessKey, createVfModuleRequest, variables);
+
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectSDNCCallbacks(callbacks, "assign, query");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ // TODO add appropriate assertions
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
+
+ logEnd();
+ }
+
+ /**
+ * Sunny day VID scenario with no preloads.
+ *
+ * @throws Exception
+ */
+ @Test
+ @Deployment(resources = {
+ "process/CreateVfModuleInfra.bpmn",
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/GenericNotificationService.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn"
+ })
+ public void sunnyDayVIDNoPreloads() throws Exception {
+
+ logStart();
+
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ MockSDNCAdapterVfModule();
+ MockVNFAdapterRestVfModule();
+ MockDBUpdateVfModule();
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleRequest =
+ FileUtil.readResourceFile("__files/CreateVfModule_VID_request_noPreloads.json");
+
+ Map<String, Object> variables = setupVariablesSunnyDayVID();
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
+ "v1", businessKey, createVfModuleRequest, variables);
+
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectSDNCCallbacks(callbacks, "assign, query");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ // TODO add appropriate assertions
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
+
+ logEnd();
+ }
+
+ // Active Scenario
+ private Map<String, Object> setupVariablesSunnyDayVID() {
+ Map<String, Object> variables = new HashMap<>();
+ //try {
+ //variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
+ //}
+ //catch (Exception e) {
+
+ //}
+ //variables.put("mso-request-id", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isBaseVfModule", false);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("recipeTimeout", "0");
+ variables.put("requestAction", "CREATE_VF_MODULE");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "skask");
+ variables.put("vnfType", "vSAMP12");
+ variables.put("vfModuleId", "");
+ variables.put("volumeGroupId", "");
+ variables.put("serviceType", "MOG");
+ variables.put("vfModuleType", "");
+ return variables;
+
+ }
+
+ /**
+ * Sunny day VID with volume attach scenario.
+ *
+ * @throws Exception
+ */
+ @Test
+ @Ignore
+ @Deployment(resources = {
+ "process/CreateVfModuleInfra.bpmn",
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
+ "subprocess/GenericNotificationService.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn"
+ })
+
+ public void sunnyDayVIDWithVolumeGroupAttach() throws Exception {
+
+ logStart();
+
+
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ MockSDNCAdapterVfModule();
+ MockVNFAdapterRestVfModule();
+ MockDBUpdateVfModule();
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleRequest =
+ FileUtil.readResourceFile("__files/CreateVfModuleVolumeGroup_VID_request.json");
+
+ Map<String, Object> variables = setupVariablesSunnyDayVIDWVolumeAttach();
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleInfra",
+ "v1", businessKey, createVfModuleRequest, variables);
+
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectSDNCCallbacks(callbacks, "assign, query");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ // TODO add appropriate assertions
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "CreateVfModuleSuccessIndicator", true);
+
+ logEnd();
+ }
+
+ // Active Scenario
+ private Map<String, Object> setupVariablesSunnyDayVIDWVolumeAttach() {
+ Map<String, Object> variables = new HashMap<>();
+ //try {
+ // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
+ //}
+ //catch (Exception e) {
+
+ //}
+ //variables.put("mso-request-id", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isBaseVfModule", false);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("recipeTimeout", "0");
+ variables.put("requestAction", "CREATE_VF_MODULE");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "skask");
+ variables.put("vnfType", "vSAMP12");
+ variables.put("vfModuleId", "");
+ variables.put("volumeGroupId", "78987");
+ variables.put("serviceType", "MOG");
+ variables.put("vfModuleType", "");
+ return variables;
+
+ }
+
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java index a5f51a8a57..23999c99ad 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= - */ + */ package org.openecomp.mso.bpmn.infrastructure; @@ -48,321 +48,321 @@ import org.openecomp.mso.bpmn.mock.StubResponseAAI; public class CreateVfModuleVolumeInfraV1Test extends WorkflowTest { - public static final String _prefix = "CVFMODVOL2_"; - - private final CallbackSet callbacks = new CallbackSet(); - - public CreateVfModuleVolumeInfraV1Test() throws IOException { - callbacks.put("volumeGroupCreate", FileUtil.readResourceFile( - "__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml")); - callbacks.put("volumeGroupDelete", FileUtil.readResourceFile( - "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml")); - callbacks.put("volumeGroupException", FileUtil.readResourceFile( - "__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml")); - callbacks.put("volumeGroupRollback", FileUtil.readResourceFile( - "__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml")); - } - - /** - * Happy path scenario for VID - *****************************/ - @Test - //@Ignore - @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/DoCreateVfModuleVolumeV2.bpmn", + public static final String _prefix = "CVFMODVOL2_"; + + private final CallbackSet callbacks = new CallbackSet(); + + public CreateVfModuleVolumeInfraV1Test() throws IOException { + callbacks.put("volumeGroupCreate", FileUtil.readResourceFile( + "__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml")); + callbacks.put("volumeGroupDelete", FileUtil.readResourceFile( + "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml")); + callbacks.put("volumeGroupException", FileUtil.readResourceFile( + "__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml")); + callbacks.put("volumeGroupRollback", FileUtil.readResourceFile( + "__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml")); + } + + /** + * Happy path scenario for VID + *****************************/ + @Test + //@Ignore + @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/DoCreateVfModuleVolumeV2.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn", "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestSuccess() throws Exception { - - logStart(); - - MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); - MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200); - MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201); - MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200); - MockPutVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml", 200); - mockPostVNFVolumeGroup(202); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); - - Map<String, Object> testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - testVariables.put("vnfId", "TEST-VNF-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - - String responseBody = response.getResponse(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", true); - - logEnd(); - } - - /** - * Fail - trigger rollback - *****************************/ - @Test - //@Ignore - @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/DoCreateVfModuleVolumeV2.bpmn", - "subprocess/DoCreateVfModuleVolumeRollback.bpmn", + public void TestSuccess() throws Exception { + + logStart(); + + MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); + MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200); + MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201); + MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200); + MockPutVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml", 200); + mockPostVNFVolumeGroup(202); + + String businessKey = UUID.randomUUID().toString(); + String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); + + Map<String, Object> testVariables = new HashMap<>(); + testVariables.put("requestId", "TEST-REQUEST-ID-0123"); + testVariables.put("serviceInstanceId", "test-service-instance-id"); + testVariables.put("vnfId", "TEST-VNF-ID-0123"); + testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); + testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); + + TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); + WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); + + String responseBody = response.getResponse(); + System.out.println("Workflow (Synch) Response:\n" + responseBody); + + injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); + + waitForProcessEnd(businessKey, 100000); + checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", true); + + logEnd(); + } + + /** + * Fail - trigger rollback + *****************************/ + @Test + //@Ignore + @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/DoCreateVfModuleVolumeV2.bpmn", + "subprocess/DoCreateVfModuleVolumeRollback.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn", "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestRollback() throws Exception { - - logStart(); - - MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); - MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200); - MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201); - mockPostVNFVolumeGroup(202); - mockPutVNFVolumeGroupRollback("TEST-VOLUME-GROUP-ID-0123", 202); - MockDeleteVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360", 202); - StubResponseAAI.MockGetVolumeGroupByName_404("AAIAIC25", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - StubResponseAAI.MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200); - StubResponseAAI.MockDeleteVolumeGroup("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360"); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); - - Map<String, Object> testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - testVariables.put("vnfId", "TEST-VNF-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - - String responseBody = response.getResponse(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); - injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); - - logEnd(); - } - - /** - * Happy path scenario for VID - *****************************/ - @Test - @Ignore - @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/DoCreateVfModuleVolumeV1.bpmn", + public void TestRollback() throws Exception { + + logStart(); + + MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); + MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200); + MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201); + mockPostVNFVolumeGroup(202); + mockPutVNFVolumeGroupRollback("TEST-VOLUME-GROUP-ID-0123", 202); + MockDeleteVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360", 202); + StubResponseAAI.MockGetVolumeGroupByName_404("AAIAIC25", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); + StubResponseAAI.MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200); + StubResponseAAI.MockDeleteVolumeGroup("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360"); + + String businessKey = UUID.randomUUID().toString(); + String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); + + Map<String, Object> testVariables = new HashMap<>(); + testVariables.put("requestId", "TEST-REQUEST-ID-0123"); + testVariables.put("serviceInstanceId", "test-service-instance-id"); + testVariables.put("vnfId", "TEST-VNF-ID-0123"); + testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); + testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); + + TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); + WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); + + String responseBody = response.getResponse(); + System.out.println("Workflow (Synch) Response:\n" + responseBody); + + injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); + injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); + + waitForProcessEnd(businessKey, 100000); + checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); + + logEnd(); + } + + /** + * Happy path scenario for VID + *****************************/ + @Test + @Ignore + @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/DoCreateVfModuleVolumeV1.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn", "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestVolumeGroupAlreadyExists() throws Exception { - - logStart(); - - MockGetVolumeGroupByName("AAIAIC25", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200); - MockGetGenericVnfById("TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200); - MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); - - Map<String, Object> testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - testVariables.put("vnfId", "TEST-VNF-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - - String responseBody = response.getResponse(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - //injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); - - logEnd(); - } - - /** - * Vnf Create fail - *****************************/ - @Test - @Ignore - @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/DoCreateVfModuleVolumeV1.bpmn", + public void TestVolumeGroupAlreadyExists() throws Exception { + + logStart(); + + MockGetVolumeGroupByName("AAIAIC25", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200); + MockGetGenericVnfById("TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200); + MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); + + String businessKey = UUID.randomUUID().toString(); + String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); + + Map<String, Object> testVariables = new HashMap<>(); + testVariables.put("requestId", "TEST-REQUEST-ID-0123"); + testVariables.put("serviceInstanceId", "test-service-instance-id"); + testVariables.put("vnfId", "TEST-VNF-ID-0123"); + testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); + testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); + + TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); + WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); + + String responseBody = response.getResponse(); + System.out.println("Workflow (Synch) Response:\n" + responseBody); + + //injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); + + waitForProcessEnd(businessKey, 100000); + checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); + + logEnd(); + } + + /** + *Vnf Create fail + *****************************/ + @Test + @Ignore + @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/DoCreateVfModuleVolumeV1.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn", "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestVNfCreateFail() throws Exception { - - logStart(); - - MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); - MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200); - MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201); - MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200); - MockPutVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml", 200); - mockPostVNFVolumeGroup(202); - MockDeleteVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360", 204); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); - - Map<String, Object> testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - testVariables.put("vnfId", "TEST-VNF-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - - String responseBody = response.getResponse(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectVNFRestCallbacks(callbacks, "volumeGroupException"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); - - logEnd(); - } - - - /** - * Error scenario - vnf not found - ********************************/ - @Test - @Ignore - @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/DoCreateVfModuleVolumeV1.bpmn", + public void TestVNfCreateFail() throws Exception { + + logStart(); + + MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); + MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200); + MockPutVolumeGroupById("AAIAIC25", "TEST-VOLUME-GROUP-ID-0123", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml", 201); + MockGetVolumeGroupByName("AAIAIC25", "MSOTESTVOL101a-vSAMP12_base_vol_module-0", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml", 200); + MockPutVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml", 200); + mockPostVNFVolumeGroup(202); + MockDeleteVolumeGroupById("AAIAIC25", "8424bb3c-c3e7-4553-9662-469649ed9379", "1460134360", 204); + + String businessKey = UUID.randomUUID().toString(); + String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); + + Map<String, Object> testVariables = new HashMap<>(); + testVariables.put("requestId", "TEST-REQUEST-ID-0123"); + testVariables.put("serviceInstanceId", "test-service-instance-id"); + testVariables.put("vnfId", "TEST-VNF-ID-0123"); + testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); + testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123"); + + TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); + WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); + + String responseBody = response.getResponse(); + System.out.println("Workflow (Synch) Response:\n" + responseBody); + + injectVNFRestCallbacks(callbacks, "volumeGroupException"); + + waitForProcessEnd(businessKey, 100000); + checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); + + logEnd(); + } + + + /** + * Error scenario - vnf not found + ********************************/ + @Test + @Ignore + @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/DoCreateVfModuleVolumeV1.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn", "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestFailVnfNotFound() throws Exception { - - logStart(); - - MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json"); - - Map<String, Object> testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - testVariables.put("vnfId", "TEST-VNF-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - - String responseBody = response.getResponse(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - //injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); - - logEnd(); - } - - /** - * Error scenario - error in validation - **************************************/ - @Test - @Ignore - @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/DoCreateVfModuleVolumeV1.bpmn", + public void TestFailVnfNotFound() throws Exception { + + logStart(); + + MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); + + String businessKey = UUID.randomUUID().toString(); + String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json"); + + Map<String, Object> testVariables = new HashMap<>(); + testVariables.put("requestId", "TEST-REQUEST-ID-0123"); + testVariables.put("serviceInstanceId", "test-service-instance-id"); + testVariables.put("vnfId", "TEST-VNF-ID-0123"); + testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); + + TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); + WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); + + String responseBody = response.getResponse(); + System.out.println("Workflow (Synch) Response:\n" + responseBody); + + //injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); + + waitForProcessEnd(businessKey, 100000); + checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); + + logEnd(); + } + + /** + * Error scenario - error in validation + **************************************/ + @Test + @Ignore + @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/DoCreateVfModuleVolumeV1.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn", "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestFailNoVnfPassed() throws Exception { - - logStart(); - - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); - - Map<String, Object> testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - //testVariables.put("vnfId", "TEST-VNF-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - - String responseBody = response.getResponse(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); - - logEnd(); - } - - /** - * Error scenario - service instance not found - *********************************************/ - @Test - @Ignore - @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/DoCreateVfModuleVolumeV1.bpmn", + public void TestFailNoVnfPassed() throws Exception { + + logStart(); + + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); + + Map<String, Object> testVariables = new HashMap<>(); + testVariables.put("requestId", "TEST-REQUEST-ID-0123"); + testVariables.put("serviceInstanceId", "test-service-instance-id"); + //testVariables.put("vnfId", "TEST-VNF-ID-0123"); + testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); + + TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); + WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); + + String responseBody = response.getResponse(); + System.out.println("Workflow (Synch) Response:\n" + responseBody); + waitForProcessEnd(businessKey, 100000); + checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); + + logEnd(); + } + + /** + * Error scenario - service instance not found + *********************************************/ + @Test + @Ignore + @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/DoCreateVfModuleVolumeV1.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn", "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestFailServiceInstanceNotFound() throws Exception { - - logStart(); - - MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); - - Map<String, Object> testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("serviceInstanceId", "test-service-instance-id"); - //testVariables.put("vnfId", "TEST-VNF-ID-0123"); - testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); - - String responseBody = response.getResponse(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); - - logEnd(); - } + public void TestFailServiceInstanceNotFound() throws Exception { + + logStart(); + + MockNodeQueryServiceInstanceById("test-service-instance-id", "CreateVfModuleVolumeInfraV1/getSIUrlById.xml"); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + String createVfModuleVolRequest = FileUtil.readResourceFile("__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json"); + + Map<String, Object> testVariables = new HashMap<>(); + testVariables.put("requestId", "TEST-REQUEST-ID-0123"); + testVariables.put("serviceInstanceId", "test-service-instance-id"); + //testVariables.put("vnfId", "TEST-VNF-ID-0123"); + testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0"); + + TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVfModuleVolumeInfraV1", "v1", businessKey, createVfModuleVolRequest, testVariables); + WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 1000000); + + String responseBody = response.getResponse(); + System.out.println("Workflow (Synch) Response:\n" + responseBody); + waitForProcessEnd(businessKey, 100000); + checkVariable(businessKey, "CVMVINFRAV1_SuccessIndicator", false); + + logEnd(); + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java index 1c64dd7952..d5f94965fe 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java @@ -19,7 +19,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= - */ + */ package org.openecomp.mso.bpmn.infrastructure; @@ -56,168 +56,168 @@ import org.openecomp.mso.bpmn.mock.FileUtil; */ public class CreateVnfInfraTest extends WorkflowTest { - private String createVnfInfraRequest; - private final CallbackSet callbacks = new CallbackSet(); - - - public CreateVnfInfraTest() throws IOException { - createVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json"); - callbacks.put("assign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyAssignCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - } - - @Test - @Deployment(resources = {"subprocess/DoCreateVnf.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/GenericPutVnf.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "process/CreateVnfInfra.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn"}) - public void testCreateVnfInfra_success() throws Exception { - - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - MockGetGenericVnfByName_404(); - MockPutGenericVnf(); - mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVnfInfra", - "v1", businessKey, createVnfInfraRequest, variables); - - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - - String responseBody = response.getResponse(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - //injectSDNCCallbacks(callbacks, "assign, query"); - //injectSDNCCallbacks(callbacks, "activate"); - - // TODO add appropriate assertions - - waitForProcessEnd(businessKey, 10000); - String status = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "CreateVnfInfraStatus"); - assertEquals("Success", status); - - logEnd(); + private String createVnfInfraRequest; + private final CallbackSet callbacks = new CallbackSet(); - //WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables); - // injectSDNCCallbacks(callbacks, "assign"); - // injectSDNCCallbacks(callbacks, "activate"); - //waitForProcessEnd(businessKey, 10000); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - //assertVariables("true", "true", "false", "true", "Success", null); - - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "process/CreateVnfInfra.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn"}) - public void testCreateVnfInfra_error_badRequest() throws Exception { - - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, null, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - assertVariables(null, null, null, null, null, "WorkflowException[processKey=CreateVnfInfra,errorCode=2500,errorMessage=Internal Error - WorkflowException Object and/or RequestInfo is null! CreateVnfInfra]"); - - } - - @Test - @Ignore - @Deployment(resources = {"subprocess/DoCreateVnf.bpmn", "subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "process/CreateVnfInfra.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn"}) - public void testCreateVnfInfra_error_siNotFound() throws Exception { - - MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - assertVariables(null, null, null, null, null, "WorkflowException[processKey=DoCreateVnf,errorCode=404,errorMessage=Service Instance Not Found]"); - - } - - @Test - @Ignore - @Deployment(resources = {"subprocess/DoCreateVnf.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericGetVnf.bpmn", - "subprocess/GenericPutVnf.bpmn", - "process/CreateVnfInfra.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn"}) - public void testCreateVnfInfra_error_vnfExist() throws Exception { - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123&depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericFlows/getGenericVnfResponse.xml"))); - - MockPutGenericVnf(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); + public CreateVnfInfraTest() throws IOException { + createVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json"); + callbacks.put("assign", FileUtil.readResourceFile( + "__files/VfModularity/SDNCTopologyAssignCallback.xml")); + callbacks.put("activate", FileUtil.readResourceFile( + "__files/VfModularity/SDNCTopologyActivateCallback.xml")); + } - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - assertVariables(null, null, null, null, null, "WorkflowException[processKey=DoCreateVnf,errorCode=5000,errorMessage=Generic Vnf Already Exist.]"); + @Test + @Deployment(resources = {"subprocess/DoCreateVnf.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/GenericGetVnf.bpmn", + "subprocess/GenericPutVnf.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "process/CreateVnfInfra.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn"}) + public void testCreateVnfInfra_success() throws Exception{ + + MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + MockGetGenericVnfByName_404(); + MockPutGenericVnf(); + mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml"); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - } + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); + TestAsyncResponse asyncResponse = invokeAsyncProcess("CreateVnfInfra", + "v1", businessKey, createVnfInfraRequest, variables); - private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) { + WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000); - String siFound = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGS_FoundIndicator"); - String siSucc = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGS_SuccessIndicator"); - String vnfFound = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGV_FoundIndicator"); - String vnfSucc = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGV_SuccessIndicator"); - String response = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "SavedWorkflowException1"); + String responseBody = response.getResponse(); + System.out.println("Workflow (Synch) Response:\n" + responseBody); - assertEquals(exSIFound, siFound); - assertEquals(exSISucc, siSucc); - assertEquals(exVnfFound, vnfFound); - assertEquals(exVnfSucc, vnfSucc); - assertEquals(exResponse, response); - assertEquals(exWorkflowException, workflowException); - } + //injectSDNCCallbacks(callbacks, "assign, query"); + //injectSDNCCallbacks(callbacks, "activate"); + + // TODO add appropriate assertions - private void setVariables(Map<String, String> variables, String request, String requestId, String siId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("bpmnRequest", request); - variables.put("mso-request-id", requestId); - variables.put("serviceInstanceId", siId); - variables.put("testVnfId", "testVnfId123"); - variables.put("vnfType", "STMTN"); - } - - private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) { - variables.put("isDebugLogEnabled", "true"); - //variables.put("bpmnRequest", request); - //variables.put("mso-request-id", requestId); - variables.put("serviceInstanceId", siId); - variables.put("requestId", requestId); - variables.put("testVnfId", "testVnfId123"); - variables.put("vnfType", "STMTN"); - } + waitForProcessEnd(businessKey, 10000); + String status = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "CreateVnfInfraStatus"); + assertEquals("Success", status); + + logEnd(); + + //WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables); + // injectSDNCCallbacks(callbacks, "assign"); + // injectSDNCCallbacks(callbacks, "activate"); + //waitForProcessEnd(businessKey, 10000); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + //assertVariables("true", "true", "false", "true", "Success", null); + + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "process/CreateVnfInfra.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn"}) + public void testCreateVnfInfra_error_badRequest() throws Exception{ + + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map<String, String> variables = new HashMap<>(); + setVariables(variables, null, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables(null, null, null, null, null, "WorkflowException[processKey=CreateVnfInfra,errorCode=2500,errorMessage=Internal Error - WorkflowException Object and/or RequestInfo is null! CreateVnfInfra]"); + + } + + @Test + @Ignore + @Deployment(resources = {"subprocess/DoCreateVnf.bpmn", "subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "process/CreateVnfInfra.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn"}) + public void testCreateVnfInfra_error_siNotFound() throws Exception{ + + MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET"); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map<String, String> variables = new HashMap<>(); + setVariables(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables(null, null, null, null, null, "WorkflowException[processKey=DoCreateVnf,errorCode=404,errorMessage=Service Instance Not Found]"); + + } + + @Test + @Ignore + @Deployment(resources = {"subprocess/DoCreateVnf.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/GenericGetVnf.bpmn", + "subprocess/GenericPutVnf.bpmn", + "process/CreateVnfInfra.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn"}) + public void testCreateVnfInfra_error_vnfExist() throws Exception{ + MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123&depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse.xml"))); + + MockPutGenericVnf(); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map<String, String> variables = new HashMap<>(); + setVariables(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CreateVnfInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables(null, null, null, null, null, "WorkflowException[processKey=DoCreateVnf,errorCode=5000,errorMessage=Generic Vnf Already Exist.]"); + + } + + private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) { + + String siFound = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGS_FoundIndicator"); + String siSucc = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGS_SuccessIndicator"); + String vnfFound = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGV_FoundIndicator"); + String vnfSucc = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "GENGV_SuccessIndicator"); + String response = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "CreateVnfInfra", "SavedWorkflowException1"); + + assertEquals(exSIFound, siFound); + assertEquals(exSISucc, siSucc); + assertEquals(exVnfFound, vnfFound); + assertEquals(exVnfSucc, vnfSucc); + assertEquals(exResponse, response); + assertEquals(exWorkflowException, workflowException); + } + + private void setVariables(Map<String, String> variables, String request, String requestId, String siId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("bpmnRequest", request); + variables.put("mso-request-id", requestId); + variables.put("serviceInstanceId",siId); + variables.put("testVnfId","testVnfId123"); + variables.put("vnfType", "STMTN"); + } + + private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) { + variables.put("isDebugLogEnabled", "true"); + //variables.put("bpmnRequest", request); + //variables.put("mso-request-id", requestId); + variables.put("serviceInstanceId",siId); + variables.put("requestId", requestId); + variables.put("testVnfId","testVnfId123"); + variables.put("vnfType", "STMTN"); + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java index 2cceba0f1b..aa05953493 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteGenericALaCarteServiceInstanceTest.java @@ -46,66 +46,66 @@ import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; */
public class DeleteGenericALaCarteServiceInstanceTest extends WorkflowTest {
- public DeleteGenericALaCarteServiceInstanceTest() throws IOException {
- }
-
- /**
- * Sunny day VID scenario.
- *
- * @throws Exception
- */
+ public DeleteGenericALaCarteServiceInstanceTest() throws IOException {
+ }
+
+ /**
+ * Sunny day VID scenario.
+ *
+ * @throws Exception
+ */
@Ignore // IGNORED FOR 1710 MERGE TO ONAP
- @Test
- @Deployment(resources = {
- "process/DeleteGenericALaCarteServiceInstance.bpmn",
- "subprocess/DoDeleteServiceInstance.bpmn",
- "subprocess/GenericDeleteService.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn"})
- public void sunnyDayAlaCarte() throws Exception {
-
- logStart();
-
- //AAI
- MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
- MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- //DB
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, String> variables = setupVariables();
- WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteGenericALaCarteServiceInstance", variables);
- waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "WorkflowResponse");
- //assertNotNull(workflowResp);
- System.out.println("Workflow (Synch) Response:\n" + workflowResp);
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "WorkflowException");
- String completionReq = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "completionRequest");
- System.out.println("completionReq:\n" + completionReq);
- System.out.println("workflowException:\n" + workflowException);
- assertNotNull(completionReq);
- assertEquals(null, workflowException);
-
- logEnd();
- }
-
- // Success Scenario
- private Map<String, String> setupVariables() {
- Map<String, String> variables = new HashMap<>();
- variables.put("isDebugLogEnabled", "true");
- variables.put("bpmnRequest", getRequest());
- variables.put("mso-request-id", "RaaTestRequestId-1");
- variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
- return variables;
- }
-
- public String getRequest() {
- String request = "{\"requestDetails\":{\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SDN-ETHERNET-INTERNET\",\"subscriberName\":\"\"},\"requestInfo\":{\"instanceName\":\"1604-MVM-26\",\"source\":\"VID\",\"suppressRollback\":\"true\",\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"mdt1\",\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\"},\"requestParameters\":{\"subscriptionServiceType\":\"123456789\",\"aLaCarte\":\"false\",\"userParams\":\"somep\"}}}";
- return request;
- }
+ @Test
+ @Deployment(resources = {
+ "process/DeleteGenericALaCarteServiceInstance.bpmn",
+ "subprocess/DoDeleteServiceInstance.bpmn",
+ "subprocess/GenericDeleteService.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn" })
+ public void sunnyDayAlaCarte() throws Exception {
+
+ logStart();
+
+ //AAI
+ MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
+ MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
+ //DB
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+
+ Map<String, String> variables = setupVariables();
+ WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteGenericALaCarteServiceInstance", variables);
+ waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "WorkflowResponse");
+ //assertNotNull(workflowResp);
+ System.out.println("Workflow (Synch) Response:\n" + workflowResp);
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "WorkflowException");
+ String completionReq = BPMNUtil.getVariable(processEngineRule, "DeleteGenericALaCarteServiceInstance", "completionRequest");
+ System.out.println("completionReq:\n" + completionReq);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNotNull(completionReq);
+ assertEquals(null, workflowException);
+
+ logEnd();
+ }
+
+ // Success Scenario
+ private Map<String, String> setupVariables() {
+ Map<String, String> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("bpmnRequest", getRequest());
+ variables.put("mso-request-id", "RaaTestRequestId-1");
+ variables.put("serviceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET");
+ return variables;
+ }
+
+ public String getRequest() {
+ String request = "{\"requestDetails\":{\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SDN-ETHERNET-INTERNET\",\"subscriberName\":\"\"},\"requestInfo\":{\"instanceName\":\"1604-MVM-26\",\"source\":\"VID\",\"suppressRollback\":\"true\",\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"mdt1\",\"tenantId\":\"8b1df54faa3b49078e3416e21370a3ba\"},\"requestParameters\":{\"subscriptionServiceType\":\"123456789\",\"aLaCarte\":\"false\",\"userParams\":\"somep\"}}}";
+ return request;
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java index 0e72b769a5..4317a57405 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteNetworkInstanceTest.java @@ -48,293 +48,294 @@ import com.github.tomakehurst.wiremock.extension.ResponseTransformer; /**
* Unit test cases for DeleteNetworkInstance.bpmn
+ *
*/
//@Ignore
public class DeleteNetworkInstanceTest extends WorkflowTest {
- @WorkflowTestTransformer
- public static final ResponseTransformer sdncAdapterMockTransformer =
- new SDNCAdapterNetworkTopologyMockTransformer();
-
- @Rule
- public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
- new SDNCAdapterCallbackRule(processEngineRule);
-
- /**
- * End-to-End flow - Unit test for DeleteNetworkInstance.bpmn
- * - String input & String response
- */
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/DeleteNetworkInstance.bpmn",
- "subprocess/DoDeleteNetworkInstance.bpmn",
- "subprocess/DoDeleteNetworkInstanceRollback.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceDeleteNetworkInstance_VID_Success() throws Exception {
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success VID - DeleteNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>delete");
- MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
- MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "1");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml");
-
- Map<String, String> variables = new HashMap<>();
- variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "DELETE");
- variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("vnfId", "");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "");
- variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- variables.put("networkType", "modelName");
- variables.put("bpmnRequest", getDeleteNetworkInstanceInfraRequest());
-
- executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
-
- Assert.assertNotNull("DELNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
- Assert.assertEquals("true", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success"));
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
- Assert.assertNotNull(workflowResp);
- System.out.println("DeleteNetworkInstanceTest.shouldInvokeServiceDeleteNetworkInstance_Success() WorkflowResponse:\n" + workflowResp);
-
- String completeMsoProcessRequest =
- "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
- + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
- + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
- + " <request-info>" + '\n'
- + " <request-id>testRequestId</request-id>" + '\n'
- + " <action>DELETE</action>" + '\n'
- + " <source>VID</source>" + '\n'
- + " </request-info>" + '\n'
- + " <aetgt:status-message>Network has been deleted successfully.</aetgt:status-message>" + '\n'
- + " <aetgt:mso-bpel-name>BPMN Network action: DELETE</aetgt:mso-bpel-name>" + '\n'
- + "</aetgt:MsoCompletionRequest>";
-
- Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success VID - DeleteNetworkInstance flow Completed ");
- System.out.println("----------------------------------------------------------");
-
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/DeleteNetworkInstance.bpmn",
- "subprocess/DoDeleteNetworkInstance.bpmn",
- //"subprocess/DoDeleteNetworkInstanceRollback.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceDeleteNetworkInstance_vIPER_Success() throws Exception {
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success vIPER - DeleteNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------");
-
- // setup simulators
- mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>unassign");
- mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>deactivate");
- MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
- MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "1");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml");
-
- String networkModelInfo = " {\"modelName\": \"modelName\", " + '\n' +
- " \"networkType\": \"modelName\" }";
-
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30");
- variables.put("networkName", "HSL_direct_net_2");
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("disableRollback", "false"); // 1702
- variables.put("failIfExists", "false");
- //variables.put("sdncVersion", "1702");
- variables.put("sdncVersion", "1707");
- variables.put("subscriptionServiceType", "MSO-dev-service-type");
- variables.put("networkModelInfo", networkModelInfo);
-
- executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
-
- Assert.assertNotNull("DELNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
- Assert.assertEquals("true", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success"));
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
- Assert.assertNotNull(workflowResp);
- System.out.println("DeleteNetworkInstanceTest.shouldInvokeServiceDeleteNetworkInstance_vIPER_Success() WorkflowResponse:\n" + workflowResp);
-
- String completeMsoProcessRequest =
- "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
- + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
- + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
- + " <request-info>" + '\n'
- + " <request-id>testRequestId</request-id>" + '\n'
- + " <action>DELETE</action>" + '\n'
- + " <source>VID</source>" + '\n'
- + " </request-info>" + '\n'
- + " <aetgt:status-message>Network has been deleted successfully.</aetgt:status-message>" + '\n'
- + " <aetgt:mso-bpel-name>BPMN Network action: DELETE</aetgt:mso-bpel-name>" + '\n'
- + "</aetgt:MsoCompletionRequest>";
-
- Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Success VID - DeleteNetworkInstance flow Completed ");
- System.out.println("----------------------------------------------------------");
-
-
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"process/DeleteNetworkInstance.bpmn",
- "subprocess/DoDeleteNetworkInstance.bpmn",
- "subprocess/DoDeleteNetworkInstanceRollback.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/SDNCAdapterV1.bpmn"})
-
- public void shouldInvokeServiceDeleteNetworkInstanceInfra_vIPER_Rollback() throws Exception {
+ @WorkflowTestTransformer
+ public static final ResponseTransformer sdncAdapterMockTransformer =
+ new SDNCAdapterNetworkTopologyMockTransformer();
+
+ @Rule
+ public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
+ new SDNCAdapterCallbackRule(processEngineRule);
+
+ /**
+ * End-to-End flow - Unit test for DeleteNetworkInstance.bpmn
+ * - String input & String response
+ */
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/DeleteNetworkInstance.bpmn",
+ "subprocess/DoDeleteNetworkInstance.bpmn",
+ "subprocess/DoDeleteNetworkInstanceRollback.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceDeleteNetworkInstance_VID_Success() throws Exception {
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Success VID - DeleteNetworkInstance flow Started! ");
+ System.out.println("----------------------------------------------------------");
+
+ // setup simulators
+ mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>delete");
+ MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
+ MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "1");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml");
+
+ Map<String, String> variables = new HashMap<>();
+ variables.put("mso-request-id", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isBaseVfModule", "true");
+ variables.put("recipeTimeout", "0");
+ variables.put("requestAction", "DELETE");
+ variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("vnfId", "");
+ variables.put("vfModuleId", "");
+ variables.put("volumeGroupId", "");
+ variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30");
+ variables.put("serviceType", "MOG");
+ variables.put("vfModuleType", "");
+ variables.put("networkType", "modelName");
+ variables.put("bpmnRequest", getDeleteNetworkInstanceInfraRequest());
+
+ executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
+
+ Assert.assertNotNull("DELNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
+ Assert.assertEquals("true", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success"));
+
+ String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
+ Assert.assertNotNull(workflowResp);
+ System.out.println("DeleteNetworkInstanceTest.shouldInvokeServiceDeleteNetworkInstance_Success() WorkflowResponse:\n" + workflowResp);
+
+ String completeMsoProcessRequest =
+ "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
+ + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
+ + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
+ + " <request-info>" + '\n'
+ + " <request-id>testRequestId</request-id>" + '\n'
+ + " <action>DELETE</action>" + '\n'
+ + " <source>VID</source>" + '\n'
+ + " </request-info>" + '\n'
+ + " <aetgt:status-message>Network has been deleted successfully.</aetgt:status-message>" + '\n'
+ + " <aetgt:mso-bpel-name>BPMN Network action: DELETE</aetgt:mso-bpel-name>" + '\n'
+ + "</aetgt:MsoCompletionRequest>";
+
+ Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Success VID - DeleteNetworkInstance flow Completed ");
+ System.out.println("----------------------------------------------------------");
+
+
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/DeleteNetworkInstance.bpmn",
+ "subprocess/DoDeleteNetworkInstance.bpmn",
+ //"subprocess/DoDeleteNetworkInstanceRollback.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceDeleteNetworkInstance_vIPER_Success() throws Exception {
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Success vIPER - DeleteNetworkInstance flow Started! ");
+ System.out.println("----------------------------------------------------------");
+
+ // setup simulators
+ mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>unassign");
+ mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>deactivate");
+ MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
+ MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "1");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml");
+
+ String networkModelInfo = " {\"modelName\": \"modelName\", " + '\n' +
+ " \"networkType\": \"modelName\" }";
+
+ Map<String, String> variables = new HashMap<>();
+ variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30");
+ variables.put("networkName", "HSL_direct_net_2");
+ variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
+ variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("disableRollback", "false"); // 1702
+ variables.put("failIfExists", "false");
+ //variables.put("sdncVersion", "1702");
+ variables.put("sdncVersion", "1707");
+ variables.put("subscriptionServiceType", "MSO-dev-service-type");
+ variables.put("networkModelInfo", networkModelInfo);
+
+ executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
+
+ Assert.assertNotNull("DELNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
+ Assert.assertEquals("true", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success"));
+
+ String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
+ Assert.assertNotNull(workflowResp);
+ System.out.println("DeleteNetworkInstanceTest.shouldInvokeServiceDeleteNetworkInstance_vIPER_Success() WorkflowResponse:\n" + workflowResp);
+
+ String completeMsoProcessRequest =
+ "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n'
+ + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n'
+ + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n'
+ + " <request-info>" + '\n'
+ + " <request-id>testRequestId</request-id>" + '\n'
+ + " <action>DELETE</action>" + '\n'
+ + " <source>VID</source>" + '\n'
+ + " </request-info>" + '\n'
+ + " <aetgt:status-message>Network has been deleted successfully.</aetgt:status-message>" + '\n'
+ + " <aetgt:mso-bpel-name>BPMN Network action: DELETE</aetgt:mso-bpel-name>" + '\n'
+ + "</aetgt:MsoCompletionRequest>";
+
+ Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_CompleteMsoProcessRequest"));
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Success VID - DeleteNetworkInstance flow Completed ");
+ System.out.println("----------------------------------------------------------");
+
+
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"process/DeleteNetworkInstance.bpmn",
+ "subprocess/DoDeleteNetworkInstance.bpmn",
+ "subprocess/DoDeleteNetworkInstanceRollback.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn"})
+
+ public void shouldInvokeServiceDeleteNetworkInstanceInfra_vIPER_Rollback() throws Exception {
// Rollback is not Applicable for DeleteNetwork (no requirements). Rollback should not be invoked.
- System.out.println("----------------------------------------------------------");
- System.out.println(" Rollback - DeleteNetworkInstance flow Started! ");
- System.out.println("----------------------------------------------------------");
-
- // setup simulatores
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>unassign", 500, "");
- mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>deactivate");
- mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate");
- MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
- MockNetworkAdapterContainingRequest("createNetworkRequest", 200, "CreateNetworkV2/createNetworkResponse_Success.xml");
- MockGetNetworkByIdWithDepth("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "1");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml");
-
- String networkModelInfo = " {\"modelCustomizationId\": \"uuid-nrc-001-1234\", " + '\n' +
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Rollback - DeleteNetworkInstance flow Started! ");
+ System.out.println("----------------------------------------------------------");
+
+ // setup simulatores
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>unassign", 500, "");
+ mockSDNCAdapterTopology("DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml", "SvcAction>deactivate");
+ mockSDNCAdapterTopology("CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml", "SvcAction>activate");
+ MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
+ MockNetworkAdapterContainingRequest("createNetworkRequest", 200, "CreateNetworkV2/createNetworkResponse_Success.xml");
+ MockGetNetworkByIdWithDepth ("bdc5efe8-404a-409b-85f6-0dcc9eebae30", "DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml", "1");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ MockGetCloudRegion("RDM2WAGPLCP", 200, "DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml");
+
+ String networkModelInfo = " {\"modelCustomizationId\": \"uuid-nrc-001-1234\", " + '\n' +
" \"modelInvariantId\": \"was-ist-das-001-1234\" }";
- Map<String, String> variables = new HashMap<>();
- variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
- variables.put("msoRequestId", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30");
- variables.put("networkName", "HSL_direct_net_2");
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- variables.put("disableRollback", "false"); // 1702
- variables.put("failIfExists", "false");
- variables.put("sdncVersion", "1702");
- variables.put("subscriptionServiceType", "MSO-dev-service-type");
- variables.put("networkModelInfo", networkModelInfo);
-
- executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
- //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
- //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
-
- String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
- Assert.assertNotNull(workflowResp);
-
- Assert.assertNotNull("DELNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_FalloutHandlerRequest"));
- Assert.assertEquals("false", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success"));
- Assert.assertEquals("false", BPMNUtil.getVariable(processEngineRule, "DoDeleteNetworkInstance", "DELNWKI_Success"));
-
- System.out.println("----------------------------------------------------------");
- System.out.println(" Rollback - DeleteNetworkInstanceModular flow Completed ");
- System.out.println("----------------------------------------------------------");
-
-
- }
-
-
- // *****************
- // Utility Section
- // *****************
-
- public String getDeleteNetworkInstanceInfraRequest() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1.0\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"HSL_direct_net_2\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"suppressRollback\": \"false\", " + '\n' +
- " \"callbackUrl\": \"\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"backoutOnFailure\": true, " + '\n' +
- " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
- " \"userParams\": {} " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
- return request;
-
- }
-
-
- public String getDeleteNetworkInstanceInfraRequest_MissingId() {
-
- String request =
- "{ \"requestDetails\": { " + '\n' +
- " \"modelInfo\": { " + '\n' +
- " \"modelType\": \"modelType\", " + '\n' +
- " \"modelId\": \"modelId\", " + '\n' +
- " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
- " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
- " \"modelVersion\": \"1\" " + '\n' +
- " }, " + '\n' +
- " \"cloudConfiguration\": { " + '\n' +
- " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
- " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
- " }, " + '\n' +
- " \"requestInfo\": { " + '\n' +
- " \"instanceName\": \"HSL_direct_net_2\", " + '\n' +
- " \"source\": \"VID\", " + '\n' +
- " \"callbackUrl\": \"\" " + '\n' +
- " }, " + '\n' +
- " \"requestParameters\": { " + '\n' +
- " \"backoutOnFailure\": true, " + '\n' +
- " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
- " \"userParams\": [] " + '\n' +
- " } " + '\n' +
- " } " + '\n' +
- "}";
- return request;
-
- }
+ Map<String, String> variables = new HashMap<>();
+ variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("serviceInstanceId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("networkId", "bdc5efe8-404a-409b-85f6-0dcc9eebae30");
+ variables.put("networkName", "HSL_direct_net_2");
+ variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
+ variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ variables.put("disableRollback", "false"); // 1702
+ variables.put("failIfExists", "false");
+ variables.put("sdncVersion", "1702");
+ variables.put("subscriptionServiceType", "MSO-dev-service-type");
+ variables.put("networkModelInfo", networkModelInfo);
+
+ executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
+ //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "DeleteNetworkInstance", variables);
+ //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID());
+
+ String workflowResp = BPMNUtil.getVariable(processEngineRule, "DeleteNetworkInstance", "WorkflowResponse");
+ Assert.assertNotNull(workflowResp);
+
+ Assert.assertNotNull("DELNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_FalloutHandlerRequest"));
+ Assert.assertEquals("false", getVariable(processEngineRule, "DeleteNetworkInstance", "DELNI_Success"));
+ Assert.assertEquals("false", BPMNUtil.getVariable(processEngineRule, "DoDeleteNetworkInstance", "DELNWKI_Success"));
+
+ System.out.println("----------------------------------------------------------");
+ System.out.println(" Rollback - DeleteNetworkInstanceModular flow Completed ");
+ System.out.println("----------------------------------------------------------");
+
+
+ }
+
+
+ // *****************
+ // Utility Section
+ // *****************
+
+ public String getDeleteNetworkInstanceInfraRequest() {
+
+ String request =
+ "{ \"requestDetails\": { " + '\n' +
+ " \"modelInfo\": { " + '\n' +
+ " \"modelType\": \"modelType\", " + '\n' +
+ " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' +
+ " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
+ " \"modelVersion\": \"1.0\" " + '\n' +
+ " }, " + '\n' +
+ " \"cloudConfiguration\": { " + '\n' +
+ " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
+ " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestInfo\": { " + '\n' +
+ " \"instanceName\": \"HSL_direct_net_2\", " + '\n' +
+ " \"source\": \"VID\", " + '\n' +
+ " \"suppressRollback\": \"false\", " + '\n' +
+ " \"callbackUrl\": \"\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestParameters\": { " + '\n' +
+ " \"backoutOnFailure\": true, " + '\n' +
+ " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
+ " \"userParams\": {} " + '\n' +
+ " } " + '\n' +
+ " } " + '\n' +
+ "}";
+ return request;
+
+ }
+
+
+ public String getDeleteNetworkInstanceInfraRequest_MissingId() {
+
+ String request =
+ "{ \"requestDetails\": { " + '\n' +
+ " \"modelInfo\": { " + '\n' +
+ " \"modelType\": \"modelType\", " + '\n' +
+ " \"modelId\": \"modelId\", " + '\n' +
+ " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' +
+ " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' +
+ " \"modelVersion\": \"1\" " + '\n' +
+ " }, " + '\n' +
+ " \"cloudConfiguration\": { " + '\n' +
+ " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' +
+ " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestInfo\": { " + '\n' +
+ " \"instanceName\": \"HSL_direct_net_2\", " + '\n' +
+ " \"source\": \"VID\", " + '\n' +
+ " \"callbackUrl\": \"\" " + '\n' +
+ " }, " + '\n' +
+ " \"requestParameters\": { " + '\n' +
+ " \"backoutOnFailure\": true, " + '\n' +
+ " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' +
+ " \"userParams\": [] " + '\n' +
+ " } " + '\n' +
+ " } " + '\n' +
+ "}";
+ return request;
+
+ }
}
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java index 413e35a326..4c478e6143 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -46,535 +46,534 @@ import org.openecomp.mso.bpmn.core.WorkflowException; import org.openecomp.mso.bpmn.mock.FileUtil;
import com.github.tomakehurst.wiremock.client.WireMock;
-
/**
* Unit test for DoDeleteVfModule.bpmn.
*/
public class DeleteVfModuleInfraTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- private static final String EOL = "\n";
-
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- " <vfModuleOutputs>" + EOL +
- " <entry>" + EOL +
- " <key>policyKey1_contrail_network_policy_fqdn</key>" + EOL +
- " <value>MSOTest:DefaultPolicyFQDN1</value>" + EOL +
- "</entry>" + EOL +
- "<entry>" + EOL +
- "<key>policyKey2_contrail_network_policy_fqdn</key>" + EOL +
- "<value>MSOTest:DefaultPolicyFQDN2</value>" + EOL +
- "</entry>" + EOL +
- " <entry>" + EOL +
- " <key>oam_management_v4_address</key>" + EOL +
- " <value>1234</value>" + EOL +
- "</entry>" + EOL +
- " <entry>" + EOL +
- " <key>oam_management_v6_address</key>" + EOL +
- " <value>1234</value>" + EOL +
- "</entry>" + EOL +
- "</vfModuleOutputs>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- private final String vnfAdapterDeleteCallbackFail =
- "<vfModuleException>" + EOL +
- " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
- " <category>INTERNAL</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL;
-
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DeleteVfModuleInfraTest() throws IOException {
- callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
- callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
- }
-
- @Test
- @Deployment(resources = {
- "process/Infrastructure/DeleteVfModuleInfra.bpmn",
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
- @Ignore
- public void TestDeleteVfModuleSuccess() throws Exception {
- // delete the Base Module
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <request-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</request-id>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- WireMock.reset();
-
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>changedelete"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>delete"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
-
- mockVNFDelete(".*", "/.*", 202);
+ private final CallbackSet callbacks = new CallbackSet();
+
+ private static final String EOL = "\n";
+
+ private final String vnfAdapterDeleteCallback =
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
+ " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ " <vfModuleOutputs>" + EOL +
+ " <entry>" + EOL +
+ " <key>policyKey1_contrail_network_policy_fqdn</key>" + EOL +
+ " <value>MSOTest:DefaultPolicyFQDN1</value>" + EOL +
+ "</entry>" + EOL +
+ "<entry>" + EOL +
+ "<key>policyKey2_contrail_network_policy_fqdn</key>" + EOL +
+ "<value>MSOTest:DefaultPolicyFQDN2</value>" + EOL +
+ "</entry>" + EOL +
+ " <entry>" + EOL +
+ " <key>oam_management_v4_address</key>" + EOL +
+ " <value>1234</value>" + EOL +
+ "</entry>" + EOL +
+ " <entry>" + EOL +
+ " <key>oam_management_v6_address</key>" + EOL +
+ " <value>1234</value>" + EOL +
+ "</entry>" + EOL +
+ "</vfModuleOutputs>" + EOL +
+ "</deleteVfModuleResponse>" + EOL;
+
+ private final String vnfAdapterDeleteCallbackFail =
+ "<vfModuleException>" + EOL +
+ " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
+ " <category>INTERNAL</category>" + EOL +
+ " <rolledBack>false</rolledBack>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</vfModuleException>" + EOL;
+
+ private final String sdncAdapterDeleteCallback =
+ "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
+ " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
+ " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
+ "</output>" + EOL;
+
+ public DeleteVfModuleInfraTest() throws IOException {
+ callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
+ callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
+ callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
+ callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
+ }
+
+ @Test
+ @Deployment(resources = {
+ "process/Infrastructure/DeleteVfModuleInfra.bpmn",
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn"
+ })
+ @Ignore
+ public void TestDeleteVfModuleSuccess() throws Exception {
+ // delete the Base Module
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <request-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</request-id>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ logStart();
+ WireMock.reset();
+
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>changedelete"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>delete"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+
+ mockVNFDelete(".*", "/.*", 202);
// MockAAIGenericVnfSearch();
// MockAAIVfModulePUT(false);
// MockAAIDeleteGenericVnf();
// MockAAIDeleteVfModule();
- mockUpdateRequestDB(200, "VfModularity/DBUpdateResponse.xml");
-
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml")));
-
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
- .willReturn(aResponse()
- .withStatus(200)));
-
-
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
-
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("MMSC"))
- .willReturn(aResponse()
- .withStatus(200)));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
- .willReturn(aResponse()
- .withStatus(200)));
-
- String body;
-
- // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>1508691</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>1508691</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>1508692</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- // The following stubs are for DeleteAAIVfModule
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
-
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(404)
- .withHeader("Content-Type", "text/xml")
- .withBody("Generic VNF Not Found")));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000021</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000073</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000020</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000074</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000075</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000019</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000076</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>false</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000077</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000018</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000078</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- body =
- "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
- " <service-id>SDN-MOBILITY</service-id>" + EOL +
- " <equipment-role>vMMSC</equipment-role>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <in-maint>false</in-maint>" + EOL +
- " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
- " <resource-version>0000021</resource-version>" + EOL +
- " <vf-modules>" + EOL +
- " <vf-module>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
- " <persona-model-version>1.0</persona-model-version>" + EOL +
- " <is-base-vf-module>true</is-base-vf-module>" + EOL +
- " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
- " <orchestration-status>pending-create</orchestration-status>" + EOL +
- " <resource-version>0000073</resource-version>" + EOL +
- " </vf-module>" + EOL +
- " </vf-modules>" + EOL +
- " <relationship-list/>" + EOL +
- " <l-interfaces/>" + EOL +
- " <lag-interfaces/>" + EOL +
- "</generic-vnf>" + EOL;
- stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBody(body)));
-
- String businessKey = UUID.randomUUID().toString();
- String deleteVfModuleRequest =
- FileUtil.readResourceFile("__files/DeleteVfModule_VID_request.json");
- //Map<String, Object> variables = new HashMap<String, Object>();
-
- //variables.put("isDebugLogEnabled","true");
+ mockUpdateRequestDB(200, "VfModularity/DBUpdateResponse.xml");
+
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml")));
+
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+
+
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("MMSC"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("PCRF"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+
+ String body;
+
+ // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(404)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("Generic VNF Not Found")));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(404)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("Generic VNF Not Found")));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>1508691</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>1508692</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>1508691</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>1508692</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>false</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>1508692</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ // The following stubs are for DeleteAAIVfModule
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(404)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("Generic VNF Not Found")));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000021</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000073</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000020</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000074</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>false</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000075</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000019</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000076</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>false</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000077</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000018</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000078</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000021</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000073</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ String businessKey = UUID.randomUUID().toString();
+ String deleteVfModuleRequest =
+ FileUtil.readResourceFile("__files/DeleteVfModule_VID_request.json");
+ //Map<String, Object> variables = new HashMap<String, Object>();
+
+ //variables.put("isDebugLogEnabled","true");
// variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
// variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+
+ Map<String, Object> variables = setupVariablesSunnyDayVID();
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleInfra",
- "v1", businessKey, deleteVfModuleRequest, variables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleInfra",
+ "v1", businessKey, deleteVfModuleRequest, variables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
- // "changedelete" operation not required for deleting a Vf Module
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- checkVariable(businessKey, "DeleteVfModuleInfraSuccessIndicator", true);
- checkVariable(businessKey, "WorkflowException", null);
- if (wfe != null) {
- System.out.println("TestDeleteVfModuleInfraSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", "true");
- variables.put("isDebugLogEnabled", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "DELETE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("volumeGroupId", "");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- return variables;
-
- }
-
-
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ injectSDNCCallbacks(callbacks, "sdncDelete");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ checkVariable(businessKey, "DeleteVfModuleInfraSuccessIndicator", true);
+ checkVariable(businessKey, "WorkflowException", null);
+ if (wfe != null) {
+ System.out.println("TestDeleteVfModuleInfraSuccess: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+ // Active Scenario
+ private Map<String, Object> setupVariablesSunnyDayVID() {
+ Map<String, Object> variables = new HashMap<>();
+ //try {
+ // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
+ //}
+ //catch (Exception e) {
+
+ //}
+ //variables.put("mso-request-id", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isBaseVfModule", "true");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("recipeTimeout", "0");
+ variables.put("requestAction", "DELETE_VF_MODULE");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("volumeGroupId", "");
+ variables.put("serviceType", "MOG");
+ variables.put("vfModuleType", "");
+ return variables;
+
+ }
+
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java index bdeb9aaf6a..84050c40e5 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= - */ + */ package org.openecomp.mso.bpmn.infrastructure; @@ -36,131 +36,131 @@ import org.openecomp.mso.bpmn.mock.FileUtil; * Unit test cases for UpdateVfModuleVolume.bpmn */ public class DeleteVfModuleVolumeInfraV1Test extends WorkflowTest { - - private final CallbackSet callbacks = new CallbackSet(); - - public DeleteVfModuleVolumeInfraV1Test() throws IOException { - callbacks.put("volumeGroupDelete", FileUtil.readResourceFile( - "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml")); - } - - /** - * Happy path scenario. - * - * @throws Exception - */ - @Test - @Ignore // BROKEN TEST - @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn", + + private final CallbackSet callbacks = new CallbackSet(); + + public DeleteVfModuleVolumeInfraV1Test() throws IOException { + callbacks.put("volumeGroupDelete", FileUtil.readResourceFile( + "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml")); + } + + /** + * Happy path scenario. + * + * @throws Exception + */ + @Test + @Ignore // BROKEN TEST + @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn", "subprocess/VnfAdapterRestV1.bpmn"}) - public void happyPath() throws Exception { - - logStart(); + public void happyPath() throws Exception { + logStart(); + // DeleteVfModuleVolumeInfraV1_success(); - - String businessKey = UUID.randomUUID().toString(); - String deleteVfModuleVolRequest = - FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json"); - - Map<String, Object> testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("volumeGroupId", "78987"); - testVariables.put("serviceInstanceId", "test-service-instance-id-0123"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1", - "v1", businessKey, deleteVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000); - - String responseBody = response.getResponse(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", true); - - logEnd(); - } - - /** - * Test fails - vf module in use - * - * @throws Exception - */ - @Test - @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn", + + String businessKey = UUID.randomUUID().toString(); + String deleteVfModuleVolRequest = + FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json"); + + Map<String, Object> testVariables = new HashMap<>(); + testVariables.put("requestId", "TEST-REQUEST-ID-0123"); + testVariables.put("volumeGroupId", "78987"); + testVariables.put("serviceInstanceId", "test-service-instance-id-0123"); + + TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1", + "v1", businessKey, deleteVfModuleVolRequest, testVariables); + WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000); + + String responseBody = response.getResponse(); + System.out.println("Workflow (Synch) Response:\n" + responseBody); + + injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); + + waitForProcessEnd(businessKey, 100000); + checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", true); + + logEnd(); + } + + /** + * Test fails - vf module in use + * + * @throws Exception + */ + @Test + @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn", "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestVfModuleInUseError() throws Exception { - - logStart(); + public void TestVfModuleInUseError() throws Exception { + logStart(); + // DeleteVfModuleVolumeInfraV1_inUseError(); // no assertions to check - - String businessKey = UUID.randomUUID().toString(); - String deleteVfModuleVolRequest = - FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json"); - - Map<String, Object> testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("volumeGroupId", "78987"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1", - "v1", businessKey, deleteVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000); - - String responseBody = response.getResponse(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - //injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", false); - - logEnd(); - } - - /** - * Test fails on vnf adapter call - * - * @throws Exception - */ - @Test - @Ignore // BROKEN TEST - @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn", + + String businessKey = UUID.randomUUID().toString(); + String deleteVfModuleVolRequest = + FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json"); + + Map<String, Object> testVariables = new HashMap<>(); + testVariables.put("requestId", "TEST-REQUEST-ID-0123"); + testVariables.put("volumeGroupId", "78987"); + + TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1", + "v1", businessKey, deleteVfModuleVolRequest, testVariables); + WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000); + + String responseBody = response.getResponse(); + System.out.println("Workflow (Synch) Response:\n" + responseBody); + + //injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); + + waitForProcessEnd(businessKey, 100000); + checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", false); + + logEnd(); + } + + /** + * Test fails on vnf adapter call + * + * @throws Exception + */ + @Test + @Ignore // BROKEN TEST + @Deployment(resources = {"process/DeleteVfModuleVolumeInfraV1.bpmn", "subprocess/FalloutHandler.bpmn", "subprocess/CompleteMsoProcess.bpmn", "subprocess/VnfAdapterRestV1.bpmn"}) - public void TestVnfAdapterCallfail() throws Exception { - - logStart(); + public void TestVnfAdapterCallfail() throws Exception { + logStart(); + // DeleteVfModuleVolumeInfraV1_fail(); - - String businessKey = UUID.randomUUID().toString(); - String deleteVfModuleVolRequest = - FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json"); - - Map<String, Object> testVariables = new HashMap<>(); - testVariables.put("requestId", "TEST-REQUEST-ID-0123"); - testVariables.put("volumeGroupId", "78987"); - - TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1", - "v1", businessKey, deleteVfModuleVolRequest, testVariables); - WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000); - - String responseBody = response.getResponse(); - System.out.println("Workflow (Synch) Response:\n" + responseBody); - - //injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); - - waitForProcessEnd(businessKey, 100000); - checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", false); - - logEnd(); - } + + String businessKey = UUID.randomUUID().toString(); + String deleteVfModuleVolRequest = + FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json"); + + Map<String, Object> testVariables = new HashMap<>(); + testVariables.put("requestId", "TEST-REQUEST-ID-0123"); + testVariables.put("volumeGroupId", "78987"); + + TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleVolumeInfraV1", + "v1", businessKey, deleteVfModuleVolRequest, testVariables); + WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 100000); + + String responseBody = response.getResponse(); + System.out.println("Workflow (Synch) Response:\n" + responseBody); + + //injectVNFRestCallbacks(callbacks, "volumeGroupDelete"); + + waitForProcessEnd(businessKey, 100000); + checkVariable(businessKey, "DELVfModVol_TransactionSuccessIndicator", false); + + logEnd(); + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java index 7c79625439..89bf141247 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java @@ -19,7 +19,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= - */ + */ package org.openecomp.mso.bpmn.infrastructure; @@ -49,151 +49,152 @@ import org.openecomp.mso.bpmn.mock.FileUtil; /** * Please describe the DeleteVnfInfra.java class + * */ public class DeleteVnfInfraTest extends WorkflowTest { - private String deleteVnfInfraRequest; - private String deleteVnfInfraRequestCascadeDelete; - - public DeleteVnfInfraTest() throws IOException { - deleteVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json"); - deleteVnfInfraRequestCascadeDelete = FileUtil.readResourceFile("__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json"); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", - "subprocess/GenericDeleteVnf.bpmn", - "subprocess/DoDeleteVnf.bpmn", - "process/DeleteVnfInfra.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn"}) - public void testDeleteVnfInfra_success() throws Exception { - - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml"))); - - MockDeleteGenericVnf(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - Object cascadeDelete = BPMNUtil.getRawVariable(processEngineRule, "DeleteVnfInfra", "DELVI_cascadeDelete"); - String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator"); - String inUse = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "DELVI_vnfInUse"); - String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowException"); - - assertEquals(false, cascadeDelete); - assertEquals("true", found); - assertEquals("false", inUse); - assertEquals("Success", response); - assertEquals(null, workflowException); - } - - @Test - @Ignore // DoDeleteVnfAndModules not complete yet - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", - "subprocess/GenericDeleteVnf.bpmn", - "subprocess/DoDeleteVnfAndModules.bpmn", - "process/DeleteVnfInfra.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn"}) - public void testDeleteVnfInfra_cascadeDelete() throws Exception { - MockGetGenericVnfById(); - MockDeleteGenericVnf(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, deleteVnfInfraRequestCascadeDelete, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator"); - String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); - String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowException"); - Object cascadeDelete = BPMNUtil.getRawVariable(processEngineRule, "DeleteVnfInfra", "DELVI_cascadeDelete"); - - assertEquals(true, cascadeDelete); - assertEquals("true", found); - assertEquals("false", inUse); - assertEquals("Success", response); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", - "subprocess/GenericDeleteVnf.bpmn", - "subprocess/DoDeleteVnf.bpmn", - "process/DeleteVnfInfra.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn"}) - public void testDeleteVnfInfra_success_vnfNotFound() throws Exception { - - MockDeleteGenericVnf_404(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator"); - String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); - String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException"); - - assertEquals("false", found); - assertEquals("false", inUse); - assertEquals("Success", response); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", - "subprocess/GenericDeleteVnf.bpmn", - "subprocess/DoDeleteVnf.bpmn", - "process/DeleteVnfInfra.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn"}) - public void testDeleteVnfInfra_error_vnfInUse() throws Exception { - - stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]depth=1")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml"))); - MockDeleteGenericVnf(); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map<String, String> variables = new HashMap<>(); - setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - - WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); - waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator"); - String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "SavedWorkflowException1"); - - String exWfex = "WorkflowException[processKey=DoDeleteVnf,errorCode=5000,errorMessage=Can't Delete Generic Vnf. Generic Vnf is still in use.]"; - - assertEquals("true", found); - assertEquals("true", inUse); - assertEquals(exWfex, workflowException); - } - - private void setVariables(Map<String, String> variables, String request, String requestId, String siId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("bpmnRequest", request); - variables.put("mso-request-id", requestId); - variables.put("serviceInstanceId", siId); - variables.put("vnfId", "testVnfId123"); - } + private String deleteVnfInfraRequest; + private String deleteVnfInfraRequestCascadeDelete; + + public DeleteVnfInfraTest () throws IOException { + deleteVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json"); + deleteVnfInfraRequestCascadeDelete = FileUtil.readResourceFile("__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json"); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", + "subprocess/GenericDeleteVnf.bpmn", + "subprocess/DoDeleteVnf.bpmn", + "process/DeleteVnfInfra.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn"}) + public void testDeleteVnfInfra_success() throws Exception{ + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml"))); + + MockDeleteGenericVnf(); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map<String, String> variables = new HashMap<>(); + setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + Object cascadeDelete = BPMNUtil.getRawVariable(processEngineRule, "DeleteVnfInfra", "DELVI_cascadeDelete"); + String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; + String inUse = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "DELVI_vnfInUse"); + String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowException"); + + assertEquals(false, cascadeDelete); + assertEquals("true", found); + assertEquals("false", inUse); + assertEquals("Success", response); + assertEquals(null, workflowException); + } + + @Test + @Ignore // DoDeleteVnfAndModules not complete yet + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", + "subprocess/GenericDeleteVnf.bpmn", + "subprocess/DoDeleteVnfAndModules.bpmn", + "process/DeleteVnfInfra.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn"}) + public void testDeleteVnfInfra_cascadeDelete() throws Exception{ + MockGetGenericVnfById(); + MockDeleteGenericVnf(); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map<String, String> variables = new HashMap<>(); + setVariables(variables, deleteVnfInfraRequestCascadeDelete, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; + String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); + String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowException"); + Object cascadeDelete = BPMNUtil.getRawVariable(processEngineRule, "DeleteVnfInfra", "DELVI_cascadeDelete"); + + assertEquals(true, cascadeDelete); + assertEquals("true", found); + assertEquals("false", inUse); + assertEquals("Success", response); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", + "subprocess/GenericDeleteVnf.bpmn", + "subprocess/DoDeleteVnf.bpmn", + "process/DeleteVnfInfra.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn"}) + public void testDeleteVnfInfra_success_vnfNotFound() throws Exception{ + + MockDeleteGenericVnf_404(); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map<String, String> variables = new HashMap<>(); + setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; + String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); + String response = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException"); + + assertEquals("false", found); + assertEquals("false", inUse); + assertEquals("Success", response); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", + "subprocess/GenericDeleteVnf.bpmn", + "subprocess/DoDeleteVnf.bpmn", + "process/DeleteVnfInfra.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn"}) + public void testDeleteVnfInfra_error_vnfInUse() throws Exception{ + + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml"))); + MockDeleteGenericVnf(); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map<String, String> variables = new HashMap<>(); + setVariables(variables, deleteVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "DeleteVnfInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; + String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "DeleteVnfInfra", "SavedWorkflowException1"); + + String exWfex = "WorkflowException[processKey=DoDeleteVnf,errorCode=5000,errorMessage=Can't Delete Generic Vnf. Generic Vnf is still in use.]"; + + assertEquals("true", found); + assertEquals("true", inUse); + assertEquals(exWfex, workflowException); + } + + private void setVariables(Map<String, String> variables, String request, String requestId, String siId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("bpmnRequest", request); + variables.put("mso-request-id", requestId); + variables.put("serviceInstanceId",siId); + variables.put("vnfId","testVnfId123"); + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java index 453e562f75..16433caa4c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateSIRollbackTest.java @@ -43,157 +43,157 @@ import org.openecomp.mso.bpmn.core.RollbackData; * Unit test cases for DoCreateServiceInstanceRollback.bpmn
*/
public class DoCreateSIRollbackTest extends WorkflowTest {
- private static final String EOL = "\n";
- private final CallbackSet callbacks = new CallbackSet();
- private final String sdncAdapterCallback =
- "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
- " <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoCreateSIRollbackTest() throws IOException {
- callbacks.put("deactivate", sdncAdapterCallback);
- callbacks.put("delete", sdncAdapterCallback);
- }
-
- /**
- * Sunny day VID scenario.
- *
- * @throws Exception
- */
- //@Ignore // File not found - unable to run the test. Also, Stubs need updating..
- @Test
- @Deployment(resources = {
- "subprocess/DoCreateServiceInstanceRollback.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericDeleteService.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn"})
- public void sunnyDay() throws Exception {
-
- logStart();
-
- //AAI
- MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
- MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
- //SDNC
- mockSDNCAdapter(200);
- //DB
- mockUpdateRequestDB(200, "DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> variables = new HashMap<>();
- setupVariables(variables);
- invokeSubProcess("DoCreateServiceInstanceRollback", businessKey, variables);
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "delete");
- waitForProcessEnd(businessKey, 10000);
- Assert.assertTrue(isProcessEnded(businessKey));
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateServiceInstanceRollback", "WorkflowException");
- System.out.println("workflowException:\n" + workflowException);
- assertEquals(null, workflowException);
-
- logEnd();
- }
-
- // Success Scenario
- private void setupVariables(Map<String, Object> variables) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("msoRequestId", "RaaTestRequestId-1");
- variables.put("mso-request-id", "RaaTestRequestId-1");
- variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
-
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
- rollbackData.put("SERVICEINSTANCE", "globalCustomerId", "SDN-ETHERNET-INTERNET");
- rollbackData.put("SERVICEINSTANCE", "serviceSubscriptionType", "123456789");
- rollbackData.put("SERVICEINSTANCE", "disablerollback", "false");
- rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true");
- rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true");
-
- String req = "<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"" + EOL +
- "xmlns:sdncadapter=\"http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1\" " + EOL +
- "xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\">" + EOL +
- "<sdncadapter:RequestHeader>" + EOL +
- "<sdncadapter:RequestId>b043d290-140d-4a38-a9b6-95d3b8bd27d4</sdncadapter:RequestId>" + EOL +
- "<sdncadapter:SvcInstanceId>MIS%252F1604%252F0026%252FSW_INTERNET</sdncadapter:SvcInstanceId>" + EOL +
- "<sdncadapter:SvcAction>deactivate</sdncadapter:SvcAction>" + EOL +
- "<sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>" + EOL +
- "<sdncadapter:CallbackUrl>http://localhost:8080/mso/SDNCAdapterCallbackService</sdncadapter:CallbackUrl>" + EOL +
- "</sdncadapter:RequestHeader>" + EOL +
- "<sdncadapterworkflow:SDNCRequestData>" + EOL +
- "<request-information>" + EOL +
- "<request-id>RaaTestRequestId-1</request-id>" + EOL +
- "<source>MSO</source>" + EOL +
- "<notification-url/>" + EOL +
- "<order-number/>" + EOL +
- "<order-version/>" + EOL +
- "<request-action>DeleteServiceInstance</request-action>" + EOL +
- "</request-information>" + EOL +
- "<service-information>" + EOL +
- "<service-id/>" + EOL +
- "<subscription-service-type>123456789</subscription-service-type>" + EOL +
- "<onap-model-information>" + EOL +
- "<model-invariant-uuid/>" + EOL +
- "<model-uuid/>" + EOL +
- "<model-version/>" + EOL +
- "<model-name/>" + EOL +
- "</onap-model-information>" + EOL +
- "<service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id>" + EOL +
- "<subscriber-name/>" + EOL +
- "<global-customer-id>SDN-ETHERNET-INTERNET</global-customer-id>" + EOL +
- "</service-information>" + EOL +
- "<service-request-input>" + EOL +
- "<service-instance-name/>" + EOL +
- "</service-request-input>" + EOL +
- "</sdncadapterworkflow:SDNCRequestData>" + EOL +
- "</sdncadapterworkflow:SDNCAdapterWorkflowRequest>";
-
- String req1 = "<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"" + EOL +
- "xmlns:sdncadapter=\"http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1\" " + EOL +
- "xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\">" + EOL +
- "<sdncadapter:RequestHeader>" + EOL +
- "<sdncadapter:RequestId>bca4fede-0804-4c13-af69-9e80b378150f</sdncadapter:RequestId>" + EOL +
- "<sdncadapter:SvcInstanceId>MIS%252F1604%252F0026%252FSW_INTERNET</sdncadapter:SvcInstanceId>" + EOL +
- "<sdncadapter:SvcAction>delete</sdncadapter:SvcAction>" + EOL +
- "<sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>" + EOL +
- "<sdncadapter:CallbackUrl>http://localhost:8080/mso/SDNCAdapterCallbackService</sdncadapter:CallbackUrl>" + EOL +
- "</sdncadapter:RequestHeader>" + EOL +
- "<sdncadapterworkflow:SDNCRequestData>" + EOL +
- "<request-information>" + EOL +
- "<request-id>RaaTestRequestId-1</request-id>" + EOL +
- "<source>MSO</source>" + EOL +
- "<notification-url/>" + EOL +
- "<order-number/>" + EOL +
- "<order-version/>" + EOL +
- "<request-action>DeleteServiceInstance</request-action>" + EOL +
- "</request-information>" + EOL +
- "<service-information>" + EOL +
- "<service-id/>" + EOL +
- "<subscription-service-type>123456789</subscription-service-type>" + EOL +
- "<onap-model-information>" + EOL +
- "<model-invariant-uuid/>" + EOL +
- "<model-uuid/>" + EOL +
- "<model-version/>" + EOL +
- "<model-name/>" + EOL +
- "</onap-model-information>" + EOL +
- "<service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id>" + EOL +
- "<subscriber-name/>" + EOL +
- "<global-customer-id>SDN-ETHERNET-INTERNET</global-customer-id>" + EOL +
- "</service-information>" + EOL +
- "<service-request-input>" + EOL +
- "<service-instance-name/>" + EOL +
- "</service-request-input>" + EOL +
- "</sdncadapterworkflow:SDNCRequestData>" + EOL +
- "</sdncadapterworkflow:SDNCAdapterWorkflowRequest>";
-
- rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", req);
-
- rollbackData.put("SERVICEINSTANCE", "sdncDelete", req1);
- variables.put("rollbackData", rollbackData);
-
- }
+ private static final String EOL = "\n";
+ private final CallbackSet callbacks = new CallbackSet();
+ private final String sdncAdapterCallback =
+ "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
+ " <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL +
+ " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
+ "</output>" + EOL;
+
+ public DoCreateSIRollbackTest() throws IOException {
+ callbacks.put("deactivate", sdncAdapterCallback);
+ callbacks.put("delete", sdncAdapterCallback);
+ }
+
+ /**
+ * Sunny day VID scenario.
+ *
+ * @throws Exception
+ */
+ //@Ignore // File not found - unable to run the test. Also, Stubs need updating..
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoCreateServiceInstanceRollback.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericDeleteService.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn" })
+ public void sunnyDay() throws Exception {
+
+ logStart();
+
+ //AAI
+ MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml");
+ MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
+ //SDNC
+ mockSDNCAdapter(200);
+ //DB
+ mockUpdateRequestDB(200, "DBUpdateResponse.xml");
+ String businessKey = UUID.randomUUID().toString();
+
+ Map<String, Object> variables = new HashMap<>();
+ setupVariables(variables);
+ invokeSubProcess("DoCreateServiceInstanceRollback", businessKey, variables);
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ waitForProcessEnd(businessKey, 10000);
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateServiceInstanceRollback", "WorkflowException");
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+
+ logEnd();
+ }
+
+ // Success Scenario
+ private void setupVariables(Map<String, Object> variables) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "RaaTestRequestId-1");
+ variables.put("mso-request-id", "RaaTestRequestId-1");
+ variables.put("serviceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET");
+
+ RollbackData rollbackData = new RollbackData();
+
+ rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET");
+ rollbackData.put("SERVICEINSTANCE", "globalCustomerId", "SDN-ETHERNET-INTERNET");
+ rollbackData.put("SERVICEINSTANCE", "serviceSubscriptionType", "123456789");
+ rollbackData.put("SERVICEINSTANCE", "disablerollback", "false");
+ rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true");
+ rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true");
+
+ String req = "<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"" + EOL +
+ "xmlns:sdncadapter=\"http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1\" " + EOL +
+ "xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\">" + EOL +
+ "<sdncadapter:RequestHeader>" + EOL +
+ "<sdncadapter:RequestId>b043d290-140d-4a38-a9b6-95d3b8bd27d4</sdncadapter:RequestId>" + EOL +
+ "<sdncadapter:SvcInstanceId>MIS%252F1604%252F0026%252FSW_INTERNET</sdncadapter:SvcInstanceId>" + EOL +
+ "<sdncadapter:SvcAction>deactivate</sdncadapter:SvcAction>" + EOL +
+ "<sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>" + EOL +
+ "<sdncadapter:CallbackUrl>http://localhost:8080/mso/SDNCAdapterCallbackService</sdncadapter:CallbackUrl>" + EOL +
+ "</sdncadapter:RequestHeader>" + EOL +
+ "<sdncadapterworkflow:SDNCRequestData>" + EOL +
+ "<request-information>" + EOL +
+ "<request-id>RaaTestRequestId-1</request-id>" + EOL +
+ "<source>MSO</source>" + EOL +
+ "<notification-url/>" + EOL +
+ "<order-number/>" + EOL +
+ "<order-version/>" + EOL +
+ "<request-action>DeleteServiceInstance</request-action>" + EOL +
+ "</request-information>" + EOL +
+ "<service-information>" + EOL +
+ "<service-id/>" + EOL +
+ "<subscription-service-type>123456789</subscription-service-type>" + EOL +
+ "<onap-model-information>" + EOL +
+ "<model-invariant-uuid/>" + EOL +
+ "<model-uuid/>" + EOL +
+ "<model-version/>" + EOL +
+ "<model-name/>" + EOL +
+ "</onap-model-information>" + EOL +
+ "<service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id>" + EOL +
+ "<subscriber-name/>" + EOL +
+ "<global-customer-id>SDN-ETHERNET-INTERNET</global-customer-id>" + EOL +
+ "</service-information>" + EOL +
+ "<service-request-input>" + EOL +
+ "<service-instance-name/>" + EOL +
+ "</service-request-input>" + EOL +
+ "</sdncadapterworkflow:SDNCRequestData>" + EOL +
+ "</sdncadapterworkflow:SDNCAdapterWorkflowRequest>";
+
+ String req1 = "<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5=\"http://org.openecomp/mso/request/types/v1\"" + EOL +
+ "xmlns:sdncadapter=\"http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1\" " + EOL +
+ "xmlns:sdncadapterworkflow=\"http://org.openecomp/mso/workflow/schema/v1\">" + EOL +
+ "<sdncadapter:RequestHeader>" + EOL +
+ "<sdncadapter:RequestId>bca4fede-0804-4c13-af69-9e80b378150f</sdncadapter:RequestId>" + EOL +
+ "<sdncadapter:SvcInstanceId>MIS%252F1604%252F0026%252FSW_INTERNET</sdncadapter:SvcInstanceId>" + EOL +
+ "<sdncadapter:SvcAction>delete</sdncadapter:SvcAction>" + EOL +
+ "<sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>" + EOL +
+ "<sdncadapter:CallbackUrl>http://localhost:8080/mso/SDNCAdapterCallbackService</sdncadapter:CallbackUrl>" + EOL +
+ "</sdncadapter:RequestHeader>" + EOL +
+ "<sdncadapterworkflow:SDNCRequestData>" + EOL +
+ "<request-information>" + EOL +
+ "<request-id>RaaTestRequestId-1</request-id>" + EOL +
+ "<source>MSO</source>" + EOL +
+ "<notification-url/>" + EOL +
+ "<order-number/>" + EOL +
+ "<order-version/>" + EOL +
+ "<request-action>DeleteServiceInstance</request-action>" + EOL +
+ "</request-information>" + EOL +
+ "<service-information>" + EOL +
+ "<service-id/>" + EOL +
+ "<subscription-service-type>123456789</subscription-service-type>" + EOL +
+ "<onap-model-information>" + EOL +
+ "<model-invariant-uuid/>" + EOL +
+ "<model-uuid/>" + EOL +
+ "<model-version/>" + EOL +
+ "<model-name/>" + EOL +
+ "</onap-model-information>" + EOL +
+ "<service-instance-id>MIS%252F1604%252F0026%252FSW_INTERNET</service-instance-id>" + EOL +
+ "<subscriber-name/>" + EOL +
+ "<global-customer-id>SDN-ETHERNET-INTERNET</global-customer-id>" + EOL +
+ "</service-information>" + EOL +
+ "<service-request-input>" + EOL +
+ "<service-instance-name/>" + EOL +
+ "</service-request-input>" + EOL +
+ "</sdncadapterworkflow:SDNCRequestData>" + EOL +
+ "</sdncadapterworkflow:SDNCAdapterWorkflowRequest>";
+
+ rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", req);
+
+ rollbackData.put("SERVICEINSTANCE", "sdncDelete",req1);
+ variables.put("rollbackData",rollbackData);
+
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java index 5f2ee94fb5..f6c5d904bd 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstanceTest.java @@ -44,75 +44,75 @@ import org.openecomp.mso.bpmn.common.WorkflowTest; * Unit test cases for DoCreateServiceInstance.bpmn */ public class DoCreateServiceInstanceTest extends WorkflowTest { - private static final String EOL = "\n"; - private final CallbackSet callbacks = new CallbackSet(); - private final String sdncAdapterCallback = - "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL + - " <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL + - " <ack-final-indicator>Y</ack-final-indicator>" + EOL + - "</output>" + EOL; + private static final String EOL = "\n"; + private final CallbackSet callbacks = new CallbackSet(); + private final String sdncAdapterCallback = + "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL + + " <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL + + " <ack-final-indicator>Y</ack-final-indicator>" + EOL + + "</output>" + EOL; + + public DoCreateServiceInstanceTest() throws IOException { + callbacks.put("assign", sdncAdapterCallback); + } + + /** + * Sunny day VID scenario. + * + * @throws Exception + */ + //@Ignore // File not found - unable to run the test. Also, Stubs need updating.. + @Test + @Deployment(resources = { + "subprocess/DoCreateServiceInstance.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/GenericPutService.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/DoCreateServiceInstanceRollback.bpmn", + "subprocess/FalloutHandler.bpmn" }) + public void sunnyDay() throws Exception { - public DoCreateServiceInstanceTest() throws IOException { - callbacks.put("assign", sdncAdapterCallback); - } + logStart(); - /** - * Sunny day VID scenario. - * - * @throws Exception - */ - //@Ignore // File not found - unable to run the test. Also, Stubs need updating.. - @Test - @Deployment(resources = { - "subprocess/DoCreateServiceInstance.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericPutService.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/DoCreateServiceInstanceRollback.bpmn", - "subprocess/FalloutHandler.bpmn"}) - public void sunnyDay() throws Exception { + //AAI + MockGetCustomer("MCBH-1610", "CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml"); + MockPutServiceInstance("MCBH-1610", "viprsvc", "RaaTest-si-id", ""); + MockGetServiceInstance("MCBH-1610", "viprsvc", "RaaTest-si-id", "GenericFlows/getServiceInstance.xml"); + MockNodeQueryServiceInstanceByName("RAATest-si", ""); + + MockNodeQueryServiceInstanceById("RaaTest-si-id", ""); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml"); + MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); + //SDNC + mockSDNCAdapter(200); + //DB + mockUpdateRequestDB(200, "DBUpdateResponse.xml"); + String businessKey = UUID.randomUUID().toString(); - logStart(); + Map<String, Object> variables = new HashMap<>(); + setupVariables(variables); + invokeSubProcess("DoCreateServiceInstance", businessKey, variables); + injectSDNCCallbacks(callbacks, "assign"); + waitForProcessEnd(businessKey, 10000); + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateServiceInstance", "WorkflowException"); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); - //AAI - MockGetCustomer("MCBH-1610", "CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml"); - MockPutServiceInstance("MCBH-1610", "viprsvc", "RaaTest-si-id", ""); - MockGetServiceInstance("MCBH-1610", "viprsvc", "RaaTest-si-id", "GenericFlows/getServiceInstance.xml"); - MockNodeQueryServiceInstanceByName("RAATest-si", ""); + logEnd(); + } - MockNodeQueryServiceInstanceById("RaaTest-si-id", ""); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml"); - MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - //SDNC - mockSDNCAdapter(200); - //DB - mockUpdateRequestDB(200, "DBUpdateResponse.xml"); - String businessKey = UUID.randomUUID().toString(); - - Map<String, Object> variables = new HashMap<>(); - setupVariables(variables); - invokeSubProcess("DoCreateServiceInstance", businessKey, variables); - injectSDNCCallbacks(callbacks, "assign"); - waitForProcessEnd(businessKey, 10000); - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateServiceInstance", "WorkflowException"); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - - logEnd(); - } - - // Success Scenario - private void setupVariables(Map<String, Object> variables) { - variables.put("mso-request-id", "RaaDSITest1"); - variables.put("isDebugLogEnabled", "true"); - variables.put("msoRequestId", "RaaDSITestRequestId-1"); - variables.put("serviceInstanceId", "RaaTest-si-id"); - variables.put("serviceModelInfo", "{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelVersionUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"}"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("globalSubscriberId", "MCBH-1610"); - variables.put("subscriptionServiceType", "viprsvc"); - variables.put("instanceName", "RAATest-1"); - } + // Success Scenario + private void setupVariables(Map<String, Object> variables) { + variables.put("mso-request-id", "RaaDSITest1"); + variables.put("isDebugLogEnabled", "true"); + variables.put("msoRequestId", "RaaDSITestRequestId-1"); + variables.put("serviceInstanceId","RaaTest-si-id"); + variables.put("serviceModelInfo", "{\"modelType\":\"service\",\"modelInvariantUuid\":\"uuid-miu-svc-011-abcdef\",\"modelVersionUuid\":\"ASDC_TOSCA_UUID\",\"modelName\":\"SIModelName1\",\"modelVersion\":\"2\"}"); + variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + variables.put("globalSubscriberId", "MCBH-1610"); + variables.put("subscriptionServiceType", "viprsvc"); + variables.put("instanceName", "RAATest-1"); + } }
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java index 366327a9da..25787c79b6 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -46,115 +46,116 @@ import org.openecomp.mso.bpmn.core.WorkflowException; * Unit test for DoDeleteVfModule.bpmn.
*/
public class DoCreateVfModuleRollbackTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- private static final String EOL = "\n";
-
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- private final String vnfAdapterDeleteCallbackFail =
- "<vfModuleException>" + EOL +
- " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
- " <category>INTERNAL</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL;
-
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoCreateVfModuleRollbackTest() throws IOException {
- callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
- callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
- }
-
- @Test
-
- @Deployment(resources = {
- "subprocess/DoCreateVfModuleRollback.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestCreateVfModuleRollbackSuccess() {
- logStart();
-
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
- mockVNFDelete("a27ce5a9-29c4-4c22-a017-6615ac73c721", "/973ed047-d251-4fb9-bf1a-65b8949e0a73", 202);
- MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021", 200);
- MockDeleteVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "0000073", 200);
- MockPutVfModuleIdNoResponse("a27ce5a9-29c4-4c22-a017-6615ac73c721", "MMSC", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- MockPutGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
- MockGetGenericVnfByIdWithDepth("a27ce5a9-29c4-4c22-a017-6615ac73c721", 1, "DoCreateVfModuleRollback/GenericVnf.xml");
- MockGetVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "DoCreateVfModuleRollback/GenericVnfVfModule.xml", 200);
- MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = new RollbackData();
- rollbackData.put("VFMODULE", "source", "PORTAL");
- rollbackData.put("VFMODULE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE", "vnfname", "STMTN5MMSC21");
- rollbackData.put("VFMODULE", "vnftype", "asc_heat-int");
- rollbackData.put("VFMODULE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- rollbackData.put("VFMODULE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
- rollbackData.put("VFMODULE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
- rollbackData.put("VFMODULE", "aiccloudregion", "RDM2WAGPLCP");
- rollbackData.put("VFMODULE", "heatstackid", "thisisaheatstack");
- rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
- rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
- rollbackData.put("VFMODULE", "oamManagementV6Address", "2000:abc:bce:1111");
- rollbackData.put("VFMODULE", "oamManagementV4Address", "127.0.0.1");
-
- rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "true");
- rollbackData.put("VFMODULE", "rollbackVnfAdapterCreate", "true");
- rollbackData.put("VFMODULE", "rollbackUpdateAAIVfModule", "true");
- rollbackData.put("VFMODULE", "rollbackSDNCRequestActivate", "true");
- rollbackData.put("VFMODULE", "rollbackCreateAAIVfModule", "true");
- rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "true");
- rollbackData.put("VFMODULE", "rollbackUpdateVnfAAI", "true");
-
-
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("rollbackData", rollbackData);
- variables.put("sdncVersion", "1702");
- invokeSubProcess("DoCreateVfModuleRollback", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ private final CallbackSet callbacks = new CallbackSet();
+
+ private static final String EOL = "\n";
+
+ private final String vnfAdapterDeleteCallback =
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
+ " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</deleteVfModuleResponse>" + EOL;
+
+ private final String vnfAdapterDeleteCallbackFail =
+ "<vfModuleException>" + EOL +
+ " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
+ " <category>INTERNAL</category>" + EOL +
+ " <rolledBack>false</rolledBack>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</vfModuleException>" + EOL;
+
+ private final String sdncAdapterDeleteCallback =
+ "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
+ " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
+ " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
+ "</output>" + EOL;
+
+ public DoCreateVfModuleRollbackTest() throws IOException {
+ callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
+ callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
+ callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
+ callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
+ }
+
+ @Test
+
+ @Deployment(resources = {
+ "subprocess/DoCreateVfModuleRollback.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void TestCreateVfModuleRollbackSuccess() {
+ logStart();
+
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
+ mockVNFDelete("a27ce5a9-29c4-4c22-a017-6615ac73c721", "/973ed047-d251-4fb9-bf1a-65b8949e0a73", 202);
+ MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021", 200);
+ MockDeleteVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "0000073", 200);
+ MockPutVfModuleIdNoResponse("a27ce5a9-29c4-4c22-a017-6615ac73c721", "MMSC", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ MockPutGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ MockGetGenericVnfByIdWithDepth("a27ce5a9-29c4-4c22-a017-6615ac73c721", 1, "DoCreateVfModuleRollback/GenericVnf.xml");
+ MockGetVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "DoCreateVfModuleRollback/GenericVnfVfModule.xml", 200);
+ MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = new RollbackData();
+ rollbackData.put("VFMODULE", "source", "PORTAL");
+ rollbackData.put("VFMODULE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE", "vnfname", "STMTN5MMSC21");
+ rollbackData.put("VFMODULE", "vnftype", "asc_heat-int");
+ rollbackData.put("VFMODULE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ rollbackData.put("VFMODULE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
+ rollbackData.put("VFMODULE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
+ rollbackData.put("VFMODULE", "aiccloudregion", "RDM2WAGPLCP");
+ rollbackData.put("VFMODULE", "heatstackid", "thisisaheatstack");
+ rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
+ rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
+ rollbackData.put("VFMODULE", "oamManagementV6Address", "2000:abc:bce:1111");
+ rollbackData.put("VFMODULE", "oamManagementV4Address", "127.0.0.1");
+
+ rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "true");
+ rollbackData.put("VFMODULE", "rollbackVnfAdapterCreate", "true");
+ rollbackData.put("VFMODULE", "rollbackUpdateAAIVfModule", "true");
+ rollbackData.put("VFMODULE", "rollbackSDNCRequestActivate", "true");
+ rollbackData.put("VFMODULE", "rollbackCreateAAIVfModule", "true");
+ rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "true");
+ rollbackData.put("VFMODULE", "rollbackUpdateVnfAAI", "true");
+
+
+
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("rollbackData", rollbackData);
+ variables.put("sdncVersion", "1702");
+ invokeSubProcess("DoCreateVfModuleRollback", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- checkVariable(businessKey, "WorkflowException", null);
- if (wfe != null) {
- System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
-
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ injectSDNCCallbacks(callbacks, "sdncDelete");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ checkVariable(businessKey, "WorkflowException", null);
+ if (wfe != null) {
+ System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java index 02c8a98401..d62c7598cb 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -49,248 +49,248 @@ import org.openecomp.mso.bpmn.mock.FileUtil; * Unit tests for DoCreateVfModuleTest.bpmn.
*/
public class DoCreateVfModuleTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateVfModuleTest() throws IOException {
- callbacks.put("assign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("queryVnf", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml"));
- callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml"));
- callbacks.put("queryModule", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfCreate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
- }
-
- /**
- * Test the sunny day scenario.
- */
- @Test
-
- @Deployment(resources = {
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void sunnyDay() throws IOException {
-
- logStart();
-
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPost("", 202, "skask");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- //RuntimeService runtimeService = processEngineRule.getRuntimeService();
-
- Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
- //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
- invokeSubProcess("DoCreateVfModule", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "queryVnf");
- injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
-
- logEnd();
- }
-
- /**
- * Test the sunny day scenario with 1702 SDNC interaction.
- */
- @Test
-
- @Deployment(resources = {
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void sunnyDay_1702() throws IOException {
-
- logStart();
-
- MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5);
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutVfModuleIdNoResponse("skask", "PCRF", ".*");
- MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
- MockPutGenericVnf("skask");
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPost("", 202, "skask");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
-
- String businessKey = UUID.randomUUID().toString();
- //RuntimeService runtimeService = processEngineRule.getRuntimeService();
-
- Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
- variables.put("sdncVersion", "1702");
- //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
- invokeSubProcess("DoCreateVfModule", businessKey, variables);
-
-
- injectSDNCCallbacks(callbacks, "assign, queryModule");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
-
- logEnd();
- }
-
- /**
- * Test the sunny day scenario.
- */
- @Test
-
- @Deployment(resources = {
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/GenerateVfModuleName.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn"
- })
- public void sunnyDay_withVfModuleNameGeneration() throws IOException {
-
- logStart();
-
- MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5);
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutVfModuleIdNoResponse("skask", "PCRF", ".*");
- MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
- MockPutGenericVnf("skask");
- MockAAIVfModule();
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPost("", 202, "skask");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
-
- String businessKey = UUID.randomUUID().toString();
- //RuntimeService runtimeService = processEngineRule.getRuntimeService();
-
- Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
- variables.put("vfModuleName", null);
- variables.put("vfModuleLabel", "MODULELABEL");
- variables.put("sdncVersion", "1702");
- //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
- invokeSubProcess("DoCreateVfModule", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "assign, query");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
-
- logEnd();
- }
-
-
- private Map<String, Object> setupVariablesSunnyDayBuildingBlocks() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
-
- variables.put("mso-request-id", "testRequestId");
-
- variables.put("msoRequestId", "testRequestId");
- variables.put("isBaseVfModule", false);
- variables.put("isDebugLogEnabled", "true");
- variables.put("disableRollback", "true");
- //variables.put("recipeTimeout", "0");
- //variables.put("requestAction", "CREATE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfName", "vnfname");
- variables.put("vfModuleName", "PCRF::module-0-2");
- variables.put("vnfType", "vSAMP12");
- variables.put("vfModuleId", "");
- variables.put("volumeGroupId", "");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- variables.put("isVidRequest", "true");
- variables.put("asdcServiceModelVersion", "1.0");
- variables.put("usePreload", true);
-
- String vfModuleModelInfo = "{ " + "\"modelType\": \"vfModule\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "\"modelCustomizationUuid\": \"MODEL-123\"" + "}";
- variables.put("vfModuleModelInfo", vfModuleModelInfo);
-
- variables.put("sdncVersion", "1707");
-
- variables.put("lcpCloudRegionId", "MDTWNJ21");
- variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
-
- String serviceModelInfo = "{ " + "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"aa5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"bb6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"SVC-STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
-
- String vnfModelInfo = "{ " + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"445256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"f26478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"VNF-STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "\"modelCustomizationUuid\": \"VNF-MODEL-123\"" + "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- variables.put("vnfQueryPath", "/restconf/vnfQueryPath");
-
- return variables;
-
- }
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateVfModuleTest() throws IOException {
+ callbacks.put("assign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("queryVnf", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml"));
+ callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml"));
+ callbacks.put("queryModule", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("vnfCreate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
+ }
+
+ /**
+ * Test the sunny day scenario.
+ */
+ @Test
+
+ @Deployment(resources = {
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn"
+ })
+ public void sunnyDay() throws IOException {
+
+ logStart();
+
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPost("", 202, "skask");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ //RuntimeService runtimeService = processEngineRule.getRuntimeService();
+
+ Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
+ //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
+ invokeSubProcess("DoCreateVfModule", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "queryVnf");
+ injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ /**
+ * Test the sunny day scenario with 1702 SDNC interaction.
+ */
+ @Test
+
+ @Deployment(resources = {
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn"
+ })
+ public void sunnyDay_1702() throws IOException {
+
+ logStart();
+
+ MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5);
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutVfModuleIdNoResponse("skask", "PCRF", ".*");
+ MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
+ MockPutGenericVnf("skask");
+ mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPost("", 202, "skask");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+
+ String businessKey = UUID.randomUUID().toString();
+ //RuntimeService runtimeService = processEngineRule.getRuntimeService();
+
+ Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
+ variables.put("sdncVersion", "1702");
+ //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
+ invokeSubProcess("DoCreateVfModule", businessKey, variables);
+
+
+ injectSDNCCallbacks(callbacks, "assign, queryModule");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ /**
+ * Test the sunny day scenario.
+ */
+ @Test
+
+ @Deployment(resources = {
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/GenerateVfModuleName.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn"
+ })
+ public void sunnyDay_withVfModuleNameGeneration() throws IOException {
+
+ logStart();
+
+ MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5);
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutVfModuleIdNoResponse("skask", "PCRF", ".*");
+ MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
+ MockPutGenericVnf("skask");
+ MockAAIVfModule();
+ mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPost("", 202, "skask");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+
+ String businessKey = UUID.randomUUID().toString();
+ //RuntimeService runtimeService = processEngineRule.getRuntimeService();
+
+ Map<String, Object> variables = setupVariablesSunnyDayBuildingBlocks();
+ variables.put("vfModuleName", null);
+ variables.put("vfModuleLabel", "MODULELABEL");
+ variables.put("sdncVersion", "1702");
+ //runtimeService.startProcessInstanceByKey("DoCreateVfModule", variables);
+ invokeSubProcess("DoCreateVfModule", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "assign, query");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ Assert.assertTrue((boolean) getRawVariable(processEngineRule, "DoCreateVfModule", "DCVFM_SuccessIndicator"));
+
+ logEnd();
+ }
+
+
+ private Map<String, Object> setupVariablesSunnyDayBuildingBlocks() {
+ Map<String, Object> variables = new HashMap<>();
+ //try {
+ // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
+ //}
+ //catch (Exception e) {
+
+ //}
+
+ variables.put("mso-request-id", "testRequestId");
+
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("isBaseVfModule", false);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("disableRollback", "true");
+ //variables.put("recipeTimeout", "0");
+ //variables.put("requestAction", "CREATE_VF_MODULE");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "skask");
+ variables.put("vnfName", "vnfname");
+ variables.put("vfModuleName", "PCRF::module-0-2");
+ variables.put("vnfType", "vSAMP12");
+ variables.put("vfModuleId", "");
+ variables.put("volumeGroupId", "");
+ variables.put("serviceType", "MOG");
+ variables.put("vfModuleType", "");
+ variables.put("isVidRequest", "true");
+ variables.put("asdcServiceModelVersion", "1.0");
+ variables.put("usePreload", true);
+
+ String vfModuleModelInfo = "{ "+ "\"modelType\": \"vfModule\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"STMTN5MMSC21-MMSC::model-1-0\"," +
+ "\"modelVersion\": \"1\"," +
+ "\"modelCustomizationUuid\": \"MODEL-123\"" + "}";
+ variables.put("vfModuleModelInfo", vfModuleModelInfo);
+
+ variables.put("sdncVersion", "1707");
+
+ variables.put("lcpCloudRegionId", "MDTWNJ21");
+ variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
+
+ String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
+ "\"modelInvariantUuid\": \"aa5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"bb6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"SVC-STMTN5MMSC21-MMSC::model-1-0\"," +
+ "\"modelVersion\": \"1\"," +
+ "}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+
+ String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," +
+ "\"modelInvariantUuid\": \"445256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"f26478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"VNF-STMTN5MMSC21-MMSC::model-1-0\"," +
+ "\"modelVersion\": \"1\"," +
+ "\"modelCustomizationUuid\": \"VNF-MODEL-123\"" + "}";
+ variables.put("vnfModelInfo", vnfModelInfo);
+
+ variables.put("vnfQueryPath", "/restconf/vnfQueryPath");
+
+ return variables;
+
+ }
}
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java index aeb47c00a9..e9082d9d65 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV2Test.java @@ -35,210 +35,206 @@ import org.openecomp.mso.bpmn.mock.FileUtil; @Ignore
public class DoCreateVfModuleVolumeV2Test extends WorkflowTest {
-
- public static final String _prefix = "CVFMODVOL2_";
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateVfModuleVolumeV2Test() throws IOException {
- callbacks.put("volumeGroupCreate", FileUtil.readResourceFile(
- "__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml"));
- callbacks.put("volumeGroupRollback", FileUtil.readResourceFile(
- "__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml"));
- }
-
- /**
- * Happy Path
- *
- * @throws Exception
- */
- @Test
- //@Ignore
- @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
+
+ public static final String _prefix = "CVFMODVOL2_";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateVfModuleVolumeV2Test() throws IOException {
+ callbacks.put("volumeGroupCreate", FileUtil.readResourceFile(
+ "__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml"));
+ callbacks.put("volumeGroupRollback", FileUtil.readResourceFile(
+ "__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml"));
+ }
+
+ /**
+ * Happy Path
+ * @throws Exception
+ */
+ @Test
+ //@Ignore
+ @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/vnfAdapterRestV1.bpmn",
"subprocess/DoCreateVfModuleVolumeRollback.bpmn"})
- public void TestHappyPath() throws Exception {
-
- logStart();
+ public void TestHappyPath() throws Exception {
+ logStart();
+
// DoCreateVfModuleVolume_Success();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- testVariables.put("lcpCloudRegionId", "AAIAIC25");
- testVariables.put("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-01");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- //testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", true);
-
- logEnd();
- }
-
- @Test
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
+ testVariables.put("vnfId", "TEST-VNF-ID-0123");
+ testVariables.put("lcpCloudRegionId", "AAIAIC25");
+ testVariables.put("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-01");
+ testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ //testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
+
+ injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", true);
+
+ logEnd();
+ }
+
+ @Test
// @Ignore
- @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
+ @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/vnfAdapterRestV1.bpmn",
"subprocess/DoCreateVfModuleVolumeRollback.bpmn"})
- public void TestVolumeGroupExistError() throws Exception {
-
- logStart();
+ public void TestVolumeGroupExistError() throws Exception {
+ logStart();
+
// DoCreateVfModuleVolume_VolumeGroupExistsFail();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
- testVariables.put("vnf-id", "TEST-VNF-ID-0123");
- testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
-
- //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1");
- Assert.assertTrue(wfe.getErrorCode() == 2500);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404."));
- checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Will trigger AAI create rollback
- *
- * @throws Exception
- */
- @Test
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
+ testVariables.put("vnf-id", "TEST-VNF-ID-0123");
+ testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+ testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
+
+ //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
+
+ waitForProcessEnd(businessKey, 100000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1");
+ Assert.assertTrue(wfe.getErrorCode() == 2500);
+ Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404."));
+ checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
+
+ logEnd();
+ }
+
+ /**
+ * Will trigger AAI create rollback
+ * @throws Exception
+ */
+ @Test
// @Ignore
- @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
+ @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/vnfAdapterRestV1.bpmn",
"subprocess/DoCreateVfModuleVolumeRollback.bpmn"})
- public void TestVnfVolumeGroupCreateError() throws Exception {
-
- logStart();
+ public void TestVnfVolumeGroupCreateError() throws Exception {
+ logStart();
+
// DoCreateVfModuleVolume_VnfCreateVolumeGroupFail();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
- testVariables.put("vnf-id", "TEST-VNF-ID-0123");
- testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
-
- //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Will trigger AAI create rollback
- *
- * @throws Exception
- */
- @Test
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
+ testVariables.put("vnf-id", "TEST-VNF-ID-0123");
+ testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+ testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
+
+ //injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
+
+ logEnd();
+ }
+
+ /**
+ * Will trigger AAI create rollback
+ * @throws Exception
+ */
+ @Test
// @Ignore
- @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
+ @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/vnfAdapterRestV1.bpmn",
"subprocess/DoCreateVfModuleVolumeRollback.bpmn"})
- public void TestUpdateAaiVolumeGroupError() throws Exception {
-
- logStart();
+ public void TestUpdateAaiVolumeGroupError() throws Exception {
+ logStart();
+
// DoCreateVfModuleVolume_AaiVolumeGroupUpdateFail();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
- testVariables.put("vnf-id", "TEST-VNF-ID-0123");
- testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
-
- // VNF callback not needed fort this failure scenario
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
+ testVariables.put("vnf-id", "TEST-VNF-ID-0123");
+ testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+ testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
+
+ // VNF callback not needed fort this failure scenario
// injectVNFRestCallbacks(callbacks, "volumeGroupCreate,volumeGroupRollback");
-
- waitForProcessEnd(businessKey, 100000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1");
- Assert.assertTrue(wfe.getErrorCode() == 2500);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404."));
- checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
-
- logEnd();
- }
-
- /**
- * Will trigger not trigger rollback
- *
- * @throws Exception
- */
- @Test
+
+ waitForProcessEnd(businessKey, 100000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1");
+ Assert.assertTrue(wfe.getErrorCode() == 2500);
+ Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404."));
+ checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
+
+ logEnd();
+ }
+
+ /**
+ * Will trigger not trigger rollback
+ * @throws Exception
+ */
+ @Test
// @Ignore
- @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
+ @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV2.bpmn",
"subprocess/FalloutHandler.bpmn",
"subprocess/CompleteMsoProcess.bpmn",
"subprocess/vnfAdapterRestV1.bpmn",
"subprocess/DoCreateVfModuleVolumeRollback.bpmn"})
- public void TestUpdateAaiVolumeGroupErrorNoRollback() throws Exception {
-
- logStart();
+ public void TestUpdateAaiVolumeGroupErrorNoRollback() throws Exception {
+ logStart();
+
// DoCreateVfModuleVolume_AaiVolumeGroupUpdateFail();
-
- String businessKey = UUID.randomUUID().toString();
- String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
- testVariables.put("vnf-id", "TEST-VNF-ID-0123");
- testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
- testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
- testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
- TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
-
- // VNF callback not needed fort this failure scenario
+
+ String businessKey = UUID.randomUUID().toString();
+ String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("DCVFMODVOLV2_volumeGroupId", "TEST-VOLUME-VOLUME-GROUP-ID-0123");
+ testVariables.put("vnf-id", "TEST-VNF-ID-0123");
+ testVariables.put("volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ testVariables.put("test-volume-group-name", "TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0");
+ testVariables.put("test-volume-group-id", "TEST-VOLUME-GROUP-ID-0123");
+ testVariables.put("DoCreateVfModuleVolumeV1Request", createVfModuleVolRequest);
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("DoCreateVfModuleVolumeV2", "v1", businessKey, createVfModuleVolRequest, testVariables);
+
+ // VNF callback not needed fort this failure scenario
// injectVNFRestCallbacks(callbacks, "volumeGroupCreate");
-
- waitForProcessEnd(businessKey, 100000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1");
- Assert.assertTrue(wfe.getErrorCode() == 2500);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404."));
- checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
-
- logEnd();
- }
+
+ waitForProcessEnd(businessKey, 100000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "SavedWorkflowException1");
+ Assert.assertTrue(wfe.getErrorCode() == 2500);
+ Assert.assertTrue(wfe.getErrorMessage().startsWith("Generic vnf null was not found in AAI. Return code: 404."));
+ checkVariable(businessKey, "DCVFMODVOLV2_SuccessIndicator", false);
+
+ logEnd();
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java index adcbbb4d72..fb2160d970 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesRollbackTest.java @@ -55,370 +55,371 @@ import org.openecomp.mso.bpmn.mock.FileUtil; * Unit test for DoCreateVnfAndModulesRollback.bpmn.
*/
public class DoCreateVnfAndModulesRollbackTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- private static final String EOL = "\n";
-
-
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- private final String vnfAdapterDeleteCallbackFail =
- "<vfModuleException>" + EOL +
- " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
- " <category>INTERNAL</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL;
-
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoCreateVnfAndModulesRollbackTest() throws IOException {
- callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
- callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
- callbacks.put("deactivate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- }
-
- @Test
- @Ignore
- @Deployment(resources = {
- "subprocess/DoCreateVnfAndModulesRollback.bpmn",
- "subprocess/DoCreateVfModuleRollback.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn"
- })
- public void TestDoCreateVnfAndModulesRollbackSuccess_BaseOnly() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>changedelete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
- mockVNFDelete(".*", "/.*", 202);
- mockVfModuleDelete("78987");
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
- MockGetGenericVnfByName("STMTN5MMSC21", "DoCreateVfModule_getVnfResponse.xml");
- MockGetGenericVnfById("/a27ce5a9-29c4-4c22-a017-6615ac73c721.*", "DoCreateVfModule_getVnfResponse.xml", 200);
- MockPutVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021");
- MockDeleteVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "0000073", 200);
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put("VFMODULE_BASE", "source", "PORTAL");
- rollbackData.put("VFMODULE_BASE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_BASE", "vnfname", "STMTN5MMSC21");
- rollbackData.put("VFMODULE_BASE", "vnftype", "asc_heat-int");
- rollbackData.put("VFMODULE_BASE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- rollbackData.put("VFMODULE_BASE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
- rollbackData.put("VFMODULE_BASE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
- rollbackData.put("VFMODULE_BASE", "aiccloudregion", "RDM2WAGPLCP");
- rollbackData.put("VFMODULE_BASE", "heatstackid", "thisisaheatstack");
- rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
- rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
- rollbackData.put("VFMODULE_BASE", "oamManagementV6Address", "2000:abc:bce:1111");
- rollbackData.put("VFMODULE_BASE", "oamManagementV4Address", "127.0.0.1");
-
- rollbackData.put("VFMODULE_BASE", "rollbackPrepareUpdateVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackVnfAdapterCreate", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackUpdateAAIVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackSDNCRequestActivate", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackCreateAAIVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackCreateNetworkPoliciesAAI", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackUpdateVnfAAI", "true");
-
- rollbackData.put("VNF", "vnfId", "testVnfId123");
-
- rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0");
-
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_BASE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_BASE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
- variables.put("rollbackData", rollbackData);
- invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ private final CallbackSet callbacks = new CallbackSet();
+
+ private static final String EOL = "\n";
+
+
+
+ private final String vnfAdapterDeleteCallback =
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
+ " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</deleteVfModuleResponse>" + EOL;
+
+ private final String vnfAdapterDeleteCallbackFail =
+ "<vfModuleException>" + EOL +
+ " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
+ " <category>INTERNAL</category>" + EOL +
+ " <rolledBack>false</rolledBack>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</vfModuleException>" + EOL;
+
+ private final String sdncAdapterDeleteCallback =
+ "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
+ " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
+ " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
+ "</output>" + EOL;
+
+ public DoCreateVnfAndModulesRollbackTest() throws IOException {
+ callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
+ callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
+ callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
+ callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
+ callbacks.put("deactivate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ }
+
+ @Test
+ @Ignore
+ @Deployment(resources = {
+ "subprocess/DoCreateVnfAndModulesRollback.bpmn",
+ "subprocess/DoCreateVfModuleRollback.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericDeleteVnf.bpmn",
+ "subprocess/DoDeleteVnf.bpmn"
+ })
+ public void TestDoCreateVnfAndModulesRollbackSuccess_BaseOnly() {
+ // delete the Base Module and Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ logStart();
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>changedelete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
+ mockVNFDelete(".*", "/.*", 202);
+ mockVfModuleDelete("78987");
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ MockGetGenericVnfByName("STMTN5MMSC21", "DoCreateVfModule_getVnfResponse.xml");
+ MockGetGenericVnfById("/a27ce5a9-29c4-4c22-a017-6615ac73c721.*", "DoCreateVfModule_getVnfResponse.xml", 200);
+ MockPutVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021");
+ MockDeleteVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", "0000073", 200);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = new RollbackData();
+
+ rollbackData.put("VFMODULE_BASE", "source", "PORTAL");
+ rollbackData.put("VFMODULE_BASE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE_BASE", "vnfname", "STMTN5MMSC21");
+ rollbackData.put("VFMODULE_BASE", "vnftype", "asc_heat-int");
+ rollbackData.put("VFMODULE_BASE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ rollbackData.put("VFMODULE_BASE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
+ rollbackData.put("VFMODULE_BASE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
+ rollbackData.put("VFMODULE_BASE", "aiccloudregion", "RDM2WAGPLCP");
+ rollbackData.put("VFMODULE_BASE", "heatstackid", "thisisaheatstack");
+ rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
+ rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
+ rollbackData.put("VFMODULE_BASE", "oamManagementV6Address", "2000:abc:bce:1111");
+ rollbackData.put("VFMODULE_BASE", "oamManagementV4Address", "127.0.0.1");
+
+ rollbackData.put("VFMODULE_BASE", "rollbackPrepareUpdateVfModule", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackVnfAdapterCreate", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackUpdateAAIVfModule", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackSDNCRequestActivate", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackCreateAAIVfModule", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackCreateNetworkPoliciesAAI", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackUpdateVnfAAI", "true");
+
+ rollbackData.put("VNF", "vnfId", "testVnfId123");
+
+ rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0");
+
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE_BASE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE_BASE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+
+ variables.put("rollbackData", rollbackData);
+ invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- checkVariable(businessKey, "WorkflowException", null);
- if (wfe != null) {
- System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoCreateVnfAndModulesRollback.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn"
- })
- public void TestDoCreateVnfAndModulesRollbackSuccess_vnfOnly() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- MockDoDeleteVfModule_SDNCSuccess();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put("VNF", "vnfId", "testVnfId123");
- rollbackData.put("VNF", "rollbackVnfCreate", "true");
- rollbackData.put("VNF", "rollbackSDNCAssign", "true");
- rollbackData.put("VNF", "rollbackSDNCActivate", "true");
- rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0");
-
-
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
-
- variables.put("rollbackData", rollbackData);
- variables.put("sdncVersion", "1707");
- invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000);
+ injectSDNCCallbacks(callbacks, "sdncDelete");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ checkVariable(businessKey, "WorkflowException", null);
+ if (wfe != null) {
+ System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoCreateVnfAndModulesRollback.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericDeleteVnf.bpmn",
+ "subprocess/DoDeleteVnf.bpmn"
+ })
+ public void TestDoCreateVnfAndModulesRollbackSuccess_vnfOnly() {
+ // delete the Base Module and Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ logStart();
+ MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
+ MockDeleteGenericVnf("testVnfId123", "testReVer123");
+ MockDoDeleteVfModule_SDNCSuccess();
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = new RollbackData();
+
+ rollbackData.put("VNF", "vnfId", "testVnfId123");
+ rollbackData.put("VNF", "rollbackVnfCreate", "true");
+ rollbackData.put("VNF", "rollbackSDNCAssign", "true");
+ rollbackData.put("VNF", "rollbackSDNCActivate", "true");
+ rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0");
+
+
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+
+
+ variables.put("rollbackData", rollbackData);
+ variables.put("sdncVersion", "1707");
+ invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000);
- // injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- checkVariable(businessKey, "WorkflowException", null);
- if (wfe != null) {
- System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- @Test
- @Ignore
- @Deployment(resources = {
- "subprocess/DoCreateVnfAndModulesRollback.bpmn",
- "subprocess/DoCreateVfModuleRollback.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn"
- })
- public void TestDoCreateVnfAndModulesRollbackSuccess_AddOn() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>changedelete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
- mockVNFDelete(".*", "/.*", 202);
- mockVfModuleDelete("78987");
- MockGetGenericVnfByName("STMTN5MMSC21", "DoCreateVfModule_getVnfResponse.xml");
- MockGetGenericVnfById("/a27ce5a9-29c4-4c22-a017-6615ac73c721", "DoCreateVfModule_getVnfResponse.xml", 200);
- MockGetGenericVnfByIdWithDepth("a27ce5a9-29c4-4c22-a017-6615ac73c721", 1, "DoCreateVfModuleRollback/GenericVnf.xml");
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
- MockPutVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021");
- MockDeleteVfModuleId("", "", "", 200);
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- RollbackData rollbackData = new RollbackData();
-
- rollbackData.put("VFMODULE_BASE", "source", "PORTAL");
- rollbackData.put("VFMODULE_BASE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_BASE", "vnfname", "STMTN5MMSC21");
- rollbackData.put("VFMODULE_BASE", "vnftype", "asc_heat-int");
- rollbackData.put("VFMODULE_BASE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- rollbackData.put("VFMODULE_BASE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
- rollbackData.put("VFMODULE_BASE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
- rollbackData.put("VFMODULE_BASE", "aiccloudregion", "RDM2WAGPLCP");
- rollbackData.put("VFMODULE_BASE", "heatstackid", "thisisaheatstack");
- rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
- rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
- rollbackData.put("VFMODULE_BASE", "oamManagementV6Address", "2000:abc:bce:1111");
- rollbackData.put("VFMODULE_BASE", "oamManagementV4Address", "127.0.0.1");
- rollbackData.put("VFMODULE_BASE", "rollbackPrepareUpdateVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackVnfAdapterCreate", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackUpdateAAIVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackSDNCRequestActivate", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackCreateAAIVfModule", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackCreateNetworkPoliciesAAI", "true");
- rollbackData.put("VFMODULE_BASE", "rollbackUpdateVnfAAI", "true");
- rollbackData.put("VFMODULE_BASE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_BASE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
-
- rollbackData.put("VFMODULE_ADDON_1", "source", "PORTAL");
- rollbackData.put("VFMODULE_ADDON_1", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_ADDON_1", "vnfname", "STMTN5MMSC21");
- rollbackData.put("VFMODULE_ADDON_1", "vnftype", "asc_heat-int");
- rollbackData.put("VFMODULE_ADDON_1", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- rollbackData.put("VFMODULE_ADDON_1", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
- rollbackData.put("VFMODULE_ADDON_1", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
- rollbackData.put("VFMODULE_ADDON_1", "aiccloudregion", "RDM2WAGPLCP");
- rollbackData.put("VFMODULE_ADDON_1", "heatstackid", "thisisaheatstack");
- rollbackData.put("VFMODULE_ADDON_1", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
- rollbackData.put("VFMODULE_ADDON_1", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
- rollbackData.put("VFMODULE_ADDON_1", "oamManagementV6Address", "2000:abc:bce:1111");
- rollbackData.put("VFMODULE_ADDON_1", "oamManagementV4Address", "127.0.0.1");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackPrepareUpdateVfModule", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackVnfAdapterCreate", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackUpdateAAIVfModule", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackSDNCRequestActivate", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackCreateAAIVfModule", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackCreateNetworkPoliciesAAI", "true");
- rollbackData.put("VFMODULE_ADDON_1", "rollbackUpdateVnfAAI", "true");
- rollbackData.put("VFMODULE_ADDON_1", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- rollbackData.put("VFMODULE_ADDON_1", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
- rollbackData.put("VNF", "vnfId", "testVnfId123");
-
- rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "1");
-
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
-
- variables.put("rollbackData", rollbackData);
- invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
- // injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- checkVariable(businessKey, "WorkflowException", null);
- if (wfe != null) {
- System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- public static void MockDoDeleteVfModule_SDNCSuccess() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>deactivate"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>unassign"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- }
+ //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000);
+ // injectSDNCCallbacks(callbacks, "sdncDelete");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ checkVariable(businessKey, "WorkflowException", null);
+ if (wfe != null) {
+ System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+ @Test
+ @Ignore
+ @Deployment(resources = {
+ "subprocess/DoCreateVnfAndModulesRollback.bpmn",
+ "subprocess/DoCreateVfModuleRollback.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericDeleteVnf.bpmn",
+ "subprocess/DoDeleteVnf.bpmn"
+ })
+ public void TestDoCreateVnfAndModulesRollbackSuccess_AddOn() {
+ // delete the Base Module and Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ logStart();
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>changedelete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>delete", 200, "DeleteGenericVNFV1/sdncAdapterResponse.xml");
+ mockVNFDelete(".*", "/.*", 202);
+ mockVfModuleDelete("78987");
+ MockGetGenericVnfByName("STMTN5MMSC21", "DoCreateVfModule_getVnfResponse.xml");
+ MockGetGenericVnfById("/a27ce5a9-29c4-4c22-a017-6615ac73c721", "DoCreateVfModule_getVnfResponse.xml", 200);
+ MockGetGenericVnfByIdWithDepth("a27ce5a9-29c4-4c22-a017-6615ac73c721", 1, "DoCreateVfModuleRollback/GenericVnf.xml");
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ MockPutVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ MockDeleteGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721", "0000021");
+ MockDeleteVfModuleId("", "", "", 200);
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = new RollbackData();
+
+ rollbackData.put("VFMODULE_BASE", "source", "PORTAL");
+ rollbackData.put("VFMODULE_BASE", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE_BASE", "vnfname", "STMTN5MMSC21");
+ rollbackData.put("VFMODULE_BASE", "vnftype", "asc_heat-int");
+ rollbackData.put("VFMODULE_BASE", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ rollbackData.put("VFMODULE_BASE", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
+ rollbackData.put("VFMODULE_BASE", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
+ rollbackData.put("VFMODULE_BASE", "aiccloudregion", "RDM2WAGPLCP");
+ rollbackData.put("VFMODULE_BASE", "heatstackid", "thisisaheatstack");
+ rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
+ rollbackData.put("VFMODULE_BASE", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
+ rollbackData.put("VFMODULE_BASE", "oamManagementV6Address", "2000:abc:bce:1111");
+ rollbackData.put("VFMODULE_BASE", "oamManagementV4Address", "127.0.0.1");
+ rollbackData.put("VFMODULE_BASE", "rollbackPrepareUpdateVfModule", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackVnfAdapterCreate", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackUpdateAAIVfModule", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackSDNCRequestActivate", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackCreateAAIVfModule", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackCreateNetworkPoliciesAAI", "true");
+ rollbackData.put("VFMODULE_BASE", "rollbackUpdateVnfAAI", "true");
+ rollbackData.put("VFMODULE_BASE", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE_BASE", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+
+
+ rollbackData.put("VFMODULE_ADDON_1", "source", "PORTAL");
+ rollbackData.put("VFMODULE_ADDON_1", "vnfid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE_ADDON_1", "vnfname", "STMTN5MMSC21");
+ rollbackData.put("VFMODULE_ADDON_1", "vnftype", "asc_heat-int");
+ rollbackData.put("VFMODULE_ADDON_1", "vfmoduleid", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ rollbackData.put("VFMODULE_ADDON_1", "vfmodulename", "STMTN5MMSC21-MMSC::module-0-0");
+ rollbackData.put("VFMODULE_ADDON_1", "tenantid", "fba1bd1e195a404cacb9ce17a9b2b421");
+ rollbackData.put("VFMODULE_ADDON_1", "aiccloudregion", "RDM2WAGPLCP");
+ rollbackData.put("VFMODULE_ADDON_1", "heatstackid", "thisisaheatstack");
+ rollbackData.put("VFMODULE_ADDON_1", "contrailNetworkPolicyFqdn0", "MSOTest:DefaultPolicyFQDN1");
+ rollbackData.put("VFMODULE_ADDON_1", "contrailNetworkPolicyFqdn1", "MSOTest:DefaultPolicyFQDN2");
+ rollbackData.put("VFMODULE_ADDON_1", "oamManagementV6Address", "2000:abc:bce:1111");
+ rollbackData.put("VFMODULE_ADDON_1", "oamManagementV4Address", "127.0.0.1");
+ rollbackData.put("VFMODULE_ADDON_1", "rollbackPrepareUpdateVfModule", "true");
+ rollbackData.put("VFMODULE_ADDON_1", "rollbackVnfAdapterCreate", "true");
+ rollbackData.put("VFMODULE_ADDON_1", "rollbackUpdateAAIVfModule", "true");
+ rollbackData.put("VFMODULE_ADDON_1", "rollbackSDNCRequestActivate", "true");
+ rollbackData.put("VFMODULE_ADDON_1", "rollbackCreateAAIVfModule", "true");
+ rollbackData.put("VFMODULE_ADDON_1", "rollbackCreateNetworkPoliciesAAI", "true");
+ rollbackData.put("VFMODULE_ADDON_1", "rollbackUpdateVnfAAI", "true");
+ rollbackData.put("VFMODULE_ADDON_1", "msorequestid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ rollbackData.put("VFMODULE_ADDON_1", "serviceinstanceid", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+
+ rollbackData.put("VNF", "vnfId", "testVnfId123");
+
+ rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "1");
+
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+
+
+ variables.put("rollbackData", rollbackData);
+ invokeSubProcess("DoCreateVnfAndModulesRollback", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
+ // injectSDNCCallbacks(callbacks, "sdncChangeDelete");
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ //waitForRunningProcessCount("DoCreateVnfAndModulesRollback", 0, 120000);
+ injectSDNCCallbacks(callbacks, "sdncDelete");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ checkVariable(businessKey, "WorkflowException", null);
+ if (wfe != null) {
+ System.out.println("TestCreateVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+ public static void MockDoDeleteVfModule_SDNCSuccess() {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>deactivate"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>unassign"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ }
}
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java index 37a5b4b806..c8f97cac04 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfAndModulesTest.java @@ -53,320 +53,322 @@ import org.openecomp.mso.bpmn.mock.FileUtil; /**
* Unit Test for the DoCreateVnfAndModules Flow
+ *
*/
public class DoCreateVnfAndModulesTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoCreateVnfAndModulesTest() throws IOException {
-
- callbacks.put("assign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("queryVnf", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml"));
- callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml"));
- callbacks.put("queryModule", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
- callbacks.put("vnfCreate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
- }
-
- @Test
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateVnfAndModulesTest() throws IOException {
+
+ callbacks.put("assign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("queryVnf", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml"));
+ callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml"));
+ callbacks.put("queryModule", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
+ callbacks.put("vnfCreate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
+ }
+
+ @Test
@Ignore // IGNORED FOR 1710 MERGE TO ONAP
- @Deployment(resources = {"subprocess/GenericGetService.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericPutVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/DoCreateVnf.bpmn",
- "subprocess/GenerateVfModuleName.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/DoCreateVnfAndModules.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DoCreateVnfAndModulesRollback.bpmn"})
- public void testDoCreateVnfAndModulesBaseOnly_success() throws Exception {
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- MockGetGenericVnfById_404("testVnfId");
- MockPutGenericVnf(".*");
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
-
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- invokeSubProcess("DoCreateVnfAndModules", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "query");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "queryVnf");
- injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- assertVariables("true", "true", "false", "true", "Success", null);
-
- }
-
- @Test
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericPutVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/DoCreateVnf.bpmn",
+ "subprocess/GenerateVfModuleName.bpmn",
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/DoCreateVnfAndModules.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DoCreateVnfAndModulesRollback.bpmn"})
+ public void testDoCreateVnfAndModulesBaseOnly_success() throws Exception{
+
+ MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+ MockGetGenericVnfById_404("testVnfId");
+ MockPutGenericVnf(".*");
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ MockVNFAdapterRestVfModule();
+ MockDBUpdateVfModule();
+
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
+ invokeSubProcess("DoCreateVnfAndModules", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "query");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "queryVnf");
+ injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ assertVariables("true", "true", "false", "true", "Success", null);
+
+ }
+
+ @Test
@Ignore // IGNORED FOR 1710 MERGE TO ONAP
- @Deployment(resources = {"subprocess/GenericGetService.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericPutVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/DoCreateVnf.bpmn",
- "subprocess/GenerateVfModuleName.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/DoCreateVnfAndModules.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DoCreateVnfAndModulesRollback.bpmn"})
- public void testDoCreateVnfAndModulesWithAddon_success() throws Exception {
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- MockGetGenericVnfById_404("testVnfId");
- MockPutGenericVnf(".*");
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesAddonSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- invokeSubProcess("DoCreateVnfAndModules", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "assign");
- injectSDNCCallbacks(callbacks, "query");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "queryVnf");
- injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "queryVnf");
- injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
- injectVNFRestCallbacks(callbacks, "vnfCreate");
- injectSDNCCallbacks(callbacks, "activate");
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- assertVariables("true", "true", "false", "true", "Success", null);
-
- }
-
- private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) {
-
- String siFound = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGS_FoundIndicator");
- String siSucc = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGS_SuccessIndicator");
- String vnfFound = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGV_FoundIndicator");
- String vnfSucc = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGV_SuccessIndicator");
- String response = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "WorkflowResponse");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "SavedWorkflowException1");
-
- //assertEquals(exSIFound, siFound);
- //assertEquals(exSISucc, siSucc);
- //assertEquals(exVnfFound, vnfFound);
- //assertEquals(exVnfSucc, vnfSucc);
- //assertEquals(exResponse, response);
- assertEquals(exWorkflowException, workflowException);
- }
-
- private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("bpmnRequest", request);
- variables.put("mso-request-id", requestId);
- variables.put("serviceInstanceId", siId);
- variables.put("testVnfId", "testVnfId123");
- variables.put("vnfType", "STMTN");
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", requestId);
- variables.put("requestId", requestId);
- variables.put("msoRequestId", requestId);
- variables.put("serviceInstanceId", siId);
- variables.put("disableRollback", "true");
- //variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
-
- String serviceModelInfo = "{ " + "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- String cloudConfiguration = "{" + "\"cloudConfiguration\": { " +
- "\"lcpCloudRegionId\": \"mdt1\"," +
- "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}";
- variables.put("cloudConfiguration", cloudConfiguration);
- variables.put("sdncVersion", "1707");
- variables.put("globalSubscriberId", "subscriber123");
-
- try {
- String serviceDecomposition = FileUtil.readResourceFile("__files/VIPR/serviceDecompositionATMFW.json");
- ServiceDecomposition sd = new ServiceDecomposition();
- ModelInfo serviceModel = new ModelInfo();
- serviceModel.setModelName("servicewithVNFs");
- sd.setModelInfo(serviceModel);
- VnfResource vr = new VnfResource();
- ModelInfo mvr = new ModelInfo();
- mvr.setModelName("vSAMP12");
- mvr.setModelInstanceName("v123");
- mvr.setModelInvariantUuid("");
- mvr.setModelVersion("1.0");
- mvr.setModelCustomizationUuid("MODEL-ID-1234");
- vr.setModelInfo(mvr);
- vr.constructVnfType("vnf1");
- vr.setNfType("somenftype");
- vr.setNfRole("somenfrole");
- vr.setNfFunction("somenffunction");
- vr.setNfNamingCode("somenamingcode");
- ModuleResource mr = new ModuleResource();
- ModelInfo mvmr = new ModelInfo();
- mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
- mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
- mvmr.setModelVersion("1");
- mvmr.setModelCustomizationUuid("MODEL-123");
- mr.setModelInfo(mvmr);
- mr.setIsBase(true);
- mr.setVfModuleLabel("MODULELABEL");
- vr.addVfModule(mr);
- sd.addVnfResource(vr);
-
- variables.put("serviceDecomposition", sd);
- variables.put("isTest", true);
- } catch (Exception e) {
-
- }
-
- }
-
- private void setVariablesAddonSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", requestId);
- variables.put("requestId", requestId);
- variables.put("msoRequestId", requestId);
- variables.put("serviceInstanceId", siId);
- variables.put("disableRollback", "true");
- //variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
-
- String serviceModelInfo = "{ " + "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- String cloudConfiguration = "{" + "\"cloudConfiguration\": { " +
- "\"lcpCloudRegionId\": \"mdt1\"," +
- "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}";
- variables.put("cloudConfiguration", cloudConfiguration);
- variables.put("sdncVersion", "1707");
- variables.put("globalSubscriberId", "subscriber123");
-
- try {
- String serviceDecomposition = FileUtil.readResourceFile("__files/VIPR/serviceDecompositionATMFW.json");
- ServiceDecomposition sd = new ServiceDecomposition();
- ModelInfo serviceModel = new ModelInfo();
- serviceModel.setModelName("servicewithVNFs");
- sd.setModelInfo(serviceModel);
- VnfResource vr = new VnfResource();
- ModelInfo mvr = new ModelInfo();
- mvr.setModelName("vSAMP12");
- mvr.setModelInstanceName("v123");
- mvr.setModelInvariantUuid("");
- mvr.setModelVersion("1.0");
- mvr.setModelCustomizationUuid("MODEL-ID-1234");
- vr.setModelInfo(mvr);
- vr.setNfType("somenftype");
- vr.setNfRole("somenfrole");
- vr.setNfFunction("somenffunction");
- vr.setNfNamingCode("somenamingcode");
- ModuleResource mr = new ModuleResource();
- ModelInfo mvmr = new ModelInfo();
- mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
- mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
- mvmr.setModelVersion("1");
- mvmr.setModelCustomizationUuid("MODEL-123");
- mr.setModelInfo(mvmr);
- mr.setIsBase(true);
- mr.setVfModuleLabel("MODULELABEL");
- vr.addVfModule(mr);
- ModuleResource mr1 = new ModuleResource();
- ModelInfo mvmr1 = new ModelInfo();
- mvmr1.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
- mvmr1.setModelName("STMTN5MMSC21-MMSC::model-1-0");
- mvmr1.setModelVersion("1");
- mvmr1.setModelCustomizationUuid("MODEL-123");
- mr1.setModelInfo(mvmr1);
- mr1.setIsBase(false);
- mr1.setVfModuleLabel("MODULELABEL");
- mr1.setInitialCount(1);
- vr.addVfModule(mr1);
-
- sd.addVnfResource(vr);
-
- variables.put("serviceDecomposition", sd);
- variables.put("isTest", true);
- } catch (Exception e) {
-
-
- }
- }
+ @Deployment(resources = {"subprocess/GenericGetService.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericPutVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/DoCreateVnf.bpmn",
+ "subprocess/GenerateVfModuleName.bpmn",
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/DoCreateVnfAndModules.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DoCreateVnfAndModulesRollback.bpmn"})
+ public void testDoCreateVnfAndModulesWithAddon_success() throws Exception{
+
+ MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+ MockGetGenericVnfById_404("testVnfId");
+ MockPutGenericVnf(".*");
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ MockVNFAdapterRestVfModule();
+ MockDBUpdateVfModule();
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesAddonSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
+ invokeSubProcess("DoCreateVnfAndModules", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "query");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "queryVnf");
+ injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "queryVnf");
+ injectSDNCCallbacks(callbacks, "assign, queryModuleNoVnf");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ assertVariables("true", "true", "false", "true", "Success", null);
+
+ }
+
+ private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) {
+
+ String siFound = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGS_FoundIndicator");
+ String siSucc = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGS_SuccessIndicator");
+ String vnfFound = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGV_FoundIndicator");
+ String vnfSucc = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "GENGV_SuccessIndicator");
+ String response = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "WorkflowResponse");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "SavedWorkflowException1");
+
+ //assertEquals(exSIFound, siFound);
+ //assertEquals(exSISucc, siSucc);
+ //assertEquals(exVnfFound, vnfFound);
+ //assertEquals(exVnfSucc, vnfSucc);
+ //assertEquals(exResponse, response);
+ assertEquals(exWorkflowException, workflowException);
+ }
+
+ private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("bpmnRequest", request);
+ variables.put("mso-request-id", requestId);
+ variables.put("serviceInstanceId",siId);
+ variables.put("testVnfId","testVnfId123");
+ variables.put("vnfType", "STMTN");
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", requestId);
+ variables.put("requestId", requestId);
+ variables.put("msoRequestId", requestId);
+ variables.put("serviceInstanceId",siId);
+ variables.put("disableRollback", "true");
+ //variables.put("testVnfId","testVnfId123");
+ variables.put("vnfType", "STMTN");
+
+ String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
+ "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"ServicevSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"vSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}";
+ variables.put("vnfModelInfo", vnfModelInfo);
+
+ String cloudConfiguration = "{" + "\"cloudConfiguration\": { " +
+ "\"lcpCloudRegionId\": \"mdt1\"," +
+ "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}";
+ variables.put("cloudConfiguration", cloudConfiguration);
+ variables.put("sdncVersion", "1707");
+ variables.put("globalSubscriberId", "subscriber123");
+
+ try {
+ String serviceDecomposition = FileUtil.readResourceFile("__files/VIPR/serviceDecompositionATMFW.json");
+ ServiceDecomposition sd = new ServiceDecomposition();
+ ModelInfo serviceModel = new ModelInfo();
+ serviceModel.setModelName("servicewithVNFs");
+ sd.setModelInfo(serviceModel);
+ VnfResource vr = new VnfResource();
+ ModelInfo mvr = new ModelInfo();
+ mvr.setModelName("vSAMP12");
+ mvr.setModelInstanceName("v123");
+ mvr.setModelInvariantUuid("");
+ mvr.setModelVersion("1.0");
+ mvr.setModelCustomizationUuid("MODEL-ID-1234");
+ vr.setModelInfo(mvr);
+ vr.constructVnfType("vnf1");
+ vr.setNfType("somenftype");
+ vr.setNfRole("somenfrole");
+ vr.setNfFunction("somenffunction");
+ vr.setNfNamingCode("somenamingcode");
+ ModuleResource mr = new ModuleResource();
+ ModelInfo mvmr = new ModelInfo();
+ mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
+ mvmr.setModelVersion("1");
+ mvmr.setModelCustomizationUuid("MODEL-123");
+ mr.setModelInfo(mvmr);
+ mr.setIsBase(true);
+ mr.setVfModuleLabel("MODULELABEL");
+ vr.addVfModule(mr);
+ sd.addVnfResource(vr);
+
+ variables.put("serviceDecomposition", sd);
+ variables.put("isTest", true);
+ } catch(Exception e) {
+
+ }
+
+ }
+
+ private void setVariablesAddonSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", requestId);
+ variables.put("requestId", requestId);
+ variables.put("msoRequestId", requestId);
+ variables.put("serviceInstanceId",siId);
+ variables.put("disableRollback", "true");
+ //variables.put("testVnfId","testVnfId123");
+ variables.put("vnfType", "STMTN");
+
+ String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
+ "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"ServicevSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"vSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}";
+ variables.put("vnfModelInfo", vnfModelInfo);
+
+ String cloudConfiguration = "{" + "\"cloudConfiguration\": { " +
+ "\"lcpCloudRegionId\": \"mdt1\"," +
+ "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}";
+ variables.put("cloudConfiguration", cloudConfiguration);
+ variables.put("sdncVersion", "1707");
+ variables.put("globalSubscriberId", "subscriber123");
+
+ try {
+ String serviceDecomposition = FileUtil.readResourceFile("__files/VIPR/serviceDecompositionATMFW.json");
+ ServiceDecomposition sd = new ServiceDecomposition();
+ ModelInfo serviceModel = new ModelInfo();
+ serviceModel.setModelName("servicewithVNFs");
+ sd.setModelInfo(serviceModel);
+ VnfResource vr = new VnfResource();
+ ModelInfo mvr = new ModelInfo();
+ mvr.setModelName("vSAMP12");
+ mvr.setModelInstanceName("v123");
+ mvr.setModelInvariantUuid("");
+ mvr.setModelVersion("1.0");
+ mvr.setModelCustomizationUuid("MODEL-ID-1234");
+ vr.setModelInfo(mvr);
+ vr.setNfType("somenftype");
+ vr.setNfRole("somenfrole");
+ vr.setNfFunction("somenffunction");
+ vr.setNfNamingCode("somenamingcode");
+ ModuleResource mr = new ModuleResource();
+ ModelInfo mvmr = new ModelInfo();
+ mvmr.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
+ mvmr.setModelVersion("1");
+ mvmr.setModelCustomizationUuid("MODEL-123");
+ mr.setModelInfo(mvmr);
+ mr.setIsBase(true);
+ mr.setVfModuleLabel("MODULELABEL");
+ vr.addVfModule(mr);
+ ModuleResource mr1 = new ModuleResource();
+ ModelInfo mvmr1 = new ModelInfo();
+ mvmr1.setModelInvariantUuid("ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ mvmr1.setModelName("STMTN5MMSC21-MMSC::model-1-0");
+ mvmr1.setModelVersion("1");
+ mvmr1.setModelCustomizationUuid("MODEL-123");
+ mr1.setModelInfo(mvmr1);
+ mr1.setIsBase(false);
+ mr1.setVfModuleLabel("MODULELABEL");
+ mr1.setInitialCount(1);
+ vr.addVfModule(mr1);
+
+ sd.addVnfResource(vr);
+
+ variables.put("serviceDecomposition", sd);
+ variables.put("isTest", true);
+ } catch(Exception e) {
+
+
+
+ }
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java index efd832735f..90d562e101 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java @@ -19,7 +19,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= - */ + */ package org.openecomp.mso.bpmn.infrastructure; @@ -46,82 +46,83 @@ import org.openecomp.mso.bpmn.mock.FileUtil; /** * Unit Test for the DoCreateVnf Flow + * */ public class DoCreateVnfTest extends WorkflowTest { - private String createVnfInfraRequest; - private final CallbackSet callbacks = new CallbackSet(); - - - public DoCreateVnfTest() throws IOException { - createVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json"); - callbacks.put("assign", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyAssignCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile( - "__files/VfModularity/SDNCTopologyActivateCallback.xml")); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/DoCreateVnf.bpmn"}) - public void testDoCreateVnfInfra_success() throws Exception { - - MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); - MockGetGenericVnfByName_404("testVnfName123"); - MockPutGenericVnf("testVnfId123"); - mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); - invokeSubProcess("DoCreateVnf", businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - assertVariables("true", "true", "false", "true", "Success", null); - } - - private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) { - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "SavedWorkflowException1"); - - assertEquals(exWorkflowException, workflowException); - } - - private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) { - variables.put("isDebugLogEnabled", "true"); - //variables.put("bpmnRequest", request); - variables.put("mso-request-id", requestId); - variables.put("serviceInstanceId", siId); - variables.put("vnfName", "testVnfName123"); - variables.put("disableRollback", "true"); - variables.put("requestId", requestId); - variables.put("testVnfId", "testVnfId123"); - variables.put("vnfType", "STMTN"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - String vnfModelInfo = "{ " + "\"modelType\": \"vnf\"," + - "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"vSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + - "}"; - variables.put("vnfModelInfo", vnfModelInfo); - - String cloudConfiguration = "{ " + - "\"lcpCloudRegionId\": \"mdt1\"," + - "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}"; - variables.put("cloudConfiguration", cloudConfiguration); - - String serviceModelInfo = "{ " + "\"modelType\": \"service\"," + - "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"ServicevSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "}"; - variables.put("serviceModelInfo", serviceModelInfo); - variables.put("globalSubscriberId", "MSO-1610"); - } + private String createVnfInfraRequest; + private final CallbackSet callbacks = new CallbackSet(); + + + public DoCreateVnfTest() throws IOException { + createVnfInfraRequest = FileUtil.readResourceFile("__files/InfrastructureFlows/CreateVnfInfraRequest.json"); + callbacks.put("assign", FileUtil.readResourceFile( + "__files/VfModularity/SDNCTopologyAssignCallback.xml")); + callbacks.put("activate", FileUtil.readResourceFile( + "__files/VfModularity/SDNCTopologyActivateCallback.xml")); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericPutVnf.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/DoCreateVnf.bpmn"}) + public void testDoCreateVnfInfra_success() throws Exception{ + + MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + MockGetGenericVnfByName_404("testVnfName123"); + MockPutGenericVnf("testVnfId123"); + mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml"); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, createVnfInfraRequest, "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET"); + invokeSubProcess("DoCreateVnf", businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + assertVariables("true", "true", "false", "true", "Success", null); + } + + private void assertVariables(String exSIFound, String exSISucc, String exVnfFound, String exVnfSucc, String exResponse, String exWorkflowException) { + String workflowException = BPMNUtil.getVariable(processEngineRule, "DoCreateVnf", "SavedWorkflowException1"); + + assertEquals(exWorkflowException, workflowException); + } + + private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) { + variables.put("isDebugLogEnabled", "true"); + //variables.put("bpmnRequest", request); + variables.put("mso-request-id", requestId); + variables.put("serviceInstanceId",siId); + variables.put("vnfName", "testVnfName123"); + variables.put("disableRollback", "true"); + variables.put("requestId", requestId); + variables.put("testVnfId","testVnfId123"); + variables.put("vnfType", "STMTN"); + variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," + + "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + + "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + + "\"modelName\": \"vSAMP12\"," + + "\"modelVersion\": \"1.0\"," + + "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + + "}"; + variables.put("vnfModelInfo", vnfModelInfo); + + String cloudConfiguration = "{ " + + "\"lcpCloudRegionId\": \"mdt1\"," + + "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}"; + variables.put("cloudConfiguration", cloudConfiguration); + + String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," + + "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," + + "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," + + "\"modelName\": \"ServicevSAMP12\"," + + "\"modelVersion\": \"1.0\"," + + "}"; + variables.put("serviceModelInfo", serviceModelInfo); + variables.put("globalSubscriberId", "MSO-1610"); + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java index a5d4a95ad1..37814999ba 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteServiceInstanceTest.java @@ -43,66 +43,66 @@ import org.openecomp.mso.bpmn.common.WorkflowTest; */ public class DoDeleteServiceInstanceTest extends WorkflowTest { - private final CallbackSet callbacks = new CallbackSet(); - private static final String EOL = "\n"; - private final String sdncAdapterCallback = - "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL + - " <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL + - " <ack-final-indicator>Y</ack-final-indicator>" + EOL + - "</output>" + EOL; + private final CallbackSet callbacks = new CallbackSet(); + private static final String EOL = "\n"; + private final String sdncAdapterCallback = + "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL + + " <svc-request-id>((REQUEST-ID))</svc-request-id>" + EOL + + " <ack-final-indicator>Y</ack-final-indicator>" + EOL + + "</output>" + EOL; + + public DoDeleteServiceInstanceTest() throws IOException { + callbacks.put("deactivate", sdncAdapterCallback); + callbacks.put("delete", sdncAdapterCallback); + } + + /** + * Sunny day VID scenario. + * + * @throws Exception + */ + //@Ignore // File not found - unable to run the test. Also, Stubs need updating.. + @Test + @Deployment(resources = { + "subprocess/DoDeleteServiceInstance.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/GenericDeleteService.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/FalloutHandler.bpmn" }) + public void sunnyDay() throws Exception { - public DoDeleteServiceInstanceTest() throws IOException { - callbacks.put("deactivate", sdncAdapterCallback); - callbacks.put("delete", sdncAdapterCallback); - } + logStart(); - /** - * Sunny day VID scenario. - * - * @throws Exception - */ - //@Ignore // File not found - unable to run the test. Also, Stubs need updating.. - @Test - @Deployment(resources = { - "subprocess/DoDeleteServiceInstance.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/GenericDeleteService.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/FalloutHandler.bpmn"}) - public void sunnyDay() throws Exception { + //AAI + MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "", 204); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml"); + MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); + //SDNC + mockSDNCAdapter(200); + //DB + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + String businessKey = UUID.randomUUID().toString(); - logStart(); + Map<String, Object> variables = new HashMap<>(); + setupVariables(variables); + invokeSubProcess("DoDeleteServiceInstance", businessKey, variables); + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + waitForProcessEnd(businessKey, 10000); + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteServiceInstance", "WorkflowException"); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); - //AAI - MockDeleteServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "", 204); - MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSINoRelations.xml"); - MockNodeQueryServiceInstanceById("MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); - //SDNC - mockSDNCAdapter(200); - //DB - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - String businessKey = UUID.randomUUID().toString(); + logEnd(); + } - Map<String, Object> variables = new HashMap<>(); - setupVariables(variables); - invokeSubProcess("DoDeleteServiceInstance", businessKey, variables); - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - waitForProcessEnd(businessKey, 10000); - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteServiceInstance", "WorkflowException"); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - - logEnd(); - } - - // Success Scenario - private void setupVariables(Map<String, Object> variables) { - variables.put("isDebugLogEnabled", "true"); - variables.put("msoRequestId", "RaaDDSIRequestId-1"); - variables.put("mso-request-id", "RaaDDSIRequestId-1"); - variables.put("serviceInstanceId", "MIS%252F1604%252F0026%252FSW_INTERNET"); - } + // Success Scenario + private void setupVariables(Map<String, Object> variables) { + variables.put("isDebugLogEnabled", "true"); + variables.put("msoRequestId", "RaaDDSIRequestId-1"); + variables.put("mso-request-id", "RaaDDSIRequestId-1"); + variables.put("serviceInstanceId","MIS%252F1604%252F0026%252FSW_INTERNET"); + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java index 16f3acfa8a..13b2f5432d 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleFromVnfTest.java @@ -41,136 +41,137 @@ import org.openecomp.mso.bpmn.common.WorkflowTest; import org.openecomp.mso.bpmn.core.WorkflowException;
public class DoDeleteVfModuleFromVnfTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- private static final String EOL = "\n";
-
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- private final String vnfAdapterDeleteCallbackFail =
- "<vfModuleException>" + EOL +
- " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
- " <category>INTERNAL</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL;
-
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoDeleteVfModuleFromVnfTest() throws IOException {
- callbacks.put("deactivate", sdncAdapterDeleteCallback);
- callbacks.put("unassign", sdncAdapterDeleteCallback);
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
- }
-
- private final String wfeString = "WorkflowException";
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModuleFromVnf.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn"
- })
- public void TestDoDeleteVfModuleFromVnfSuccess() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIDeleteVfModule();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("msoRequestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
- variables.put("sdncVersion", "1707");
-
- invokeSubProcess("DoDeleteVfModuleFromVnf", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- //waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- checkVariable(businessKey, wfeString, null);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
-
- // start of mocks used locally and by other VF Module unit tests
-
-
- public static void MockDoDeleteVfModule_SDNCSuccess() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>deactivate"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>unassign"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- }
-
-
- public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
-
+ private final CallbackSet callbacks = new CallbackSet();
+
+ private static final String EOL = "\n";
+
+ private final String vnfAdapterDeleteCallback =
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
+ " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</deleteVfModuleResponse>" + EOL;
+
+ private final String vnfAdapterDeleteCallbackFail =
+ "<vfModuleException>" + EOL +
+ " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
+ " <category>INTERNAL</category>" + EOL +
+ " <rolledBack>false</rolledBack>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</vfModuleException>" + EOL;
+
+ private final String sdncAdapterDeleteCallback =
+ "<output xmlns=\"com:att:sdnctl:l3api\">" + EOL +
+ " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
+ " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
+ "</output>" + EOL;
+
+ public DoDeleteVfModuleFromVnfTest() throws IOException {
+ callbacks.put("deactivate", sdncAdapterDeleteCallback);
+ callbacks.put("unassign", sdncAdapterDeleteCallback);
+ callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
+ callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
+ }
+
+ private final String wfeString = "WorkflowException";
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoDeleteVfModuleFromVnf.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn"
+ })
+ public void TestDoDeleteVfModuleFromVnfSuccess() {
+ // delete the Base Module and Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://org.openecomp/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ logStart();
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIGenericVnfSearch();
+ MockAAIDeleteVfModule();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("msoRequestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
+ variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
+ variables.put("sdncVersion", "1707");
+
+ invokeSubProcess("DoDeleteVfModuleFromVnf", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ //waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
+ checkVariable(businessKey, wfeString, null);
+ if (wfe != null) {
+ System.out.println("TestDoDeleteVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+
+ // start of mocks used locally and by other VF Module unit tests
+
+
+
+ public static void MockDoDeleteVfModule_SDNCSuccess() {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>deactivate"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>unassign"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ }
+
+
+ public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
+ stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
+
}
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java index e3ecf30f7a..578fda3910 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -49,516 +49,516 @@ import org.openecomp.mso.bpmn.mock.FileUtil; * Unit test for DoDeleteVfModule.bpmn.
*/
public class DoDeleteVfModuleTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- private static final String EOL = "\n";
-
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- private final String vnfAdapterDeleteCallbackFail =
- "<vfModuleException>" + EOL +
- " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
- " <category>INTERNAL</category>" + EOL +
- " <rolledBack>false</rolledBack>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</vfModuleException>" + EOL;
-
- private final String sdncAdapterDeleteCallback =
- "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
- " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
- " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
- "</output>" + EOL;
-
- public DoDeleteVfModuleTest() throws IOException {
- callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
- callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
- callbacks.put("vnfDelete", FileUtil.readResourceFile(
- "__files/DeleteVfModuleCallbackResponse.xml"));
- callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
- }
-
- private final String wfeString = "WorkflowException";
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModuleSuccess() {
- // delete the Base Module and Generic Vnf
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("DoDeleteVfModuleRequest", request);
- variables.put("isVidRequest", "true");
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ private final CallbackSet callbacks = new CallbackSet();
+
+ private static final String EOL = "\n";
+
+ private final String vnfAdapterDeleteCallback =
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
+ " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</deleteVfModuleResponse>" + EOL;
+
+ private final String vnfAdapterDeleteCallbackFail =
+ "<vfModuleException>" + EOL +
+ " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
+ " <category>INTERNAL</category>" + EOL +
+ " <rolledBack>false</rolledBack>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</vfModuleException>" + EOL;
+
+ private final String sdncAdapterDeleteCallback =
+ "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
+ " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
+ " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
+ "</output>" + EOL;
+
+ public DoDeleteVfModuleTest() throws IOException {
+ callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
+ callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
+ callbacks.put("vnfDelete", FileUtil.readResourceFile(
+ "__files/DeleteVfModuleCallbackResponse.xml"));
+ callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
+ }
+
+ private final String wfeString = "WorkflowException";
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void TestDoDeleteVfModuleSuccess() {
+ // delete the Base Module and Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ logStart();
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIGenericVnfSearch();
+ MockAAIVfModulePUT(false);
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("DoDeleteVfModuleRequest",request);
+ variables.put("isVidRequest", "true");
+ invokeSubProcess("DoDeleteVfModule", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- checkVariable(businessKey, wfeString, null);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModule_Building_Block_Success() {
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
-
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("requestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
- variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0");
- variables.put("sdncVersion", "1610");
- variables.put("isVidRequest", "true");
- variables.put("retainResources", false);
- String vfModuleModelInfo = "{" + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
- "}";
- variables.put("vfModuleModelInfo", vfModuleModelInfo);
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"RDM2WAGPLCP\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
- variables.put("cloudConfiguration", cloudConfiguration);
-
-
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ injectSDNCCallbacks(callbacks, "sdncDelete");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
+ checkVariable(businessKey, wfeString, null);
+ if (wfe != null) {
+ System.out.println("TestDoDeleteVfModuleSuccess: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void TestDoDeleteVfModule_Building_Block_Success() {
+ logStart();
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIGenericVnfSearch();
+ MockAAIVfModulePUT(false);
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("requestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("isDebugLogEnabled","true");
+ variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0");
+ variables.put("sdncVersion", "1610");
+ variables.put("isVidRequest", "true");
+ variables.put("retainResources", false);
+ String vfModuleModelInfo = "{" + "\"modelType\": \"vnf\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"vSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
+ "}";
+ variables.put("vfModuleModelInfo", vfModuleModelInfo);
+
+ String cloudConfiguration = "{" +
+ "\"lcpCloudRegionId\": \"RDM2WAGPLCP\"," +
+ "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
+ variables.put("cloudConfiguration", cloudConfiguration);
+
+
+ invokeSubProcess("DoDeleteVfModule", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- injectSDNCCallbacks(callbacks, "sdncDelete");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- checkVariable(businessKey, wfeString, null);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModule_Building_Block_Success: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- }
- logEnd();
- }
-
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModuleSDNCFailure() {
- // delete the Base Module and Generic Vnf - SDNCAdapter failure
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
-
- logStart();
- MockDoDeleteVfModule_SDNCFailure();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("DoDeleteVfModuleRequest", request);
- variables.put("isVidRequest", "true");
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ injectSDNCCallbacks(callbacks, "sdncDelete");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
+ checkVariable(businessKey, wfeString, null);
+ if (wfe != null) {
+ System.out.println("TestDoDeleteVfModule_Building_Block_Success: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ }
+ logEnd();
+ }
+
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void TestDoDeleteVfModuleSDNCFailure() {
+ // delete the Base Module and Generic Vnf - SDNCAdapter failure
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+
+ logStart();
+ MockDoDeleteVfModule_SDNCFailure();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIGenericVnfSearch();
+ MockAAIVfModulePUT(false);
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("DoDeleteVfModuleRequest", request);
+ variables.put("isVidRequest", "true");
+ invokeSubProcess("DoDeleteVfModule", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- // cause a failure by not injecting a callback
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ // cause a failure by not injecting a callback
// injectSDNCCallbacks(callbacks, "sdncDelete");
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- Assert.assertNotNull(wfe);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleSDNCFailure: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- Assert.assertTrue(wfe.getErrorCode() == 7000);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Could not communicate"));
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModuleSDNCCallbackFailure() {
- // delete the Base Module and Generic Vnf - SDNCAdapter Callback failure
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
-
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("DoDeleteVfModuleRequest", request);
- variables.put("isVidRequest", "true");
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
+ Assert.assertNotNull(wfe);
+ if (wfe != null) {
+ System.out.println("TestDoDeleteVfModuleSDNCFailure: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ Assert.assertTrue(wfe.getErrorCode() == 7000);
+ Assert.assertTrue(wfe.getErrorMessage().startsWith("Could not communicate"));
+ }
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void TestDoDeleteVfModuleSDNCCallbackFailure() {
+ // delete the Base Module and Generic Vnf - SDNCAdapter Callback failure
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+
+ logStart();
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIGenericVnfSearch();
+ MockAAIVfModulePUT(false);
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("DoDeleteVfModuleRequest",request);
+ variables.put("isVidRequest", "true");
+ invokeSubProcess("DoDeleteVfModule", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete:ERR");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
- // return a failure in the callback
- injectSDNCCallbacks(callbacks, "sdncDelete:ERR");
-
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- Assert.assertNotNull(wfe);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleSDNCCallbackFailure: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- Assert.assertTrue(wfe.getErrorCode() == 5310);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Received error from SDN-C"));
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModuleVNFFailure() {
- // delete the Base Module and Generic Vnf - VNFAdapter failure
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
-
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFFailure();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("DoDeleteVfModuleRequest", request);
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ // return a failure in the callback
+ injectSDNCCallbacks(callbacks, "sdncDelete:ERR");
+
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
+ Assert.assertNotNull(wfe);
+ if (wfe != null) {
+ System.out.println("TestDoDeleteVfModuleSDNCCallbackFailure: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ Assert.assertTrue(wfe.getErrorCode() == 5310);
+ Assert.assertTrue(wfe.getErrorMessage().startsWith("Received error from SDN-C"));
+ }
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void TestDoDeleteVfModuleVNFFailure() {
+ // delete the Base Module and Generic Vnf - VNFAdapter failure
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+
+ logStart();
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFFailure();
+ MockAAIGenericVnfSearch();
+ MockAAIVfModulePUT(false);
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("DoDeleteVfModuleRequest",request);
+ invokeSubProcess("DoDeleteVfModule", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- // cause a failure by not injecting a callback
+ // cause a failure by not injecting a callback
// injectVNFRestCallbacks(callbacks, "vnfDelete");
// waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
// injectSDNCCallbacks(callbacks, "sdncDelete");
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- Assert.assertNotNull(wfe);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleVNFFailure: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- Assert.assertTrue(wfe.getErrorCode() == 7020);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Received error from VnfAdapter"));
- }
- logEnd();
- }
-
- @Test
- @Deployment(resources = {
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn"
- })
- public void TestDoDeleteVfModuleVNFCallbackFailure() {
- // delete the Base Module and Generic Vnf - VNFAdapter Callback failure
- // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
- String request =
- "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
- " <request-info>" + EOL +
- " <action>DELETE_VF_MODULE</action>" + EOL +
- " <source>PORTAL</source>" + EOL +
- " </request-info>" + EOL +
- " <vnf-inputs>" + EOL +
- " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
- " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
- " <vnf-type>asc_heat-int</vnf-type>" + EOL +
- " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
- " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
- " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
- " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
- " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
- " <orchestration-status>pending-delete</orchestration-status>" + EOL +
- " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
- " </vnf-inputs>" + EOL +
- " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
- "</vnf-request>" + EOL;
-
- logStart();
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIGenericVnfSearch();
- MockAAIVfModulePUT(false);
- MockAAIDeleteGenericVnf();
- MockAAIDeleteVfModule();
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("isDebugLogEnabled", "true");
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("DoDeleteVfModuleRequest", request);
- invokeSubProcess("DoDeleteVfModule", businessKey, variables);
-
- // "changedelete" operation not required for deleting a Vf Module
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
+ Assert.assertNotNull(wfe);
+ if (wfe != null) {
+ System.out.println("TestDoDeleteVfModuleVNFFailure: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ Assert.assertTrue(wfe.getErrorCode() == 7020);
+ Assert.assertTrue(wfe.getErrorMessage().startsWith("Received error from VnfAdapter"));
+ }
+ logEnd();
+ }
+
+ @Test
+ @Deployment(resources = {
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn"
+ })
+ public void TestDoDeleteVfModuleVNFCallbackFailure() {
+ // delete the Base Module and Generic Vnf - VNFAdapter Callback failure
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>asc_heat-int</vnf-type>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " <orchestration-status>pending-delete</orchestration-status>" + EOL +
+ " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+
+ logStart();
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIGenericVnfSearch();
+ MockAAIVfModulePUT(false);
+ MockAAIDeleteGenericVnf();
+ MockAAIDeleteVfModule();
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("DoDeleteVfModuleRequest",request);
+ invokeSubProcess("DoDeleteVfModule", businessKey, variables);
+
+ // "changedelete" operation not required for deleting a Vf Module
// injectSDNCCallbacks(callbacks, "sdncChangeDelete");
- injectVNFRestCallbacks(callbacks, "vnfDeleteFail");
- waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
+ injectVNFRestCallbacks(callbacks, "vnfDeleteFail");
+ waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
// injectSDNCCallbacks(callbacks, "sdncDelete");
- waitForProcessEnd(businessKey, 10000);
- WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
- Assert.assertNotNull(wfe);
- if (wfe != null) {
- System.out.println("TestDoDeleteVfModuleVNFCallbackFailure: ErrorCode=" + wfe.getErrorCode() +
- ", ErrorMessage=" + wfe.getErrorMessage());
- Assert.assertTrue(wfe.getErrorCode() == 7020);
- Assert.assertTrue(wfe.getErrorMessage().startsWith("Received vfModuleException from VnfAdapter"));
- }
- logEnd();
- }
-
- // start of mocks used locally and by other VF Module unit tests
- public static void MockAAIVfModulePUT(boolean isCreate) {
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("MMSC"))
- .willReturn(aResponse()
- .withStatus(isCreate ? 201 : 200)));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
- .withRequestBody(containing("PCRF"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("aaiFault.xml")));
- stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
- public static void MockDoDeleteVfModule_SDNCSuccess() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>changedelete"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>delete"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- }
-
- public static void MockDoDeleteVfModule_SDNCFailure() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>changedelete"))
- .willReturn(aResponse()
- .withStatus(500)));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>delete"))
- .willReturn(aResponse()
- .withStatus(500)));
- }
-
- public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
- public static void MockDoDeleteVfModule_DeleteVNFFailure() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(500)
- .withHeader("Content-Type", "application/xml")));
- }
+ waitForProcessEnd(businessKey, 10000);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, wfeString);
+ Assert.assertNotNull(wfe);
+ if (wfe != null) {
+ System.out.println("TestDoDeleteVfModuleVNFCallbackFailure: ErrorCode=" + wfe.getErrorCode() +
+ ", ErrorMessage=" + wfe.getErrorMessage());
+ Assert.assertTrue(wfe.getErrorCode() == 7020);
+ Assert.assertTrue(wfe.getErrorMessage().startsWith("Received vfModuleException from VnfAdapter"));
+ }
+ logEnd();
+ }
+
+ // start of mocks used locally and by other VF Module unit tests
+ public static void MockAAIVfModulePUT(boolean isCreate){
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("MMSC"))
+ .willReturn(aResponse()
+ .withStatus(isCreate ? 201 : 200)));
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("PCRF"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+ public static void MockDoDeleteVfModule_SDNCSuccess() {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>changedelete"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>delete"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ }
+
+ public static void MockDoDeleteVfModule_SDNCFailure() {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>changedelete"))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>delete"))
+ .willReturn(aResponse()
+ .withStatus(500)));
+ }
+
+ public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
+ stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
+ public static void MockDoDeleteVfModule_DeleteVNFFailure() {
+ stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "application/xml")));
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java index 8d2991e7f2..165debe7f1 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleVolumeV2Test.java @@ -40,159 +40,159 @@ import org.openecomp.mso.bpmn.mock.FileUtil; public class DoDeleteVfModuleVolumeV2Test extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoDeleteVfModuleVolumeV2Test() throws IOException {
- callbacks.put("volumeGroupDelete", FileUtil.readResourceFile(
- "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml"));
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
- public void happyPath() throws Exception {
-
- logStart();
-
- MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
- MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
- MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
- mockPutVNFVolumeGroup("78987", 202);
- mockVfModuleDelete("78987");
- MockDeleteVolumeGroupById("AAIAIC25", "78987", "0000020", 200);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- MockGetVolumeGroupById("AAIAIC25", "78987", "VfModularity/VolumeGroup.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
- testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
- testVariables.put("isDebugLogEnabled", "true");
- //testVariables.put("lcpCloudRegionId", "MDTWNJ21");
- //testVariables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
- testVariables.put("cloudConfiguration", cloudConfiguration);
-
- invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "wasDeleted", "true");
-
- logEnd();
- }
-
-
- @Test
- //@Ignore
- @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
- public void testVolumeGroupInUse() throws Exception {
-
- logStart();
- MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
- MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml");
- MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
- mockVfModuleDelete("78987");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
- testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
- testVariables.put("isDebugLogEnabled", "true");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
- testVariables.put("cloudConfiguration", cloudConfiguration);
-
- invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "wasDeleted", "false");
- WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage());
-
-
- logEnd();
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
- public void testTenantIdMismatch() throws Exception {
-
- logStart();
- MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
- MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
- MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
- mockVfModuleDelete("78987", 404);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
- testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
- testVariables.put("isDebugLogEnabled", "true");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421xxx\"" + "}";
- testVariables.put("cloudConfiguration", cloudConfiguration);
-
- invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "wasDeleted", "false");
- WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage());
-
-
- logEnd();
- }
-
- @Test
- //@Ignore
- @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
- public void testVnfAdapterCallfail() throws Exception {
-
- logStart();
- MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
- MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
- MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
- mockVfModuleDelete("78987", 404);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- String businessKey = UUID.randomUUID().toString();
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
- testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
- testVariables.put("isDebugLogEnabled", "true");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
-
- String cloudConfiguration = "{" +
- "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
- "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
- testVariables.put("cloudConfiguration", cloudConfiguration);
-
- invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
-
- waitForProcessEnd(businessKey, 100000);
- checkVariable(businessKey, "wasDeleted", "false");
- WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage());
-
- logEnd();
- }
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoDeleteVfModuleVolumeV2Test() throws IOException {
+ callbacks.put("volumeGroupDelete", FileUtil.readResourceFile(
+ "__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml"));
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
+ public void happyPath() throws Exception {
+
+ logStart();
+
+ MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
+ MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
+ MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
+ mockPutVNFVolumeGroup("78987", 202);
+ mockVfModuleDelete("78987");
+ MockDeleteVolumeGroupById("AAIAIC25", "78987", "0000020", 200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ MockGetVolumeGroupById("AAIAIC25", "78987", "VfModularity/VolumeGroup.xml");
+ String businessKey = UUID.randomUUID().toString();
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
+ testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("isDebugLogEnabled", "true");
+ //testVariables.put("lcpCloudRegionId", "MDTWNJ21");
+ //testVariables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
+ testVariables.put("volumeGroupId", "78987");
+ testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
+
+ String cloudConfiguration = "{" +
+ "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
+ "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
+ testVariables.put("cloudConfiguration", cloudConfiguration);
+
+ invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
+
+ injectVNFRestCallbacks(callbacks, "volumeGroupDelete");
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "wasDeleted", "true");
+
+ logEnd();
+ }
+
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
+ public void testVolumeGroupInUse() throws Exception {
+
+ logStart();
+ MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
+ MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_HasVfModRelationship.xml");
+ MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
+ mockVfModuleDelete("78987");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ String businessKey = UUID.randomUUID().toString();
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
+ testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("isDebugLogEnabled", "true");
+ testVariables.put("volumeGroupId", "78987");
+ testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
+
+ String cloudConfiguration = "{" +
+ "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
+ "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
+ testVariables.put("cloudConfiguration", cloudConfiguration);
+
+ invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "wasDeleted", "false");
+ WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage());
+
+
+ logEnd();
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
+ public void testTenantIdMismatch() throws Exception {
+
+ logStart();
+ MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
+ MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
+ MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
+ mockVfModuleDelete("78987", 404);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ String businessKey = UUID.randomUUID().toString();
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
+ testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("isDebugLogEnabled", "true");
+ testVariables.put("volumeGroupId", "78987");
+ testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
+
+ String cloudConfiguration = "{" +
+ "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
+ "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421xxx\"" + "}";
+ testVariables.put("cloudConfiguration", cloudConfiguration);
+
+ invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "wasDeleted", "false");
+ WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage());
+
+
+ logEnd();
+ }
+
+ @Test
+ //@Ignore
+ @Deployment(resources = {"subprocess/DoDeleteVfModuleVolumeV2.bpmn", "subprocess/VnfAdapterRestV1.bpmn"})
+ public void testVnfAdapterCallfail() throws Exception {
+
+ logStart();
+ MockGetNetworkCloudRegion("MDTWNJ21", "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml");
+ MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
+ MockDeleteVolumeGroupById("RDM2WAGPLCP", "78987", "0000020", 200);
+ mockVfModuleDelete("78987", 404);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ String businessKey = UUID.randomUUID().toString();
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("mso-request-id", "TEST-REQUEST-ID-0123");
+ testVariables.put("msoRequestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("isDebugLogEnabled", "true");
+ testVariables.put("volumeGroupId", "78987");
+ testVariables.put("serviceInstanceId", "test-service-instance-id-0123");
+
+ String cloudConfiguration = "{" +
+ "\"lcpCloudRegionId\": \"MDTWNJ21\"," +
+ "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}";
+ testVariables.put("cloudConfiguration", cloudConfiguration);
+
+ invokeSubProcess("DoDeleteVfModuleVolumeV2", businessKey, testVariables);
+
+ waitForProcessEnd(businessKey, 100000);
+ checkVariable(businessKey, "wasDeleted", "false");
+ WorkflowException msoException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ System.out.println("WorkflowException - Code: " + msoException.getErrorCode() + " Message: " + msoException.getErrorMessage());
+
+ logEnd();
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java index 033f77c106..a9dde90327 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfAndModulesTest.java @@ -49,162 +49,162 @@ import org.openecomp.mso.bpmn.common.WorkflowTest; import org.openecomp.mso.bpmn.mock.FileUtil;
public class DoDeleteVnfAndModulesTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
- private static final String EOL = "\n";
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- public DoDeleteVnfAndModulesTest() throws IOException {
- callbacks.put("deactivate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/DoDeleteVnfAndModules.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn", "subprocess/DoDeleteVfModule.bpmn"})
- public void testDoDeleteVnfAndModules_successVnfOnly() throws Exception {
- MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- mockSDNCAdapter(200);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesVnfOnly(variables);
- invokeSubProcess("DoDeleteVnfAndModules", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "unassign");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
-
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnfAndModules", "WorkflowException");
-
- assertEquals(null, workflowException);
- }
-
-
- private void setVariablesVnfOnly(Map<String, Object> variables) {
- variables.put("mso-request-id", "testRequestId123");
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfId", "testVnfId123");
- variables.put("serviceInstanceId", "MIS%2F1604%2F0026%2FSW_INTERNET");
- //variables.put("vnfName", "testVnfName123");
- variables.put("disableRollback", "true");
- variables.put("msoRequestId", "testVnfId123");
- variables.put("testVnfId", "testVnfId123");
- //variables.put("vnfType", "STMTN");
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- String vnfModelInfo = "{ " + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
- "}";
- //variables.put("vnfModelInfo", vnfModelInfo);
-
- variables.put("lcpCloudRegionId", "mdt1");
- variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
-
- String serviceModelInfo = "{ " + "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- //variables.put("serviceModelInfo", serviceModelInfo);
- variables.put("globalSubscriberId", "MSO-1610");
- variables.put("sdncVersion", "1707");
-
- }
-
- @Test
- @Deployment(resources = {"subprocess/DoDeleteVnfAndModules.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn", "subprocess/DoDeleteVfModuleFromVnf.bpmn", "subprocess/VnfAdapterRestV1.bpmn", "subprocess/DeleteAAIVfModule.bpmn"})
- public void testDoDeleteVnfAndModules_successVnfAndModules() throws Exception {
- MockAAIGenericVnfSearch();
- MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- mockSDNCAdapter(200);
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIDeleteVfModule();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesVnfAndModules(variables);
- invokeSubProcess("DoDeleteVnfAndModules", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "deactivate");
- injectSDNCCallbacks(callbacks, "deactivate");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- injectSDNCCallbacks(callbacks, "unassign");
- MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
- injectSDNCCallbacks(callbacks, "unassign");
- //MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
-
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnfAndModules", "WorkflowException");
-
- assertEquals(null, workflowException);
- }
-
-
- private void setVariablesVnfAndModules(Map<String, Object> variables) {
- variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("isDebugLogEnabled", "true");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
-
- variables.put("msoRequestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- //variables.put("testVnfId","testVnfId123");
-
- variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
- variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
-
- variables.put("sdncVersion", "1707");
-
- }
-
-
- public static void MockDoDeleteVfModule_SDNCSuccess() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>deactivate"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>unassign"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- }
-
-
- public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
+ private final CallbackSet callbacks = new CallbackSet();
+ private static final String EOL = "\n";
+ private final String vnfAdapterDeleteCallback =
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
+ " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</deleteVfModuleResponse>" + EOL;
+
+ public DoDeleteVnfAndModulesTest () throws IOException {
+ callbacks.put("deactivate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
+
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/DoDeleteVnfAndModules.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn", "subprocess/DoDeleteVfModule.bpmn"})
+ public void testDoDeleteVnfAndModules_successVnfOnly() throws Exception{
+ MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
+ MockDeleteGenericVnf("testVnfId123", "testReVer123");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ mockSDNCAdapter(200);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesVnfOnly(variables);
+ invokeSubProcess("DoDeleteVnfAndModules", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnfAndModules", "WorkflowException");
+
+ assertEquals(null, workflowException);
+ }
+
+
+ private void setVariablesVnfOnly(Map<String, Object> variables) {
+ variables.put("mso-request-id", "testRequestId123");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfId","testVnfId123");
+ variables.put("serviceInstanceId", "MIS%2F1604%2F0026%2FSW_INTERNET");
+ //variables.put("vnfName", "testVnfName123");
+ variables.put("disableRollback", "true");
+ variables.put("msoRequestId", "testVnfId123");
+ variables.put("testVnfId","testVnfId123");
+ //variables.put("vnfType", "STMTN");
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"vSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
+ "}";
+ //variables.put("vnfModelInfo", vnfModelInfo);
+
+ variables.put("lcpCloudRegionId", "mdt1");
+ variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
+
+ String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
+ "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"ServicevSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "}";
+ //variables.put("serviceModelInfo", serviceModelInfo);
+ variables.put("globalSubscriberId", "MSO-1610");
+ variables.put("sdncVersion", "1707");
+
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/DoDeleteVnfAndModules.bpmn", "subprocess/SDNCAdapterV1.bpmn", "subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn", "subprocess/DoDeleteVfModuleFromVnf.bpmn", "subprocess/VnfAdapterRestV1.bpmn", "subprocess/DeleteAAIVfModule.bpmn"})
+ public void testDoDeleteVnfAndModules_successVnfAndModules() throws Exception{
+ MockAAIGenericVnfSearch();
+ MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
+ MockDeleteGenericVnf("testVnfId123", "testReVer123");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ mockSDNCAdapter(200);
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIDeleteVfModule();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesVnfAndModules(variables);
+ invokeSubProcess("DoDeleteVnfAndModules", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ injectSDNCCallbacks(callbacks, "unassign");
+ MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
+ injectSDNCCallbacks(callbacks, "unassign");
+ //MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnfAndModules", "WorkflowException");
+
+ assertEquals(null, workflowException);
+ }
+
+
+ private void setVariablesVnfAndModules(Map<String, Object> variables) {
+ variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfId","a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("serviceInstanceId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+
+ variables.put("msoRequestId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ //variables.put("testVnfId","testVnfId123");
+
+ variables.put("lcpCloudRegionId", "RDM2WAGPLCP");
+ variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
+
+ variables.put("sdncVersion", "1707");
+
+ }
+
+
+ public static void MockDoDeleteVfModule_SDNCSuccess() {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>deactivate"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>unassign"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ }
+
+
+ public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
+ stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ }
}
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java index 95c275f85d..8caa9f22a2 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java @@ -19,7 +19,7 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= - */ + */ package org.openecomp.mso.bpmn.infrastructure; @@ -40,100 +40,101 @@ import org.openecomp.mso.bpmn.common.WorkflowTest; /** * Please describe the DeleteVnfInfra.java class + * */ public class DoDeleteVnfTest extends WorkflowTest { - - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"}) - public void testDoDeleteVnf_success() throws Exception { - - MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfByNameResponse.xml"); - MockDeleteGenericVnf("testVnfId123", "testReVer123"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariables(variables); - invokeSubProcess("DoDeleteVnf", businessKey, variables); - // Disabled until SDNC support is there + + @Test + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"}) + public void testDoDeleteVnf_success() throws Exception{ + + MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfByNameResponse.xml"); + MockDeleteGenericVnf("testVnfId123", "testReVer123"); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariables(variables); + invokeSubProcess("DoDeleteVnf", businessKey, variables); + // Disabled until SDNC support is there // injectSDNCCallbacks(callbacks, "assign"); // injectSDNCCallbacks(callbacks, "activate"); - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator"); - String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException"); - - assertEquals("true", found); - assertEquals("false", inUse); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"}) - public void testDeleteVnfInfra_success_vnfNotFound() throws Exception { - - MockDeleteGenericVnf("testVnfId123", "testReVer123", 404); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("DoDeleteVnf", businessKey, variables); - // Disabled until SDNC support is there + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; + String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException"); + + assertEquals("true", found); + assertEquals("false", inUse); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"}) + public void testDeleteVnfInfra_success_vnfNotFound() throws Exception{ + + MockDeleteGenericVnf("testVnfId123", "testReVer123", 404); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("DoDeleteVnf", businessKey, variables); + // Disabled until SDNC support is there // injectSDNCCallbacks(callbacks, "assign"); // injectSDNCCallbacks(callbacks, "activate"); - waitForProcessEnd(businessKey, 10000); + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; + String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException"); - Assert.assertTrue(isProcessEnded(businessKey)); - String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator"); - String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException"); + assertEquals("false", found); + assertEquals("false", inUse); + assertEquals(null, workflowException); + } - assertEquals("false", found); - assertEquals("false", inUse); - assertEquals(null, workflowException); - } + @Test + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"}) + public void testDeleteVnfInfra_error_vnfInUse() throws Exception{ - @Test - @Deployment(resources = {"subprocess/GenericGetVnf.bpmn", "subprocess/GenericDeleteVnf.bpmn", "subprocess/DoDeleteVnf.bpmn"}) - public void testDeleteVnfInfra_error_vnfInUse() throws Exception { + MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfResponse_hasRelationships.xml"); + MockDeleteGenericVnf("testVnfId123", "testReVer123"); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfResponse_hasRelationships.xml"); - MockDeleteGenericVnf("testVnfId123", "testReVer123"); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariables(variables); - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariables(variables); - - invokeSubProcess("DoDeleteVnf", businessKey, variables); + invokeSubProcess("DoDeleteVnf", businessKey, variables); // Disabled until SDNC support is there // injectSDNCCallbacks(callbacks, "assign"); // injectSDNCCallbacks(callbacks, "activate"); - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - - String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator"); - String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); - String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException"); - String exWfex = "WorkflowException[processKey=DoDeleteVnf,errorCode=5000,errorMessage=Can't Delete Generic Vnf. Generic Vnf is still in use.]"; - - assertEquals("true", found); - assertEquals("true", inUse); - assertEquals(exWfex, workflowException); - } - - private void setVariables(Map<String, Object> variables) { - variables.put("mso-request-id", "123"); - variables.put("isDebugLogEnabled", "true"); - variables.put("vnfId", "testVnfId123"); - } + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + + String found = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "GENGV_FoundIndicator") ; + String inUse = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "DoDVNF_vnfInUse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "DoDeleteVnf", "WorkflowException"); + String exWfex = "WorkflowException[processKey=DoDeleteVnf,errorCode=5000,errorMessage=Can't Delete Generic Vnf. Generic Vnf is still in use.]"; + + assertEquals("true", found); + assertEquals("true", inUse); + assertEquals(exWfex, workflowException); + } + + private void setVariables(Map<String, Object> variables) { + variables.put("mso-request-id", "123"); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfId","testVnfId123"); + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java index 40564a9b26..9fa93235b7 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java @@ -16,11 +16,12 @@ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
+
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.put;
@@ -55,158 +56,158 @@ import org.openecomp.mso.bpmn.mock.FileUtil; * Unit tests for DoUpdateVfModule.bpmn.
*/
public class DoUpdateVfModuleTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoUpdateVfModuleTest() throws IOException {
- callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
- }
-
- /**
- * Test the happy path through the flow.
- */
- @Test
- @Ignore
- @Deployment(resources = {
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn"
- })
- public void happyPath() throws IOException {
-
- logStart();
-
- String doUpdateVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/DoUpdateVfModuleRequest.xml");
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockGetVfModuleIdNoResponse("skask", "PCRF", "supercool");
- MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool");
- MockGetVolumeGroupById("MDTWNJ21", "78987", "VfModularity/VolumeGroup.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- MockPutGenericVnf("skask");
- MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1);
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "DEV-VF-0011");
- variables.put("isDebugLogEnabled", "true");
- variables.put("DoUpdateVfModuleRequest", doUpdateVfModuleRequest);
- invokeSubProcess("DoUpdateVfModule", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- checkVariable(businessKey, "DoUpdateVfModuleSuccessIndicator", true);
-
- String heatStackId = (String) getVariableFromHistory(businessKey, "DOUPVfMod_heatStackId");
- System.out.println("Heat stack Id from AAI: " + heatStackId);
-
- logEnd();
- }
-
- /**
- * Test the happy path through the flow with Building Blocks interface.
- */
- @Test
-
- @Deployment(resources = {
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn"
- })
- public void happyPathBB() throws IOException {
-
- logStart();
-
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- MockSDNCAdapterVfModule();
- MockVNFAdapterRestVfModule();
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- variables.put("mso-request-id", "DEV-VF-0011");
- variables.put("isDebugLogEnabled", "true");
- variables.put("msoRequestId", "DEV-VF-0011");
- variables.put("isBaseVfModule", "false");
- variables.put("isDebugLogEnabled", "true");
- variables.put("disableRollback", "true");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vfModuleId", "supercool");
- variables.put("vnfType", "pcrf-capacity");
- variables.put("isVidRequest", "true");
- variables.put("volumeGroupId", "78987");
- variables.put("usePreload", true);
-
- variables.put("sdncVersion", "1702");
-
- variables.put("lcpCloudRegionId", "MDTWNJ21");
- variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
-
- String vfModuleModelInfo = "{ " + "\"modelType\": \"vfModule\"," +
- "\"modelInvariantUuid\": \"introvert\"," +
- "\"modelUuid\": \"3.14\"," +
- "\"modelName\": \"STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "\"modelCustomizationUuid\": \"MODEL-123\"" + "}";
- variables.put("vfModuleModelInfo", vfModuleModelInfo);
-
- String vnfModelInfo = "{ " + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"introvert\"," +
- "\"modelUuid\": \"3.14\"," +
- "\"modelName\": \"VNF-STMTN5MMSC21-MMSC::model-1-0\"," +
- "\"modelVersion\": \"1\"," +
- "\"modelCustomizationUuid\": \"VNF-MODEL-123\"" + "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- invokeSubProcess("DoUpdateVfModule", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
-
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- checkVariable(businessKey, "DoUpdateVfModuleSuccessIndicator", true);
-
- String heatStackId = (String) getVariableFromHistory(businessKey, "DOUPVfMod_heatStackId");
- System.out.println("Heat stack Id from AAI: " + heatStackId);
-
- logEnd();
- }
-
- // start of mocks used locally and by other VF Module unit tests
- public static void MockSDNCAdapterVfModule() {
- // simplified the implementation to return "success" for all requests
- stubFor(post(urlEqualTo("/SDNCAdapter"))
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoUpdateVfModuleTest() throws IOException {
+ callbacks.put("changeassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("vnfUpdate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
+ }
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+ @Ignore
+ @Deployment(resources = {
+ "subprocess/DoUpdateVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn"
+ })
+ public void happyPath() throws IOException {
+
+ logStart();
+
+ String doUpdateVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/DoUpdateVfModuleRequest.xml");
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockGetVfModuleIdNoResponse("skask", "PCRF", "supercool");
+ MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool");
+ MockGetVolumeGroupById("MDTWNJ21", "78987", "VfModularity/VolumeGroup.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPut("skask", "/supercool", 202);
+ MockPutGenericVnf("skask");
+ MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "DEV-VF-0011");
+ variables.put("isDebugLogEnabled","true");
+ variables.put("DoUpdateVfModuleRequest", doUpdateVfModuleRequest);
+ invokeSubProcess("DoUpdateVfModule", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ checkVariable(businessKey, "DoUpdateVfModuleSuccessIndicator", true);
+
+ String heatStackId = (String) getVariableFromHistory(businessKey, "DOUPVfMod_heatStackId");
+ System.out.println("Heat stack Id from AAI: " + heatStackId);
+
+ logEnd();
+ }
+
+ /**
+ * Test the happy path through the flow with Building Blocks interface.
+ */
+ @Test
+
+ @Deployment(resources = {
+ "subprocess/DoUpdateVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn"
+ })
+ public void happyPathBB() throws IOException {
+
+ logStart();
+
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ MockSDNCAdapterVfModule();
+ MockVNFAdapterRestVfModule();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "DEV-VF-0011");
+ variables.put("isDebugLogEnabled","true");
+ variables.put("msoRequestId", "DEV-VF-0011");
+ variables.put("isBaseVfModule", "false");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("disableRollback", "true");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "skask");
+ variables.put("vfModuleId", "supercool");
+ variables.put("vnfType", "pcrf-capacity");
+ variables.put("isVidRequest", "true");
+ variables.put("volumeGroupId", "78987");
+ variables.put("usePreload", true);
+
+ variables.put("sdncVersion", "1702");
+
+ variables.put("lcpCloudRegionId", "MDTWNJ21");
+ variables.put("tenantId", "fba1bd1e195a404cacb9ce17a9b2b421");
+
+ String vfModuleModelInfo = "{ "+ "\"modelType\": \"vfModule\"," +
+ "\"modelInvariantUuid\": \"introvert\"," +
+ "\"modelUuid\": \"3.14\"," +
+ "\"modelName\": \"STMTN5MMSC21-MMSC::model-1-0\"," +
+ "\"modelVersion\": \"1\"," +
+ "\"modelCustomizationUuid\": \"MODEL-123\"" + "}";
+ variables.put("vfModuleModelInfo", vfModuleModelInfo);
+
+ String vnfModelInfo = "{ "+ "\"modelType\": \"vnf\"," +
+ "\"modelInvariantUuid\": \"introvert\"," +
+ "\"modelUuid\": \"3.14\"," +
+ "\"modelName\": \"VNF-STMTN5MMSC21-MMSC::model-1-0\"," +
+ "\"modelVersion\": \"1\"," +
+ "\"modelCustomizationUuid\": \"VNF-MODEL-123\"" + "}";
+ variables.put("vnfModelInfo", vnfModelInfo);
+
+ invokeSubProcess("DoUpdateVfModule", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ checkVariable(businessKey, "DoUpdateVfModuleSuccessIndicator", true);
+
+ String heatStackId = (String) getVariableFromHistory(businessKey, "DOUPVfMod_heatStackId");
+ System.out.println("Heat stack Id from AAI: " + heatStackId);
+
+ logEnd();
+ }
+
+ // start of mocks used locally and by other VF Module unit tests
+ public static void MockSDNCAdapterVfModule() {
+ // simplified the implementation to return "success" for all requests
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
// .withRequestBody(containing("SvcInstanceId><"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
// stubFor(post(urlEqualTo("/SDNCAdapter"))
// .withRequestBody(containing("vnf-type>STMTN"))
// .willReturn(aResponse()
@@ -219,25 +220,25 @@ public class DoUpdateVfModuleTest extends WorkflowTest { // .withStatus(200)
// .withHeader("Content-Type", "text/xml")
// .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
- }
-
- public static void MockVNFAdapterRestVfModule() {
- stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
+ }
+
+ public static void MockVNFAdapterRestVfModule() {
+ stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(post(urlMatching("/vnfs/v1/vnfs/.*/vf-modules"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(post(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/78987"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java index 5dbad094d4..4def56cf6a 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVnfAndModulesTest.java @@ -55,170 +55,172 @@ import org.openecomp.mso.bpmn.mock.FileUtil; /**
* Unit Test for the DoUpdateVnfAndModules Flow
+ *
*/
public class DoUpdateVnfAndModulesTest extends WorkflowTest {
- private final CallbackSet callbacks = new CallbackSet();
-
- public DoUpdateVnfAndModulesTest() throws IOException {
-
- callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
- }
-
- @Test
-
- @Deployment(resources = {
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/DoUpdateVnfAndModules.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn"})
- public void testDoUpdateVnfAndModules_success() throws Exception {
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- //MockGetGenericVnfById_404("testVnfId");
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutGenericVnf(".*");
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- mockVNFPut("skask", "/lukewarm", 202);
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
-
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = new HashMap<>();
- setVariablesSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
- invokeSubProcess("DoUpdateVnfAndModules", businessKey, variables);
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
- waitForProcessEnd(businessKey, 10000);
-
- Assert.assertTrue(isProcessEnded(businessKey));
- assertVariables("2", "200", null);
-
- }
-
-
- private void assertVariables(String exModuleCount, String exVnfFound, String exWorkflowException) {
-
- String moduleCount = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "DUVAM_moduleCount");
- String vnfFound = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "DUVAM_queryAAIVfModuleResponseCode");
- String workflowException = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "SavedWorkflowException1");
-
- assertEquals(exModuleCount, moduleCount);
- assertEquals(exVnfFound, vnfFound);
- assertEquals(exWorkflowException, workflowException);
- }
-
- private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("bpmnRequest", request);
- variables.put("msoRequestUdid", requestId);
- variables.put("serviceInstanceId", siId);
- variables.put("testVnfId", "testVnfId123");
- variables.put("vnfType", "STMTN");
-
- }
-
- private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
- variables.put("isDebugLogEnabled", "true");
- variables.put("requestId", requestId);
- variables.put("msoRequestId", requestId);
- variables.put("serviceInstanceId", siId);
- variables.put("disableRollback", "true");
- //variables.put("testVnfId","testVnfId123");
- variables.put("vnfType", "STMTN");
- variables.put("vnfId", "skask");
- variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
- variables.put("lcpCloudRegionId", "mdt1");
-
- String serviceModelInfo = "{ " + "\"modelType\": \"service\"," +
- "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"ServicevSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "}";
- variables.put("serviceModelInfo", serviceModelInfo);
- variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
- String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," +
- "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
- "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
- "\"modelName\": \"vSAMP12\"," +
- "\"modelVersion\": \"1.0\"," +
- "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}";
- variables.put("vnfModelInfo", vnfModelInfo);
-
- String cloudConfiguration = "{" + "\"cloudConfiguration\": { " +
- "\"lcpCloudRegionId\": \"mdt1\"," +
- "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}";
- variables.put("cloudConfiguration", cloudConfiguration);
- variables.put("sdncVersion", "1702");
- variables.put("globalSubscriberId", "subscriber123");
- variables.put("asdcServiceModelVersion", "serviceVersion01");
-
- try {
- VnfResource vr = new VnfResource();
- ModelInfo mvr = new ModelInfo();
- mvr.setModelName("vSAMP12");
- mvr.setModelInstanceName("v123");
- mvr.setModelInvariantUuid("extrovert");
- mvr.setModelVersion("1.0");
- mvr.setModelCustomizationUuid("MODEL-ID-1234");
- vr.setModelInfo(mvr);
- vr.constructVnfType("vnf1");
- vr.setNfType("somenftype");
- vr.setNfRole("somenfrole");
- vr.setNfFunction("somenffunction");
- vr.setNfNamingCode("somenamingcode");
- ModuleResource mr = new ModuleResource();
- ModelInfo mvmr = new ModelInfo();
- mvmr.setModelInvariantUuid("introvert");
- mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
- mvmr.setModelVersion("1");
- mvmr.setModelCustomizationUuid("MODEL-123");
- mr.setModelInfo(mvmr);
- mr.setIsBase(true);
- mr.setVfModuleLabel("MODULELABEL");
- vr.addVfModule(mr);
- ModuleResource mr1 = new ModuleResource();
- ModelInfo mvmr1 = new ModelInfo();
- mvmr1.setModelInvariantUuid("extrovert");
- mvmr1.setModelName("SECONDMODELNAME");
- mvmr1.setModelVersion("1");
- mvmr1.setModelCustomizationUuid("MODEL-123");
- mr1.setModelInfo(mvmr1);
- mr1.setIsBase(false);
- mr1.setVfModuleLabel("MODULELABEL1");
- vr.addVfModule(mr1);
- variables.put("vnfResourceDecomposition", vr);
- variables.put("isTest", true);
- } catch (Exception e) {
-
- }
-
- }
-
-
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoUpdateVnfAndModulesTest() throws IOException {
+
+ callbacks.put("changeassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("vnfUpdate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
+ }
+
+ @Test
+
+ @Deployment(resources = {
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/DoUpdateVfModule.bpmn",
+ "subprocess/DoUpdateVnfAndModules.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn"})
+ public void testDoUpdateVnfAndModules_success() throws Exception{
+
+ MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+ //MockGetGenericVnfById_404("testVnfId");
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf(".*");
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPut("skask", "/supercool", 202);
+ mockVNFPut("skask", "/lukewarm", 202);
+ MockVNFAdapterRestVfModule();
+ MockDBUpdateVfModule();
+
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "", "testRequestId123", "MIS%2F1604%2F0026%2FSW_INTERNET");
+ invokeSubProcess("DoUpdateVnfAndModules", businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ assertVariables("2", "200", null);
+
+ }
+
+
+
+ private void assertVariables(String exModuleCount, String exVnfFound, String exWorkflowException) {
+
+ String moduleCount = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "DUVAM_moduleCount");
+ String vnfFound = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "DUVAM_queryAAIVfModuleResponseCode");
+ String workflowException = BPMNUtil.getVariable(processEngineRule, "DoUpdateVnfAndModules", "SavedWorkflowException1");
+
+ assertEquals(exModuleCount, moduleCount);
+ assertEquals(exVnfFound, vnfFound);
+ assertEquals(exWorkflowException, workflowException);
+ }
+
+ private void setVariables(Map<String, String> variables, String request, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("bpmnRequest", request);
+ variables.put("msoRequestUdid", requestId);
+ variables.put("serviceInstanceId",siId);
+ variables.put("testVnfId","testVnfId123");
+ variables.put("vnfType", "STMTN");
+
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables, String request, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("requestId", requestId);
+ variables.put("msoRequestId", requestId);
+ variables.put("serviceInstanceId",siId);
+ variables.put("disableRollback", "true");
+ //variables.put("testVnfId","testVnfId123");
+ variables.put("vnfType", "STMTN");
+ variables.put("vnfId", "skask");
+ variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e");
+ variables.put("lcpCloudRegionId", "mdt1");
+
+ String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
+ "\"modelInvariantUuid\": \"995256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"ServicevSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+ variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
+ String vnfModelInfo = "{" + "\"modelType\": \"vnf\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"vSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "\"modelCustomizationUuid\": \"MODEL-ID-1234\"" + "}";
+ variables.put("vnfModelInfo", vnfModelInfo);
+
+ String cloudConfiguration = "{" + "\"cloudConfiguration\": { " +
+ "\"lcpCloudRegionId\": \"mdt1\"," +
+ "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}}";
+ variables.put("cloudConfiguration", cloudConfiguration);
+ variables.put("sdncVersion", "1702");
+ variables.put("globalSubscriberId", "subscriber123");
+ variables.put("asdcServiceModelVersion", "serviceVersion01");
+
+ try {
+ VnfResource vr = new VnfResource();
+ ModelInfo mvr = new ModelInfo();
+ mvr.setModelName("vSAMP12");
+ mvr.setModelInstanceName("v123");
+ mvr.setModelInvariantUuid("extrovert");
+ mvr.setModelVersion("1.0");
+ mvr.setModelCustomizationUuid("MODEL-ID-1234");
+ vr.setModelInfo(mvr);
+ vr.constructVnfType("vnf1");
+ vr.setNfType("somenftype");
+ vr.setNfRole("somenfrole");
+ vr.setNfFunction("somenffunction");
+ vr.setNfNamingCode("somenamingcode");
+ ModuleResource mr = new ModuleResource();
+ ModelInfo mvmr = new ModelInfo();
+ mvmr.setModelInvariantUuid("introvert");
+ mvmr.setModelName("STMTN5MMSC21-MMSC::model-1-0");
+ mvmr.setModelVersion("1");
+ mvmr.setModelCustomizationUuid("MODEL-123");
+ mr.setModelInfo(mvmr);
+ mr.setIsBase(true);
+ mr.setVfModuleLabel("MODULELABEL");
+ vr.addVfModule(mr);
+ ModuleResource mr1 = new ModuleResource();
+ ModelInfo mvmr1 = new ModelInfo();
+ mvmr1.setModelInvariantUuid("extrovert");
+ mvmr1.setModelName("SECONDMODELNAME");
+ mvmr1.setModelVersion("1");
+ mvmr1.setModelCustomizationUuid("MODEL-123");
+ mr1.setModelInfo(mvmr1);
+ mr1.setIsBase(false);
+ mr1.setVfModuleLabel("MODULELABEL1");
+ vr.addVfModule(mr1);
+ variables.put("vnfResourceDecomposition", vr);
+ variables.put("isTest", true);
+ } catch(Exception e) {
+
+ }
+
+ }
+
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java index 82208d9f64..64852dfb5f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/ReplaceVnfInfraTest.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -69,191 +69,191 @@ import org.openecomp.mso.bpmn.mock.FileUtil; * Unit test cases for UpdateVnfInfra.bpmn
*/
public class ReplaceVnfInfraTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
- private static final String EOL = "\n";
- private final String vnfAdapterDeleteCallback =
- "<deleteVfModuleResponse>" + EOL +
- " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
- " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
- " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
- " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
- "</deleteVfModuleResponse>" + EOL;
-
- public ReplaceVnfInfraTest() throws IOException {
- callbacks.put("deactivate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("unassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
- callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
- }
-
- /**
- * Sunny day scenario.
- *
- * @throws Exception
- */
- @Test
+
+ private final CallbackSet callbacks = new CallbackSet();
+ private static final String EOL = "\n";
+ private final String vnfAdapterDeleteCallback =
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
+ " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</deleteVfModuleResponse>" + EOL;
+
+ public ReplaceVnfInfraTest() throws IOException {
+ callbacks.put("deactivate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
+ callbacks.put("changeassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("vnfUpdate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
+ }
+
+ /**
+ * Sunny day scenario.
+ *
+ * @throws Exception
+ */
+ @Test
@Ignore
- @Deployment(resources = {
- "process/ReplaceVnfInfra.bpmn",
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/DoDeleteVnfAndModules.bpmn",
- "subprocess/DeleteAAIVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/DoDeleteVnfAndModules.bpmn",
- "subprocess/GenericDeleteVnf.bpmn",
- "subprocess/DoDeleteVnf.bpmn",
- "subprocess/DoDeleteVfModule.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/GenericGetService.bpmn",
- "subprocess/GenericGetVnf.bpmn",
- "subprocess/GenericPutVnf.bpmn",
- "subprocess/DoCreateVnf.bpmn",
- "subprocess/GenerateVfModuleName.bpmn",
- "subprocess/DoCreateVfModule.bpmn",
- "subprocess/DoCreateVnfAndModules.bpmn",
- "subprocess/ConfirmVolumeGroupName.bpmn",
- "subprocess/CreateAAIVfModule.bpmn",
- "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/DoCreateVnfAndModulesRollback.bpmn",
- "subprocess/BuildingBlock/DecomposeService.bpmn",
- "subprocess/BuildingBlock/RainyDayHandler.bpmn",
- "subprocess/BuildingBlock/ManualHandling.bpmn"
-
- })
- public void sunnyDay() throws Exception {
-
- logStart();
- MockAAIGenericVnfSearch();
- MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
- MockDeleteGenericVnf("testVnfId123", "testReVer123");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
- mockSDNCAdapter(200);
- MockDoDeleteVfModule_SDNCSuccess();
- MockDoDeleteVfModule_DeleteVNFSuccess();
- MockAAIDeleteVfModule();
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- //MockGetGenericVnfById_404("testVnfId");
- MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "1.0", "VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json");
- //MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- //MockPutGenericVnf(".*");
- MockAAIVfModule();
- MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
- MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", ".*");
- //mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- //mockVNFPut("skask", "/supercool", 202);
- //mockVNFPut("skask", "/lukewarm", 202);
- //MockVNFAdapterRestVfModule();
- //MockDBUpdateVfModule();
- //MockGetPserverByVnfId("skask", "AAI/AAI_pserverByVnfId.json", 200);
- //MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
- MockSetInMaintFlagByVnfId("skask", 200);
- MockPolicySkip();
-
- //mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- //mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVnfRequest =
- FileUtil.readResourceFile("__files/InfrastructureFlows/ReplaceVnf_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("ReplaceVnfInfra",
- "v1", businessKey, updaetVnfRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- //injectSDNCCallbacks(callbacks, "deactivate");
- //injectSDNCCallbacks(callbacks, "deactivate");
- injectVNFRestCallbacks(callbacks, "vnfDelete");
- //injectSDNCCallbacks(callbacks, "unassign");
- MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
- injectSDNCCallbacks(callbacks, "unassign");
-
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "ReplaceVfModuleInfraSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isDebugLogEnabled", "true");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
- variables.put("vnfType", "vSAMP12");
- variables.put("serviceType", "MOG");
-
- return variables;
-
- }
-
- public static void MockDoDeleteVfModule_SDNCSuccess() {
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>deactivate"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing("SvcAction>unassign"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
- }
-
-
- public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
- stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
- .willReturn(aResponse()
- .withStatus(202)
- .withHeader("Content-Type", "application/xml")));
- }
-
+ @Deployment(resources = {
+ "process/ReplaceVnfInfra.bpmn",
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/DoDeleteVnfAndModules.bpmn",
+ "subprocess/DeleteAAIVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/DoDeleteVnfAndModules.bpmn",
+ "subprocess/GenericDeleteVnf.bpmn",
+ "subprocess/DoDeleteVnf.bpmn",
+ "subprocess/DoDeleteVfModule.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/GenericGetService.bpmn",
+ "subprocess/GenericGetVnf.bpmn",
+ "subprocess/GenericPutVnf.bpmn",
+ "subprocess/DoCreateVnf.bpmn",
+ "subprocess/GenerateVfModuleName.bpmn",
+ "subprocess/DoCreateVfModule.bpmn",
+ "subprocess/DoCreateVnfAndModules.bpmn",
+ "subprocess/ConfirmVolumeGroupName.bpmn",
+ "subprocess/CreateAAIVfModule.bpmn",
+ "subprocess/CreateAAIVfModuleVolumeGroup.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/DoCreateVnfAndModulesRollback.bpmn",
+ "subprocess/BuildingBlock/DecomposeService.bpmn",
+ "subprocess/BuildingBlock/RainyDayHandler.bpmn",
+ "subprocess/BuildingBlock/ManualHandling.bpmn"
+
+ })
+ public void sunnyDay() throws Exception {
+
+ logStart();
+ MockAAIGenericVnfSearch();
+ MockGetGenericVnfById("testVnfId123.*", "GenericFlows/getGenericVnfByNameResponse.xml");
+ MockDeleteGenericVnf("testVnfId123", "testReVer123");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ mockSDNCAdapter(200);
+ MockDoDeleteVfModule_SDNCSuccess();
+ MockDoDeleteVfModule_DeleteVNFSuccess();
+ MockAAIDeleteVfModule();
+
+ MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+ //MockGetGenericVnfById_404("testVnfId");
+ MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "1.0", "VIPR/getCatalogServiceResourcesDataForReplaceVnfInfra.json");
+ //MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ //MockPutGenericVnf(".*");
+ MockAAIVfModule();
+ MockPatchGenericVnf("a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", ".*");
+ //mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ //mockVNFPut("skask", "/supercool", 202);
+ //mockVNFPut("skask", "/lukewarm", 202);
+ //MockVNFAdapterRestVfModule();
+ //MockDBUpdateVfModule();
+ //MockGetPserverByVnfId("skask", "AAI/AAI_pserverByVnfId.json", 200);
+ //MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
+ MockSetInMaintFlagByVnfId("skask", 200);
+ MockPolicySkip();
+
+ //mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ //mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ String updaetVnfRequest =
+ FileUtil.readResourceFile("__files/InfrastructureFlows/ReplaceVnf_VID_request.json");
+
+ Map<String, Object> variables = setupVariablesSunnyDayVID();
+
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("ReplaceVnfInfra",
+ "v1", businessKey, updaetVnfRequest, variables);
+
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ //injectSDNCCallbacks(callbacks, "deactivate");
+ //injectSDNCCallbacks(callbacks, "deactivate");
+ injectVNFRestCallbacks(callbacks, "vnfDelete");
+ //injectSDNCCallbacks(callbacks, "unassign");
+ MockGetGenericVnfById("a27ce5a9-29c4-4c22-a017-6615ac73c721", "GenericFlows/getGenericVnfByNameResponse.xml");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ // TODO add appropriate assertions
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "ReplaceVfModuleInfraSuccessIndicator", true);
+
+ logEnd();
+ }
+
+ // Active Scenario
+ private Map<String, Object> setupVariablesSunnyDayVID() {
+ Map<String, Object> variables = new HashMap<>();
+ //try {
+ // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
+ //}
+ //catch (Exception e) {
+
+ //}
+ //variables.put("mso-request-id", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("vnfType", "vSAMP12");
+ variables.put("serviceType", "MOG");
+
+ return variables;
+
+ }
+
+ public static void MockDoDeleteVfModule_SDNCSuccess() {
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>deactivate"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ stubFor(post(urlEqualTo("/SDNCAdapter"))
+ .withRequestBody(containing("SvcAction>unassign"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
+ }
+
+
+ public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
+ stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
+ }
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java index 02ed13e2fb..8f16ed3b1e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/StubResponseAAITest.java @@ -16,150 +16,153 @@ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
-
+ */
+
package org.openecomp.mso.bpmn.infrastructure;
import org.junit.Test;
import org.openecomp.mso.bpmn.common.WorkflowTest;
import org.openecomp.mso.bpmn.mock.StubResponseAAI;
-public class StubResponseAAITest extends WorkflowTest {
-
- @Test
- public void testStubResponseAAIforNullAndDefaultInputs() {
- try {
- StubResponseAAI.MockPutTunnelXConnect(null, null, null, null, null);
- StubResponseAAI.MockGetAllottedResource(null, null, null, null, null);
- StubResponseAAI.MockPutAllottedResource(null, null, null, null);
- StubResponseAAI.MockPutAllottedResource_500(null, null, null, null);
- StubResponseAAI.MockDeleteAllottedResource(null, null, null, null, null);
- StubResponseAAI.MockPatchAllottedResource(null, null, null, null);
- StubResponseAAI.MockQueryAllottedResourceById(null, null);
- StubResponseAAI.MockGetServiceInstance(null, null, null, null);
- StubResponseAAI.MockGetServiceInstance_404(null, null, null);
- StubResponseAAI.MockGetServiceInstance_500(null, null, null);
- StubResponseAAI.MockGetServiceInstance_500(null, null, null, null);
- StubResponseAAI.MockNodeQueryServiceInstanceByName(null, null);
- StubResponseAAI.MockNodeQueryServiceInstanceByName_404(null);
- StubResponseAAI.MockNodeQueryServiceInstanceByName_500(null);
- StubResponseAAI.MockNodeQueryServiceInstanceById(null, null);
- StubResponseAAI.MockNodeQueryServiceInstanceById_404(null);
- StubResponseAAI.MockNodeQueryServiceInstanceById_500(null);
- StubResponseAAI.MockDeleteServiceInstance(null, null, null, null);
- StubResponseAAI.MockGetServiceInstance(null, null, null, null, 0);
- StubResponseAAI.MockGetServiceInstance(null, null, null, 0);
- StubResponseAAI.MockDeleteServiceInstance(null, null, null, null, 0);
- StubResponseAAI.MockDeleteServiceInstance(null, null, null, 0);
- StubResponseAAI.MockDeleteServiceInstance_404(null, null, null, null);
- StubResponseAAI.MockDeleteServiceInstance_500(null, null, null, null);
- StubResponseAAI.MockPutServiceInstance(null, null, null, null);
- StubResponseAAI.MockPutServiceInstance_500(null, null, null);
- StubResponseAAI.MockGetServiceSubscription(null, null, null);
- StubResponseAAI.MockDeleteServiceSubscription(null, null, 0);
- StubResponseAAI.MockDeleteServiceInstanceId(null, null, null);
- StubResponseAAI.MockPutServiceSubscription(null, null);
- StubResponseAAI.MockGetServiceSubscription(null, null, 0);
- StubResponseAAI.MockGetCustomer(null, null);
- StubResponseAAI.MockDeleteCustomer(null);
- StubResponseAAI.MockPutCustomer(null);
- StubResponseAAI.MockPutCustomer_500(null);
- StubResponseAAI.MockGetGenericVnfById(null, null);
- StubResponseAAI.MockGetGenericVnfById(null, null, 0);
- StubResponseAAI.MockGetGenericVnfByIdWithPriority(null, 0, null);
- StubResponseAAI.MockGetGenericVnfByIdWithPriority(null, null, 0, null, 0);
- StubResponseAAI.MockGetGenericVnfByIdWithDepth(null, 0, null);
- StubResponseAAI.MockGetGenericVnfById_404(null);
- StubResponseAAI.MockGetGenericVnfById_500(null);
- StubResponseAAI.MockGetGenericVnfByName(null, null);
- StubResponseAAI.MockGetGenericVnfByNameWithDepth(null, 0, null);
- StubResponseAAI.MockGetGenericVnfByName_404(null);
- StubResponseAAI.MockDeleteGenericVnf(null, null);
- StubResponseAAI.MockDeleteGenericVnf(null, null, 0);
- StubResponseAAI.MockDeleteGenericVnf_500(null, null);
- StubResponseAAI.MockPutGenericVnf(null);
- StubResponseAAI.MockPutGenericVnf(null, null, 0);
- StubResponseAAI.MockPutGenericVnf(null, 0);
- StubResponseAAI.MockPutGenericVnf_Bad(null, 0);
- StubResponseAAI.MockPatchGenericVnf(null);
- StubResponseAAI.MockGetVceById(null, null);
- StubResponseAAI.MockGetVceByName(null, null);
- StubResponseAAI.MockDeleteVce(null, null, 0);
- StubResponseAAI.MockPutVce(null);
- StubResponseAAI.MockGetGenericVceByNameWithDepth(null, 0, null);
- StubResponseAAI.MockGetVceGenericQuery(null, 0, 0, null);
- StubResponseAAI.MockGetTenantGenericQuery(null, null, null);
- StubResponseAAI.MockGetTenant(null, null);
- StubResponseAAI.MockGetNetwork(null, null, 0);
- StubResponseAAI.MockGetNetworkByIdWithDepth(null, null, null);
- StubResponseAAI.MockGetNetworkCloudRegion(null, null);
- StubResponseAAI.MockGetNetworkByName(null, null);
- StubResponseAAI.MockGetNetworkByName_404(null, null);
- StubResponseAAI.MockGetNetworkCloudRegion_404(null);
- StubResponseAAI.MockPutNetwork(null, 0, null);
- StubResponseAAI.MockPutNetwork(null, null, 0);
- StubResponseAAI.MockGetNetworkName(null, null, 0);
- StubResponseAAI.MockGetNetworkVpnBinding(null, null);
- StubResponseAAI.MockGetNetworkPolicy(null, null);
- StubResponseAAI.MockGetNetworkVpnBinding(null, null, 0);
- StubResponseAAI.MockGetNetworkPolicy(null, null, 0);
- StubResponseAAI.MockGetNetworkTableReference(null, null);
- StubResponseAAI.MockPutNetworkIdWithDepth(null, null, null);
- StubResponseAAI.MockGetNetworkPolicyfqdn(null, null, 0);
- StubResponseAAI.MockGetNetworkRouteTable(null, null, 0);
- StubResponseAAI.MockPatchVfModuleId(null, null);
- StubResponseAAI.MockVNFAdapterRestVfModule();
- StubResponseAAI.MockDBUpdateVfModule();
- StubResponseAAI.MockSDNCAdapterVfModule();
- StubResponseAAI.MockAAIVfModule();
- StubResponseAAI.MockGetCloudRegion(null, 0, null);
- StubResponseAAI.MockGetVolumeGroupById(null, null, null);
- StubResponseAAI.MockPutVolumeGroupById(null, null, null, 0);
- StubResponseAAI.MockGetVolumeGroupByName(null, null, null, 0);
- StubResponseAAI.MockDeleteVolumeGroupById(null, null, null, 0);
- StubResponseAAI.MockGetVolumeGroupByName_404(null, null);
- StubResponseAAI.MockDeleteVolumeGroup(null, null, null);
- StubResponseAAI.MockGetVfModuleId(null, null, null, 0);
- StubResponseAAI.MockGetVfModuleByNameWithDepth(null, null, 0, null, 0);
- StubResponseAAI.MockGetVfModuleIdNoResponse(null, null, null);
- StubResponseAAI.MockPutVfModuleIdNoResponse(null, null, null);
- StubResponseAAI.MockPutVfModuleId(null, null);
- StubResponseAAI.MockPutVfModuleId(null, null, 0);
- StubResponseAAI.MockDeleteVfModuleId(null, null, null, 0);
- StubResponseAAI.MockAAIVfModuleBadPatch(null, 0);
- StubResponseAAI.MockGetPserverByVnfId(null, null, 0);
- StubResponseAAI.MockGetGenericVnfsByVnfId(null, null, 0);
- StubResponseAAI.MockSetInMaintFlagByVnfId(null, 0);
- StubResponseAAI.MockGetVceById();
- StubResponseAAI.MockGetVceByName();
- StubResponseAAI.MockPutVce();
- StubResponseAAI.MockDeleteVce();
- StubResponseAAI.MockDeleteVce_404();
- StubResponseAAI.MockDeleteServiceSubscription();
- StubResponseAAI.MockGetServiceSubscription();
- StubResponseAAI.MockGetServiceSubscription_200Empty();
- StubResponseAAI.MockGetServiceSubscription_404();
- StubResponseAAI.MockGENPSIPutServiceInstance();
- StubResponseAAI.MockGENPSIPutServiceSubscription();
- StubResponseAAI.MockGENPSIPutServiceInstance_get500();
- StubResponseAAI.MockGetGenericVnfById();
- StubResponseAAI.MockGetGenericVnfById_404();
- StubResponseAAI.MockGetGenericVnfByName();
- StubResponseAAI.MockGetGenericVnfByName_hasRelationships();
- StubResponseAAI.MockGetGenericVnfById_hasRelationships();
- StubResponseAAI.MockGetGenericVnfById_500();
- StubResponseAAI.MockGetGenericVnfByName_404();
- StubResponseAAI.MockPutGenericVnf();
- StubResponseAAI.MockPutGenericVnf_400();
- StubResponseAAI.MockDeleteGenericVnf();
- StubResponseAAI.MockDeleteGenericVnf_404();
- StubResponseAAI.MockDeleteGenericVnf_500();
- StubResponseAAI.MockDeleteGenericVnf_412();
- } catch (Exception ex) {
-
- System.err.println(ex);
- }
+public class StubResponseAAITest extends WorkflowTest{
- }
+ @Test
+ public void testStubResponseAAIforNullAndDefaultInputs()
+ {
+ try{
+ StubResponseAAI.MockPutTunnelXConnect(null, null, null, null, null);
+ StubResponseAAI.MockGetAllottedResource(null, null, null, null, null);
+ StubResponseAAI.MockPutAllottedResource(null, null, null, null);
+ StubResponseAAI.MockPutAllottedResource_500(null, null, null, null);
+ StubResponseAAI.MockDeleteAllottedResource(null, null, null, null, null);
+ StubResponseAAI.MockPatchAllottedResource(null, null, null, null);
+ StubResponseAAI.MockQueryAllottedResourceById(null, null);
+ StubResponseAAI.MockGetServiceInstance(null, null, null, null);
+ StubResponseAAI.MockGetServiceInstance_404(null, null, null);
+ StubResponseAAI.MockGetServiceInstance_500(null, null, null);
+ StubResponseAAI.MockGetServiceInstance_500(null, null, null, null);
+ StubResponseAAI.MockNodeQueryServiceInstanceByName(null, null);
+ StubResponseAAI.MockNodeQueryServiceInstanceByName_404(null);
+ StubResponseAAI.MockNodeQueryServiceInstanceByName_500(null);
+ StubResponseAAI.MockNodeQueryServiceInstanceById(null, null);
+ StubResponseAAI.MockNodeQueryServiceInstanceById_404(null);
+ StubResponseAAI.MockNodeQueryServiceInstanceById_500(null);
+ StubResponseAAI.MockDeleteServiceInstance(null, null, null, null);
+ StubResponseAAI.MockGetServiceInstance(null, null, null, null, 0);
+ StubResponseAAI.MockGetServiceInstance(null, null, null, 0);
+ StubResponseAAI.MockDeleteServiceInstance(null, null, null, null, 0);
+ StubResponseAAI.MockDeleteServiceInstance(null, null, null, 0);
+ StubResponseAAI.MockDeleteServiceInstance_404(null, null, null, null);
+ StubResponseAAI.MockDeleteServiceInstance_500(null, null, null, null);
+ StubResponseAAI.MockPutServiceInstance(null, null, null, null);
+ StubResponseAAI.MockPutServiceInstance_500(null, null, null);
+ StubResponseAAI.MockGetServiceSubscription(null, null, null);
+ StubResponseAAI.MockDeleteServiceSubscription(null, null, 0);
+ StubResponseAAI.MockDeleteServiceInstanceId(null, null, null);
+ StubResponseAAI.MockPutServiceSubscription(null, null);
+ StubResponseAAI.MockGetServiceSubscription(null, null, 0);
+ StubResponseAAI.MockGetCustomer(null, null);
+ StubResponseAAI.MockDeleteCustomer(null);
+ StubResponseAAI.MockPutCustomer(null);
+ StubResponseAAI.MockPutCustomer_500(null);
+ StubResponseAAI.MockGetGenericVnfById(null, null);
+ StubResponseAAI.MockGetGenericVnfById(null, null, 0);
+ StubResponseAAI.MockGetGenericVnfByIdWithPriority(null, 0, null);
+ StubResponseAAI.MockGetGenericVnfByIdWithPriority(null, null, 0, null, 0);
+ StubResponseAAI.MockGetGenericVnfByIdWithDepth(null, 0, null);
+ StubResponseAAI.MockGetGenericVnfById_404(null);
+ StubResponseAAI.MockGetGenericVnfById_500(null);
+ StubResponseAAI.MockGetGenericVnfByName(null, null);
+ StubResponseAAI.MockGetGenericVnfByNameWithDepth(null, 0, null);
+ StubResponseAAI.MockGetGenericVnfByName_404(null);
+ StubResponseAAI.MockDeleteGenericVnf(null, null);
+ StubResponseAAI.MockDeleteGenericVnf(null, null, 0);
+ StubResponseAAI.MockDeleteGenericVnf_500(null, null);
+ StubResponseAAI.MockPutGenericVnf(null);
+ StubResponseAAI.MockPutGenericVnf(null, null, 0);
+ StubResponseAAI.MockPutGenericVnf(null, 0);
+ StubResponseAAI.MockPutGenericVnf_Bad(null, 0);
+ StubResponseAAI.MockPatchGenericVnf(null);
+ StubResponseAAI.MockGetVceById(null, null);
+ StubResponseAAI.MockGetVceByName(null, null);
+ StubResponseAAI.MockDeleteVce(null, null, 0);
+ StubResponseAAI.MockPutVce(null);
+ StubResponseAAI.MockGetGenericVceByNameWithDepth(null, 0, null);
+ StubResponseAAI.MockGetVceGenericQuery(null, 0, 0, null);
+ StubResponseAAI.MockGetTenantGenericQuery(null, null, null);
+ StubResponseAAI.MockGetTenant(null, null);
+ StubResponseAAI.MockGetNetwork(null, null, 0);
+ StubResponseAAI.MockGetNetworkByIdWithDepth(null, null, null);
+ StubResponseAAI.MockGetNetworkCloudRegion(null, null);
+ StubResponseAAI.MockGetNetworkByName(null, null);
+ StubResponseAAI.MockGetNetworkByName_404(null, null);
+ StubResponseAAI.MockGetNetworkCloudRegion_404(null);
+ StubResponseAAI.MockPutNetwork(null, 0, null);
+ StubResponseAAI.MockPutNetwork(null, null, 0);
+ StubResponseAAI.MockGetNetworkName(null, null, 0);
+ StubResponseAAI.MockGetNetworkVpnBinding(null, null);
+ StubResponseAAI.MockGetNetworkPolicy(null, null);
+ StubResponseAAI.MockGetNetworkVpnBinding(null, null, 0);
+ StubResponseAAI.MockGetNetworkPolicy(null, null, 0);
+ StubResponseAAI.MockGetNetworkTableReference(null, null);
+ StubResponseAAI.MockPutNetworkIdWithDepth(null, null, null);
+ StubResponseAAI.MockGetNetworkPolicyfqdn(null, null, 0);
+ StubResponseAAI.MockGetNetworkRouteTable(null, null, 0);
+ StubResponseAAI.MockPatchVfModuleId(null, null);
+ StubResponseAAI.MockVNFAdapterRestVfModule();
+ StubResponseAAI.MockDBUpdateVfModule();
+ StubResponseAAI.MockSDNCAdapterVfModule();
+ StubResponseAAI.MockAAIVfModule();
+ StubResponseAAI.MockGetCloudRegion(null, 0, null);
+ StubResponseAAI.MockGetVolumeGroupById(null, null, null);
+ StubResponseAAI.MockPutVolumeGroupById(null, null, null, 0);
+ StubResponseAAI.MockGetVolumeGroupByName(null, null, null, 0);
+ StubResponseAAI.MockDeleteVolumeGroupById(null, null, null, 0);
+ StubResponseAAI.MockGetVolumeGroupByName_404(null, null);
+ StubResponseAAI.MockDeleteVolumeGroup(null, null, null);
+ StubResponseAAI.MockGetVfModuleId(null, null, null, 0);
+ StubResponseAAI.MockGetVfModuleByNameWithDepth(null, null, 0, null, 0);
+ StubResponseAAI.MockGetVfModuleIdNoResponse(null, null, null);
+ StubResponseAAI.MockPutVfModuleIdNoResponse(null, null, null);
+ StubResponseAAI.MockPutVfModuleId(null, null);
+ StubResponseAAI.MockPutVfModuleId(null, null, 0);
+ StubResponseAAI.MockDeleteVfModuleId(null, null, null, 0);
+ StubResponseAAI.MockAAIVfModuleBadPatch(null, 0);
+ StubResponseAAI.MockGetPserverByVnfId(null, null, 0);
+ StubResponseAAI.MockGetGenericVnfsByVnfId(null, null, 0);
+ StubResponseAAI.MockSetInMaintFlagByVnfId(null, 0);
+ StubResponseAAI.MockGetVceById();
+ StubResponseAAI.MockGetVceByName();
+ StubResponseAAI.MockPutVce();
+ StubResponseAAI.MockDeleteVce();
+ StubResponseAAI.MockDeleteVce_404();
+ StubResponseAAI.MockDeleteServiceSubscription();
+ StubResponseAAI.MockGetServiceSubscription();
+ StubResponseAAI.MockGetServiceSubscription_200Empty();
+ StubResponseAAI.MockGetServiceSubscription_404();
+ StubResponseAAI.MockGENPSIPutServiceInstance();
+ StubResponseAAI.MockGENPSIPutServiceSubscription();
+ StubResponseAAI.MockGENPSIPutServiceInstance_get500();
+ StubResponseAAI.MockGetGenericVnfById();
+ StubResponseAAI.MockGetGenericVnfById_404();
+ StubResponseAAI.MockGetGenericVnfByName();
+ StubResponseAAI.MockGetGenericVnfByName_hasRelationships();
+ StubResponseAAI.MockGetGenericVnfById_hasRelationships();
+ StubResponseAAI.MockGetGenericVnfById_500();
+ StubResponseAAI.MockGetGenericVnfByName_404();
+ StubResponseAAI.MockPutGenericVnf();
+ StubResponseAAI.MockPutGenericVnf_400();
+ StubResponseAAI.MockDeleteGenericVnf();
+ StubResponseAAI.MockDeleteGenericVnf_404();
+ StubResponseAAI.MockDeleteGenericVnf_500();
+ StubResponseAAI.MockDeleteGenericVnf_412();
+ }
+ catch(Exception ex)
+ {
+
+ System.err.println(ex);
+ }
+
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java index 040294876a..5b5e4e59d3 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceTest.java @@ -46,442 +46,443 @@ import com.github.tomakehurst.wiremock.extension.ResponseTransformer; /** * Unit test cases for DoUpdateNetworkInstance.bpmn + * */ public class UpdateNetworkInstanceTest extends WorkflowTest { - @WorkflowTestTransformer - public static final ResponseTransformer sdncAdapterMockTransformer = - new SDNCAdapterNetworkTopologyMockTransformer(); - - @Rule - public final SDNCAdapterCallbackRule sdncAdapterCallbackRule = - new SDNCAdapterCallbackRule(processEngineRule); - - /** - * End-to-End flow - Unit test for DoUpdateNetworkInstance.bpmn - * - String input & String response - */ - - @Test - //@Ignore - @Deployment(resources = {"process/UpdateNetworkInstance.bpmn", - "subprocess/DoUpdateNetworkInstance.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceUpdateNetworkInstance_SuccessVID1() throws Exception { - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success1 - UpdateNetworkInstance flow Started! "); - System.out.println("----------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); - MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); - MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); - - Map<String, String> variables = setupVariablesVID1(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - System.out.println("----------------------------------------------------------"); - System.out.println("- got workflow response -"); - System.out.println("----------------------------------------------------------"); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); - Assert.assertNotNull("UPDNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest")); - - String workflowResp = BPMNUtil.getVariable(processEngineRule, "UpdateNetworkInstance", "WorkflowResponse"); - Assert.assertNotNull(workflowResp); - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success1 - UpdateNetworkInstance flow Completed "); - System.out.println("----------------------------------------------------------"); - - } - - @Test - //@Ignore - @Deployment(resources = {"process/UpdateNetworkInstance.bpmn", - "subprocess/DoUpdateNetworkInstance.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceUpdateNetworkInstance_SuccessVIPER1() throws Exception { - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success2 - UpdateNetworkInstance flow Started! "); - System.out.println("----------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); - MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); - MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); - - Map<String, String> variables = setupVariablesVIPER1(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); - Assert.assertNotNull("UPDNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest")); - - String completeMsoProcessRequest = - "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n' - + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n' - + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n' - + " <request-info>" + '\n' - + " <request-id>testRequestId</request-id>" + '\n' - + " <action>UPDATE</action>" + '\n' - + " <source>VID</source>" + '\n' - + " </request-info>" + '\n' - + " <aetgt:status-message>Network has been updated successfully.</aetgt:status-message>" + '\n' - + " <aetgt:mso-bpel-name>BPMN Network action: UPDATE</aetgt:mso-bpel-name>" + '\n' - + "</aetgt:MsoCompletionRequest>"; - - Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest")); - - System.out.println("----------------------------------------------------------"); - System.out.println(" Success2 - UpdateNetworkInstance flow Completed "); - System.out.println("----------------------------------------------------------"); - - } - - - @Test - //@Ignore - @Deployment(resources = {"process/UpdateNetworkInstance.bpmn", - "subprocess/DoUpdateNetworkInstance.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceUpdateNetworkInstance_MissingNetworkId() throws Exception { - - System.out.println("--------------------------------------------------------------------"); - System.out.println(" Missing networkId - UpdateNetworkInstance flow Started! "); - System.out.println("--------------------------------------------------------------------"); - - // setup simulators - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); - - Map<String, String> variables = setupVariablesMissingNetworkId(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); - Assert.assertNotNull("UPDNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest")); - - String falloutHandlerActual = getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest"); - String falloutHandlerExpected = - "<aetgt:FalloutHandlerRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + "\n" + - " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + "\n" + - " xmlns:wfsch=\"http://org.openecomp/mso/workflow/schema/v1\">" + "\n" + - " <request-info xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + "\n" + - " <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>" + "\n" + - " <action>UPDATE</action>" + "\n" + - " <source>VID</source>" + "\n" + - " </request-info>" + "\n" + - " <aetgt:WorkflowException xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\">" + "\n" + - " <aetgt:ErrorMessage>Variable 'network-id' value/element is missing.</aetgt:ErrorMessage>" + "\n" + - " <aetgt:ErrorCode>7000</aetgt:ErrorCode>" + "\n" + - " </aetgt:WorkflowException>" + "\n" + - " </aetgt:FalloutHandlerRequest>"; - - assertEquals("Response", falloutHandlerExpected, falloutHandlerActual); - - System.out.println("------------------------------------------------------------------"); - System.out.println(" Missing networkId - UpdateNetworkInstance flow Completed "); - System.out.println("------------------------------------------------------------------"); - - } - - - @Test - //@Ignore - @Deployment(resources = {"process/UpdateNetworkInstance.bpmn", - "subprocess/DoUpdateNetworkInstance.bpmn", - "subprocess/DoUpdateNetworkInstanceRollback.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/CompleteMsoProcess.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn"}) - - public void shouldInvokeServiceUpdateNetworkInstance_Network_SDNC_Rollback() throws Exception { - - System.out.println("---------------------------------------------------------------"); - System.out.println(" Network and SDNC Rollback - UpdateNetworkInstance flow Started! "); - System.out.println("---------------------------------------------------------------"); - - // setup simulators - mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); - mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>rollback"); - MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); - MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - MockUpdateRequestDB("DBUpdateResponse.xml"); - //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8"); - MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); - - Map<String, String> variables = setupVariablesVID1(); - //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); - //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); - - assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); - Assert.assertNotNull("UPDNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest")); - - System.out.println("---------------------------------------------------------------------"); - System.out.println(" Network and SCNC Rollback - UpdateNetworkInstance flow Completed "); - System.out.println("---------------------------------------------------------------------"); - - } - - // ***************** - // Utility Section - // ***************** - - String networkModelInfo = - " {\"modelUuid\": \"mod-inst-uuid-123\", " + '\n' + - " \"modelName\": \"mod_inst_z_123\", " + '\n' + - " \"modelVersion\": \"1.0\", " + '\n' + - " \"modelCustomizationUuid\": \"mod-inst-uuid-123\", " + '\n' + - " \"modelInvariantUuid\": \"mod-invar-uuid-123\" " + '\n' + - " }"; - - String serviceModelInfo = - " {\"modelUuid\": \"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6\", " + '\n' + - " \"modelName\": \"HNGW Protected OAM\", " + '\n' + - " \"modelVersion\": \"1.0\", " + '\n' + - " \"modelInvariantUuid\": \"fcc85cb0-ad74-45d7-a5a1-17c8744fdb71\" " + '\n' + - " }"; - - // Success Scenario - private Map<String, String> setupVariablesVID1() { - Map<String, String> variables = new HashMap<>(); - variables.put("bpmnRequest", getCreateNetworkRequest1()); - variables.put("mso-request-id", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("isBaseVfModule", "true"); - variables.put("recipeTimeout", "0"); - variables.put("requestAction", "UPDATE"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", ""); - variables.put("vfModuleId", ""); - variables.put("volumeGroupId", ""); - variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); - variables.put("serviceType", "vMOG"); - variables.put("vfModuleType", ""); - variables.put("networkType", "modelName"); - return variables; - - } - - public String getCreateNetworkRequest1() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1.0\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_1\", " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"callbackUrl\": \"\", " + '\n' + - " \"suppressRollback\": \"false\" ," + '\n' + - " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"backoutOnFailure\": true, " + '\n' + - " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' + - " \"userParams\": [] " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - - return request; - } - - public String getCreateNetworkRequest2() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelId\": \"modelId\", " + '\n' + - " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"instanceName\": \"myOwn_Network\", " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"callbackUrl\": \"\", " + '\n' + - " \"suppressRollback\": \"true\" ," + '\n' + - " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"backoutOnFailure\": true, " + '\n' + - " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' + - " \"userParams\": [] " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - - return request; - - } - - // Success Scenario - private Map<String, String> setupVariablesVIPER1() { - Map<String, String> variables = new HashMap<>(); - variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("msoRequestId", "testRequestId"); - variables.put("requestId", "testRequestId"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); - variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_1"); - variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); - variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e"); - variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); - variables.put("disableRollback", "false"); // macro - variables.put("failIfExists", "false"); - //variables.put("sdncVersion", "1702"); - variables.put("sdncVersion", "1707"); - variables.put("subscriptionServiceType", "MSO-dev-service-type"); - variables.put("globalSubscriberId", "globalId_45678905678"); - variables.put("networkModelInfo", networkModelInfo); - variables.put("serviceModelInfo", serviceModelInfo); - return variables; - - } - - // Missing Name Scenario - private Map<String, String> setupVariablesMissingNetworkId() { - Map<String, String> variables = new HashMap<>(); - variables.put("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); - variables.put("bpmnRequest", getCreateNetworkRequestNetworkId()); - variables.put("requestId", "testRequestId"); - variables.put("isBaseVfModule", "true"); - variables.put("recipeTimeout", "0"); - variables.put("requestAction", "UPDATE"); - variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); - variables.put("vnfId", ""); - variables.put("vfModuleId", ""); - variables.put("volumeGroupId", ""); - //variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); // missing, ok - variables.put("serviceType", "vMOG"); - variables.put("vfModuleType", ""); - variables.put("networkType", "modelName"); - - return variables; - - } - - public String getCreateNetworkRequestNetworkId() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelId\": \"modelId\", " + '\n' + - " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"callbackUrl\": \"\", " + '\n' + - " \"suppressRollback\": \"true\" ," + '\n' + - " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"userParams\": [] " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - - return request; - - } - - public String getCreateNetworkRequestSDNCRollback() { - - String request = - "{ \"requestDetails\": { " + '\n' + - " \"modelInfo\": { " + '\n' + - " \"modelType\": \"modelType\", " + '\n' + - " \"modelId\": \"modelId\", " + '\n' + - " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' + - " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + - " \"modelVersion\": \"1\" " + '\n' + - " }, " + '\n' + - " \"cloudConfiguration\": { " + '\n' + - " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + - " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + - " }, " + '\n' + - " \"requestInfo\": { " + '\n' + - " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_3\", " + '\n' + - " \"source\": \"VID\", " + '\n' + - " \"callbackUrl\": \"\", " + '\n' + - " \"suppressRollback\": \"true\" ," + '\n' + - " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + - " }, " + '\n' + - " \"requestParameters\": { " + '\n' + - " \"userParams\": [] " + '\n' + - " } " + '\n' + - " } " + '\n' + - "}"; - - - return request; - } + @WorkflowTestTransformer + public static final ResponseTransformer sdncAdapterMockTransformer = + new SDNCAdapterNetworkTopologyMockTransformer(); + + @Rule + public final SDNCAdapterCallbackRule sdncAdapterCallbackRule = + new SDNCAdapterCallbackRule(processEngineRule); + + /** + * End-to-End flow - Unit test for DoUpdateNetworkInstance.bpmn + * - String input & String response + */ + + @Test + //@Ignore + @Deployment(resources = {"process/UpdateNetworkInstance.bpmn", + "subprocess/DoUpdateNetworkInstance.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceUpdateNetworkInstance_SuccessVID1() throws Exception { + + System.out.println("----------------------------------------------------------"); + System.out.println(" Success1 - UpdateNetworkInstance flow Started! "); + System.out.println("----------------------------------------------------------"); + + // setup simulators + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); + MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); + MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); + MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); + MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1"); + MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); + MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); + MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); + MockUpdateRequestDB("DBUpdateResponse.xml"); + //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); + + Map<String, String> variables = setupVariablesVID1(); + //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); + executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); + System.out.println("----------------------------------------------------------"); + System.out.println("- got workflow response -"); + System.out.println("----------------------------------------------------------"); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); + Assert.assertNotNull("UPDNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest")); + + String workflowResp = BPMNUtil.getVariable(processEngineRule, "UpdateNetworkInstance", "WorkflowResponse"); + Assert.assertNotNull(workflowResp); + + System.out.println("----------------------------------------------------------"); + System.out.println(" Success1 - UpdateNetworkInstance flow Completed "); + System.out.println("----------------------------------------------------------"); + + } + + @Test + //@Ignore + @Deployment(resources = {"process/UpdateNetworkInstance.bpmn", + "subprocess/DoUpdateNetworkInstance.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceUpdateNetworkInstance_SuccessVIPER1() throws Exception { + + System.out.println("----------------------------------------------------------"); + System.out.println(" Success2 - UpdateNetworkInstance flow Started! "); + System.out.println("----------------------------------------------------------"); + + // setup simulators + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); + MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); + MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); + MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); + MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "1"); + MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); + MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); + MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); + MockUpdateRequestDB("DBUpdateResponse.xml"); + //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); + + Map<String, String> variables = setupVariablesVIPER1(); + //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); + executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); + Assert.assertNotNull("UPDNI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest")); + + String completeMsoProcessRequest = + "<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + '\n' + + " xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + '\n' + + " xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + '\n' + + " <request-info>" + '\n' + + " <request-id>testRequestId</request-id>" + '\n' + + " <action>UPDATE</action>" + '\n' + + " <source>VID</source>" + '\n' + + " </request-info>" + '\n' + + " <aetgt:status-message>Network has been updated successfully.</aetgt:status-message>" + '\n' + + " <aetgt:mso-bpel-name>BPMN Network action: UPDATE</aetgt:mso-bpel-name>" + '\n' + + "</aetgt:MsoCompletionRequest>"; + + Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_CompleteMsoProcessRequest")); + + System.out.println("----------------------------------------------------------"); + System.out.println(" Success2 - UpdateNetworkInstance flow Completed "); + System.out.println("----------------------------------------------------------"); + + } + + + @Test + //@Ignore + @Deployment(resources = {"process/UpdateNetworkInstance.bpmn", + "subprocess/DoUpdateNetworkInstance.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceUpdateNetworkInstance_MissingNetworkId() throws Exception { + + System.out.println("--------------------------------------------------------------------"); + System.out.println(" Missing networkId - UpdateNetworkInstance flow Started! "); + System.out.println("--------------------------------------------------------------------"); + + // setup simulators + MockUpdateRequestDB("DBUpdateResponse.xml"); + //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); + + Map<String, String> variables = setupVariablesMissingNetworkId(); + //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); + executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); + Assert.assertNotNull("UPDNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest")); + + String falloutHandlerActual = getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest"); + String falloutHandlerExpected = +"<aetgt:FalloutHandlerRequest xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\"" + "\n" + +" xmlns:ns=\"http://org.openecomp/mso/request/types/v1\"" + "\n" + +" xmlns:wfsch=\"http://org.openecomp/mso/workflow/schema/v1\">" + "\n" + +" <request-info xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">" + "\n" + +" <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>" + "\n" + +" <action>UPDATE</action>" + "\n" + +" <source>VID</source>" + "\n" + +" </request-info>" + "\n" + +" <aetgt:WorkflowException xmlns:aetgt=\"http://org.openecomp/mso/workflow/schema/v1\">" + "\n" + +" <aetgt:ErrorMessage>Variable 'network-id' value/element is missing.</aetgt:ErrorMessage>" + "\n" + +" <aetgt:ErrorCode>7000</aetgt:ErrorCode>" + "\n" + +" </aetgt:WorkflowException>" + "\n" + +" </aetgt:FalloutHandlerRequest>"; + + assertEquals("Response", falloutHandlerExpected, falloutHandlerActual); + + System.out.println("------------------------------------------------------------------"); + System.out.println(" Missing networkId - UpdateNetworkInstance flow Completed "); + System.out.println("------------------------------------------------------------------"); + + } + + + @Test + //@Ignore + @Deployment(resources = {"process/UpdateNetworkInstance.bpmn", + "subprocess/DoUpdateNetworkInstance.bpmn", + "subprocess/DoUpdateNetworkInstanceRollback.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceUpdateNetworkInstance_Network_SDNC_Rollback() throws Exception { + + System.out.println("---------------------------------------------------------------"); + System.out.println(" Network and SDNC Rollback - UpdateNetworkInstance flow Started! "); + System.out.println("---------------------------------------------------------------"); + + // setup simulators + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>rollback"); + MockNetworkAdapterRestPut("UpdateNetworkV2/updateNetworkResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); + MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); + MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); + MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); + MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); + MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); + MockUpdateRequestDB("DBUpdateResponse.xml"); + //MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml", "v8"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); + + Map<String, String> variables = setupVariablesVID1(); + //WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); + executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstance", variables); + //waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_Success")); + Assert.assertNotNull("UPDNI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstance", "UPDNI_FalloutHandlerRequest")); + + System.out.println("---------------------------------------------------------------------"); + System.out.println(" Network and SCNC Rollback - UpdateNetworkInstance flow Completed "); + System.out.println("---------------------------------------------------------------------"); + + } + + // ***************** + // Utility Section + // ***************** + + String networkModelInfo = + " {\"modelUuid\": \"mod-inst-uuid-123\", " + '\n' + + " \"modelName\": \"mod_inst_z_123\", " + '\n' + + " \"modelVersion\": \"1.0\", " + '\n' + + " \"modelCustomizationUuid\": \"mod-inst-uuid-123\", " + '\n' + + " \"modelInvariantUuid\": \"mod-invar-uuid-123\" " + '\n' + + " }"; + + String serviceModelInfo = + " {\"modelUuid\": \"36a3a8ea-49a6-4ac8-b06c-89a54544b9b6\", " + '\n' + + " \"modelName\": \"HNGW Protected OAM\", " + '\n' + + " \"modelVersion\": \"1.0\", " + '\n' + + " \"modelInvariantUuid\": \"fcc85cb0-ad74-45d7-a5a1-17c8744fdb71\" " + '\n' + + " }"; + + // Success Scenario + private Map<String, String> setupVariablesVID1() { + Map<String, String> variables = new HashMap<>(); + variables.put("bpmnRequest", getCreateNetworkRequest1()); + variables.put("mso-request-id", "testRequestId"); + variables.put("requestId", "testRequestId"); + variables.put("isBaseVfModule", "true"); + variables.put("recipeTimeout", "0"); + variables.put("requestAction", "UPDATE"); + variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); + variables.put("vnfId", ""); + variables.put("vfModuleId", ""); + variables.put("volumeGroupId", ""); + variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); + variables.put("serviceType", "vMOG"); + variables.put("vfModuleType", ""); + variables.put("networkType", "modelName"); + return variables; + + } + + public String getCreateNetworkRequest1() { + + String request = + "{ \"requestDetails\": { " + '\n' + + " \"modelInfo\": { " + '\n' + + " \"modelType\": \"modelType\", " + '\n' + + " \"modelCustomizationId\": \"f21df226-8093-48c3-be7e-0408fcda0422\", " + '\n' + + " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + + " \"modelVersion\": \"1.0\" " + '\n' + + " }, " + '\n' + + " \"cloudConfiguration\": { " + '\n' + + " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + + " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + + " }, " + '\n' + + " \"requestInfo\": { " + '\n' + + " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_1\", " + '\n' + + " \"source\": \"VID\", " + '\n' + + " \"callbackUrl\": \"\", " + '\n' + + " \"suppressRollback\": \"false\" ," + '\n' + + " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + + " }, " + '\n' + + " \"requestParameters\": { " + '\n' + + " \"backoutOnFailure\": true, " + '\n' + + " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' + + " \"userParams\": [] " + '\n' + + " } " + '\n' + + " } " + '\n' + + "}"; + + return request; + } + + public String getCreateNetworkRequest2() { + + String request = + "{ \"requestDetails\": { " + '\n' + + " \"modelInfo\": { " + '\n' + + " \"modelType\": \"modelType\", " + '\n' + + " \"modelId\": \"modelId\", " + '\n' + + " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' + + " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + + " \"modelVersion\": \"1\" " + '\n' + + " }, " + '\n' + + " \"cloudConfiguration\": { " + '\n' + + " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + + " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + + " }, " + '\n' + + " \"requestInfo\": { " + '\n' + + " \"instanceName\": \"myOwn_Network\", " + '\n' + + " \"source\": \"VID\", " + '\n' + + " \"callbackUrl\": \"\", " + '\n' + + " \"suppressRollback\": \"true\" ," + '\n' + + " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + + " }, " + '\n' + + " \"requestParameters\": { " + '\n' + + " \"backoutOnFailure\": true, " + '\n' + + " \"serviceId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\", " + '\n' + + " \"userParams\": [] " + '\n' + + " } " + '\n' + + " } " + '\n' + + "}"; + + return request; + + } + + // Success Scenario + private Map<String, String> setupVariablesVIPER1() { + Map<String, String> variables = new HashMap<>(); + variables.put("testMessageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); + variables.put("msoRequestId", "testRequestId"); + variables.put("requestId", "testRequestId"); + variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); + variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); + variables.put("networkName", "MNS-25180-L-01-dmz_direct_net_1"); + variables.put("lcpCloudRegionId", "RDM2WAGPLCP"); + variables.put("tenantId", "88a6ca3ee0394ade9403f075db23167e"); + variables.put("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + variables.put("disableRollback", "false"); // macro + variables.put("failIfExists", "false"); + //variables.put("sdncVersion", "1702"); + variables.put("sdncVersion", "1707"); + variables.put("subscriptionServiceType", "MSO-dev-service-type"); + variables.put("globalSubscriberId", "globalId_45678905678"); + variables.put("networkModelInfo", networkModelInfo); + variables.put("serviceModelInfo", serviceModelInfo); + return variables; + + } + + // Missing Name Scenario + private Map<String, String> setupVariablesMissingNetworkId() { + Map<String, String> variables = new HashMap<>(); + variables.put("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56"); + variables.put("bpmnRequest", getCreateNetworkRequestNetworkId()); + variables.put("requestId", "testRequestId"); + variables.put("isBaseVfModule", "true"); + variables.put("recipeTimeout", "0"); + variables.put("requestAction", "UPDATE"); + variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4"); + variables.put("vnfId", ""); + variables.put("vfModuleId", ""); + variables.put("volumeGroupId", ""); + //variables.put("networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4"); // missing, ok + variables.put("serviceType", "vMOG"); + variables.put("vfModuleType", ""); + variables.put("networkType", "modelName"); + + return variables; + + } + + public String getCreateNetworkRequestNetworkId() { + + String request = + "{ \"requestDetails\": { " + '\n' + + " \"modelInfo\": { " + '\n' + + " \"modelType\": \"modelType\", " + '\n' + + " \"modelId\": \"modelId\", " + '\n' + + " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' + + " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + + " \"modelVersion\": \"1\" " + '\n' + + " }, " + '\n' + + " \"cloudConfiguration\": { " + '\n' + + " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + + " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + + " }, " + '\n' + + " \"requestInfo\": { " + '\n' + + " \"source\": \"VID\", " + '\n' + + " \"callbackUrl\": \"\", " + '\n' + + " \"suppressRollback\": \"true\" ," + '\n' + + " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + + " }, " + '\n' + + " \"requestParameters\": { " + '\n' + + " \"userParams\": [] " + '\n' + + " } " + '\n' + + " } " + '\n' + + "}"; + + return request; + + } + + public String getCreateNetworkRequestSDNCRollback() { + + String request = + "{ \"requestDetails\": { " + '\n' + + " \"modelInfo\": { " + '\n' + + " \"modelType\": \"modelType\", " + '\n' + + " \"modelId\": \"modelId\", " + '\n' + + " \"modelNameVersionId\": \"modelNameVersionId\", " + '\n' + + " \"modelName\": \"CONTRAIL_EXTERNAL\", " + '\n' + + " \"modelVersion\": \"1\" " + '\n' + + " }, " + '\n' + + " \"cloudConfiguration\": { " + '\n' + + " \"lcpCloudRegionId\": \"RDM2WAGPLCP\", " + '\n' + + " \"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\" " + '\n' + + " }, " + '\n' + + " \"requestInfo\": { " + '\n' + + " \"instanceName\": \"MNS-25180-L-01-dmz_direct_net_3\", " + '\n' + + " \"source\": \"VID\", " + '\n' + + " \"callbackUrl\": \"\", " + '\n' + + " \"suppressRollback\": \"true\" ," + '\n' + + " \"productFamilyId\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\" " + '\n' + + " }, " + '\n' + + " \"requestParameters\": { " + '\n' + + " \"userParams\": [] " + '\n' + + " } " + '\n' + + " } " + '\n' + + "}"; + + + return request; + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java index 5c33ba4c11..37c548abf7 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -43,103 +43,103 @@ import org.openecomp.mso.bpmn.mock.FileUtil; * Unit test cases for UpdateVfModule.bpmn
*/
public class UpdateVfModuleInfraTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public UpdateVfModuleInfraTest() throws IOException {
- callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
- }
-
- /**
- * Sunny day scenario.
- *
- * @throws Exception
- */
- @Test
- @Ignore
- @Deployment(resources = {
- "process/UpdateVfModuleInfra.bpmn",
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
- public void sunnyDay() throws Exception {
-
- logStart();
-
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool");
- MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1);
- mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVfModuleRequest =
- FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVfModule_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleInfra",
- "v1", businessKey, updaetVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "UpdateVfModuleInfraSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", false);
- variables.put("isDebugLogEnabled", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "UPDATE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfType", "vSAMP12");
- variables.put("vfModuleId", "supercool");
- variables.put("volumeGroupId", "");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- return variables;
-
- }
-
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public UpdateVfModuleInfraTest() throws IOException {
+ callbacks.put("changeassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("vnfUpdate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
+ }
+
+ /**
+ * Sunny day scenario.
+ *
+ * @throws Exception
+ */
+ @Test
+ @Ignore
+ @Deployment(resources = {
+ "process/UpdateVfModuleInfra.bpmn",
+ "subprocess/DoUpdateVfModule.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn"
+ })
+ public void sunnyDay() throws Exception {
+
+ logStart();
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool");
+ MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1);
+ mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPut("skask", "/supercool", 202);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ String updaetVfModuleRequest =
+ FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVfModule_VID_request.json");
+
+ Map<String, Object> variables = setupVariablesSunnyDayVID();
+
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleInfra",
+ "v1", businessKey, updaetVfModuleRequest, variables);
+
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ // TODO add appropriate assertions
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "UpdateVfModuleInfraSuccessIndicator", true);
+
+ logEnd();
+ }
+
+ // Active Scenario
+ private Map<String, Object> setupVariablesSunnyDayVID() {
+ Map<String, Object> variables = new HashMap<>();
+ //try {
+ // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
+ //}
+ //catch (Exception e) {
+
+ //}
+ //variables.put("mso-request-id", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isBaseVfModule", false);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("recipeTimeout", "0");
+ variables.put("requestAction", "UPDATE_VF_MODULE");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "skask");
+ variables.put("vnfType", "vSAMP12");
+ variables.put("vfModuleId", "supercool");
+ variables.put("volumeGroupId", "");
+ variables.put("serviceType", "MOG");
+ variables.put("vfModuleType", "");
+ return variables;
+
+ }
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java index b5f7f64561..65a514c804 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraV2Test.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -45,11 +45,11 @@ import org.openecomp.mso.bpmn.mock.FileUtil; * Unit test cases for UpdateVfModuleV2.bpmn
*/
public class UpdateVfModuleInfraV2Test extends WorkflowTest {
+
+ private final CallbackSet callbacks = new CallbackSet();
- private final CallbackSet callbacks = new CallbackSet();
-
- public UpdateVfModuleInfraV2Test() throws IOException {
- /*callbacks.put("changeassign", FileUtil.readResourceFile(
+ public UpdateVfModuleInfraV2Test() throws IOException {
+ /*callbacks.put("changeassign", FileUtil.readResourceFile(
"__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
callbacks.put("query", FileUtil.readResourceFile(
"__files/VfModularity/SDNCTopologyQueryCallback.xml"));
@@ -57,63 +57,63 @@ public class UpdateVfModuleInfraV2Test extends WorkflowTest { "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
callbacks.put("vnfUpdate", FileUtil.readResourceFile(
"__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));*/
- }
-
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- @Deployment(resources = {
- "process/UpdateVfModuleInfraV2.bpmn",
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- })
-
- public void sunnyDay() throws Exception {
- //logStart();
-
-
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool");
- MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1);
- mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
- String updateVfModuleRequest =
- FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVfModule_VID_request.json");
- TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleInfraV2",
- "v1", businessKey, updateVfModuleRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- //String responseBody = response.getResponse();
- //System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- //logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- variables.put("requestId", "testRequestId");
- variables.put("isBaseVfModule", false);
- variables.put("isDebugLogEnabled", "true");
- variables.put("recipeTimeout", "0");
- variables.put("requestAction", "UPDATE_VF_MODULE");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfType", "vSAMP12");
- variables.put("vfModuleId", "supercool");
- variables.put("volumeGroupId", "");
- variables.put("serviceType", "MOG");
- variables.put("vfModuleType", "");
- variables.put("moduleUuid", "fe6985cd-ea33-3346-ac12-ab121484a3fe");
- return variables;
-
- }
-
+ }
+
+ @Test
+ @Ignore // IGNORED FOR 1710 MERGE TO ONAP
+ @Deployment(resources = {
+ "process/UpdateVfModuleInfraV2.bpmn",
+ "subprocess/DoUpdateVfModule.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ })
+
+ public void sunnyDay() throws Exception {
+ //logStart();
+
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutVfModuleIdNoResponse("skask", "PCRF", "supercool");
+ MockGetGenericVnfByIdWithPriority("skask", "supercool", 200, "VfModularity/VfModule-supercool.xml", 1);
+ mockSDNCAdapter("/SDNCAdapter", "SvcInstanceId><", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPut("skask", "/supercool", 202);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = setupVariablesSunnyDayVID();
+
+ String updateVfModuleRequest =
+ FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVfModule_VID_request.json");
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleInfraV2",
+ "v1", businessKey, updateVfModuleRequest, variables);
+
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ //String responseBody = response.getResponse();
+ //System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ //logEnd();
+ }
+
+ // Active Scenario
+ private Map<String, Object> setupVariablesSunnyDayVID() {
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("requestId", "testRequestId");
+ variables.put("isBaseVfModule", false);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("recipeTimeout", "0");
+ variables.put("requestAction", "UPDATE_VF_MODULE");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "skask");
+ variables.put("vnfType", "vSAMP12");
+ variables.put("vfModuleId", "supercool");
+ variables.put("volumeGroupId", "");
+ variables.put("serviceType", "MOG");
+ variables.put("vfModuleType", "");
+ variables.put("moduleUuid", "fe6985cd-ea33-3346-ac12-ab121484a3fe");
+ return variables;
+
+ }
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java index 00efc575ef..b24eb56058 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -41,104 +41,103 @@ import org.openecomp.mso.bpmn.mock.FileUtil; * Unit test cases for UpdateVfModuleVolume.bpmn
*/
public class UpdateVfModuleVolumeInfraV1Test extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public UpdateVfModuleVolumeInfraV1Test() throws IOException {
- callbacks.put("volumeGroupUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml"));
- }
-
- /**
- * Happy path scenario.
- *
- * @throws Exception
- */
- @Test
- @Deployment(resources = {
- "process/UpdateVfModuleVolumeInfraV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
- public void happyPath() throws Exception {
-
- logStart();
-
- MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
- MockGetVolumeGroupById("mdt1", "78987", "UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
- MockGetVfModuleId("9e48f6ea-f786-46de-800a-d480e5ccc846", "6a1dc898-b590-47b9-bbf0-34424a7a2ec3/", "UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml", 200);
- mockPutVNFVolumeGroup("78987", 202);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVfModuleVolRequest =
- FileUtil.readResourceFile("__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleVolumeInfraV1", "v1", businessKey, updaetVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupUpdate");
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "UpdateVfModuleVolumeSuccessIndicator", true);
-
- logEnd();
- }
-
- /**
- * VF Module Personal model id does not match request model invariant id
- *
- * @throws Exception
- */
- @Test
- //@Ignore
- @Deployment(resources = {
- "process/UpdateVfModuleVolumeInfraV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/GenericNotificationService.bpmn",
- "subprocess/FalloutHandler.bpmn"
- })
- public void testPersonaModelIdNotMatch() throws Exception {
-
- logStart();
-
- MockGetVolumeGroupById("mdt1", "78987", "UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
- MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
- MockGetVfModuleId("9e48f6ea-f786-46de-800a-d480e5ccc846", "6a1dc898-b590-47b9-bbf0-34424a7a2ec3/", "UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml", 200);
- mockPutVNFVolumeGroup("78987", 202);
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVfModuleVolRequest =
- FileUtil.readResourceFile("__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json");
-
- Map<String, Object> testVariables = new HashMap<>();
- testVariables.put("requestId", "TEST-REQUEST-ID-0123");
- testVariables.put("serviceInstanceId", "test-service-instance-id");
- testVariables.put("volumeGroupId", "78987");
- testVariables.put("vnfId", "TEST-VNF-ID-0123");
- TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleVolumeInfraV1", "v1", businessKey, updaetVfModuleVolRequest, testVariables);
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectVNFRestCallbacks(callbacks, "volumeGroupUpdate");
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "UpdateVfModuleVolumeSuccessIndicator", true);
-
- logEnd();
- }
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public UpdateVfModuleVolumeInfraV1Test() throws IOException {
+ callbacks.put("volumeGroupUpdate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml"));
+ }
+
+ /**
+ * Happy path scenario.
+ *
+ * @throws Exception
+ */
+ @Test
+ @Deployment(resources = {
+ "process/UpdateVfModuleVolumeInfraV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/GenericNotificationService.bpmn",
+ "subprocess/FalloutHandler.bpmn"
+ })
+ public void happyPath() throws Exception {
+
+ logStart();
+
+ MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
+ MockGetVolumeGroupById("mdt1", "78987", "UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
+ MockGetVfModuleId("9e48f6ea-f786-46de-800a-d480e5ccc846", "6a1dc898-b590-47b9-bbf0-34424a7a2ec3/", "UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml", 200);
+ mockPutVNFVolumeGroup("78987", 202);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ String updaetVfModuleVolRequest =
+ FileUtil.readResourceFile("__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("requestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("serviceInstanceId", "test-service-instance-id");
+ testVariables.put("volumeGroupId", "78987");
+ testVariables.put("vnfId", "TEST-VNF-ID-0123");
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleVolumeInfraV1", "v1", businessKey, updaetVfModuleVolRequest, testVariables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectVNFRestCallbacks(callbacks, "volumeGroupUpdate");
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "UpdateVfModuleVolumeSuccessIndicator", true);
+
+ logEnd();
+ }
+
+ /**
+ * VF Module Personal model id does not match request model invariant id
+ * @throws Exception
+ */
+ @Test
+ //@Ignore
+ @Deployment(resources = {
+ "process/UpdateVfModuleVolumeInfraV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/GenericNotificationService.bpmn",
+ "subprocess/FalloutHandler.bpmn"
+ })
+ public void testPersonaModelIdNotMatch() throws Exception {
+
+ logStart();
+
+ MockGetVolumeGroupById("mdt1", "78987", "UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml");
+ MockGetGenericVnfById("/TEST-VNF-ID-0123", "CreateVfModuleVolumeInfraV1/GenericVnf.xml", 200);
+ MockGetVfModuleId("9e48f6ea-f786-46de-800a-d480e5ccc846", "6a1dc898-b590-47b9-bbf0-34424a7a2ec3/", "UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml", 200);
+ mockPutVNFVolumeGroup("78987", 202);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ String updaetVfModuleVolRequest =
+ FileUtil.readResourceFile("__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json");
+
+ Map<String, Object> testVariables = new HashMap<>();
+ testVariables.put("requestId", "TEST-REQUEST-ID-0123");
+ testVariables.put("serviceInstanceId", "test-service-instance-id");
+ testVariables.put("volumeGroupId", "78987");
+ testVariables.put("vnfId", "TEST-VNF-ID-0123");
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVfModuleVolumeInfraV1", "v1", businessKey, updaetVfModuleVolRequest, testVariables);
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectVNFRestCallbacks(callbacks, "volumeGroupUpdate");
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "UpdateVfModuleVolumeSuccessIndicator", true);
+
+ logEnd();
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java index b83040e60f..391fc2308b 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVnfInfraTest.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- */
+ */
package org.openecomp.mso.bpmn.infrastructure;
@@ -56,119 +56,119 @@ import org.openecomp.mso.bpmn.mock.FileUtil; * Unit test cases for UpdateVnfInfra.bpmn
*/
public class UpdateVnfInfraTest extends WorkflowTest {
-
- private final CallbackSet callbacks = new CallbackSet();
-
- public UpdateVnfInfraTest() throws IOException {
- callbacks.put("changeassign", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
- callbacks.put("activate", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
- callbacks.put("query", FileUtil.readResourceFile(
- "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
- callbacks.put("vnfUpdate", FileUtil.readResourceFile(
- "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
- }
-
- /**
- * Sunny day scenario.
- *
- * @throws Exception
- */
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- @Deployment(resources = {
- "process/UpdateVnfInfra.bpmn",
- "subprocess/DoUpdateVfModule.bpmn",
- "subprocess/DoUpdateVnfAndModules.bpmn",
- "subprocess/PrepareUpdateAAIVfModule.bpmn",
- "subprocess/ConfirmVolumeGroupTenant.bpmn",
- "subprocess/SDNCAdapterV1.bpmn",
- "subprocess/VnfAdapterRestV1.bpmn",
- "subprocess/UpdateAAIGenericVnf.bpmn",
- "subprocess/UpdateAAIVfModule.bpmn",
- "subprocess/CompleteMsoProcess.bpmn",
- "subprocess/FalloutHandler.bpmn",
- "subprocess/BuildingBlock/DecomposeService.bpmn",
- "subprocess/BuildingBlock/RainyDayHandler.bpmn",
- "subprocess/BuildingBlock/ManualHandling.bpmn"
-
- })
- public void sunnyDay() throws Exception {
-
- logStart();
-
- MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
- MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
- //MockGetGenericVnfById_404("testVnfId");
- MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "1.0", "VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json");
- MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
- MockPutGenericVnf(".*");
- MockAAIVfModule();
- MockPatchGenericVnf("skask");
- MockPatchVfModuleId("skask", ".*");
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockVNFPut("skask", "/supercool", 202);
- mockVNFPut("skask", "/lukewarm", 202);
- MockVNFAdapterRestVfModule();
- MockDBUpdateVfModule();
- MockGetPserverByVnfId("skask", "AAI/AAI_pserverByVnfId.json", 200);
- MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
- MockSetInMaintFlagByVnfId("skask", 200);
- MockPolicySkip();
-
- mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
- mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
-
- String businessKey = UUID.randomUUID().toString();
- String updaetVnfRequest =
- FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVnf_VID_request.json");
-
- Map<String, Object> variables = setupVariablesSunnyDayVID();
-
-
- TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVnfInfra",
- "v1", businessKey, updaetVnfRequest, variables);
-
- WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
-
- String responseBody = response.getResponse();
- System.out.println("Workflow (Synch) Response:\n" + responseBody);
-
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
- injectSDNCCallbacks(callbacks, "changeassign, query");
- injectVNFRestCallbacks(callbacks, "vnfUpdate");
- injectSDNCCallbacks(callbacks, "activate");
-
- // TODO add appropriate assertions
-
- waitForProcessEnd(businessKey, 10000);
- checkVariable(businessKey, "UpdateVfModuleInfraSuccessIndicator", true);
-
- logEnd();
- }
-
- // Active Scenario
- private Map<String, Object> setupVariablesSunnyDayVID() {
- Map<String, Object> variables = new HashMap<>();
- //try {
- // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
- //}
- //catch (Exception e) {
-
- //}
- //variables.put("mso-request-id", "testRequestId");
- variables.put("requestId", "testRequestId");
- variables.put("isDebugLogEnabled", "true");
- variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
- variables.put("vnfId", "skask");
- variables.put("vnfType", "vSAMP12");
- variables.put("serviceType", "MOG");
-
- return variables;
-
- }
-
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public UpdateVnfInfraTest() throws IOException {
+ callbacks.put("changeassign", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyChangeAssignCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile(
+ "__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("vnfUpdate", FileUtil.readResourceFile(
+ "__files/VfModularity/VNFAdapterRestUpdateCallback.xml"));
+ }
+
+ /**
+ * Sunny day scenario.
+ *
+ * @throws Exception
+ */
+ @Test
+ @Ignore // IGNORED FOR 1710 MERGE TO ONAP
+ @Deployment(resources = {
+ "process/UpdateVnfInfra.bpmn",
+ "subprocess/DoUpdateVfModule.bpmn",
+ "subprocess/DoUpdateVnfAndModules.bpmn",
+ "subprocess/PrepareUpdateAAIVfModule.bpmn",
+ "subprocess/ConfirmVolumeGroupTenant.bpmn",
+ "subprocess/SDNCAdapterV1.bpmn",
+ "subprocess/VnfAdapterRestV1.bpmn",
+ "subprocess/UpdateAAIGenericVnf.bpmn",
+ "subprocess/UpdateAAIVfModule.bpmn",
+ "subprocess/CompleteMsoProcess.bpmn",
+ "subprocess/FalloutHandler.bpmn",
+ "subprocess/BuildingBlock/DecomposeService.bpmn",
+ "subprocess/BuildingBlock/RainyDayHandler.bpmn",
+ "subprocess/BuildingBlock/ManualHandling.bpmn"
+
+ })
+ public void sunnyDay() throws Exception {
+
+ logStart();
+
+ MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlByIdVipr.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+ //MockGetGenericVnfById_404("testVnfId");
+ MockGetServiceResourcesCatalogData("995256d2-5a33-55df-13ab-12abad84e7ff", "1.0", "VIPR/getCatalogServiceResourcesDataForUpdateVnfInfra.json");
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf(".*");
+ MockAAIVfModule();
+ MockPatchGenericVnf("skask");
+ MockPatchVfModuleId("skask", ".*");
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ mockVNFPut("skask", "/supercool", 202);
+ mockVNFPut("skask", "/lukewarm", 202);
+ MockVNFAdapterRestVfModule();
+ MockDBUpdateVfModule();
+ MockGetPserverByVnfId("skask", "AAI/AAI_pserverByVnfId.json", 200);
+ MockGetGenericVnfsByVnfId("skask", "AAI/AAI_genericVnfsByVnfId.json", 200);
+ MockSetInMaintFlagByVnfId("skask", 200);
+ MockPolicySkip();
+
+ mockSDNCAdapter("VfModularity/StandardSDNCSynchResponse.xml");
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ String updaetVnfRequest =
+ FileUtil.readResourceFile("__files/InfrastructureFlows/UpdateVnf_VID_request.json");
+
+ Map<String, Object> variables = setupVariablesSunnyDayVID();
+
+
+ TestAsyncResponse asyncResponse = invokeAsyncProcess("UpdateVnfInfra",
+ "v1", businessKey, updaetVnfRequest, variables);
+
+ WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
+
+ String responseBody = response.getResponse();
+ System.out.println("Workflow (Synch) Response:\n" + responseBody);
+
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "changeassign, query");
+ injectVNFRestCallbacks(callbacks, "vnfUpdate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ // TODO add appropriate assertions
+
+ waitForProcessEnd(businessKey, 10000);
+ checkVariable(businessKey, "UpdateVfModuleInfraSuccessIndicator", true);
+
+ logEnd();
+ }
+
+ // Active Scenario
+ private Map<String, Object> setupVariablesSunnyDayVID() {
+ Map<String, Object> variables = new HashMap<>();
+ //try {
+ // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
+ //}
+ //catch (Exception e) {
+
+ //}
+ //variables.put("mso-request-id", "testRequestId");
+ variables.put("requestId", "testRequestId");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
+ variables.put("vnfId", "skask");
+ variables.put("vnfType", "vSAMP12");
+ variables.put("serviceType", "MOG");
+
+ return variables;
+
+ }
+
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java index 918311ba4b..e7b80f12ab 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/AbstractTestBase.java @@ -22,20 +22,20 @@ package org.openecomp.mso.bpmn.vcpe; import org.openecomp.mso.bpmn.common.WorkflowTest; public class AbstractTestBase extends WorkflowTest { + + + public static final String CUST = "SDN-ETHERNET-INTERNET"; + public static final String SVC = "123456789"; + public static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET"; + public static final String PARENT_INST = "MIS%252F1604%252F0027%252FSW_INTERNET"; + public static final String ARID = "arId-1"; + public static final String ARVERS = "1490627351232"; + public static final String DEC_INST = "MIS%2F1604%2F0026%2FSW_INTERNET"; + public static final String DEC_PARENT_INST = "MIS%2F1604%2F0027%2FSW_INTERNET"; - public static final String CUST = "SDN-ETHERNET-INTERNET"; - public static final String SVC = "123456789"; - public static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET"; - public static final String PARENT_INST = "MIS%252F1604%252F0027%252FSW_INTERNET"; - public static final String ARID = "arId-1"; - public static final String ARVERS = "1490627351232"; - - public static final String DEC_INST = "MIS%2F1604%2F0026%2FSW_INTERNET"; - public static final String DEC_PARENT_INST = "MIS%2F1604%2F0027%2FSW_INTERNET"; - - public static final String VAR_SUCCESS_IND = "SuccessIndicator"; - public static final String VAR_WFEX = "SavedWorkflowException1"; - public static final String VAR_RESP_CODE = "CMSO_ResponseCode"; - public static final String VAR_COMP_REQ = "CompleteMsoProcessRequest"; + public static final String VAR_SUCCESS_IND = "SuccessIndicator"; + public static final String VAR_WFEX = "SavedWorkflowException1"; + public static final String VAR_RESP_CODE = "CMSO_ResponseCode"; + public static final String VAR_COMP_REQ = "CompleteMsoProcessRequest"; } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java index 10809bef11..1b3bfa8c76 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/CreateVcpeResCustServiceTest.java @@ -46,332 +46,332 @@ import org.openecomp.mso.bpmn.mock.FileUtil; public class CreateVcpeResCustServiceTest extends AbstractTestBase { - private static final String PROCNAME = "CreateVcpeResCustService"; - private static final String Prefix = "CVRCS_"; - - private final CallbackSet callbacks = new CallbackSet(); - private final String request; - - public CreateVcpeResCustServiceTest() throws IOException { - callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml")); - callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("queryTXC", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml")); - callbacks.put("queryBRG", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml")); - callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); - callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); - callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); - - request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSIName.json"); - } - - @Test - @Deployment(resources = { - "process/CreateVcpeResCustService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericPutService.bpmn", - "subprocess/BuildingBlock/DecomposeService.bpmn", + private static final String PROCNAME = "CreateVcpeResCustService"; + private static final String Prefix = "CVRCS_"; + + private final CallbackSet callbacks = new CallbackSet(); + private final String request; + + public CreateVcpeResCustServiceTest() throws IOException { + callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml")); + callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml")); + callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml")); + callbacks.put("queryTXC", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml")); + callbacks.put("queryBRG", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml")); + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); + + request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSIName.json"); + } + + @Test + @Deployment(resources = { + "process/CreateVcpeResCustService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/GenericPutService.bpmn", + "subprocess/BuildingBlock/DecomposeService.bpmn", "subprocess/DoCreateServiceInstance.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", + "subprocess/DoCreateAllottedResourceTXC.bpmn", + "subprocess/DoCreateAllottedResourceBRG.bpmn", "subprocess/CompleteMsoProcess.bpmn", // stubs - "VCPE/stubprocess/Homing.bpmn", + "VCPE/stubprocess/Homing.bpmn", "VCPE/stubprocess/DoCreateVnfAndModules.bpmn"}) - - public void testCreateVcpeResCustService_Success() throws Exception { - - System.out.println("starting: testCreateVcpeResCustService_Success\n"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); - - // TODO: the SI should NOT have to be URL-encoded yet again! - MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map<String, Object> variables = setupVariables(); - - String businessKey = UUID.randomUUID().toString(); - invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); - - // for SI - injectSDNCCallbacks(callbacks, "assign"); - - // for TXC - injectSDNCCallbacks(callbacks, "assign"); - injectSDNCCallbacks(callbacks, "create"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "queryTXC"); - - // for BRG - injectSDNCCallbacks(callbacks, "assign"); - injectSDNCCallbacks(callbacks, "create"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "queryBRG"); - - waitForProcessEnd(businessKey, 10000); - - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - - String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + VAR_COMP_REQ); - System.out.println("completionReq:\n" + completionReq); - - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME + VAR_SUCCESS_IND)); - assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); - assertEquals(null, workflowException); - assertTrue(completionReq.contains("request-id>testRequestId<")); - assertTrue(completionReq.contains("action>CREATE<")); - assertTrue(completionReq.contains("source>VID<")); - - assertEquals("1", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + "VnfsCreatedCount")); - } - - @Test - @Deployment(resources = { - "process/CreateVcpeResCustService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericPutService.bpmn", - "subprocess/BuildingBlock/DecomposeService.bpmn", + + public void testCreateVcpeResCustService_Success() throws Exception { + + System.out.println("starting: testCreateVcpeResCustService_Success\n"); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); + + // TODO: the SI should NOT have to be URL-encoded yet again! + MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + + MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map<String, Object> variables = setupVariables(); + + String businessKey = UUID.randomUUID().toString(); + invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); + + // for SI + injectSDNCCallbacks(callbacks, "assign"); + + // for TXC + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "create"); + injectSDNCCallbacks(callbacks, "activate"); + injectSDNCCallbacks(callbacks, "queryTXC"); + + // for BRG + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "create"); + injectSDNCCallbacks(callbacks, "activate"); + injectSDNCCallbacks(callbacks, "queryBRG"); + + waitForProcessEnd(businessKey, 10000); + + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + + String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ); + System.out.println("completionReq:\n" + completionReq); + + assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); + assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); + assertEquals(null, workflowException); + assertTrue(completionReq.contains("request-id>testRequestId<")); + assertTrue(completionReq.contains("action>CREATE<")); + assertTrue(completionReq.contains("source>VID<")); + + assertEquals("1", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"VnfsCreatedCount")); + } + + @Test + @Deployment(resources = { + "process/CreateVcpeResCustService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/GenericPutService.bpmn", + "subprocess/BuildingBlock/DecomposeService.bpmn", "subprocess/DoCreateServiceInstance.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", + "subprocess/DoCreateAllottedResourceTXC.bpmn", + "subprocess/DoCreateAllottedResourceBRG.bpmn", "subprocess/CompleteMsoProcess.bpmn", // stubs - "VCPE/stubprocess/Homing.bpmn", + "VCPE/stubprocess/Homing.bpmn", "VCPE/stubprocess/DoCreateVnfAndModules.bpmn"}) - - public void testCreateVcpeResCustService_NoParts() throws Exception { - - System.out.println("starting: testCreateVcpeResCustService_NoParts\n"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json"); - MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); - - // TODO: the SI should NOT have to be URL-encoded yet again! - MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - - // TODO: should these really be PARENT_INST, or should they be INST? - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map<String, Object> variables = setupVariables(); - - String businessKey = UUID.randomUUID().toString(); - invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); - - // for SI - injectSDNCCallbacks(callbacks, "assign"); - - waitForProcessEnd(businessKey, 10000); - - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - - String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + VAR_COMP_REQ); - System.out.println("completionReq:\n" + completionReq); - - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME + VAR_SUCCESS_IND)); - assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); - assertEquals(null, workflowException); - assertTrue(completionReq.contains("request-id>testRequestId<")); - assertTrue(completionReq.contains("action>CREATE<")); - assertTrue(completionReq.contains("source>VID<")); - - assertEquals("0", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + "VnfsCreatedCount")); - } - - @Test - @Deployment(resources = { - "process/CreateVcpeResCustService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericPutService.bpmn", - "subprocess/BuildingBlock/DecomposeService.bpmn", + + public void testCreateVcpeResCustService_NoParts() throws Exception { + + System.out.println("starting: testCreateVcpeResCustService_NoParts\n" ); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json"); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json"); + MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); + + // TODO: the SI should NOT have to be URL-encoded yet again! + MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + + MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + + // TODO: should these really be PARENT_INST, or should they be INST? + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map<String, Object> variables = setupVariables(); + + String businessKey = UUID.randomUUID().toString(); + invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); + + // for SI + injectSDNCCallbacks(callbacks, "assign"); + + waitForProcessEnd(businessKey, 10000); + + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + + String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ); + System.out.println("completionReq:\n" + completionReq); + + assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); + assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); + assertEquals(null, workflowException); + assertTrue(completionReq.contains("request-id>testRequestId<")); + assertTrue(completionReq.contains("action>CREATE<")); + assertTrue(completionReq.contains("source>VID<")); + + assertEquals("0", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"VnfsCreatedCount")); + } + + @Test + @Deployment(resources = { + "process/CreateVcpeResCustService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/GenericPutService.bpmn", + "subprocess/BuildingBlock/DecomposeService.bpmn", "subprocess/DoCreateServiceInstance.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", + "subprocess/DoCreateAllottedResourceBRG.bpmn", "subprocess/CompleteMsoProcess.bpmn", // this stub will trigger a fault - "VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn", + "VCPE/stubprocess/DoCreateAllottedResourceTXC.bpmn", // stubs - "VCPE/stubprocess/Homing.bpmn", + "VCPE/stubprocess/Homing.bpmn", "VCPE/stubprocess/DoCreateVnfAndModules.bpmn"}) - - public void testCreateVcpeResCustService_Fault_NoRollback() throws Exception { - - System.out.println("starting: testCreateVcpeResCustService_Fault_NoRollback\n"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); - - // TODO: the SI should NOT have to be URL-encoded yet again! - MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map<String, Object> variables = setupVariables(); - - String req = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json"); - - String businessKey = UUID.randomUUID().toString(); - invokeAsyncProcess(PROCNAME, "v1", businessKey, req, variables); - - // for SI - injectSDNCCallbacks(callbacks, "assign"); - - waitForProcessEnd(businessKey, 10000); - - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - - String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + VAR_COMP_REQ); - System.out.println("completionReq:\n" + completionReq); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME + VAR_SUCCESS_IND)); - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); - assertNotNull(workflowException); - - BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateAllottedResourceBRGRollback"); - BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateVnfAndModulesRollback"); - BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateAllottedResourceTXCRollback"); - } - - @Test - @Deployment(resources = { - "process/CreateVcpeResCustService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericPutService.bpmn", - "subprocess/BuildingBlock/DecomposeService.bpmn", + + public void testCreateVcpeResCustService_Fault_NoRollback() throws Exception { + + System.out.println("starting: testCreateVcpeResCustService_Fault_NoRollback\n"); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); + + // TODO: the SI should NOT have to be URL-encoded yet again! + MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + + MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map<String, Object> variables = setupVariables(); + + String req = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json"); + + String businessKey = UUID.randomUUID().toString(); + invokeAsyncProcess(PROCNAME, "v1", businessKey, req, variables); + + // for SI + injectSDNCCallbacks(callbacks, "assign"); + + waitForProcessEnd(businessKey, 10000); + + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + + String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ); + System.out.println("completionReq:\n" + completionReq); + + assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); + assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); + assertNotNull(workflowException); + + BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateAllottedResourceBRGRollback"); + BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateVnfAndModulesRollback"); + BPMNUtil.assertNoProcessInstance(processEngineRule, "DoCreateAllottedResourceTXCRollback"); + } + + @Test + @Deployment(resources = { + "process/CreateVcpeResCustService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/GenericPutService.bpmn", + "subprocess/BuildingBlock/DecomposeService.bpmn", "subprocess/DoCreateServiceInstance.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn", + "subprocess/DoCreateAllottedResourceTXC.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn", "subprocess/CompleteMsoProcess.bpmn", // this stub will trigger a fault - "VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn", + "VCPE/stubprocess/DoCreateAllottedResourceBRG.bpmn", // stubs - "VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn", - "VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn", + "VCPE/stubprocess/DoCreateAllottedResourceBRGRollback.bpmn", + "VCPE/stubprocess/DoCreateVnfAndModulesRollback.bpmn", "VCPE/stubprocess/DoCreateServiceInstanceRollback.bpmn", - "VCPE/stubprocess/Homing.bpmn", + "VCPE/stubprocess/Homing.bpmn", "VCPE/stubprocess/DoCreateVnfAndModules.bpmn"}) - - public void testCreateVcpeResCustService_Fault_Rollback() throws Exception { - - System.out.println("starting: testCreateVcpeResCustService_Fault_Rollback\n"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); - MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); - - // TODO: the SI should NOT have to be URL-encoded yet again! - MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); - - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml"); - MockGetAllottedResource(CUST, SVC, PARENT_INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockDeleteAllottedResource(CUST, SVC, PARENT_INST, ARID, ARVERS); - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map<String, Object> variables = setupVariables(); - - String businessKey = UUID.randomUUID().toString(); - invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); - - // for SI - injectSDNCCallbacks(callbacks, "assign"); - - // for TXC - injectSDNCCallbacks(callbacks, "assign"); - injectSDNCCallbacks(callbacks, "create"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "queryTXC"); - - // BRG is a stub so don't need SDNC callbacks - - // for TXC rollback - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - - String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + VAR_COMP_REQ); - System.out.println("completionReq:\n" + completionReq); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME + VAR_SUCCESS_IND)); - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); - assertEquals(null, completionReq); - assertNotNull(workflowException); - - BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateAllottedResourceBRGRollback"); - BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateVnfAndModulesRollback"); - BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateAllottedResourceTXCRollback"); - } - - // ***************** - // Utility Section - // ***************** - - // Success Scenario - private Map<String, Object> setupVariables() { - Map<String, Object> variables = new HashMap<>(); - variables.put("requestId", "testRequestId"); - variables.put("request-id", "testRequestId"); - variables.put("serviceInstanceId", DEC_INST); - variables.put("allottedResourceId", ARID); - return variables; - - } + + public void testCreateVcpeResCustService_Fault_Rollback() throws Exception { + + System.out.println("starting: testCreateVcpeResCustService_Fault_Rollback\n"); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json"); + MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml"); + + // TODO: the SI should NOT have to be URL-encoded yet again! + MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml"); + + MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml"); + MockGetAllottedResource(CUST, SVC, PARENT_INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockDeleteAllottedResource(CUST, SVC, PARENT_INST, ARID, ARVERS); + + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map<String, Object> variables = setupVariables(); + + String businessKey = UUID.randomUUID().toString(); + invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); + + // for SI + injectSDNCCallbacks(callbacks, "assign"); + + // for TXC + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "create"); + injectSDNCCallbacks(callbacks, "activate"); + injectSDNCCallbacks(callbacks, "queryTXC"); + + // BRG is a stub so don't need SDNC callbacks + + // for TXC rollback + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForProcessEnd(businessKey, 10000); + + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + + String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ); + System.out.println("completionReq:\n" + completionReq); + + assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); + assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); + assertEquals(null, completionReq); + assertNotNull(workflowException); + + BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateAllottedResourceBRGRollback"); + BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateVnfAndModulesRollback"); + BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoCreateAllottedResourceTXCRollback"); + } + + // ***************** + // Utility Section + // ***************** + + // Success Scenario + private Map<String, Object> setupVariables() { + Map<String, Object> variables = new HashMap<>(); + variables.put("requestId", "testRequestId"); + variables.put("request-id", "testRequestId"); + variables.put("serviceInstanceId", DEC_INST); + variables.put("allottedResourceId", ARID); + return variables; + + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java index c8edc82a23..d026b7a949 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DeleteVcpeResCustServiceTest.java @@ -50,248 +50,248 @@ import com.github.tomakehurst.wiremock.stubbing.Scenario; public class DeleteVcpeResCustServiceTest extends AbstractTestBase { - private static final String PROCNAME = "DeleteVcpeResCustService"; - private static final String Prefix = "DVRCS_"; - private static final String AR_BRG_ID = "ar-brgB"; - private static final String AR_TXC_ID = "ar-txcA"; - - private final CallbackSet callbacks = new CallbackSet(); - private final String request; - - public DeleteVcpeResCustServiceTest() throws IOException { - callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); - callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); - callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); - - request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json"); - } - - @Test - @Deployment(resources = { - "process/DeleteVcpeResCustService.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericDeleteService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", + private static final String PROCNAME = "DeleteVcpeResCustService"; + private static final String Prefix = "DVRCS_"; + private static final String AR_BRG_ID = "ar-brgB"; + private static final String AR_TXC_ID = "ar-txcA"; + + private final CallbackSet callbacks = new CallbackSet(); + private final String request; + + public DeleteVcpeResCustServiceTest() throws IOException { + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); + + request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json"); + } + + @Test + @Deployment(resources = { + "process/DeleteVcpeResCustService.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/GenericDeleteService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", "subprocess/DoDeleteServiceInstance.bpmn", - "subprocess/DoDeleteAllottedResourceBRG.bpmn", - "subprocess/DoDeleteAllottedResourceTXC.bpmn", + "subprocess/DoDeleteAllottedResourceBRG.bpmn", + "subprocess/DoDeleteAllottedResourceTXC.bpmn", "subprocess/CompleteMsoProcess.bpmn", // stubs "VCPE/stubprocess/DoDeleteVnfAndModules.bpmn"}) + + public void testDeleteVcpeResCustService_Success() throws Exception { - public void testDeleteVcpeResCustService_Success() throws Exception { - - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - // TODO: use INST instead of DEC_INST - /* + // TODO: use INST instead of DEC_INST + /* * Seems to be a bug in GenericDeleteService (or its subflows) as they * fail to URL-encode the SI id before performing the query so we'll * add a stub for that case, too. */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); /* * cannot use MockGetServiceInstance(), because we need to return * different responses as we traverse through the flow - */ - - // initially, the SI includes the ARs - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)) - .inScenario("SI retrieval") - .whenScenarioStateIs(Scenario.STARTED) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VCPE/DeleteVcpeResCustService/getSI.xml")) - .willSetStateTo("ARs Deleted")); - - // once the ARs have been deleted, the SI should be empty - stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)) - .inScenario("SI retrieval") - .whenScenarioStateIs("ARs Deleted") - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"))); - - // for BRG - MockQueryAllottedResourceById(AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/arGetBRGById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, AR_BRG_ID); - MockDeleteAllottedResource(CUST, SVC, INST, AR_BRG_ID, ARVERS); - - // for TXC - MockQueryAllottedResourceById(AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/arGetTXCById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, AR_TXC_ID); - MockDeleteAllottedResource(CUST, SVC, INST, AR_TXC_ID, ARVERS); - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map<String, Object> variables = setupVariables(); - - String businessKey = UUID.randomUUID().toString(); - invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); - - // for BRG - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - // for TXC - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - // for SI - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - - waitForProcessEnd(businessKey, 10000); - - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - - String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + VAR_COMP_REQ); - System.out.println("completionReq:\n" + completionReq); - - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME + VAR_SUCCESS_IND)); - assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); - assertEquals(null, workflowException); - assertTrue(completionReq.contains("<request-id>testRequestId<")); - assertTrue(completionReq.contains("<action>DELETE<")); - assertTrue(completionReq.contains("<source>VID<")); + */ + + // initially, the SI includes the ARs + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)) + .inScenario("SI retrieval") + .whenScenarioStateIs(Scenario.STARTED) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VCPE/DeleteVcpeResCustService/getSI.xml")) + .willSetStateTo("ARs Deleted")); + + // once the ARs have been deleted, the SI should be empty + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST)) + .inScenario("SI retrieval") + .whenScenarioStateIs("ARs Deleted") + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"))); + + // for BRG + MockQueryAllottedResourceById(AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/arGetBRGById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, AR_BRG_ID); + MockDeleteAllottedResource(CUST, SVC, INST, AR_BRG_ID, ARVERS); + + // for TXC + MockQueryAllottedResourceById(AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/arGetTXCById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, AR_TXC_ID); + MockDeleteAllottedResource(CUST, SVC, INST, AR_TXC_ID, ARVERS); + + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map<String, Object> variables = setupVariables(); - assertEquals("2", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + "vnfsDeletedCount")); + String businessKey = UUID.randomUUID().toString(); + invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); + + // for BRG + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + // for TXC + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + // for SI + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + + waitForProcessEnd(businessKey, 10000); - BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoDeleteVnfAndModules"); - } + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); - @Test - @Deployment(resources = { - "process/DeleteVcpeResCustService.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericDeleteService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", + String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ); + System.out.println("completionReq:\n" + completionReq); + + assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); + assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); + assertEquals(null, workflowException); + assertTrue(completionReq.contains("<request-id>testRequestId<")); + assertTrue(completionReq.contains("<action>DELETE<")); + assertTrue(completionReq.contains("<source>VID<")); + + assertEquals("2", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"vnfsDeletedCount")); + + BPMNUtil.assertAnyProcessInstanceFinished(processEngineRule, "DoDeleteVnfAndModules"); + } + + @Test + @Deployment(resources = { + "process/DeleteVcpeResCustService.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/GenericDeleteService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", "subprocess/DoDeleteServiceInstance.bpmn", - "subprocess/DoDeleteAllottedResourceBRG.bpmn", - "subprocess/DoDeleteAllottedResourceTXC.bpmn", + "subprocess/DoDeleteAllottedResourceBRG.bpmn", + "subprocess/DoDeleteAllottedResourceTXC.bpmn", "subprocess/CompleteMsoProcess.bpmn", // stubs "VCPE/stubprocess/DoDeleteVnfAndModules.bpmn"}) + + public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception { - public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception { - - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - // TODO: use INST instead of DEC_INST + // TODO: use INST instead of DEC_INST /* * Seems to be a bug in GenericDeleteService (or its subflows) as they * fail to URL-encode the SI id before performing the query so we'll * add a stub for that case, too. */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"); - - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map<String, Object> variables = setupVariables(); - - String businessKey = UUID.randomUUID().toString(); - invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); - - // for SI - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - - waitForProcessEnd(businessKey, 10000); - - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - - String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + VAR_COMP_REQ); - System.out.println("completionReq:\n" + completionReq); - - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME + VAR_SUCCESS_IND)); - assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); - assertEquals(null, workflowException); - assertTrue(completionReq.contains("<request-id>testRequestId<")); - assertTrue(completionReq.contains("<action>DELETE<")); - assertTrue(completionReq.contains("<source>VID<")); + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"); + + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map<String, Object> variables = setupVariables(); - assertEquals("0", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + "vnfsDeletedCount")); + String businessKey = UUID.randomUUID().toString(); + invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); + + // for SI + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + + waitForProcessEnd(businessKey, 10000); - BPMNUtil.assertNoProcessInstance(processEngineRule, "DoDeleteVnfAndModules"); - } + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); - @Test - @Deployment(resources = { - "process/DeleteVcpeResCustService.bpmn", - "subprocess/GenericGetService.bpmn", - "subprocess/GenericDeleteService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", + String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ); + System.out.println("completionReq:\n" + completionReq); + + assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); + assertEquals("200", BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); + assertEquals(null, workflowException); + assertTrue(completionReq.contains("<request-id>testRequestId<")); + assertTrue(completionReq.contains("<action>DELETE<")); + assertTrue(completionReq.contains("<source>VID<")); + + assertEquals("0", BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+"vnfsDeletedCount")); + + BPMNUtil.assertNoProcessInstance(processEngineRule, "DoDeleteVnfAndModules"); + } + + @Test + @Deployment(resources = { + "process/DeleteVcpeResCustService.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/GenericDeleteService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", "subprocess/DoDeleteServiceInstance.bpmn", - "subprocess/DoDeleteAllottedResourceBRG.bpmn", - "subprocess/DoDeleteAllottedResourceTXC.bpmn", + "subprocess/DoDeleteAllottedResourceBRG.bpmn", + "subprocess/DoDeleteAllottedResourceTXC.bpmn", "subprocess/CompleteMsoProcess.bpmn", // stubs "VCPE/stubprocess/DoDeleteVnfAndModules.bpmn"}) + + public void testDeleteVcpeResCustService_Fault() throws Exception { - public void testDeleteVcpeResCustService_Fault() throws Exception { + MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml"); - - // TODO: use INST instead of DEC_INST + // TODO: use INST instead of DEC_INST /* * Seems to be a bug in GenericDeleteService (or its subflows) as they * fail to URL-encode the SI id before performing the query so we'll * add a stub for that case, too. */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"); - - // generate failure - mockSDNCAdapter(404); - - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - Map<String, Object> variables = setupVariables(); - - String businessKey = UUID.randomUUID().toString(); - invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); - - waitForProcessEnd(businessKey, 10000); - - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - - String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix + VAR_COMP_REQ); - System.out.println("completionReq:\n" + completionReq); + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml"); + + // generate failure + mockSDNCAdapter(404); + + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + Map<String, Object> variables = setupVariables(); - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME + VAR_SUCCESS_IND)); - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); - assertNotNull(workflowException); - } + String businessKey = UUID.randomUUID().toString(); + invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables); + + waitForProcessEnd(businessKey, 10000); - private Map<String, Object> setupVariables() throws UnsupportedEncodingException { - Map<String, Object> variables = new HashMap<>(); - variables.put("isDebugLogEnabled", "true"); - variables.put("requestId", "testRequestId"); - variables.put("serviceInstanceId", DEC_INST); - variables.put("sdncVersion", "1802"); - variables.put("serviceInstanceName", "some-junk-name"); - return variables; - } + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + String completionReq = BPMNUtil.getVariable(processEngineRule, PROCNAME, Prefix+VAR_COMP_REQ); + System.out.println("completionReq:\n" + completionReq); + + assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, PROCNAME+VAR_SUCCESS_IND)); + assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_RESP_CODE)); + assertNotNull(workflowException); + } + + private Map<String, Object> setupVariables() throws UnsupportedEncodingException { + Map<String, Object> variables = new HashMap<>(); + variables.put("isDebugLogEnabled", "true"); + variables.put("requestId", "testRequestId"); + variables.put("serviceInstanceId", DEC_INST); + variables.put("sdncVersion", "1802"); + variables.put("serviceInstanceName", "some-junk-name"); + return variables; + } + } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java index d467bbdb2a..0407e172e2 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackTest.java @@ -43,303 +43,303 @@ import org.openecomp.mso.bpmn.mock.FileUtil; public class DoCreateAllottedResourceBRGRollbackTest extends AbstractTestBase { - private static final String PROCNAME = "DoCreateAllottedResourceBRGRollback"; - private static final String RbType = "DCARBRG_"; - private final CallbackSet callbacks = new CallbackSet(); - - public DoCreateAllottedResourceBRGRollbackTest() throws IOException { - callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); - callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); - callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_Success() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_skipRollback() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackAAI", "false"); - rollbackData.put(RbType, "rollbackSDNCassign", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_DoNotRollBack() throws Exception { - - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - // this will cause "rollbackSDNC" to be set to false - rollbackData.put(RbType, "rollbackSDNCassign", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_NoDeactivate() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackSDNCactivate", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_NoDelete() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackSDNCcreate", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_NoUnassign() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackSDNCassign", "false"); - + private static final String PROCNAME = "DoCreateAllottedResourceBRGRollback"; + private static final String RbType = "DCARBRG_"; + private final CallbackSet callbacks = new CallbackSet(); + + public DoCreateAllottedResourceBRGRollbackTest() throws IOException { + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) + public void testDoCreateAllottedResourceBRGRollback_Success() throws Exception { + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) + public void testDoCreateAllottedResourceBRGRollback_skipRollback() throws Exception { + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); + + rollbackData.put(RbType, "rollbackAAI", "false"); + rollbackData.put(RbType, "rollbackSDNCassign", "false"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) + public void testDoCreateAllottedResourceBRGRollback_DoNotRollBack() throws Exception { + + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); + + // this will cause "rollbackSDNC" to be set to false + rollbackData.put(RbType, "rollbackSDNCassign", "false"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) + public void testDoCreateAllottedResourceBRGRollback_NoDeactivate() throws Exception { + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); + + rollbackData.put(RbType, "rollbackSDNCactivate", "false"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) + public void testDoCreateAllottedResourceBRGRollback_NoDelete() throws Exception { + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); + + rollbackData.put(RbType, "rollbackSDNCcreate", "false"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) + public void testDoCreateAllottedResourceBRGRollback_NoUnassign() throws Exception { + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); + + rollbackData.put(RbType, "rollbackSDNCassign", "false"); + /* * Note: if assign == false then the flow/script will set * "skipRollback" to false, which will cause ALL of the SDNC steps * to be skipped, not just the unassign step. */ - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_SubProcessError() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - mockSDNCAdapter(404); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRGRollback_JavaException() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - variables.put("rollbackData", "string instead of rollback data"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("failNotFound", "true"); - variables.put("msoRequestId", requestId); - variables.put("mso-request-id", "requestId"); - variables.put("allottedResourceId", ARID); - - variables.put("serviceInstanceId", DEC_INST); - variables.put("parentServiceInstanceId", DEC_PARENT_INST); - - RollbackData rollbackData = new RollbackData(); - - rollbackData.put(RbType, "serviceInstanceId", DEC_INST); - rollbackData.put(RbType, "serviceSubscriptionType", SVC); - rollbackData.put(RbType, "disablerollback", "false"); - rollbackData.put(RbType, "rollbackAAI", "true"); - rollbackData.put(RbType, "rollbackSDNCassign", "true"); - rollbackData.put(RbType, "rollbackSDNCactivate", "true"); - rollbackData.put(RbType, "rollbackSDNCcreate", "true"); - rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID); - - rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml")); - rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml")); - rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml")); - - variables.put("rollbackData", rollbackData); - - return rollbackData; - } + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) + public void testDoCreateAllottedResourceBRGRollback_SubProcessError() throws Exception { + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + mockSDNCAdapter(404); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) + public void testDoCreateAllottedResourceBRGRollback_JavaException() throws Exception { + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + variables.put("rollbackData", "string instead of rollback data"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("failNotFound", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("allottedResourceId", ARID); + + variables.put("serviceInstanceId", DEC_INST); + variables.put("parentServiceInstanceId", DEC_PARENT_INST); + + RollbackData rollbackData = new RollbackData(); + + rollbackData.put(RbType, "serviceInstanceId", DEC_INST); + rollbackData.put(RbType, "serviceSubscriptionType", SVC); + rollbackData.put(RbType, "disablerollback", "false"); + rollbackData.put(RbType, "rollbackAAI", "true"); + rollbackData.put(RbType, "rollbackSDNCassign", "true"); + rollbackData.put(RbType, "rollbackSDNCactivate", "true"); + rollbackData.put(RbType, "rollbackSDNCcreate", "true"); + rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID); + + rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml")); + rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml")); + rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml")); + + variables.put("rollbackData",rollbackData); + + return rollbackData; + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java index 7b858c464e..0373266ce1 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceBRGTest.java @@ -43,254 +43,254 @@ import org.openecomp.mso.bpmn.mock.FileUtil; public class DoCreateAllottedResourceBRGTest extends AbstractTestBase { - private static final String PROCNAME = "DoCreateAllottedResourceBRG"; - private final CallbackSet callbacks = new CallbackSet(); - - public DoCreateAllottedResourceBRGTest() throws IOException { - callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml")); - callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRG_Success() throws Exception { - - // TODO: use INST instead of DEC_INST - /* + private static final String PROCNAME = "DoCreateAllottedResourceBRG"; + private final CallbackSet callbacks = new CallbackSet(); + + public DoCreateAllottedResourceBRGTest() throws IOException { + callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml")); + callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml")); + callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml")); + callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml")); + } + + @Test + @Deployment(resources = { + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceBRG.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) + public void testDoCreateAllottedResourceBRG_Success() throws Exception{ + + // TODO: use INST instead of DEC_INST + /* * should be INST instead of DEC_INST, but AAI utilities appear to * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "assign"); - injectSDNCCallbacks(callbacks, "create"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "query"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertEquals(null, workflowException); - - assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRG_NoSI() throws Exception { - - // TODO: use INST instead of DEC_INST + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "create"); + injectSDNCCallbacks(callbacks, "activate"); + injectSDNCCallbacks(callbacks, "query"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + assertEquals(null, workflowException); + + assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); + } + + @Test + @Deployment(resources = { + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceBRG.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) + public void testDoCreateAllottedResourceBRG_NoSI() throws Exception{ + + // TODO: use INST instead of DEC_INST /* * should be INST instead of DEC_INST, but AAI utilities appear to * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertNotNull(workflowException); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRG_ActiveAr() throws Exception { - - // TODO: use INST instead of DEC_INST + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + assertNotNull(workflowException); + + assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); + } + + @Test + @Deployment(resources = { + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceBRG.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) + public void testDoCreateAllottedResourceBRG_ActiveAr() throws Exception{ + + // TODO: use INST instead of DEC_INST /* * should be INST instead of DEC_INST, but AAI utilities appear to * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - variables.put("failExists", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "query"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertEquals(null, workflowException); - - assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRG_NoParentSI() throws Exception { - - // TODO: use INST instead of DEC_INST + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + variables.put("failExists", "false"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "query"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + assertEquals(null, workflowException); + + assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); + } + + @Test + @Deployment(resources = { + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceBRG.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) + public void testDoCreateAllottedResourceBRG_NoParentSI() throws Exception{ + + // TODO: use INST instead of DEC_INST /* * should be INST instead of DEC_INST, but AAI utilities appear to * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertNotNull(workflowException); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceBRG.bpmn", - "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) - public void testDoCreateAllottedResourceBRG_SubProcessError() throws Exception { - - // TODO: use INST instead of DEC_INST + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + assertNotNull(workflowException); + + assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); + } + + @Test + @Deployment(resources = { + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceBRG.bpmn", + "subprocess/DoCreateAllottedResourceBRGRollback.bpmn"}) + public void testDoCreateAllottedResourceBRG_SubProcessError() throws Exception{ + + // TODO: use INST instead of DEC_INST /* * should be INST instead of DEC_INST, but AAI utilities appear to * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(404); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertNotNull(workflowException); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - private void setVariablesSuccess(Map<String, Object> variables, String requestId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("failExists", "true"); - variables.put("disableRollback", "true"); - variables.put("msoRequestId", requestId); - variables.put("mso-request-id", "requestId"); - variables.put("sourceNetworkId", "snId"); - variables.put("sourceNetworkRole", "snRole"); - variables.put("allottedResourceRole", "txc"); - variables.put("allottedResourceType", "BRG"); - variables.put("allottedResourceId", ARID); - variables.put("vni", "BRG"); - variables.put("vgmuxBearerIP", "bearerip"); - variables.put("brgWanMacAddress", "wanmac"); - - variables.put("serviceInstanceId", DEC_INST); - variables.put("parentServiceInstanceId", DEC_PARENT_INST); - - variables.put("serviceChainServiceInstanceId", "scsiId"); - - String arModelInfo = "{ " + "\"modelType\": \"allotted-resource\"," + - "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"vSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + - "}"; - variables.put("allottedResourceModelInfo", arModelInfo); - } + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(404); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + assertNotNull(workflowException); + + assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); + } + + private void setVariablesSuccess(Map<String, Object> variables, String requestId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("failExists", "true"); + variables.put("disableRollback", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("sourceNetworkId", "snId"); + variables.put("sourceNetworkRole", "snRole"); + variables.put("allottedResourceRole", "txc"); + variables.put("allottedResourceType", "BRG"); + variables.put("allottedResourceId", ARID); + variables.put("vni", "BRG"); + variables.put("vgmuxBearerIP", "bearerip"); + variables.put("brgWanMacAddress", "wanmac"); + + variables.put("serviceInstanceId", DEC_INST); + variables.put("parentServiceInstanceId", DEC_PARENT_INST); + + variables.put("serviceChainServiceInstanceId", "scsiId"); + + String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," + + "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + + "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + + "\"modelName\": \"vSAMP12\"," + + "\"modelVersion\": \"1.0\"," + + "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + + "}"; + variables.put("allottedResourceModelInfo", arModelInfo); + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java index b8b0130159..cdce56ee63 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackTest.java @@ -43,303 +43,303 @@ import org.openecomp.mso.bpmn.mock.FileUtil; public class DoCreateAllottedResourceTXCRollbackTest extends AbstractTestBase { - private static final String PROCNAME = "DoCreateAllottedResourceTXCRollback"; - private static final String RbType = "DCARTXC_"; - private final CallbackSet callbacks = new CallbackSet(); - - public DoCreateAllottedResourceTXCRollbackTest() throws IOException { - callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); - callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); - callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_Success() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_skipRollback() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackAAI", "false"); - rollbackData.put(RbType, "rollbackSDNCassign", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_DoNotRollBack() throws Exception { - - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - // this will cause "rollbackSDNC" to be set to false - rollbackData.put(RbType, "rollbackSDNCassign", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_NoDeactivate() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackSDNCactivate", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_NoDelete() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackSDNCcreate", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_NoUnassign() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); - - rollbackData.put(RbType, "rollbackSDNCassign", "false"); - + private static final String PROCNAME = "DoCreateAllottedResourceTXCRollback"; + private static final String RbType = "DCARTXC_"; + private final CallbackSet callbacks = new CallbackSet(); + + public DoCreateAllottedResourceTXCRollbackTest() throws IOException { + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) + public void testDoCreateAllottedResourceTXCRollback_Success() throws Exception { + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) + public void testDoCreateAllottedResourceTXCRollback_skipRollback() throws Exception { + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); + + rollbackData.put(RbType, "rollbackAAI", "false"); + rollbackData.put(RbType, "rollbackSDNCassign", "false"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) + public void testDoCreateAllottedResourceTXCRollback_DoNotRollBack() throws Exception { + + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); + + // this will cause "rollbackSDNC" to be set to false + rollbackData.put(RbType, "rollbackSDNCassign", "false"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) + public void testDoCreateAllottedResourceTXCRollback_NoDeactivate() throws Exception { + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); + + rollbackData.put(RbType, "rollbackSDNCactivate", "false"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) + public void testDoCreateAllottedResourceTXCRollback_NoDelete() throws Exception { + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); + + rollbackData.put(RbType, "rollbackSDNCcreate", "false"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) + public void testDoCreateAllottedResourceTXCRollback_NoUnassign() throws Exception { + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + RollbackData rollbackData = setVariablesSuccess(variables, "testRequestId1"); + + rollbackData.put(RbType, "rollbackSDNCassign", "false"); + /* * Note: if assign == false then the flow/script will set * "skipRollback" to false, which will cause ALL of the SDNC steps * to be skipped, not just the unassign step. */ - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_SubProcessError() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - mockSDNCAdapter(404); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXCRollback_JavaException() throws Exception { - - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - variables.put("rollbackData", "string instead of rollback data"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); - assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); - } - - private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("failNotFound", "true"); - variables.put("msoRequestId", requestId); - variables.put("mso-request-id", "requestId"); - variables.put("allottedResourceId", ARID); - - variables.put("serviceInstanceId", DEC_INST); - variables.put("parentServiceInstanceId", DEC_PARENT_INST); - - RollbackData rollbackData = new RollbackData(); - - rollbackData.put(RbType, "serviceInstanceId", DEC_INST); - rollbackData.put(RbType, "serviceSubscriptionType", SVC); - rollbackData.put(RbType, "disablerollback", "false"); - rollbackData.put(RbType, "rollbackAAI", "true"); - rollbackData.put(RbType, "rollbackSDNCassign", "true"); - rollbackData.put(RbType, "rollbackSDNCactivate", "true"); - rollbackData.put(RbType, "rollbackSDNCcreate", "true"); - rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST + "/allotted-resources/allotted-resource/" + ARID); - - rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml")); - rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml")); - rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml")); - - variables.put("rollbackData", rollbackData); - - return rollbackData; - } + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("true", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) + public void testDoCreateAllottedResourceTXCRollback_SubProcessError() throws Exception { + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + mockSDNCAdapter(404); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) + public void testDoCreateAllottedResourceTXCRollback_JavaException() throws Exception { + + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + variables.put("rollbackData", "string instead of rollback data"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + assertEquals("false", BPMNUtil.getVariable(processEngineRule, PROCNAME, "rolledBack")); + assertNotNull(BPMNUtil.getVariable(processEngineRule, PROCNAME, "rollbackError")); + } + + private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("failNotFound", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("allottedResourceId", ARID); + + variables.put("serviceInstanceId", DEC_INST); + variables.put("parentServiceInstanceId", DEC_PARENT_INST); + + RollbackData rollbackData = new RollbackData(); + + rollbackData.put(RbType, "serviceInstanceId", DEC_INST); + rollbackData.put(RbType, "serviceSubscriptionType", SVC); + rollbackData.put(RbType, "disablerollback", "false"); + rollbackData.put(RbType, "rollbackAAI", "true"); + rollbackData.put(RbType, "rollbackSDNCassign", "true"); + rollbackData.put(RbType, "rollbackSDNCactivate", "true"); + rollbackData.put(RbType, "rollbackSDNCcreate", "true"); + rollbackData.put(RbType, "aaiARPath", "http://localhost:28090/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID); + + rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml")); + rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml")); + rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml")); + + variables.put("rollbackData",rollbackData); + + return rollbackData; + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java index 643ff3cc01..9cf059c24c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoCreateAllottedResourceTXCTest.java @@ -43,260 +43,260 @@ import org.openecomp.mso.bpmn.mock.FileUtil; public class DoCreateAllottedResourceTXCTest extends AbstractTestBase { - private static final String PROCNAME = "DoCreateAllottedResourceTXC"; - private final CallbackSet callbacks = new CallbackSet(); - - public DoCreateAllottedResourceTXCTest() throws IOException { - callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml")); - callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml")); - callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml")); - callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXC_Success() throws Exception { - - // TODO: use INST instead of DEC_INST - /* + private static final String PROCNAME = "DoCreateAllottedResourceTXC"; + private final CallbackSet callbacks = new CallbackSet(); + + public DoCreateAllottedResourceTXCTest() throws IOException { + callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml")); + callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml")); + callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml")); + callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml")); + } + + @Test + @Deployment(resources = { + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceTXC.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) + public void testDoCreateAllottedResourceTXC_Success() throws Exception{ + + // TODO: use INST instead of DEC_INST + /* * should be INST instead of DEC_INST, but AAI utilities appear to * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "assign"); - injectSDNCCallbacks(callbacks, "create"); - injectSDNCCallbacks(callbacks, "activate"); - injectSDNCCallbacks(callbacks, "query"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertEquals(null, workflowException); - - assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - assertEquals("my-vni", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vni")); - assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxBearerIP")); - assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxLanIP")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXC_NoSI() throws Exception { - - // TODO: use INST instead of DEC_INST + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "assign"); + injectSDNCCallbacks(callbacks, "create"); + injectSDNCCallbacks(callbacks, "activate"); + injectSDNCCallbacks(callbacks, "query"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + assertEquals(null, workflowException); + + assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); + assertEquals("my-vni", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vni")); + assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxBearerIP")); + assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxLanIP")); + } + + @Test + @Deployment(resources = { + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceTXC.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) + public void testDoCreateAllottedResourceTXC_NoSI() throws Exception{ + + // TODO: use INST instead of DEC_INST /* * should be INST instead of DEC_INST, but AAI utilities appear to * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertNotNull(workflowException); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXC_ActiveAr() throws Exception { - - // TODO: use INST instead of DEC_INST + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + assertNotNull(workflowException); + + assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); + } + + @Test + @Deployment(resources = { + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceTXC.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) + public void testDoCreateAllottedResourceTXC_ActiveAr() throws Exception{ + + // TODO: use INST instead of DEC_INST /* * should be INST instead of DEC_INST, but AAI utilities appear to * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - variables.put("failExists", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "query"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertEquals(null, workflowException); - - assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - assertEquals("my-vni", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vni")); - assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxBearerIP")); - assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxLanIP")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXC_NoParentSI() throws Exception { - - // TODO: use INST instead of DEC_INST + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + variables.put("failExists", "false"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "query"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + assertEquals(null, workflowException); + + assertEquals("namefromrequest", BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); + assertEquals("my-vni", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vni")); + assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxBearerIP")); + assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngineRule, PROCNAME, "vgmuxLanIP")); + } + + @Test + @Deployment(resources = { + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceTXC.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) + public void testDoCreateAllottedResourceTXC_NoParentSI() throws Exception{ + + // TODO: use INST instead of DEC_INST /* * should be INST instead of DEC_INST, but AAI utilities appear to * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertNotNull(workflowException); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - @Test - @Deployment(resources = { - "subprocess/GenericGetService.bpmn", - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoCreateAllottedResourceTXC.bpmn", - "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) - public void testDoCreateAllottedResourceTXC_SubProcessError() throws Exception { - - // TODO: use INST instead of DEC_INST + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + assertNotNull(workflowException); + + assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); + } + + @Test + @Deployment(resources = { + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoCreateAllottedResourceTXC.bpmn", + "subprocess/DoCreateAllottedResourceTXCRollback.bpmn"}) + public void testDoCreateAllottedResourceTXC_SubProcessError() throws Exception{ + + // TODO: use INST instead of DEC_INST /* * should be INST instead of DEC_INST, but AAI utilities appear to * have a bug in that they don't URL-encode the SI id before using * it in the query */ - MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); - MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); - - MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); - MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); - MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); - MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); - mockSDNCAdapter(404); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId123"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - assertNotNull(workflowException); - - assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); - } - - private void setVariablesSuccess(Map<String, Object> variables, String requestId) { - // TODO: need all of these? - variables.put("isDebugLogEnabled", "true"); - variables.put("failExists", "true"); - variables.put("disableRollback", "true"); - variables.put("msoRequestId", requestId); - variables.put("mso-request-id", "requestId"); - variables.put("sourceNetworkId", "snId"); - variables.put("sourceNetworkRole", "snRole"); - variables.put("allottedResourceRole", "brg"); - variables.put("allottedResourceType", "TXC"); - variables.put("allottedResourceId", ARID); - variables.put("brgWanMacAddress", "wanmac"); - - variables.put("serviceInstanceId", DEC_INST); - variables.put("parentServiceInstanceId", DEC_PARENT_INST); - - variables.put("serviceChainServiceInstanceId", "scsiId"); - - String arModelInfo = "{ " + "\"modelType\": \"allotted-resource\"," + - "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + - "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + - "\"modelName\": \"vSAMP12\"," + - "\"modelVersion\": \"1.0\"," + - "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + - "}"; - variables.put("allottedResourceModelInfo", arModelInfo); - } + MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml"); + MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml"); + + MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml"); + MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml"); + MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID); + MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID); + mockSDNCAdapter(404); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId123"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + assertNotNull(workflowException); + + assertEquals(null, BPMNUtil.getVariable(processEngineRule, PROCNAME, "allotedResourceName")); + } + + private void setVariablesSuccess(Map<String, Object> variables, String requestId) { + // TODO: need all of these? + variables.put("isDebugLogEnabled", "true"); + variables.put("failExists", "true"); + variables.put("disableRollback", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("sourceNetworkId", "snId"); + variables.put("sourceNetworkRole", "snRole"); + variables.put("allottedResourceRole", "brg"); + variables.put("allottedResourceType", "TXC"); + variables.put("allottedResourceId", ARID); + variables.put("brgWanMacAddress", "wanmac"); + + variables.put("serviceInstanceId", DEC_INST); + variables.put("parentServiceInstanceId", DEC_PARENT_INST); + + variables.put("serviceChainServiceInstanceId", "scsiId"); + + String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," + + "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + + "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + + "\"modelName\": \"vSAMP12\"," + + "\"modelVersion\": \"1.0\"," + + "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," + + "}"; + variables.put("allottedResourceModelInfo", arModelInfo); + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java index 1395d7b9ed..03972da789 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceBRGTest.java @@ -43,120 +43,120 @@ import org.openecomp.mso.bpmn.mock.FileUtil; public class DoDeleteAllottedResourceBRGTest extends AbstractTestBase { - private static final String PROCNAME = "DoDeleteAllottedResourceBRG"; - private final CallbackSet callbacks = new CallbackSet(); - - public DoDeleteAllottedResourceBRGTest() throws IOException { - callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); - callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml")); - callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); - callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoDeleteAllottedResourceBRG.bpmn"}) - public void testDoDeleteAllottedResourceBRG_Success() throws Exception { - - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoDeleteAllottedResourceBRG.bpmn"}) - public void testDoDeleteAllottedResourceBRG_ARNotInSDNC() throws Exception { - - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - variables.put("failNotFound", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivateNF"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - } - - // TODO - exception is not caught - @Test - @Ignore - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoDeleteAllottedResourceBRG.bpmn"}) - public void testDoDeleteAllottedResourceBRG_SubProcessError() throws Exception { - - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - mockSDNCAdapter(500); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertNotNull(workflowException); - } - - private void setVariablesSuccess(Map<String, Object> variables, String requestId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("failNotFound", "true"); - variables.put("msoRequestId", requestId); - variables.put("mso-request-id", "requestId"); - variables.put("allottedResourceId", ARID); - - variables.put("serviceInstanceId", DEC_INST); - variables.put("parentServiceInstanceId", DEC_PARENT_INST); - } + private static final String PROCNAME = "DoDeleteAllottedResourceBRG"; + private final CallbackSet callbacks = new CallbackSet(); + + public DoDeleteAllottedResourceBRGTest() throws IOException { + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoDeleteAllottedResourceBRG.bpmn"}) + public void testDoDeleteAllottedResourceBRG_Success() throws Exception { + + MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoDeleteAllottedResourceBRG.bpmn"}) + public void testDoDeleteAllottedResourceBRG_ARNotInSDNC() throws Exception { + + MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + variables.put("failNotFound", "false"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "deactivateNF"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + } + + // TODO - exception is not caught + @Test + @Ignore + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoDeleteAllottedResourceBRG.bpmn"}) + public void testDoDeleteAllottedResourceBRG_SubProcessError() throws Exception { + + MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + mockSDNCAdapter(500); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertNotNull(workflowException); + } + + private void setVariablesSuccess(Map<String, Object> variables, String requestId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("failNotFound", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("allottedResourceId", ARID); + + variables.put("serviceInstanceId", DEC_INST); + variables.put("parentServiceInstanceId", DEC_PARENT_INST); + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java index 6990cc0689..2b0364c3c9 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/vcpe/DoDeleteAllottedResourceTXCTest.java @@ -43,120 +43,120 @@ import org.openecomp.mso.bpmn.mock.FileUtil; public class DoDeleteAllottedResourceTXCTest extends AbstractTestBase { - private static final String PROCNAME = "DoDeleteAllottedResourceTXC"; - private final CallbackSet callbacks = new CallbackSet(); - - public DoDeleteAllottedResourceTXCTest() throws IOException { - callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); - callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml")); - callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); - callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoDeleteAllottedResourceTXC.bpmn"}) - public void testDoDeleteAllottedResourceTXC_Success() throws Exception { - - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivate"); - injectSDNCCallbacks(callbacks, "delete"); - injectSDNCCallbacks(callbacks, "unassign"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - } - - @Test - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoDeleteAllottedResourceTXC.bpmn"}) - public void testDoDeleteAllottedResourceTXC_ARNotInSDNC() throws Exception { - - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockSDNCAdapter(200); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - variables.put("failNotFound", "false"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - injectSDNCCallbacks(callbacks, "deactivateNF"); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertEquals(null, workflowException); - } - - // TODO - exception is not caught - @Test - @Ignore - @Deployment(resources = { - "subprocess/SDNCAdapterV1.bpmn", - "subprocess/FalloutHandler.bpmn", - "subprocess/DoDeleteAllottedResourceTXC.bpmn"}) - public void testDoDeleteAllottedResourceTXC_SubProcessError() throws Exception { - - MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); - MockPatchAllottedResource(CUST, SVC, INST, ARID); - MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); - mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); - - mockSDNCAdapter(500); - - String businessKey = UUID.randomUUID().toString(); - Map<String, Object> variables = new HashMap<>(); - setVariablesSuccess(variables, "testRequestId1"); - - invokeSubProcess(PROCNAME, businessKey, variables); - - waitForProcessEnd(businessKey, 10000); - - Assert.assertTrue(isProcessEnded(businessKey)); - String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); - System.out.println("workflowException:\n" + workflowException); - assertNotNull(workflowException); - } - - private void setVariablesSuccess(Map<String, Object> variables, String requestId) { - variables.put("isDebugLogEnabled", "true"); - variables.put("failNotFound", "true"); - variables.put("msoRequestId", requestId); - variables.put("mso-request-id", "requestId"); - variables.put("allottedResourceId", ARID); - - variables.put("serviceInstanceId", DEC_INST); - variables.put("parentServiceInstanceId", DEC_PARENT_INST); - } + private static final String PROCNAME = "DoDeleteAllottedResourceTXC"; + private final CallbackSet callbacks = new CallbackSet(); + + public DoDeleteAllottedResourceTXCTest() throws IOException { + callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml")); + callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml")); + callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml")); + callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml")); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoDeleteAllottedResourceTXC.bpmn"}) + public void testDoDeleteAllottedResourceTXC_Success() throws Exception { + + MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "deactivate"); + injectSDNCCallbacks(callbacks, "delete"); + injectSDNCCallbacks(callbacks, "unassign"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoDeleteAllottedResourceTXC.bpmn"}) + public void testDoDeleteAllottedResourceTXC_ARNotInSDNC() throws Exception { + + MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + variables.put("failNotFound", "false"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + injectSDNCCallbacks(callbacks, "deactivateNF"); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertEquals(null, workflowException); + } + + // TODO - exception is not caught + @Test + @Ignore + @Deployment(resources = { + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/DoDeleteAllottedResourceTXC.bpmn"}) + public void testDoDeleteAllottedResourceTXC_SubProcessError() throws Exception { + + MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml"); + MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml"); + MockPatchAllottedResource(CUST, SVC, INST, ARID); + MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + mockSDNCAdapter(500); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariablesSuccess(variables, "testRequestId1"); + + invokeSubProcess(PROCNAME, businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + Assert.assertTrue(isProcessEnded(businessKey)); + String workflowException = BPMNUtil.getVariable(processEngineRule, PROCNAME, VAR_WFEX); + System.out.println("workflowException:\n" + workflowException); + assertNotNull(workflowException); + } + + private void setVariablesSuccess(Map<String, Object> variables, String requestId) { + variables.put("isDebugLogEnabled", "true"); + variables.put("failNotFound", "true"); + variables.put("msoRequestId", requestId); + variables.put("mso-request-id", "requestId"); + variables.put("allottedResourceId", ARID); + + variables.put("serviceInstanceId", DEC_INST); + variables.put("parentServiceInstanceId", DEC_PARENT_INST); + } } |