From b6b7bef8bdcad15af01ac88a038dd763ce59f68f Mon Sep 17 00:00:00 2001 From: xg353y Date: Tue, 11 Apr 2017 13:30:42 +0200 Subject: [MSO-8] Update the maven dependency Update the maven depenency for sdc-distribution-client to cooperate with the sdc changes. Change-Id: I2da936e5c40cb68c7181bb78307192dd5655b5dc Signed-off-by: xg353y --- .../scripts/CreateVfModuleVolumeInfraV1Test.groovy | 209 ++ .../scripts/DeleteVfModuleVolumeInfraV1Test.groovy | 166 ++ .../scripts/DoCreateVfModuleVolumeV1Test.groovy | 218 ++ .../scripts/UpdateNetworkInstanceInfraTest.groovy | 3094 ++++++++++++++++++++ .../scripts/UpdateVfModuleVolumeInfraV1Test.groovy | 93 + .../infrastructure/CreateVfModuleInfraTest.java | 243 ++ .../CreateVfModuleVolumeInfraV1Test.java | 306 ++ .../bpmn/infrastructure/CreateVnfInfraTest.java | 220 ++ .../infrastructure/DeleteVfModuleInfraTest.java | 579 ++++ .../DeleteVfModuleVolumeInfraV1Test.java | 166 ++ .../bpmn/infrastructure/DeleteVnfInfraTest.java | 200 ++ .../DoCreateVfModuleRollbackTest.java | 157 + .../bpmn/infrastructure/DoCreateVfModuleTest.java | 149 + .../DoCreateVfModuleVolumeV1Test.java | 351 +++ .../mso/bpmn/infrastructure/DoCreateVnfTest.java | 119 + .../bpmn/infrastructure/DoDeleteVfModuleTest.java | 549 ++++ .../mso/bpmn/infrastructure/DoDeleteVnfTest.java | 140 + .../bpmn/infrastructure/DoUpdateVfModuleTest.java | 115 + .../UpdateNetworkInstanceInfraTest.java | 840 ++++++ .../infrastructure/UpdateVfModuleInfraTest.java | 144 + .../UpdateVfModuleVolumeInfraV1Test.java | 141 + .../cloudRegion25_AAIResponse_Success.xml | 20 + .../cloudRegion30_AAIResponse_Success.xml | 20 + .../CreateNetworkV2/createNetworkResponse_400.xml | 6 + .../CreateNetworkV2/createNetworkResponse_500.xml | 78 + .../createNetworkResponse_Success.xml | 24 + .../createNetwork_queryInstance_Success.xml | 4 + ...reateNetwork_queryName2_AAIResponse_Success.xml | 62 + ...Network_queryNameActive_AAIResponse_Success.xml | 74 + .../createNetwork_queryName_AAIResponse_404.xml | 19 + ...createNetwork_queryName_AAIResponse_Success.xml | 62 + ...reateNetwork_queryNetworkId_AAIResponse_404.xml | 19 + ...ueryNetworkId_AAIResponse_NoPayload_Success.xml | 73 + ...eNetwork_queryNetworkId_AAIResponse_Success.xml | 95 + ...work_queryNetworkPolicy_AAIResponse_Success.xml | 21 + ...k_queryNetworkTableRef1_AAIResponse_Success.xml | 20 + ...k_queryNetworkTableRef2_AAIResponse_Success.xml | 20 + ...Network_queryVpnBinding_AAIResponse_Success.xml | 46 + ...eNetwork_updateContrail_AAIResponse_Success.xml | 11 + ...e_createServiceInstance_AAIResponse_Success.xml | 11 + ...e_queryGlobalCustomerId_AAIResponse_Success.xml | 62 + .../CreateVfModuleCallbackException.xml | 7 + .../CreateVfModuleVolumeCallbackResponse.xml | 53 + .../CreateVfModuleVolumeRequest.xml | 24 + .../CreateVfModuleVolumeInfraV1/GenericVnf.xml | 38 + .../RollbackVfModuleVolumeCallbackResponse.xml | 5 + .../createVfModuleVolume_VID_request.json | 65 + ...createVfModuleVolume_VID_request_noreqparm.json | 45 + ...Volume_createVolumeName_AAIResponse_Success.xml | 49 + ...Volume_deleteVolumeName_AAIResponse_Success.xml | 24 + ...oduleVolume_queryVolumeName_AAIResponse_404.xml | 31 + ...eVolume_queryVolumeName_AAIResponse_Success.xml | 49 + ...Volume_updateVolumeName_AAIResponse_Success.xml | 24 + .../CreateVfModuleVolumeInfraV1/getSIUrlById.xml | 6 + .../test/resources/__files/Database/DBAdapter.xml | 1 + .../__files/Database/DBUpdateResponse.xml | 4 + .../DeleteGenericVNFV1/sdncAdapterResponse.xml | 7 + .../cloudRegion25_AAIResponse_Success.xml | 20 + .../cloudRegion30_AAIResponse_Success.xml | 20 + .../deleteAAIResponse_Failure500_RESTFault.xml | 19 + .../deleteNetworkAAIResponse_Success.xml | 61 + ...NetworkAAIResponse_withRelationship_Success.xml | 73 + .../DeleteVfModuleVolumeCallbackResponse.xml | 5 + .../deleteVfModuleVolume_VID_request_st.json | 17 + .../queryVolumeId_AAIResponse_Success.xml | 42 + .../DoCreateVfModuleRollback/GenericVnf.xml | 26 + .../GenericVnfVfModule.xml | 26 + .../CreateVfModuleVolumeCallbackResponse.xml | 53 + .../CreateVfModuleVolumeNoRollbackRequest.xml | 24 + .../CreateVfModuleVolumeRequest.xml | 24 + .../DoCreateVfModuleVolumeV1/GenericVnf.xml | 38 + .../RollbackVfModuleVolumeCallbackResponse.xml | 5 + .../createVfModuleVolume_VID_request.json | 64 + ...Volume_createVolumeName_AAIResponse_Success.xml | 49 + ...Volume_deleteVolumeName_AAIResponse_Success.xml | 24 + ...eVolume_queryVolumeName_AAIResponse_Success.xml | 49 + ...Volume_updateVolumeName_AAIResponse_Success.xml | 24 + .../GenericFlows/getGenericVnfByNameResponse.xml | 23 + .../__files/GenericFlows/getGenericVnfResponse.xml | 90 + .../getGenericVnfResponse_hasRelationships.xml | 90 + .../__files/GenericFlows/getSIUrlById.xml | 6 + .../__files/GenericFlows/getServiceInstance.xml | 30 + .../InfrastructureFlows/CreateVnfInfraRequest.json | 38 + .../DeleteVnfInfraRequestCascadeDelete.json | 39 + .../UpdateVfModule_VID_request.json | 51 + .../UpdateNetworkV2/updateNetworkResponse_400.xml | 6 + .../UpdateNetworkV2/updateNetworkResponse_500.xml | 78 + .../updateNetworkResponse_Success.xml | 24 + .../updateNetwork_queryInstance_Success.xml | 4 + ...ueryNetworkId_AAIResponse_NoPayload_Success.xml | 73 + ...eNetwork_queryNetworkId_AAIResponse_Success.xml | 95 + ...work_queryNetworkPolicy_AAIResponse_Success.xml | 21 + ...k_queryNetworkTableRef1_AAIResponse_Success.xml | 20 + ...k_queryNetworkTableRef2_AAIResponse_Success.xml | 20 + ...Network_queryVpnBinding_AAIResponse_Success.xml | 46 + ...eNetwork_updateContrail_AAIResponse_Success.xml | 11 + .../queryVolumeId_AAIResponse_Success.xml | 44 + .../updateVfModuleVolume_VID_request.json | 64 + .../updateVfModuleVolume_VID_request_2.json | 64 + .../vf_module_aai_response.xml | 29 + .../AddNetworkPolicy_AAIResponse_Success.xml | 21 + .../resources/__files/VfModularity/GenericVnf.xml | 38 + .../QueryNetworkPolicy_AAIResponse_Success.xml | 21 + .../VfModularity/StandardSDNCSynchResponse.xml | 5 + .../__files/VfModularity/VfModule-new.xml | 9 + .../__files/VfModularity/VfModule-supercool.xml | 27 + .../resources/__files/VfModularity/VolumeGroup.xml | 25 + .../__files/deleteNetworkResponse_Success.xml | 3 + .../src/test/resources/camunda.cfg.xml | 61 + .../src/test/resources/logging.properties | 2 + .../src/test/resources/mso.bpmn.properties | 3 + .../src/test/resources/mso.bpmn.urn.properties | 85 + 112 files changed, 11307 insertions(+) create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV1Test.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstanceInfraTest.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV1Test.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceInfraTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBAdapter.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/__files/deleteNetworkResponse_Success.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/camunda.cfg.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/logging.properties create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.properties create mode 100644 bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties (limited to 'bpmn/MSOInfrastructureBPMN/src/test') diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy new file mode 100644 index 0000000000..4f5375719f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1Test.groovy @@ -0,0 +1,209 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.scripts; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.mockito.ArgumentCaptor +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.openecomp.mso.bpmn.common.scripts.MsoGroovyTest; + + +@RunWith(MockitoJUnitRunner.class) +import org.apache.commons.lang3.* + + +class CreateVfModuleVolumeInfraV1Test extends MsoGroovyTest { + + def jsonRequest = """ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1", + "modelCustomizationName": "vSAMP12" + } + } + } + ], + "requestParameters": { + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": [ + {"name": "vnfName", "value": "STMTN5MMSC20" }, + {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, + {"name": "vnfNmInformation", "value": "" }, + {"name": "vnfType", "value": "pcrf-capacity" }, + {"name": "vnfId", "value": "skask" }, + {"name": "vnfStackId", "value": "slowburn" }, + {"name": "vnfStatus", "value": "created" }, + {"name": "aicCloudRegion", "value": "MDTWNJ21" }, + {"name": "availabilityZone", "value": "slcp3-esx-az01" }, + {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, + {"name": "vmName", "value": "slcp34246vbc246ceb" }, + {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, + {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } + ] + } + } +} +""" + + def volumeRequestXml = """ + + CREATE_VF_MODULE_VOL + VID + + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + true + + + + STMTN5MMSC20 + US1117MTSNJVBR0246 + + pcrf-capacity + skask + slowburn + created + MDTWNJ21 + slcp3-esx-az01 + VLAN-OAM-1323 + slcp34246vbc246ceb + 970cd2b9-7f09-4a12-af47-182ea38ba1f0 + 545cc2c3-1930-4100-b534-5d82d0e12bb6 + +""" + + def completeMsoRequestXml = """ + + 1234 + CREATE + VID + + Volume Group has been created successfully. + BPMN VF Module Volume action: CREATE +""" + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + + @Test + public void testPreProcessRequest() { + + ExecutionEntity mockExecution = setupMock('CreateVfModuleVolumeInfraV1') + + when(mockExecution.getVariable("prefix")).thenReturn('CVMVINFRAV1_') + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonRequest) + when(mockExecution.getVariable("serviceInstanceId")).thenReturn('') + when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id') + when(mockExecution.getVariable("mso-request-id")).thenReturn('1234') + + CreateVfModuleVolumeInfraV1 createVfModuleVolumeInfraV1 = new CreateVfModuleVolumeInfraV1() + createVfModuleVolumeInfraV1.preProcessRequest(mockExecution, 'true') + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(15)).setVariable(captor1.capture(), captor2.capture()) + + List arg2List = captor2.getAllValues() + String volumeRequestActual = arg2List.get(6) + String isVidRequestActual = arg2List.get(8) + + assertEquals(volumeRequestXml, volumeRequestActual.trim()) + assertEquals('true', isVidRequestActual) + } + + @Test + public void testPostProcessResponse() { + + ExecutionEntity mockExecution = setupMock('CreateVfModuleVolumeInfraV1') + when(mockExecution.getVariable("dbReturnCode")).thenReturn('000') + when(mockExecution.getVariable("CVMVINFRAV1_createDBResponse")).thenReturn('') + when(mockExecution.getVariable("mso-request-id")).thenReturn('1234') + when(mockExecution.getVariable("CVMVINFRAV1_source")).thenReturn('VID') + + CreateVfModuleVolumeInfraV1 createVfModuleVolumeInfraV1 = new CreateVfModuleVolumeInfraV1() + createVfModuleVolumeInfraV1.postProcessResponse(mockExecution, 'true') + + verify(mockExecution).setVariable('CVMVINFRAV1_Success', true) + verify(mockExecution).setVariable('CVMVINFRAV1_CompleteMsoProcessRequest', completeMsoRequestXml) + } + + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy new file mode 100644 index 0000000000..2e6b35eaba --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1Test.groovy @@ -0,0 +1,166 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.scripts; + +import static org.junit.Assert.* +import static org.mockito.Mockito.* + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.openecomp.mso.bpmn.common.scripts.MsoGroovyTest +import org.openecomp.mso.bpmn.core.WorkflowException + + +@RunWith(MockitoJUnitRunner.class) +class DeleteVfModuleVolumeInfraV1Test extends MsoGroovyTest { + + def deleteVnfAdapterRequestXml = """ + RDM2WAGPLCP + fba1bd1e195a404cacb9ce17a9b2b421 + 78987 + + true + + TEST-REQUEST-ID-0123 + 1234 + + ebb9ef7b-a6a5-40e6-953e-f868f1767677 + http://localhost:28080/mso/WorkflowMessage/VNFAResponse/ebb9ef7b-a6a5-40e6-953e-f868f1767677 +""" + + def dbRequestXml = """ + + + + TEST-REQUEST-ID-0123 + BPMN + VolumeGroup successfully deleted + COMPLETE + 100 + + + +""" + + def completionRequestXml = """ + + TEST-REQUEST-ID-0123 + DELETE + VID + + Volume Group has been deleted successfully. + BPMN VF Module Volume action: DELETE +""" + + def falloutHandlerRequestXml = """ + + TEST-REQUEST-ID-0123 + DELETE + VID + + + Unexpected Error + 5000 + +""" + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + + @Test + public void testPrepareVnfAdapterDeleteRequest() { + + ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') + when(mockExecution.getVariable("DELVfModVol_cloudRegion")).thenReturn('RDM2WAGPLCP') + when(mockExecution.getVariable("DELVfModVol_tenantId")).thenReturn('fba1bd1e195a404cacb9ce17a9b2b421') + when(mockExecution.getVariable("DELVfModVol_volumeGroupId")).thenReturn('78987') + when(mockExecution.getVariable("DELVfModVol_volumeGroupHeatStackId")).thenReturn('') + when(mockExecution.getVariable("DELVfModVol_requestId")).thenReturn('TEST-REQUEST-ID-0123') + when(mockExecution.getVariable("DELVfModVol_serviceId")).thenReturn('1234') + when(mockExecution.getVariable("DELVfModVol_messageId")).thenReturn('ebb9ef7b-a6a5-40e6-953e-f868f1767677') + when(mockExecution.getVariable("URN_mso_workflow_message_endpoint")).thenReturn('http://localhost:28080/mso/WorkflowMessage') + when(mockExecution.getVariable("URN_mso_use_qualified_host")).thenReturn('') + + DeleteVfModuleVolumeInfraV1 myproc = new DeleteVfModuleVolumeInfraV1() + myproc.prepareVnfAdapterDeleteRequest(mockExecution, 'true') + + verify(mockExecution).setVariable("DELVfModVol_deleteVnfARequest", deleteVnfAdapterRequestXml) + + } + + @Test + public void testPrepareDbRequest() { + + ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') + when(mockExecution.getVariable("DELVfModVol_requestId")).thenReturn('TEST-REQUEST-ID-0123') + when(mockExecution.getVariable("DELVfModVol_volumeOutputs")).thenReturn('') + + DeleteVfModuleVolumeInfraV1 myproc = new DeleteVfModuleVolumeInfraV1() + myproc.prepareDBRequest(mockExecution, 'true') + + verify(mockExecution).setVariable("DELVfModVol_updateInfraRequest", dbRequestXml) + } + + @Test + public void testPrepareCompletionHandlerRequest() { + + ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') + when(mockExecution.getVariable("mso-request-id")).thenReturn('TEST-REQUEST-ID-0123') + when(mockExecution.getVariable("DELVfModVol_source")).thenReturn('VID') + + DeleteVfModuleVolumeInfraV1 myproc = new DeleteVfModuleVolumeInfraV1() + myproc.prepareCompletionHandlerRequest(mockExecution, 'true') + + verify(mockExecution).setVariable("DELVfModVol_CompleteMsoProcessRequest", completionRequestXml) + } + + @Test + public void testPrepareFalloutHandler() { + + WorkflowException workflowException = new WorkflowException('DeleteVfModuleVolumeInfraV1', 5000, 'Unexpected Error') + + ExecutionEntity mockExecution = setupMock('DeleteVfModuleVolumeInfraV1') + + when(mockExecution.getVariable("DELVfModVol_requestId")).thenReturn('TEST-REQUEST-ID-0123') + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + when(mockExecution.getVariable("DELVfModVol_source")).thenReturn('VID') + + DeleteVfModuleVolumeInfraV1 myproc = new DeleteVfModuleVolumeInfraV1() + myproc.prepareFalloutHandler(mockExecution, 'true') + + verify(mockExecution).setVariable("DELVfModVol_Success", false) + verify(mockExecution).setVariable("DELVfModVol_FalloutHandlerRequest", falloutHandlerRequestXml) + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV1Test.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV1Test.groovy new file mode 100644 index 0000000000..cf95ed3085 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV1Test.groovy @@ -0,0 +1,218 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.scripts; + +import static org.junit.Assert.* +import static org.mockito.Mockito.* + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Assert +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.openecomp.mso.bpmn.common.scripts.MsoGroovyTest + + +@RunWith(MockitoJUnitRunner.class) +class DoCreateVfModuleVolumeV1Test extends MsoGroovyTest { + + def volumeRequest = +""" + + 123abc + d8d4fcfa-fd7e-4413-b19d-c95aa67291b8 + CREATE_VF_MODULE_VOL + SoapUI-bns-create-base-vol-1001-1 + + + Test/vSAMP12 + vSAMP12::base::module-0 + true + 2.0 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MDTWNJ21 + 897deadc2b954a6bac6d3c197fb3525e + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + + + + value1" + value2" + value3" + +""" + + def genericVnfResponseXml = """ + + TEST-VNF-ID-0123 + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + lukewarm + PCRF::module-0-0 + introvert + 2.0 + true + fastburn + pending-create + 0000074 + + + supercool + PCRF::module-1-0 + extrovert + 2.0 + false + slowburn + pending-create + 0000075 + + + + + + +""" + def String expectedCreateVnfRequestXml = """ + MDTWNJ21 + 897deadc2b954a6bac6d3c197fb3525e + TEST-VNF-ID-0123 + STMTN5MMSC20 + test-vol-group-id-123 + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + 2.0 + vSAMP12::base::module-0 + + + + vnf_id + TEST-VNF-ID-0123 + + + vnf_name + STMTN5MMSC20 + + + vf_module_id + test-vol-group-id-123 + + + vf_module_name + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + + + param1 + value1 + + + param2 + value2 + + + param3 + value3 + + + true + true + true + + d8d4fcfa-fd7e-4413-b19d-c95aa67291b8 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + 111 + http://localhost:28080/mso/WorkflowMessage/12345678 + +""" + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + + } + + @Test + public void TestPreProcessRequest() { + + ExecutionEntity mockExecution = setupMock('DoCreateVfModuleVolumeV1') + + when(mockExecution.getVariable("DoCreateVfModuleVolumeV1Request")).thenReturn(volumeRequest) + when(mockExecution.getVariable("vnf-id")).thenReturn('test-vnf-id-123') + when(mockExecution.getVariable("volume-group-id")).thenReturn('test-volume-group-id-123') + when(mockExecution.getVariable("mso-request-id")).thenReturn('test-request-id-123') + + DoCreateVfModuleVolumeV1 myprocess = new DoCreateVfModuleVolumeV1() + myprocess.preProcessRequest(mockExecution, 'true') + + verify(mockExecution).setVariable('DCVFMODVOLV1_serviceId', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb') + verify(mockExecution).setVariable('DCVFMODVOLV1_source', 'SoapUI-bns-create-base-vol-1001-1') + verify(mockExecution, times(7)).setVariable(anyString(), anyString()) + } + + @Test + public void TestPrepareVnfAdapterCreateRequest() { + + ExecutionEntity mockExecution = setupMock('DoCreateVfModuleVolumeV1') + + when(mockExecution.getVariable("DCVFMODVOLV1_Request")).thenReturn(volumeRequest) + when(mockExecution.getVariable("DCVFMODVOLV1_requestId")).thenReturn('d8d4fcfa-fd7e-4413-b19d-c95aa67291b8') + when(mockExecution.getVariable("DCVFMODVOLV1_serviceId")).thenReturn('a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb') + when(mockExecution.getVariable("DCVFMODVOLV1_AAIQueryGenericVfnResponse")).thenReturn(genericVnfResponseXml) + when(mockExecution.getVariable("DCVFMODVOLV1_rollbackEnabled")).thenReturn(true) + when(mockExecution.getVariable("volume-group-id")).thenReturn('test-vol-group-id-123') + when(mockExecution.getVariable("URN_mso_workflow_message_endpoint")).thenReturn('http://localhost:28080/mso/WorkflowMessage') + when(mockExecution.getVariable("URN_mso_use_qualified_host")).thenReturn(true) + + DoCreateVfModuleVolumeV1 myprocess = new DoCreateVfModuleVolumeV1() + myprocess.prepareVnfAdapterCreateRequest(mockExecution, 'true') + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(2)).setVariable(captor1.capture(), captor2.capture()) + + List arg2List = captor2.getAllValues() + String createVnfRequestXml = arg2List.get(0) + + //replace messageID value because it is random generated + createVnfRequestXml = createVnfRequestXml.replaceAll("(.+?)", "111") + .replaceAll("(.+?)", "http://localhost:28080/mso/WorkflowMessage/12345678") + + Assert.assertEquals(expectedCreateVnfRequestXml.trim(), createVnfRequestXml.trim()) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstanceInfraTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstanceInfraTest.groovy new file mode 100644 index 0000000000..d19081c766 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstanceInfraTest.groovy @@ -0,0 +1,3094 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.scripts; + +import static org.junit.Assert.* +import static org.mockito.Mockito.* +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetCloudRegion +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetwork +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutNetwork +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkPolicy +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkRouteTable +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkVpnBinding + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.runtime.Execution +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.ArgumentCaptor +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.openecomp.mso.bpmn.common.scripts.MsoUtils +import org.openecomp.mso.bpmn.core.WorkflowException + +import com.github.tomakehurst.wiremock.client.WireMock +import com.github.tomakehurst.wiremock.junit.WireMockRule + + +@RunWith(MockitoJUnitRunner.class) +class UpdateNetworkInstanceInfraTest { + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090); + + def utils = new MsoUtils() + + String jsonIncomingRequest = + """{ "requestDetails": { + "modelInfo": { + "modelType": "networkTyp", + "modelId": "modelId", + "modelNameVersionId": "modelNameVersionId", + "modelName": "CONTRAIL_EXTERNAL", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "RDM2WAGPLCP", + "tenantId": "7dd5365547234ee8937416c65507d266" + }, + "requestInfo": { + "instanceName": "MNS-25180-L-01-dmz_direct_net_1", + "source": "VID", + "callbackUrl": "", + "suppressRollback": true, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", + "modelInfo": { + "modelType": "serviceT", + "modelId": "modelI", + "modelNameVersionId": "modelNameVersionI", + "modelName": "modleNam", + "modelVersion": "1" + } + } + } + ], + "requestParameters": { + "userParams": [ + { + "name": "someUserParam1", + "value": "someValue1" + } + ] + } + }}""" + + String jsonIncomingRequest_Missingname = + """{ "requestDetails": { + "modelInfo": { + "modelType": "networkTyp", + "modelId": "modelId", + "modelNameVersionId": "modelNameVersionId", + "modelName": "CONTRAIL_EXTERNAL", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "RDM2WAGPLCP", + "tenantId": "7dd5365547234ee8937416c65507d266" + }, + "requestInfo": { + "source": "VID", + "callbackUrl": "", + "suppressRollback": true, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", + "modelInfo": { + "modelType": "serviceT", + "modelId": "modelI", + "modelNameVersionId": "modelNameVersionI", + "modelName": "modleNam", + "modelVersion": "1" + } + } + } + ], + "requestParameters": { + "userParams": [] + } + }}""" + + String jsonIncomingRequest_MissingCloudRegion = + """{ "requestDetails": { + "modelInfo": { + "modelType": "networkTyp", + "modelId": "modelId", + "modelNameVersionId": "modelNameVersionId", + "modelName": "CONTRAIL_EXTERNAL", + "modelVersion": "1" + }, + "cloudConfiguration": { + "tenantId": "7dd5365547234ee8937416c65507d266" + }, + "requestInfo": { + "instanceName": "MNS-25180-L-01-dmz_direct_net_1", + "source": "VID", + "callbackUrl": "", + "suppressRollback": true, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4", + "modelInfo": { + "modelType": "serviceT", + "modelId": "modelI", + "modelNameVersionId": "modelNameVersionI", + "modelName": "modleNam", + "modelVersion": "1" + } + } + } + ], + "requestParameters": { + "userParams": [] + } + }}""" + + + + String expectedNetworkRequestMissingNetworkId = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + UPDATE + VID + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + + + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + true + + + someValue1 + + +""" + + +String expectedNetworkRequestMissingCloudRegion = +""" + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + UPDATE + PORTAL + + + HSL_direct_net_2 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + e81d842d3e8b45c5a59f57cd76af3aaf + + + 1 + +""" + + // vnfRESTRequest + String networkRESTRequest = +""" + + + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + UPDATE + PORTAL + + + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + dvs-slcp3-01 + 3008 + + + 1 + 0 + + + + """ + + String networkInputsMissingName = + """ + + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + e81d842d3e8b45c5a59f57cd76af3aaf + """ + +String networkInputsMissingCloudRegion = +""" + HSL_direct_net_2 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + e81d842d3e8b45c5a59f57cd76af3aaf +""" + + String expectedUpdateNetworkInstanceInfraRequest = + """ + + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + UPDATE + PORTAL + + + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + dvs-slcp3-01 + 3008 + + + 1 + 0 + + +""" + + String expectedUpdateNetworkInstanceInfraRequest_Output = + """ + + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + UPDATE + PORTAL + + + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + + + MNS-25180-L-01-dmz_direct_net_1 + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + + + 1 + 0 + + +""" + + // expectedNetworkRequest + String expectedNetworkRequest = + """ + + UPDATE + VID + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + true + + + true + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + true + true + 10.10.125.1 + +""" + +String expectedNetworkInputs = +""" + + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + true +""" + + + String NetworkRequest_noPhysicalName = + """ + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + UPDATE + PORTAL + + + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + 3008 + + + + true + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + true + true + 10.10.125.1 + + +""" + + String vnfRequestFakeRegion = + """ + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + UPDATE + PORTAL + + + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MDTWNJ21 + 7dd5365547234ee8937416c65507d266 + + + 1 + 0 + +""" + + // expectedNetworkRequest + String expectedNetworkRequest_Outputs = + """ + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + UPDATE + PORTAL + + + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + + + MNS-25180-L-01-dmz_direct_net_1 + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + + + 1 + 0 + +""" + + + // expectedNetworkRequest + String networkInputs_404 = + """ + myOwn_Network + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + e81d842d3e8b45c5a59f57cd76af3aaf + """ + + String networkInputs = + """ + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + RDM2WAGPLCP + e81d842d3e8b45c5a59f57cd76af3aaf +""" + + String networkOutputs = + """ + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + """ + + String queryAAIResponse = + """ + + + + + + + + + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-delete + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-delete + true + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + + +""" + + String queryIdAIIResponse = + """ + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + l3-version + pending-delete + ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326 + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-delete + true + subnetName + + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-delete + true + subnetName + + + + + 414 + 4132176 + + + 415 + 4132176 + + + + inner + ctag-version + + + tenant + https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ + + vpn-binding.vpn-id + a290b841-f672-44dd-b9cd-6f8c20d7d8c8 + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest2 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ + + vpn-binding.vpn-id + 24a4b507-853a-4a38-99aa-05fcc54be24d + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest1 + + + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + + +""" + + String queryIdAIIResponseTestScenario01 = + """ + + 4da55fe4-7a9e-478c-a434-8a98d62265ab + GN_EVPN_direct_net_0_ST1 + CONTRAIL30_BASIC + GN_EVPN_direct + contrail + false + 9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + 1465398611 + pending-delete + networkName + false + true + false + + + cb1a7b47-5428-44c9-89c2-8b17541c3228 + 108.239.40.1 + 108.239.40.0 + 28 + 4 + pending-delete + true + 108.239.40.0 + 108.239.40.0 + 1465398611 + subnetName + + + + e2cc7c14-90f0-4205-840d-b4e07f04e621 + 2606:ae00:2e01:604::1 + 2606:ae00:2e01:604:: + 64 + 6 + pending-delete + true + 2606:ae00:2e01:604:: + 2606:ae00:2e01:604:: + 1465398611 + subnetName + + + + + + 416 + 4132176 + + + + cloud-region + https://mtanjv9aaas03.aic.cip.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/ + + + cloud-region.cloud-region-id + AAIAIC25 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.owner-defined-type + + + + + tenant + https://mtanjv9aaas03.aic.cip.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/4ae1d3446a4c48b2bec44b6cfba06d68/ + + tenant.tenant-id + 4ae1d3446a4c48b2bec44b6cfba06d68 + + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + AAIAIC25 + + + tenant.tenant-name + Ruchira Contrail 3.0 test + + + + vpn-binding + https://mtanjv9aaas03.aic.cip.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 9a7b327d9-287aa00-82c4b0-100001 + + + vpn-binding.vpn-name + GN_EVPN_direct_net_0_ST1 + + + + route-table-reference + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + +""" + + String queryIdAIIResponseVpnNotPresent = + """ + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-delete + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-delete + true + subnetName + + + + + + +""" + + String queryNameAIIResponse = + """ + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-delete + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-delete + true + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + + + """ + + String queryNameAIIResponseVpnNotPresent = + """ + + + + + + + + + + + + + + +""" + + String queryVpnBindingAAIResponse = + """ + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 13979:105757 + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ + + l3-network.network-id + 689ec39e-c5fc-4462-8db2-4f760763ad28 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ + + l3-network.network-id + 1a49396b-19b3-40a4-8792-aa2fbd0f0704 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ + + l3-network.network-id + 774f3329-3c83-4771-86c7-9e6207cd50fd + + + + + +""" + + String updateDBRequest_Active = + """ + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + BPMN + Network MNS-25180-L-01-dmz_direct_net_1 already exists. Silent success. + + COMPLETED + 100 + <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id><network-name>MNS-25180-L-01-dmz_direct_net_1</network-names> + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + + +""" + + String updateDBRequest = + """ + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + BPMN + Network successfully updated. + + COMPLETED + 100 + <network-id></network-id><network-name></network-names> + + + +""" + + String updateDBRequestError = + """ + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + BPMN + Received error from SDN-C: No availability zone available + + FAILED + <network-id></network-id><network-name></network-names> + + + """ + + String updateDBRequestError01 = + """ + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + BPMN + Received error unexpectedly from SDN-C. + + FAILED + <network-id></network-id><network-name></network-names> + + + """ + + String updateDBRequest_Outputs = + """ + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + BPMN + Network successfully updated. + + COMPLETED + 100 + <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id><network-name>MNS-25180-L-01-dmz_direct_net_1</network-names> + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + + +""" + + String updateNetworkRequest = + """ + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + + CONTRAIL + + networkName + 414,415 + + + true + false + 13979:105757 + 13979:105757 + GN_EVPN_Test + refFQDN1 + refFQDN2 + + + + + + + 107.239.52.0/24 + true + 107.239.52.1 + 4 + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + subnetName + + + + + + + 107.239.52.0/24 + true + 107.239.52.1 + 4 + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + subnetName + + true + true + false + + true + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + true + true + 10.10.125.1 + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + + messageId_generated + +""" + + + String updateNetworkRequest_noPhysicalName = + """ + RDM2WAGPLCP + 7dd5365547234ee8937416c65507d266 + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + + CONTRAIL + + networkName + 414,415 + + + true + false + 13979:105757 + 13979:105757 + GN_EVPN_Test + + + + + + + 107.239.52.0/24 + true + 107.239.52.1 + 4 + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + subnetName + + + + + + + 107.239.52.0/24 + true + 107.239.52.1 + 4 + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + subnetName + + true + true + false + + true + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + true + true + 10.10.125.1 + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + null + + messageId_generated + +""" + + String updateNetworkResponseREST = + """ + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 + + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + CONTRAIL_EXTERNAL + true + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + + messageId_generated +""" + + String updateRollbackNetworkRequest = + """ + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + CONTRAIL_EXTERNAL + true + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + +""" + + String updateNetworkResponse = + """ + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + true + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + CONTRAIL_EXTERNAL + false + c4f4e878-cde0-4b15-ae9a-bda857759cea + 7dd5365547234ee8937416c65507d266 + +""" + + String updateContrailAAIPayloadRequest = + """ + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + c4f4e878-cde0-4b15-ae9a-bda857759cea + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + l3-version + active + ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326 + default-domain:MSOTest:GN_EVPN_direct_net_0_ST1 + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + 107.239.52.1 + 107.239.52.0 + 24 + 4 + active + true + subnetName + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + 107.239.52.1 + 107.239.52.0 + 24 + 4 + active + true + subnetName + + + + 414 + + + 415 + + + + inner + ctag-version + + + tenant + https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/ + + vpn-binding.vpn-id + a290b841-f672-44dd-b9cd-6f8c20d7d8c8 + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest2 + + + + vpn-binding + https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ + + vpn-binding.vpn-id + 24a4b507-853a-4a38-99aa-05fcc54be24d + + + vpn-binding.vpn-name + oam_protected_net_6_MTN5_msotest1 + + + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + +""" + + String updateContrailAAIResponse = + """ + + + + + + + + +""" + + String updateNetworkErrorResponse = + """ + 680bd458-5ec1-4a16-b77c-509022e53450INTERNAL + 400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data + true + """ + + + String networkException500 = + """soap:VersionMismatch"http://org.openecomp.mso/network", the namespace on the "updateNetworkContrail" element, is not a valid SOAP version.""" + + String aaiResponse = + """ + + + + + + + + + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + HSL_direct + contrail + 8bbd3edf-b835-4610-96a2-a5cafa029042 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + active + HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 + + + ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a + 5a77fdc2-7789-4649-a1b9-6eaf1db1813a + 172.16.34.1 + 172.16.34.0 + 28 + 4 + active + true + + + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v3/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ + + tenant.tenant-id + e81d842d3e8b45c5a59f57cd76af3aaf + + + + + + """ + + String changeAssignSDNCRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + changeassign + network-topology-operation + sdncCallback + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + NetworkActivateRequest + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + +String assignResponse = +""" 006927ca-f5a3-47fd-880c-dfcbcd81a093 200 OK 200006927ca-f5a3-47fd-880c-dfcbcd81a093Ynotsurewecarea9a77d5a-123e-4ca2-9eb9-0b015d2ee0fbGN_EVPN_direct_net_0_ST_noGW8abc633a-810b-4ca5-8b3a-09511d13a2ce """ + + String sdncRollbackRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + rollback + network-topology-operation + sdncCallback + + + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + NetworkActivateRequest + VID + + + + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MSO-dev-service-type + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + MSO_1610_dev + + + 8abc633a-810b-4ca5-8b3a-09511d13a2ce + CONTRAIL_EXTERNAL + MNS-25180-L-01-dmz_direct_net_1 + 7dd5365547234ee8937416c65507d266 + RDM2WAGPLCP + + +""" + + String sdncAdapterWorkflowResponse = + """ + + + 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 + 200 + OK + + <output xmlns="org:openecomp:sdnctl:vnf"><svc-request-id>00703dc8-71ff-442d-a4a8-3adc5beef6a9</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>MNS-25180-L-01-dmz_direct_net_1</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + +""" + + + String sdncAdapterWorkflowResponse_Error = + """ + + + + 400 + Error writing to l3-netework + Y + c79240d8-34b5-4853-af69-2021928dba00 + + + +""" + + String expected_sdncAdapterWorkflowResponse_Error = + """ + + + + 400 + Error writing to l3-netework + Y + c79240d8-34b5-4853-af69-2021928dba00 + + + +""" + + String sdncAdapterWorkflowFormattedResponse = + """ + + + 00703dc8-71ff-442d-a4a8-3adc5beef6a9 + 200 + Y + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + notsurewecare + + + +""" + + String falloutHandlerRequest = + """ + + b69c9054-da09-4a2c-adf5-51042b62bfac + UPDATE + PORTAL + + + Received error from SDN-C: No availability zone available. + 5300 + + """ + + String falloutHandlerRequestObject = + """ + + b69c9054-da09-4a2c-adf5-51042b62bfac + UPDATE + VID + + + Received error from SDN-C: No availability zone available + 7000 + + """ + + + String falloutHandlerRequest_Scenario01 = + """ + + b69c9054-da09-4a2c-adf5-51042b62bfac + UPDATE + VID + + + Unexpected Response from AAI - 400 + 7020 + + """ + + String completeMsoProcessRequest = + """ + + 88f65519-9a38-4c4b-8445-9eb4a5a5af56 + UPDATE + PORTAL + + BPMN Network action: UPDATE +""" + +// - - - - - - - - + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + + } + + public void initializeVariables (Execution mockExecution) { + + verify(mockExecution).setVariable("UPDNETI_messageId", "") + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "") + verify(mockExecution).setVariable("UPDNETI_UpdateNetworkInstanceInfraJsonRequest", "") + verify(mockExecution).setVariable("UPDNETI_networkRequest", "") + verify(mockExecution).setVariable("UPDNETI_networkInputs", "") + verify(mockExecution).setVariable("UPDNETI_networkOutputs", "") + verify(mockExecution).setVariable("UPDNETI_requestId", "") + verify(mockExecution).setVariable("UPDNETI_source", "") + verify(mockExecution).setVariable("UPDNETI_networkId", "") + + verify(mockExecution).setVariable("UPDNETI_CompleteMsoProcessRequest", "") + verify(mockExecution).setVariable("UPDNETI_FalloutHandlerRequest", "") + verify(mockExecution).setVariable("UPDNETI_isSilentSuccess", false) + verify(mockExecution).setVariable("UPDNETI_isPONR", false) + + // AAI query Cloud Region + verify(mockExecution).setVariable("UPDNETI_queryCloudRegionRequest","") + verify(mockExecution).setVariable("UPDNETI_queryCloudRegionReturnCode","") + verify(mockExecution).setVariable("UPDNETI_queryCloudRegionResponse","") + verify(mockExecution).setVariable("UPDNETI_cloudRegionPo","") + verify(mockExecution).setVariable("UPDNETI_cloudRegionSdnc","") + verify(mockExecution).setVariable("UPDNETI_isCloudRegionGood", false) + + // AAI query Id + verify(mockExecution).setVariable("UPDNETI_queryIdAAIRequest","") + verify(mockExecution).setVariable("UPDNETI_queryIdAAIResponse", "") + verify(mockExecution).setVariable("UPDNETI_aaiIdReturnCode", "") + + // AAI query vpn binding + verify(mockExecution).setVariable("UPDNETI_queryVpnBindingAAIRequest","") + verify(mockExecution).setVariable("UPDNETI_queryVpnBindingAAIResponse", "") + verify(mockExecution).setVariable("UPDNETI_aaiQqueryVpnBindingReturnCode", "") + verify(mockExecution).setVariable("UPDNETI_vpnBindings", null) + verify(mockExecution).setVariable("UPDNETI_vpnCount", 0) + verify(mockExecution).setVariable("UPDNETI_routeCollection", "") + + // AAI query network policy + verify(mockExecution).setVariable("UPDNETI_queryNetworkPolicyAAIRequest","") + verify(mockExecution).setVariable("UPDNETI_queryNetworkPolicyAAIResponse", "") + verify(mockExecution).setVariable("UPDNETI_aaiQqueryNetworkPolicyReturnCode", "") + verify(mockExecution).setVariable("UPDNETI_networkPolicyUriList", null) + verify(mockExecution).setVariable("UPDNETI_networkPolicyCount", 0) + verify(mockExecution).setVariable("UPDNETI_networkCollection", "") + + // AAI query route table reference + verify(mockExecution).setVariable("UPDNETI_queryNetworkTableRefAAIRequest","") + verify(mockExecution).setVariable("UPDNETI_queryNetworkTableRefAAIResponse", "") + verify(mockExecution).setVariable("UPDNETI_aaiQqueryNetworkTableRefReturnCode", "") + verify(mockExecution).setVariable("UPDNETI_networkTableRefUriList", null) + verify(mockExecution).setVariable("UPDNETI_networkTableRefCount", 0) + verify(mockExecution).setVariable("UPDNETI_tableRefCollection", "") + + + // AAI requery Id + verify(mockExecution).setVariable("UPDNETI_requeryIdAAIRequest","") + verify(mockExecution).setVariable("UPDNETI_requeryIdAAIResponse", "") + verify(mockExecution).setVariable("UPDNETI_aaiRequeryIdReturnCode", "") + + // AAI update contrail + verify(mockExecution).setVariable("UPDNETI_updateContrailAAIUrlRequest","") + verify(mockExecution).setVariable("UPDNETI_updateContrailAAIPayloadRequest","") + verify(mockExecution).setVariable("UPDNETI_updateContrailAAIResponse", "") + verify(mockExecution).setVariable("UPDNETI_aaiUpdateContrailReturnCode", "") + + verify(mockExecution).setVariable("UPDNETI_updateNetworkRequest", "") + verify(mockExecution).setVariable("UPDNETI_updateNetworkResponse", "") + verify(mockExecution).setVariable("UPDNETI_rollbackNetworkRequest", "") + verify(mockExecution).setVariable("UPDNETI_rollbackNetworkResponse", "") + verify(mockExecution).setVariable("UPDNETI_networkReturnCode", "") + verify(mockExecution).setVariable("UPDNETI_rollbackNetworkReturnCode", "") + verify(mockExecution).setVariable("UPDNETI_isNetworkRollbackNeeded", false) + + verify(mockExecution).setVariable("UPDNETI_changeAssignSDNCRequest", "") + verify(mockExecution).setVariable("UPDNETI_changeAssignSDNCResponse", "") + verify(mockExecution).setVariable("UPDNETI_rollbackSDNCRequest", "") + verify(mockExecution).setVariable("UPDNETI_rollbackSDNCResponse", "") + verify(mockExecution).setVariable("UPDNETI_sdncReturnCode", "") + verify(mockExecution).setVariable("UPDNETI_rollbackSDNCReturnCode", "") + verify(mockExecution).setVariable("UPDNETI_isSdncRollbackNeeded", false) + verify(mockExecution).setVariable("UPDNETI_sdncResponseSuccess", false) + + verify(mockExecution).setVariable("UPDNETI_updateDBRequest", "") + verify(mockExecution).setVariable("UPDNETI_updateDBResponse", "") + verify(mockExecution).setVariable("UPDNETI_dbReturnCode", "") + + verify(mockExecution).setVariable("UPDNETI_isVnfBindingPresent", false) + verify(mockExecution).setVariable("UPDNETI_Success", false) + verify(mockExecution).setVariable("UPDNETI_serviceInstanceId", "") + verify(mockExecution).setVariable("GENGS_type", "service-instance") // Setting for Generic Sub Flow use + + + } + + @Test + //@Ignore + public void preProcessRequest_NetworkRequest() { + + println "************ preProcessRequest_Payload ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) + when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) + when(mockExecution.getVariable("requestAction")).thenReturn("UPDATE") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("vnfId")).thenReturn("") + when(mockExecution.getVariable("volumeGroupId")).thenReturn("") + when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") + when(mockExecution.getVariable("serviceType")).thenReturn("MOG") + when(mockExecution.getVariable("networkType")).thenReturn("modelName") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) + + when(mockExecution.getVariable("UPDNETI_messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("URN_mso_rollback")).thenReturn("true") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.preProcessRequest(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution).setVariable("prefix", "UPDNETI_") + + //verify variable initialization + initializeVariables(mockExecution) + + // Authentications + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") + + verify(mockExecution).setVariable("UPDNETI_UpdateNetworkInstanceInfraJsonRequest", jsonIncomingRequest) + //verify(mockExecution).setVariable("UPDNETI_networkRequest", expectedNetworkRequest) + //verify(mockExecution).setVariable("UPDNETI_networkInputs", expectedNetworkInputs) + //verify(mockExecution, atLeast(3)).setVariable("UPDNETI_networkOutputs", "") + + //verify(mockExecution).setVariable("UPDNETI_requestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //verify(mockExecution).setVariable("UPDNETI_source", "VID") + //verify(mockExecution).setVariable("UPDNETI_messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //verify(mockExecution, atLeast(1)).setVariable("GENGS_type", "service-instance") + + } + + + @Test + //@Ignore + public void preProcessRequest_MissingNetworkId() { + + println "************ preProcessRequest_MissingName() ************* " + + WorkflowException missingNameWorkflowException = new WorkflowException("UpdateNetworkInstanceInfra", 2500, "Variable 'network-id' value/element is missing.") + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) + when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) + when(mockExecution.getVariable("requestAction")).thenReturn("UPDATE") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("vnfId")).thenReturn("") + when(mockExecution.getVariable("volumeGroupId")).thenReturn("") + //when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") + when(mockExecution.getVariable("serviceType")).thenReturn("MOG") + when(mockExecution.getVariable("networkType")).thenReturn("modelName") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) + + when(mockExecution.getVariable("UPDNETI_messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("URN_mso_rollback")).thenReturn("true") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + try { + UpdateNetworkInstanceInfra.preProcessRequest(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") + verify(mockExecution, atLeast(1)).setVariable("prefix", "UPDNETI_") + + //verify variable initialization + initializeVariables(mockExecution) + + // Authentications + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") + + verify(mockExecution).setVariable("UPDNETI_UpdateNetworkInstanceInfraJsonRequest", jsonIncomingRequest) + //verify(mockExecution, atLeast(1)).setVariable("UPDNETI_networkOutputs", networkOutputs) + //verify(mockExecution).setVariable("UPDNETI_networkRequest", expectedNetworkRequestMissingNetworkId) + //verify(mockExecution).setVariable("UPDNETI_networkInputs", expectedNetworkInputs) + + //verify(mockExecution).setVariable("UPDNETI_requestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //verify(mockExecution).setVariable("UPDNETI_source", "VID") + //verify(mockExecution).setVariable("UPDNETI_messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + + verify(mockExecution).setVariable(eq("WorkflowException"), refEq(missingNameWorkflowException)) + + } + + @Test + //@Ignore + public void preProcessRequest_MissingCloudRegion() { + + println "************ preProcessRequest_MissingCloudRegion() ************* " + + WorkflowException missingCloudRegionWorkflowException = new WorkflowException("UpdateNetworkInstanceInfra", 2500, "requestDetails has missing 'aic-cloud-region' value/element.") + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) + when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) + when(mockExecution.getVariable("requestAction")).thenReturn("UPDATE") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("vnfId")).thenReturn("") + when(mockExecution.getVariable("volumeGroupId")).thenReturn("") + when(mockExecution.getVariable("networkId")).thenReturn("networkId") + when(mockExecution.getVariable("serviceType")).thenReturn("MOG") + when(mockExecution.getVariable("networkType")).thenReturn("modelName") + + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest_MissingCloudRegion) + when(mockExecution.getVariable("UPDNETI_messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("URN_mso_rollback")).thenReturn("true") + + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + try { + UpdateNetworkInstanceInfra.preProcessRequest(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).getVariable("isDebugLogEnabled") + verify(mockExecution, atLeast(1)).setVariable("prefix", "UPDNETI_") + + //verify variable initialization + initializeVariables(mockExecution) + + verify(mockExecution).setVariable("UPDNETI_messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + // Authentications + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") + + verify(mockExecution).setVariable("UPDNETI_UpdateNetworkInstanceInfraJsonRequest", jsonIncomingRequest_MissingCloudRegion) + //verify(mockExecution).setVariable("UPDNETI_networkRequest", "") + //verify(mockExecution).setVariable("UPDNETI_networkInputs", "") + //verify(mockExecution, atLeast(1)).setVariable("UPDNETI_networkOutputs", "") + + //verify(mockExecution).setVariable("UPDNETI_requestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //verify(mockExecution).setVariable("UPDNETI_source", "VID") + + verify(mockExecution).setVariable(eq("WorkflowException"), refEq(missingCloudRegionWorkflowException)) + + } + + @Test + //@Ignore + public void sendSyncResponse() { + + println "************ sendSyncResponse ************* " + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) + when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + //when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.sendSyncResponse(mockExecution) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UpdateNetworkInstanceInfraResponseCode", "202") + + + } + + @Test + //@Ignore + public void sendSyncError() { + + println "************ sendSyncError ************* " + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("isAsyncProcess")).thenReturn(true) + when(mockExecution.getVariable("mso-request-id")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + //when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.sendSyncError(mockExecution) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UpdateNetworkInstanceInfraResponseCode", "500") + + } + + + @Test + //@Ignore + public void prepareDBRequest() { + + println "************ prepareDBRequest ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("UPDNETI_networkOutputs")).thenReturn("") + when(mockExecution.getVariable("UPDNETI_requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("UPDNETI_orchestrationStatus")).thenReturn("") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.prepareDBRequest(mockExecution) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_updateDBRequest", updateDBRequest) + + } + + @Test + //@Ignore + public void prepareDBRequestErro_ExceptionObject() { + + println "************ prepareDBRequest ************* " + + WorkflowException sndcWorkflowException = new WorkflowException("UpdateNetworkInstanceInfra", 500, "Received error from SDN-C: No availability zone available") + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("UPDNETI_networkOutputs")).thenReturn("") + when(mockExecution.getVariable("UPDNETI_requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("UPDNETI_networkOutputs")).thenReturn("") + when(mockExecution.getVariable("UPDNETI_orchestrationStatus")).thenReturn("") + when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowException) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.prepareDBRequestError(mockExecution) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_updateDBRequest", updateDBRequestError) + + } + + @Test + //@Ignore + public void prepareDBRequest_Outputs() { + + println "************ prepareDBRequest ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("UPDNETI_networkOutputs")).thenReturn(networkOutputs) + when(mockExecution.getVariable("UPDNETI_requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("UPDNETI_orchestrationStatus")).thenReturn("") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.prepareDBRequest(mockExecution) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_updateDBRequest", updateDBRequest_Outputs) + + } + + @Test + //@Ignore + public void prepareUpdateNetworkRequest() { + + println "************ prepareNetworkRequest ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("UPDNETI_networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable("UPDNETI_requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable("UPDNETI_cloudRegionPo")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable("UPDNETI_messageId")).thenReturn("messageId_generated") + when(mockExecution.getVariable("UPDNETI_source")).thenReturn("VID") + //when(mockExecution.getVariable("UPDNETI_queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) + when(mockExecution.getVariable("UPDNETI_routeCollection")).thenReturn("13979:10575713979:105757") + when(mockExecution.getVariable("UPDNETI_networkCollection")).thenReturn("GN_EVPN_Test") + when(mockExecution.getVariable("UPDNETI_tableRefCollection")).thenReturn("refFQDN1refFQDN2") + when(mockExecution.getVariable("UPDNETI_requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UPDNETI_rollbackEnabled")).thenReturn("true") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.prepareUpdateNetworkRequest(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + // verify set prefix = "UPDNETI_" + verify(mockExecution).setVariable("prefix", "UPDNETI_") + + verify(mockExecution).setVariable("UPDNETI_updateNetworkRequest", updateNetworkRequest) + + } + + + @Test + //@Ignore + public void prepareUpdateNetworkRequest_NoPhysicalname() { + + println "************ prepareNetworkRequest ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("UPDNETI_networkRequest")).thenReturn(NetworkRequest_noPhysicalName) + when(mockExecution.getVariable("UPDNETI_requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable("UPDNETI_cloudRegionPo")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable("UPDNETI_messageId")).thenReturn("messageId_generated") + when(mockExecution.getVariable("UPDNETI_source")).thenReturn("VID") + //when(mockExecution.getVariable("UPDNETI_queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) + when(mockExecution.getVariable("UPDNETI_routeCollection")).thenReturn("13979:10575713979:105757") + when(mockExecution.getVariable("UPDNETI_networkCollection")).thenReturn("GN_EVPN_Test") + when(mockExecution.getVariable("UPDNETI_tableRefCollection")).thenReturn("") + when(mockExecution.getVariable("UPDNETI_requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UPDNETI_rollbackEnabled")).thenReturn("true") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.prepareUpdateNetworkRequest(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + // verify set prefix = "UPDNETI_" + verify(mockExecution).setVariable("prefix", "UPDNETI_") + + verify(mockExecution).setVariable("UPDNETI_updateNetworkRequest", updateNetworkRequest_noPhysicalName) + + } + + @Test + //@Ignore + public void prepareSDNCRequest() { + + println "************ prepareSDNCRequest ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("UPDNETI_networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable("UPDNETI_cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable("UPDNETI_serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("openecomp-mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://localhost:28090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") + + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.prepareSDNCRequest(mockExecution) + + // verify set prefix = "UPDNETI_" + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_changeAssignSDNCRequest", changeAssignSDNCRequest) + + } + + @Test + //@Ignore + public void prepareSDNCRollbackRequest() { + + println "************ prepareSDNCRollbackRequest ************* " + + + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("UPDNETI_networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable("UPDNETI_cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable("UPDNETI_serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("UPDNETI_changeAssignSDNCResponse")).thenReturn(assignResponse) + when(mockExecution.getVariable("openecomp-mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://localhost:28090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.prepareSDNCRollbackRequest(mockExecution) + + // verify set prefix = "UPDNETI_" + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_rollbackSDNCRequest", sdncRollbackRequest) + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkId_200() { + + println "************ callRESTQueryAAINetworkId ************* " + + WireMock.reset(); + + MockGetNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", 200); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("UPDNETI_networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable("UPDNETI_messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.callRESTQueryAAINetworkId(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_queryIdAAIRequest", "http://localhost:28090/aai/v8/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4") + verify(mockExecution).setVariable("UPDNETI_aaiIdReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAICloudRegion30_200() { + + println "************ callRESTQueryAAICloudRegion30_200 ************* " + + WireMock.reset(); + MockGetCloudRegion("RDM2WAGPLCP", 200, "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml") + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn("UPDNETI_") + when(mockExecution.getVariable("UPDNETI_networkInputs")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.callRESTQueryAAICloudRegion(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_queryCloudRegionRequest", "http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP") + verify(mockExecution, atLeast(2)).setVariable("UPDNETI_queryCloudRegionReturnCode", "200") + verify(mockExecution).setVariable("UPDNETI_isCloudRegionGood", true) + + } + + @Test + //@Ignore + public void callRESTQueryAAICloudRegion25_200() { + + println "************ callRESTQueryAAICloudRegion25_200 ************* " + + WireMock.reset(); + MockGetCloudRegion("RDM2WAGPLCP", 200, "CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml") + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn("UPDNETI_") + when(mockExecution.getVariable("UPDNETI_networkInputs")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.callRESTQueryAAICloudRegion(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_queryCloudRegionRequest", "http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP") + verify(mockExecution, atLeast(2)).setVariable("UPDNETI_queryCloudRegionReturnCode", "200") + verify(mockExecution).setVariable("UPDNETI_isCloudRegionGood", true) + + } + + @Test + //@Ignore + public void callRESTQueryAAICloudRegion_NotFound() { + + println "************ callRESTQueryAAICloudRegionFake ************* " + + WireMock.reset(); + MockGetCloudRegion("MDTWNJ21", 404, "") + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn("UPDNETI_") + when(mockExecution.getVariable("UPDNETI_networkInputs")).thenReturn(vnfRequestFakeRegion) + when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_cloud_region_uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.callRESTQueryAAICloudRegion(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_queryCloudRegionRequest", "http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/MDTWNJ21") + verify(mockExecution, atLeast(1)).setVariable("UPDNETI_queryCloudRegionReturnCode", "404") + verify(mockExecution).setVariable("UPDNETI_cloudRegionPo", "MDTWNJ21") + verify(mockExecution).setVariable("UPDNETI_cloudRegionSdnc", "AAIAIC25") + verify(mockExecution).setVariable("UPDNETI_isCloudRegionGood", true) + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkVpnBinding_200() { + + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + + WireMock.reset(); + MockGetNetworkVpnBinding("85f015d0-2e32-4c30-96d2-87a1a27f8017", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200) + MockGetNetworkVpnBinding("c980a6ef-3b88-49f0-9751-dbad8608d0a6", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("UPDNETI_requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) // v6 + when(mockExecution.getVariable("UPDNETI_messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vpn_binding_uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") +// when(mockExecution.getVariable("URN_mso_workflow_UpdateNetworkInstanceInfra_aai_network_vpn-binding_uri")).thenReturn("") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.callRESTQueryAAINetworkVpnBinding(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_vpnCount", 2) + verify(mockExecution).setVariable("UPDNETI_vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable("UPDNETI_queryVpnBindingAAIRequest", "http://localhost:28090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017") + verify(mockExecution, atLeast(2)).setVariable("UPDNETI_aaiQqueryVpnBindingReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkVpnBinding_TestScenario01_200() { + + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + + WireMock.reset(); + MockGetNetworkVpnBinding("85f015d0-2e32-4c30-96d2-87a1a27f8017", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200) + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("UPDNETI_requeryIdAAIResponse")).thenReturn(queryIdAIIResponseTestScenario01) + when(mockExecution.getVariable("UPDNETI_messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vpn_binding_uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") +// when(mockExecution.getVariable("URN_mso_workflow_UpdateNetworkInstanceInfra_aai_network_vpn-binding_uri")).thenReturn("") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.callRESTQueryAAINetworkVpnBinding(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_vpnCount", 1) + verify(mockExecution).setVariable("UPDNETI_vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable("UPDNETI_queryVpnBindingAAIRequest", "http://localhost:28090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017") + verify(mockExecution).setVariable("UPDNETI_aaiQqueryVpnBindingReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkVpnBinding_200_URN_Uri() { + + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + + WireMock.reset(); + MockGetNetworkVpnBinding("85f015d0-2e32-4c30-96d2-87a1a27f8017", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200) + MockGetNetworkVpnBinding("c980a6ef-3b88-49f0-9751-dbad8608d0a6", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("UPDNETI_requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable("UPDNETI_messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vpn_binding_uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.callRESTQueryAAINetworkVpnBinding(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_vpnCount", 2) + verify(mockExecution).setVariable("UPDNETI_vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable("UPDNETI_queryVpnBindingAAIRequest", "http://localhost:28090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017") + verify(mockExecution, atLeast(2)).setVariable("UPDNETI_aaiQqueryVpnBindingReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkVpnBinding_NotPresent() { + + println "************ callRESTQueryAAINetworkVpnBinding_NotPresent ************* " + + WireMock.reset(); + MockGetNetworkVpnBinding("85f015d0-2e32-4c30-96d2-87a1a27f8017", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200) + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + + when(mockExecution.getVariable("UPDNETI_requeryIdAAIResponse")).thenReturn(queryIdAIIResponseVpnNotPresent) + when(mockExecution.getVariable("UPDNETI_messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.callRESTQueryAAINetworkVpnBinding(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_aaiQqueryVpnBindingReturnCode", "200") + verify(mockExecution).setVariable("UPDNETI_vpnCount", 0) + verify(mockExecution).setVariable("UPDNETI_queryVpnBindingAAIResponse", aaiVpnResponseStub) + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkTableRef_200() { + + println "************ callRESTQueryAAINetworkTableRef_200 ************* " + + WireMock.reset(); + MockGetNetworkRouteTable("refFQDN1", "CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", 200) + MockGetNetworkRouteTable("refFQDN2", "CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", 200) + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("UPDNETI_requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable("UPDNETI_messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_route_table_reference_uri")).thenReturn("/aai/v8/network/route-table-references/route-table-reference") +// when(mockExecution.getVariable("URN_mso_workflow_CreateNetworkInstanceInfra_aai_network_table_reference_uri")).thenReturn("") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.callRESTQueryAAINetworkTableRef(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_networkTableRefCount", 2) + verify(mockExecution).setVariable("UPDNETI_networkTableRefUriList", ['/aai/v8/network/route-table-references/route-table-reference/refFQDN1','/aai/v8/network/route-table-references/route-table-reference/refFQDN2']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable("UPDNETI_queryNetworkTableRefAAIRequest", "http://localhost:28090/aai/v8/network/route-table-references/route-table-reference/refFQDN1") + verify(mockExecution, atLeast(2)).setVariable("UPDNETI_aaiQqueryNetworkTableRefReturnCode", "200") + + } + + @Test + //@Ignore + public void callRESTQueryAAINetworkPolicy_200() { + + println "************ callRESTQueryAAINetworkPolicy_200 ************* " + + WireMock.reset(); + MockGetNetworkPolicy("cee6d136-e378-4678-a024-2cd15f0ee0cg", "UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", 200) + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("UPDNETI_requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable("UPDNETI_messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_network_policy_uri")).thenReturn("/aai/v8/network/network-policies/network-policy") +// when(mockExecution.getVariable("URN_mso_workflow_UpdateNetworkInstanceInfra_aai_network_policy_uri")).thenReturn("") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.callRESTQueryAAINetworkPolicy(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_networkPolicyCount", 1) + verify(mockExecution).setVariable("UPDNETI_networkPolicyUriList", ['/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg']) + // the last vpnBinding value is saved. + verify(mockExecution).setVariable("UPDNETI_queryNetworkPolicyAAIRequest", "http://localhost:28090/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg") + verify(mockExecution).setVariable("UPDNETI_aaiQqueryNetworkPolicyReturnCode", "200") + + } + + + @Test + //@Ignore + public void callRESTReQueryAAINetworkId_200() { + + println "************ callRESTReQueryAAINetworkId ************* " + + WireMock.reset(); + MockGetNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", 200) + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("UPDNETI_changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowFormattedResponse) + when(mockExecution.getVariable("UPDNETI_messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.callRESTReQueryAAINetworkId(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_requeryIdAAIRequest", "http://localhost:28090/aai/v8/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4") + verify(mockExecution).setVariable("UPDNETI_aaiRequeryIdReturnCode", "200") + + } + + + @Test + //@Ignore + public void callRESTUpdateContrailAAINetworkREST_200() { + + println "************ callRESTUpdateContrailAAINetwork ************* " + + WireMock.reset(); + MockPutNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", 200, "UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml") + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("UPDNETI_changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowFormattedResponse) + when(mockExecution.getVariable("UPDNETI_requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable("UPDNETI_updateNetworkResponse")).thenReturn(updateNetworkResponseREST) + when(mockExecution.getVariable("UPDNETI_messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") + when(mockExecution.getVariable("URN_aai_endpoint")).thenReturn("http://localhost:28090") + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn("8") + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("URN_aai_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + // preProcessRequest(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.callRESTUpdateContrailAAINetwork(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(6)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadResponseActual = arg2List.get(4) + + assertEquals(updateContrailAAIResponse.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_updateContrailAAIUrlRequest", "http://localhost:28090/aai/v8/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4") + verify(mockExecution).setVariable("UPDNETI_updateContrailAAIPayloadRequest", updateContrailAAIPayloadRequest) + verify(mockExecution).setVariable("UPDNETI_aaiUpdateContrailReturnCode", "200") + verify(mockExecution).setVariable("UPDNETI_isPONR", true) + + } + + + + @Test + //@Ignore + public void validateUpdateNetworkResponseREST() { + + println "************ validateNetworkResponse ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UPDNETI_updateNetworkResponse")).thenReturn(updateNetworkResponseREST) + when(mockExecution.getVariable("UPDNETI_networkReturnCode")).thenReturn('200') + + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.validateUpdateNetworkResponse(mockExecution) + + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_updateNetworkResponse", updateNetworkResponseREST) + verify(mockExecution).setVariable("UPDNETI_isNetworkRollbackNeeded", true) + verify(mockExecution).setVariable("UPDNETI_rollbackNetworkRequest", updateRollbackNetworkRequest) + + } + + @Test + //@Ignore + public void validateUpdateNetworkResponseREST_Error() { + + println "************ validateNetworkResponse ************* " + + WorkflowException workflowException = new WorkflowException("UpdateNetworkInstanceInfra", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UPDNETI_updateNetworkResponse")).thenReturn(networkException500) + when(mockExecution.getVariable("UPDNETI_networkReturnCode")).thenReturn('500') + + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + try { + UpdateNetworkInstanceInfra.validateUpdateNetworkResponse(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution, atLeast(1)).setVariable("WorkflowException", refEq(workflowException, any(WorkflowException.class))) + + } + + @Test + //@Ignore + public void validateSDNCResponse() { + + println "************ validateSDNCResponse ************* " + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UPDNETI_changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse) + when(mockExecution.getVariable("prefix")).thenReturn("UPDNETI_") + when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) + when(mockExecution.getVariable("UPDNETI_sdncReturnCode")).thenReturn("200") + when(mockExecution.getVariable("UPDNETI_isResponseGood")).thenReturn(true) + + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + try { + UpdateNetworkInstanceInfra.validateSDNCResponse(mockExecution) + verify(mockExecution).setVariable("UPDNETI_isSdncRollbackNeeded", true) + verify(mockExecution).setVariable("UPDNETI_rollbackSDNCRequest", "") + + } catch (Exception ex) { + println " Graceful Exit - " + ex.getMessage() + } + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + //verify(mockExecution).setVariable("UPDNETI_isSdncRollbackNeeded", true) + + } + + @Test + //@Ignore + public void validateSDNCResponse_Error() { + + println "************ validateSDNCResponse ************* " + //ExecutionEntity mockExecution = mock(ExecutionEntity.class) + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UPDNETI_changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse_Error) + when(mockExecution.getVariable("prefix")).thenReturn("UPDNETI_") + when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(false) + when(mockExecution.getVariable("UPDNETI_sdncReturnCode")).thenReturn("200") + when(mockExecution.getVariable("UPDNETI_isResponseGood")).thenReturn(true) + + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + try { + UpdateNetworkInstanceInfra.validateSDNCResponse(mockExecution) + } catch (Exception ex) { + println " Graceful Exit! - " + ex.getMessage() + } + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + // verify set prefix = "UPDNETI_" + //verify(mockExecution).setVariable("UPDNETI_sdncResponseSuccess", false) + + } + + + + @Test + //@Ignore + public void postProcessResponse() { + + println "************ postProcessResponse ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UPDNETI_source")).thenReturn("PORTAL") + when(mockExecution.getVariable("UPDNETI_requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("UPDNETI_dbReturnCode")).thenReturn("200") + + // postProcessResponse(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.postProcessResponse(mockExecution) + + // check the sequence of variable invocation + //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() + //preDebugger.printInvocations(mockExecution) + + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_Success", true) + verify(mockExecution).setVariable("UPDNETI_CompleteMsoProcessRequest", completeMsoProcessRequest) + + } + + @Test + //@Ignore + public void validateRollbackResponses_Good() { + + WorkflowException workflowException = new WorkflowException("UpdateNetworkInstanceInfra", 2500, "AAI Update Contrail Failed. Error 404.") + WorkflowException expectedWorkflowException = new WorkflowException("UpdateNetworkInstanceInfra", 2500, "AAI Update Contrail Failed. Error 404. + PO Network rollback is not supported for Update. Submit another Update to restore/rollback. + SNDC rollback completed.") + + println "************ validateRollbackResponses_Good() ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("prefix")).thenReturn("UPDNETI_") + + when(mockExecution.getVariable("UPDNETI_isNetworkRollbackNeeded")).thenReturn(true) + when(mockExecution.getVariable("UPDNETI_rollbackNetworkReturnCode")).thenReturn("200") + when(mockExecution.getVariable("UPDNETI_rollbackNetworkResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable("UPDNETI_isSdncRollbackNeeded")).thenReturn(true) + when(mockExecution.getVariable("UPDNETI_rollbackSDNCReturnCode")).thenReturn("200") + when(mockExecution.getVariable("UPDNETI_rollbackSDNCResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.validateRollbackResponses(mockExecution) + + // verify set prefix = "UPDNETI_" + verify(mockExecution, atLeast(1)).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("WorkflowException", refEq(expectedWorkflowException, any(WorkflowException.class))) + + } + + @Test + //@Ignore + public void validateRollbackResponses_Failed() { + + WorkflowException workflowException = new WorkflowException("UpdateNetworkInstanceInfra", 7020, "AAI Update Contrail Failed. Error 404.") + WorkflowException expectedWorkflowException = new WorkflowException("UpdateNetworkInstanceInfra", 7020, "AAI Update Contrail Failed. Error 404. + PO Network rollback is not supported for Update. Submit another Update to restore/rollback. + SDNC rollback failed. ") + + println "************ validateRollbackResponses_Failed() ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("prefix")).thenReturn("UPDNETI_") + + when(mockExecution.getVariable("UPDNETI_isNetworkRollbackNeeded")).thenReturn(true) + when(mockExecution.getVariable("UPDNETI_rollbackNetworkReturnCode")).thenReturn("404") + when(mockExecution.getVariable("UPDNETI_rollbackNetworkResponse")).thenReturn("BadResponse") + when(mockExecution.getVariable("UPDNETI_isSdncRollbackNeeded")).thenReturn(true) + when(mockExecution.getVariable("UPDNETI_rollbackSDNCReturnCode")).thenReturn("500") + when(mockExecution.getVariable("UPDNETI_rollbackSDNCResponse")).thenReturn("BadResponse") + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.validateRollbackResponses(mockExecution) + + // verify set prefix = "UPDNETI_" + verify(mockExecution, atLeast(1)).setVariable("prefix", "UPDNETI_") + verify(mockExecution, atLeast(1)).setVariable("WorkflowException", refEq(expectedWorkflowException, any(WorkflowException.class))) + + } + + @Test + //@Ignore + public void validateRollbackResponses_NetworkFailed() { + + WorkflowException workflowException = new WorkflowException("UpdateNetworkInstanceInfra", 7020, "AAI Update Contrail Failed. Error 404.") + WorkflowException expectedWorkflowExceptionFailed = new WorkflowException("UpdateNetworkInstanceInfra", 7020, "AAI Update Contrail Failed. Error 404. + PO Network rollback is not supported for Update. Submit another Update to restore/rollback. + SNDC rollback completed.") + + println "************ validateRollbackResponses_NetworkFailed() ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("prefix")).thenReturn("UPDNETI_") + + when(mockExecution.getVariable("UPDNETI_isNetworkRollbackNeeded")).thenReturn(true) + when(mockExecution.getVariable("UPDNETI_rollbackNetworkReturnCode")).thenReturn("404") + when(mockExecution.getVariable("UPDNETI_rollbackNetworkResponse")).thenReturn("BadResponse") + when(mockExecution.getVariable("UPDNETI_isSdncRollbackNeeded")).thenReturn(true) + when(mockExecution.getVariable("UPDNETI_rollbackSDNCReturnCode")).thenReturn("200") + when(mockExecution.getVariable("UPDNETI_rollbackSDNCResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.validateRollbackResponses(mockExecution) + + // verify set prefix = "UPDNETI_" + verify(mockExecution, atLeast(1)).setVariable("prefix", "UPDNETI_") + verify(mockExecution, atLeast(1)).setVariable("WorkflowException", refEq(expectedWorkflowExceptionFailed , any(WorkflowException.class))) + + } + + @Test + //@Ignore + public void validateRollbackResponses_SdncFailed() { + + WorkflowException workflowException = new WorkflowException("UpdateNetworkInstanceInfra", 7020, "AAI Update Contrail Failed. Error 404.") + WorkflowException expectedWorkflowException = new WorkflowException("UpdateNetworkInstanceInfra", 7020, "AAI Update Contrail Failed. Error 404. + PO Network rollback is not supported for Update. Submit another Update to restore/rollback. + SDNC rollback failed. ") + + println "************ validateRollbackResponses_SdncFailed() ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("prefix")).thenReturn("UPDNETI_") + + when(mockExecution.getVariable("UPDNETI_isNetworkRollbackNeeded")).thenReturn(true) + when(mockExecution.getVariable("UPDNETI_rollbackNetworkReturnCode")).thenReturn("200") + when(mockExecution.getVariable("UPDNETI_rollbackNetworkResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable("UPDNETI_isSdncRollbackNeeded")).thenReturn(true) + when(mockExecution.getVariable("UPDNETI_rollbackSDNCReturnCode")).thenReturn("200") + when(mockExecution.getVariable("UPDNETI_rollbackSDNCResponse")).thenReturn("400") + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.validateRollbackResponses(mockExecution) + + // verify set prefix = "UPDNETI_" + verify(mockExecution, atLeast(1)).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("WorkflowException", refEq(expectedWorkflowException , any(WorkflowException.class))) + + } + + @Test + //@Ignore + public void validateRollbackResponses_NoRollbacks() { + + WorkflowException workflowException = new WorkflowException("UpdateNetworkInstanceInfra", 2500, " AAI Update Contrail Failed. Error 404") + WorkflowException expectedWorkflowException = new WorkflowException("UpdateNetworkInstanceInfra", 2500, " AAI Update Contrail Failed. Error 404") + + println "************ validateRollbackResponses_NoRollbacks() ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("prefix")).thenReturn("UPDNETI_") + + when(mockExecution.getVariable("UPDNETI_isNetworkRollbackNeeded")).thenReturn(false) + when(mockExecution.getVariable("UPDNETI_rollbackNetworkReturnCode")).thenReturn("200") + when(mockExecution.getVariable("UPDNETI_rollbackNetworkResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable("UPDNETI_isSdncRollbackNeeded")).thenReturn(false) + when(mockExecution.getVariable("UPDNETI_rollbackSDNCReturnCode")).thenReturn("200") + when(mockExecution.getVariable("UPDNETI_rollbackSDNCResponse")).thenReturn("GoodResponse") + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.validateRollbackResponses(mockExecution) + + // verify set prefix = "UPDNETI_" + verify(mockExecution, atLeast(1)).setVariable("prefix", "UPDNETI_") + //verify(mockExecution, atLeast(1)).setVariable("WorkflowException", any(expectedWorkflowException)) + verify(mockExecution, atLeast(1)).setVariable("WorkflowException", refEq(expectedWorkflowException, any(WorkflowException.class))) + + } + + + @Test + //@Ignore + public void buildErrorResponse() { + + println "************ buildErrorResponse ************* " + + + WorkflowException sndcWorkflowException = new WorkflowException("UpdateNetworkInstanceInfra", 5300, "Received error from SDN-C: No availability zone available.") + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UPDNETI_requestId")).thenReturn("b69c9054-da09-4a2c-adf5-51042b62bfac") + when(mockExecution.getVariable("UPDNETI_source")).thenReturn("PORTAL") + when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowException) + + // buildErrorResponse(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.buildErrorResponse(mockExecution) + + // verify set prefix = "UPDNETI_" + verify(mockExecution, atLeast(1)).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_Success", false) + verify(mockExecution).setVariable("UPDNETI_FalloutHandlerRequest", falloutHandlerRequest) + + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + } + + @Test + //@Ignore + public void buildErrorResponse_WorkflowExceptionObject() { + + println "************ buildErrorResponse ************* " + + WorkflowException sndcWorkflowException = new WorkflowException("UpdateNetworkInstanceInfra", 7000, "Received error from SDN-C: No availability zone available") + + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UPDNETI_requestId")).thenReturn("b69c9054-da09-4a2c-adf5-51042b62bfac") + when(mockExecution.getVariable("UPDNETI_source")).thenReturn("VID") + when(mockExecution.getVariable("WorkflowException")).thenReturn(sndcWorkflowException) + + // buildErrorResponse(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.buildErrorResponse(mockExecution) + + // verify set prefix = "UPDNETI_" + verify(mockExecution).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_Success", false) + verify(mockExecution).setVariable("UPDNETI_FalloutHandlerRequest", falloutHandlerRequestObject) + + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + } + + @Test + //@Ignore + public void buildErrorResponse_Scenario01() { + + WorkflowException aaiWorkflowException_Secnario01 = new WorkflowException("UpdateNetworkInstanceInfra", 7020, "Unexpected Response from AAI - 400") + + println "************ buildErrorResponse ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("UPDNETI_requestId")).thenReturn("b69c9054-da09-4a2c-adf5-51042b62bfac") + when(mockExecution.getVariable("UPDNETI_source")).thenReturn("VID") + when(mockExecution.getVariable("WorkflowException")).thenReturn(aaiWorkflowException_Secnario01) + when(mockExecution.getVariable("UPDNETI_dbReturnCode")).thenReturn("200") + when(mockExecution.getVariable("UPDNETI_updateDBResponse")).thenReturn("") + + when(mockExecution.getVariable("UPDNETI_aaiRequeryIdReturnCode")).thenReturn("400") + + // buildErrorResponse(Execution execution) + UpdateNetworkInstanceInfra UpdateNetworkInstanceInfra = new UpdateNetworkInstanceInfra() + UpdateNetworkInstanceInfra.buildErrorResponse(mockExecution) + + // verify set prefix = "UPDNETI_" + verify(mockExecution, atLeast(1)).setVariable("prefix", "UPDNETI_") + verify(mockExecution).setVariable("UPDNETI_Success", false) + verify(mockExecution).setVariable("UPDNETI_FalloutHandlerRequest", falloutHandlerRequest_Scenario01) + + //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + //debugger.printInvocations(mockExecution) + + } + + + private ExecutionEntity setupMock() { + + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn("UpdateNetworkInstanceInfra") + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("UpdateNetworkInstanceInfra") + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + + when(mockExecution.getId()).thenReturn("100") + when(mockExecution.getProcessDefinitionId()).thenReturn("UpdateNetworkInstanceInfra") + when(mockExecution.getProcessInstanceId()).thenReturn("UpdateNetworkInstanceInfra") + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) + + return mockExecution + } + + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy new file mode 100644 index 0000000000..2e9efad215 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy @@ -0,0 +1,93 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.scripts; + +import static org.junit.Assert.* +import static org.mockito.Mockito.* + +import org.junit.Before +import org.junit.Ignore +import org.junit.Rule +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +@RunWith(MockitoJUnitRunner.class) +@Ignore // No Junits exists in this class to run +class UpdateVfModuleVolumeInfraV1Test { + + String xml = """ + + + tenant + https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ + + tenant.tenant-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mdt1 + + + tenant.tenant-name + ECOMP_MDT1 + + + + vf-module + https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ + + vf-module.vf-module-ids + fba1bd1e195a404cacb9ce17a9b2b421 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mdt1 + + + vf-module.vf-module-name + ECOMP_MDT1 + + + +""" + + @Rule + public WireMockRule wireMockRule = new WireMockRule(28090); + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + + } +} 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 new file mode 100644 index 0000000000..7a9864caa5 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleInfraTest.java @@ -0,0 +1,243 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure; + +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetCloudRegion; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkPolicyfqdn; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutNetwork; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPost; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; +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. + * + * @throws Exception + */ + @Test + @Deployment(resources = { + "process/CreateVfModuleInfra.bpmn", + "subprocess/DoCreateVfModule.bpmn", + "subprocess/SDNCAdapterV1.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 sunnyDayVID() throws Exception { + + logStart(); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5); + MockGetGenericVnfById("skask", "VfModularity/GenericVnf.xml", 200); + MockPutVfModuleIdNoResponse("skask", "PCRF", ".*"); + MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200); + MockPutGenericVnf("skask"); + mockVNFPost("", 202, "skask"); + mockSDNCAdapter("/SDNCAdapter", "vnf-type>STMTN", 200, "VfModularity/StandardSDNCSynchResponse.xml"); + mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 200, "VfModularity/StandardSDNCSynchResponse.xml"); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + String createVfModuleRequest = + FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"); + + Map 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 setupVariablesSunnyDayVID() { + Map 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 + @Deployment(resources = { + "process/CreateVfModuleInfra.bpmn", + "subprocess/DoCreateVfModule.bpmn", + "subprocess/SDNCAdapterV1.bpmn", + "subprocess/VnfAdapterRestV1.bpmn", + "subprocess/ConfirmVolumeGroupTenant.bpmn", + "subprocess/ConfirmVolumeGroupName.bpmn", + "subprocess/CreateAAIVfModule.bpmn", + "subprocess/CreateAAIVfModuleVolumeGroup.bpmn", + "subprocess/UpdateAAIVfModule.bpmn", + "subprocess/UpdateAAIGenericVnf.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/FalloutHandler.bpmn" + }) + public void sunnyDayVIDWithVolumeGroupAttach() throws Exception { + + logStart(); + + MockGetVolumeGroupById("AAIAIC25", "78987", "VfModularity/VolumeGroup.xml"); + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockGetCloudRegion("MDTWNJ21", 200, "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml"); + MockGetVolumeGroupById("RDM2WAGPLCP", "78987", "DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml"); + MockPutVfModuleIdNoResponse("skask", "PCRF", ".*"); + mockVNFPost("", 202, "skask"); + MockGetNetworkPolicyfqdn(".*", "VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml", 200); + MockPutGenericVnf("skask"); + MockGetGenericVnfByIdWithPriority("skask", ".*", 200, "VfModularity/VfModule-new.xml", 5); + 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"); + + String businessKey = UUID.randomUUID().toString(); + String createVfModuleRequest = + FileUtil.readResourceFile("__files/CreateVfModuleVolumeGroup_VID_request.json"); + + Map 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 setupVariablesSunnyDayVIDWVolumeAttach() { + Map 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 new file mode 100644 index 0000000000..e70f48d758 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVfModuleVolumeInfraV1Test.java @@ -0,0 +1,306 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure; + +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVolumeGroupById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupByName; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVolumeGroupById; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockPostVNFVolumeGroup; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; +import org.openecomp.mso.bpmn.mock.FileUtil; + +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("volumeGroupException", FileUtil.readResourceFile( + "__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml")); + callbacks.put("volumeGroupRollback", FileUtil.readResourceFile( + "__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml")); + } + + /** + * Happy path scenario for VID + *****************************/ + @Test + @Deployment(resources = {"process/CreateVfModuleVolumeInfraV1.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/DoCreateVfModuleVolumeV1.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 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(); + } + + /** + * Happy path scenario for VID + *****************************/ + @Test + @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 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 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 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 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 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 new file mode 100644 index 0000000000..80c1e8c215 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/CreateVnfInfraTest.java @@ -0,0 +1,220 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * 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.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; +import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByName_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.BPMNUtil; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; +import org.openecomp.mso.bpmn.mock.FileUtil; + +/** + * Unit Test for the CreateVnfInfra Flow + */ +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 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(); + + //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 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 + @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 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 + @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 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 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 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/DeleteVfModuleInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java new file mode 100644 index 0000000000..a6ae368fd3 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleInfraTest.java @@ -0,0 +1,579 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * 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.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Ignore; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; +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 = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " true" + EOL + + " {{MESSAGE-ID}}" + EOL + + " " + EOL + + " " + EOL + + " policyKey1_contrail_network_policy_fqdn" + EOL + + " MSOTest:DefaultPolicyFQDN1" + EOL + + "" + EOL + + "" + EOL + + "policyKey2_contrail_network_policy_fqdn" + EOL + + "MSOTest:DefaultPolicyFQDN2" + EOL + + "" + EOL + + " " + EOL + + " oam_management_v4_address" + EOL + + " 1234" + EOL + + "" + EOL + + " " + EOL + + " oam_management_v6_address" + EOL + + " 1234" + EOL + + "" + EOL + + "" + EOL + + "" + EOL; + + private final String vnfAdapterDeleteCallbackFail = + "" + EOL + + " Error processing request to VNF-Async. Not Found." + EOL + + " INTERNAL" + EOL + + " false" + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL; + + private final String sdncAdapterDeleteCallback = + "" + EOL + + " {{REQUEST-ID}}" + EOL + + " Y" + EOL + + "" + 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 = + "" + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " asc_heat-int" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 00000000-0000-0000-0000-000000000000" + EOL + + " SDN-ETHERNET-INTERNET" + EOL + + " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + + " pending-delete" + EOL + + " RDM2WAGPLCP" + EOL + + " " + EOL + + " " + EOL + + "" + 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 = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 1508691" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 1508692" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + 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 = + "" + EOL + + " 2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4" + EOL + + " STMTN5MMSC20" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 1508691" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC20-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 1508692" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " STMTN5MMSC20-MMSC::module-1-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " 1.0" + EOL + + " false" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 1508692" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + 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 = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000021" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000073" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + 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 = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c720" + EOL + + " STMTN5MMSC20" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000020" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " STMTN5MMSC20-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000074" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + + " STMTN5MMSC20-MMSC::module-1-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + + " 1.0" + EOL + + " false" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000075" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + 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 = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c719" + EOL + + " STMTN5MMSC19" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000019" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a76" + EOL + + " STMTN5MMSC19-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a76" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000076" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + + " STMTN5MMSC19-MMSC::module-1-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + + " 1.0" + EOL + + " false" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000077" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + 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 = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c718" + EOL + + " STMTN5MMSC18" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000018" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + + " STMTN5MMSC18-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000078" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + 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 = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " mmsc-capacity" + EOL + + " SDN-MOBILITY" + EOL + + " vMMSC" + EOL + + " pending-create" + EOL + + " false" + EOL + + " false" + EOL + + " 0000021" + EOL + + " " + EOL + + " " + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " 1.0" + EOL + + " true" + EOL + + " FILLED-IN-BY-MSO" + EOL + + " pending-create" + EOL + + " 0000073" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + "" + 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 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"); + + Map 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); + + // "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 setupVariablesSunnyDayVID() { + Map 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; + + } + + +} \ No newline at end of file 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 new file mode 100644 index 0000000000..73acde3fc6 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVfModuleVolumeInfraV1Test.java @@ -0,0 +1,166 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Ignore; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; +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", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/VnfAdapterRestV1.bpmn"}) + 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 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(); + +// DeleteVfModuleVolumeInfraV1_inUseError(); // no assertions to check + + String businessKey = UUID.randomUUID().toString(); + String deleteVfModuleVolRequest = + FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json"); + + Map 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(); + +// DeleteVfModuleVolumeInfraV1_fail(); + + String businessKey = UUID.randomUUID().toString(); + String deleteVfModuleVolRequest = + FileUtil.readResourceFile("__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json"); + + Map 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 new file mode 100644 index 0000000000..00c5a24338 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DeleteVnfInfraTest.java @@ -0,0 +1,200 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * 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.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; +import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Ignore; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.BPMNUtil; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; +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 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 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 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 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 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/DoCreateVfModuleRollbackTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java new file mode 100644 index 0000000000..7a9345f83a --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleRollbackTest.java @@ -0,0 +1,157 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure; + +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVfModuleId; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVfModuleId; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.WorkflowTest.CallbackSet; +import org.openecomp.mso.bpmn.core.RollbackData; +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 = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " true" + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL; + + private final String vnfAdapterDeleteCallbackFail = + "" + EOL + + " Error processing request to VNF-Async. Not Found." + EOL + + " INTERNAL" + EOL + + " false" + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL; + + private final String sdncAdapterDeleteCallback = + "" + EOL + + " {{REQUEST-ID}}" + EOL + + " Y" + EOL + + "" + 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); + + String businessKey = UUID.randomUUID().toString(); + Map 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); + 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(); + } + + +} + 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 new file mode 100644 index 0000000000..235deb85af --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleTest.java @@ -0,0 +1,149 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure; + + +import static org.openecomp.mso.bpmn.common.BPMNUtil.getRawVariable; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutNetwork; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPost; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.WorkflowTest.CallbackSet; +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("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/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(); + + 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"); + + String businessKey = UUID.randomUUID().toString(); + //RuntimeService runtimeService = processEngineRule.getRuntimeService(); + + Map variables = setupVariablesSunnyDayBuildingBlocks(); + //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 setupVariablesSunnyDayBuildingBlocks() { + Map variables = new HashMap(); + + variables.put("mso-request-id", "testRequestId"); + variables.put("requestId", "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("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"); + + String vfModuleModelInfo = "{" + "\"modelInfo\": { "+ "\"modelType\": \"vfModule\"," + + "\"modelInvariantId\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + + "\"modelNameVersionId\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + + "\"modelName\": \"STMTN5MMSC21-MMSC::model-1-0\"," + + "\"modelVersion\": \"1\"," + + "\"modelCustomizationId\": \"MODEL-123\"" + "}}"; + variables.put("vfModuleModelInfo", vfModuleModelInfo); + + String cloudConfiguration = "{" + "\"cloudConfiguration\": { " + + "\"lcpCloudRegionId\": \"MDTWNJ21\"," + + "\"tenantId\": \"fba1bd1e195a404cacb9ce17a9b2b421\"" + "}}"; + variables.put("cloudConfiguration", cloudConfiguration); + return variables; + + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV1Test.java new file mode 100644 index 0000000000..c7a112d5aa --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVfModuleVolumeV1Test.java @@ -0,0 +1,351 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * 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.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.WorkflowTest.CallbackSet; +import org.openecomp.mso.bpmn.mock.FileUtil; + +public class DoCreateVfModuleVolumeV1Test extends WorkflowTest { + + public static final String _prefix = "CVFMODVOL2_"; + + private final CallbackSet callbacks = new CallbackSet(); + + public DoCreateVfModuleVolumeV1Test() 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 + @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/VnfAdapterRestV1.bpmn", + "subprocess/VnfAdapterRestV1.bpmn"}) + public void TestHappyPath() throws Exception { + + logStart(); + + DoCreateVfModuleVolume_Success(); + + String businessKey = UUID.randomUUID().toString(); + String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml"); + + Map testVariables = new HashMap(); + testVariables.put("DCVFMODVOLV1_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); + invokeAsyncProcess("DoCreateVfModuleVolumeV1", "v1", businessKey, createVfModuleVolRequest, testVariables); + + injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); + + waitForProcessEnd(businessKey, 100000); + checkVariable(businessKey, "DCVFMODVOLV1_SuccessIndicator", true); + + logEnd(); + } + + @Test + @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/VnfAdapterRestV1.bpmn", + "subprocess/VnfAdapterRestV1.bpmn"}) + public void TestVolumeGroupExistError() throws Exception { + + logStart(); + + DoCreateVfModuleVolume_VolumeGroupExistsFail(); + + String businessKey = UUID.randomUUID().toString(); + String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml"); + + Map testVariables = new HashMap(); + testVariables.put("DCVFMODVOLV1_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); + invokeAsyncProcess("DoCreateVfModuleVolumeV1", "v1", businessKey, createVfModuleVolRequest, testVariables); + + //injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); + + waitForProcessEnd(businessKey, 100000); + checkVariable(businessKey, "DCVFMODVOLV1_SuccessIndicator", false); + + logEnd(); + } + + /** + * Will trigger AAI create rollback + * @throws Exception + */ + @Test + @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/VnfAdapterRestV1.bpmn", + "subprocess/VnfAdapterRestV1.bpmn"}) + public void TestVnfVolumeGroupCreateError() throws Exception { + + logStart(); + + DoCreateVfModuleVolume_VnfCreateVolumeGroupFail(); + + String businessKey = UUID.randomUUID().toString(); + String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml"); + + Map testVariables = new HashMap(); + testVariables.put("DCVFMODVOLV1_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); + invokeAsyncProcess("DoCreateVfModuleVolumeV1", "v1", businessKey, createVfModuleVolRequest, testVariables); + + //injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); + + waitForProcessEnd(businessKey, 100000); + checkVariable(businessKey, "DCVFMODVOLV1_SuccessIndicator", false); + + logEnd(); + } + + /** + * Will trigger AAI create rollback + * @throws Exception + */ + @Test + @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/VnfAdapterRestV1.bpmn", + "subprocess/VnfAdapterRestV1.bpmn"}) + public void TestUpdateAaiVolumeGroupError() throws Exception { + + logStart(); + + DoCreateVfModuleVolume_AaiVolumeGroupUpdateFail(); + + String businessKey = UUID.randomUUID().toString(); + String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml"); + + Map testVariables = new HashMap(); + testVariables.put("DCVFMODVOLV1_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); + invokeAsyncProcess("DoCreateVfModuleVolumeV1", "v1", businessKey, createVfModuleVolRequest, testVariables); + + injectVNFRestCallbacks(callbacks, "volumeGroupCreate,volumeGroupRollback"); + + waitForProcessEnd(businessKey, 100000); + checkVariable(businessKey, "DCVFMODVOLV1_SuccessIndicator", false); + + logEnd(); + } + + /** + * Will trigger not trigger rollback + * @throws Exception + */ + @Test + @Deployment(resources = {"subprocess/DoCreateVfModuleVolumeV1.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/VnfAdapterRestV1.bpmn", + "subprocess/VnfAdapterRestV1.bpmn"}) + public void TestUpdateAaiVolumeGroupErrorNoRollback() throws Exception { + + logStart(); + + DoCreateVfModuleVolume_AaiVolumeGroupUpdateFail(); + + String businessKey = UUID.randomUUID().toString(); + String createVfModuleVolRequest = FileUtil.readResourceFile("__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml"); + + Map testVariables = new HashMap(); + testVariables.put("DCVFMODVOLV1_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); + invokeAsyncProcess("DoCreateVfModuleVolumeV1", "v1", businessKey, createVfModuleVolRequest, testVariables); + + injectVNFRestCallbacks(callbacks, "volumeGroupCreate"); + + waitForProcessEnd(businessKey, 100000); + checkVariable(businessKey, "DCVFMODVOLV1_SuccessIndicator", false); + + logEnd(); + } + + public static void DoCreateVfModuleVolume_Success() { + // Notes: + // 1. initial aai volume group by name - /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group?volume-group-name=TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0 + // 2. Create volume group - /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group + // 3. Requery Volume Group - /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group?volume-group-name=MSOTESTVOL101a-vSAMP12_base_vol_module-0 + // 4. Update volume group (id from requery response - /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group/8424bb3c-c3e7-4553-9662-469649ed9379 + + //generic vnf + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/TEST-VNF-ID-0123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModuleVolumeV1/GenericVnf.xml"))); + //create volume group + stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group/TEST-VOLUME-GROUP-ID-0123")) + .willReturn(aResponse() + .withStatus(201) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml"))); + //requery volume group + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups[?]volume-group-name=MSOTESTVOL101a-vSAMP12_base_vol_module-0")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml"))); + //update volume group + stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group/8424bb3c-c3e7-4553-9662-469649ed9379")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml"))); + // VNF rest Adapter + stubFor(post(urlEqualTo("/vnfs/v1/volume-groups")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/xml"))); + } + + public static void DoCreateVfModuleVolume_VolumeGroupExistsFail() { + //generic vnf + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/TEST-VNF-ID-0123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModuleVolumeV1/GenericVnf.xml"))); + //initial volume group query + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group[?]volume-group-name=TEST-MSOTESTVOL101a-vSAMP12_base_vol_module-0")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml"))); + } + + public static void DoCreateVfModuleVolume_VnfCreateVolumeGroupFail() { + //generic vnf + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/TEST-VNF-ID-0123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModuleVolumeV1/GenericVnf.xml"))); + //create volume group + stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group/TEST-VOLUME-GROUP-ID-0123")) + .willReturn(aResponse() + .withStatus(201) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml"))); + //Query AAI volume group by name -- needed before delete + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups[?]volume-group-name=MSOTESTVOL101a-vSAMP12_base_vol_module-0")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml"))); + //delete volume group in aai + stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group/8424bb3c-c3e7-4553-9662-469649ed9379[?]resource-version=1460134360")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml"))); + stubFor(post(urlEqualTo("/vnfs/v1/volume-groups")) + .willReturn(aResponse() + .withStatus(404) + .withHeader("Content-Type", "application/xml"))); + } + + public static void DoCreateVfModuleVolume_AaiVolumeGroupUpdateFail() { + //generic vnf + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/TEST-VNF-ID-0123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModuleVolumeV1/GenericVnf.xml"))); + //create volume group + stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups/volume-group/TEST-VOLUME-GROUP-ID-0123")) + .willReturn(aResponse() + .withStatus(201) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml"))); + //requery volume group + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/volume-groups[?]volume-group-name=MSOTESTVOL101a-vSAMP12_base_vol_module-0")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml"))); + //delete volume group in aai + stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/volume-groups/volume-group/8424bb3c-c3e7-4553-9662-469649ed9379[?]resource-version=1460134360")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml"))); + // VNF rest Adapter + stubFor(post(urlEqualTo("/vnfs/v1/volume-groups")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/xml"))); + // VNF Rest Adapter rollback - vnfs/v1/volume-groups/STUB-TEST-8424bb3c-c3e7-4553-9662-469649ed9379/rollback + stubFor(delete(urlEqualTo("/vnfs/v1/volume-groups/TEST-VOLUME-GROUP-ID-0123/rollback")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/xml"))); + } +} 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 new file mode 100644 index 0000000000..b161d05bfe --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoCreateVnfTest.java @@ -0,0 +1,119 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByName_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.BPMNUtil; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.WorkflowTest.CallbackSet; +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 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 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\"," + + "\"modelInvariantId\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + + "\"modelNameVersionId\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + + "\"modelName\": \"vSAMP12\"," + + "\"modelVersion\": \"1.0\"," + + "\"modelCustomizationId\": \"MODEL-ID-1234\"," + + "}"; + variables.put("vnfModelInfo", vnfModelInfo); + + String cloudConfiguration = "{ " + + "\"lcpCloudRegionId\": \"mdt1\"," + + "\"tenantId\": \"88a6ca3ee0394ade9403f075db23167e\"" + "}"; + variables.put("cloudConfiguration", cloudConfiguration); + } + +} 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 new file mode 100644 index 0000000000..a04ed1759d --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVfModuleTest.java @@ -0,0 +1,549 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * 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.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIDeleteGenericVnf; +import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIDeleteVfModule; +import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIGenericVnfSearch; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.WorkflowTest.CallbackSet; +import org.openecomp.mso.bpmn.core.WorkflowException; + +/** + * 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 = + "" + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " true" + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL; + + private final String vnfAdapterDeleteCallbackFail = + "" + EOL + + " Error processing request to VNF-Async. Not Found." + EOL + + " INTERNAL" + EOL + + " false" + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL; + + private final String sdncAdapterDeleteCallback = + "" + EOL + + " {{REQUEST-ID}}" + EOL + + " Y" + EOL + + "" + EOL; + + public DoDeleteVfModuleTest() throws IOException { + callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback); + callbacks.put("sdncDelete", sdncAdapterDeleteCallback); + callbacks.put("vnfDelete", vnfAdapterDeleteCallback); + 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 = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " asc_heat-int" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 00000000-0000-0000-0000-000000000000" + EOL + + " SDN-ETHERNET-INTERNET" + EOL + + " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + + " pending-delete" + EOL + + " RDM2WAGPLCP" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + logStart(); + MockDoDeleteVfModule_SDNCSuccess(); + MockDoDeleteVfModule_DeleteVNFSuccess(); + MockAAIGenericVnfSearch(); + MockAAIVfModulePUT(false); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + String businessKey = UUID.randomUUID().toString(); + Map 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(); + String businessKey = UUID.randomUUID().toString(); + Map 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"); + String vfModuleModelInfo = "{" + "\"modelType\": \"vnf\"," + + "\"modelInvariantId\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," + + "\"modelNameVersionId\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," + + "\"modelName\": \"vSAMP12\"," + + "\"modelVersion\": \"1.0\"," + + "\"modelCustomizationId\": \"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 = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " asc_heat-int" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 00000000-0000-0000-0000-000000000000" + EOL + + " SDN-ETHERNET-INTERNET" + EOL + + " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + + " pending-delete" + EOL + + " RDM2WAGPLCP" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + + logStart(); + MockDoDeleteVfModule_SDNCFailure(); + MockDoDeleteVfModule_DeleteVNFSuccess(); + MockAAIGenericVnfSearch(); + MockAAIVfModulePUT(false); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + String businessKey = UUID.randomUUID().toString(); + Map 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 +// 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 = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " asc_heat-int" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 00000000-0000-0000-0000-000000000000" + EOL + + " SDN-ETHERNET-INTERNET" + EOL + + " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + + " pending-delete" + EOL + + " RDM2WAGPLCP" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + + logStart(); + MockDoDeleteVfModule_SDNCSuccess(); + MockDoDeleteVfModule_DeleteVNFSuccess(); + MockAAIGenericVnfSearch(); + MockAAIVfModulePUT(false); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + String businessKey = UUID.randomUUID().toString(); + Map 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 = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " asc_heat-int" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 00000000-0000-0000-0000-000000000000" + EOL + + " SDN-ETHERNET-INTERNET" + EOL + + " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + + " pending-delete" + EOL + + " RDM2WAGPLCP" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + + logStart(); + MockDoDeleteVfModule_SDNCSuccess(); + MockDoDeleteVfModule_DeleteVNFFailure(); + MockAAIGenericVnfSearch(); + MockAAIVfModulePUT(false); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + String businessKey = UUID.randomUUID().toString(); + Map 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 +// 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 = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " asc_heat-int" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a73" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " 00000000-0000-0000-0000-000000000000" + EOL + + " SDN-ETHERNET-INTERNET" + EOL + + " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + + " pending-delete" + EOL + + " RDM2WAGPLCP" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + + logStart(); + MockDoDeleteVfModule_SDNCSuccess(); + MockDoDeleteVfModule_DeleteVNFSuccess(); + MockAAIGenericVnfSearch(); + MockAAIVfModulePUT(false); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + String businessKey = UUID.randomUUID().toString(); + Map 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); +// 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"))); + } +} + 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 new file mode 100644 index 0000000000..9c98c01b91 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoDeleteVnfTest.java @@ -0,0 +1,140 @@ +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.BPMNUtil; +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 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 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("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{ + + MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfResponse_hasRelationships.xml"); + MockDeleteGenericVnf("testVnfId123", "testReVer123"); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map 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"); + 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 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 new file mode 100644 index 0000000000..e202b0349b --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/DoUpdateVfModuleTest.java @@ -0,0 +1,115 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure; + + + +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVfModuleIdNoResponse; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.WorkflowTest.CallbackSet; +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 + + @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 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(); + } +} + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceInfraTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceInfraTest.java new file mode 100644 index 0000000000..9ef4c94cce --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateNetworkInstanceInfraTest.java @@ -0,0 +1,840 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.common.BPMNUtil.executeAsyncWorkflow; +import static org.openecomp.mso.bpmn.common.BPMNUtil.getVariable; +import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetCloudRegion; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetwork; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkPolicy; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkRouteTable; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetNetworkVpnBinding; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutNetwork; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseNetworkAdapter.MockPutNetworkAdapter; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapterTopology; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.BPMNUtil; +import org.openecomp.mso.bpmn.common.SDNCAdapterCallbackRule; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.WorkflowTestTransformer; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; +import org.openecomp.mso.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer; + +import com.github.tomakehurst.wiremock.extension.ResponseTransformer; + +/** + * Unit test cases for UpdateNetworkInstanceInfra.bpmn + * + */ +public class UpdateNetworkInstanceInfraTest 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 UpdateNetworkInstanceInfra.bpmn + * - String input & String response + */ + + @Test + //@Ignore + @Deployment(resources = {"process/UpdateNetworkInstanceInfra.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceUpdateNetworkInstanceInfra_Success1() throws Exception { + + System.out.println("----------------------------------------------------------"); + System.out.println(" Success1 - UpdateNetworkInstanceInfra flow Started! "); + System.out.println("----------------------------------------------------------"); + + // setup simulators + + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); // + MockPutNetworkAdapter("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "updateNetworkRequest", 200, "UpdateNetworkV2/updateNetworkResponse_Success.xml"); + MockGetCloudRegion("RDM2WAGPLCP", 200, "CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml"); + MockGetNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", 200); + MockGetNetworkVpnBinding("85f015d0-2e32-4c30-96d2-87a1a27f8017", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + MockGetNetworkVpnBinding("c980a6ef-3b88-49f0-9751-dbad8608d0a6", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + MockGetNetworkPolicy("cee6d136-e378-4678-a024-2cd15f0ee0cg", "UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", 200); + MockGetNetworkRouteTable("refFQDN1", "UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", 200); + MockGetNetworkRouteTable("refFQDN2", "UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", 200); + MockPutNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", 200, "UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml"); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); + + Map variables = setupVariables1(); + WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstanceInfra", variables); + System.out.println("----------------------------------------------------------"); + System.out.println("- got workflow response -"); + System.out.println("----------------------------------------------------------"); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_Success")); + Assert.assertNotNull("UPDNETI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_CompleteMsoProcessRequest")); + + String workflowResp = BPMNUtil.getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "WorkflowResponse"); + Assert.assertNotNull(workflowResp); + + System.out.println("----------------------------------------------------------"); + System.out.println(" Success1 - UpdateNetworkInstanceInfra flow Completed "); + System.out.println("----------------------------------------------------------"); + + } + + @Test + //@Ignore + @Deployment(resources = {"process/UpdateNetworkInstanceInfra.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceUpdateNetworkInstanceInfra_Success2() throws Exception { + + System.out.println("----------------------------------------------------------"); + System.out.println(" Success2 - UpdateNetworkInstanceInfra flow Started! "); + System.out.println("----------------------------------------------------------"); + + // setup simulators + + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); + MockPutNetworkAdapter("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "updateNetworkRequest", 200, "UpdateNetworkV2/updateNetworkResponse_Success.xml"); + MockGetCloudRegion("RDM2WAGPLCP", 200, "CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml"); + MockGetNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", 200); + MockGetNetworkVpnBinding("85f015d0-2e32-4c30-96d2-87a1a27f8017", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + MockGetNetworkVpnBinding("c980a6ef-3b88-49f0-9751-dbad8608d0a6", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + MockGetNetworkPolicy("cee6d136-e378-4678-a024-2cd15f0ee0cg", "UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", 200); + MockGetNetworkRouteTable("refFQDN1", "UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", 200); + MockGetNetworkRouteTable("refFQDN2", "UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", 200); + MockPutNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", 200, "UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml"); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); + + Map variables = setupVariables2(); + WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstanceInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("true", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_Success")); + Assert.assertNotNull("UPDNETI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_CompleteMsoProcessRequest")); + + String completeMsoProcessRequest = + "" + '\n' + + " " + '\n' + + " testRequestId" + '\n' + + " UPDATE" + '\n' + + " VID" + '\n' + + " " + '\n' + + " BPMN Network action: UPDATE" + '\n' + + ""; + + Assert.assertEquals(completeMsoProcessRequest, getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_CompleteMsoProcessRequest")); + + System.out.println("----------------------------------------------------------"); + System.out.println(" Success2 - UpdateNetworkInstanceInfra flow Completed "); + System.out.println("----------------------------------------------------------"); + + } + + + @Test + @Deployment(resources = {"process/UpdateNetworkInstanceInfra.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceUpdateNetworkInstanceInfra_MissingNetworkId() throws Exception { + + System.out.println("--------------------------------------------------------------------"); + System.out.println(" Missing networkId - UpdateNetworkInstanceInfra flow Started! "); + System.out.println("--------------------------------------------------------------------"); + + // setup simulators + + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); + + Map variables = setupVariablesMissingNetworkId(); + WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstanceInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_Success")); + Assert.assertNotNull("UPDNETI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_FalloutHandlerRequest")); + + String falloutHandlerActual = getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_FalloutHandlerRequest"); + String falloutHandlerExpected = +"" + "\n" + +" " + "\n" + +" 88f65519-9a38-4c4b-8445-9eb4a5a5af56" + "\n" + +" UPDATE" + "\n" + +" VID" + "\n" + +" " + "\n" + +" " + "\n" + +" Variable 'network-id' value/element is missing." + "\n" + +" 2500" + "\n" + +" " + "\n" + +" "; + + assertEquals("Response", falloutHandlerExpected, falloutHandlerActual); + + System.out.println("------------------------------------------------------------------"); + System.out.println(" Missing networkId - UpdateNetworkInstanceInfra flow Completed "); + System.out.println("------------------------------------------------------------------"); + + } + + /* NOT NEEDED + @Test + @Deployment(resources = {"process/UpdateNetworkInstanceInfra.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceUpdateNetworkInstanceInfra_SDNCRollback1() throws Exception { + + System.out.println("----------------------------------------------------------"); + System.out.println(" SDNCRollback1 - UpdateNetworkInstanceInfra flow Started! "); + System.out.println("----------------------------------------------------------"); + + // setup simulators + + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>rollback"); + MockPutNetworkAdapter("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "updateNetworkRequest", 200, "UpdateNetworkV2/updateNetworkResponse_Success.xml"); + MockGetCloudRegion("RDM2WAGPLCP", 200, "CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml"); + MockAAIResponse_queryId_UpdateNetwork_404V2(); // failure in queryId in AAI + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); + + Map variables = setupVariablesSDNCRollback(); + WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstanceInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_Success")); + Assert.assertNotNull("UPDNETI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_FalloutHandlerRequest")); + + System.out.println("----------------------------------------------------------"); + System.out.println(" SDNCRollback1 - UpdateNetworkInstanceInfra flow Completed "); + System.out.println("----------------------------------------------------------"); + + } */ + + @Test + @Deployment(resources = {"process/UpdateNetworkInstanceInfra.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceUpdateNetworkInstanceInfra_SDNCRollback_Scenario01() throws Exception { + + System.out.println("----------------------------------------------------------"); + System.out.println(" SDNCRollback - UpdateNetworkInstanceInfra flow Started! "); + System.out.println("----------------------------------------------------------"); + + // setup simulators + + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); // + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>rollback"); + MockPutNetworkAdapter("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "updateNetworkRequest", 200, "UpdateNetworkV2/updateNetworkResponse_Success.xml"); + MockGetCloudRegion("RDM2WAGPLCP", 200, "CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml"); + MockGetNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml", 200); // no 'payload' response from NetworkAdapter, version 2 + //MockGetNetworkVpnBinding("85f015d0-2e32-4c30-96d2-87a1a27f8017", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); // let it fail (404) to see SDNC compensation + //MockGetNetworkVpnBinding("c980a6ef-3b88-49f0-9751-dbad8608d0a6", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); // let it fail (404) to see SDNC compensation + //MockGetNetworkRouteTable("refFQDN2", "UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", 200); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); + + Map variables = setupVariablesSDNCRollback(); + WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstanceInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_Success")); + Assert.assertNotNull("UPDNETI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_FalloutHandlerRequest")); + + System.out.println("----------------------------------------------------------"); + System.out.println(" SDNCRollback - UpdateNetworkInstanceInfra flow Completed "); + System.out.println("----------------------------------------------------------"); + + } + + @Test + @Deployment(resources = {"process/UpdateNetworkInstanceInfra.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceUpdateNetworkInstanceInfra_Network_SDNC_Rollback() throws Exception { + + System.out.println("---------------------------------------------------------------"); + System.out.println(" Network and SDNC Rollback - UpdateNetworkInstanceInfra flow Started! "); + System.out.println("---------------------------------------------------------------"); + + // setup simulators + + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); // + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>rollback"); + MockPutNetworkAdapter("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "updateNetworkRequest", 200, "UpdateNetworkV2/updateNetworkResponse_Success.xml"); + MockGetCloudRegion("RDM2WAGPLCP", 200, "CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml"); + MockGetNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", 200); + MockGetNetworkVpnBinding("85f015d0-2e32-4c30-96d2-87a1a27f8017", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + MockGetNetworkVpnBinding("c980a6ef-3b88-49f0-9751-dbad8608d0a6", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + MockGetNetworkPolicy("cee6d136-e378-4678-a024-2cd15f0ee0cg", "UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", 200); + MockGetNetworkRouteTable("refFQDN1", "UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", 200); + MockGetNetworkRouteTable("refFQDN2", "UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", 200); + //MockAAIResponse_updateContrail_CreateNetwork_SuccessV2(); // designed to fail in AAI Update + //mockUpdateRequestDB(500, "Database/DBUpdateResponse.xml"); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); + + Map variables = setupVariables1(); + WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstanceInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_Success")); + Assert.assertNotNull("UPDNETI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_FalloutHandlerRequest")); + + System.out.println("---------------------------------------------------------------------"); + System.out.println(" Network and SCNC Rollback - UpdateNetworkInstanceInfra flow Completed "); + System.out.println("---------------------------------------------------------------------"); + + } + + @Test + @Deployment(resources = {"process/UpdateNetworkInstanceInfra.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceUpdateNetworkInstanceInfra_Network_SDNC_Rollback_Failed() throws Exception { + + System.out.println("---------------------------------------------------------------"); + System.out.println(" Network and SDNC Rollback - UpdateNetworkInstanceInfra flow Started! "); + System.out.println("---------------------------------------------------------------"); + + // setup simulators + + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); // + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml", "SvcAction>rollback"); + MockPutNetworkAdapter("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "updateNetworkRequest", 200, "UpdateNetworkV2/updateNetworkResponse_Success.xml"); + MockGetCloudRegion("RDM2WAGPLCP", 200, "CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml"); + MockGetNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", 200); + MockGetNetworkVpnBinding("85f015d0-2e32-4c30-96d2-87a1a27f8017", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + MockGetNetworkVpnBinding("c980a6ef-3b88-49f0-9751-dbad8608d0a6", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + MockGetNetworkPolicy("cee6d136-e378-4678-a024-2cd15f0ee0cg", "UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", 200); + MockGetNetworkRouteTable("refFQDN1", "UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", 200); + MockGetNetworkRouteTable("refFQDN2", "UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", 200); + //MockAAIResponse_updateContrail_CreateNetwork_SuccessV2(); // designed to fail in AAI Update + //mockUpdateRequestDB(500, "Database/DBUpdateResponse.xml"); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); + + Map variables = setupVariables1(); + WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstanceInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_Success")); + Assert.assertNotNull("UPDNETI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_FalloutHandlerRequest")); + + System.out.println("---------------------------------------------------------------------"); + System.out.println(" Network and SCNC Rollback - UpdateNetworkInstanceInfra flow Completed "); + System.out.println("---------------------------------------------------------------------"); + + } + + @Test + @Deployment(resources = {"process/UpdateNetworkInstanceInfra.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceUpdateNetworkInstanceInfra_SDNCRollback2() throws Exception { + + System.out.println("----------------------------------------------------"); + System.out.println(" SDNCRollback2 - UpdateNetworkInstanceInfra flow Started! "); + System.out.println("----------------------------------------------------"); + + // setup simulators + + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>rollback"); + MockPutNetworkAdapter("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "updateNetworkRequest", 500, "UpdateNetworkV2/updateNetworkResponse_500.xml"); // failure 500 in NetworkAdapter + MockGetCloudRegion("RDM2WAGPLCP", 200, "CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml"); + MockGetNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", 200); + MockGetNetworkVpnBinding("85f015d0-2e32-4c30-96d2-87a1a27f8017", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + MockGetNetworkVpnBinding("c980a6ef-3b88-49f0-9751-dbad8608d0a6", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + MockGetNetworkPolicy("cee6d136-e378-4678-a024-2cd15f0ee0cg", "UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", 200); + MockGetNetworkRouteTable("refFQDN1", "UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", 200); + MockGetNetworkRouteTable("refFQDN2", "UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", 200); + //MockPutNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", 200, "UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml"); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); + + Map variables = setupVariables1(); + WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstanceInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_Success")); + Assert.assertNotNull("UPDNETI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_FalloutHandlerRequest")); + + System.out.println("------------------------------------------------------------"); + System.out.println(" SDNCRollback2 - UpdateNetworkInstanceInfra flow Completed "); + System.out.println("------------------------------------------------------------"); + + } + + @Test + @Deployment(resources = {"process/UpdateNetworkInstanceInfra.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceUpdateNetworkInstanceInfra_SDNCRollback3() throws Exception { + + System.out.println("----------------------------------------------------"); + System.out.println(" SDNCRollback3 - UpdateNetworkInstanceInfra flow Started! "); + System.out.println("----------------------------------------------------"); + + // setup simulators + + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>rollback"); + MockPutNetworkAdapter("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "updateNetworkRequest", 400, "UpdateNetworkV2/updateNetworkResponse_400.xml"); // failure 400 in NetworkAdapter + MockGetCloudRegion("RDM2WAGPLCP", 200, "CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml"); + MockGetNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", 200); + MockGetNetworkVpnBinding("85f015d0-2e32-4c30-96d2-87a1a27f8017", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + MockGetNetworkVpnBinding("c980a6ef-3b88-49f0-9751-dbad8608d0a6", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + MockGetNetworkPolicy("cee6d136-e378-4678-a024-2cd15f0ee0cg", "UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", 200); + MockGetNetworkRouteTable("refFQDN1", "UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", 200); + MockGetNetworkRouteTable("refFQDN2", "UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", 200); + //MockPutNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", 200, "UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml"); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); + + Map variables = setupVariables1(); + WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstanceInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_Success")); + Assert.assertNotNull("UPDNETI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_FalloutHandlerRequest")); + + System.out.println("------------------------------------------------------------"); + System.out.println(" SDNCRollback3 - UpdateNetworkInstanceInfra flow Completed "); + System.out.println("------------------------------------------------------------"); + + } + + @Test + @Deployment(resources = {"process/UpdateNetworkInstanceInfra.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceUpdateNetworkInstanceInfra_PONR() throws Exception { + + System.out.println("--------------------------------------------------------------------"); + System.out.println(" PONR (Point-of-no-Return) - UpdateNetworkInstanceInfra flow Started! "); + System.out.println("--------------------------------------------------------------------"); + + // setup simulators + + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>changeassign"); // + mockSDNCAdapterTopology("UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml", "SvcAction>rollback"); + MockPutNetworkAdapter("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "updateNetworkRequest", 200, "UpdateNetworkV2/updateNetworkResponse_Success.xml"); + MockGetCloudRegion("RDM2WAGPLCP", 200, "CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml"); + MockGetNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", 200); + MockGetNetworkVpnBinding("85f015d0-2e32-4c30-96d2-87a1a27f8017", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + MockGetNetworkVpnBinding("c980a6ef-3b88-49f0-9751-dbad8608d0a6", "UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", 200); + MockGetNetworkPolicy("cee6d136-e378-4678-a024-2cd15f0ee0cg", "UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", 200); + MockGetNetworkRouteTable("refFQDN1", "UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", 200); + MockGetNetworkRouteTable("refFQDN2", "UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", 200); + MockPutNetwork("49c86598-f766-46f8-84f8-8d1c1b10f9b4", 200, "UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml"); + mockUpdateRequestDB(500, "Database/DBUpdateResponse.xml"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); + + Map variables = setupVariables1(); + WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstanceInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_Success")); + Assert.assertNotNull("UPDNETI_FalloutHandlerRequest - ", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_FalloutHandlerRequest")); + + String falloutHandlerRequest = + "" + '\n' + + " " + '\n' + + " testRequestId" + '\n' + + " CREATE" + '\n' + + " VID" + '\n' + + " " + '\n' + + " " + '\n' + + " DB Update failed, code: 500" + '\n' + + " 2500" + '\n' + + " " + '\n' + + " "; + + System.out.println("Display UPDNETI_FalloutHandlerRequest - " + getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_FalloutHandlerRequest")); + //Assert.assertEquals(falloutHandlerRequest, getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_FalloutHandlerRequest")); + + System.out.println("--------------------------------------------------------------------"); + System.out.println(" PONR (Point-of-no-Return) - UpdateNetworkInstanceInfra flow Completed! "); + System.out.println("--------------------------------------------------------------------"); + + + } + + @Test + @Deployment(resources = {"process/UpdateNetworkInstanceInfra.bpmn", + "subprocess/GenericGetService.bpmn", + "subprocess/FalloutHandler.bpmn", + "subprocess/CompleteMsoProcess.bpmn", + "subprocess/SDNCAdapterV1.bpmn"}) + + public void shouldInvokeServiceUpdateNetworkInstanceInfra_sdncFailure() throws Exception { + + System.out.println("----------------------------------------------------------"); + System.out.println(" SNDC Failure - UpdateNetworkInstanceInfra flow Started! "); + System.out.println("----------------------------------------------------------"); + + // setup simulators + + //MockSDNCAdapterBadAsynchronousResponse(); // 404 + mockSDNCAdapter("/SDNCAdapter", "SvcAction>query", 500, ""); // 500 + MockGetCloudRegion("RDM2WAGPLCP", 200, "CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml"); + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + MockNodeQueryServiceInstanceById("f70e927b-6087-4974-9ef8-c5e4d5847ca4", "UpdateNetworkV2/updateNetwork_queryInstance_Success.xml"); + + Map variables = setupVariables2(); + WorkflowResponse workflowResponse = executeAsyncWorkflow(processEngineRule, "UpdateNetworkInstanceInfra", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertEquals("false", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_Success")); + Assert.assertNotNull("UPDNETI_CompleteMsoProcessRequest - ", getVariable(processEngineRule, "UpdateNetworkInstanceInfra", "UPDNETI_CompleteMsoProcessRequest")); + + System.out.println("----------------------------------------------------------"); + System.out.println(" SNDC Failure - UpdateNetworkInstanceInfra flow Completed "); + System.out.println("----------------------------------------------------------"); + + } + + // ***************** + // Utility Section + // ***************** + + // Success Scenario + private Map setupVariables1() { + Map 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", "CREATE"); + 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' + + " \"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_1\", " + '\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 2 + private Map setupVariables2() { + Map variables = new HashMap(); + variables.put("bpmnRequest", getCreateNetworkRequest2()); + 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 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; + + } + + /* Active Scenario + private Map setupVariablesActive() { + Map variables = new HashMap(); + variables.put("mso-request-id", "testRequestId"); + variables.put("bpmnRequest", getCreateNetworkRequestActive()); + 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 getCreateNetworkRequestActive() { + + 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_2\", " + '\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; + + } */ + + // Missing Name Scenario + private Map setupVariablesMissingNetworkId() { + Map 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; + + } + + // SDNC Rollback Scenario + private Map setupVariablesSDNCRollback() { + Map variables = new HashMap(); + variables.put("mso-request-id", "testRequestId"); + variables.put("bpmnRequest", getCreateNetworkRequestSDNCRollback()); + 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 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 new file mode 100644 index 0000000000..cadca4c3a3 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleInfraTest.java @@ -0,0 +1,144 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure; + +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; +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 + + @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 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 setupVariablesSunnyDayVID() { + Map 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/UpdateVfModuleVolumeInfraV1Test.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java new file mode 100644 index 0000000000..34c0af43c4 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/UpdateVfModuleVolumeInfraV1Test.java @@ -0,0 +1,141 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure; + +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVfModuleId; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockPutVNFVolumeGroup; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.WorkflowTest; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; +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/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 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/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 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/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml new file mode 100644 index 0000000000..90c668c576 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 2.5 + RDM2WAGPLCP + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml new file mode 100644 index 0000000000..9b651f25e3 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 3.0 + RDM2WAGPLCP + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml new file mode 100644 index 0000000000..a5640b2b26 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_400.xml @@ -0,0 +1,6 @@ + + +680bd458-5ec1-4a16-b77c-509022e53450INTERNAL +400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data +true + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml new file mode 100644 index 0000000000..c67e980c63 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_500.xml @@ -0,0 +1,78 @@ + + + JBoss Web/7.2.2.Final-redhat-1 - JBWEB000064: Error report + + + + +

JBWEB000065: HTTP Status 500 - java.lang.NullPointerException

+
+

+ JBWEB000309: type + JBWEB000066: Exception report +

+

+ JBWEB000068: message + java.lang.NullPointerException +

+

+ JBWEB000069: description + JBWEB000145: The server encountered an internal error that + prevented it from fulfilling this request. +

+

+ JBWEB000070: exception +

org.jboss.resteasy.spi.UnhandledException:
+					java.lang.NullPointerException
+					org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365)
+					org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233)
+					org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209)
+					org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557)
+					org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
+					org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
+					org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
+					org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
+					org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
+					javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
+					org.openecomp.mso.logger.LogFilter.doFilter(LogFilter.java:35)
+				
+

+

+ JBWEB000071: root cause +

java.lang.NullPointerException
+					org.openecomp.mso.adapters.network.NetworkAdapterRest$CreateNetworkVolumesTask.run(NetworkAdapterRest.java:128)
+					org.openecomp.mso.adapters.network.NetworkAdapterRest.createNetwork(NetworkAdapterRest.java:64)
+					sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+					sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+					sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+					java.lang.reflect.Method.invoke(Method.java:606)
+					org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
+					org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
+					org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
+					org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
+					org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
+					org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
+					org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
+					org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
+					org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
+					org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
+					javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
+					org.openecomp.mso.logger.LogFilter.doFilter(LogFilter.java:35)
+				
+

+

+ JBWEB000072: note + JBWEB000073: The full stack trace of the root cause is available + in the JBoss Web/7.2.2.Final-redhat-1 logs. +

+
+

JBoss Web/7.2.2.Final-redhat-1

+ + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml new file mode 100644 index 0000000000..b40bd07a9d --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetworkResponse_Success.xml @@ -0,0 +1,24 @@ + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + true + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + CONTRAIL_EXTERNAL + false + c4f4e878-cde0-4b15-ae9a-bda857759cea + 7dd5365547234ee8937416c65507d266 + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml new file mode 100644 index 0000000000..ca5145c226 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryInstance_Success.xml @@ -0,0 +1,4 @@ + + service-instance + https://aai-conexus-e2e.test.com:8443/aai/v8/business/customers/customer/8310000058863/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/f70e927b-6087-4974-9ef8-c5e4d5847ca4 + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml new file mode 100644 index 0000000000..d6f7737a2a --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName2_AAIResponse_Success.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4_3 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml new file mode 100644 index 0000000000..03b37814b1 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNameActive_AAIResponse_Success.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_2 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + active + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + active + true + subnetName + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + route-table-reference + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml new file mode 100644 index 0000000000..5cda12da2f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_404.xml @@ -0,0 +1,19 @@ + + 404 + HTTP method: GET Not Found + <Fault> + <requestError> + <serviceException> + <messageId>SVC3001</messageId> + <text>Resource not found for %1 using id %2 (msg=%3) (ec=%4)</text> + <variables> + <variable>GETl3Networks</variable> + <variable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/> + <variable>Node Not Found:No Node of type l3Network found for properties: (network-id = null)</variable> + <variable>ERR.5.4.6114</variable> + </variables> + </serviceException> + </requestError> +</Fault> + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml new file mode 100644 index 0000000000..4eadb1061e --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryName_AAIResponse_Success.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + + + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml new file mode 100644 index 0000000000..5cda12da2f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_404.xml @@ -0,0 +1,19 @@ + + 404 + HTTP method: GET Not Found + <Fault> + <requestError> + <serviceException> + <messageId>SVC3001</messageId> + <text>Resource not found for %1 using id %2 (msg=%3) (ec=%4)</text> + <variables> + <variable>GETl3Networks</variable> + <variable xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/> + <variable>Node Not Found:No Node of type l3Network found for properties: (network-id = null)</variable> + <variable>ERR.5.4.6114</variable> + </variables> + </serviceException> + </requestError> +</Fault> + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml new file mode 100644 index 0000000000..e06d27ea88 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml @@ -0,0 +1,73 @@ + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml new file mode 100644 index 0000000000..599c34fa73 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkId_AAIResponse_Success.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..686ac1667f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 13979:105757 + 13979:105757 + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml new file mode 100644 index 0000000000..b01e469cbf --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef1_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN1 + 12345 + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml new file mode 100644 index 0000000000..a19f9412c8 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryNetworkTableRef2_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN2 + 12345 + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml new file mode 100644 index 0000000000..c35faef27f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_queryVpnBinding_AAIResponse_Success.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 13979:105757 + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ + + l3-network.network-id + 689ec39e-c5fc-4462-8db2-4f760763ad28 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ + + l3-network.network-id + 1a49396b-19b3-40a4-8792-aa2fbd0f0704 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ + + l3-network.network-id + 774f3329-3c83-4771-86c7-9e6207cd50fd + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml new file mode 100644 index 0000000000..eedbda9343 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml new file mode 100644 index 0000000000..eedbda9343 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_createServiceInstance_AAIResponse_Success.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml new file mode 100644 index 0000000000..be820b83b1 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_queryGlobalCustomerId_AAIResponse_Success.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + 8310000058863 + Mobility + INFRA + 1452288058 + + + vMOG + 1452288058 + + + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + gg0e927b-6087-5574-9ef8-c5e4d5847db5 + V1.0 + vMOG-AKRON-1234 + 1462561835 + + + + + + + tenant + https://aai-conexus-e2e.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/396d61752cf04c3b8ca2afcb4ee049e9/ + + tenant.tenant-id + 396d61752cf04c3b8ca2afcb4ee049e9 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + AAIAIC25 + + + tenant.tenant-name + vMOG-AKRON-PROD + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml new file mode 100644 index 0000000000..1ede44427a --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleCallbackException.xml @@ -0,0 +1,7 @@ + + + {{MESSAGE-ID}} + INTERNAL + Exception during create VF Create VF Module: Unable to determine specific VF Module Type: Nimbus_LU2_PXMC_Svc/PXMC_09_20_2016_v2 3::Pxmc09202016V2..pxmc_base.yaml..module-2 with version = 3.0 + true + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..a421355aba --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,53 @@ + + + {{MESSAGE-ID}} + true + d485ecee-957c-4a0a-8b95-27a22b90103f + + + mmsc_vol_1 + a73e0fe9-1ce8-49c2-8fef-e2788605be29 + + + mmsc_vol_2 + 37b6455a-5ea8-463a-89e3-0efeaf7b7c6d + + + nemsfe_vol_1 + b7ff1c21-d138-49a3-bf13-4cfd91efaf48 + + + nemsbe_vol_1 + a5988471-cd42-44d8-b078-64f2f13d3d4c + + + mmsc_vol_5 + f7b91c1e-ab8c-413a-a850-ba80a246c7e0 + + + nemsfe_vol_2 + 957ea3f3-2d4a-4707-bfd2-ba66f42037c2 + + + mmsc_vol_3 + de6fccfe-d61a-48b0-b03b-87bf1bf749b3 + + + mmsc_vol_4 + 76162310-2c38-4c32-981c-5c2880190077 + + + + RDM2WAGPLCP + e585e4f4-9452-437a-b294-45a2d6d3b7a3 + + c30b9453-4b68-4c2e-aacf-58a5ba648bf5 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + 1bbab536a19b4756926e7d0ec1eb543c + true + 78987 + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml new file mode 100644 index 0000000000..458426660e --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/CreateVfModuleVolumeRequest.xml @@ -0,0 +1,24 @@ + + + 123abc + d8d4fcfa-fd7e-4413-b19d-c95aa67291b8 + CREATE_VF_MODULE_VOL + SoapUI-bns-create-base-vol-1001-1 + + + Test/vSAMP12 + vSAMP12::base::module-0 + + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MDTWNJ21 + 897deadc2b954a6bac6d3c197fb3525e + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + + + + value1" + value2" + value3" + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml new file mode 100644 index 0000000000..aea1a46017 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/GenericVnf.xml @@ -0,0 +1,38 @@ + + TEST-VNF-ID-0123 + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + lukewarm + PCRF::module-0-0 + introvert + 2.0 + true + fastburn + pending-create + 0000074 + + + supercool + PCRF::module-1-0 + extrovert + 2.0 + false + slowburn + pending-create + 0000075 + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..6ab9416617 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/RollbackVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,5 @@ + + + {{MESSAGE-ID}} + true + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json new file mode 100644 index 0000000000..91048eca9b --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request.json @@ -0,0 +1,65 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1", + "modelCustomizationId": "ee6478e5-ea33-3346-ac12-ab121484a3fe" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1", + "modelCustomizationName": "vSAMP12" + } + } + } + ], + "requestParameters": { + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": [ + {"name": "vnfName", "value": "STMTN5MMSC20" }, + {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, + {"name": "vnfNmInformation", "value": "" }, + {"name": "vnfType", "value": "pcrf-capacity" }, + {"name": "vnfId", "value": "skask" }, + {"name": "vnfStackId", "value": "slowburn" }, + {"name": "vnfStatus", "value": "created" }, + {"name": "aicCloudRegion", "value": "MDTWNJ21" }, + {"name": "availabilityZone", "value": "slcp3-esx-az01" }, + {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, + {"name": "vmName", "value": "slcp34246vbc246ceb" }, + {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, + {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } + ] + } + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json new file mode 100644 index 0000000000..72e41839fb --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_VID_request_noreqparm.json @@ -0,0 +1,45 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "{parent service model name}", + "modelVersion": "1" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test/vSAMP12", + "modelVersion": "1" + } + } + } + ] + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..02b43ff186 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + simpleCinderVolume_201604071 + simpleCinderVolume_201604071 + simpleCinderVolume_201604071 + simple_cinder_master + Pending + 1460134360 + + + tenant + https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..1574310474 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml new file mode 100644 index 0000000000..96e906f9bf --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_404.xml @@ -0,0 +1,31 @@ + + + 94f0f72f-4be1-49ed-8410-702396797163 + MSOTESTVOL103H-vSAMP12_base_vol_module-0 + + Test/vSAMP12 + Pending + 1469203133 + + + tenant + https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/e444c311b27a45dc9522f2370d70f90f/ + + tenant.tenant-id + e444c311b27a45dc9522f2370d70f90f + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + tenant.tenant-name + MSOCustomer1 + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..5e8913f335 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + 8424bb3c-c3e7-4553-9662-469649ed9379 + MSOTESTVOL103W-vSAMP12_base_vol_module-0 + + simple_cinder_master + Pending + 1460134360 + + + tenant + https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..1574310474 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml new file mode 100644 index 0000000000..416689e10c --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/CreateVfModuleVolumeInfraV1/getSIUrlById.xml @@ -0,0 +1,6 @@ + + + service-instance + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBAdapter.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBAdapter.xml new file mode 100644 index 0000000000..5a36d741d0 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBAdapter.xml @@ -0,0 +1 @@ +Notified \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml new file mode 100644 index 0000000000..7c30f75497 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml new file mode 100644 index 0000000000..8056f05d5a --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteGenericVNFV1/sdncAdapterResponse.xml @@ -0,0 +1,7 @@ + + + + <output xmlns="org:openecomp:sdnctl:vnf"><svc-request-id>1660b8da-0a94-442d-8ed5-ea079e3c67c8</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><vnf-information><vnf-id>8925b50d-de67-44c1-b984-e7ce7b0f4dae</vnf-id></vnf-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>8925b50d-de67-44c1-b984-e7ce7b0f4dae</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml new file mode 100644 index 0000000000..90c668c576 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 2.5 + RDM2WAGPLCP + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml new file mode 100644 index 0000000000..9b651f25e3 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + att-aic + RDM2WAGPLCP + 3.0 + RDM2WAGPLCP + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml new file mode 100644 index 0000000000..4ce7048950 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteAAIResponse_Failure500_RESTFault.xml @@ -0,0 +1,19 @@ + + 500 + HTTP method: GET Internal Server Error + <Fault> + <requestError> + <serviceException> + <messageId>SVC3002</messageId> + <text>Error writing output performing %1 on %2 (msg=%3) (ec=%4)</text> + <variables> + <variable>PUT customer</variable> + <variable>SubName32</variable> + <variable>Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [12312442454112] violates a uniqueness constraint [service-instance-id]</variable> + <variable>ERR.5.4.5105</variable> + </variables> + </serviceException> + </requestError> +</Fault> + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml new file mode 100644 index 0000000000..a740caacc4 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_Success.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + HSL_direct + contrail + 8bbd3edf-b835-4610-96a2-a5cafa029042 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + active + HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 + + + ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a + 5a77fdc2-7789-4649-a1b9-6eaf1db1813a + 172.16.34.1 + 172.16.34.0 + 28 + 4 + active + true + + + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ + + tenant.tenant-id + e81d842d3e8b45c5a59f57cd76af3aaf + + + + cloud-region + cloud-infrastructure/cloud-regions/cloud-region/att-aic/RDM2WAGPLCP/ + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + RDM2WAGPLCP + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml new file mode 100644 index 0000000000..841cae0a2b --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteNetworkV2/deleteNetworkAAIResponse_withRelationship_Success.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + bdc5efe8-404a-409b-85f6-0dcc9eebae30 + HSL_direct_net_2 + CONTRAIL_BASIC + HSL_direct + contrail + 8bbd3edf-b835-4610-96a2-a5cafa029042 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + active + HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6 + + + ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a + 5a77fdc2-7789-4649-a1b9-6eaf1db1813a + 172.16.34.1 + 172.16.34.0 + 28 + 4 + active + true + + + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/ + + tenant.tenant-id + e81d842d3e8b45c5a59f57cd76af3aaf + + + + vf-module + https://aai-app-e2e.ecomp.cci.com:8443/aai/v8/network/generic-vnfs/generic-vnf/105df7e5-0b3b-49f7-a837-4864b62827c4/vf-modules/vf-module/d9217058-95a0-49ee-b9a9-949259e89349/ + + generic-vnf.vnf-id + 105df7e5-0b3b-49f7-a837-4864b62827c4 + + + vf-module.vf-module-id + d9217058-95a0-49ee-b9a9-949259e89349 + + + + generic-vnf + https://aai-app-e2e.test.com:8443/aai/v8/network/generic-vnfs/generic-vnf/45f822d9-73ca-4255-9844-7cef401bbf47/ + + generic-vnf.vnf-id + 45f822d9-73ca-4255-9844-7cef401bbf47 + + + generic-vnf.vnf-name + zrdm1scpx05 + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..25aa45afd9 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/DeleteVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,5 @@ + + + {{MESSAGE-ID}} + true + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json new file mode 100644 index 0000000000..35ba121086 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json @@ -0,0 +1,17 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantId": "0b01b8c2-8416-11e6-ae22-56b6b6499611", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1.0" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "MDTWNJ21", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "source": "VID" + } + } +} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml new file mode 100644 index 0000000000..fd10548cef --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml @@ -0,0 +1,42 @@ + + 78987 + MSOTESTVOL102a-vSAMP12_base_vol_module-0 + + Test/vSAMP12 + Pending + 0000020 + + + generic-vnf + https://aai-ext1.test.com:8443/aai/v8/network/generic-vnfs/generic-vnf/9e48f6ea-f786-46de-800a-d480e5ccc846/ + + generic-vnf.vnf-id + 9e48f6ea-f786-46de-800a-d480e5ccc846 + + + generic-vnf.vnf-name + MSOSTSAMP12-10601 + + + + tenant + https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ + + tenant.tenant-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mdt1 + + + tenant.tenant-name + ECOMP_MDT1 + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml new file mode 100644 index 0000000000..50e4347e5f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnf.xml @@ -0,0 +1,26 @@ + + a27ce5a9-29c4-4c22-a017-6615ac73c721 + STMTN5MMSC21 + mmsc-capacity + SDN-MOBILITY + vMMSC + pending-create + false + false + 1508691 + + + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + STMTN5MMSC21-MMSC::module-0-0 + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + 1.0 + true + FILLED-IN-BY-MSO + pending-create + 1508692 + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml new file mode 100644 index 0000000000..f60260d85b --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleRollback/GenericVnfVfModule.xml @@ -0,0 +1,26 @@ + + a27ce5a9-29c4-4c22-a017-6615ac73c721 + STMTN5MMSC21 + mmsc-capacity + SDN-MOBILITY + vMMSC + pending-create + false + false + 0000021 + + + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + STMTN5MMSC21-MMSC::module-0-0 + 973ed047-d251-4fb9-bf1a-65b8949e0a73 + 1.0 + true + FILLED-IN-BY-MSO + pending-create + 0000073 + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..a421355aba --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,53 @@ + + + {{MESSAGE-ID}} + true + d485ecee-957c-4a0a-8b95-27a22b90103f + + + mmsc_vol_1 + a73e0fe9-1ce8-49c2-8fef-e2788605be29 + + + mmsc_vol_2 + 37b6455a-5ea8-463a-89e3-0efeaf7b7c6d + + + nemsfe_vol_1 + b7ff1c21-d138-49a3-bf13-4cfd91efaf48 + + + nemsbe_vol_1 + a5988471-cd42-44d8-b078-64f2f13d3d4c + + + mmsc_vol_5 + f7b91c1e-ab8c-413a-a850-ba80a246c7e0 + + + nemsfe_vol_2 + 957ea3f3-2d4a-4707-bfd2-ba66f42037c2 + + + mmsc_vol_3 + de6fccfe-d61a-48b0-b03b-87bf1bf749b3 + + + mmsc_vol_4 + 76162310-2c38-4c32-981c-5c2880190077 + + + + RDM2WAGPLCP + e585e4f4-9452-437a-b294-45a2d6d3b7a3 + + c30b9453-4b68-4c2e-aacf-58a5ba648bf5 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + 1bbab536a19b4756926e7d0ec1eb543c + true + 78987 + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + + ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml new file mode 100644 index 0000000000..803a847bbc --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeNoRollbackRequest.xml @@ -0,0 +1,24 @@ + + + 123abc + d8d4fcfa-fd7e-4413-b19d-c95aa67291b8 + CREATE_VF_MODULE_VOL + SoapUI-bns-create-base-vol-1001-1 + + + Test/vSAMP12 + vSAMP12::base::module-0 + false + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MDTWNJ21 + 897deadc2b954a6bac6d3c197fb3525e + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + + + + value1" + value2" + value3" + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml new file mode 100644 index 0000000000..e6ada9c826 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/CreateVfModuleVolumeRequest.xml @@ -0,0 +1,24 @@ + + + 123abc + d8d4fcfa-fd7e-4413-b19d-c95aa67291b8 + CREATE_VF_MODULE_VOL + SoapUI-bns-create-base-vol-1001-1 + + + Test/vSAMP12 + vSAMP12::base::module-0 + true + + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + MDTWNJ21 + 897deadc2b954a6bac6d3c197fb3525e + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + + + + value1" + value2" + value3" + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml new file mode 100644 index 0000000000..aea1a46017 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/GenericVnf.xml @@ -0,0 +1,38 @@ + + TEST-VNF-ID-0123 + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + lukewarm + PCRF::module-0-0 + introvert + 2.0 + true + fastburn + pending-create + 0000074 + + + supercool + PCRF::module-1-0 + extrovert + 2.0 + false + slowburn + pending-create + 0000075 + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml new file mode 100644 index 0000000000..6ab9416617 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/RollbackVfModuleVolumeCallbackResponse.xml @@ -0,0 +1,5 @@ + + + {{MESSAGE-ID}} + true + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json new file mode 100644 index 0000000000..5ff965f7e2 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_VID_request.json @@ -0,0 +1,64 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL103W-vSAMP12_base_vol_module-0", + "source": "VID", + "callbackUrl": "{do we support this???}" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "{parent service model name}", + "modelVersion": "1" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test/vSAMP12", + "modelVersion": "1" + } + } + } + ], + "requestParameters": { + "backoutOnFailure": true, + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": { + {"name": "vnfName", "value": "STMTN5MMSC20" }, + {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, + {"name": "vnfNmInformation", "value": "" }, + {"name": "vnfType", "value": "pcrf-capacity" }, + {"name": "vnfId", "value": "skask" }, + {"name": "vnfStackId", "value": "slowburn" }, + {"name": "vnfStatus", "value": "created" }, + {"name": "aicCloudRegion", "value": "MDTWNJ21" }, + {"name": "availabilityZone", "value": "slcp3-esx-az01" }, + {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, + {"name": "vmName", "value": "slcp34246vbc246ceb" }, + {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, + {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } + } + } + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..02b43ff186 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_createVolumeName_AAIResponse_Success.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + simpleCinderVolume_201604071 + simpleCinderVolume_201604071 + simpleCinderVolume_201604071 + simple_cinder_master + Pending + 1460134360 + + + tenant + https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..1574310474 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_deleteVolumeName_AAIResponse_Success.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..5e8913f335 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_queryVolumeName_AAIResponse_Success.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + 8424bb3c-c3e7-4553-9662-469649ed9379 + MSOTESTVOL103W-vSAMP12_base_vol_module-0 + + simple_cinder_master + Pending + 1460134360 + + + tenant + https://aai-ext1.test.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/ + + tenant.tenant-id + 897deadc2b954a6bac6d3c197fb3525e + + + tenant.tenant-name + MSOTest1 + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml new file mode 100644 index 0000000000..1574310474 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DoCreateVfModuleVolumeV1/createVfModuleVolume_updateVolumeName_AAIResponse_Success.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml new file mode 100644 index 0000000000..a472996121 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml @@ -0,0 +1,23 @@ + + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + testReVer123 + + + nothing + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml new file mode 100644 index 0000000000..8ba178cc1c --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml @@ -0,0 +1,90 @@ + + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + + 802767b3-18a6-4432-96db-25522786aee0 + ZRDM1MMSC03 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml new file mode 100644 index 0000000000..8ba178cc1c --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml @@ -0,0 +1,90 @@ + + + 2f1cc940-455f-4ee2-9411-a7899cd4f124 + testVnfName123 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + + 802767b3-18a6-4432-96db-25522786aee0 + ZRDM1MMSC03 + mmsc-capacity + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + vMMSC + pending-create + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/c597ab81-fece-49f4-a4f5-710cebb13c29/ + + l3-network.network-id + c597ab81-fece-49f4-a4f5-710cebb13c29 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/53956c91-6e5e-49aa-88dd-535f57e66e70/ + + l3-network.network-id + 53956c91-6e5e-49aa-88dd-535f57e66e70 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/44e0d9e0-9334-4ec6-9344-07a96dac629f/ + + l3-network.network-id + 44e0d9e0-9334-4ec6-9344-07a96dac629f + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/ac49d99b-5daf-4624-9f8e-188b126ea166/ + + l3-network.network-id + ac49d99b-5daf-4624-9f8e-188b126ea166 + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml new file mode 100644 index 0000000000..416689e10c --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml @@ -0,0 +1,6 @@ + + + service-instance + https://aai-ext1.test.com:8443/aai/v7/business/customers/customer/SDN-ETHERNET-INTERNET/service-subscriptions/service-subscription/123456789/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml new file mode 100644 index 0000000000..e377c70474 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml @@ -0,0 +1,30 @@ + + MIS/1604/0026/SW_INTERNET + 123456789 + + + cvlan-tag + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/port-groups/port-group/slcp1447vbc.ipag/cvlan-tags/cvlan-tag/2003/ + + cvlan-tag.cvlan-tag + 2003 + + + port-group.interface-id + slcp1447vbc.ipag + + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + vce + https://aai-ext1.test.com:8443/aai/v2/network/vces/vce/832bace2-3fb0-49e0-a6a4-07c47223c535/ + + vce.vnf-id + 832bace2-3fb0-49e0-a6a4-07c47223c535 + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json new file mode 100644 index 0000000000..2b9c2879a7 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/CreateVnfInfraRequest.json @@ -0,0 +1,38 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vnf", + "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelCustomizationName": "vSAMP12 1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "testVnfName123", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{serviceInstanceId}", + "modelInfo": { + "modelType": "service", + "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "{parent service model name}", + "modelVersion": "1.0" + } + } + } + ], + "requestParameters": { + } + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json new file mode 100644 index 0000000000..f90b9678f0 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DeleteVnfInfraRequestCascadeDelete.json @@ -0,0 +1,39 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vnf", + "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelCustomizationName": "vSAMP12 1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestInfo": { + "instanceName": "testVnfName123", + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{serviceInstanceId}", + "modelInfo": { + "modelType": "service", + "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "{parent service model name}", + "modelVersion": "1.0" + } + } + } + ], + "requestParameters": { + "cascadeDelete": true + } + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json new file mode 100644 index 0000000000..e3556e7b4a --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/UpdateVfModule_VID_request.json @@ -0,0 +1,51 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantId": "introvert", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1", +"modelCustomizationId": "MODEL12345" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "PCRF::module-0", +"instanceId": "supercool", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "123456", +"modelInfo": { +"modelType": "service", +"modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", +"modelName": "SERVICE_MODEL_NAME", +"modelVersion": "1.0" +} +} +}, +{ +"relatedInstance": { +"instanceId": "skask", +"modelInfo": { +"modelType": "vnf", +"modelInvariantId": "skask", +"modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationName": "vSAMP12 1" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml new file mode 100644 index 0000000000..a5640b2b26 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml @@ -0,0 +1,6 @@ + + +680bd458-5ec1-4a16-b77c-509022e53450INTERNAL +400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data +true + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml new file mode 100644 index 0000000000..c67e980c63 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml @@ -0,0 +1,78 @@ + + + JBoss Web/7.2.2.Final-redhat-1 - JBWEB000064: Error report + + + + +

JBWEB000065: HTTP Status 500 - java.lang.NullPointerException

+
+

+ JBWEB000309: type + JBWEB000066: Exception report +

+

+ JBWEB000068: message + java.lang.NullPointerException +

+

+ JBWEB000069: description + JBWEB000145: The server encountered an internal error that + prevented it from fulfilling this request. +

+

+ JBWEB000070: exception +

org.jboss.resteasy.spi.UnhandledException:
+					java.lang.NullPointerException
+					org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365)
+					org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233)
+					org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209)
+					org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557)
+					org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
+					org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
+					org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
+					org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
+					org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
+					javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
+					org.openecomp.mso.logger.LogFilter.doFilter(LogFilter.java:35)
+				
+

+

+ JBWEB000071: root cause +

java.lang.NullPointerException
+					org.openecomp.mso.adapters.network.NetworkAdapterRest$CreateNetworkVolumesTask.run(NetworkAdapterRest.java:128)
+					org.openecomp.mso.adapters.network.NetworkAdapterRest.createNetwork(NetworkAdapterRest.java:64)
+					sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+					sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+					sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+					java.lang.reflect.Method.invoke(Method.java:606)
+					org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
+					org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
+					org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
+					org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216)
+					org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
+					org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
+					org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
+					org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
+					org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
+					org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
+					javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
+					org.openecomp.mso.logger.LogFilter.doFilter(LogFilter.java:35)
+				
+

+

+ JBWEB000072: note + JBWEB000073: The full stack trace of the root cause is available + in the JBoss Web/7.2.2.Final-redhat-1 logs. +

+
+

JBoss Web/7.2.2.Final-redhat-1

+ + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml new file mode 100644 index 0000000000..7a00744103 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml @@ -0,0 +1,24 @@ + + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + c4f4e878-cde0-4b15-ae9a-bda857759cea + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73 + + + + RDM2WAGPLCP + + 1ef47428-cade-45bd-a103-0751e8b2deb0 + + + true + MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641 + CONTRAIL_EXTERNAL + false + c4f4e878-cde0-4b15-ae9a-bda857759cea + 7dd5365547234ee8937416c65507d266 + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml new file mode 100644 index 0000000000..ca5145c226 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml @@ -0,0 +1,4 @@ + + service-instance + https://aai-conexus-e2e.test.com:8443/aai/v8/business/customers/customer/8310000058863/service-subscriptions/service-subscription/vMOG/service-instances/service-instance/f70e927b-6087-4974-9ef8-c5e4d5847ca4 + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml new file mode 100644 index 0000000000..e06d27ea88 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml @@ -0,0 +1,73 @@ + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml new file mode 100644 index 0000000000..24ee1df9c8 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + 49c86598-f766-46f8-84f8-8d1c1b10f9b4 + MNS-25180-L-01-dmz_direct_net_1 + CONTRAIL_EXTERNAL + dmz_direct + contrail + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + 0 + pending-create + networkName + false + true + false + + + 57e9a1ff-d14f-4071-a828-b19ae98eb2fc + 107.239.52.1 + 107.239.52.0 + 24 + 4 + pending-create + true + subnetName + + + + + 413 + 4132176 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + + vpn-binding.vpn-id + 85f015d0-2e32-4c30-96d2-87a1a27f8017 + + + + vpn-binding + https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/ + + vpn-binding.vpn-id + c980a6ef-3b88-49f0-9751-dbad8608d0a6 + + + + tenant + https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg + + network-policy.network-policy-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + route-table-reference + https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2 + + route-table-reference.route-table-reference-id + cee6d136-e378-4678-a024-2cd15f0ee0hi + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..686ac1667f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 13979:105757 + 13979:105757 + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml new file mode 100644 index 0000000000..b01e469cbf --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN1 + 12345 + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml new file mode 100644 index 0000000000..a19f9412c8 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + 5938baec-03ca-2bd5-a3f1-d54x123e253a + refFQDN2 + 12345 + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml new file mode 100644 index 0000000000..c35faef27f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 13979:105757 + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/ + + l3-network.network-id + 689ec39e-c5fc-4462-8db2-4f760763ad28 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/ + + l3-network.network-id + 1a49396b-19b3-40a4-8792-aa2fbd0f0704 + + + + l3-network + https://aai-app-e2e.test.com:8443/aai/v8/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/ + + l3-network.network-id + 774f3329-3c83-4771-86c7-9e6207cd50fd + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml new file mode 100644 index 0000000000..eedbda9343 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml new file mode 100644 index 0000000000..b03e95c013 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/queryVolumeId_AAIResponse_Success.xml @@ -0,0 +1,44 @@ + + + 78987 + MSOTESTVOL102a-vSAMP12_base_vol_module-0 + + Test/vSAMP12 + Pending + 0000020 + + + tenant + https://aai-ext1.test.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mdt1/tenants/tenant/fba1bd1e195a404cacb9ce17a9b2b421/ + + tenant.tenant-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mdt1 + + + tenant.tenant-name + ECOMP_MDT1 + + + + vf-module + http://localhost:28090/aai/v8/network/generic-vnfs/generic-vnf/9e48f6ea-f786-46de-800a-d480e5ccc846/vf-modules/vf-module/6a1dc898-b590-47b9-bbf0-34424a7a2ec3/ + + generic-vnf.vnf-id + 9e48f6ea-f786-46de-800a-d480e5ccc846 + + + vf-module.vf-module-id + 6a1dc898-b590-47b9-bbf0-34424a7a2ec3 + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json new file mode 100644 index 0000000000..8ab460e24d --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request.json @@ -0,0 +1,64 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test/vSAMP12", + "modelVersion": "1", + "modelCustomizationName": "vSAMP12" + } + } + } + ], + "requestParameters": { + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": [ + {"name": "vnfName", "value": "STMTN5MMSC20" }, + {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, + {"name": "vnfNmInformation", "value": "" }, + {"name": "vnfType", "value": "pcrf-capacity" }, + {"name": "vnfId", "value": "skask" }, + {"name": "vnfStackId", "value": "slowburn" }, + {"name": "vnfStatus", "value": "created" }, + {"name": "aicCloudRegion", "value": "MDTWNJ21" }, + {"name": "availabilityZone", "value": "slcp3-esx-az01" }, + {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, + {"name": "vmName", "value": "slcp34246vbc246ceb" }, + {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, + {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } + ] + } + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json new file mode 100644 index 0000000000..963e2dd7d7 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/updateVfModuleVolume_VID_request_2.json @@ -0,0 +1,64 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12::base::module-0", + "modelVersion": "1" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "MSOTESTVOL101a-vSAMP12_base_vol_module-0", + "source": "VID", + "suppressRollback": false + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "{service-instance-id}", + "modelInfo": { + "modelType": "service", + "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff-x", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test", + "modelVersion": "2.0" + } + } + }, { + "relatedInstance": { + "instanceId": "{vnf-instance-id}", + "modelInfo": { + "modelType": "vnf", + "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "Test/vSAMP12", + "modelVersion": "1", + "modelCustomizationName": "vSAMP12" + } + } + } + ], + "requestParameters": { + "serviceId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "userParams": [ + {"name": "vnfName", "value": "STMTN5MMSC20" }, + {"name": "vnfName2", "value": "US1117MTSNJVBR0246" }, + {"name": "vnfNmInformation", "value": "" }, + {"name": "vnfType", "value": "pcrf-capacity" }, + {"name": "vnfId", "value": "skask" }, + {"name": "vnfStackId", "value": "slowburn" }, + {"name": "vnfStatus", "value": "created" }, + {"name": "aicCloudRegion", "value": "MDTWNJ21" }, + {"name": "availabilityZone", "value": "slcp3-esx-az01" }, + {"name": "oamNetworkName", "value": "VLAN-OAM-1323" }, + {"name": "vmName", "value": "slcp34246vbc246ceb" }, + {"name": "ipagNetworkId", "value": "970cd2b9-7f09-4a12-af47-182ea38ba1f0" }, + {"name": "vpeNetworkId", "value": "545cc2c3-1930-4100-b534-5d82d0e12bb6" } + ] + } + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml new file mode 100644 index 0000000000..aa2a85c579 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/UpdateVfModuleVolumeInfraV1/vf_module_aai_response.xml @@ -0,0 +1,29 @@ + + 6a1dc898-b590-47b9-bbf0-34424a7a2ec3 + MSOST10606-vSAMP12_MTN6_base_module-0 + MSOST10606-vSAMP12_MTN6_base_module-0/81b01583-690c-4ec3-9c58-0eafa7a90be7 + active + true + 1475077639 + ff5256d2-5a33-55df-13ab-12abad84e7ff + 1.0 + + + volume-group + https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/volume-groups/volume-group/064bd1c6-e377-4009-a744-e958eec6e727/ + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + mtn6 + + + volume-group.volume-group-id + 064bd1c6-e377-4009-a744-e958eec6e727 + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..0ec1e30022 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + fqdn123 + slowburn + 145878989 + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml new file mode 100644 index 0000000000..b2560bcb47 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml @@ -0,0 +1,38 @@ + + skask + STMTN5MMSC20 + pcrf-capacity + SDN-MOBILITY + vPCRF + pending-create + false + false + introvert + 2.0 + 0000020 + + + lukewarm + PCRF::module-0-0 + introvert + 2.0 + true + fastburn + pending-create + 0000074 + + + supercool + PCRF::module-1-0 + extrovert + 2.0 + false + slowburn + pending-create + 0000075 + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..d7bbb15b8c --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + 9a7b327d9-287aa00-82c4b0-105757 + GN_EVPN_Test + 195159195 + 14567890 + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml new file mode 100644 index 0000000000..919ff2c36b --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml new file mode 100644 index 0000000000..a71441e916 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml @@ -0,0 +1,9 @@ + + b37d96db-7d2c-47ce-bf61-a6c7b82fe161 + PCRF::module-0-2 + 00000000-0000-0000-0000-000000000000 + 1.0 + false + pending-create + 330-90 + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml new file mode 100644 index 0000000000..1066b17b94 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml @@ -0,0 +1,27 @@ + + supercool + PCRF::module-2 + fastburn + pending-create + false + 330-89 + introvert + 2.0 + + + volume-group + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + pdk1 + + + volume-group.volume-group-id + 78987 + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml new file mode 100644 index 0000000000..df84706ec5 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml @@ -0,0 +1,25 @@ + + 78987 + Volume_2 + slowburn + pcrf-capacity + Active + 0000020 + + + tenant + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + MDTWNJ21 + + + tenant.tenant-id + fba1bd1e195a404cacb9ce17a9b2b421 + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/deleteNetworkResponse_Success.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/deleteNetworkResponse_Success.xml new file mode 100644 index 0000000000..902c0837d9 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/deleteNetworkResponse_Success.xml @@ -0,0 +1,3 @@ + + true + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/camunda.cfg.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/camunda.cfg.xml new file mode 100644 index 0000000000..c94e32e686 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/camunda.cfg.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/logging.properties b/bpmn/MSOInfrastructureBPMN/src/test/resources/logging.properties new file mode 100644 index 0000000000..4941c55971 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/logging.properties @@ -0,0 +1,2 @@ +#register SLF4JBridgeHandler as handler for the j.u.l. root logger +handlers = org.slf4j.bridge.SLF4JBridgeHandler diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.properties b/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.properties new file mode 100644 index 0000000000..f800d00245 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.properties @@ -0,0 +1,3 @@ +# Default BPMN properties for unit tests + +URNMapping.FileSystemLoading.Enabled=true \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties b/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties new file mode 100644 index 0000000000..4ec6617431 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties @@ -0,0 +1,85 @@ +# Default URN Mappings for unit tests + +mso.rollback=true + +canopi.auth=757A94191D685FD2092AC1490730A4FC +csi.aots.addincidentmanagement.endpoint=http://localhost:28090/AddIncidentManagementTicketRequest +csi.networkstatus.endpoint=http://localhost:28090/SendManagedNetworkStatusNotification +mso.csi.pwd=4EA237303511EFBBC37F17A351562131 +mso.csi.usrname=mso +mso.msoKey=07a7159d3bf51a0e53be7a8f89699be7 + +mso.adapters.completemsoprocess.endpoint=http://localhost:28090/CompleteMsoProcess + +mso.adapters.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter +mso.adapters.db.auth=757A94191D685FD2092AC1490730A4FC + +mso.adapters.network.endpoint=http://localhost:28090/networks/NetworkAdapter +mso.adapters.network.rest.endpoint=http://localhost:28090/networks/NetworkAdapter + +mso.adapters.po.auth=757A94191D685FD2092AC1490730A4FC +mso.adapters.po.password=3141634BF7E070AA289CF2892C986C0B +mso.po.timeout=PT60S + +aai.auth=757A94191D685FD2092AC1490730A4FC + +mso.adapters.sdnc.endpoint=http://localhost:28090/SDNCAdapter +mso.adapters.sdnc.rest.endpoint=http://localhost:28090/SDNCAdapter/v1/sdnc +mso.adapters.sdnc.timeout=PT60S +mso.sdnc.firewall.yang.model=http://com/openecomp/svc/mis/firewall-lite-gui +mso.sdnc.firewall.yang.model.version=2015-05-15 +mso.sdnc.password=3141634BF7E070AA289CF2892C986C0B +mso.sdnc.timeout.firewall.minutes=20 +mso.sdnc.timeout=PT10S +mso.sdnc.timeout.ucpe.async.hours=120 +mso.sdnc.timeout.ucpe.async.minutes=5 +mso.workflow.message.endpoint=http://localhost:28080/mso/WorkflowMesssage +mso.workflow.sdncadapter.callback=http://localhost:28080/mso/SDNCAdapterCallbackService + +mso.catalog.db.endpoint=http://localhost:28090/ + +mso.adapters.tenant.endpoint=http://localhost:28090/tenantAdapterMock +mso.adapters.vnf-async.endpoint=http://localhost:28090/vnfs/VnfAdapterAsync +mso.adapters.vnf.endpoint=http://localhost:28090/vnfs/VnfAdapter +mso.adapters.vnf.rest.endpoint=http://localhost:28090/vnfs/v1/vnfs +mso.workflow.vnfadapter.create.callback=http://localhost:28080/mso/vnfAdapterNotify +mso.workflow.vnfadapter.delete.callback=http://localhost:28080/mso/vnfAdapterNotify +mso.workflow.vnfadapter.query.callback=http://localhost:28080/mso/services/VNFAdapterQuerCallbackV1 +mso.workflow.vnfadapter.rollback.callback=http://localhost:28080/mso/vnfAdapterNotify +mso.workflow.createvce.delay.seconds=1 +mso.infra.customer.id=testCustIdInfra + +aai.endpoint=http://localhost:28090 + +# AAI version mappings + +# Example to override default version for a resource: +#mso.workflow.default.aai.vce.version=6 +#mso.workflow.default.aai.v6.vce.uri=/aai/v6/network/vces/vce + +mso.workflow.global.default.aai.version=8 +mso.workflow.default.aai.cloud-region.version=9 +mso.workflow.default.aai.generic-vnf.version=9 + +mso.workflow.default.aai.v9.cloud-region.uri=/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic +mso.workflow.default.aai.v8.customer.uri=/aai/v8/business/customers/customer +mso.workflow.default.aai.v8.generic-query.uri=/aai/v8/search/generic-query +mso.workflow.default.aai.v9.generic-vnf.uri=/aai/v9/network/generic-vnfs/generic-vnf +mso.workflow.default.aai.v8.l3-network.uri=/aai/v8/network/l3-networks/l3-network +mso.workflow.default.aai.v8.network-policy.uri=/aai/v8/network/network-policies/network-policy +mso.workflow.default.aai.v8.nodes-query.uri=/aai/v8/search/nodes-query +mso.workflow.default.aai.v8.route-table-reference.uri=/aai/v8/network/route-table-references/route-table-reference +mso.workflow.default.aai.v8.tenant.uri=/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant +mso.workflow.default.aai.v8.vce.uri=/aai/v8/network/vces/vce +mso.workflow.default.aai.v8.vpn-binding.uri=/aai/v8/network/vpn-bindings/vpn-binding + + +log.debug.CompleteMsoProcess=true +log.debug.CreateNetworkInstanceInfra=true +log.debug.CreateServiceInstanceInfra=true +log.debug.DeleteNetworkInstanceInfra=true +log.debug.FalloutHandler=true +log.debug.GenericGetService=true +log.debug.sdncAdapter=true +log.debug.UpdateNetworkInstanceInfra=true +log.debug.VnfAdapterRestV1=true \ No newline at end of file -- cgit 1.2.3-korg