From b6b7bef8bdcad15af01ac88a038dd763ce59f68f Mon Sep 17 00:00:00 2001 From: xg353y Date: Tue, 11 Apr 2017 13:30:42 +0200 Subject: [PATCH] [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 --- adapters/mso-adapter-utils/pom.xml | 19 +- .../mso/cloud/CloudConfigIdentityMapper.java | 29 + .../org/openecomp/mso/cloud/CloudIdentity.java | 114 +- .../cloud/IdentityAuthenticationTypeAbstract.java | 75 + ...IdentityAuthenticationTypeJsonDeserializer.java | 44 + .../IdentityAuthenticationTypeJsonSerializer.java | 38 + .../mso/cloud/IdentityServerTypeAbstract.java | 77 + .../cloud/IdentityServerTypeJsonDeserializer.java | 44 + .../cloud/IdentityServerTypeJsonSerializer.java | 38 + .../AuthenticationMethodFactory.java | 79 + .../authentication/AuthenticationWrapper.java | 58 + .../models/RackspaceAuthentication.java | 99 + .../wrappers/RackspaceAPIKeyWrapper.java | 55 + .../wrappers/UsernamePasswordWrapper.java | 55 + .../openecomp/mso/openstack/beans/VnfRollback.java | 24 +- .../openstack/utils/CloudConfigInitializer.java | 16 + .../mso/openstack/utils/MsoHeatUtils.java | 101 +- .../mso/openstack/utils/MsoKeystoneUtils.java | 9 +- .../mso/openstack/utils/MsoNeutronUtils.java | 4 - .../mso/openstack/utils/MsoTenantUtils.java | 6 +- .../mso/openstack/utils/MsoTenantUtilsFactory.java | 17 +- .../mso/adapter_utils/tests/CloudConfigTest.java | 43 +- .../mso/adapter_utils/tests/MsoHeatUtilsTest.java | 36 +- .../authentication/AuthenticationMethodTest.java | 115 + .../mso/cloud/servertype/NewServerTypeUtils.java | 56 + .../mso/cloud/servertype/ServerTypeTest.java | 63 + .../mso/openstack/beans/VnfRollbackESTest.java | 800 ++--- .../src/test/resources/cloud_config.json | 15 +- adapters/mso-adapters-rest-interface/pom.xml | 2 +- .../QueryAllottedResourceCustomization.java | 69 + .../catalogrest/QueryServiceMacroHolder.java | 56 + .../adapters/catalogrest/QueryServiceNetworks.java | 78 + .../mso/adapters/catalogrest/QueryServiceVnfs.java | 79 + .../mso/adapters/json/MapDeserializer.java | 74 + .../openecomp/mso/adapters/json/MapSerializer.java | 67 + .../mso/adapters/sdncrest/RequestInformation.java | 87 + .../mso/adapters/sdncrest/SDNCErrorCommon.java | 37 + .../openecomp/mso/adapters/sdncrest/SDNCEvent.java | 151 + .../mso/adapters/sdncrest/SDNCRequestCommon.java | 109 + .../mso/adapters/sdncrest/SDNCResponseCommon.java | 117 + .../mso/adapters/sdncrest/SDNCServiceError.java | 50 + .../mso/adapters/sdncrest/SDNCServiceRequest.java | 146 + .../mso/adapters/sdncrest/SDNCServiceResponse.java | 91 + .../mso/adapters/sdncrest/ServiceInformation.java | 102 + .../adapters/vnfrest/CreateVfModuleRequest.java | 13 +- .../adapters/vnfrest/CreateVolumeGroupRequest.java | 13 +- .../adapters/vnfrest/DeleteVfModuleResponse.java | 19 +- .../adapters/vnfrest/UpdateVfModuleRequest.java | 14 +- .../adapters/vnfrest/UpdateVolumeGroupRequest.java | 13 +- .../QueryAllottedResourceCustomizationESTest.java | 97 + ...ttedResourceCustomizationESTestscaffolding.java | 264 ++ .../catalogrest/QueryServiceMacroHolderESTest.java | 109 + .../QueryServiceMacroHolderESTestscaffolding.java | 221 ++ .../catalogrest/QueryServiceNetworksESTest.java | 163 ++ .../QueryServiceNetworksESTestscaffolding.java | 265 ++ .../catalogrest/QueryServiceVnfsESTest.java | 188 ++ .../QueryServiceVnfsESTestscaffolding.java | 264 ++ .../sdncrest/RequestInformationESTest.java | 108 + .../RequestInformationESTestscaffolding.java | 92 +- .../adapters/sdncrest/SDNCErrorCommonESTest.java | 28 + .../sdncrest/SDNCErrorCommonESTestscaffolding.java | 96 + .../adapters/sdncrest/SDNCServiceErrorESTest.java | 28 + .../SDNCServiceErrorESTestscaffolding.java | 96 + .../sdncrest/SDNCServiceRequestESTest.java | 172 ++ .../SDNCServiceRequestESTestscaffolding.java | 110 + .../sdncrest/SDNCServiceResponseESTest.java | 63 + .../SDNCServiceResponseESTestscaffolding.java | 246 ++ .../sdncrest/ServiceInformationESTest.java | 118 + .../ServiceInformationESTestscaffolding.java | 92 +- .../vnfrest/CreateVfModuleResponseESTest.java | 288 +- .../vnfrest/DeleteVfModuleResponseESTest.java | 182 +- .../vnfrest/RollbackVfModuleRequestESTest.java | 48 +- .../adapters/vnfrest/VfModuleRollbackESTest.java | 469 +-- .../WEB-INF/jboss-deployment-structure.xml | 17 + .../WebContent/WEB-INF/jboss-web.xml | 3 + .../WebContent/WEB-INF/web.xml | 49 + adapters/mso-catalog-db-adapter/pom.xml | 105 + .../adapters/catalogdb/CatalogDbAdapterRest.java | 393 +++ adapters/mso-network-adapter-async-client/pom.xml | 3 +- .../src/main/resources/NetworkAdapterNotify.wsdl | 24 +- .../mso/adapters/network/BpelRestClient.java | 42 +- .../mso/adapters/network/MsoNetworkAdapter.java | 2 +- .../adapters/network/MsoNetworkAdapterAsync.java | 2 +- .../network/MsoNetworkAdapterAsyncImpl.java | 4 +- .../adapters/network/MsoNetworkAdapterImpl.java | 574 ++-- .../network/exceptions/NetworkException.java | 2 +- .../mso/adapters/network/NetworkAdapterTest.java | 10 +- .../WebContent/WEB-INF/web.xml | 11 + .../adapters/requestsdb/MsoRequestsDbAdapter.java | 9 +- .../requestsdb/MsoRequestsDbAdapterImpl.java | 39 +- .../exceptions/MsoRequestsDbException.java | 2 +- .../mso-sdnc-adapter/WebContent/WEB-INF/web.xml | 8 +- .../null/mso-config/uuid/uuid_null | 1 - adapters/mso-sdnc-adapter/pom.xml | 6 + adapters/mso-sdnc-adapter/readme | 2 +- .../mso/adapters/sdnc/SDNCAdapterPortType.java | 6 +- .../mso/adapters/sdnc/SDNCAdapterRequest.java | 2 +- .../mso/adapters/sdnc/SDNCAdapterService.java | 6 +- .../sdnc/client/SDNCAdapterCallbackRequest.java | 2 +- .../sdnc/client/SDNCCallbackAdapterPortType.java | 6 +- .../sdnc/client/SDNCCallbackAdapterService.java | 6 +- .../mso/adapters/sdnc/client/package-info.java | 2 +- .../mso/adapters/sdnc/impl/Constants.java | 9 +- .../sdnc/impl/SDNCAdapterPortTypeImpl.java | 2 +- .../openecomp/mso/adapters/sdnc/package-info.java | 2 +- .../mso/adapters/sdnc/sdncrest/BPRestCallback.java | 173 ++ .../sdnc/sdncrest/SDNCAdapterProperties.java | 85 + .../adapters/sdnc/sdncrest/SDNCAdapterRest.java | 239 ++ .../adapters/sdnc/sdncrest/SDNCAdapterUtils.java | 70 + .../mso/adapters/sdnc/sdncrest/SDNCConnector.java | 309 ++ .../adapters/sdnc/sdncrest/SDNCEventParser.java | 156 + .../sdnc/sdncrest/SDNCServiceRequestConnector.java | 194 ++ .../sdnc/sdncrest/SDNCServiceRequestTask.java | 205 ++ .../mso/adapters/sdnc/sdncrest/SNIROResponse.java | 78 + .../sdnc/sdncrest/TypedRequestTunables.java | 224 ++ .../src/main/resources/SDNCAdapter.wsdl | 10 +- .../src/main/resources/SDNCAdapterSchema.xsd | 6 +- .../src/main/resources/SDNCCallbackAdapter.wsdl | 10 +- .../adapters/sdnc/sdncrest/ObjectMappingTest.java | 477 +++ .../src/test/resources/mso.properties | 10 - .../mso/adapters/tenant/MsoTenantAdapter.java | 2 +- .../mso/adapters/tenant/MsoTenantAdapterImpl.java | 2 +- .../tenant/exceptions/TenantAlreadyExists.java | 2 +- .../tenant/exceptions/TenantException.java | 2 +- adapters/mso-vnf-adapter-async-client/pom.xml | 3 +- .../src/main/resources/VnfAdapterNotify.wsdl | 14 +- .../openecomp/mso/adapters/vnf/BpelRestClient.java | 40 +- .../openecomp/mso/adapters/vnf/MsoVnfAdapter.java | 29 +- .../mso/adapters/vnf/MsoVnfAdapterAsync.java | 2 +- .../mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java | 4 +- .../mso/adapters/vnf/MsoVnfAdapterImpl.java | 335 ++- .../openecomp/mso/adapters/vnf/VnfAdapterRest.java | 19 +- .../mso/adapters/vnf/VolumeAdapterRest.java | 39 +- .../adapters/vnf/exceptions/VnfAlreadyExists.java | 10 +- .../mso/adapters/vnf/exceptions/VnfException.java | 2 +- .../adapters/vnf/exceptions/VnfExceptionBean.java | 7 +- .../mso/adapters/vnf/exceptions/VnfNotFound.java | 10 +- adapters/pom.xml | 7 + asdc-controller/WebContent/WEB-INF/web.xml | 18 +- asdc-controller/pom.xml | 17 +- .../mso/asdc/client/ASDCConfiguration.java | 28 +- .../openecomp/mso/asdc/client/ASDCController.java | 118 +- .../mso/asdc/installer/ASDCElementInfo.java | 34 +- .../mso/asdc/installer/IVfModuleData.java | 54 + .../mso/asdc/installer/VfModuleMetaData.java | 99 + .../mso/asdc/installer/VfModuleStructure.java | 50 +- .../mso/asdc/installer/VfResourceStructure.java | 118 +- .../asdc/installer/heat/VfResourceInstaller.java | 424 ++- .../mso/asdc/util/ASDCNotificationLogging.java | 210 +- .../mso/asdc/client/tests/ASDCElementInfoTest.java | 81 +- .../mso/asdc/installer/ASDCElementInfoESTest.java | 139 - .../ASDCElementInfoESTestscaffolding.java | 100 - .../mso/asdc/installer/VfModuleMetaDataESTest.java | 517 ++++ .../VfModuleMetaDataESTestscaffolding.java | 78 + .../asdc/installer/VfModuleStructureESTest.java | 167 +- .../asdc/installer/VfResourceStructureESTest.java | 400 --- .../VfResourceStructureESTestscaffolding.java | 105 - .../asdc/util/ASDCNotificationLoggingESTest.java | 940 ++---- .../ASDCNotificationLoggingESTestscaffolding.java | 87 +- bpmn/MSOCockpit/pom.xml | 14 +- bpmn/MSOCommonBPMN/pom.xml | 392 +++ .../mso/bpmn/common}/scripts/AaiUtil.groovy | 395 ++- .../scripts/AbstractServiceTaskProcessor.groovy | 156 +- .../mso/bpmn/common/scripts/CatalogDbUtils.groovy | 550 ++++ .../common}/scripts/CommonExceptionUtil.groovy | 6 +- .../bpmn/common}/scripts/CompleteMsoProcess.groovy | 257 +- .../common}/scripts/ConfirmVolumeGroupName.groovy | 44 +- .../scripts/ConfirmVolumeGroupTenant.groovy | 25 +- .../bpmn/common}/scripts/CreateAAIVfModule.groovy | 188 +- .../scripts/CreateAAIVfModuleVolumeGroup.groovy | 22 +- .../common/scripts/CreateGenericVNFUtils.groovy | 280 ++ .../bpmn/common}/scripts/DeleteAAIVfModule.groovy | 64 +- .../mso/bpmn/common}/scripts/ExceptionUtil.groovy | 134 +- .../mso/bpmn/common}/scripts/FalloutHandler.groovy | 296 +- .../common/scripts/GenerateVfModuleName.groovy | 166 ++ .../common}/scripts/GenericDeleteService.groovy | 28 +- .../bpmn/common}/scripts/GenericDeleteVnf.groovy | 18 +- .../bpmn/common}/scripts/GenericGetService.groovy | 38 +- .../mso/bpmn/common}/scripts/GenericGetVnf.groovy | 18 +- .../bpmn/common/scripts/GenericPutService.groovy | 280 ++ .../mso/bpmn/common}/scripts/GenericPutVnf.groovy | 14 +- .../mso/bpmn/common}/scripts/MsoUtils.groovy | 126 +- .../mso/bpmn/common}/scripts/NetworkUtils.groovy | 180 +- .../scripts/PrepareUpdateAAIVfModule.groovy | 41 +- .../mso/bpmn/common}/scripts/SDNCAdapter.groovy | 80 +- .../bpmn/common}/scripts/SDNCAdapterUtils.groovy | 340 ++- .../common}/scripts/ServiceTaskProcessor.groovy | 2 +- .../common}/scripts/UpdateAAIGenericVnf.groovy | 131 +- .../bpmn/common}/scripts/UpdateAAIVfModule.groovy | 63 +- .../mso/bpmn/common}/scripts/VfModule.groovy | 10 +- .../mso/bpmn/common}/scripts/VfModuleBase.groovy | 51 +- .../mso/bpmn/common}/scripts/VidUtils.groovy | 224 +- .../bpmn/common}/scripts/VnfAdapterRestV1.groovy | 43 +- .../bpmn/common}/scripts/VnfAdapterUtils.groovy | 19 +- .../mso/bpmn/common/MSOCommonApplication.java} | 7 +- .../bpmn/common/adapter/sdnc}/CallbackHeader.java | 10 +- .../bpmn/common/adapter/sdnc}/ObjectFactory.java | 42 +- .../bpmn/common/adapter/sdnc}/RequestHeader.java | 2 +- .../adapter/sdnc}/SDNCAdapterCallbackRequest.java | 12 +- .../common/adapter/sdnc}/SDNCAdapterRequest.java | 4 +- .../common/adapter/sdnc}/SDNCAdapterResponse.java | 2 +- .../adapter/sdnc}/SDNCCallbackAdapterPortType.java | 17 +- .../bpmn/common/adapter/sdnc}/package-info.java | 4 +- .../common/adapter/vnf}/CreateVnfNotification.java | 10 +- .../common/adapter/vnf}/DeleteVnfNotification.java | 15 +- .../common/adapter/vnf}/MsoExceptionCategory.java | 2 +- .../mso/bpmn/common/adapter/vnf}/MsoRequest.java | 2 +- .../bpmn/common/adapter/vnf}/ObjectFactory.java | 22 +- .../common/adapter/vnf}/QueryVnfNotification.java | 12 +- .../adapter/vnf}/RollbackVnfNotification.java | 8 +- .../common/adapter/vnf}/UpdateVnfNotification.java | 10 +- .../bpmn/common/adapter/vnf}/VnfAdapterNotify.java | 30 +- .../adapter/vnf}/VnfAdapterNotify_Service.java | 12 +- .../mso/bpmn/common/adapter/vnf}/VnfRollback.java | 26 +- .../mso/bpmn/common/adapter/vnf}/VnfStatus.java | 2 +- .../mso/bpmn/common/adapter/vnf}/package-info.java | 4 +- .../mso/bpmn/common}/util/CryptoHandler.java | 2 +- .../mso/bpmn/common}/util/CryptoUtils.java | 28 +- .../mso/bpmn/common}/util/ICryptoHandler.java | 2 +- .../service/SDNCAdapterCallbackServiceImpl.java | 21 +- .../service/VnfAdapterNotifyServiceImpl.java | 65 +- .../service/WorkflowAsyncCommonResource.java} | 28 +- .../workflow/service/WorkflowAsyncResource.java | 37 +- .../workflow/service/WorkflowCallbackResponse.java | 2 +- .../common}/workflow/service/WorkflowContext.java | 2 +- .../workflow/service/WorkflowContextHolder.java | 2 +- .../workflow/service/WorkflowMessageResource.java | 141 + .../common}/workflow/service/WorkflowResource.java | 36 +- .../service/WorkflowResourceApplication.java | 8 +- .../common}/workflow/service/WorkflowResponse.java | 2 +- .../src/main/resources/META-INF/persistence.xml | 2 +- .../src/main/resources/META-INF/processes.xml | 36 +- .../src/main/resources/logback.xml | 0 .../src/main/resources/processengine.properties | 20 + .../resources/subprocess/CompleteMsoProcess.bpmn | 447 +++ .../subprocess}/ConfirmVolumeGroupName.bpmn | 444 +-- .../subprocess}/ConfirmVolumeGroupTenant.bpmn | 370 +-- .../resources/subprocess}/CreateAAIVfModule.bpmn | 1036 +++---- .../subprocess}/CreateAAIVfModuleVolumeGroup.bpmn | 434 +-- .../resources/subprocess}/DeleteAAIVfModule.bpmn | 940 +++--- .../main/resources/subprocess/FalloutHandler.bpmn | 421 +++ .../resources/subprocess/GenerateVfModuleName.bpmn | 87 + .../resources/subprocess/GenericDeleteService.bpmn | 592 ++-- .../resources/subprocess/GenericDeleteVnf.bpmn | 485 +-- .../resources/subprocess/GenericGetService.bpmn | 636 ++-- .../main/resources/subprocess/GenericGetVnf.bpmn | 406 +-- .../resources/subprocess/GenericPutService.bpmn | 201 ++ .../main/resources/subprocess/GenericPutVnf.bpmn | 258 +- .../subprocess}/PrepareUpdateAAIVfModule.bpmn | 596 ++-- .../main/resources/subprocess/SDNCAdapterV1.bpmn | 524 ++++ .../resources/subprocess}/UpdateAAIGenericVnf.bpmn | 418 +-- .../resources/subprocess}/UpdateAAIVfModule.bpmn | 434 +-- .../resources/subprocess/VnfAdapterRestV1.bpmn | 842 +++--- .../src/main/resources/urn.properties | 29 + .../src/main/resources/wsdl/VnfAdapterNotify.wsdl | 16 +- .../webapp/WEB-INF/jboss-deployment-structure.xml | 0 .../src/main/webapp/WEB-INF/jboss-web.xml | 26 + .../src/main/webapp/WEB-INF/web.xml | 48 +- .../mso/bpmn/common/scripts/AaiUtilTest.groovy | 318 ++ .../common/scripts/CommonExceptionUtilTest.groovy | 201 ++ .../common/scripts/CompleteMsoProcessTest.groovy | 219 ++ .../bpmn/common/scripts/ExceptionUtilTest.groovy | 190 ++ .../bpmn/common/scripts/FalloutHandlerTest.groovy | 311 ++ .../mso/bpmn/common/scripts/MsoGroovyTest.groovy | 72 + .../mso/bpmn/common/scripts/MsoUtilsTest.groovy | 233 ++ .../mso/bpmn/common/scripts/SDNCAdapterTest.groovy | 948 ++++++ .../mso/bpmn/common/scripts/VidUtilsTest.groovy | 972 ++++++ .../org/openecomp/mso/bpmn/common/BPMNUtil.java | 214 ++ .../mso/bpmn/common/CompleteMsoProcessTest.java | 207 ++ .../bpmn/common/ConfirmVolumeGroupNameTest.java | 133 + .../bpmn/common/ConfirmVolumeGroupTenantTest.java | 91 + .../mso/bpmn/common/CreateAAIVfModuleTest.java | 277 ++ .../common/CreateAAIVfModuleVolumeGroupTest.java | 136 + .../mso/bpmn/common/DeleteAAIVfModuleTest.java | 643 ++++ .../mso/bpmn/common/FalloutHandlerTest.java | 226 ++ .../mso/bpmn/common/GenericDeleteServiceTest.java | 279 ++ .../mso/bpmn/common/GenericDeleteVnfTest.java | 221 ++ .../mso/bpmn/common/GenericGetServiceTest.java | 505 ++++ .../mso/bpmn/common/GenericGetVnfTest.java | 191 ++ .../mso/bpmn/common/GenericPutVnfTest.java | 182 ++ .../bpmn/common/PrepareUpdateAAIVfModuleTest.java | 208 ++ .../mso/bpmn/common/SDNCAdapterCallbackRule.java | 64 + .../mso/bpmn/common/SDNCAdapterV1Test.java | 389 +++ .../mso/bpmn/common/UpdateAAIGenericVnfTest.java | 171 ++ .../mso/bpmn/common/UpdateAAIVfModuleTest.java | 137 + .../mso/bpmn/common/VnfAdapterRestV1Test.java | 389 +++ .../mso/bpmn/common/WorkflowAsyncResourceTest.java | 96 + .../mso/bpmn/common/WorkflowContextHolderTest.java | 97 + .../openecomp/mso/bpmn/common/WorkflowTest.java | 1796 ++++++++++++ .../mso/bpmn/common/WorkflowTestTransformer.java | 21 + .../sdncCreateNetworkTopologySim500Response.xml | 25 + ...CreateNetworkTopologySimResponse_noExtraTag.xml | 17 + .../__files/CRTGVNF_queryAAIResponseVolume.xml | 22 + .../CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml | 22 + ...IVE_CAMUNDA_HISTORY-Default Store Procedure.sql | 140 + ...OLLB_ARCHIVE_CAMUNDA_HISTORY-StoreProcedure.sql | 210 ++ .../Archive/drop_mariadb_engine_7.5.6.sql | 76 + .../Archive/mariadb_engine_7.5_patch_7.5.6.sql | 222 ++ .../Cleanup/create_mariadb_camunda7.5.6_ee.sql | 1127 +++++++ .../upgrade_mariadb_camunda7.3.7_to_7.5.6_ee.sql | 602 ++++ .../sdncCreateNetworkTopologySimResponse.xml | 19 + ..._genericQueryByInstanceName_AAIResponse_200.xml | 13 + ...enericQueryByInstanceName_AAIResponse_Fault.xml | 15 + .../CreateVfModuleVolumeGroup_VID_request.json | 74 + .../__files/CreateVfModule_VID_request.json | 64 + .../test/resources/__files/Database/DBAdapter.xml | 1 + .../__files/Database/DBUpdateResponse.xml | 4 + .../sdncDeleteNetworkTopologySimResponse.xml | 19 + .../__files/DeleteVfModule_VID_request.json | 50 + .../__files/GENDSI_getServiceInstanceResponse.xml | 35 + .../GenericFlows/getGenericVnfByNameResponse.xml | 23 + .../__files/GenericFlows/getGenericVnfResponse.xml | 90 + .../getGenericVnfResponse_hasRelationships.xml | 90 + .../__files/GenericFlows/getSIUrlById.xml | 6 + .../__files/GenericFlows/getSIUrlByName.xml | 6 + .../__files/GenericFlows/getServiceInstance.xml | 30 + .../GenericFlows/getServiceSubscription.xml | 34 + .../__files/GenericFlows/getVceByNameResponse.xml | 97 + .../__files/GenericFlows/getVceResponse.xml | 97 + ...ance_PutServiceInstance_AAIResponse_Success.xml | 11 + .../__files/GenericPutServiceInstance/aaiFault.xml | 15 + .../SDNCAdapterV1/sdncadapterworkflowrequest.xml | 32 + .../sdncadaptercallbackrequest.xml | 350 +++ .../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 + ...k_queryNetworkTableRef1_AAIResponse_Success.xml | 20 + ...k_queryNetworkTableRef2_AAIResponse_Success.xml | 20 + .../sdncUpdateNetworkTopologySim500Response.xml | 25 + .../sdncUpdateNetworkTopologySimResponse.xml | 19 + .../AddNetworkPolicy_AAIResponse_Success.xml | 21 + .../CreateAAIVfModuleVolumeGroupRequest.xml | 6 + .../VfModularity/DoUpdateVfModuleRequest.xml | 29 + .../resources/__files/VfModularity/GenericVnf.xml | 38 + .../PrepareUpdateAAIVfModuleRequest.xml | 5 + .../QueryNetworkPolicy_AAIResponse_Success.xml | 21 + .../VfModularity/SDNCTopologyActivateCallback.xml | 13 + .../VfModularity/SDNCTopologyAssignCallback.xml | 13 + .../SDNCTopologyChangeAssignCallback.xml | 13 + .../VfModularity/SDNCTopologyQueryCallback.xml | 315 ++ .../SDNCTopologyQueryCallbackVfModule.xml | 141 + .../VfModularity/StandardSDNCSynchResponse.xml | 5 + .../VfModularity/UpdateAAIGenericVnfRequest.xml | 5 + .../VfModularity/UpdateAAIVfModuleRequest.xml | 10 + .../__files/VfModularity/UpdateVfModuleRequest.xml | 35 + .../VfModularity/VNFAdapterRestCreateCallback.xml | 55 + .../VfModularity/VNFAdapterRestUpdateCallback.xml | 16 + .../VNFAdapterRestVolumeGroupCallback.xml | 15 + .../__files/VfModularity/VfModule-lukewarm.xml | 10 + .../__files/VfModularity/VfModule-new.xml | 9 + .../__files/VfModularity/VfModule-supercool.xml | 27 + .../resources/__files/VfModularity/VolumeGroup.xml | 25 + .../resources/__files/aai-volume-group-id-info.xml | 28 + .../src/test/resources/__files/aaiFault.xml | 15 + .../vnfAdapterMocks/vnfCreateSimResponse.xml | 29 + .../vnfAdapterMocks/vnfDeleteSimResponse.xml | 11 + .../vnfAdapterMocks/vnfQuerySimResponse.xml | 20 + .../vnfAdapterMocks/vnfRollbackSimResponse.xml | 11 + .../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 | 86 + .../test/resources/sdncCallbackErrorResponse.xml | 1 + .../src/test/resources/sdncDeleteResponse.xml | 212 ++ .../test/resources/sdncadaptercallbackrequest.xml | 342 +++ .../sdncadaptercallbackrequest_404CallBack.xml | 13 + .../sdncadaptercallbackrequestdata-nonfinal.text | 42 + .../resources/sdncadaptercallbackrequestdata.text | 42 + .../resources/sdncadapterworkflowrequest-act.xml | 33 + .../test/resources/sdncadapterworkflowrequest.xml | 32 + .../src/test/resources/testAsyncResource.bpmn | 81 + .../resources/vnfAdapter/vnfUpdateSimResponse.xml | 22 + bpmn/MSOCoreBPMN/pom.xml | 348 ++- .../mso/bpmn/{test => core}/CamundaDBSetup.java | 40 +- .../mso/bpmn/core/HealthCheckHandler.java | 144 +- .../mso/bpmn/core/PropertyConfiguration.java | 24 +- .../{test => core}/PropertyConfigurationSetup.java | 24 +- .../openecomp/mso/bpmn/core/XQueryScriptTask.java | 2 +- .../openecomp/mso/bpmn/core/json/JsonUtils.java | 439 ++- .../core/plugins/LoggingAndURNMappingPlugin.java | 4 +- bpmn/MSOCoreBPMN/src/main/resources/urnMapping.xml | 4 +- .../openecomp/mso/bpmn/core/BPMNLoggerESTest.java | 30 - .../bpmn/core/BadInjectedFieldExceptionESTest.java | 24 - .../org/openecomp/mso/bpmn/core/JsonUtilsTest.java | 539 ++-- .../org/openecomp/mso/bpmn/core/LogTaskESTest.java | 41 - .../mso/bpmn/core/LogTaskESTestscaffolding.java | 342 --- .../core/MissingInjectedFieldExceptionESTest.java | 20 - .../mso/bpmn/core/PropertyConfigurationTest.java | 21 +- .../mso/bpmn/core/ReadConfigTaskESTest.java | 58 - .../bpmn/core/ReadConfigTaskESTestscaffolding.java | 331 --- .../mso/bpmn/core/ReadFileTaskESTest.java | 58 - .../bpmn/core/ReadFileTaskESTestscaffolding.java | 339 --- .../mso/bpmn/core/RollbackDataESTest.java | 117 - .../org/openecomp/mso/bpmn/core/TestBaseTask.java | 5 +- .../mso/bpmn/core/URNMappingsTaskESTest.java | 27 - .../core/URNMappingsTaskESTestscaffolding.java | 103 - .../mso/bpmn/core/WorkflowExceptionESTest.java | 88 - .../mso/bpmn/core/XQueryScriptTaskESTest.java | 81 - .../core/XQueryScriptTaskESTestscaffolding.java | 533 ---- .../mso/bpmn/core/json/JsonUtilsESTest.java | 165 -- .../bpmn/core/json/JsonUtilsESTestscaffolding.java | 120 - .../mso/bpmn/core/mybatis/URNMappingESTest.java | 114 - .../src/test/resources/BaseTaskTest.bpmn | 2 +- .../MSOCoreBPMN/src/test/resources/camunda.cfg.xml | 26 +- bpmn/MSOCoreBPMN/src/test/resources/request.json | 10 +- .../src/test/resources/requestArray.json | 54 + .../bpm/scripts/CreateNetworkInstanceInfra.groovy | 1780 ----------- .../bpm/scripts/CreateServiceInstanceInfra.groovy | 776 ----- .../bpm/scripts/DeleteNetworkInstanceInfra.groovy | 873 ------ .../bpm/scripts/DeleteServiceInstanceInfra.groovy | 549 ---- .../bpm/scripts/DoCreateVfModuleRollback.groovy | 284 -- .../com/att/bpm/scripts/DoDeleteVfModule.groovy | 264 -- .../service/VnfAdapterRestNotifyResource.java | 206 -- .../Infrastructure/CreateNetworkInstanceInfra.bpmn | 1297 -------- .../Infrastructure/CreateServiceInstanceInfra.bpmn | 466 --- .../process/Infrastructure/CreateVnfInfra.bpmn | 463 --- .../Infrastructure/DeleteNetworkInstanceInfra.bpmn | 1007 ------- .../Infrastructure/DeleteServiceInstanceInfra.bpmn | 554 ---- .../process/Infrastructure/DeleteVnfInfra.bpmn | 458 --- .../resources/subprocess/CompleteMsoProcess.bpmn | 1024 ------- .../main/resources/subprocess/FalloutHandler.bpmn | 1102 ------- .../main/resources/subprocess/SDNCAdapterV1.bpmn | 810 ----- .../subprocess/VfModularity/DoDeleteVfModule.bpmn | 287 -- .../WebContent}/META-INF/MANIFEST.MF | 0 .../pom.xml | 110 +- .../CreateGenericMacroServiceNetworkVnf.groovy | 749 +++++ .../scripts/CreateNetworkInstance.groovy | 453 +++ .../scripts/CreateServiceInstance.groovy | 262 ++ .../scripts/CreateVfModuleInfra.groovy | 177 +- .../scripts/CreateVfModuleVolumeInfraV1.groovy | 45 +- .../infrastructure}/scripts/CreateVnfInfra.groovy | 186 +- .../scripts/DelServiceInstance.groovy | 353 +++ .../DeleteGenericMacroServiceNetworkVnf.groovy | 476 +++ .../scripts/DeleteNetworkInstance.groovy | 417 +++ .../scripts/DeleteVfModuleInfra.groovy | 161 +- .../scripts/DeleteVfModuleVolumeInfraV1.groovy | 47 +- .../infrastructure}/scripts/DeleteVnfInfra.groovy | 71 +- .../scripts/DoCreateNetworkInstance.groovy | 1741 +++++++++++ .../scripts/DoCreateNetworkInstanceRollback.groovy | 387 +++ .../scripts/DoCreateServiceInstance.groovy | 506 ++++ .../scripts/DoCreateServiceInstanceRollback.groovy | 231 ++ .../scripts/DoCreateVfModule.groovy | 877 ++++-- .../scripts/DoCreateVfModuleRollback.groovy | 487 +++ .../scripts/DoCreateVfModuleVolumeV1.groovy | 52 +- .../bpmn/infrastructure/scripts/DoCreateVnf.groovy | 414 +++ .../scripts/DoCreateVnfAndModules.groovy | 241 ++ .../scripts/DoDeleteNetworkInstance.groovy | 1061 +++++++ .../scripts/DoDeleteNetworkInstanceRollback.groovy | 335 +++ .../scripts/DoDeleteServiceInstance.groovy | 420 +++ .../infrastructure/scripts/DoDeleteVfModule.groovy | 599 ++++ .../bpmn/infrastructure/scripts/DoDeleteVnf.groovy | 136 + .../scripts/DoUpdateVfModule.groovy | 94 +- .../scripts/HealchCheckActivate.groovy | 3 +- .../scripts/UpdateNetworkInstanceInfra.groovy | 157 +- .../infrastructure/scripts/UpdateVfModule.groovy | 329 +++ .../scripts/UpdateVfModuleInfra.groovy | 27 +- .../scripts/UpdateVfModuleVolume.groovy | 440 +++ .../scripts/UpdateVfModuleVolumeInfraV1.groovy | 47 +- .../MSOInfrastructureApplication.java | 58 + .../WorkflowAsyncInfrastructureResource.java | 50 + .../service/WorkflowResourceApplication.java | 57 + .../src/main/resources/META-INF/persistence.xml | 37 + .../src/main/resources/META-INF/processes.xml | 81 + .../src/main/resources/logback.xml | 159 + .../CreateGenericMacroServiceNetworkVnf.bpmn | 1203 ++++++++ .../resources/process/CreateNetworkInstance.bpmn | 372 +++ .../resources/process/CreateServiceInstance.bpmn | 336 +++ .../resources/process}/CreateVfModuleInfra.bpmn | 931 +++--- .../process}/CreateVfModuleVolumeInfraV1.bpmn | 941 +++--- .../src/main/resources/process/CreateVnfInfra.bpmn | 284 ++ .../main/resources/process/DelServiceInstance.bpmn | 331 +++ .../DeleteGenericMacroServiceNetworkVnf.bpmn | 771 +++++ .../resources/process/DeleteNetworkInstance.bpmn | 370 +++ .../resources/process}/DeleteVfModuleInfra.bpmn | 652 +++-- .../process}/DeleteVfModuleVolumeInfraV1.bpmn | 1095 +++---- .../src/main/resources/process/DeleteVnfInfra.bpmn | 353 +++ .../process}/UpdateNetworkInstanceInfra.bpmn | 1976 ++++++------- .../resources/process}/UpdateVfModuleInfra.bpmn | 530 ++-- .../process}/UpdateVfModuleVolumeInfraV1.bpmn | 1009 +++---- .../src/main/resources/processengine.properties | 20 + .../subprocess/DoCreateNetworkInstance.bpmn | 1385 +++++++++ .../DoCreateNetworkInstanceRollback.bpmn | 517 ++++ .../subprocess/DoCreateServiceInstance.bpmn | 390 +++ .../DoCreateServiceInstanceRollback.bpmn | 338 +++ .../resources/subprocess/DoCreateVfModule.bpmn | 1780 ++++++----- .../subprocess/DoCreateVfModuleRollback.bpmn | 1174 ++++---- .../subprocess/DoCreateVfModuleVolumeV1.bpmn | 1326 ++++----- .../src/main/resources/subprocess/DoCreateVnf.bpmn | 475 +++ .../subprocess/DoCreateVnfAndModules.bpmn | 352 +++ .../subprocess/DoDeleteNetworkInstance.bpmn | 933 ++++++ .../DoDeleteNetworkInstanceRollback.bpmn | 546 ++++ .../subprocess/DoDeleteServiceInstance.bpmn | 332 +++ .../resources/subprocess/DoDeleteVfModule.bpmn | 422 +++ .../src/main/resources/subprocess/DoDeleteVnf.bpmn | 308 ++ .../resources/subprocess}/DoUpdateVfModule.bpmn | 1288 ++++---- .../src/main/resources/urn.properties | 5 +- .../webapp/WEB-INF/jboss-deployment-structure.xml | 31 + .../src/main/webapp/WEB-INF/jboss-web.xml | 0 .../src/main/webapp/WEB-INF/web.xml | 74 + .../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 + bpmn/MSOMockServer/.gitignore | 4 + .../WebContent/META-INF/MANIFEST.MF | 0 bpmn/MSOMockServer/WebContent/WEB-INF/web.xml | 3 + bpmn/MSOMockServer/pom.xml | 95 + .../java/org/openecomp/mso/bpmn/mock/FileUtil.java | 64 + .../org/openecomp/mso/bpmn/mock/MockResource.java | 207 ++ .../mso/bpmn/mock/MockResourceApplication.java | 52 + .../mso/bpmn/mock/SDNCAdapterMockTransformer.java | 141 + .../SDNCAdapterNetworkTopologyMockTransformer.java | 130 + .../openecomp/mso/bpmn/mock/StubResponseAAI.java | 776 +++++ .../mso/bpmn/mock/StubResponseDatabase.java | 65 + .../mso/bpmn/mock/StubResponseNetworkAdapter.java | 93 + .../mso/bpmn/mock/StubResponseSDNCAdapter.java | 138 + .../mso/bpmn/mock/StubResponseVNFAdapter.java | 130 + .../bpmn/mock/VnfAdapterCreateMockTransformer.java | 148 + .../bpmn/mock/VnfAdapterDeleteMockTransformer.java | 146 + .../bpmn/mock/VnfAdapterQueryMockTransformer.java | 160 + .../mock/VnfAdapterRollbackMockTransformer.java | 147 + .../bpmn/mock/VnfAdapterUpdateMockTransformer.java | 148 + .../src/main/resources/__files/sdncSimResponse.xml | 19 + .../src/main/webapp/WEB-INF/jboss-web.xml | 6 + bpmn/MSORESTClient/pom.xml | 47 +- .../java/org/openecomp/mso/rest/RESTClient.java | 8 - .../org/openecomp/mso/rest/APIResponseESTest.java | 20 + .../mso/rest/APIResponseESTestscaffolding.java | 20 + .../org/openecomp/mso/rest/HttpHeaderESTest.java | 20 + .../mso/rest/HttpHeaderESTestscaffolding.java | 20 + .../org/openecomp/mso/rest/RESTClientESTest.java | 1068 ------- .../mso/rest/RESTClientESTestscaffolding.java | 366 --- .../org/openecomp/mso/rest/RESTClientTest.java | 77 - .../org/openecomp/mso/rest/RESTConfigESTest.java | 20 + .../mso/rest/RESTConfigESTestscaffolding.java | 20 + .../openecomp/mso/rest/RESTExceptionESTest.java | 20 + .../mso/rest/RESTExceptionESTestscaffolding.java | 20 + bpmn/MSOURN-plugin/pom.xml | 21 +- .../camunda/bpmn}/plugin/urnmap/URNMapPlugin.java | 7 +- .../urnmap/db/MyBatisExtendedSessionFactory.java | 2 +- .../urnmap/db/MyBatisQueryCommandExecutor.java | 2 +- .../camunda/bpmn}/plugin/urnmap/db/URNData.java | 2 +- .../camunda/bpmn}/plugin/urnmap/db/URNService.java | 2 +- .../urnmap/resources/ProcessInstanceResource.java | 6 +- .../urnmap/resources/URNMapPluginRootResource.java | 5 +- .../bpmn}/plugin/urnmap/resources/URNResource.java | 10 +- ...rg.camunda.bpm.cockpit.plugin.spi.CockpitPlugin | 2 +- bpmn/MSOURN-plugin/src/main/resources/mappings.xml | 2 +- .../camunda/bpm/plugin/urnmap/queries/urnMap.xml | 14 +- .../bpmn}/plugin/urnmap/URNMapPluginESTest.java | 5 +- .../urnmap/URNMapPluginESTestscaffolding.java | 10 +- .../bpmn}/plugin/urnmap/db/URNDataESTest.java | 4 +- .../plugin/urnmap/db/URNDataESTestscaffolding.java | 6 +- .../bpmn}/plugin/urnmap/db/URNServiceESTest.java | 6 +- .../urnmap/db/URNServiceESTestscaffolding.java | 8 +- .../resources/ProcessInstanceResourceESTest.java | 7 +- .../ProcessInstanceResourceESTestscaffolding.java | 8 +- .../resources/URNMapPluginRootResourceESTest.java | 6 +- .../URNMapPluginRootResourceESTestscaffolding.java | 12 +- .../plugin/urnmap/resources/URNResourceESTest.java | 7 +- .../resources/URNResourceESTestscaffolding.java | 10 +- bpmn/pom.xml | 45 +- common/pom.xml | 45 +- .../java/org/openecomp/mso/db/HibernateUtils.java | 55 + .../mso/properties/MsoJsonProperties.java | 6 +- .../org/openecomp/mso/utils/CryptoUtilsESTest.java | 4 +- mso-api-handlers/mso-api-handler-common/pom.xml | 10 - .../apihandler/camundabeans/CamundaVIDRequest.java | 10 +- .../mso/apihandler/common/CamundaClient.java | 28 +- .../mso/apihandler/common/CommonConstants.java | 12 +- .../mso/apihandler/common/ValidationException.java | 11 +- .../mso/camunda/tests/BPELRestClientTest.java | 4 +- .../mso/camunda/tests/CamundaRequestTest.java | 6 +- .../mso/camunda/tests/ResponseHandlerTest.java | 4 +- mso-api-handlers/mso-api-handler-infra/pom.xml | 2 +- .../openecomp/mso/apihandlerinfra/Constants.java | 25 +- .../openecomp/mso/apihandlerinfra/MsoRequest.java | 955 +++--- .../apihandlerinfra/NetworkMsoInfraRequest.java | 11 +- .../mso/apihandlerinfra/NetworkTypesHandler.java | 4 +- .../mso/apihandlerinfra/OrchestrationRequests.java | 237 +- .../mso/apihandlerinfra/RequestHandler.java | 2102 ------------- .../mso/apihandlerinfra/ServiceInstances.java | 545 ++-- .../org/openecomp/mso/apihandlerinfra/Status.java | 7 +- .../apihandlerinfra/VfModuleModelNamesHandler.java | 18 +- .../mso/apihandlerinfra/VnfMsoInfraRequest.java | 7 +- .../mso/apihandlerinfra/VnfTypesHandler.java | 5 +- .../mso/apihandlerinfra/VolumeMsoInfraRequest.java | 123 +- .../networkbeans/NetworkRequest.java | 8 +- .../networkbeans/NetworkRequests.java | 2 +- .../apihandlerinfra/networkbeans/NetworkTypes.java | 2 +- .../networkbeans/ObjectFactory.java | 4 +- .../apihandlerinfra/networkbeans/RequestInfo.java | 89 +- .../apihandlerinfra/networkbeans/package-info.java | 2 +- .../mso/apihandlerinfra/package-info.java | 2 +- .../serviceinstancebeans/CloudConfiguration.java | 30 +- .../serviceinstancebeans/InstanceReferences.java | 18 +- .../serviceinstancebeans/ModelInfo.java | 53 +- .../serviceinstancebeans/PolicyException.java | 2 +- .../serviceinstancebeans/RelatedInstanceList.java | 13 +- .../serviceinstancebeans/RequestDetails.java | 55 +- .../serviceinstancebeans/RequestError.java | 4 +- .../serviceinstancebeans/RequestInfo.java | 74 +- .../serviceinstancebeans/RequestParameters.java | 71 +- .../serviceinstancebeans/RequestStatus.java | 11 +- .../serviceinstancebeans/ServiceException.java | 2 +- .../ServiceInstancesRequest.java | 17 +- .../serviceinstancebeans/SubscriberInfo.java | 26 +- .../apihandlerinfra/vnfbeans/ObjectFactory.java | 6 +- .../mso/apihandlerinfra/vnfbeans/RequestInfo.java | 88 +- .../vnfbeans/RequestStatusType.java | 19 +- .../vnfbeans/VfModuleModelNames.java | 2 +- .../mso/apihandlerinfra/vnfbeans/VnfRequest.java | 8 +- .../mso/apihandlerinfra/vnfbeans/VnfRequests.java | 2 +- .../mso/apihandlerinfra/vnfbeans/VnfTypes.java | 2 +- .../mso/apihandlerinfra/vnfbeans/package-info.java | 2 +- .../apihandlerinfra/volumebeans/ObjectFactory.java | 4 +- .../apihandlerinfra/volumebeans/RequestInfo.java | 88 +- .../apihandlerinfra/volumebeans/VolumeRequest.java | 8 +- .../volumebeans/VolumeRequests.java | 2 +- .../apihandlerinfra/volumebeans/package-info.java | 2 +- .../test/resources/adv-feature-request.xml | 8 +- .../test/resources/adv-service-request.xml | 10 +- .../resources/test/resources/feature-request.xml | 2 +- .../resources/test/resources/service-request.xml | 2 +- mso-api-handlers/mso-requests-db/pom.xml | 13 +- .../openecomp/mso/requestsdb/HibernateUtil.java | 59 - .../mso/requestsdb/HibernateUtilsRequestsDb.java | 47 + .../openecomp/mso/requestsdb/InfraRequests.java | 30 +- .../openecomp/mso/requestsdb/RequestsDatabase.java | 32 +- .../src/main/resources/InfraActiveRequests.hbm.xml | 7 +- ...g.xml => hibernate-requests-core-mysql.cfg.xml} | 0 .../mso/requestsdb/HibernateUtilESTest.java | 24 - mso-api-handlers/pom.xml | 6 + mso-catalog-db/pom.xml | 17 +- .../openecomp/mso/db/catalog/CatalogDatabase.java | 1382 ++++++++- .../mso/db/catalog/HibernateUtilsCatalogDb.java | 45 + .../beans/AllottedResourceCustomization.java | 123 + .../mso/db/catalog/beans/HeatEnvironment.java | 18 +- .../openecomp/mso/db/catalog/beans/HeatFiles.java | 29 +- .../mso/db/catalog/beans/HeatTemplate.java | 28 +- .../org/openecomp/mso/db/catalog/beans/Model.java | 198 ++ .../mso/db/catalog/beans/ModelRecipe.java | 180 ++ .../beans/NetworkResourceCustomization.java | 140 + .../mso/db/catalog/beans/ServiceMacroHolder.java | 141 + .../mso/db/catalog/beans/ServiceRecipe.java | 42 +- .../catalog/beans/ServiceToAllottedResources.java | 67 + .../mso/db/catalog/beans/ServiceToNetworks.java | 68 + .../openecomp/mso/db/catalog/beans/VfModule.java | 89 +- .../mso/db/catalog/beans/VnfResource.java | 82 +- .../mso/db/catalog/utils/MavenLikeVersioning.java | 9 +- .../db/catalog/utils/RecordNotFoundException.java | 51 +- .../AllottedResourceCustomization.hbm.xml | 59 + .../src/main/resources/HeatEnvironment.hbm.xml | 17 +- .../src/main/resources/HeatTemplate.hbm.xml | 26 +- .../src/main/resources/ModelRecipe.hbm.xml | 87 + .../src/main/resources/NetworkRecipe.hbm.xml | 18 +- .../src/main/resources/NetworkResource.hbm.xml | 16 +- .../resources/NetworkResourceCustomization.hbm.xml | 59 + mso-catalog-db/src/main/resources/Service.hbm.xml | 35 +- .../resources/ServiceToAllottedResources.hbm.xml | 41 + .../src/main/resources/ServiceToNetworks.hbm.xml | 41 + mso-catalog-db/src/main/resources/VfModule.hbm.xml | 57 +- .../src/main/resources/VnfComponentsRecipe.hbm.xml | 14 +- .../src/main/resources/VnfRecipe.hbm.xml | 22 +- .../src/main/resources/VnfResource.hbm.xml | 64 +- ...fg.xml => hibernate-catalog-core-mysql.cfg.xml} | 0 .../mso/db/catalog/CatalogDatabaseESTest.java | 246 +- .../beans/AllottedResourceCustomizationESTest.java | 214 ++ ...ttedResourceCustomizationESTestscaffolding.java | 77 + .../mso/db/catalog/beans/ModelESTest.java | 271 ++ .../db/catalog/beans/ModelESTestscaffolding.java | 99 +- .../mso/db/catalog/beans/ModelRecipeESTest.java | 287 ++ .../beans/ModelRecipeESTestscaffolding.java | 89 +- .../db/catalog/beans/ServiceMacroHolderESTest.java | 261 ++ .../beans/ServiceMacroHolderESTestscaffolding.java | 113 +- .../beans/ServiceToAllottedResourcesESTest.java | 95 + ...erviceToAllottedResourcesESTestscaffolding.java | 94 +- .../db/catalog/beans/ServiceToNetworksESTest.java | 95 + .../beans/ServiceToNetworksESTestscaffolding.java | 92 +- .../mso/db/catalog/beans/VfModuleESTest.java | 1662 ++++++----- .../utils/RecordNotFoundExceptionESTest.java | 23 + .../RecordNotFoundExceptionESTestscaffolding.java | 81 + packages/arquillian-unit-tests/pom.xml | 30 +- .../mso/global_tests/IntegrationTestsSuite.java | 4 +- .../mso/global_tests/asdc/ASDCITCase.java | 214 +- .../notif_emulator/DistributionClientEmulator.java | 53 +- .../asdc/notif_emulator/JsonResourceInfo.java | 25 +- .../mso/global_tests/soapui/SoapUiITCase.java | 15 +- .../src/test/resources/JMeter/MSO-Perf.jmx | 20 +- .../SoapUI/Healthcheck-soapui-project.xml | 34 +- .../SoapUI/Local-API-Handler-soapui-project.xml | 310 +- .../SoapUI/MSONetworkAdapter-soapui-project.xml | 86 +- .../SoapUI/MSOTenantAdapter-soapui-project.xml | 58 +- .../SoapUI/MSOVnfAdapter-soapui-project.xml | 70 +- .../SoapUI/MsoRequestDB-soapui-project.xml | 90 +- .../src/test/resources/arquillian.xml | 4 +- .../src/test/resources/docker/mso/mso-docker.json | 33 +- .../demo-dns-V1/artifacts/vnf-module-artifact.json | 10 +- .../asdc/demo-dns-V1/notif-structure.json | 27 +- .../demo-vfw-V1/artifacts/vnf-module-artifact.json | 5 +- .../asdc/demo-vfw-V1/notif-structure.json | 17 +- .../notif-structure.json | 17 +- .../artifacts/vnf-module-artifact.json | 5 +- .../asdc/simpleNotif-V1/notif-structure.json | 19 +- .../artifacts/vnf-module-artifact.json | 5 +- .../asdc/simpleNotif-V2/notif-structure.json | 19 +- .../artifacts/vnf-module-artifact.json | 5 +- .../asdc/simpleNotif-V3/notif-structure.json | 29 +- .../artifacts/vnf-module-artifact.json | 5 +- .../asdc/simpleNotif-V4/notif-structure.json | 29 +- .../artifacts/vnf-module-artifact.json | 12 +- .../asdc/simpleNotif-V5/notif-structure.json | 39 +- packages/deliveries/pom.xml | 6 +- .../src/main/assembly/war-pack/mso-wars.xml | 33 +- packages/docker/pom.xml | 22 +- .../configuration/application-roles.properties | 3 +- .../configuration/application-users.properties | 3 +- .../automated-tests/create_mso_db-tests.sql | 19 +- .../default/create_mso_db-default.sql | 16 +- .../camunda/mariadb_engine_7.6.0.sql | 1071 +++++++ .../camunda/mariadb_identity_7.6.0.sql | 88 + .../camunda/mysql_updates_7.3.0_to_7.6.0.sql | 699 +++++ .../sub-sql-files/catalog_add_constraints.sql | 45 + .../sub-sql-files/catalog_timestamp_mso_db.sql | 5 + pom.xml | 15 +- project-configs/maven/conf/settings.xml | 7 - readme.md | 6 +- status-control/pom.xml | 16 +- .../java/org/openecomp/mso/HealthCheckUtils.java | 25 +- .../org/openecomp/mso/HealthCheckUtilsTest.java | 26 +- 840 files changed, 91003 insertions(+), 38687 deletions(-) create mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonDeserializer.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonSerializer.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeAbstract.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonDeserializer.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonSerializer.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactory.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationWrapper.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/models/RackspaceAuthentication.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapper.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapper.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryAllottedResourceCustomization.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceMacroHolder.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceNetworks.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfs.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommon.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryAllottedResourceCustomizationESTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryAllottedResourceCustomizationESTestscaffolding.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceMacroHolderESTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceMacroHolderESTestscaffolding.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceNetworksESTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceNetworksESTestscaffolding.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfsESTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfsESTestscaffolding.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/RequestInformationESTest.java rename bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTestscaffolding.java => adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/RequestInformationESTestscaffolding.java (55%) create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommonESTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommonESTestscaffolding.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorESTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorESTestscaffolding.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestESTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestESTestscaffolding.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseESTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseESTestscaffolding.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationESTest.java rename bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTestscaffolding.java => adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationESTestscaffolding.java (54%) create mode 100644 adapters/mso-catalog-db-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml create mode 100644 adapters/mso-catalog-db-adapter/WebContent/WEB-INF/jboss-web.xml create mode 100644 adapters/mso-catalog-db-adapter/WebContent/WEB-INF/web.xml create mode 100644 adapters/mso-catalog-db-adapter/pom.xml create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org.openecomp.mso/adapters/catalogdb/CatalogDbAdapterRest.java delete mode 100644 adapters/mso-sdnc-adapter/null/mso-config/uuid/uuid_null create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterProperties.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SNIROResponse.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunables.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/ObjectMappingTest.java create mode 100644 asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IVfModuleData.java create mode 100644 asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleMetaData.java delete mode 100644 asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTest.java delete mode 100644 asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTestscaffolding.java create mode 100644 asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleMetaDataESTest.java create mode 100644 asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleMetaDataESTestscaffolding.java delete mode 100644 asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTest.java delete mode 100644 asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTestscaffolding.java create mode 100644 bpmn/MSOCommonBPMN/pom.xml rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/AaiUtil.groovy (57%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/AbstractServiceTaskProcessor.groovy (88%) create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/CommonExceptionUtil.groovy (96%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/CompleteMsoProcess.groovy (59%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/ConfirmVolumeGroupName.groovy (86%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/ConfirmVolumeGroupTenant.groovy (94%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/CreateAAIVfModule.groovy (85%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/CreateAAIVfModuleVolumeGroup.groovy (95%) create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateGenericVNFUtils.groovy rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/DeleteAAIVfModule.groovy (90%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/ExceptionUtil.groovy (80%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/FalloutHandler.groovy (68%) create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/GenericDeleteService.groovy (96%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/GenericDeleteVnf.groovy (96%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/GenericGetService.groovy (94%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/GenericGetVnf.groovy (96%) create mode 100644 bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/GenericPutVnf.groovy (95%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/MsoUtils.groovy (86%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/NetworkUtils.groovy (88%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/PrepareUpdateAAIVfModule.groovy (94%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/SDNCAdapter.groovy (84%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/SDNCAdapterUtils.groovy (74%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/ServiceTaskProcessor.groovy (96%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/UpdateAAIGenericVnf.groovy (77%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/UpdateAAIVfModule.groovy (90%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/VfModule.groovy (91%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/VfModuleBase.groovy (93%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/VidUtils.groovy (57%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/VnfAdapterRestV1.groovy (94%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common}/scripts/VnfAdapterUtils.groovy (71%) rename bpmn/{MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/MSOGammaApplication.java => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/MSOCommonApplication.java} (93%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc}/CallbackHeader.java (92%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc}/ObjectFactory.java (73%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc}/RequestHeader.java (99%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc}/SDNCAdapterCallbackRequest.java (89%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc}/SDNCAdapterRequest.java (95%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc}/SDNCAdapterResponse.java (96%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/callback/wsdl/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc}/SDNCCallbackAdapterPortType.java (75%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc}/package-info.java (81%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf}/CreateVnfNotification.java (97%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf}/DeleteVnfNotification.java (91%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf}/MsoExceptionCategory.java (96%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf}/MsoRequest.java (97%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf}/ObjectFactory.java (88%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf}/QueryVnfNotification.java (96%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf}/RollbackVnfNotification.java (94%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf}/UpdateVnfNotification.java (96%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf}/VnfAdapterNotify.java (78%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf}/VnfAdapterNotify_Service.java (85%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf}/VnfRollback.java (89%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf}/VnfStatus.java (96%) rename bpmn/{MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1 => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf}/package-info.java (86%) rename bpmn/{MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common}/util/CryptoHandler.java (97%) rename bpmn/{MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common}/util/CryptoUtils.java (90%) rename bpmn/{MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common}/util/ICryptoHandler.java (96%) rename bpmn/{MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common}/workflow/service/SDNCAdapterCallbackServiceImpl.java (93%) rename bpmn/{MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common}/workflow/service/VnfAdapterNotifyServiceImpl.java (88%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/beans/SAOTSTRequest.groovy => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java} (70%) rename bpmn/{MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common}/workflow/service/WorkflowAsyncResource.java (91%) rename bpmn/{MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common}/workflow/service/WorkflowCallbackResponse.java (96%) rename bpmn/{MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common}/workflow/service/WorkflowContext.java (98%) rename bpmn/{MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common}/workflow/service/WorkflowContextHolder.java (99%) create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java rename bpmn/{MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common}/workflow/service/WorkflowResource.java (94%) rename bpmn/{MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common}/workflow/service/WorkflowResourceApplication.java (84%) rename bpmn/{MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma => MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common}/workflow/service/WorkflowResponse.java (97%) rename bpmn/{MSOGammaBPMN => MSOCommonBPMN}/src/main/resources/META-INF/persistence.xml (97%) rename bpmn/{MSOGammaBPMN => MSOCommonBPMN}/src/main/resources/META-INF/processes.xml (88%) rename bpmn/{MSOGammaBPMN => MSOCommonBPMN}/src/main/resources/logback.xml (100%) create mode 100644 bpmn/MSOCommonBPMN/src/main/resources/processengine.properties create mode 100644 bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn rename bpmn/{MSOGammaBPMN/src/main/resources/subprocess/VfModularity => MSOCommonBPMN/src/main/resources/subprocess}/ConfirmVolumeGroupName.bpmn (92%) rename bpmn/{MSOGammaBPMN/src/main/resources/subprocess/VfModularity => MSOCommonBPMN/src/main/resources/subprocess}/ConfirmVolumeGroupTenant.bpmn (93%) rename bpmn/{MSOGammaBPMN/src/main/resources/subprocess/VfModularity => MSOCommonBPMN/src/main/resources/subprocess}/CreateAAIVfModule.bpmn (95%) rename bpmn/{MSOGammaBPMN/src/main/resources/subprocess/VfModularity => MSOCommonBPMN/src/main/resources/subprocess}/CreateAAIVfModuleVolumeGroup.bpmn (93%) rename bpmn/{MSOGammaBPMN/src/main/resources/subprocess/VfModularity => MSOCommonBPMN/src/main/resources/subprocess}/DeleteAAIVfModule.bpmn (95%) create mode 100644 bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn create mode 100644 bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenerateVfModuleName.bpmn rename bpmn/{MSOGammaBPMN => MSOCommonBPMN}/src/main/resources/subprocess/GenericDeleteService.bpmn (94%) rename bpmn/{MSOGammaBPMN => MSOCommonBPMN}/src/main/resources/subprocess/GenericDeleteVnf.bpmn (65%) rename bpmn/{MSOGammaBPMN => MSOCommonBPMN}/src/main/resources/subprocess/GenericGetService.bpmn (96%) rename bpmn/{MSOGammaBPMN => MSOCommonBPMN}/src/main/resources/subprocess/GenericGetVnf.bpmn (95%) create mode 100644 bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn rename bpmn/{MSOGammaBPMN => MSOCommonBPMN}/src/main/resources/subprocess/GenericPutVnf.bpmn (95%) rename bpmn/{MSOGammaBPMN/src/main/resources/subprocess/VfModularity => MSOCommonBPMN/src/main/resources/subprocess}/PrepareUpdateAAIVfModule.bpmn (94%) create mode 100644 bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn rename bpmn/{MSOGammaBPMN/src/main/resources/subprocess/VfModularity => MSOCommonBPMN/src/main/resources/subprocess}/UpdateAAIGenericVnf.bpmn (93%) rename bpmn/{MSOGammaBPMN/src/main/resources/subprocess/VfModularity => MSOCommonBPMN/src/main/resources/subprocess}/UpdateAAIVfModule.bpmn (93%) rename bpmn/{MSOGammaBPMN => MSOCommonBPMN}/src/main/resources/subprocess/VnfAdapterRestV1.bpmn (95%) create mode 100644 bpmn/MSOCommonBPMN/src/main/resources/urn.properties rename bpmn/{MSOGammaBPMN => MSOCommonBPMN}/src/main/resources/wsdl/VnfAdapterNotify.wsdl (93%) rename bpmn/{MSOGammaBPMN => MSOCommonBPMN}/src/main/webapp/WEB-INF/jboss-deployment-structure.xml (100%) create mode 100644 bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-web.xml rename bpmn/{MSOGammaBPMN => MSOCommonBPMN}/src/main/webapp/WEB-INF/web.xml (78%) create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CommonExceptionUtilTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcessTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoGroovyTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtilsTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtilsTest.groovy create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTestTransformer.java create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ARCHIVE_CAMUNDA_HISTORY-Default Store Procedure.sql create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ROLLB_ARCHIVE_CAMUNDA_HISTORY-StoreProcedure.sql create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Upgrade/upgrade_mariadb_camunda7.3.7_to_7.5.6_ee.sql create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_Fault.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModuleVolumeGroup_VID_request.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModule_VID_request.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBAdapter.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteVfModule_VID_request.json create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/aaiFault.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/aaiFault.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/camunda.cfg.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/logging.properties create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.properties create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata-nonfinal.text create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata.text create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn create mode 100644 bpmn/MSOCommonBPMN/src/test/resources/vnfAdapter/vnfUpdateSimResponse.xml rename bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/{test => core}/CamundaDBSetup.java (57%) rename bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/{test => core}/PropertyConfigurationSetup.java (89%) delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTest.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTestscaffolding.java delete mode 100644 bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTest.java create mode 100644 bpmn/MSOCoreBPMN/src/test/resources/requestArray.json delete mode 100644 bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateNetworkInstanceInfra.groovy delete mode 100644 bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateServiceInstanceInfra.groovy delete mode 100644 bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteNetworkInstanceInfra.groovy delete mode 100644 bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteServiceInstanceInfra.groovy delete mode 100644 bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoCreateVfModuleRollback.groovy delete mode 100644 bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoDeleteVfModule.groovy delete mode 100644 bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/VnfAdapterRestNotifyResource.java delete mode 100644 bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateNetworkInstanceInfra.bpmn delete mode 100644 bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateServiceInstanceInfra.bpmn delete mode 100644 bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateVnfInfra.bpmn delete mode 100644 bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteNetworkInstanceInfra.bpmn delete mode 100644 bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteServiceInstanceInfra.bpmn delete mode 100644 bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteVnfInfra.bpmn delete mode 100644 bpmn/MSOGammaBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn delete mode 100644 bpmn/MSOGammaBPMN/src/main/resources/subprocess/FalloutHandler.bpmn delete mode 100644 bpmn/MSOGammaBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn delete mode 100644 bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/DoDeleteVfModule.bpmn rename bpmn/{MSOGammaBPMN => MSOInfrastructureBPMN/WebContent}/META-INF/MANIFEST.MF (100%) rename bpmn/{MSOGammaBPMN => MSOInfrastructureBPMN}/pom.xml (76%) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericMacroServiceNetworkVnf.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateServiceInstance.groovy rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure}/scripts/CreateVfModuleInfra.groovy (84%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure}/scripts/CreateVfModuleVolumeInfraV1.groovy (84%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure}/scripts/CreateVnfInfra.groovy (61%) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DelServiceInstance.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericMacroServiceNetworkVnf.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure}/scripts/DeleteVfModuleInfra.groovy (74%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure}/scripts/DeleteVfModuleVolumeInfraV1.groovy (93%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure}/scripts/DeleteVnfInfra.groovy (76%) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure}/scripts/DoCreateVfModule.groovy (59%) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure}/scripts/DoCreateVfModuleVolumeV1.groovy (94%) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnf.groovy rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure}/scripts/DoUpdateVfModule.groovy (92%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure}/scripts/HealchCheckActivate.groovy (93%) rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure}/scripts/UpdateNetworkInstanceInfra.groovy (92%) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModule.groovy rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure}/scripts/UpdateVfModuleInfra.groovy (94%) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy rename bpmn/{MSOGammaBPMN/src/main/groovy/com/att/bpm => MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure}/scripts/UpdateVfModuleVolumeInfraV1.groovy (91%) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowAsyncInfrastructureResource.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/persistence.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/processes.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/logback.xml create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateGenericMacroServiceNetworkVnf.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateNetworkInstance.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateServiceInstance.bpmn rename bpmn/{MSOGammaBPMN/src/main/resources/process/Infrastructure => MSOInfrastructureBPMN/src/main/resources/process}/CreateVfModuleInfra.bpmn (65%) rename bpmn/{MSOGammaBPMN/src/main/resources/process/Infrastructure => MSOInfrastructureBPMN/src/main/resources/process}/CreateVfModuleVolumeInfraV1.bpmn (68%) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVnfInfra.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/DelServiceInstance.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteGenericMacroServiceNetworkVnf.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteNetworkInstance.bpmn rename bpmn/{MSOGammaBPMN/src/main/resources/process/Infrastructure => MSOInfrastructureBPMN/src/main/resources/process}/DeleteVfModuleInfra.bpmn (64%) rename bpmn/{MSOGammaBPMN/src/main/resources/process/Infrastructure => MSOInfrastructureBPMN/src/main/resources/process}/DeleteVfModuleVolumeInfraV1.bpmn (94%) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVnfInfra.bpmn rename bpmn/{MSOGammaBPMN/src/main/resources/process/Infrastructure => MSOInfrastructureBPMN/src/main/resources/process}/UpdateNetworkInstanceInfra.bpmn (68%) rename bpmn/{MSOGammaBPMN/src/main/resources/process/Infrastructure => MSOInfrastructureBPMN/src/main/resources/process}/UpdateVfModuleInfra.bpmn (91%) rename bpmn/{MSOGammaBPMN/src/main/resources/process/Infrastructure => MSOInfrastructureBPMN/src/main/resources/process}/UpdateVfModuleVolumeInfraV1.bpmn (94%) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/processengine.properties create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstanceRollback.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstance.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn rename bpmn/{MSOGammaBPMN => MSOInfrastructureBPMN}/src/main/resources/subprocess/DoCreateVfModule.bpmn (54%) rename bpmn/{MSOGammaBPMN => MSOInfrastructureBPMN}/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn (50%) rename bpmn/{MSOGammaBPMN => MSOInfrastructureBPMN}/src/main/resources/subprocess/DoCreateVfModuleVolumeV1.bpmn (95%) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnf.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstance.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstanceRollback.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModule.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnf.bpmn rename bpmn/{MSOGammaBPMN/src/main/resources/subprocess/VfModularity => MSOInfrastructureBPMN/src/main/resources/subprocess}/DoUpdateVfModule.bpmn (88%) rename bpmn/{MSOGammaBPMN => MSOInfrastructureBPMN}/src/main/resources/urn.properties (89%) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml rename bpmn/{MSOGammaBPMN => MSOInfrastructureBPMN}/src/main/webapp/WEB-INF/jboss-web.xml (100%) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/web.xml 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 create mode 100644 bpmn/MSOMockServer/.gitignore rename bpmn/{MSOGammaBPMN => MSOMockServer}/WebContent/META-INF/MANIFEST.MF (100%) create mode 100644 bpmn/MSOMockServer/WebContent/WEB-INF/web.xml create mode 100644 bpmn/MSOMockServer/pom.xml create mode 100644 bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/FileUtil.java create mode 100644 bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResource.java create mode 100644 bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java create mode 100644 bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java create mode 100644 bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java create mode 100644 bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java create mode 100644 bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java create mode 100644 bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java create mode 100644 bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java create mode 100644 bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java create mode 100644 bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java create mode 100644 bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java create mode 100644 bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java create mode 100644 bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java create mode 100644 bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java create mode 100644 bpmn/MSOMockServer/src/main/resources/__files/sdncSimResponse.xml create mode 100644 bpmn/MSOMockServer/src/main/webapp/WEB-INF/jboss-web.xml delete mode 100644 bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTest.java delete mode 100644 bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTestscaffolding.java delete mode 100644 bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientTest.java rename bpmn/MSOURN-plugin/src/main/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/URNMapPlugin.java (87%) rename bpmn/MSOURN-plugin/src/main/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/db/MyBatisExtendedSessionFactory.java (98%) rename bpmn/MSOURN-plugin/src/main/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/db/MyBatisQueryCommandExecutor.java (97%) rename bpmn/MSOURN-plugin/src/main/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/db/URNData.java (96%) rename bpmn/MSOURN-plugin/src/main/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/db/URNService.java (97%) rename bpmn/MSOURN-plugin/src/main/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/resources/ProcessInstanceResource.java (95%) rename bpmn/MSOURN-plugin/src/main/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/resources/URNMapPluginRootResource.java (92%) rename bpmn/MSOURN-plugin/src/main/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/resources/URNResource.java (94%) rename bpmn/MSOURN-plugin/src/main/resources/{com/att => org/openecomp}/camunda/bpm/plugin/urnmap/queries/urnMap.xml (80%) rename bpmn/MSOURN-plugin/src/test/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/URNMapPluginESTest.java (91%) rename bpmn/MSOURN-plugin/src/test/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/URNMapPluginESTestscaffolding.java (90%) rename bpmn/MSOURN-plugin/src/test/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/db/URNDataESTest.java (95%) rename bpmn/MSOURN-plugin/src/test/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/db/URNDataESTestscaffolding.java (92%) rename bpmn/MSOURN-plugin/src/test/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/db/URNServiceESTest.java (82%) rename bpmn/MSOURN-plugin/src/test/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/db/URNServiceESTestscaffolding.java (93%) rename bpmn/MSOURN-plugin/src/test/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/resources/ProcessInstanceResourceESTest.java (93%) rename bpmn/MSOURN-plugin/src/test/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/resources/ProcessInstanceResourceESTestscaffolding.java (91%) rename bpmn/MSOURN-plugin/src/test/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/resources/URNMapPluginRootResourceESTest.java (89%) rename bpmn/MSOURN-plugin/src/test/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/resources/URNMapPluginRootResourceESTestscaffolding.java (91%) rename bpmn/MSOURN-plugin/src/test/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/resources/URNResourceESTest.java (97%) rename bpmn/MSOURN-plugin/src/test/java/{com/att/camunda/bpm => org/openecomp/camunda/bpmn}/plugin/urnmap/resources/URNResourceESTestscaffolding.java (97%) create mode 100644 common/src/main/java/org/openecomp/mso/db/HibernateUtils.java delete mode 100644 mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestHandler.java delete mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtil.java create mode 100644 mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtilsRequestsDb.java rename mso-api-handlers/mso-requests-db/src/main/resources/{hibernate-mysql.cfg.xml => hibernate-requests-core-mysql.cfg.xml} (100%) delete mode 100644 mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/HibernateUtilESTest.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/HibernateUtilsCatalogDb.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java create mode 100644 mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java rename bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/beans/CommonCompletionRequest.groovy => mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundException.java (60%) create mode 100644 mso-catalog-db/src/main/resources/AllottedResourceCustomization.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/ModelRecipe.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/NetworkResourceCustomization.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/ServiceToAllottedResources.hbm.xml create mode 100644 mso-catalog-db/src/main/resources/ServiceToNetworks.hbm.xml rename mso-catalog-db/src/main/resources/{hibernate-catalog-mysql.cfg.xml => hibernate-catalog-core-mysql.cfg.xml} (100%) create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomizationESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomizationESTestscaffolding.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelESTest.java rename mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/HibernateUtilESTestscaffolding.java => mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelESTestscaffolding.java (64%) create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelRecipeESTest.java rename bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTestscaffolding.java => mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelRecipeESTestscaffolding.java (55%) create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolderESTest.java rename bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTestscaffolding.java => mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolderESTestscaffolding.java (51%) create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTest.java rename bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTestscaffolding.java => mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTestscaffolding.java (52%) create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTest.java rename bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTestscaffolding.java => mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTestscaffolding.java (56%) create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTest.java create mode 100644 mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTestscaffolding.java create mode 100644 packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_engine_7.6.0.sql create mode 100644 packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_identity_7.6.0.sql create mode 100644 packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mysql_updates_7.3.0_to_7.6.0.sql create mode 100644 packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/sub-sql-files/catalog_add_constraints.sql diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml index 959358761d..f80bfeb2cb 100644 --- a/adapters/mso-adapter-utils/pom.xml +++ b/adapters/mso-adapter-utils/pom.xml @@ -39,15 +39,6 @@ - - - maven-war-plugin - 2.3 - - WebContent - false - - @@ -55,22 +46,22 @@ org.openecomp.mso.libs.openstack-java-sdk keystone-client - 1.1.0 + ${openstack.version} org.openecomp.mso.libs.openstack-java-sdk heat-client - 1.1.0 + ${openstack.version} org.openecomp.mso.libs.openstack-java-sdk quantum-client - 1.1.0 + ${openstack.version} org.openecomp.mso.libs.openstack-java-sdk.client-connectors http-connector - 1.1.0 + ${openstack.version} org.openecomp.mso @@ -127,7 +118,7 @@ 2.2.0.Final provided - + org.yaml snakeyaml 1.15 diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java new file mode 100644 index 0000000000..a765f8004e --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java @@ -0,0 +1,29 @@ +/*- + * ============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.cloud; + +/** + * This interface provides the method signature for mapping registration. + * All mappings should be registered by the implementing class. + */ +public interface CloudConfigIdentityMapper { + + public void registerAllMappings(); +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java index a777e4133c..db6ccde46c 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java @@ -1,32 +1,56 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - MSO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * ============LICENSE_START========================================== + * =================================================================== + * 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 - * + * + * 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========================================================= + * ============LICENSE_END============================================ + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + * */ package org.openecomp.mso.cloud; +import java.io.IOException; +import java.net.URISyntaxException; import java.security.GeneralSecurityException; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.JsonSerializer; +import org.codehaus.jackson.JsonGenerator; +import org.codehaus.jackson.map.SerializerProvider; +import org.codehaus.jackson.map.annotate.JsonDeserialize; +import org.codehaus.jackson.map.annotate.JsonSerialize; +import org.codehaus.jackson.JsonProcessingException; + +import org.openecomp.mso.openstack.exceptions.MsoAdapterException; import org.openecomp.mso.openstack.exceptions.MsoException; +import org.openecomp.mso.openstack.utils.MsoCommonUtils; +import org.openecomp.mso.openstack.utils.MsoKeystoneUtils; +import org.openecomp.mso.openstack.utils.MsoTenantUtils; +import org.openecomp.mso.openstack.utils.MsoTenantUtilsFactory; +import org.openecomp.mso.cloud.authentication.AuthenticationMethodFactory; +import org.openecomp.mso.cloud.authentication.AuthenticationWrapper; +import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication; +import org.openecomp.mso.cloud.authentication.wrappers.RackspaceAPIKeyWrapper; +import org.openecomp.mso.cloud.authentication.wrappers.UsernamePasswordWrapper; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; -import com.woorea.openstack.keystone.model.authentication.RackspaceAuthentication; + import com.woorea.openstack.keystone.model.authentication.UsernamePassword; import org.openecomp.mso.utils.CryptoUtils; import com.woorea.openstack.keystone.model.Authentication; @@ -43,11 +67,39 @@ import com.woorea.openstack.keystone.model.Authentication; */ public class CloudIdentity { + // This block is needed to trigger the class loader so that static initialization + // of both inner static classes occur. This is required when the Json Deserializer + // gets called and no access to any of these inner classes happened yet. + static { + IdentityServerType.bootstrap(); + IdentityAuthenticationType.bootstrap(); + } + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - public enum IdentityServerType {KEYSTONE}; - public enum IdentityAuthenticationType { USERNAME_PASSWORD, RACKSPACE_APIKEY }; + public final static class IdentityServerType extends IdentityServerTypeAbstract { + + public static final IdentityServerType KEYSTONE = new IdentityServerType("KEYSTONE", MsoKeystoneUtils.class); + + public IdentityServerType(String serverType, Class utilsClass) { + super(serverType, utilsClass); + } + + public static final void bootstrap() {} + } + + public static final class IdentityAuthenticationType extends IdentityAuthenticationTypeAbstract { + + public static final IdentityAuthenticationType USERNAME_PASSWORD = new IdentityAuthenticationType("USERNAME_PASSWORD", UsernamePasswordWrapper.class); + + public static final IdentityAuthenticationType RACKSPACE_APIKEY = new IdentityAuthenticationType("RACKSPACE_APIKEY", RackspaceAPIKeyWrapper.class); + + public IdentityAuthenticationType(String identityType, Class wrapperClass) { + super(identityType, wrapperClass); + } + + public static final void bootstrap() {} + } @JsonProperty private String id; @@ -64,8 +116,12 @@ public class CloudIdentity { @JsonProperty("tenant_metadata") private Boolean tenantMetadata; @JsonProperty("identity_server_type") + @JsonSerialize(using=IdentityServerTypeJsonSerializer.class) + @JsonDeserialize(using=IdentityServerTypeJsonDeserializer.class) private IdentityServerType identityServerType; @JsonProperty("identity_authentication_type") + @JsonSerialize(using=IdentityAuthenticationTypeJsonSerializer.class) + @JsonDeserialize(using=IdentityAuthenticationTypeJsonDeserializer.class) private IdentityAuthenticationType identityAuthenticationType; private static String cloudKey = "aa3871669d893c7fb8abbcda31b88b4f"; @@ -92,26 +148,34 @@ public class CloudIdentity { public String getKeystoneUrl (String regionId, String msoPropID) throws MsoException { if (IdentityServerType.KEYSTONE.equals(this.identityServerType)) { return this.identityUrl; - } - else { - return null; + } else { + if (this.identityServerType == null) { + return null; + } + MsoTenantUtils tenantUtils = new MsoTenantUtilsFactory(msoPropID).getTenantUtilsByServerType(this.identityServerType.toString()); + if (tenantUtils != null) { + return tenantUtils.getKeystoneUrl(regionId, msoPropID, this); + } else { + return null; + } } } public Authentication getAuthentication () throws MsoException { - if (IdentityAuthenticationType.RACKSPACE_APIKEY.equals(this.identityAuthenticationType)) { - return new RackspaceAuthentication (this.getMsoId (),this.getMsoPass ()); - } - else { - // Use default case - return new UsernamePassword (this.getMsoId (),this.getMsoPass ()); + if (this.getIdentityAuthenticationType() != null) { + try { + return AuthenticationMethodFactory.getAuthenticationFor(this); + } catch (IllegalAccessException | InstantiationException | ClassNotFoundException | IOException | URISyntaxException e) { + throw new MsoAdapterException("Could not retrieve authentication for " + this.identityAuthenticationType, e); + } + } else { // Fallback + return new UsernamePassword(this.getMsoId(), this.getMsoPass()); } - } public void setKeystoneUrl (String url) { if (IdentityServerType.KEYSTONE.equals(this.identityServerType)) { - this.identityUrl = url; + this.identityUrl = url; } } diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java new file mode 100644 index 0000000000..45a79730ad --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java @@ -0,0 +1,75 @@ +/*- + * ============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.cloud; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.openecomp.mso.cloud.authentication.AuthenticationWrapper; + +public abstract class IdentityAuthenticationTypeAbstract { + + // This map will prevent duplicates (as if it was an Enum). + // Without this, using an instance specific field for the class could allow + // different classes bound to the same entry name. + private static final Map entries = new ConcurrentHashMap<>(); + + private String identityType; + + private Class wrapperClass; + + protected IdentityAuthenticationTypeAbstract(String identityType, Class wrapperClass) { + try { + this.identityType = identityType; + this.wrapperClass = wrapperClass; + entries.put(identityType, this); + AuthenticationWrapper.register(this.toString(), wrapperClass); + } catch (IllegalAccessException | InstantiationException e) { + // Do not add the class if an exception occurs as we won't get the class anyway + } + } + + public static final IdentityAuthenticationTypeAbstract valueOf(String serverType) { + return entries.get(serverType); + } + + @Override + public final String toString() { + return this.identityType; + } + + public final String name() { + return this.identityType; + } + + public static final IdentityAuthenticationTypeAbstract[] values() { + return (IdentityAuthenticationTypeAbstract[]) entries.values().stream().toArray(IdentityAuthenticationTypeAbstract[]::new); + } + + public final Class getWrapperClass() { + return this.wrapperClass; + } + + @Override + public final boolean equals(Object other) { + return ((this.identityType != null) && (other != null) && (other instanceof IdentityAuthenticationTypeAbstract) && (this.identityType.equals(other.toString()))); + } + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonDeserializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonDeserializer.java new file mode 100644 index 0000000000..c7b2c14cb8 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonDeserializer.java @@ -0,0 +1,44 @@ +/*- + * ============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.cloud; + +import java.io.IOException; + +import org.codehaus.jackson.JsonParser; +import org.codehaus.jackson.JsonProcessingException; +import org.codehaus.jackson.JsonToken; +import org.codehaus.jackson.map.DeserializationContext; +import org.codehaus.jackson.map.JsonDeserializer; +import org.openecomp.mso.cloud.CloudIdentity.IdentityServerType; + + +public class IdentityAuthenticationTypeJsonDeserializer extends JsonDeserializer { + + @Override + public IdentityAuthenticationTypeAbstract deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) + throws IOException, JsonProcessingException { + JsonToken token = jsonParser.getCurrentToken(); + if (JsonToken.VALUE_STRING.equals(token)) { + return IdentityAuthenticationTypeAbstract.valueOf(jsonParser.getText()); + } else { + return null; + } + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonSerializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonSerializer.java new file mode 100644 index 0000000000..06d877d4fa --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonSerializer.java @@ -0,0 +1,38 @@ +/*- + * ============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.cloud; + +import java.io.IOException; + +import org.codehaus.jackson.JsonGenerator; +import org.codehaus.jackson.JsonProcessingException; +import org.codehaus.jackson.map.JsonSerializer; +import org.codehaus.jackson.map.SerializerProvider; +import org.openecomp.mso.cloud.CloudIdentity.IdentityServerType; + + +public class IdentityAuthenticationTypeJsonSerializer extends JsonSerializer { + + @Override + public void serialize(IdentityAuthenticationTypeAbstract tmpObj, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) + throws IOException, JsonProcessingException { + jsonGenerator.writeObject(tmpObj.toString()); + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeAbstract.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeAbstract.java new file mode 100644 index 0000000000..38f1f87ddc --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeAbstract.java @@ -0,0 +1,77 @@ +/*- + * ============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.cloud; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.openecomp.mso.openstack.utils.MsoTenantUtils; + + +public abstract class IdentityServerTypeAbstract { + + // This map will prevent duplicates (as if it was an Enum). + // Without this, using an instance specific field for the class could allow + // different classes bound to the same entry name. + private static final Map entries = new ConcurrentHashMap<>(); + + private String serverType; + + private Class utilsClass; + + protected IdentityServerTypeAbstract(String serverType, Class utilsClass) { + if ((serverType == null) || (serverType.isEmpty())) { + throw new IllegalArgumentException("Server Type name cannot be null or empty, provided value was " + serverType); + } + if (entries.containsKey(serverType)) { + throw new IllegalArgumentException("Duplicate Server Type entry for registration: " + serverType); + } + this.serverType = serverType; + this.utilsClass = utilsClass; + entries.put(serverType, this); + } + + public static final IdentityServerTypeAbstract valueOf(String serverType) { + return entries.get(serverType); + } + + @Override + public final String toString() { + return this.serverType; + } + + public final String name() { + return this.serverType; + } + + public static final IdentityServerTypeAbstract[] values() { + return (IdentityServerTypeAbstract[]) entries.values().stream().toArray(IdentityServerTypeAbstract[]::new); + } + + public final Class getMsoTenantUtilsClass() { + return this.utilsClass; + } + + @Override + public final boolean equals(Object other) { + return ((this.serverType != null) && (other != null) && (other instanceof IdentityServerTypeAbstract) && (this.serverType.equals(other.toString()))); + } + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonDeserializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonDeserializer.java new file mode 100644 index 0000000000..8b9da1a3f4 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonDeserializer.java @@ -0,0 +1,44 @@ +/*- + * ============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.cloud; + +import java.io.IOException; + +import org.codehaus.jackson.JsonParser; +import org.codehaus.jackson.JsonProcessingException; +import org.codehaus.jackson.JsonToken; +import org.codehaus.jackson.map.DeserializationContext; +import org.codehaus.jackson.map.JsonDeserializer; +import org.openecomp.mso.cloud.CloudIdentity.IdentityServerType; + + +public class IdentityServerTypeJsonDeserializer extends JsonDeserializer { + + @Override + public IdentityServerTypeAbstract deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) + throws IOException, JsonProcessingException { + JsonToken token = jsonParser.getCurrentToken(); + if (JsonToken.VALUE_STRING.equals(token)) { + return IdentityServerTypeAbstract.valueOf(jsonParser.getText()); + } else { + return null; + } + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonSerializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonSerializer.java new file mode 100644 index 0000000000..c008860264 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonSerializer.java @@ -0,0 +1,38 @@ +/*- + * ============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.cloud; + +import java.io.IOException; + +import org.codehaus.jackson.JsonGenerator; +import org.codehaus.jackson.JsonProcessingException; +import org.codehaus.jackson.map.JsonSerializer; +import org.codehaus.jackson.map.SerializerProvider; +import org.openecomp.mso.cloud.CloudIdentity.IdentityServerType; + + +public class IdentityServerTypeJsonSerializer extends JsonSerializer { + + @Override + public void serialize(IdentityServerTypeAbstract tmpObj, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) + throws IOException, JsonProcessingException { + jsonGenerator.writeObject(tmpObj.toString()); + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactory.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactory.java new file mode 100644 index 0000000000..feaafd3c07 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactory.java @@ -0,0 +1,79 @@ +/* + * ============LICENSE_START========================================== + * =================================================================== + * 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============================================ + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + * + */ + +package org.openecomp.mso.cloud.authentication; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.openecomp.mso.cloud.CloudIdentity; + +import com.woorea.openstack.keystone.model.Authentication; + +/** + * This factory manages all the wrappers associated to authentication types. + * + */ +public final class AuthenticationMethodFactory { + + private static Map authWrappers = new ConcurrentHashMap<>(); + + /** + * + */ + private AuthenticationMethodFactory() {} + + /** + * Function to be called by classes implementing the abstract {@link AuthenticationWrapper#register(String, Class)}. + */ + static final synchronized void register(String authenticationType, Class wrapperClass) throws InstantiationException, IllegalAccessException { + if ((authenticationType == null) || ("".equals(authenticationType))) { + throw new IllegalArgumentException("Authentication Type to register cannot be null or an empty name string, provided value is " + authenticationType + "."); + } + if (wrapperClass == null) { + throw new IllegalArgumentException("Wrapper Class to register for Authentication cannot be null"); + } + + if (!authWrappers.containsKey(authenticationType)) { + authWrappers.put(authenticationType, wrapperClass.newInstance()); + } + } + + public static final synchronized Authentication getAuthenticationFor(CloudIdentity cloudIdentity) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException, URISyntaxException { + if (cloudIdentity == null) { + throw new IllegalArgumentException("Cloud identity cannot be null"); + } + if ((cloudIdentity.getIdentityAuthenticationType() == null) || ("".equals(cloudIdentity.getIdentityAuthenticationType().toString()))) { + throw new IllegalArgumentException("Cloud identity authentication type cannot be null or empty, provided value is " + cloudIdentity.getIdentityAuthenticationType() + "."); + } + String authenticationType = cloudIdentity.getIdentityAuthenticationType().toString(); + + if (authWrappers.containsKey(authenticationType)) { + return authWrappers.get(authenticationType).getAuthentication(cloudIdentity); + } else { + throw new IllegalArgumentException("Provided authentication type (" + authenticationType + ") is not implemented by any wrapper."); + } + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationWrapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationWrapper.java new file mode 100644 index 0000000000..8b3725cd41 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationWrapper.java @@ -0,0 +1,58 @@ +/* + * ============LICENSE_START========================================== + * =================================================================== + * 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============================================ + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + * + */ + +package org.openecomp.mso.cloud.authentication; + +import org.openecomp.mso.cloud.CloudIdentity; + +import com.woorea.openstack.keystone.model.Authentication; + +/** + * This abstract class provides the necessary method for registering authentication + * types with wrapper classes, and also defines the contract for providing + * Openstack-compatible Authentication implementations for said authentication types. + * + */ +public abstract class AuthenticationWrapper { + + /** + * Registers the implementing class to the list of Authentication Wrappers. + * + * @param authenticationType The authentication type that is provided by the implementing class + * @param wrapperClass The implementing class Class object + * @throws InstantiationException If the provided implementing class cannot be instantiated + * @throws IllegalAccessException If the provided implementing class cannot be instantiated + */ + public static final void register(String authenticationType, Class wrapperClass) throws InstantiationException, IllegalAccessException { + AuthenticationMethodFactory.register(authenticationType, wrapperClass); + } + + /** + * Returns an OpenStack Authentication object for the provided CloudIdentity. + * + * @param cloudIdentity The input Cloud Identity instance + * @return the OpenStack Authentication associated with this cloud identity instance + */ + protected abstract Authentication getAuthentication(CloudIdentity cloudIdentity); + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/models/RackspaceAuthentication.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/models/RackspaceAuthentication.java new file mode 100644 index 0000000000..2b8da9f641 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/models/RackspaceAuthentication.java @@ -0,0 +1,99 @@ +/* + * ============LICENSE_START========================================== + * =================================================================== + * 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============================================ + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + * + */ + +package org.openecomp.mso.cloud.authentication.models; + +import org.codehaus.jackson.annotate.JsonIgnore; +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonRootName; +import com.woorea.openstack.keystone.model.Authentication; + +@JsonRootName("auth") +public class RackspaceAuthentication extends Authentication { + + /** + * + */ + private static final long serialVersionUID = 5451283386875662918L; + + @JsonIgnore + private String tenantId; + + @JsonIgnore + private String tenantName; + + public static final class Token { + + private String username; + private String apiKey; + + /** + * @return the username + */ + public String getUsername() { + return username; + } + /** + * @param username the username to set + */ + public void setUsername(String username) { + this.username = username; + } + /** + * @return the apiKey + */ + public String getApiKey() { + return apiKey; + } + /** + * @param apiKey the apiKey to set + */ + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + } + + @JsonProperty("RAX-KSKEY:apiKeyCredentials") + private Token token = new Token(); + + public RackspaceAuthentication (String username, String apiKey) { + this.token.username = username; + this.token.apiKey = apiKey; + + } + + /** + * @return the token + */ + public Token getToken() { + return token; + } + + /** + * @param token the token to set + */ + public void setToken(Token token) { + this.token = token; + } + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapper.java new file mode 100644 index 0000000000..87ff2582de --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapper.java @@ -0,0 +1,55 @@ +/* + * ============LICENSE_START========================================== + * =================================================================== + * 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============================================ + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + * + */ + +package org.openecomp.mso.cloud.authentication.wrappers; + +import org.openecomp.mso.cloud.CloudIdentity; +import org.openecomp.mso.cloud.authentication.AuthenticationWrapper; +import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication; + +import com.woorea.openstack.keystone.model.Authentication; + +/** + * This class implements the authentication wrapper for Rackspace Authentication. + * + */ +public class RackspaceAPIKeyWrapper extends AuthenticationWrapper { + + /** + * + */ + public RackspaceAPIKeyWrapper() { + // TODO Auto-generated constructor stub + } + + /* (non-Javadoc) + * @see org.openecomp.mso.cloud.authentication.AuthenticationWrapper#getAuthentication(org.openecomp.mso.cloud.CloudIdentity) + */ + @Override + public Authentication getAuthentication(CloudIdentity cloudIdentity) { + if (cloudIdentity == null) { + throw new IllegalArgumentException("Provided cloud identity is null, cannot extract username and password"); + } + return new RackspaceAuthentication (cloudIdentity.getMsoId (), cloudIdentity.getMsoPass ()); + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapper.java new file mode 100644 index 0000000000..2eebbb7d4b --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapper.java @@ -0,0 +1,55 @@ +/* + * ============LICENSE_START========================================== + * =================================================================== + * 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============================================ + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + * + */ + +package org.openecomp.mso.cloud.authentication.wrappers; + +import org.openecomp.mso.cloud.CloudIdentity; +import org.openecomp.mso.cloud.authentication.AuthenticationWrapper; + +import com.woorea.openstack.keystone.model.Authentication; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; + +/** + * This class implements the authentication wrapper for Openstack provided for + * user name and password authentication. + * + */ +public class UsernamePasswordWrapper extends AuthenticationWrapper { + + /** + * + */ + public UsernamePasswordWrapper() { + } + + /* (non-Javadoc) + * @see org.openecomp.mso.cloud.authentication.AuthenticationWrapper#getAuthentication(org.openecomp.mso.cloud.CloudIdentity) + */ + @Override + public Authentication getAuthentication(CloudIdentity cloudIdentity) { + if (cloudIdentity == null) { + throw new IllegalArgumentException("Provided cloud identity is null, cannot extract username and password"); + } + return new UsernamePassword (cloudIdentity.getMsoId (), cloudIdentity.getMsoPass ()); + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java index b6e4a6e855..fc148746a0 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java @@ -7,9 +7,9 @@ * 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. @@ -42,13 +42,14 @@ public class VnfRollback { private String baseGroupHeatStackId; private boolean isBase = false; private String vfModuleStackId; + private String modelCustomizationUuid; //NOTE: this is the vfModule's modelCustomizationUuid public VnfRollback() {} - + public VnfRollback(String vnfId, String tenantId, String cloudSiteId, boolean tenantCreated, boolean vnfCreated, MsoRequest msoRequest, - String volumeGroupName, String volumeGroupId, String requestType) { + String volumeGroupName, String volumeGroupId, String requestType, String modelCustomizationUuid) { super(); this.vnfId = vnfId; this.tenantId = tenantId; @@ -59,6 +60,7 @@ public class VnfRollback { this.volumeGroupName = volumeGroupName; this.volumeGroupId = volumeGroupId; this.requestType = requestType; + this.modelCustomizationUuid = modelCustomizationUuid; } public String getVnfId() { @@ -122,14 +124,14 @@ public class VnfRollback { public void setVolumeGroupHeatStackId(String volumeGroupHeatStackId) { this.volumeGroupHeatStackId = volumeGroupHeatStackId; } - + public String getBaseGroupHeatStackId() { return this.baseGroupHeatStackId; } public void setBaseGroupHeatStackId(String baseGroupHeatStackId) { this.baseGroupHeatStackId = baseGroupHeatStackId; } - + public boolean isBase() { return this.isBase; } @@ -142,11 +144,17 @@ public class VnfRollback { public void setVfModuleStackId(String vfModuleStackId) { this.vfModuleStackId = vfModuleStackId; } - + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } @Override public String toString() { return "VnfRollback: cloud=" + cloudSiteId + ", tenant=" + tenantId + ", vnf=" + vnfId + ", tenantCreated=" + tenantCreated + - ", vnfCreated=" + vnfCreated + ", requestType = " + requestType; + ", vnfCreated=" + vnfCreated + ", requestType = " + requestType + + ", modelCustomizationUuid=" + this.modelCustomizationUuid; } } diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java index 3d9c23cc32..05d9a70a2d 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java @@ -27,6 +27,7 @@ import javax.servlet.ServletContextListener; import javax.servlet.annotation.WebListener; import org.openecomp.mso.cloud.CloudConfigFactory; +import org.openecomp.mso.cloud.CloudConfigIdentityMapper; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; @@ -73,6 +74,21 @@ public class CloudConfigInitializer implements ServletContextListener initLogger.error(MessageEnum.RA_CONFIG_EXC, msoPropDecoded[0] + ". MSO Properties failed due to conversion error (in web.xml file)", "", "", MsoLogger.ErrorCode.DataError, "MSO Properties failed due to conversion error (in web.xml file)", ne); } } + + // Second, obtain class name that will register all mappings + String msoMapperClassParam = event.getServletContext().getInitParameter("mso.cloud_config.mapper.class"); + if (msoMapperClassParam != null) { + Class mapperClass = Class.forName(msoMapperClassParam); + if (CloudConfigIdentityMapper.class.isAssignableFrom(mapperClass)) { + ((CloudConfigIdentityMapper)mapperClass.newInstance()).registerAllMappings(); + initLogger.info(MessageEnum.RA_CONFIG_LOAD,msoMapperClassParam+"(Openstack authentication mapper class)","",""); + } else { + initLogger.info(MessageEnum.RA_CONFIG_LOAD,msoMapperClassParam+"(Openstack authentication mapper class not an implementation of CloudConfigIdentityMapper)","",""); + } + } else { + initLogger.info(MessageEnum.RA_CONFIG_LOAD,"Openstack authentication mapper class not specified in web.xml (ONLY core authentication mechanisms will be loaded)","",""); + } + } catch (Exception e) { initLogger.error(MessageEnum.RA_CONFIG_EXC, "Unknown. MSO Properties failed to initialize completely", "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception - MSO Properties failed to initialize completely", e); diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java index 9309f05c40..99d5863819 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java @@ -7,9 +7,9 @@ * 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. @@ -58,6 +58,7 @@ import com.woorea.openstack.base.client.OpenStackResponseException; import com.woorea.openstack.heat.Heat; import com.woorea.openstack.heat.model.CreateStackParam; import com.woorea.openstack.heat.model.Stack; +import com.woorea.openstack.heat.model.Stack.Output; import com.woorea.openstack.heat.model.Stacks; import com.woorea.openstack.keystone.Keystone; import com.woorea.openstack.keystone.model.Access; @@ -69,7 +70,7 @@ public class MsoHeatUtils extends MsoCommonUtils { private MsoPropertiesFactory msoPropertiesFactory; private CloudConfigFactory cloudConfigFactory; - + private static final String TOKEN_AUTH = "TokenAuth"; private static final String QUERY_ALL_STACKS = "QueryAllStacks"; @@ -103,7 +104,7 @@ public class MsoHeatUtils extends MsoCommonUtils { private int deletePollIntervalDefault = 15; private int deletePollTimeoutDefault = 300; private String msoPropID; - + private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); /** @@ -127,7 +128,7 @@ public class MsoHeatUtils extends MsoCommonUtils { } cloudConfig = cloudConfigFactory.getCloudConfig (); LOGGER.debug("MsoHeatUtils:" + msoPropID); - + } @@ -201,7 +202,7 @@ public class MsoHeatUtils extends MsoCommonUtils { null, true); } - + // This method has environment, files, heatfiles public StackInfo createStack (String cloudSiteId, String tenantId, @@ -413,6 +414,11 @@ public class MsoHeatUtils extends MsoCommonUtils { try { heatStack = queryHeatStack (heatClient, canonicalName); LOGGER.debug (heatStack.getStackStatus () + " (" + canonicalName + ")"); + try { + LOGGER.debug("Current stack " + this.getOutputsAsStringBuilder(heatStack).toString()); + } catch (Exception e) { + LOGGER.debug("an error occurred trying to print out the current outputs of the stack"); + } if ("CREATE_IN_PROGRESS".equals (heatStack.getStackStatus ())) { // Stack creation is still running. @@ -443,7 +449,7 @@ public class MsoHeatUtils extends MsoCommonUtils { if (!backout) { LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, stack deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in Create Stack, stack deletion suppressed"); - } + } else { try { @@ -451,7 +457,7 @@ public class MsoHeatUtils extends MsoCommonUtils { OpenStackRequest request = heatClient.getStacks ().deleteByName (canonicalName); executeAndRecordOpenstackRequest (request, msoProps); // this may be a waste of time - if we just got an exception trying to query the stack - we'll just - // get another one, n'est-ce pas? + // get another one, n'est-ce pas? boolean deleted = false; while (!deleted) { try { @@ -460,8 +466,8 @@ public class MsoHeatUtils extends MsoCommonUtils { LOGGER.debug(heatStack.getStackStatus()); if ("DELETE_IN_PROGRESS".equals(heatStack.getStackStatus())) { if (deletePollTimeout <= 0) { - LOGGER.error (MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, - heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, + LOGGER.error (MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, + heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, "Rollback: DELETE stack timeout"); break; } else { @@ -486,11 +492,11 @@ public class MsoHeatUtils extends MsoCommonUtils { deleted = true; continue; } - + } catch (Exception e3) { // Just log this one. We will report the original exception. LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back stack: " + e3, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack: Nested exception rolling back stack on error on query"); - + } } } catch (Exception e2) { @@ -529,8 +535,8 @@ public class MsoHeatUtils extends MsoCommonUtils { LOGGER.debug(heatStack.getStackStatus() + " (" + canonicalName + ")"); if ("DELETE_IN_PROGRESS".equals(heatStack.getStackStatus())) { if (deletePollTimeout <= 0) { - LOGGER.error (MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, - heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, + LOGGER.error (MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, + heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, "Rollback: DELETE stack timeout"); break; } else { @@ -561,13 +567,13 @@ public class MsoHeatUtils extends MsoCommonUtils { deleted = true; continue; } - + } catch (MsoException me2) { // We got an exception on the delete - don't throw this exception - throw the original - just log. LOGGER.debug("Exception thrown trying to delete " + canonicalName + " on a create->rollback: " + me2.getContextMessage()); LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, then stack deletion FAILED - exception thrown", "", "", MsoLogger.ErrorCode.BusinessProcesssError, me2.getContextMessage()); } - + } // end while !deleted StringBuilder errorContextMessage = null; if (createTimedOut) { @@ -588,7 +594,7 @@ public class MsoHeatUtils extends MsoCommonUtils { // shouldn't happen - but handle LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back stack: " + e2, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in Create Stack: rolling back stack"); } - } + } MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString()); me.addContext(CREATE_STACK); alarmLogger.sendAlarm(HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); @@ -949,10 +955,10 @@ public class MsoHeatUtils extends MsoCommonUtils { Access access = null; try { Authentication credentials = cloudIdentity.getAuthentication (); - + OpenStackRequest request = keystoneTenantClient.tokens () .authenticate (credentials).withTenantId (tenantId); - + access = executeAndRecordOpenstackRequest (request, msoProps); } catch (OpenStackResponseException e) { if (e.getStatus () == 401) { @@ -984,10 +990,6 @@ public class MsoHeatUtils extends MsoCommonUtils { alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); throw new MsoAdapterException (error, e); } - // This is needed for testing in the MT cloud - if ("MT".equals (cloudId)) { - heatUrl = heatUrl.replace ("controller", "mtdnj02bh01wt.bvoip.labs.att.com"); - } Heat heatClient = new Heat (heatUrl); heatClient.token (access.getToken ().getId ()); @@ -1119,7 +1121,7 @@ public class MsoHeatUtils extends MsoCommonUtils { public static void heatCacheReset () { heatClientCache = new HashMap (); } - + public Map queryStackForOutputs(String cloudSiteId, String tenantId, String stackName) throws MsoException { LOGGER.debug("MsoHeatUtils.queryStackForOutputs)"); @@ -1208,7 +1210,7 @@ public class MsoHeatUtils extends MsoCommonUtils { } return sb; } - + private String convertNode(final JsonNode node) { try { final Object obj = JSON_MAPPER.treeToValue(node, Object.class); @@ -1221,4 +1223,53 @@ public class MsoHeatUtils extends MsoCommonUtils { } return "[Error converting json to string]"; } + + + private StringBuilder getOutputsAsStringBuilder(Stack heatStack) { + // This should only be used as a utility to print out the stack outputs + // to the log + StringBuilder sb = new StringBuilder(""); + if (heatStack == null) { + sb.append("(heatStack is null)"); + return sb; + } + List outputList = heatStack.getOutputs(); + if (outputList == null || outputList.isEmpty()) { + sb.append("(outputs is empty)"); + return sb; + } + Map outputs = new HashMap(); + for (Output outputItem : outputList) { + outputs.put(outputItem.getOutputKey(), outputItem.getOutputValue()); + } + int counter = 0; + sb.append("OUTPUTS:"); + for (String key : outputs.keySet()) { + sb.append("outputs[" + counter++ + "]: " + key + "="); + Object obj = outputs.get(key); + if (obj instanceof String) { + sb.append((String)obj); + } else if (obj instanceof JsonNode) { + sb.append(this.convertNode((JsonNode)obj)); + } else if (obj instanceof java.util.LinkedHashMap) { + try { + String str = JSON_MAPPER.writeValueAsString(obj); + sb.append(str); + } catch (Exception e) { + sb.append("(a LinkedHashMap value that would not convert nicely)"); + } + } else { + String str = ""; + try { + str = (String) obj; + } catch (Exception e) { + str = "(a value unable to be cast as a String)"; + } + sb.append(str); + } + sb.append("; "); + } + sb.append("[END]"); + return sb; + } } diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java index 8375b973c9..e387ec4023 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java @@ -454,10 +454,6 @@ public class MsoKeystoneUtils extends MsoTenantUtils { LOGGER.error(MessageEnum.IDENTITY_SERVICE_NOT_FOUND, region, cloudIdentity.getId(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in findEndpointURL"); throw new MsoAdapterException (error, e); } - // The following is needed for the MT lab. - if ("MT".equals (cloudSite.getId ())) { - adminUrl = adminUrl.replace ("controller", "mtdnj02bh01wt.bvoip.labs.att.com"); - } // A new Keystone object is required for the new URL. Use the auth token from above. // Note: this doesn't go back to Openstack, it's just a local object. @@ -685,4 +681,9 @@ public class MsoKeystoneUtils extends MsoTenantUtils { public static void adminCacheReset () { adminClientCache = new HashMap (); } + + @Override + public String getKeystoneUrl(String regionId, String msoPropID, CloudIdentity cloudIdentity) throws MsoException { + return cloudIdentity.getIdentityUrl(); + } } diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java index f3281e3f1c..5c21913a66 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java @@ -425,10 +425,6 @@ public class MsoNeutronUtils extends MsoCommonUtils alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); throw new MsoAdapterException (error, e); } - // This is needed for testing in the MT cloud - if (cloudId.equals("MT")) { - neutronUrl = neutronUrl.replace("controller", "mtdnj02bh01wt.bvoip.labs.att.com"); - } Quantum neutronClient = new Quantum(neutronUrl); neutronClient.token(access.getToken().getId()); diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtils.java index 41104707cb..5af535f2b5 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtils.java @@ -28,6 +28,7 @@ import java.util.Map; import org.openecomp.mso.cloud.CloudConfig; import org.openecomp.mso.cloud.CloudConfigFactory; +import org.openecomp.mso.cloud.CloudIdentity; import org.openecomp.mso.logger.MsoAlarmLogger; import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.logger.MessageEnum; @@ -75,5 +76,8 @@ public abstract class MsoTenantUtils extends MsoCommonUtils { public abstract boolean deleteTenant (String tenantId, String cloudSiteId) throws MsoException; - + + public abstract String getKeystoneUrl (String regionId, String msoPropID, CloudIdentity cloudIdentity) + throws MsoException; + } diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java index 6fd7a6364a..2a5b3ad994 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java @@ -20,6 +20,7 @@ package org.openecomp.mso.openstack.utils; +import java.lang.reflect.InvocationTargetException; import org.openecomp.mso.cloud.CloudConfig; import org.openecomp.mso.cloud.CloudConfigFactory; import org.openecomp.mso.cloud.CloudIdentity; @@ -36,7 +37,7 @@ public class MsoTenantUtilsFactory { protected CloudConfig cloudConfig; protected MsoJavaProperties msoProps = null; private String msoPropID; - + public MsoTenantUtilsFactory (String msoPropID) { this.msoPropID = msoPropID; } @@ -48,10 +49,20 @@ public class MsoTenantUtilsFactory { cloudConfig = cloudConfigFactory.getCloudConfig(); CloudSite cloudSite = cloudConfig.getCloudSite (cloudSiteId); + return getTenantUtilsByServerType(cloudSite.getIdentityService().getIdentityServerType().toString()); + } + + public MsoTenantUtils getTenantUtilsByServerType(String serverType) { + MsoTenantUtils tenantU = null; - if (cloudSite.getIdentityService().getIdentityServerType() == CloudIdentity.IdentityServerType.KEYSTONE) - { + if (CloudIdentity.IdentityServerType.KEYSTONE.equals(serverType)) { tenantU = new MsoKeystoneUtils (msoPropID); + } else { + try { + tenantU = CloudIdentity.IdentityServerType.valueOf(serverType).getMsoTenantUtilsClass().getConstructor(String.class).newInstance(msoPropID); + } catch (InvocationTargetException | InstantiationException | NoSuchMethodException | IllegalAccessException e) { + throw new RuntimeException("Could not instantiate an MsoTenantUtils class for " + serverType, e); + } } return tenantU; } diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java index 8632d02164..6be668c056 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/CloudConfigTest.java @@ -7,9 +7,9 @@ * 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. @@ -39,14 +39,14 @@ import org.openecomp.mso.cloud.CloudSite; * */ public class CloudConfigTest { - + private static CloudConfig con; private static CloudConfigFactory cloudConfigFactory= new CloudConfigFactory(); - + public CloudConfigTest () { - + } - + /** * This method is called before any test occurs. * It creates a fake tree from scratch @@ -55,11 +55,11 @@ public class CloudConfigTest { public static final void prepare () { ClassLoader classLoader = CloudConfigTest.class.getClassLoader(); String config = classLoader.getResource("cloud_config.json").toString().substring(5); - + cloudConfigFactory.initializeCloudConfig(config,1); con = cloudConfigFactory.getCloudConfig(); } - + /** * This method implements a test for the getCloudConfig method. */ @@ -79,17 +79,19 @@ public class CloudConfigTest { CloudSite site1 = siteMap.get("MT"); CloudSite site2 = siteMap.get("DAN"); CloudSite site3 = siteMap.get("MTINJVCC101"); - + CloudSite site4 = siteMap.get("MTSNJA4LCP1"); + assertEquals (site1.getRegionId(), "regionOne"); assertEquals (site1.getIdentityServiceId(), "MT_KEYSTONE"); assertEquals (site2.getRegionId(), "RegionOne"); assertEquals (site2.getIdentityServiceId(), "DAN_KEYSTONE"); assertEquals (site3.getRegionId(), "regionTwo"); assertEquals (site3.getIdentityServiceId(), "MTINJVCC101_DCP"); - + assertEquals (site4.getRegionId(), "mtsnjlcp1"); + assertEquals (site4.getIdentityServiceId(), "MTSNJA3DCP1"); } - - + + /** * This method implements a test for the getIdentityServices method. */ @@ -97,12 +99,12 @@ public class CloudConfigTest { public final void testGetIdentityServices () { Map identityMap = con.getIdentityServices (); assertNotNull(identityMap); - + CloudIdentity identity1 = identityMap.get("MT_KEYSTONE"); CloudIdentity identity2 = identityMap.get("DAN_KEYSTONE"); CloudIdentity identity3 = identityMap.get("MTINJVCC101_DCP"); CloudIdentity identity4 = identityMap.get("MTSNJA3DCP1"); - + // assertEquals (identity1.getKeystoneUrl(), "http://localhost:5000/v2.0"); // assertEquals (identity1.getIdentityUrl(), "http://localhost:5000/v2.0"); assertEquals (identity1.getMsoId(), "john"); @@ -110,7 +112,7 @@ public class CloudConfigTest { assertEquals (identity1.getAdminTenant(), "admin"); assertEquals (identity1.getMemberRole(), "_member_"); assertEquals (identity1.hasTenantMetadata(), false); - + // assertEquals (identity2.getKeystoneUrl(), "http://localhost:5000/v2.0"); // assertEquals (identity2.getIdentityUrl(), "http://localhost:5000/v2.0"); assertEquals (identity2.getMsoId(), "mockId"); @@ -118,7 +120,7 @@ public class CloudConfigTest { assertEquals (identity2.getAdminTenant(), "service"); assertEquals (identity2.getMemberRole(), "_member_"); assertEquals (identity2.hasTenantMetadata(), false); - + // assertEquals (identity3.getKeystoneUrl(), "http://localhost:5000/v2.0"); // assertEquals (identity3.getIdentityUrl(), "http://localhost:5000/v2.0"); assertEquals (identity3.getMsoId(), "mockIdToo"); @@ -126,7 +128,7 @@ public class CloudConfigTest { assertEquals (identity3.getAdminTenant(), "service"); assertEquals (identity3.getMemberRole(), "admin"); assertEquals (identity3.hasTenantMetadata(), true); - + // assertEquals (identity4.getKeystoneUrl(), "https://localhost:5000/v2.0"); // assertEquals (identity4.getIdentityUrl(), "https://localhost:5000/v2.0"); assertEquals (identity4.getMsoId(), "mockIdToo"); @@ -136,7 +138,7 @@ public class CloudConfigTest { assertEquals (identity4.hasTenantMetadata(), true); } - + /** * This method implements a test for the getCloudSite method. */ @@ -146,9 +148,6 @@ public class CloudConfigTest { assertNotNull(site1); assertEquals (site1.getRegionId(), "regionOne"); assertEquals (site1.getIdentityServiceId(), "MT_KEYSTONE"); - - - } /** @@ -165,7 +164,7 @@ public class CloudConfigTest { assertEquals (identity1.getAdminTenant(), "admin"); assertEquals (identity1.getMemberRole(), "_member_"); assertEquals (identity1.hasTenantMetadata(), false); - + CloudIdentity identity2 = con.getIdentityService("Test"); assertNull(identity2); } diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java index 6f8a6e93d8..3427e42304 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java @@ -7,9 +7,9 @@ * 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. @@ -47,45 +47,45 @@ public class MsoHeatUtilsTest extends MsoCommonUtils { public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); public static CloudConfigFactory cloudConfigFactory = new CloudConfigFactory(); public static MsoHeatUtils msoHeatUtils; - + @BeforeClass public static final void loadClasses() { ClassLoader classLoader = CloudConfigTest.class.getClassLoader(); String config = classLoader.getResource("cloud_config.json").toString().substring(5); cloudConfigFactory.initializeCloudConfig(config, 1); - msoHeatUtils = new MsoHeatUtils("NO_PROP",msoPropertiesFactory,cloudConfigFactory); + msoHeatUtils = new MsoHeatUtils("NO_PROP",msoPropertiesFactory,cloudConfigFactory); } - + @Test - public final void testCreateStackBadCloudConfig () { + public final void testCreateStackBadCloudConfig () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { try { msoHeatUtils.createStack ("DOESNOTEXIST", "test", "stackName", "test", new HashMap (), Boolean.TRUE, 10); - } catch (MsoException e) { + } catch (MsoCloudSiteNotFound e) { + + } - } - } - + @Test public final void testCreateStackFailedConnectionHeatClient () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { try { msoHeatUtils.createStack ("MT", "test", "stackName", "test", new HashMap (), Boolean.TRUE, 10); } catch (MsoIOException e) { - + } - + } - + @Test public final void testCreateStackFailedConnection () throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { try { msoHeatUtils.createStack ("MT", "test", "stackName", "test", new HashMap (), Boolean.TRUE, 10); } catch (MsoIOException e) { - + } - + } - - - + + + } diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java new file mode 100644 index 0000000000..beb85a4a8e --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java @@ -0,0 +1,115 @@ +/* + * ============LICENSE_START========================================== + * =================================================================== + * 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============================================ + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + * + */ + +package org.openecomp.mso.cloud.authentication; + +import static org.junit.Assert.assertTrue; + +import java.io.IOException; +import java.net.URISyntaxException; + +import org.junit.Test; +import org.openecomp.mso.cloud.CloudIdentity; +import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication; +import org.openecomp.mso.openstack.exceptions.MsoException; + +import com.woorea.openstack.keystone.model.Authentication; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; + +/** + * A few JUnit tests to evaluate the new factory that manages authentication + * types and their associated wrapper classes. Here it is assumed that core types + * only are tested. + * + */ +public class AuthenticationMethodTest { + + /** + * + */ + public AuthenticationMethodTest() { + // TODO Auto-generated constructor stub + } + + @Test + public void testCustomRackspaceAuth() { + CloudIdentity ci = new CloudIdentity(); + ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY); + ci.setMsoPass("FD205490A48D48475607C36B9AD902BF"); + ci.setMsoId("test"); + + try { + Authentication auth = AuthenticationMethodFactory.getAuthenticationFor(ci); + assertTrue(RackspaceAuthentication.class.equals(auth.getClass())); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IOException + | URISyntaxException e) { + e.printStackTrace(); + } + } + + @Test + public void testCoreUsernamePasswordAuth() { + CloudIdentity ci = new CloudIdentity(); + ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.USERNAME_PASSWORD); + ci.setMsoPass("FD205490A48D48475607C36B9AD902BF"); + ci.setMsoId("someuser"); + + try { + Authentication auth = AuthenticationMethodFactory.getAuthenticationFor(ci); + assertTrue(UsernamePassword.class.equals(auth.getClass())); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IOException + | URISyntaxException e) { + e.printStackTrace(); + } + } + + @Test + public void testCustomRackspaceAuthFromCloudIdentity() { + CloudIdentity ci = new CloudIdentity(); + ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY); + ci.setMsoPass("FD205490A48D48475607C36B9AD902BF"); + ci.setMsoId("test"); + + try { + Authentication auth = ci.getAuthentication(); + assertTrue(RackspaceAuthentication.class.equals(auth.getClass())); + } catch (MsoException e) { + e.printStackTrace(); + } + } + + @Test + public void testCoreUsernamePasswordAuthFromCloudIdentity() { + CloudIdentity ci = new CloudIdentity(); + ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.USERNAME_PASSWORD); + ci.setMsoPass("FD205490A48D48475607C36B9AD902BF"); + ci.setMsoId("someuser"); + + try { + Authentication auth = ci.getAuthentication(); + assertTrue(UsernamePassword.class.equals(auth.getClass())); + } catch (MsoException e) { + e.printStackTrace(); + } + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java new file mode 100644 index 0000000000..1cbba3c45e --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java @@ -0,0 +1,56 @@ +/** + * + */ +package org.openecomp.mso.cloud.servertype; + +import java.util.Map; + +import org.openecomp.mso.cloud.CloudIdentity; +import org.openecomp.mso.openstack.beans.MsoTenant; +import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; +import org.openecomp.mso.openstack.exceptions.MsoException; +import org.openecomp.mso.openstack.utils.MsoTenantUtils; + + +public class NewServerTypeUtils extends MsoTenantUtils { + + /** + * @param msoPropID + */ + public NewServerTypeUtils(String msoPropID) { + super(msoPropID); + } + + @Override + public String createTenant(String tenantName, String cloudSiteId, Map metadata, boolean backout) + throws MsoException { + // TODO Auto-generated method stub + return null; + } + + @Override + public MsoTenant queryTenant(String tenantId, String cloudSiteId) throws MsoException, MsoCloudSiteNotFound { + // TODO Auto-generated method stub + return null; + } + + @Override + public MsoTenant queryTenantByName(String tenantName, String cloudSiteId) + throws MsoException, MsoCloudSiteNotFound { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean deleteTenant(String tenantId, String cloudSiteId) throws MsoException { + // TODO Auto-generated method stub + return false; + } + + @Override + public String getKeystoneUrl(String regionId, String msoPropID, CloudIdentity cloudIdentity) + throws MsoException { + return msoPropID + ":" + regionId + ":NewServerTypeKeystoneURL/" + cloudIdentity.getIdentityUrl(); + } + +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java new file mode 100644 index 0000000000..e2a0f865a0 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java @@ -0,0 +1,63 @@ +/** + * + */ +package org.openecomp.mso.cloud.servertype; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +import org.junit.Test; +import org.openecomp.mso.cloud.CloudIdentity; +import org.openecomp.mso.cloud.CloudIdentity.IdentityServerType; +import org.openecomp.mso.cloud.IdentityServerTypeAbstract; +import org.openecomp.mso.openstack.exceptions.MsoException; + +public class ServerTypeTest { + + @Test + public void testKeystoneServerType() { + IdentityServerTypeAbstract keystoneServerType = IdentityServerType.valueOf("KEYSTONE"); + assertNotNull(keystoneServerType); + } + + @Test + public void testNewServerType() { + IdentityServerTypeAbstract customServerType = null; + try { + customServerType = new IdentityServerType("NewServerType", NewServerTypeUtils.class); + + } catch (IllegalArgumentException e) { + fail("An exception should not be raised when we register a new server type for the first time"); + } finally { + System.out.println(IdentityServerType.values().toString()); + assertEquals(customServerType, IdentityServerType.valueOf("NewServerType")); + } + + // Create it a second time + IdentityServerTypeAbstract customServerType2 = null; + try { + customServerType2 = new IdentityServerType("NewServerType", NewServerTypeUtils.class); + fail("An exception should be raised as server type does not exist"); + } catch (IllegalArgumentException e) { + // Fail silently -- it simply indicates we already registered it + customServerType2 = IdentityServerType.valueOf("NewServerType"); + } finally { + System.out.println(IdentityServerType.values().toString()); + assertEquals(customServerType2, IdentityServerType.valueOf("NewServerType")); + } + + // Check the KeystoneURL for this custom TenantUtils + CloudIdentity cloudIdentity = new CloudIdentity(); + cloudIdentity.setIdentityUrl("LocalIdentity"); + cloudIdentity.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY); + cloudIdentity.setIdentityServerType((CloudIdentity.IdentityServerType) CloudIdentity.IdentityServerType.valueOf("NewServerType")); + String regionId = "RegionA"; + String msoPropID = "12345"; + try { + assertEquals(cloudIdentity.getKeystoneUrl(regionId, msoPropID), msoPropID + ":" + regionId + ":NewServerTypeKeystoneURL/" + cloudIdentity.getIdentityUrl()); + } catch (MsoException e) { + fail("No MSO Exception should have occured here"); + } + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTest.java index e76ce410d4..27007a3ce1 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackESTest.java @@ -1,6 +1,6 @@ /* * This file was automatically generated by EvoSuite - * Mon Nov 14 08:51:17 GMT 2016 + * Fri Feb 17 16:22:30 GMT 2017 */ package org.openecomp.mso.openstack.beans; @@ -8,396 +8,424 @@ package org.openecomp.mso.openstack.beans; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.shaded.org.mockito.Mockito.*; - -import org.openecomp.mso.entity.MsoRequest; +import static org.evosuite.runtime.MockitoExtension.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.ViolatedAssumptionAnswer; import org.junit.runner.RunWith; +import org.openecomp.mso.entity.MsoRequest; +import org.openecomp.mso.openstack.beans.VnfRollback; -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) public class VnfRollbackESTest extends VnfRollbackESTestscaffolding { - @Test(timeout = 4000) - public void test00() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.setVolumeGroupName(", vnfCreated="); - vnfRollback0.getVolumeGroupName(); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.isBase()); - } - - @Test(timeout = 4000) - public void test01() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.setVolumeGroupId("}mvn2f6!r5FG1/_M~M"); - vnfRollback0.getVolumeGroupId(); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.isBase()); - } - - @Test(timeout = 4000) - public void test02() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.setVolumeGroupId(""); - vnfRollback0.getVolumeGroupId(); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.isBase()); - } - - @Test(timeout = 4000) - public void test03() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.setVolumeGroupHeatStackId("Z^t$4-eOKP9"); - vnfRollback0.getVolumeGroupHeatStackId(); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.isBase()); - } - - @Test(timeout = 4000) - public void test04() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.getVnfId(); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.isBase()); - } - - @Test(timeout = 4000) - public void test05() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.setVnfId(""); - vnfRollback0.getVnfId(); - assertFalse(vnfRollback0.isBase()); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.getVnfCreated()); - } - - @Test(timeout = 4000) - public void test06() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.setVfModuleStackId("8y*`!>A$@*l8#a>"); - vnfRollback0.getVfModuleStackId(); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.isBase()); - assertFalse(vnfRollback0.getVnfCreated()); - } - - @Test(timeout = 4000) - public void test07() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.setVfModuleStackId(""); - vnfRollback0.getVfModuleStackId(); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.isBase()); - } - - @Test(timeout = 4000) - public void test08() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(", tenant=", ", tenant=", ", tenant=", false, false, (MsoRequest) null, ", tenant=", "f5`2h^e^.-x", ", tenant="); - String string0 = vnfRollback0.getTenantId(); - assertFalse(vnfRollback0.getVnfCreated()); - assertEquals(", tenant=", vnfRollback0.getCloudSiteId()); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.isBase()); - assertEquals(", tenant=", vnfRollback0.getRequestType()); - assertEquals("f5`2h^e^.-x", vnfRollback0.getVolumeGroupId()); - assertEquals(", tenant=", vnfRollback0.getVolumeGroupName()); - assertEquals(", tenant=", vnfRollback0.getVnfId()); - assertEquals(", tenant=", string0); - } - - @Test(timeout = 4000) - public void test09() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.setTenantId(""); - vnfRollback0.getTenantId(); - assertFalse(vnfRollback0.isBase()); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.getTenantCreated()); - } - - @Test(timeout = 4000) - public void test10() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - assertFalse(vnfRollback0.getTenantCreated()); - - vnfRollback0.setTenantCreated(true); - boolean boolean0 = vnfRollback0.getTenantCreated(); - assertTrue(boolean0); - } - - @Test(timeout = 4000) - public void test11() throws Throwable { - MsoRequest msoRequest0 = mock(MsoRequest.class, new ViolatedAssumptionAnswer()); - VnfRollback vnfRollback0 = new VnfRollback("", ", vnf=", "Jvr", false, false, msoRequest0, "", "f'D", "VnfRollback: cloud="); - String string0 = vnfRollback0.getRequestType(); - assertFalse(vnfRollback0.isBase()); - assertEquals("Jvr", vnfRollback0.getCloudSiteId()); - assertEquals("", vnfRollback0.getVnfId()); - assertFalse(vnfRollback0.getTenantCreated()); - assertEquals("f'D", vnfRollback0.getVolumeGroupId()); - assertEquals(", vnf=", vnfRollback0.getTenantId()); - assertEquals("VnfRollback: cloud=", string0); - assertFalse(vnfRollback0.getVnfCreated()); - assertEquals("", vnfRollback0.getVolumeGroupName()); - } - - @Test(timeout = 4000) - public void test12() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.setRequestType(""); - vnfRollback0.getRequestType(); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.isBase()); - } - - @Test(timeout = 4000) - public void test13() throws Throwable { - MsoRequest msoRequest0 = mock(MsoRequest.class, new ViolatedAssumptionAnswer()); - doReturn("Jvr").when(msoRequest0).toString(); - VnfRollback vnfRollback0 = new VnfRollback("", ", vnf=", "Jvr", false, false, msoRequest0, "", "f'D", "VnfRollback: cloud="); - vnfRollback0.getMsoRequest(); - assertEquals("Jvr", vnfRollback0.getCloudSiteId()); - assertEquals("", vnfRollback0.getVnfId()); - assertFalse(vnfRollback0.isBase()); - assertEquals(", vnf=", vnfRollback0.getTenantId()); - assertEquals("", vnfRollback0.getVolumeGroupName()); - assertEquals("f'D", vnfRollback0.getVolumeGroupId()); - assertEquals("VnfRollback: cloud=", vnfRollback0.getRequestType()); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.getTenantCreated()); - } - - @Test(timeout = 4000) - public void test14() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(", tenant=", ", tenant=", ", tenant=", false, false, (MsoRequest) null, ", tenant=", "f5`2h^e^.-x", ", tenant="); - String string0 = vnfRollback0.getCloudSiteId(); - assertFalse(vnfRollback0.isBase()); - assertEquals(", tenant=", string0); - assertEquals("f5`2h^e^.-x", vnfRollback0.getVolumeGroupId()); - assertFalse(vnfRollback0.getVnfCreated()); - assertEquals(", tenant=", vnfRollback0.getVnfId()); - assertFalse(vnfRollback0.getTenantCreated()); - assertEquals(", tenant=", vnfRollback0.getVolumeGroupName()); - assertEquals(", tenant=", vnfRollback0.getRequestType()); - assertEquals(", tenant=", vnfRollback0.getTenantId()); - } - - @Test(timeout = 4000) - public void test15() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.setCloudSiteId(""); - vnfRollback0.getCloudSiteId(); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.isBase()); - assertFalse(vnfRollback0.getTenantCreated()); - } - - @Test(timeout = 4000) - public void test16() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.setBaseGroupHeatStackId("3(6Q^)Ic kf:zj"); - vnfRollback0.getBaseGroupHeatStackId(); - assertFalse(vnfRollback0.isBase()); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.getVnfCreated()); - } - - @Test(timeout = 4000) - public void test17() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.setBaseGroupHeatStackId(""); - vnfRollback0.getBaseGroupHeatStackId(); - assertFalse(vnfRollback0.isBase()); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.getTenantCreated()); - } - - @Test(timeout = 4000) - public void test18() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - assertFalse(vnfRollback0.isBase()); - - vnfRollback0.setIsBase(true); - boolean boolean0 = vnfRollback0.isBase(); - assertTrue(boolean0); - } - - @Test(timeout = 4000) - public void test19() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.getVfModuleStackId(); - assertFalse(vnfRollback0.isBase()); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.getVnfCreated()); - } - - @Test(timeout = 4000) - public void test20() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.getVolumeGroupName(); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.isBase()); - assertFalse(vnfRollback0.getTenantCreated()); - } - - @Test(timeout = 4000) - public void test21() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.setVolumeGroupName(""); - vnfRollback0.getVolumeGroupName(); - assertFalse(vnfRollback0.isBase()); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.getVnfCreated()); - } - - @Test(timeout = 4000) - public void test22() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - boolean boolean0 = vnfRollback0.getTenantCreated(); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(boolean0); - assertFalse(vnfRollback0.isBase()); - } - - @Test(timeout = 4000) - public void test23() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - boolean boolean0 = vnfRollback0.isBase(); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(boolean0); - } - - @Test(timeout = 4000) - public void test24() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - String string0 = vnfRollback0.toString(); - assertFalse(vnfRollback0.isBase()); - assertEquals("VnfRollback: cloud=null, tenant=null, vnf=null, tenantCreated=false, vnfCreated=false, requestType = null", string0); - } - - @Test(timeout = 4000) - public void test25() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - boolean boolean0 = vnfRollback0.getVnfCreated(); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(boolean0); - assertFalse(vnfRollback0.isBase()); - } - - @Test(timeout = 4000) - public void test26() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.getVolumeGroupHeatStackId(); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.isBase()); - } - - @Test(timeout = 4000) - public void test27() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.getBaseGroupHeatStackId(); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.isBase()); - } - - @Test(timeout = 4000) - public void test28() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.getCloudSiteId(); - assertFalse(vnfRollback0.isBase()); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.getVnfCreated()); - } - - @Test(timeout = 4000) - public void test29() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.getTenantId(); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.isBase()); - assertFalse(vnfRollback0.getVnfCreated()); - } - - @Test(timeout = 4000) - public void test30() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - MsoRequest msoRequest0 = mock(MsoRequest.class, new ViolatedAssumptionAnswer()); - vnfRollback0.setMsoRequest(msoRequest0); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.isBase()); - } - - @Test(timeout = 4000) - public void test31() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.getMsoRequest(); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.isBase()); - } - - @Test(timeout = 4000) - public void test32() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - assertFalse(vnfRollback0.getVnfCreated()); - - vnfRollback0.setVnfCreated(true); - boolean boolean0 = vnfRollback0.getVnfCreated(); - assertTrue(boolean0); - } - - @Test(timeout = 4000) - public void test33() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.getVolumeGroupId(); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.isBase()); - } - - @Test(timeout = 4000) - public void test34() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.getRequestType(); - assertFalse(vnfRollback0.isBase()); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.getVnfCreated()); - } - - @Test(timeout = 4000) - public void test35() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - vnfRollback0.setVolumeGroupHeatStackId(""); - vnfRollback0.getVolumeGroupHeatStackId(); - assertFalse(vnfRollback0.isBase()); - assertFalse(vnfRollback0.getTenantCreated()); - assertFalse(vnfRollback0.getVnfCreated()); - } - - @Test(timeout = 4000) - public void test36() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(", tenant=", ", tenant=", ", tenant=", false, false, (MsoRequest) null, ", tenant=", "f5`2h^e^.-x", ", tenant="); - String string0 = vnfRollback0.getVnfId(); - assertEquals(", tenant=", string0); - assertEquals(", tenant=", vnfRollback0.getTenantId()); - assertFalse(vnfRollback0.getVnfCreated()); - assertFalse(vnfRollback0.isBase()); - assertFalse(vnfRollback0.getTenantCreated()); - assertEquals(", tenant=", vnfRollback0.getCloudSiteId()); - assertEquals(", tenant=", vnfRollback0.getVolumeGroupName()); - assertEquals(", tenant=", vnfRollback0.getRequestType()); - assertEquals("f5`2h^e^.-x", vnfRollback0.getVolumeGroupId()); - } + @Test(timeout = 4000) + public void test05() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setVolumeGroupHeatStackId(""); + vnfRollback0.getVolumeGroupHeatStackId(); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.getVnfId(); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback("M+!!EJC*~uO", "Q,@Ir,{J2Nuu", "M+!!EJC*~uO", true, true, (MsoRequest) null, "M+!!EJC*~uO", "", "Q,@Ir,{J2Nuu", ""); + assertEquals("M+!!EJC*~uO", vnfRollback0.getVnfId()); + + vnfRollback0.setVnfId(""); + vnfRollback0.getVnfId(); + assertEquals("Q,@Ir,{J2Nuu", vnfRollback0.getTenantId()); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + boolean boolean0 = vnfRollback0.getVnfCreated(); + assertFalse(vnfRollback0.isBase()); + assertFalse(boolean0); + assertFalse(vnfRollback0.getTenantCreated()); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setVfModuleStackId("VnfRollback: cloud="); + vnfRollback0.getVfModuleStackId(); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getVnfCreated()); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setVfModuleStackId(""); + vnfRollback0.getVfModuleStackId(); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.getVnfCreated()); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback((String) null, (String) null, ", vnf=", false, true, (MsoRequest) null, "", ", vnf=", "", ""); + String string0 = vnfRollback0.getTenantId(); + assertTrue(vnfRollback0.getVnfCreated()); + assertEquals(", vnf=", vnfRollback0.getVolumeGroupId()); + assertNull(string0); + assertEquals("", vnfRollback0.getVolumeGroupName()); + assertEquals(", vnf=", vnfRollback0.getCloudSiteId()); + assertEquals("", vnfRollback0.getRequestType()); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getTenantCreated()); + assertEquals("", vnfRollback0.getModelCustomizationUuid()); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + assertFalse(vnfRollback0.getTenantCreated()); + + vnfRollback0.setTenantCreated(true); + boolean boolean0 = vnfRollback0.getTenantCreated(); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setRequestType("$W[I&I@KHseI MUVb"); + vnfRollback0.getRequestType(); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.isBase()); + assertFalse(vnfRollback0.getTenantCreated()); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback((String) null, (String) null, ", vnf=", false, true, (MsoRequest) null, "", ", vnf=", "", ""); + String string0 = vnfRollback0.getRequestType(); + assertTrue(vnfRollback0.getVnfCreated()); + assertEquals("", vnfRollback0.getVolumeGroupName()); + assertNotNull(string0); + assertEquals(", vnf=", vnfRollback0.getCloudSiteId()); + assertFalse(vnfRollback0.getTenantCreated()); + assertEquals("", string0); + assertEquals(", vnf=", vnfRollback0.getVolumeGroupId()); + assertEquals("", vnfRollback0.getModelCustomizationUuid()); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + MsoRequest msoRequest0 = mock(MsoRequest.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(msoRequest0).toString(); + VnfRollback vnfRollback0 = new VnfRollback("b", "b", "b", true, false, msoRequest0, "b", "b", "*^0M|pdSi&sbx2u>4q#", (String) null); + vnfRollback0.getMsoRequest(); + assertEquals("b", vnfRollback0.getCloudSiteId()); + assertEquals("b", vnfRollback0.getTenantId()); + assertFalse(vnfRollback0.getVnfCreated()); + assertEquals("b", vnfRollback0.getVnfId()); + assertEquals("b", vnfRollback0.getVolumeGroupName()); + assertEquals("*^0M|pdSi&sbx2u>4q#", vnfRollback0.getRequestType()); + assertEquals("b", vnfRollback0.getVolumeGroupId()); + assertFalse(vnfRollback0.isBase()); + assertTrue(vnfRollback0.getTenantCreated()); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.getModelCustomizationUuid(); + assertFalse(vnfRollback0.getVnfCreated()); + assertFalse(vnfRollback0.getTenantCreated()); + assertFalse(vnfRollback0.isBase()); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + VnfRollback vnfRollback0 = new VnfRollback(); + vnfRollback0.setModelCustomizationUuid("jar mso-adapters-rest-interface - Java Beans (Requests and Responses) for Network/Tenant/VNF REST Operations + Java Beans (Requests and Responses) for Network/Tenant/VNF/SDNC REST Operations ${project.artifactId}-${project.version} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryAllottedResourceCustomization.java new file mode 100644 index 0000000000..fc4cec9201 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryAllottedResourceCustomization.java @@ -0,0 +1,69 @@ +/*- + * ============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.adapters.catalogrest; + +import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; +import org.openecomp.mso.logger.MsoLogger; +import org.codehaus.jackson.map.ObjectMapper; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlRootElement; +import java.util.ArrayList; +import java.util.List; + +@XmlRootElement(name = "serviceAllottedResources") +@NoJackson +public class QueryAllottedResourceCustomization { + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private List allottedResourceCustomization; + + public QueryAllottedResourceCustomization() { super(); allottedResourceCustomization = new ArrayList(); } + public QueryAllottedResourceCustomization(List vlist) { allottedResourceCustomization = vlist; } + + public List getServiceAllottedResources(){ return this.allottedResourceCustomization; } + public void setServiceAllottedResources(List v) { this.allottedResourceCustomization = v; } + + @Override + public String toString () { + StringBuffer buf = new StringBuffer(); + + boolean first = true; + int i = 1; + for (AllottedResourceCustomization o : allottedResourceCustomization) { + buf.append(i+"\t"); + if (!first) buf.append("\n"); first = false; + buf.append(o); + } + return buf.toString(); + } + + public String toJsonString() { + String jsonString = null; + try { + ObjectMapper mapper = new ObjectMapper(); + jsonString = mapper.writeValueAsString(this); + LOGGER.debug ("AllottedResourceCustomization jsonString: "+jsonString); + } + catch (Exception e) { + LOGGER.debug ("AllottedResourceCustomization jsonString exception:"+e.getMessage()); + } + return jsonString; + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceMacroHolder.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceMacroHolder.java new file mode 100644 index 0000000000..2cb756b856 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceMacroHolder.java @@ -0,0 +1,56 @@ +/*- + * ============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.adapters.catalogrest; + +import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder; +import org.openecomp.mso.logger.MsoLogger; +import org.codehaus.jackson.map.ObjectMapper; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "serviceResources") +@NoJackson +public class QueryServiceMacroHolder { + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private ServiceMacroHolder serviceMacroHolder; + + public QueryServiceMacroHolder() { super(); serviceMacroHolder = new ServiceMacroHolder(); } + public QueryServiceMacroHolder(ServiceMacroHolder vlist) { serviceMacroHolder = vlist; } + + public ServiceMacroHolder getServiceResources(){ return this.serviceMacroHolder; } + public void setServiceResources(ServiceMacroHolder v) { this.serviceMacroHolder = v; } + + @Override + public String toString () { return serviceMacroHolder.toString(); } + + public String toJsonString() { + String jsonString = null; + try { + ObjectMapper mapper = new ObjectMapper(); + jsonString = mapper.writeValueAsString(this); + LOGGER.debug ("QueryServiceMacroHolder jsonString: "+jsonString); + } + catch (Exception e) { + LOGGER.debug ("QueryServiceMacroHolder jsonString exception:"+e.getMessage()); + } + return jsonString; + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceNetworks.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceNetworks.java new file mode 100644 index 0000000000..dfc3683fad --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceNetworks.java @@ -0,0 +1,78 @@ +/*- + * ============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.adapters.catalogrest; + +import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; +import org.openecomp.mso.logger.MsoLogger; +import org.codehaus.jackson.map.ObjectMapper; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlRootElement; +import java.util.ArrayList; +import java.util.List; + +@XmlRootElement(name = "serviceNetworks") +@NoJackson +public class QueryServiceNetworks { + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private List serviceNetworks; + + public QueryServiceNetworks() { super(); serviceNetworks = new ArrayList(); } + public QueryServiceNetworks(List vlist) { + LOGGER.debug ("QueryServiceNetworks:"); + serviceNetworks = new ArrayList(); + for (NetworkResourceCustomization o : vlist) { + LOGGER.debug ("-- o is a serviceNetworks ----"); + LOGGER.debug (o.toString()); + serviceNetworks.add(o); + LOGGER.debug ("-------------------"); + } + } + + public List getServiceNetworks(){ return this.serviceNetworks; } + public void setServiceNetworks(List v) { this.serviceNetworks = v; } + + @Override + public String toString () { + StringBuffer buf = new StringBuffer(); + + boolean first = true; + int i = 1; + for (NetworkResourceCustomization o : serviceNetworks) { + buf.append(i+"\t"); + if (!first) buf.append("\n"); first = false; + buf.append(o); + } + return buf.toString(); + } + + public String toJsonString() { + String jsonString = null; + try { + ObjectMapper mapper = new ObjectMapper(); + jsonString = mapper.writeValueAsString(this); + LOGGER.debug ("QueryServiceNetworks jsonString: "+jsonString); + } + catch (Exception e) { + LOGGER.debug ("QueryServiceNetworks jsonString exception:"+e.getMessage()); + } + return jsonString; + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfs.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfs.java new file mode 100644 index 0000000000..0ea054309b --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfs.java @@ -0,0 +1,79 @@ +/*- + * ============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.adapters.catalogrest; +/* should be called QueryVnfResource.java */ + +import org.openecomp.mso.db.catalog.beans.VnfResource; +import org.openecomp.mso.logger.MsoLogger; +import org.codehaus.jackson.map.ObjectMapper; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlRootElement; +import java.util.ArrayList; +import java.util.List; + +@XmlRootElement(name = "serviceVnfs") +@NoJackson +public class QueryServiceVnfs { + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + private List serviceVnfs; + + public QueryServiceVnfs() { super(); serviceVnfs = new ArrayList(); } + public QueryServiceVnfs(List vlist) { + LOGGER.debug ("QueryServiceVnfs:"); + serviceVnfs = new ArrayList(); + for (VnfResource o : vlist) { + LOGGER.debug ("-- o is a serviceVnfs ----"); + LOGGER.debug (o.toString()); + serviceVnfs.add(o); + LOGGER.debug ("-------------------"); + } + } + + public List getServiceVnfs(){ return this.serviceVnfs; } + public void setServiceVnfs(List v) { this.serviceVnfs = v; } + + @Override + public String toString () { + StringBuffer buf = new StringBuffer(); + + boolean first = true; + int i = 1; + for (VnfResource o : serviceVnfs) { + buf.append(i+"\t"); + if (!first) buf.append("\n"); first = false; + buf.append(o); + } + return buf.toString(); + } + + public String toJsonString() { + String jsonString = null; + try { + ObjectMapper mapper = new ObjectMapper(); + jsonString = mapper.writeValueAsString(this); + LOGGER.debug ("QuerySrviceVnfs jsonString: "+jsonString); + } + catch (Exception e) { + LOGGER.debug ("QuerySrviceVnfs jsonString exception:"+e.getMessage()); + } + return jsonString; + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java new file mode 100644 index 0000000000..03b8beae03 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java @@ -0,0 +1,74 @@ +/*- + * ============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.adapters.json; + +import org.codehaus.jackson.JsonNode; +import org.codehaus.jackson.JsonParser; +import org.codehaus.jackson.JsonProcessingException; +import org.codehaus.jackson.map.DeserializationContext; +import org.codehaus.jackson.map.JsonDeserializer; +import org.codehaus.jackson.map.ObjectMapper; + +import java.io.IOException; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * Custom JSON Deserializer for Map. + * In MSO with Jackson 1.9.12 and RestEasy 3.0.8, maps in JSON are serialized as + * follows: + *
+ * "params": {
+ *   "entry": [
+ *     {"key": "P1", "value": "V1"},
+ *     {"key": "P2", "value": "V2"},
+ *     ...
+ *     {"key": "PN", "value": "VN"}
+ *   ]
+ * }
+ * The implementation uses a LinkedHashMap to preserve the ordering of entries.
+ * 
+ */ +public class MapDeserializer extends JsonDeserializer> { + @Override + public Map deserialize(JsonParser parser, + DeserializationContext context) throws IOException, + JsonProcessingException { + ObjectMapper mapper = new ObjectMapper(); + JsonNode tree = mapper.readTree(parser); + + Map map = new LinkedHashMap(); + Iterator iterator = tree.iterator(); + + while (iterator.hasNext()) { + JsonNode element = iterator.next(); + Iterator arrayIterator = element.iterator(); + while (arrayIterator.hasNext()) { + JsonNode arrayElement = arrayIterator.next(); + String key = arrayElement.get("key").getTextValue(); + String value = arrayElement.get("value").getTextValue(); + map.put(key, value); + } + } + + return map; + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java new file mode 100644 index 0000000000..e3f55a0e69 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java @@ -0,0 +1,67 @@ +/*- + * ============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.adapters.json; + +import org.codehaus.jackson.JsonGenerationException; +import org.codehaus.jackson.JsonGenerator; +import org.codehaus.jackson.map.JsonSerializer; +import org.codehaus.jackson.map.SerializerProvider; + +import java.io.IOException; +import java.util.Map; + +/** + * Custom JSON Serializer for Map. + * In MSO with Jackson 1.9.12 and RestEasy 3.0.8, maps in JSON are serialized as + * follows: + *
+ * "params": {
+ *   "entry": [
+ *     {"key": "P1", "value": "V1"},
+ *     {"key": "P2", "value": "V2"},
+ *     ...
+ *     {"key": "PN", "value": "VN"}
+ *   ]
+ * }
+ * 
+ * The implementation uses a TreeMap, so entries are always sorted according + * to the natural ordering of the keys. + */ +public class MapSerializer extends JsonSerializer> { + @Override + public void serialize(Map map, JsonGenerator jsonGenerator, + SerializerProvider serializerProvider) throws IOException, + JsonGenerationException { + + jsonGenerator.writeStartObject(); + jsonGenerator.writeArrayFieldStart("entry"); + + for (String key : map.keySet()) { + String value = map.get(key); + jsonGenerator.writeStartObject(); + jsonGenerator.writeStringField("key", key); + jsonGenerator.writeStringField("value", value); + jsonGenerator.writeEndObject(); + } + + jsonGenerator.writeEndArray(); + jsonGenerator.writeEndObject(); + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java new file mode 100644 index 0000000000..24a543c4f0 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java @@ -0,0 +1,87 @@ +/*- + * ============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.adapters.sdncrest; + +import org.codehaus.jackson.annotate.JsonProperty; + +import javax.xml.bind.annotation.XmlElement; +import java.io.Serializable; + +/** + * Request Information specified by the SDNC "agnostic" API. + */ +public class RequestInformation implements Serializable { + private static final long serialVersionUID = 1L; + + // Identifies the transaction MSO has with the calling system. + private String requestId; + + // Identifies the calling system, e.g. CCD. + private String source; + + // The calling system's endpoint for receiving notifications from MSO. + private String notificationUrl; + + // NOTE: these are defined in the SDNC AID, but not used by MSO: + // request-action + // request-sub-action + + public RequestInformation(String requestId, String source, String notificationUrl) { + this.requestId = requestId; + this.source = source; + this.notificationUrl = notificationUrl; + } + + public RequestInformation() { + } + + @JsonProperty("requestId") + @XmlElement(name = "requestId") + public String getRequestId() { + return requestId; + } + + @JsonProperty("requestId") + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + @JsonProperty("source") + @XmlElement(name = "source") + public String getSource() { + return source; + } + + @JsonProperty("source") + public void setSource(String source) { + this.source = source; + } + + @JsonProperty("notificationUrl") + @XmlElement(name = "notificationUrl") + public String getNotificationUrl() { + return notificationUrl; + } + + @JsonProperty("notificationUrl") + public void setNotificationUrl(String notificationUrl) { + this.notificationUrl = notificationUrl; + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommon.java new file mode 100644 index 0000000000..20fc0498f4 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommon.java @@ -0,0 +1,37 @@ +/*- + * ============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.adapters.sdncrest; + +import java.io.Serializable; + +/** + * Base class for all SDNC adapter error responses. + */ +public abstract class SDNCErrorCommon extends SDNCResponseCommon implements Serializable { + private static final long serialVersionUID = 1L; + + public SDNCErrorCommon(String sdncRequestId, String responseCode, + String responseMessage, String ackFinalIndicator) { + super(sdncRequestId, responseCode, responseMessage, ackFinalIndicator); + } + + public SDNCErrorCommon() { + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java new file mode 100644 index 0000000000..038aaa4bba --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java @@ -0,0 +1,151 @@ +/*- + * ============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.adapters.sdncrest; + +import org.openecomp.mso.adapters.json.MapDeserializer; +import org.openecomp.mso.adapters.json.MapSerializer; +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.map.SerializationConfig; +import org.codehaus.jackson.map.annotate.JsonDeserialize; +import org.codehaus.jackson.map.annotate.JsonRootName; +import org.codehaus.jackson.map.annotate.JsonSerialize; +import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.IOException; +import java.io.Serializable; +import java.util.LinkedHashMap; +import java.util.Map; + +// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, +// even though we are using JSON exclusively. The @NoJackson annotation +// is also required in this environment. + +/** + * SDNC adapter success response for "agnostic" API services. Note that the + * map of response parameters is represented this way in JSON: + *
+ * "params": {
+ *   "entry": [
+ *     {"key": "P1", "value": "V1"},
+ *     {"key": "P2", "value": "V2"},
+ *     ...
+ *     {"key": "PN", "value": "VN"}
+ *   ]
+ * }
+ * 
+ */ +@JsonRootName("SDNCEvent") +@JsonSerialize(include= Inclusion.NON_NULL) +@XmlRootElement(name = "SDNCEvent") +@NoJackson +public class SDNCEvent implements Serializable { + private static final long serialVersionUID = 1L; + + // Event type + private String eventType; + + // Event correlator type + private String eventCorrelatorType; + + // Event correlator value. + private String eventCorrelator; + + // Map of response parameters (possibly none). + private Map params = null; + + public SDNCEvent(String eventType, String eventCorrelatorType, String eventCorrelator) { + this.eventType = eventType; + this.eventCorrelatorType = eventCorrelatorType; + this.eventCorrelator = eventCorrelator; + } + + public SDNCEvent() { + } + + @JsonProperty("eventType") + @XmlElement(name = "eventType") + public String getEventType() { + return eventType; + } + + @JsonProperty("eventType") + public void setEventType(String eventType) { + this.eventType = eventType; + } + + @JsonProperty("eventCorrelatorType") + @XmlElement(name = "eventCorrelatorType") + public String getEventCorrelatorType() { + return eventCorrelatorType; + } + + @JsonProperty("eventCorrelatorType") + public void setEventCorrelatorType(String eventCorrelatorType) { + this.eventCorrelatorType = eventCorrelatorType; + } + + @JsonProperty("eventCorrelator") + @XmlElement(name = "eventCorrelator") + public String getEventCorrelator() { + return eventCorrelator; + } + + @JsonProperty("eventCorrelator") + public void setEventCorrelator(String eventCorrelator) { + this.eventCorrelator = eventCorrelator; + } + + @JsonProperty("params") + @JsonDeserialize(using = MapDeserializer.class) + @XmlElement(name = "params") + public Map getParams() { + return params; + } + + @JsonProperty("params") + @JsonSerialize(using = MapSerializer.class, include= Inclusion.NON_NULL) + public void setParams(Map params) { + this.params = params; + } + + public void addParam(String name, String value) { + if (params == null) { + params = new LinkedHashMap(); + } + params.put(name, value); + } + + public String toJson() { + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.setSerializationInclusion(Inclusion.NON_NULL); + return mapper.writeValueAsString(this); + } catch (IOException e) { + e.printStackTrace(); + throw new UnsupportedOperationException("Cannot convert " + + getClass().getSimpleName() + " to JSON", e); + } + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java new file mode 100644 index 0000000000..6232af6f79 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java @@ -0,0 +1,109 @@ +/*- + * ============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.adapters.sdncrest; + +import org.codehaus.jackson.annotate.JsonIgnore; +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.map.SerializationConfig; +import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; + +import javax.xml.bind.annotation.XmlElement; +import java.io.IOException; +import java.io.Serializable; + +/** + * Base class for all SDNC adapter requests. + */ +public abstract class SDNCRequestCommon implements Serializable { + private static final long serialVersionUID = 1L; + + // Endpoint on which BPMN can receive notifications from the SDNC adapter. + private String bpNotificationUrl; + + // BPMN flow timeout value in ISO 8601 format, e.g. PT5M. + // Not currently used by the SDNC adapter. + private String bpTimeout; + + // Identifies the MSO transaction with SDNC. + // Maps to sdnc-request-header/requestId in the SDNC request. + private String sdncRequestId; + + public SDNCRequestCommon(String sdncRequestId, String bpNotificationUrl, + String bpTimeout) { + this.sdncRequestId = sdncRequestId; + this.bpNotificationUrl = bpNotificationUrl; + this.bpTimeout = bpTimeout; + } + + public SDNCRequestCommon() { + } + + @JsonProperty("bpNotificationUrl") + @XmlElement(name = "bpNotificationUrl") + public String getBPNotificationUrl() { + return bpNotificationUrl; + } + + @JsonProperty("bpNotificationUrl") + public void setBPNotificationUrl(String bpNotificationUrl) { + this.bpNotificationUrl = bpNotificationUrl; + } + + @JsonProperty("bpTimeout") + @XmlElement(name = "bpTimeout") + public String getBPTimeout() { + return bpTimeout; + } + + @JsonProperty("bpTimeout") + public void setBPTimeout(String bpTimeout) { + this.bpTimeout = bpTimeout; + } + + @JsonProperty("sdncRequestId") + @XmlElement(name = "sdncRequestId") + public String getSDNCRequestId() { + return sdncRequestId; + } + + @JsonProperty("sdncRequestId") + public void setSDNCRequestId(String sdncRequestId) { + this.sdncRequestId = sdncRequestId; + } + + @JsonIgnore + public boolean isSynchronous() { + return bpNotificationUrl == null || bpNotificationUrl.isEmpty(); + } + + public String toJson() { + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.setSerializationInclusion(Inclusion.NON_NULL); + return mapper.writeValueAsString(this); + } catch (IOException e) { + e.printStackTrace(); + throw new UnsupportedOperationException("Cannot convert " + + getClass().getSimpleName() + " to JSON", e); + } + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java new file mode 100644 index 0000000000..aa0be2702b --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java @@ -0,0 +1,117 @@ +/*- + * ============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.adapters.sdncrest; + +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.map.SerializationConfig; +import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; + +import javax.xml.bind.annotation.XmlElement; +import java.io.IOException; +import java.io.Serializable; + +/** + * Base class for all SDNC adapter responses, including errors. + */ +public abstract class SDNCResponseCommon implements Serializable { + private static final long serialVersionUID = 1L; + + // Identifies the MSO transaction with SDNC. + private String sdncRequestId; + + // Response code, either from SDNC, or generated by the SDNC adapter. + // 2XX responses are considered success responses. + private String responseCode; + + // Response message, either from SDNC, or generated by the SDNC adapter. + private String responseMessage; + + // Indicates if the response is final (Y or N). + private String ackFinalIndicator; + + public SDNCResponseCommon(String sdncRequestId, String responseCode, + String responseMessage, String ackFinalIndicator) { + this.sdncRequestId = sdncRequestId; + this.responseCode = responseCode; + this.responseMessage = responseMessage; + this.ackFinalIndicator = ackFinalIndicator; + } + + public SDNCResponseCommon() { + } + + @JsonProperty("sdncRequestId") + @XmlElement(name = "sdncRequestId") + public String getSDNCRequestId() { + return sdncRequestId; + } + + @JsonProperty("sdncRequestId") + public void setSDNCRequestId(String sdncRequestId) { + this.sdncRequestId = sdncRequestId; + } + + @JsonProperty("responseCode") + @XmlElement(name = "responseCode") + public String getResponseCode() { + return responseCode; + } + + @JsonProperty("responseCode") + public void setResponseCode(String responseCode) { + this.responseCode = responseCode; + } + + @JsonProperty("responseMessage") + @XmlElement(name = "responseMessage") + public String getResponseMessage() { + return responseMessage; + } + + @JsonProperty("responseMessage") + public void setResponseMessage(String responseMessage) { + this.responseMessage = responseMessage; + } + + @JsonProperty("ackFinalIndicator") + @XmlElement(name = "ackFinalIndicator") + public String getAckFinalIndicator() { + return ackFinalIndicator; + } + + @JsonProperty("ackFinalIndicator") + public void setAckFinalIndicator(String ackFinalIndicator) { + this.ackFinalIndicator = ackFinalIndicator; + } + + public String toJson() { + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.setSerializationInclusion(Inclusion.NON_NULL); + return mapper.writeValueAsString(this); + } catch (IOException e) { + e.printStackTrace(); + throw new UnsupportedOperationException("Cannot convert " + + getClass().getSimpleName() + " to JSON", e); + } + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java new file mode 100644 index 0000000000..a789316754 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java @@ -0,0 +1,50 @@ +/*- + * ============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.adapters.sdncrest; + +import org.codehaus.jackson.map.annotate.JsonRootName; +import org.codehaus.jackson.map.annotate.JsonSerialize; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; + +// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, +// even though we are using JSON exclusively. The @NoJackson annotation +// is also required in this environment. + +/** + * SDNC adapter error response for "agnostic" API services. + */ +@JsonRootName("SDNCServiceError") +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@XmlRootElement(name = "SDNCServiceError") +@NoJackson +public class SDNCServiceError extends SDNCErrorCommon implements Serializable { + private static final long serialVersionUID = 1; + + public SDNCServiceError(String sdncRequestId, String responseCode, + String responseMessage, String ackFinalIndicator) { + super(sdncRequestId, responseCode, responseMessage, ackFinalIndicator); + } + + public SDNCServiceError() { + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java new file mode 100644 index 0000000000..814b603783 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java @@ -0,0 +1,146 @@ +/*- + * ============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.adapters.sdncrest; + +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonRootName; +import org.codehaus.jackson.map.annotate.JsonSerialize; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; + +// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, +// even though we are using JSON exclusively. The @NoJackson annotation +// is also required in this environment. + +/** + * SDNC adapter request for "agnostic" API services. + * The target action is determined by a service type and an operation. + */ +@JsonRootName("SDNCServiceRequest") +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@XmlRootElement(name = "SDNCServiceRequest") +@NoJackson +public class SDNCServiceRequest extends SDNCRequestCommon implements Serializable { + private static final long serialVersionUID = 1L; + + // Request Information specified by SDNC "agnostic" API + private RequestInformation requestInformation; + + // Service Information specified by: SDNC "agnostic" API + private ServiceInformation serviceInformation; + + // The SDNC service type specified by SDNC "agnostic" API + private String sdncService; + + // The SDNC operation specified by SDNC "agnostic" API + private String sdncOperation; + + // The SDNC service data type specified by SDNC "agnostic" API + private String sdncServiceDataType; + + // The SDNC service data specified by SDNC "agnostic" API + private String sndcServiceData; + + public SDNCServiceRequest() { + } + + public SDNCServiceRequest(String bpNotificationUrl, String bpTimeout, + String sdncRequestId, String sdncService, String sdncOperation, + RequestInformation requestInformation, + ServiceInformation serviceInformation, String sdncServiceDataType, + String sndcServiceData) { + super(bpNotificationUrl, bpTimeout, sdncRequestId); + this.requestInformation = requestInformation; + this.serviceInformation = serviceInformation; + this.sdncService = sdncService; + this.sdncOperation = sdncOperation; + this.sdncServiceDataType = sdncServiceDataType; + this.sndcServiceData = sndcServiceData; + } + + @JsonProperty("requestInformation") + @XmlElement(name = "requestInformation") + public RequestInformation getRequestInformation() { + return requestInformation; + } + + @JsonProperty("requestInformation") + public void setRequestInformation(RequestInformation requestInformation) { + this.requestInformation = requestInformation; + } + + @JsonProperty("serviceInformation") + @XmlElement(name = "serviceInformation") + public ServiceInformation getServiceInformation() { + return serviceInformation; + } + + @JsonProperty("serviceInformation") + public void setServiceInformation(ServiceInformation serviceInformation) { + this.serviceInformation = serviceInformation; + } + + @JsonProperty("sdncService") + @XmlElement(name = "sdncService") + public String getSDNCService() { + return sdncService; + } + + @JsonProperty("sdncService") + public void setSDNCService(String sdncService) { + this.sdncService = sdncService; + } + + @JsonProperty("sdncOperation") + @XmlElement(name = "sdncOperation") + public String getSDNCOperation() { + return sdncOperation; + } + + @JsonProperty("sdncOperation") + public void setSDNCOperation(String sdncOperation) { + this.sdncOperation = sdncOperation; + } + + @JsonProperty("sdncServiceDataType") + @XmlElement(name = "sdncServiceDataType") + public String getSDNCServiceDataType() { + return sdncServiceDataType; + } + + @JsonProperty("sdncServiceDataType") + public void setSDNCServiceDataType(String sdncServiceDataType) { + this.sdncServiceDataType = sdncServiceDataType; + } + + @JsonProperty("sdncServiceData") + @XmlElement(name = "sdncServiceData") + public String getSDNCServiceData() { + return sndcServiceData; + } + + @JsonProperty("sdncServiceData") + public void setSDNCServiceData(String sndcServiceData) { + this.sndcServiceData = sndcServiceData; + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java new file mode 100644 index 0000000000..2ab6ed5a8a --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java @@ -0,0 +1,91 @@ +/*- + * ============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.adapters.sdncrest; + +import org.openecomp.mso.adapters.json.MapDeserializer; +import org.openecomp.mso.adapters.json.MapSerializer; +import org.codehaus.jackson.annotate.JsonProperty; +import org.codehaus.jackson.map.annotate.JsonDeserialize; +import org.codehaus.jackson.map.annotate.JsonRootName; +import org.codehaus.jackson.map.annotate.JsonSerialize; +import org.jboss.resteasy.annotations.providers.NoJackson; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import java.io.Serializable; +import java.util.LinkedHashMap; +import java.util.Map; + +// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, +// even though we are using JSON exclusively. The @NoJackson annotation +// is also required in this environment. + +/** + * SDNC adapter success response for "agnostic" API services. Note that the + * map of response parameters is represented this way in JSON: + *
+ * "params": {
+ *   "entry": [
+ *     {"key": "P1", "value": "V1"},
+ *     {"key": "P2", "value": "V2"},
+ *     ...
+ *     {"key": "PN", "value": "VN"}
+ *   ]
+ * }
+ * 
+ */ +@JsonRootName("SDNCServiceResponse") +@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) +@XmlRootElement(name = "SDNCServiceResponse") +@NoJackson +public class SDNCServiceResponse extends SDNCResponseCommon implements Serializable { + private static final long serialVersionUID = 1L; + + // Map of response parameters (possibly none). + private Map params = null; + + public SDNCServiceResponse(String sdncRequestId, String responseCode, + String responseMessage, String ackFinalIndicator) { + super(sdncRequestId, responseCode, responseMessage, ackFinalIndicator); + } + + public SDNCServiceResponse() { + } + + @JsonProperty("params") + @JsonDeserialize(using = MapDeserializer.class) + @XmlElement(name = "params") + public Map getParams() { + return params; + } + + @JsonProperty("params") + @JsonSerialize(using = MapSerializer.class, include=JsonSerialize.Inclusion.NON_NULL) + public void setParams(Map params) { + this.params = params; + } + + public void addParam(String name, String value) { + if (params == null) { + params = new LinkedHashMap(); + } + params.put(name, value); + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java new file mode 100644 index 0000000000..628ef9c071 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java @@ -0,0 +1,102 @@ +/*- + * ============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.adapters.sdncrest; + +import org.codehaus.jackson.annotate.JsonProperty; + +import javax.xml.bind.annotation.XmlElement; +import java.io.Serializable; + +/** + * Service Information specified by the SDNC "agnostic" API. + */ +public class ServiceInformation implements Serializable { + private static final long serialVersionUID = 1L; + + // The subscription's service type for the target service instance. + private String serviceType; + + // Identifies the target service instance for this particular SDNC request. + // NOTE: this could be a child of the parent model instance, i.e. this + // service instance ID may be different from the service instance ID + // associated with the transaction MSO has with the system that invoked it. + private String serviceInstanceId; + + // The subscriber name. + private String subscriberName; + + // The subscriber global ID (customer ID). + private String subscriberGlobalId; + + public ServiceInformation(String serviceType, String serviceInstanceId, + String subscriberName, String subscriberGlobalId) { + this.serviceType = serviceType; + this.serviceInstanceId = serviceInstanceId; + this.subscriberName = subscriberName; + this.subscriberGlobalId = subscriberGlobalId; + } + + public ServiceInformation() { + } + + @JsonProperty("serviceType") + @XmlElement(name = "serviceType") + public String getServiceType() { + return serviceType; + } + + @JsonProperty("serviceType") + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + @JsonProperty("serviceInstanceId") + @XmlElement(name = "serviceInstanceId") + public String getServiceInstanceId() { + return serviceInstanceId; + } + + @JsonProperty("serviceInstanceId") + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + @JsonProperty("subscriberName") + @XmlElement(name = "subscriberName") + public String getSubscriberName() { + return subscriberName; + } + + @JsonProperty("subscriberName") + public void setSubscriberName(String subscriberName) { + this.subscriberName = subscriberName; + } + + @JsonProperty("subscriberGlobalId") + @XmlElement(name = "subscriberGlobalId") + public String getSubscriberGlobalId() { + return subscriberGlobalId; + } + + @JsonProperty("subscriberGlobalId") + public void setSubscriberGlobalId(String subscriberGlobalId) { + this.subscriberGlobalId = subscriberGlobalId; + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java index f337c4c9de..bcee2ffd8a 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java @@ -7,9 +7,9 @@ * 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. @@ -66,6 +66,7 @@ public class CreateVfModuleRequest extends VfRequestCommon { private String volumeGroupStackId; private String baseVfModuleId; private String baseVfModuleStackId; + private String modelCustomizationUuid; private String requestType; private Boolean failIfExists; @@ -170,6 +171,14 @@ public class CreateVfModuleRequest extends VfRequestCommon { this.baseVfModuleStackId = baseVfModuleStackId; } + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public String getRequestType() { return requestType; } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java index b93a26031f..840edf7fbc 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java @@ -7,9 +7,9 @@ * 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. @@ -42,6 +42,7 @@ public class CreateVolumeGroupRequest extends VfRequestCommon { private String vnfType; private String vnfVersion; private String vfModuleType; + private String modelCustomizationUuid; private Map volumeGroupParams = new HashMap(); private Boolean failIfExists; private Boolean suppressBackout; @@ -111,6 +112,14 @@ public class CreateVolumeGroupRequest extends VfRequestCommon { return volumeGroupId; } + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public void setVolumeGroupId(String volumeGroupId) { this.volumeGroupId = volumeGroupId; } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java index a3d00a95cd..8f719c88c8 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java @@ -7,9 +7,9 @@ * 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. @@ -25,6 +25,9 @@ import javax.xml.bind.annotation.XmlRootElement; import org.jboss.resteasy.annotations.providers.NoJackson; import org.codehaus.jackson.map.annotate.JsonRootName; +import java.util.HashMap; +import java.util.Map; + @JsonRootName("deleteVfModuleResponse") @XmlRootElement(name = "deleteVfModuleResponse") @NoJackson @@ -32,16 +35,17 @@ public class DeleteVfModuleResponse extends VfResponseCommon { private String vnfId; private String vfModuleId; private Boolean vfModuleDeleted; - + private Map vfModuleOutputs = new HashMap(); public DeleteVfModuleResponse() { super(); } - public DeleteVfModuleResponse(String vnfId, String vfModuleId, Boolean vfModuleDeleted, String messageId) { + public DeleteVfModuleResponse(String vnfId, String vfModuleId, Boolean vfModuleDeleted, String messageId, Map outputs) { super(messageId); this.vnfId = vnfId; this.vfModuleId = vfModuleId; this.vfModuleDeleted = vfModuleDeleted; + this.vfModuleOutputs = outputs; } public String getVnfId() { @@ -67,4 +71,11 @@ public class DeleteVfModuleResponse extends VfResponseCommon { public void setVfModuleDeleted(Boolean vfModuleDeleted) { this.vfModuleDeleted = vfModuleDeleted; } + public Map getVfModuleOutputs() { + return vfModuleOutputs; + } + + public void setVfModuleOutputs(Map vfModuleOutputs) { + this.vfModuleOutputs = vfModuleOutputs; + } } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java index a234e749ba..6c11232bfa 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java @@ -7,9 +7,9 @@ * 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. @@ -52,6 +52,8 @@ public class UpdateVfModuleRequest extends VfRequestCommon { private String baseVfModuleId; private String baseVfModuleStackId; + private String modelCustomizationUuid; + private String requestType; private Boolean failIfExists; private Boolean backout; @@ -151,6 +153,14 @@ public class UpdateVfModuleRequest extends VfRequestCommon { return baseVfModuleId; } + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public void setBaseVfModuleId(String baseVfModuleId) { this.baseVfModuleId = baseVfModuleId; } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java index 50c60b30d6..596021e5e8 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java @@ -7,9 +7,9 @@ * 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. @@ -42,6 +42,7 @@ public class UpdateVolumeGroupRequest extends VfRequestCommon { private String vnfType; private String vnfVersion; private String vfModuleType; + private String modelCustomizationUuid; private Map volumeGroupParams = new HashMap(); private MsoRequest msoRequest = new MsoRequest(); @@ -105,6 +106,14 @@ public class UpdateVolumeGroupRequest extends VfRequestCommon { this.vfModuleType = vfModuleType; } + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public Map getVolumeGroupParams() { return volumeGroupParams; } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryAllottedResourceCustomizationESTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryAllottedResourceCustomizationESTest.java new file mode 100644 index 0000000000..5addb999ce --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryAllottedResourceCustomizationESTest.java @@ -0,0 +1,97 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Feb 20 14:08:31 GMT 2017 + */ + +package org.openecomp.mso.adapters.catalogrest; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.runtime.EvoAssertions.*; +import java.util.LinkedList; +import java.util.List; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.junit.runner.RunWith; +import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class QueryAllottedResourceCustomizationESTest extends QueryAllottedResourceCustomizationESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + QueryAllottedResourceCustomization queryAllottedResourceCustomization0 = new QueryAllottedResourceCustomization(); + queryAllottedResourceCustomization0.setServiceAllottedResources((List) null); + List list0 = queryAllottedResourceCustomization0.getServiceAllottedResources(); + assertNull(list0); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + AllottedResourceCustomization allottedResourceCustomization0 = new AllottedResourceCustomization(); + linkedList0.add(allottedResourceCustomization0); + QueryAllottedResourceCustomization queryAllottedResourceCustomization0 = new QueryAllottedResourceCustomization((List) linkedList0); + List list0 = queryAllottedResourceCustomization0.getServiceAllottedResources(); + assertFalse(list0.isEmpty()); + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + AllottedResourceCustomization allottedResourceCustomization0 = new AllottedResourceCustomization(); + linkedList0.add(allottedResourceCustomization0); + QueryAllottedResourceCustomization queryAllottedResourceCustomization0 = new QueryAllottedResourceCustomization((List) linkedList0); + linkedList0.add(allottedResourceCustomization0); + String string0 = queryAllottedResourceCustomization0.toString(); + assertEquals("1\tmodelName=null,modelVersion=null,version=null,modelUuid=null,modelInvariantUuid=null,modelCustomizationUuid=null,modelInstanceName=null,description=null,modelInstanceName=null,created=null1\t\nmodelName=null,modelVersion=null,version=null,modelUuid=null,modelInvariantUuid=null,modelCustomizationUuid=null,modelInstanceName=null,description=null,modelInstanceName=null,created=null", string0); + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + QueryAllottedResourceCustomization queryAllottedResourceCustomization0 = new QueryAllottedResourceCustomization(); + String string0 = queryAllottedResourceCustomization0.toString(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + QueryAllottedResourceCustomization queryAllottedResourceCustomization0 = new QueryAllottedResourceCustomization(); + List list0 = queryAllottedResourceCustomization0.getServiceAllottedResources(); + assertTrue(list0.isEmpty()); + } + + @Test(timeout = 4000) + public void test5() throws Throwable { + QueryAllottedResourceCustomization queryAllottedResourceCustomization0 = new QueryAllottedResourceCustomization(); + queryAllottedResourceCustomization0.setServiceAllottedResources((List) null); + // Undeclared exception! + try { + queryAllottedResourceCustomization0.toString(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.adapters.catalogrest.QueryAllottedResourceCustomization", e); + } + } + + @Test(timeout = 4000) + public void test6() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + QueryAllottedResourceCustomization queryAllottedResourceCustomization0 = new QueryAllottedResourceCustomization((List) linkedList0); + // Undeclared exception! + try { + queryAllottedResourceCustomization0.toJsonString(); + fail("Expecting exception: VerifyError"); + + } catch(VerifyError e) { + // + // (class: org/codehaus/jackson/map/MapperConfig, method: signature: ()V) Bad type in putfield/putstatic + // + verifyException("org.codehaus.jackson.map.ObjectMapper", e); + } + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryAllottedResourceCustomizationESTestscaffolding.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryAllottedResourceCustomizationESTestscaffolding.java new file mode 100644 index 0000000000..0ce23dc7c2 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryAllottedResourceCustomizationESTestscaffolding.java @@ -0,0 +1,264 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Feb 20 14:08:31 GMT 2017 + */ + +package org.openecomp.mso.adapters.catalogrest; + +import org.evosuite.runtime.annotation.EvoSuiteClassExclude; +import org.junit.BeforeClass; +import org.junit.Before; +import org.junit.After; +import org.junit.AfterClass; +import org.evosuite.runtime.sandbox.Sandbox; + +@EvoSuiteClassExclude +public class QueryAllottedResourceCustomizationESTestscaffolding { + + @org.junit.Rule + public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); + + private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + + private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); + + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.adapters.catalogrest.QueryAllottedResourceCustomization"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; + org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); + initializeClasses(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } + + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); + } + + @Before + public void initTestCase(){ + threadStopper.storeCurrentThreads(); + threadStopper.startRecordingTime(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } + + @After + public void doneWithTestCase(){ + threadStopper.killAndJoinClientThreads(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } + + private static void initializeClasses() { + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(QueryAllottedResourceCustomizationESTestscaffolding.class.getClassLoader() , + "org.codehaus.jackson.map.JsonSerializableWithType", + "org.codehaus.jackson.map.HandlerInstantiator", + "org.codehaus.jackson.map.deser.StdDeserializerProvider", + "org.codehaus.jackson.map.SerializerFactory", + "org.codehaus.jackson.map.SerializerProvider", + "org.codehaus.jackson.map.type.TypeBindings", + "org.codehaus.jackson.map.SerializationConfig", + "org.codehaus.jackson.JsonProcessingException", + "org.codehaus.jackson.map.introspect.AnnotationMap", + "org.codehaus.jackson.map.introspect.Annotated", + "org.codehaus.jackson.io.InputDecorator", + "org.codehaus.jackson.map.Module", + "org.codehaus.jackson.map.util.Annotations", + "org.codehaus.jackson.map.type.TypeModifier", + "org.codehaus.jackson.sym.NameN", + "org.codehaus.jackson.JsonGenerator", + "org.codehaus.jackson.map.introspect.AnnotatedClass", + "org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector", + "org.codehaus.jackson.annotate.JsonAutoDetect$1", + "org.codehaus.jackson.map.JsonSerializable", + "org.codehaus.jackson.annotate.JsonMethod", + "com.att.eelf.i18n.EELFResolvableErrorEnum", + "org.codehaus.jackson.node.BaseJsonNode", + "org.openecomp.mso.logger.MsoLogger$StatusCode", + "org.codehaus.jackson.map.ObjectReader", + "org.codehaus.jackson.map.DeserializerProvider", + "org.codehaus.jackson.annotate.JsonAutoDetect$Visibility", + "org.codehaus.jackson.node.ValueNode", + "org.codehaus.jackson.map.ser.BeanSerializerFactory", + "org.codehaus.jackson.map.JsonSerializer", + "org.codehaus.jackson.map.introspect.AnnotatedWithParams", + "com.att.eelf.i18n.EELFMsgs", + "org.codehaus.jackson.map.AnnotationIntrospector", + "org.codehaus.jackson.map.MappingJsonFactory", + "com.att.eelf.configuration.EELFLogger$Level", + "org.codehaus.jackson.map.MapperConfig$Impl", + "org.codehaus.jackson.sym.Name1", + "org.codehaus.jackson.sym.Name2", + "org.codehaus.jackson.sym.Name3", + "org.codehaus.jackson.map.introspect.MethodFilter", + "org.codehaus.jackson.map.ser.StdSerializerProvider", + "org.codehaus.jackson.map.deser.StdDeserializationContext", + "org.codehaus.jackson.type.TypeReference", + "org.codehaus.jackson.map.ClassIntrospector", + "org.codehaus.jackson.map.AnnotationIntrospector$Pair", + "org.codehaus.jackson.map.PropertyNamingStrategy$LowerCaseWithUnderscoresStrategy", + "org.codehaus.jackson.map.MapperConfig$ConfigFeature", + "org.codehaus.jackson.map.SerializationConfig$Feature", + "org.codehaus.jackson.Versioned", + "org.codehaus.jackson.io.IOContext", + "org.openecomp.mso.adapters.catalogrest.QueryAllottedResourceCustomization", + "org.codehaus.jackson.map.type.TypeBase", + "org.codehaus.jackson.map.ser.BasicSerializerFactory", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "org.codehaus.jackson.map.PropertyNamingStrategy", + "org.codehaus.jackson.node.ContainerNode", + "org.codehaus.jackson.map.ser.FilterProvider", + "org.codehaus.jackson.map.jsontype.NamedType", + "org.codehaus.jackson.map.introspect.NopAnnotationIntrospector", + "com.att.eelf.configuration.EELFLogger", + "org.codehaus.jackson.map.DeserializationConfig", + "org.codehaus.jackson.map.introspect.AnnotatedConstructor", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer", + "org.codehaus.jackson.map.type.TypeFactory", + "org.codehaus.jackson.impl.ReaderBasedParser", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer$TableInfo", + "org.codehaus.jackson.JsonEncoding", + "org.codehaus.jackson.map.type.MapLikeType", + "org.codehaus.jackson.map.JsonDeserializer", + "org.codehaus.jackson.map.PropertyNamingStrategy$PropertyNamingStrategyBase", + "org.codehaus.jackson.node.ObjectNode", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "org.codehaus.jackson.map.ser.std.SerializerBase", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$MinimalMethodFilter", + "org.codehaus.jackson.map.type.CollectionLikeType", + "org.openecomp.mso.logger.MessageEnum", + "org.codehaus.jackson.map.DeserializationConfig$Feature", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer$Bucket", + "org.codehaus.jackson.map.introspect.AnnotatedMethodMap", + "org.codehaus.jackson.impl.JsonParserMinimalBase", + "org.codehaus.jackson.map.type.TypeParser", + "org.codehaus.jackson.map.introspect.POJOPropertiesCollector", + "org.codehaus.jackson.JsonParseException", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$SetterMethodFilter", + "org.codehaus.jackson.map.introspect.VisibilityChecker", + "org.codehaus.jackson.map.introspect.AnnotatedField", + "org.codehaus.jackson.impl.JsonGeneratorBase", + "org.codehaus.jackson.map.ObjectMapper", + "org.codehaus.jackson.util.ByteArrayBuilder", + "org.codehaus.jackson.map.ser.impl.FailingSerializer", + "org.codehaus.jackson.PrettyPrinter", + "org.codehaus.jackson.JsonToken", + "org.codehaus.jackson.map.jsontype.SubtypeResolver", + "org.codehaus.jackson.map.type.SimpleType", + "org.codehaus.jackson.map.util.StdDateFormat", + "org.codehaus.jackson.impl.Utf8Generator", + "org.codehaus.jackson.node.NumericNode", + "org.jboss.resteasy.annotations.providers.NoJackson", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$SetterAndGetterMethodFilter", + "org.codehaus.jackson.JsonNode", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer", + "org.codehaus.jackson.annotate.JacksonAnnotation", + "org.codehaus.jackson.map.ObjectWriter", + "org.codehaus.jackson.schema.SchemaAware", + "org.codehaus.jackson.io.OutputDecorator", + "com.att.eelf.configuration.SLF4jWrapper", + "org.codehaus.jackson.FormatSchema", + "org.codehaus.jackson.format.MatchStrength", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.codehaus.jackson.ObjectCodec", + "org.codehaus.jackson.map.introspect.AnnotatedMethod", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.codehaus.jackson.JsonGenerationException", + "org.openecomp.mso.entity.MsoRequest", + "org.codehaus.jackson.format.InputAccessor", + "org.codehaus.jackson.JsonFactory", + "org.codehaus.jackson.node.ArrayNode", + "org.codehaus.jackson.util.BufferRecycler", + "org.codehaus.jackson.io.SegmentedStringWriter", + "org.openecomp.mso.logger.MsoLogger$ResponseCode", + "org.codehaus.jackson.map.jsontype.TypeResolverBuilder", + "org.codehaus.jackson.map.type.HierarchicType", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$GetterMethodFilter", + "org.codehaus.jackson.JsonParser$Feature", + "org.codehaus.jackson.map.BeanDescription", + "org.codehaus.jackson.JsonParser$1", + "org.codehaus.jackson.impl.WriterBasedGenerator", + "org.codehaus.jackson.JsonGenerator$Feature", + "org.codehaus.jackson.sym.Name", + "org.codehaus.jackson.Version", + "org.codehaus.jackson.io.CharacterEscapes", + "org.codehaus.jackson.map.introspect.BasicBeanDescription", + "org.codehaus.jackson.schema.JsonSchema", + "org.codehaus.jackson.util.TokenBuffer", + "org.codehaus.jackson.map.MappingIterator", + "org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion", + "org.codehaus.jackson.map.DeserializationContext", + "org.codehaus.jackson.impl.JsonParserBase", + "org.codehaus.jackson.map.ObjectMapper$DefaultTyping", + "org.codehaus.jackson.map.JsonMappingException", + "org.codehaus.jackson.map.introspect.AnnotatedMember", + "org.codehaus.jackson.node.JsonNodeFactory", + "org.codehaus.jackson.type.JavaType", + "com.att.eelf.i18n.EELFResourceManager", + "org.codehaus.jackson.map.introspect.VisibilityChecker$Std", + "org.codehaus.jackson.annotate.JsonTypeInfo$As", + "org.codehaus.jackson.JsonParser", + "org.codehaus.jackson.node.NullNode", + "org.codehaus.jackson.map.InjectableValues", + "org.codehaus.jackson.map.jsontype.impl.StdSubtypeResolver", + "org.codehaus.jackson.node.TreeTraversingParser", + "org.codehaus.jackson.map.type.CollectionType", + "com.att.eelf.configuration.EELFManager", + "org.codehaus.jackson.map.MapperConfig", + "org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization", + "org.codehaus.jackson.map.Module$SetupContext", + "org.codehaus.jackson.io.UTF8Writer", + "org.codehaus.jackson.map.introspect.VisibilityChecker$1", + "org.codehaus.jackson.map.type.MapType", + "org.codehaus.jackson.annotate.JsonAutoDetect", + "org.codehaus.jackson.map.type.ArrayType", + "org.openecomp.mso.logger.MsoLogger", + "org.codehaus.jackson.map.ClassIntrospector$MixInResolver" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(QueryAllottedResourceCustomizationESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.openecomp.mso.logger.MsoLogger", + "com.att.eelf.i18n.EELFResourceManager", + "com.att.eelf.i18n.EELFMsgs", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "com.att.eelf.configuration.EELFLogger$Level", + "com.att.eelf.configuration.EELFManager", + "org.openecomp.mso.logger.MessageEnum", + "org.openecomp.mso.adapters.catalogrest.QueryAllottedResourceCustomization", + "org.codehaus.jackson.map.introspect.AnnotatedClass", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector", + "org.codehaus.jackson.annotate.JsonAutoDetect$Visibility", + "org.codehaus.jackson.annotate.JsonMethod", + "org.codehaus.jackson.map.introspect.VisibilityChecker$Std", + "org.codehaus.jackson.map.ObjectMapper", + "org.codehaus.jackson.JsonParser$Feature", + "org.codehaus.jackson.JsonGenerator$Feature", + "org.codehaus.jackson.JsonFactory", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer", + "org.codehaus.jackson.map.type.TypeFactory" + ); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceMacroHolderESTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceMacroHolderESTest.java new file mode 100644 index 0000000000..6f3fa5aec5 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceMacroHolderESTest.java @@ -0,0 +1,109 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Feb 20 14:12:21 GMT 2017 + */ + +package org.openecomp.mso.adapters.catalogrest; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; +import static org.evosuite.runtime.EvoAssertions.*; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.ViolatedAssumptionAnswer; +import org.junit.runner.RunWith; +import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class QueryServiceMacroHolderESTest extends QueryServiceMacroHolderESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = mock(ServiceMacroHolder.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(serviceMacroHolder0).toString(); + QueryServiceMacroHolder queryServiceMacroHolder0 = new QueryServiceMacroHolder(serviceMacroHolder0); + String string0 = queryServiceMacroHolder0.toString(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = mock(ServiceMacroHolder.class, new ViolatedAssumptionAnswer()); + doReturn("com.att.eelf.policy").when(serviceMacroHolder0).toString(); + QueryServiceMacroHolder queryServiceMacroHolder0 = new QueryServiceMacroHolder(serviceMacroHolder0); + String string0 = queryServiceMacroHolder0.toString(); + assertEquals("com.att.eelf.policy", string0); + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = mock(ServiceMacroHolder.class, new ViolatedAssumptionAnswer()); + doReturn("com.att.eelf.policy").when(serviceMacroHolder0).toString(); + QueryServiceMacroHolder queryServiceMacroHolder0 = new QueryServiceMacroHolder(serviceMacroHolder0); + ServiceMacroHolder serviceMacroHolder1 = queryServiceMacroHolder0.getServiceResources(); + assertSame(serviceMacroHolder1, serviceMacroHolder0); + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + QueryServiceMacroHolder queryServiceMacroHolder0 = new QueryServiceMacroHolder((ServiceMacroHolder) null); + // Undeclared exception! + try { + queryServiceMacroHolder0.toString(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceMacroHolder", e); + } + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = mock(ServiceMacroHolder.class, new ViolatedAssumptionAnswer()); + doReturn("").when(serviceMacroHolder0).toString(); + QueryServiceMacroHolder queryServiceMacroHolder0 = new QueryServiceMacroHolder(serviceMacroHolder0); + String string0 = queryServiceMacroHolder0.toString(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test5() throws Throwable { + QueryServiceMacroHolder queryServiceMacroHolder0 = new QueryServiceMacroHolder(); + } + + @Test(timeout = 4000) + public void test6() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = mock(ServiceMacroHolder.class, new ViolatedAssumptionAnswer()); + QueryServiceMacroHolder queryServiceMacroHolder0 = new QueryServiceMacroHolder(serviceMacroHolder0); + // Undeclared exception! + try { + queryServiceMacroHolder0.toJsonString(); + fail("Expecting exception: VerifyError"); + + } catch(VerifyError e) { + // + // (class: org/codehaus/jackson/map/MapperConfig, method: signature: ()V) Bad type in putfield/putstatic + // + verifyException("org.codehaus.jackson.map.ObjectMapper", e); + } + } + + @Test(timeout = 4000) + public void test7() throws Throwable { + QueryServiceMacroHolder queryServiceMacroHolder0 = new QueryServiceMacroHolder((ServiceMacroHolder) null); + ServiceMacroHolder serviceMacroHolder0 = queryServiceMacroHolder0.getServiceResources(); + assertNull(serviceMacroHolder0); + } + + @Test(timeout = 4000) + public void test8() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = mock(ServiceMacroHolder.class, new ViolatedAssumptionAnswer()); + QueryServiceMacroHolder queryServiceMacroHolder0 = new QueryServiceMacroHolder(serviceMacroHolder0); + ServiceMacroHolder serviceMacroHolder1 = mock(ServiceMacroHolder.class, new ViolatedAssumptionAnswer()); + queryServiceMacroHolder0.setServiceResources(serviceMacroHolder1); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceMacroHolderESTestscaffolding.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceMacroHolderESTestscaffolding.java new file mode 100644 index 0000000000..4a5898649b --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceMacroHolderESTestscaffolding.java @@ -0,0 +1,221 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Feb 20 14:12:21 GMT 2017 + */ + +package org.openecomp.mso.adapters.catalogrest; + +import org.evosuite.runtime.annotation.EvoSuiteClassExclude; +import org.junit.BeforeClass; +import org.junit.Before; +import org.junit.After; +import org.junit.AfterClass; +import org.evosuite.runtime.sandbox.Sandbox; + +@EvoSuiteClassExclude +public class QueryServiceMacroHolderESTestscaffolding { + + @org.junit.Rule + public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); + + private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + + private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); + + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.adapters.catalogrest.QueryServiceMacroHolder"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; + org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); + initializeClasses(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } + + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); + } + + @Before + public void initTestCase(){ + threadStopper.storeCurrentThreads(); + threadStopper.startRecordingTime(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } + + @After + public void doneWithTestCase(){ + threadStopper.killAndJoinClientThreads(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } + + private static void initializeClasses() { + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(QueryServiceMacroHolderESTestscaffolding.class.getClassLoader() , + "org.codehaus.jackson.map.JsonSerializableWithType", + "org.codehaus.jackson.map.deser.StdDeserializerProvider", + "org.codehaus.jackson.map.SerializerFactory", + "org.codehaus.jackson.map.SerializerProvider", + "org.codehaus.jackson.map.SerializationConfig", + "org.codehaus.jackson.JsonProcessingException", + "org.codehaus.jackson.map.introspect.AnnotationMap", + "org.codehaus.jackson.map.introspect.Annotated", + "org.codehaus.jackson.map.util.Annotations", + "org.codehaus.jackson.sym.NameN", + "org.codehaus.jackson.JsonGenerator", + "org.codehaus.jackson.map.introspect.AnnotatedClass", + "org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector", + "org.codehaus.jackson.map.JsonSerializable", + "org.codehaus.jackson.annotate.JsonMethod", + "com.att.eelf.i18n.EELFResolvableErrorEnum", + "org.codehaus.jackson.node.BaseJsonNode", + "org.openecomp.mso.logger.MsoLogger$StatusCode", + "org.codehaus.jackson.map.DeserializerProvider", + "org.codehaus.jackson.annotate.JsonAutoDetect$Visibility", + "org.codehaus.jackson.node.ValueNode", + "org.codehaus.jackson.map.ser.BeanSerializerFactory", + "org.codehaus.jackson.map.introspect.AnnotatedWithParams", + "com.att.eelf.i18n.EELFMsgs", + "org.codehaus.jackson.map.AnnotationIntrospector", + "org.codehaus.jackson.map.MappingJsonFactory", + "com.att.eelf.configuration.EELFLogger$Level", + "org.codehaus.jackson.map.MapperConfig$Impl", + "org.codehaus.jackson.sym.Name1", + "org.codehaus.jackson.sym.Name2", + "org.codehaus.jackson.sym.Name3", + "org.codehaus.jackson.map.introspect.MethodFilter", + "org.codehaus.jackson.map.ser.StdSerializerProvider", + "org.codehaus.jackson.map.deser.StdDeserializationContext", + "org.codehaus.jackson.map.ClassIntrospector", + "org.codehaus.jackson.map.AnnotationIntrospector$Pair", + "org.codehaus.jackson.Versioned", + "org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization", + "org.codehaus.jackson.map.type.TypeBase", + "org.codehaus.jackson.map.ser.BasicSerializerFactory", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "org.codehaus.jackson.node.ContainerNode", + "org.codehaus.jackson.map.introspect.NopAnnotationIntrospector", + "com.att.eelf.configuration.EELFLogger", + "org.codehaus.jackson.map.DeserializationConfig", + "org.codehaus.jackson.map.introspect.AnnotatedConstructor", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer", + "org.codehaus.jackson.map.type.TypeFactory", + "org.codehaus.jackson.impl.ReaderBasedParser", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer$TableInfo", + "org.codehaus.jackson.map.type.MapLikeType", + "org.openecomp.mso.db.catalog.beans.VnfResource", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "org.codehaus.jackson.node.ObjectNode", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$MinimalMethodFilter", + "org.codehaus.jackson.map.type.CollectionLikeType", + "org.openecomp.mso.logger.MessageEnum", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer$Bucket", + "org.codehaus.jackson.impl.JsonParserMinimalBase", + "org.openecomp.mso.db.catalog.beans.ServiceMacroHolder", + "org.codehaus.jackson.map.type.TypeParser", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$SetterMethodFilter", + "org.codehaus.jackson.map.introspect.VisibilityChecker", + "org.codehaus.jackson.map.introspect.AnnotatedField", + "org.codehaus.jackson.impl.JsonGeneratorBase", + "org.codehaus.jackson.map.ObjectMapper", + "org.codehaus.jackson.util.ByteArrayBuilder", + "org.codehaus.jackson.PrettyPrinter", + "org.codehaus.jackson.map.jsontype.SubtypeResolver", + "org.codehaus.jackson.map.type.SimpleType", + "org.codehaus.jackson.map.util.StdDateFormat", + "org.codehaus.jackson.impl.Utf8Generator", + "org.jboss.resteasy.annotations.providers.NoJackson", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$SetterAndGetterMethodFilter", + "org.codehaus.jackson.JsonNode", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer", + "org.codehaus.jackson.annotate.JacksonAnnotation", + "com.att.eelf.configuration.SLF4jWrapper", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.codehaus.jackson.ObjectCodec", + "org.codehaus.jackson.map.introspect.AnnotatedMethod", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.openecomp.mso.entity.MsoRequest", + "org.codehaus.jackson.JsonFactory", + "org.codehaus.jackson.node.ArrayNode", + "org.codehaus.jackson.io.SegmentedStringWriter", + "org.openecomp.mso.logger.MsoLogger$ResponseCode", + "org.codehaus.jackson.map.jsontype.TypeResolverBuilder", + "org.openecomp.mso.adapters.catalogrest.QueryServiceMacroHolder", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$GetterMethodFilter", + "org.codehaus.jackson.JsonParser$Feature", + "org.codehaus.jackson.map.BeanDescription", + "org.codehaus.jackson.impl.WriterBasedGenerator", + "org.codehaus.jackson.JsonGenerator$Feature", + "org.codehaus.jackson.sym.Name", + "org.openecomp.mso.db.catalog.beans.Service", + "org.codehaus.jackson.map.introspect.BasicBeanDescription", + "org.codehaus.jackson.util.TokenBuffer", + "org.codehaus.jackson.map.DeserializationContext", + "org.codehaus.jackson.impl.JsonParserBase", + "org.codehaus.jackson.map.JsonMappingException", + "org.codehaus.jackson.map.introspect.AnnotatedMember", + "org.codehaus.jackson.type.JavaType", + "com.att.eelf.i18n.EELFResourceManager", + "org.codehaus.jackson.map.introspect.VisibilityChecker$Std", + "org.codehaus.jackson.JsonParser", + "org.codehaus.jackson.node.NullNode", + "org.codehaus.jackson.map.jsontype.impl.StdSubtypeResolver", + "org.codehaus.jackson.node.TreeTraversingParser", + "org.codehaus.jackson.map.type.CollectionType", + "com.att.eelf.configuration.EELFManager", + "org.codehaus.jackson.map.MapperConfig", + "org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization", + "org.codehaus.jackson.map.Module$SetupContext", + "org.codehaus.jackson.io.UTF8Writer", + "org.codehaus.jackson.map.type.MapType", + "org.codehaus.jackson.annotate.JsonAutoDetect", + "org.codehaus.jackson.map.type.ArrayType", + "org.openecomp.mso.logger.MsoLogger", + "org.codehaus.jackson.map.ClassIntrospector$MixInResolver" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(QueryServiceMacroHolderESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.openecomp.mso.logger.MsoLogger", + "com.att.eelf.i18n.EELFResourceManager", + "com.att.eelf.i18n.EELFMsgs", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "com.att.eelf.configuration.EELFLogger$Level", + "com.att.eelf.configuration.EELFManager", + "org.openecomp.mso.logger.MessageEnum", + "org.openecomp.mso.adapters.catalogrest.QueryServiceMacroHolder", + "org.codehaus.jackson.map.introspect.AnnotatedClass", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector", + "org.codehaus.jackson.annotate.JsonAutoDetect$Visibility", + "org.codehaus.jackson.annotate.JsonMethod", + "org.codehaus.jackson.map.introspect.VisibilityChecker$Std", + "org.codehaus.jackson.map.ObjectMapper", + "org.codehaus.jackson.JsonParser$Feature", + "org.codehaus.jackson.JsonGenerator$Feature", + "org.codehaus.jackson.JsonFactory", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer", + "org.codehaus.jackson.map.type.TypeFactory" + ); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceNetworksESTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceNetworksESTest.java new file mode 100644 index 0000000000..0219fb52fa --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceNetworksESTest.java @@ -0,0 +1,163 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Feb 20 14:04:40 GMT 2017 + */ + +package org.openecomp.mso.adapters.catalogrest; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; +import static org.evosuite.runtime.EvoAssertions.*; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.ViolatedAssumptionAnswer; +import org.junit.runner.RunWith; +import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class QueryServiceNetworksESTest extends QueryServiceNetworksESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + QueryServiceNetworks queryServiceNetworks0 = new QueryServiceNetworks((List) linkedList0); + queryServiceNetworks0.setServiceNetworks((List) null); + List list0 = queryServiceNetworks0.getServiceNetworks(); + assertNull(list0); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + QueryServiceNetworks queryServiceNetworks0 = new QueryServiceNetworks(); + Object[] objectArray0 = new Object[3]; + objectArray0[0] = (Object) queryServiceNetworks0; + Collection collection0 = (Collection) mock(Collection.class, new ViolatedAssumptionAnswer()); + doReturn(objectArray0).when(collection0).toArray(); + linkedList0.addAll(collection0); + queryServiceNetworks0.setServiceNetworks(linkedList0); + // Undeclared exception! + try { + queryServiceNetworks0.toString(); + fail("Expecting exception: ClassCastException"); + + } catch(ClassCastException e) { + // + // org.openecomp.mso.adapters.catalogrest.QueryServiceNetworks cannot be cast to org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization + // + verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceNetworks", e); + } + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + QueryServiceNetworks queryServiceNetworks0 = null; + try { + queryServiceNetworks0 = new QueryServiceNetworks((List) null); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceNetworks", e); + } + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + NetworkResourceCustomization networkResourceCustomization0 = new NetworkResourceCustomization(); + linkedList0.add(networkResourceCustomization0); + Object[] objectArray0 = new Object[4]; + objectArray0[0] = (Object) linkedList0; + Collection collection0 = (Collection) mock(Collection.class, new ViolatedAssumptionAnswer()); + doReturn(objectArray0).when(collection0).toArray(); + linkedList0.addAll(1, collection0); + QueryServiceNetworks queryServiceNetworks0 = null; + try { + queryServiceNetworks0 = new QueryServiceNetworks((List) linkedList0); + fail("Expecting exception: ClassCastException"); + + } catch(ClassCastException e) { + // + // java.util.LinkedList cannot be cast to org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization + // + verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceNetworks", e); + } + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + QueryServiceNetworks queryServiceNetworks0 = new QueryServiceNetworks(); + queryServiceNetworks0.setServiceNetworks(linkedList0); + NetworkResourceCustomization networkResourceCustomization0 = new NetworkResourceCustomization(); + linkedList0.add(networkResourceCustomization0); + linkedList0.add(networkResourceCustomization0); + String string0 = queryServiceNetworks0.toString(); + assertEquals("1\tmodelName=nullmodelUuid=nullmodelUuid=nullmodelInvariantUuid=nullmodelVersion=nullmodelCustomizationUuid=nullmodelInstanceName=nullnetworkResourceId=0networkType=null1\t\nmodelName=nullmodelUuid=nullmodelUuid=nullmodelInvariantUuid=nullmodelVersion=nullmodelCustomizationUuid=nullmodelInstanceName=nullnetworkResourceId=0networkType=null", string0); + } + + @Test(timeout = 4000) + public void test5() throws Throwable { + QueryServiceNetworks queryServiceNetworks0 = new QueryServiceNetworks(); + String string0 = queryServiceNetworks0.toString(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test6() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + NetworkResourceCustomization networkResourceCustomization0 = new NetworkResourceCustomization(); + linkedList0.add(networkResourceCustomization0); + QueryServiceNetworks queryServiceNetworks0 = new QueryServiceNetworks((List) linkedList0); + List list0 = queryServiceNetworks0.getServiceNetworks(); + assertEquals(1, list0.size()); + } + + @Test(timeout = 4000) + public void test7() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + QueryServiceNetworks queryServiceNetworks0 = new QueryServiceNetworks((List) linkedList0); + queryServiceNetworks0.setServiceNetworks((List) null); + // Undeclared exception! + try { + queryServiceNetworks0.toString(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceNetworks", e); + } + } + + @Test(timeout = 4000) + public void test8() throws Throwable { + QueryServiceNetworks queryServiceNetworks0 = new QueryServiceNetworks(); + List list0 = queryServiceNetworks0.getServiceNetworks(); + assertTrue(list0.isEmpty()); + } + + @Test(timeout = 4000) + public void test9() throws Throwable { + QueryServiceNetworks queryServiceNetworks0 = new QueryServiceNetworks(); + // Undeclared exception! + try { + queryServiceNetworks0.toJsonString(); + fail("Expecting exception: VerifyError"); + + } catch(VerifyError e) { + // + // (class: org/codehaus/jackson/map/MapperConfig, method: signature: ()V) Bad type in putfield/putstatic + // + verifyException("org.codehaus.jackson.map.ObjectMapper", e); + } + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceNetworksESTestscaffolding.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceNetworksESTestscaffolding.java new file mode 100644 index 0000000000..e47d9b2a5b --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceNetworksESTestscaffolding.java @@ -0,0 +1,265 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Feb 20 14:04:40 GMT 2017 + */ + +package org.openecomp.mso.adapters.catalogrest; + +import org.evosuite.runtime.annotation.EvoSuiteClassExclude; +import org.junit.BeforeClass; +import org.junit.Before; +import org.junit.After; +import org.junit.AfterClass; +import org.evosuite.runtime.sandbox.Sandbox; + +@EvoSuiteClassExclude +public class QueryServiceNetworksESTestscaffolding { + + @org.junit.Rule + public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); + + private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + + private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); + + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.adapters.catalogrest.QueryServiceNetworks"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; + org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); + initializeClasses(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } + + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); + } + + @Before + public void initTestCase(){ + threadStopper.storeCurrentThreads(); + threadStopper.startRecordingTime(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } + + @After + public void doneWithTestCase(){ + threadStopper.killAndJoinClientThreads(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } + + private static void initializeClasses() { + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(QueryServiceNetworksESTestscaffolding.class.getClassLoader() , + "org.codehaus.jackson.map.JsonSerializableWithType", + "org.codehaus.jackson.map.HandlerInstantiator", + "org.codehaus.jackson.map.deser.StdDeserializerProvider", + "org.codehaus.jackson.map.SerializerFactory", + "org.codehaus.jackson.map.SerializerProvider", + "org.codehaus.jackson.map.type.TypeBindings", + "org.codehaus.jackson.map.SerializationConfig", + "org.codehaus.jackson.JsonProcessingException", + "org.codehaus.jackson.map.introspect.AnnotationMap", + "org.codehaus.jackson.map.introspect.Annotated", + "org.codehaus.jackson.io.InputDecorator", + "org.codehaus.jackson.map.Module", + "org.codehaus.jackson.map.util.Annotations", + "org.codehaus.jackson.map.type.TypeModifier", + "org.codehaus.jackson.sym.NameN", + "org.codehaus.jackson.JsonGenerator", + "org.codehaus.jackson.map.introspect.AnnotatedClass", + "org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector", + "org.codehaus.jackson.annotate.JsonAutoDetect$1", + "org.codehaus.jackson.map.JsonSerializable", + "org.codehaus.jackson.annotate.JsonMethod", + "com.att.eelf.i18n.EELFResolvableErrorEnum", + "org.codehaus.jackson.node.BaseJsonNode", + "org.openecomp.mso.logger.MsoLogger$StatusCode", + "org.codehaus.jackson.map.ObjectReader", + "org.codehaus.jackson.map.DeserializerProvider", + "org.codehaus.jackson.annotate.JsonAutoDetect$Visibility", + "org.codehaus.jackson.node.ValueNode", + "org.codehaus.jackson.map.ser.BeanSerializerFactory", + "org.codehaus.jackson.map.JsonSerializer", + "org.codehaus.jackson.map.introspect.AnnotatedWithParams", + "com.att.eelf.i18n.EELFMsgs", + "org.codehaus.jackson.map.AnnotationIntrospector", + "org.codehaus.jackson.map.MappingJsonFactory", + "com.att.eelf.configuration.EELFLogger$Level", + "org.codehaus.jackson.map.MapperConfig$Impl", + "org.codehaus.jackson.sym.Name1", + "org.codehaus.jackson.sym.Name2", + "org.codehaus.jackson.sym.Name3", + "org.codehaus.jackson.map.introspect.MethodFilter", + "org.codehaus.jackson.map.ser.StdSerializerProvider", + "org.codehaus.jackson.map.deser.StdDeserializationContext", + "org.codehaus.jackson.type.TypeReference", + "org.codehaus.jackson.map.ClassIntrospector", + "org.codehaus.jackson.map.AnnotationIntrospector$Pair", + "org.codehaus.jackson.map.PropertyNamingStrategy$LowerCaseWithUnderscoresStrategy", + "org.codehaus.jackson.map.MapperConfig$ConfigFeature", + "org.codehaus.jackson.map.SerializationConfig$Feature", + "org.codehaus.jackson.Versioned", + "org.codehaus.jackson.io.IOContext", + "org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization", + "org.codehaus.jackson.map.type.TypeBase", + "org.codehaus.jackson.map.ser.BasicSerializerFactory", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "org.codehaus.jackson.map.PropertyNamingStrategy", + "org.codehaus.jackson.node.ContainerNode", + "org.codehaus.jackson.map.jsontype.NamedType", + "org.codehaus.jackson.map.ser.FilterProvider", + "org.codehaus.jackson.map.introspect.NopAnnotationIntrospector", + "com.att.eelf.configuration.EELFLogger", + "org.codehaus.jackson.map.DeserializationConfig", + "org.codehaus.jackson.map.introspect.AnnotatedConstructor", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer", + "org.codehaus.jackson.map.type.TypeFactory", + "org.codehaus.jackson.impl.ReaderBasedParser", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer$TableInfo", + "org.codehaus.jackson.JsonEncoding", + "org.codehaus.jackson.map.type.MapLikeType", + "org.codehaus.jackson.map.JsonDeserializer", + "org.codehaus.jackson.map.PropertyNamingStrategy$PropertyNamingStrategyBase", + "org.codehaus.jackson.node.ObjectNode", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "org.codehaus.jackson.map.ser.std.SerializerBase", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$MinimalMethodFilter", + "org.codehaus.jackson.map.type.CollectionLikeType", + "org.openecomp.mso.logger.MessageEnum", + "org.codehaus.jackson.map.DeserializationConfig$Feature", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer$Bucket", + "org.codehaus.jackson.map.introspect.AnnotatedMethodMap", + "org.codehaus.jackson.impl.JsonParserMinimalBase", + "org.codehaus.jackson.map.type.TypeParser", + "org.codehaus.jackson.map.introspect.POJOPropertiesCollector", + "org.codehaus.jackson.JsonParseException", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$SetterMethodFilter", + "org.codehaus.jackson.map.introspect.VisibilityChecker", + "org.codehaus.jackson.map.introspect.AnnotatedField", + "org.codehaus.jackson.impl.JsonGeneratorBase", + "org.codehaus.jackson.map.ObjectMapper", + "org.codehaus.jackson.util.ByteArrayBuilder", + "org.codehaus.jackson.map.ser.impl.FailingSerializer", + "org.codehaus.jackson.PrettyPrinter", + "org.codehaus.jackson.JsonToken", + "org.codehaus.jackson.map.jsontype.SubtypeResolver", + "org.codehaus.jackson.map.type.SimpleType", + "org.codehaus.jackson.map.util.StdDateFormat", + "org.codehaus.jackson.impl.Utf8Generator", + "org.codehaus.jackson.node.NumericNode", + "org.jboss.resteasy.annotations.providers.NoJackson", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$SetterAndGetterMethodFilter", + "org.codehaus.jackson.JsonNode", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer", + "org.codehaus.jackson.annotate.JacksonAnnotation", + "org.codehaus.jackson.map.ObjectWriter", + "org.codehaus.jackson.schema.SchemaAware", + "org.codehaus.jackson.io.OutputDecorator", + "com.att.eelf.configuration.SLF4jWrapper", + "org.codehaus.jackson.FormatSchema", + "org.codehaus.jackson.format.MatchStrength", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.codehaus.jackson.ObjectCodec", + "org.codehaus.jackson.map.introspect.AnnotatedMethod", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.codehaus.jackson.JsonGenerationException", + "org.openecomp.mso.entity.MsoRequest", + "org.codehaus.jackson.format.InputAccessor", + "org.codehaus.jackson.JsonFactory", + "org.codehaus.jackson.node.ArrayNode", + "org.codehaus.jackson.util.BufferRecycler", + "org.codehaus.jackson.io.SegmentedStringWriter", + "org.openecomp.mso.logger.MsoLogger$ResponseCode", + "org.codehaus.jackson.map.jsontype.TypeResolverBuilder", + "org.codehaus.jackson.map.type.HierarchicType", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$GetterMethodFilter", + "org.codehaus.jackson.JsonParser$Feature", + "org.codehaus.jackson.map.BeanDescription", + "org.codehaus.jackson.JsonParser$1", + "org.codehaus.jackson.impl.WriterBasedGenerator", + "org.codehaus.jackson.JsonGenerator$Feature", + "org.codehaus.jackson.sym.Name", + "org.codehaus.jackson.Version", + "org.codehaus.jackson.io.CharacterEscapes", + "org.codehaus.jackson.map.introspect.BasicBeanDescription", + "org.codehaus.jackson.schema.JsonSchema", + "org.codehaus.jackson.util.TokenBuffer", + "org.codehaus.jackson.map.MappingIterator", + "org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion", + "org.codehaus.jackson.map.DeserializationContext", + "org.codehaus.jackson.impl.JsonParserBase", + "org.codehaus.jackson.map.ObjectMapper$DefaultTyping", + "org.codehaus.jackson.map.JsonMappingException", + "org.codehaus.jackson.map.introspect.AnnotatedMember", + "org.codehaus.jackson.node.JsonNodeFactory", + "org.codehaus.jackson.type.JavaType", + "com.att.eelf.i18n.EELFResourceManager", + "org.codehaus.jackson.map.introspect.VisibilityChecker$Std", + "org.codehaus.jackson.annotate.JsonTypeInfo$As", + "org.codehaus.jackson.JsonParser", + "org.codehaus.jackson.node.NullNode", + "org.codehaus.jackson.map.InjectableValues", + "org.codehaus.jackson.map.jsontype.impl.StdSubtypeResolver", + "org.codehaus.jackson.node.TreeTraversingParser", + "org.codehaus.jackson.map.type.CollectionType", + "com.att.eelf.configuration.EELFManager", + "org.codehaus.jackson.map.MapperConfig", + "org.codehaus.jackson.map.Module$SetupContext", + "org.openecomp.mso.adapters.catalogrest.QueryServiceNetworks", + "org.codehaus.jackson.io.UTF8Writer", + "org.openecomp.mso.db.catalog.beans.NetworkResource", + "org.codehaus.jackson.map.introspect.VisibilityChecker$1", + "org.codehaus.jackson.map.type.MapType", + "org.codehaus.jackson.annotate.JsonAutoDetect", + "org.codehaus.jackson.map.type.ArrayType", + "org.openecomp.mso.logger.MsoLogger", + "org.codehaus.jackson.map.ClassIntrospector$MixInResolver" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(QueryServiceNetworksESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.openecomp.mso.logger.MsoLogger", + "com.att.eelf.i18n.EELFResourceManager", + "com.att.eelf.i18n.EELFMsgs", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "com.att.eelf.configuration.EELFLogger$Level", + "com.att.eelf.configuration.EELFManager", + "org.openecomp.mso.logger.MessageEnum", + "org.openecomp.mso.adapters.catalogrest.QueryServiceNetworks", + "org.codehaus.jackson.map.introspect.AnnotatedClass", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector", + "org.codehaus.jackson.annotate.JsonAutoDetect$Visibility", + "org.codehaus.jackson.annotate.JsonMethod", + "org.codehaus.jackson.map.introspect.VisibilityChecker$Std", + "org.codehaus.jackson.map.ObjectMapper", + "org.codehaus.jackson.JsonParser$Feature", + "org.codehaus.jackson.JsonGenerator$Feature", + "org.codehaus.jackson.JsonFactory", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer", + "org.codehaus.jackson.map.type.TypeFactory" + ); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfsESTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfsESTest.java new file mode 100644 index 0000000000..4f963032d0 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfsESTest.java @@ -0,0 +1,188 @@ +/* + * This file was automatically generated by EvoSuite + * Wed Feb 22 12:31:50 GMT 2017 + */ + +package org.openecomp.mso.adapters.catalogrest; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; +import static org.evosuite.runtime.MockitoExtension.*; +import static org.evosuite.runtime.EvoAssertions.*; +import java.util.Collection; +import java.util.ConcurrentModificationException; +import java.util.LinkedList; +import java.util.List; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.ViolatedAssumptionAnswer; +import org.junit.runner.RunWith; +import org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs; +import org.openecomp.mso.db.catalog.beans.VnfResource; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class QueryServiceVnfsESTest extends QueryServiceVnfsESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs(); + queryServiceVnfs0.setServiceVnfs((List) null); + List list0 = queryServiceVnfs0.getServiceVnfs(); + assertNull(list0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + VnfResource vnfResource0 = new VnfResource(); + linkedList0.add(vnfResource0); + List list0 = linkedList0.subList(1, 1); + linkedList0.add(vnfResource0); + QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs(); + queryServiceVnfs0.setServiceVnfs(list0); + // Undeclared exception! + try { + queryServiceVnfs0.toString(); + fail("Expecting exception: ConcurrentModificationException"); + + } catch(ConcurrentModificationException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("java.util.SubList", e); + } + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs(); + queryServiceVnfs0.setServiceVnfs((List) null); + // Undeclared exception! + try { + queryServiceVnfs0.toString(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs", e); + } + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs(); + Object[] objectArray0 = new Object[3]; + objectArray0[1] = (Object) queryServiceVnfs0; + queryServiceVnfs0.setServiceVnfs(linkedList0); + Collection collection0 = (Collection) mock(Collection.class, new ViolatedAssumptionAnswer()); + doReturn(objectArray0).when(collection0).toArray(); + linkedList0.addAll(collection0); + // Undeclared exception! + try { + queryServiceVnfs0.toString(); + fail("Expecting exception: ClassCastException"); + + } catch(ClassCastException e) { + // + // org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs cannot be cast to org.openecomp.mso.db.catalog.beans.VnfResource + // + verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs", e); + } + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + linkedList0.add((VnfResource) null); + QueryServiceVnfs queryServiceVnfs0 = null; + try { + queryServiceVnfs0 = new QueryServiceVnfs((List) linkedList0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs", e); + } + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs(); + Object[] objectArray0 = new Object[8]; + objectArray0[0] = (Object) queryServiceVnfs0; + Collection collection0 = (Collection) mock(Collection.class, new ViolatedAssumptionAnswer()); + doReturn(objectArray0).when(collection0).toArray(); + linkedList0.addAll(0, collection0); + QueryServiceVnfs queryServiceVnfs1 = null; + try { + queryServiceVnfs1 = new QueryServiceVnfs((List) linkedList0); + fail("Expecting exception: ClassCastException"); + + } catch(ClassCastException e) { + // + // org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs cannot be cast to org.openecomp.mso.db.catalog.beans.VnfResource + // + verifyException("org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs", e); + } + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + VnfResource vnfResource0 = new VnfResource(); + linkedList0.add(vnfResource0); + QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs(); + queryServiceVnfs0.setServiceVnfs(linkedList0); + linkedList0.add(vnfResource0); + String string0 = queryServiceVnfs0.toString(); + assertEquals("1\tVNF=null,version=null,mode=null,template=null,envtId=null,asdcUuid=null,aicVersionMin=null,aicVersionMax=null,modelInvariantUuid=null,modelVersion=null,modelCustomizationName=null,modelName=null,serviceModelInvariantUUID=null,modelCustomizationUuid=nullVfModules: NONE1\t\nVNF=null,version=null,mode=null,template=null,envtId=null,asdcUuid=null,aicVersionMin=null,aicVersionMax=null,modelInvariantUuid=null,modelVersion=null,modelCustomizationName=null,modelName=null,serviceModelInvariantUUID=null,modelCustomizationUuid=nullVfModules: NONE", string0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs(); + String string0 = queryServiceVnfs0.toString(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + VnfResource vnfResource0 = new VnfResource(); + linkedList0.add(vnfResource0); + QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs((List) linkedList0); + List list0 = queryServiceVnfs0.getServiceVnfs(); + assertEquals(1, list0.size()); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs(); + List list0 = queryServiceVnfs0.getServiceVnfs(); + queryServiceVnfs0.setServiceVnfs(list0); + assertTrue(list0.isEmpty()); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + QueryServiceVnfs queryServiceVnfs0 = new QueryServiceVnfs(); + // Undeclared exception! + try { + queryServiceVnfs0.toJsonString(); + fail("Expecting exception: VerifyError"); + + } catch(VerifyError e) { + // + // (class: org/codehaus/jackson/map/MapperConfig, method: signature: ()V) Bad type in putfield/putstatic + // + verifyException("org.codehaus.jackson.map.ObjectMapper", e); + } + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfsESTestscaffolding.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfsESTestscaffolding.java new file mode 100644 index 0000000000..aa9a411de2 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/catalogrest/QueryServiceVnfsESTestscaffolding.java @@ -0,0 +1,264 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Feb 20 14:04:40 GMT 2017 + */ + +package org.openecomp.mso.adapters.catalogrest; + +import org.evosuite.runtime.annotation.EvoSuiteClassExclude; +import org.junit.BeforeClass; +import org.junit.Before; +import org.junit.After; +import org.junit.AfterClass; +import org.evosuite.runtime.sandbox.Sandbox; + +@EvoSuiteClassExclude +public class QueryServiceVnfsESTestscaffolding { + + @org.junit.Rule + public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); + + private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + + private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); + + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; + org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); + initializeClasses(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } + + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); + } + + @Before + public void initTestCase(){ + threadStopper.storeCurrentThreads(); + threadStopper.startRecordingTime(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } + + @After + public void doneWithTestCase(){ + threadStopper.killAndJoinClientThreads(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } + + private static void initializeClasses() { + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(QueryServiceVnfsESTestscaffolding.class.getClassLoader() , + "org.codehaus.jackson.map.JsonSerializableWithType", + "org.codehaus.jackson.map.HandlerInstantiator", + "org.codehaus.jackson.map.deser.StdDeserializerProvider", + "org.codehaus.jackson.map.SerializerFactory", + "org.codehaus.jackson.map.SerializerProvider", + "org.codehaus.jackson.map.type.TypeBindings", + "org.codehaus.jackson.map.SerializationConfig", + "org.codehaus.jackson.JsonProcessingException", + "org.codehaus.jackson.map.introspect.AnnotationMap", + "org.codehaus.jackson.map.introspect.Annotated", + "org.codehaus.jackson.io.InputDecorator", + "org.codehaus.jackson.map.Module", + "org.codehaus.jackson.map.util.Annotations", + "org.codehaus.jackson.map.type.TypeModifier", + "org.codehaus.jackson.sym.NameN", + "org.codehaus.jackson.JsonGenerator", + "org.codehaus.jackson.map.introspect.AnnotatedClass", + "org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector", + "org.codehaus.jackson.annotate.JsonAutoDetect$1", + "org.codehaus.jackson.map.JsonSerializable", + "org.codehaus.jackson.annotate.JsonMethod", + "com.att.eelf.i18n.EELFResolvableErrorEnum", + "org.codehaus.jackson.node.BaseJsonNode", + "org.openecomp.mso.logger.MsoLogger$StatusCode", + "org.codehaus.jackson.map.ObjectReader", + "org.codehaus.jackson.map.DeserializerProvider", + "org.codehaus.jackson.annotate.JsonAutoDetect$Visibility", + "org.codehaus.jackson.node.ValueNode", + "org.codehaus.jackson.map.ser.BeanSerializerFactory", + "org.codehaus.jackson.map.JsonSerializer", + "org.codehaus.jackson.map.introspect.AnnotatedWithParams", + "com.att.eelf.i18n.EELFMsgs", + "org.codehaus.jackson.map.AnnotationIntrospector", + "org.codehaus.jackson.map.MappingJsonFactory", + "com.att.eelf.configuration.EELFLogger$Level", + "org.codehaus.jackson.map.MapperConfig$Impl", + "org.codehaus.jackson.sym.Name1", + "org.codehaus.jackson.sym.Name2", + "org.codehaus.jackson.sym.Name3", + "org.codehaus.jackson.map.introspect.MethodFilter", + "org.codehaus.jackson.map.ser.StdSerializerProvider", + "org.codehaus.jackson.map.deser.StdDeserializationContext", + "org.codehaus.jackson.type.TypeReference", + "org.codehaus.jackson.map.ClassIntrospector", + "org.codehaus.jackson.map.AnnotationIntrospector$Pair", + "org.codehaus.jackson.map.PropertyNamingStrategy$LowerCaseWithUnderscoresStrategy", + "org.codehaus.jackson.map.MapperConfig$ConfigFeature", + "org.codehaus.jackson.map.SerializationConfig$Feature", + "org.codehaus.jackson.Versioned", + "org.codehaus.jackson.io.IOContext", + "org.codehaus.jackson.map.type.TypeBase", + "org.codehaus.jackson.map.ser.BasicSerializerFactory", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "org.codehaus.jackson.map.PropertyNamingStrategy", + "org.codehaus.jackson.node.ContainerNode", + "org.codehaus.jackson.map.jsontype.NamedType", + "org.codehaus.jackson.map.ser.FilterProvider", + "org.codehaus.jackson.map.introspect.NopAnnotationIntrospector", + "com.att.eelf.configuration.EELFLogger", + "org.codehaus.jackson.map.DeserializationConfig", + "org.codehaus.jackson.map.introspect.AnnotatedConstructor", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer", + "org.codehaus.jackson.map.type.TypeFactory", + "org.codehaus.jackson.impl.ReaderBasedParser", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer$TableInfo", + "org.codehaus.jackson.JsonEncoding", + "org.codehaus.jackson.map.type.MapLikeType", + "org.codehaus.jackson.map.JsonDeserializer", + "org.openecomp.mso.db.catalog.beans.VnfResource", + "org.codehaus.jackson.map.PropertyNamingStrategy$PropertyNamingStrategyBase", + "org.codehaus.jackson.node.ObjectNode", + "org.openecomp.mso.logger.MsoLogger$ErrorCode", + "org.codehaus.jackson.map.ser.std.SerializerBase", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$MinimalMethodFilter", + "org.codehaus.jackson.map.type.CollectionLikeType", + "org.openecomp.mso.logger.MessageEnum", + "org.codehaus.jackson.map.DeserializationConfig$Feature", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer$Bucket", + "org.codehaus.jackson.map.introspect.AnnotatedMethodMap", + "org.codehaus.jackson.impl.JsonParserMinimalBase", + "org.codehaus.jackson.map.type.TypeParser", + "org.codehaus.jackson.map.introspect.POJOPropertiesCollector", + "org.codehaus.jackson.JsonParseException", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$SetterMethodFilter", + "org.codehaus.jackson.map.introspect.VisibilityChecker", + "org.codehaus.jackson.map.introspect.AnnotatedField", + "org.codehaus.jackson.impl.JsonGeneratorBase", + "org.codehaus.jackson.map.ObjectMapper", + "org.codehaus.jackson.util.ByteArrayBuilder", + "org.codehaus.jackson.map.ser.impl.FailingSerializer", + "org.codehaus.jackson.PrettyPrinter", + "org.codehaus.jackson.JsonToken", + "org.codehaus.jackson.map.jsontype.SubtypeResolver", + "org.codehaus.jackson.map.type.SimpleType", + "org.codehaus.jackson.map.util.StdDateFormat", + "org.codehaus.jackson.impl.Utf8Generator", + "org.codehaus.jackson.node.NumericNode", + "org.jboss.resteasy.annotations.providers.NoJackson", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$SetterAndGetterMethodFilter", + "org.codehaus.jackson.JsonNode", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer", + "org.codehaus.jackson.annotate.JacksonAnnotation", + "org.codehaus.jackson.map.ObjectWriter", + "org.codehaus.jackson.schema.SchemaAware", + "org.codehaus.jackson.io.OutputDecorator", + "com.att.eelf.configuration.SLF4jWrapper", + "org.codehaus.jackson.FormatSchema", + "org.codehaus.jackson.format.MatchStrength", + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.codehaus.jackson.ObjectCodec", + "org.codehaus.jackson.map.introspect.AnnotatedMethod", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.codehaus.jackson.JsonGenerationException", + "org.openecomp.mso.entity.MsoRequest", + "org.codehaus.jackson.format.InputAccessor", + "org.codehaus.jackson.JsonFactory", + "org.codehaus.jackson.node.ArrayNode", + "org.codehaus.jackson.util.BufferRecycler", + "org.codehaus.jackson.io.SegmentedStringWriter", + "org.openecomp.mso.logger.MsoLogger$ResponseCode", + "org.codehaus.jackson.map.jsontype.TypeResolverBuilder", + "org.codehaus.jackson.map.type.HierarchicType", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$GetterMethodFilter", + "org.codehaus.jackson.JsonParser$Feature", + "org.codehaus.jackson.map.BeanDescription", + "org.codehaus.jackson.JsonParser$1", + "org.codehaus.jackson.impl.WriterBasedGenerator", + "org.codehaus.jackson.JsonGenerator$Feature", + "org.codehaus.jackson.sym.Name", + "org.codehaus.jackson.Version", + "org.codehaus.jackson.io.CharacterEscapes", + "org.codehaus.jackson.map.introspect.BasicBeanDescription", + "org.codehaus.jackson.schema.JsonSchema", + "org.codehaus.jackson.util.TokenBuffer", + "org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion", + "org.codehaus.jackson.map.MappingIterator", + "org.codehaus.jackson.map.DeserializationContext", + "org.codehaus.jackson.impl.JsonParserBase", + "org.codehaus.jackson.map.ObjectMapper$DefaultTyping", + "org.codehaus.jackson.map.JsonMappingException", + "org.codehaus.jackson.map.introspect.AnnotatedMember", + "org.codehaus.jackson.node.JsonNodeFactory", + "org.codehaus.jackson.type.JavaType", + "com.att.eelf.i18n.EELFResourceManager", + "org.codehaus.jackson.map.introspect.VisibilityChecker$Std", + "org.codehaus.jackson.annotate.JsonTypeInfo$As", + "org.codehaus.jackson.JsonParser", + "org.codehaus.jackson.node.NullNode", + "org.codehaus.jackson.map.InjectableValues", + "org.codehaus.jackson.map.jsontype.impl.StdSubtypeResolver", + "org.codehaus.jackson.node.TreeTraversingParser", + "org.codehaus.jackson.map.type.CollectionType", + "com.att.eelf.configuration.EELFManager", + "org.codehaus.jackson.map.MapperConfig", + "org.codehaus.jackson.map.Module$SetupContext", + "org.codehaus.jackson.io.UTF8Writer", + "org.codehaus.jackson.map.introspect.VisibilityChecker$1", + "org.codehaus.jackson.map.type.MapType", + "org.codehaus.jackson.annotate.JsonAutoDetect", + "org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs", + "org.codehaus.jackson.map.type.ArrayType", + "org.openecomp.mso.logger.MsoLogger", + "org.codehaus.jackson.map.ClassIntrospector$MixInResolver" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(QueryServiceVnfsESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.logger.MsoLogger$Catalog", + "org.openecomp.mso.logger.MsoLogger", + "com.att.eelf.i18n.EELFResourceManager", + "com.att.eelf.i18n.EELFMsgs", + "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "com.att.eelf.configuration.EELFLogger$Level", + "com.att.eelf.configuration.EELFManager", + "org.openecomp.mso.logger.MessageEnum", + "org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs", + "org.codehaus.jackson.map.introspect.AnnotatedClass", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector", + "org.codehaus.jackson.annotate.JsonAutoDetect$Visibility", + "org.codehaus.jackson.annotate.JsonMethod", + "org.codehaus.jackson.map.introspect.VisibilityChecker$Std", + "org.codehaus.jackson.map.ObjectMapper", + "org.codehaus.jackson.JsonParser$Feature", + "org.codehaus.jackson.JsonGenerator$Feature", + "org.codehaus.jackson.JsonFactory", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer", + "org.codehaus.jackson.map.type.TypeFactory" + ); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/RequestInformationESTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/RequestInformationESTest.java new file mode 100644 index 0000000000..293a91e4f3 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/RequestInformationESTest.java @@ -0,0 +1,108 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Feb 20 14:10:13 GMT 2017 + */ + +package org.openecomp.mso.adapters.sdncrest; + +import org.junit.Test; +import static org.junit.Assert.*; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class RequestInformationESTest extends RequestInformationESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + RequestInformation requestInformation0 = new RequestInformation(); + String string0 = requestInformation0.getSource(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + RequestInformation requestInformation0 = new RequestInformation("", "", ""); + String string0 = requestInformation0.getSource(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + RequestInformation requestInformation0 = new RequestInformation(); + String string0 = requestInformation0.getRequestId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + RequestInformation requestInformation0 = new RequestInformation("82W?GC", "", "82W?GC"); + String string0 = requestInformation0.getNotificationUrl(); + assertEquals("82W?GC", string0); + assertEquals("82W?GC", requestInformation0.getRequestId()); + assertEquals("", requestInformation0.getSource()); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + RequestInformation requestInformation0 = new RequestInformation("", "3*5=IrA", ""); + String string0 = requestInformation0.getSource(); + assertEquals("3*5=IrA", string0); + assertEquals("", requestInformation0.getNotificationUrl()); + assertEquals("", requestInformation0.getRequestId()); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + RequestInformation requestInformation0 = new RequestInformation("", "3*5=IrA", ""); + assertEquals("", requestInformation0.getRequestId()); + + requestInformation0.setRequestId("3*5=IrA"); + requestInformation0.getRequestId(); + assertEquals("3*5=IrA", requestInformation0.getSource()); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + RequestInformation requestInformation0 = new RequestInformation(); + String string0 = requestInformation0.getNotificationUrl(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + RequestInformation requestInformation0 = new RequestInformation("", "3*5=IrA", ""); + assertEquals("", requestInformation0.getNotificationUrl()); + + requestInformation0.setNotificationUrl("3*5=IrA"); + assertEquals("3*5=IrA", requestInformation0.getSource()); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + RequestInformation requestInformation0 = new RequestInformation("", "3*5=IrA", ""); + String string0 = requestInformation0.getNotificationUrl(); + assertEquals("", string0); + assertEquals("", requestInformation0.getRequestId()); + assertEquals("3*5=IrA", requestInformation0.getSource()); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + RequestInformation requestInformation0 = new RequestInformation("", "3*5=IrA", ""); + String string0 = requestInformation0.getRequestId(); + assertEquals("", string0); + assertEquals("", requestInformation0.getNotificationUrl()); + assertEquals("3*5=IrA", requestInformation0.getSource()); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + RequestInformation requestInformation0 = new RequestInformation("", "3*5=IrA", ""); + assertEquals("3*5=IrA", requestInformation0.getSource()); + + requestInformation0.setSource(""); + assertEquals("", requestInformation0.getNotificationUrl()); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTestscaffolding.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/RequestInformationESTestscaffolding.java similarity index 55% rename from bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTestscaffolding.java rename to adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/RequestInformationESTestscaffolding.java index 7dc6ca1e4e..a2d81096c4 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTestscaffolding.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/RequestInformationESTestscaffolding.java @@ -1,10 +1,10 @@ /** - * Scaffolding file used to store all the setups needed to run + * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite - * Mon Nov 14 11:33:44 GMT 2016 + * Mon Feb 20 14:10:13 GMT 2017 */ -package org.openecomp.mso.bpmn.core; +package org.openecomp.mso.adapters.sdncrest; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; @@ -14,70 +14,68 @@ import org.junit.AfterClass; import org.evosuite.runtime.sandbox.Sandbox; @EvoSuiteClassExclude -public class RollbackDataESTestscaffolding { +public class RequestInformationESTestscaffolding { - @org.junit.Rule + @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.bpmn.core.RollbackData"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.adapters.sdncrest.RequestInformation"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; + org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); + } - @Before - public void initTestCase(){ + @Before + public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } - @After - public void doneWithTestCase(){ + @After + public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } - + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(RollbackDataESTestscaffolding.class.getClassLoader() , - "org.openecomp.mso.bpmn.core.RollbackData" + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(RequestInformationESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.adapters.sdncrest.RequestInformation" ); - } + } private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(RollbackDataESTestscaffolding.class.getClassLoader()); + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(RequestInformationESTestscaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "org.openecomp.mso.bpmn.core.RollbackData" + "org.openecomp.mso.adapters.sdncrest.RequestInformation" ); } } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommonESTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommonESTest.java new file mode 100644 index 0000000000..047735f8d9 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommonESTest.java @@ -0,0 +1,28 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Feb 20 14:06:32 GMT 2017 + */ + +package org.openecomp.mso.adapters.sdncrest; + +import org.junit.Test; +import static org.junit.Assert.*; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class SDNCErrorCommonESTest extends SDNCErrorCommonESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + SDNCServiceError sDNCServiceError0 = new SDNCServiceError(); + assertNull(sDNCServiceError0.getAckFinalIndicator()); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + SDNCServiceError sDNCServiceError0 = new SDNCServiceError("8F;T;=}$'$-(v5P;/wC", "8F;T;=}$'$-(v5P;/wC", "", ""); + assertEquals("8F;T;=}$'$-(v5P;/wC", sDNCServiceError0.getSDNCRequestId()); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommonESTestscaffolding.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommonESTestscaffolding.java new file mode 100644 index 0000000000..e90d27a622 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommonESTestscaffolding.java @@ -0,0 +1,96 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Feb 20 14:06:32 GMT 2017 + */ + +package org.openecomp.mso.adapters.sdncrest; + +import org.evosuite.runtime.annotation.EvoSuiteClassExclude; +import org.junit.BeforeClass; +import org.junit.Before; +import org.junit.After; +import org.junit.AfterClass; +import org.evosuite.runtime.sandbox.Sandbox; + +@EvoSuiteClassExclude +public class SDNCErrorCommonESTestscaffolding { + + @org.junit.Rule + public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); + + private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + + private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); + + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; + org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); + initializeClasses(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } + + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); + } + + @Before + public void initTestCase(){ + threadStopper.storeCurrentThreads(); + threadStopper.startRecordingTime(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } + + @After + public void doneWithTestCase(){ + threadStopper.killAndJoinClientThreads(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } + + private static void initializeClasses() { + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(SDNCErrorCommonESTestscaffolding.class.getClassLoader() , + "org.codehaus.jackson.annotate.JacksonAnnotation", + "org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon", + "org.openecomp.mso.adapters.sdncrest.SDNCServiceError", + "org.codehaus.jackson.map.annotate.JsonSerialize$Typing", + "org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion", + "org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon", + "org.codehaus.jackson.map.JsonSerializer", + "org.codehaus.jackson.map.JsonSerializer$None", + "org.codehaus.jackson.map.annotate.NoClass", + "org.jboss.resteasy.annotations.providers.NoJackson", + "org.codehaus.jackson.map.annotate.JsonSerialize", + "org.codehaus.jackson.map.annotate.JsonRootName" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(SDNCErrorCommonESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion", + "org.codehaus.jackson.map.annotate.JsonSerialize$Typing", + "org.openecomp.mso.adapters.sdncrest.SDNCServiceError", + "org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon", + "org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon" + ); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorESTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorESTest.java new file mode 100644 index 0000000000..3a980a345f --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorESTest.java @@ -0,0 +1,28 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Feb 20 14:12:21 GMT 2017 + */ + +package org.openecomp.mso.adapters.sdncrest; + +import org.junit.Test; +import static org.junit.Assert.*; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class SDNCServiceErrorESTest extends SDNCServiceErrorESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + SDNCServiceError sDNCServiceError0 = new SDNCServiceError("org.openecomp.mso.adapters.sdncrest.SDNCServiceError", "org.openecomp.mso.adapters.sdncrest.SDNCServiceError", "org.openecomp.mso.adapters.sdncrest.SDNCServiceError", ""); + assertEquals("org.openecomp.mso.adapters.sdncrest.SDNCServiceError", sDNCServiceError0.getSDNCRequestId()); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + SDNCServiceError sDNCServiceError0 = new SDNCServiceError(); + assertNull(sDNCServiceError0.getResponseCode()); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorESTestscaffolding.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorESTestscaffolding.java new file mode 100644 index 0000000000..0baefc00dc --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorESTestscaffolding.java @@ -0,0 +1,96 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Feb 20 14:12:21 GMT 2017 + */ + +package org.openecomp.mso.adapters.sdncrest; + +import org.evosuite.runtime.annotation.EvoSuiteClassExclude; +import org.junit.BeforeClass; +import org.junit.Before; +import org.junit.After; +import org.junit.AfterClass; +import org.evosuite.runtime.sandbox.Sandbox; + +@EvoSuiteClassExclude +public class SDNCServiceErrorESTestscaffolding { + + @org.junit.Rule + public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); + + private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + + private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); + + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.adapters.sdncrest.SDNCServiceError"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; + org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); + initializeClasses(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } + + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); + } + + @Before + public void initTestCase(){ + threadStopper.storeCurrentThreads(); + threadStopper.startRecordingTime(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } + + @After + public void doneWithTestCase(){ + threadStopper.killAndJoinClientThreads(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } + + private static void initializeClasses() { + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(SDNCServiceErrorESTestscaffolding.class.getClassLoader() , + "org.codehaus.jackson.annotate.JacksonAnnotation", + "org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon", + "org.openecomp.mso.adapters.sdncrest.SDNCServiceError", + "org.codehaus.jackson.map.annotate.JsonSerialize$Typing", + "org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion", + "org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon", + "org.codehaus.jackson.map.annotate.NoClass", + "org.codehaus.jackson.map.JsonSerializer", + "org.codehaus.jackson.map.JsonSerializer$None", + "org.jboss.resteasy.annotations.providers.NoJackson", + "org.codehaus.jackson.map.annotate.JsonSerialize", + "org.codehaus.jackson.map.annotate.JsonRootName" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(SDNCServiceErrorESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.codehaus.jackson.map.annotate.JsonSerialize$Typing", + "org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion", + "org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon", + "org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon", + "org.openecomp.mso.adapters.sdncrest.SDNCServiceError" + ); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestESTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestESTest.java new file mode 100644 index 0000000000..5df036600a --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestESTest.java @@ -0,0 +1,172 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Feb 20 14:08:11 GMT 2017 + */ + +package org.openecomp.mso.adapters.sdncrest; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; + +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.ViolatedAssumptionAnswer; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class SDNCServiceRequestESTest extends SDNCServiceRequestESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + RequestInformation requestInformation0 = mock(RequestInformation.class, new ViolatedAssumptionAnswer()); + ServiceInformation serviceInformation0 = mock(ServiceInformation.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(serviceInformation0).toString(); + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest("org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest", "org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest", "", "{", "org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest", requestInformation0, serviceInformation0, "6`.", "{"); + sDNCServiceRequest0.getServiceInformation(); + assertEquals("{", sDNCServiceRequest0.getSDNCService()); + assertEquals("{", sDNCServiceRequest0.getSDNCServiceData()); + assertEquals("org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest", sDNCServiceRequest0.getSDNCOperation()); + assertEquals("6`.", sDNCServiceRequest0.getSDNCServiceDataType()); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest(); + sDNCServiceRequest0.setSDNCServiceDataType("2u]\"aLx"); + String string0 = sDNCServiceRequest0.getSDNCServiceDataType(); + assertEquals("2u]\"aLx", string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest(); + sDNCServiceRequest0.setSDNCServiceData("}=uO{e7dUj.<"); + String string0 = sDNCServiceRequest0.getSDNCServiceData(); + assertEquals("}=uO{e7dUj.<", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest(); + sDNCServiceRequest0.setSDNCServiceData(""); + String string0 = sDNCServiceRequest0.getSDNCServiceData(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + RequestInformation requestInformation0 = mock(RequestInformation.class, new ViolatedAssumptionAnswer()); + ServiceInformation serviceInformation0 = mock(ServiceInformation.class, new ViolatedAssumptionAnswer()); + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest("STATIC", "STATIC", "", "", "STATIC", requestInformation0, serviceInformation0, "STATIC", "+VFyyH0:WXAf=Y+|K"); + String string0 = sDNCServiceRequest0.getSDNCService(); + assertEquals("", string0); + assertEquals("STATIC", sDNCServiceRequest0.getSDNCServiceDataType()); + assertEquals("STATIC", sDNCServiceRequest0.getSDNCOperation()); + assertEquals("+VFyyH0:WXAf=Y+|K", sDNCServiceRequest0.getSDNCServiceData()); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest(); + String string0 = sDNCServiceRequest0.getSDNCOperation(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest(); + sDNCServiceRequest0.setSDNCOperation(""); + String string0 = sDNCServiceRequest0.getSDNCOperation(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest(); + RequestInformation requestInformation0 = mock(RequestInformation.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(requestInformation0).toString(); + sDNCServiceRequest0.setRequestInformation(requestInformation0); + RequestInformation requestInformation1 = sDNCServiceRequest0.getRequestInformation(); + assertSame(requestInformation1, requestInformation0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest(); + String string0 = sDNCServiceRequest0.getSDNCServiceDataType(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest(); + String string0 = sDNCServiceRequest0.getSDNCService(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + RequestInformation requestInformation0 = mock(RequestInformation.class, new ViolatedAssumptionAnswer()); + ServiceInformation serviceInformation0 = mock(ServiceInformation.class, new ViolatedAssumptionAnswer()); + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest("STATIC", "STATIC", "", "", "STATIC", requestInformation0, serviceInformation0, "STATIC", "+VFyyH0:WXAf=Y+|K"); + String string0 = sDNCServiceRequest0.getSDNCOperation(); + assertEquals("", sDNCServiceRequest0.getSDNCService()); + assertEquals("+VFyyH0:WXAf=Y+|K", sDNCServiceRequest0.getSDNCServiceData()); + assertEquals("STATIC", string0); + assertEquals("STATIC", sDNCServiceRequest0.getSDNCServiceDataType()); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest(); + ServiceInformation serviceInformation0 = sDNCServiceRequest0.getServiceInformation(); + assertNull(serviceInformation0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest(); + RequestInformation requestInformation0 = sDNCServiceRequest0.getRequestInformation(); + assertNull(requestInformation0); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + RequestInformation requestInformation0 = mock(RequestInformation.class, new ViolatedAssumptionAnswer()); + ServiceInformation serviceInformation0 = mock(ServiceInformation.class, new ViolatedAssumptionAnswer()); + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest("33M*~O'k?", "33M*~O'k?", "33M*~O'k?", "33M*~O'k?", "33M*~O'k?", requestInformation0, serviceInformation0, "33M*~O'k?", "[t["); + sDNCServiceRequest0.setServiceInformation((ServiceInformation) null); + assertEquals("33M*~O'k?", sDNCServiceRequest0.getSDNCService()); + assertEquals("[t[", sDNCServiceRequest0.getSDNCServiceData()); + assertEquals("33M*~O'k?", sDNCServiceRequest0.getSDNCOperation()); + assertEquals("33M*~O'k?", sDNCServiceRequest0.getSDNCServiceDataType()); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + RequestInformation requestInformation0 = mock(RequestInformation.class, new ViolatedAssumptionAnswer()); + ServiceInformation serviceInformation0 = mock(ServiceInformation.class, new ViolatedAssumptionAnswer()); + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest("", "M6Oxa*g8~:)0BdUFX/", "org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest", "M6Oxa*g8~:)0BdUFX/", "org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest", requestInformation0, serviceInformation0, "", "TWqSFP>PXW"); + String string0 = sDNCServiceRequest0.getSDNCServiceDataType(); + assertEquals("org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest", sDNCServiceRequest0.getSDNCOperation()); + assertEquals("TWqSFP>PXW", sDNCServiceRequest0.getSDNCServiceData()); + assertEquals("", string0); + assertEquals("M6Oxa*g8~:)0BdUFX/", sDNCServiceRequest0.getSDNCService()); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest(); + String string0 = sDNCServiceRequest0.getSDNCServiceData(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + SDNCServiceRequest sDNCServiceRequest0 = new SDNCServiceRequest(); + sDNCServiceRequest0.setSDNCService("-3eOw~BRI3K>O"); + String string0 = sDNCServiceRequest0.getSDNCService(); + assertEquals("-3eOw~BRI3K>O", string0); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestESTestscaffolding.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestESTestscaffolding.java new file mode 100644 index 0000000000..4de6c0ca7c --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestESTestscaffolding.java @@ -0,0 +1,110 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Feb 20 14:08:11 GMT 2017 + */ + +package org.openecomp.mso.adapters.sdncrest; + +import org.evosuite.runtime.annotation.EvoSuiteClassExclude; +import org.junit.BeforeClass; +import org.junit.Before; +import org.junit.After; +import org.junit.AfterClass; +import org.evosuite.runtime.sandbox.Sandbox; + +@EvoSuiteClassExclude +public class SDNCServiceRequestESTestscaffolding { + + @org.junit.Rule + public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); + + private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + + private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); + + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; + org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); + initializeClasses(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } + + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); + } + + @Before + public void initTestCase(){ + threadStopper.storeCurrentThreads(); + threadStopper.startRecordingTime(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } + + @After + public void doneWithTestCase(){ + threadStopper.killAndJoinClientThreads(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } + + private static void initializeClasses() { + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(SDNCServiceRequestESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.adapters.sdncrest.ServiceInformation", + "org.openecomp.mso.adapters.sdncrest.SDNCRequestCommon", + "org.codehaus.jackson.map.annotate.JsonSerialize$Typing", + "org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion", + "org.codehaus.jackson.map.JsonSerializer", + "org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest", + "org.jboss.resteasy.annotations.providers.NoJackson", + "org.openecomp.mso.adapters.sdncrest.RequestInformation", + "org.codehaus.jackson.annotate.JacksonAnnotation", + "org.codehaus.jackson.map.annotate.NoClass", + "org.codehaus.jackson.map.JsonSerializer$None", + "org.codehaus.jackson.map.annotate.JsonSerialize", + "org.codehaus.jackson.map.annotate.JsonRootName" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(SDNCServiceRequestESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion", + "org.codehaus.jackson.map.annotate.JsonSerialize$Typing", + "org.openecomp.mso.adapters.sdncrest.ServiceInformation", + "org.codehaus.jackson.map.introspect.AnnotatedClass", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector", + "org.codehaus.jackson.annotate.JsonAutoDetect$Visibility", + "org.codehaus.jackson.annotate.JsonMethod", + "org.codehaus.jackson.map.introspect.VisibilityChecker$Std", + "org.codehaus.jackson.map.ObjectMapper", + "org.codehaus.jackson.JsonParser$Feature", + "org.codehaus.jackson.JsonGenerator$Feature", + "org.codehaus.jackson.JsonFactory", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer", + "org.codehaus.jackson.map.type.TypeFactory", + "org.openecomp.mso.adapters.sdncrest.RequestInformation", + "org.openecomp.mso.adapters.sdncrest.SDNCRequestCommon", + "org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest" + ); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseESTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseESTest.java new file mode 100644 index 0000000000..fc05ed5b6c --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseESTest.java @@ -0,0 +1,63 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Feb 20 14:07:08 GMT 2017 + */ + +package org.openecomp.mso.adapters.sdncrest; + +import org.junit.Test; +import static org.junit.Assert.*; +import java.util.HashMap; +import java.util.Map; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class SDNCServiceResponseESTest extends SDNCServiceResponseESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + SDNCServiceResponse sDNCServiceResponse0 = new SDNCServiceResponse(); + sDNCServiceResponse0.addParam((String) null, ""); + assertNull(sDNCServiceResponse0.getResponseMessage()); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + SDNCServiceResponse sDNCServiceResponse0 = new SDNCServiceResponse(); + sDNCServiceResponse0.addParam("", ""); + Map map0 = sDNCServiceResponse0.getParams(); + assertEquals(1, map0.size()); + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + SDNCServiceResponse sDNCServiceResponse0 = new SDNCServiceResponse(); + sDNCServiceResponse0.addParam("", ""); + sDNCServiceResponse0.addParam("DYNAMIC", "DYNAMIC"); + assertNull(sDNCServiceResponse0.getResponseMessage()); + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + SDNCServiceResponse sDNCServiceResponse0 = new SDNCServiceResponse(); + HashMap hashMap0 = new HashMap(); + sDNCServiceResponse0.setParams(hashMap0); + Map map0 = sDNCServiceResponse0.getParams(); + assertEquals(0, map0.size()); + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + SDNCServiceResponse sDNCServiceResponse0 = new SDNCServiceResponse("", "", "", ""); + assertEquals("", sDNCServiceResponse0.getResponseCode()); + } + + @Test(timeout = 4000) + public void test5() throws Throwable { + SDNCServiceResponse sDNCServiceResponse0 = new SDNCServiceResponse(); + Map map0 = sDNCServiceResponse0.getParams(); + assertNull(map0); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseESTestscaffolding.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseESTestscaffolding.java new file mode 100644 index 0000000000..243140efff --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseESTestscaffolding.java @@ -0,0 +1,246 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Mon Feb 20 14:07:08 GMT 2017 + */ + +package org.openecomp.mso.adapters.sdncrest; + +import org.evosuite.runtime.annotation.EvoSuiteClassExclude; +import org.junit.BeforeClass; +import org.junit.Before; +import org.junit.After; +import org.junit.AfterClass; +import org.evosuite.runtime.sandbox.Sandbox; + +@EvoSuiteClassExclude +public class SDNCServiceResponseESTestscaffolding { + + @org.junit.Rule + public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); + + private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + + private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); + + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.adapters.sdncrest.SDNCServiceResponse"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; + org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); + initializeClasses(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } + + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); + } + + @Before + public void initTestCase(){ + threadStopper.storeCurrentThreads(); + threadStopper.startRecordingTime(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } + + @After + public void doneWithTestCase(){ + threadStopper.killAndJoinClientThreads(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } + + private static void initializeClasses() { + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(SDNCServiceResponseESTestscaffolding.class.getClassLoader() , + "org.codehaus.jackson.map.JsonSerializableWithType", + "org.codehaus.jackson.map.HandlerInstantiator", + "org.codehaus.jackson.map.deser.StdDeserializerProvider", + "org.codehaus.jackson.map.SerializerFactory", + "org.codehaus.jackson.map.SerializerProvider", + "org.codehaus.jackson.map.type.TypeBindings", + "org.codehaus.jackson.map.SerializationConfig", + "org.codehaus.jackson.map.introspect.AnnotationMap", + "org.codehaus.jackson.JsonProcessingException", + "org.codehaus.jackson.map.introspect.Annotated", + "org.codehaus.jackson.io.InputDecorator", + "org.codehaus.jackson.map.Module", + "org.codehaus.jackson.map.util.Annotations", + "org.codehaus.jackson.map.type.TypeModifier", + "org.codehaus.jackson.sym.NameN", + "org.codehaus.jackson.JsonGenerator", + "org.codehaus.jackson.map.introspect.AnnotatedClass", + "org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector", + "org.codehaus.jackson.annotate.JsonAutoDetect$1", + "org.codehaus.jackson.map.JsonSerializable", + "org.codehaus.jackson.annotate.JsonMethod", + "org.codehaus.jackson.node.BaseJsonNode", + "org.codehaus.jackson.map.ObjectReader", + "org.codehaus.jackson.annotate.JsonAutoDetect$Visibility", + "org.codehaus.jackson.map.DeserializerProvider", + "org.codehaus.jackson.node.ValueNode", + "org.codehaus.jackson.map.JsonSerializer", + "org.codehaus.jackson.map.ser.BeanSerializerFactory", + "org.codehaus.jackson.map.introspect.AnnotatedWithParams", + "org.codehaus.jackson.map.AnnotationIntrospector", + "org.codehaus.jackson.map.MappingJsonFactory", + "org.codehaus.jackson.map.MapperConfig$Impl", + "org.codehaus.jackson.sym.Name1", + "org.codehaus.jackson.sym.Name2", + "org.codehaus.jackson.sym.Name3", + "org.codehaus.jackson.map.introspect.MethodFilter", + "org.codehaus.jackson.map.ser.StdSerializerProvider", + "org.codehaus.jackson.map.deser.StdDeserializationContext", + "org.codehaus.jackson.type.TypeReference", + "org.codehaus.jackson.map.ClassIntrospector", + "org.codehaus.jackson.map.AnnotationIntrospector$Pair", + "org.codehaus.jackson.map.PropertyNamingStrategy$LowerCaseWithUnderscoresStrategy", + "org.codehaus.jackson.map.MapperConfig$ConfigFeature", + "org.codehaus.jackson.map.SerializationConfig$Feature", + "org.codehaus.jackson.Versioned", + "org.codehaus.jackson.io.IOContext", + "org.codehaus.jackson.map.annotate.JsonSerialize$Typing", + "org.codehaus.jackson.map.type.TypeBase", + "org.codehaus.jackson.map.ser.BasicSerializerFactory", + "org.openecomp.mso.adapters.sdncrest.SDNCServiceResponse", + "org.codehaus.jackson.map.PropertyNamingStrategy", + "org.codehaus.jackson.node.ContainerNode", + "org.codehaus.jackson.map.jsontype.NamedType", + "org.codehaus.jackson.map.ser.FilterProvider", + "org.codehaus.jackson.map.introspect.AnnotatedConstructor", + "org.codehaus.jackson.map.DeserializationConfig", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer", + "org.codehaus.jackson.map.type.TypeFactory", + "org.codehaus.jackson.impl.ReaderBasedParser", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer$TableInfo", + "org.codehaus.jackson.JsonEncoding", + "org.codehaus.jackson.map.type.MapLikeType", + "org.codehaus.jackson.map.JsonDeserializer", + "org.codehaus.jackson.map.PropertyNamingStrategy$PropertyNamingStrategyBase", + "org.codehaus.jackson.node.ObjectNode", + "org.codehaus.jackson.map.ser.std.SerializerBase", + "org.codehaus.jackson.map.type.CollectionLikeType", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$MinimalMethodFilter", + "org.codehaus.jackson.map.DeserializationConfig$Feature", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer$Bucket", + "org.codehaus.jackson.map.introspect.AnnotatedMethodMap", + "org.codehaus.jackson.impl.JsonParserMinimalBase", + "org.codehaus.jackson.map.type.TypeParser", + "org.codehaus.jackson.map.introspect.POJOPropertiesCollector", + "org.codehaus.jackson.JsonParseException", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$SetterMethodFilter", + "org.codehaus.jackson.map.introspect.VisibilityChecker", + "org.codehaus.jackson.map.introspect.AnnotatedField", + "org.codehaus.jackson.impl.JsonGeneratorBase", + "org.codehaus.jackson.map.ObjectMapper", + "org.codehaus.jackson.util.ByteArrayBuilder", + "org.codehaus.jackson.map.ser.impl.FailingSerializer", + "org.codehaus.jackson.PrettyPrinter", + "org.codehaus.jackson.JsonToken", + "org.codehaus.jackson.map.jsontype.SubtypeResolver", + "org.codehaus.jackson.map.type.SimpleType", + "org.codehaus.jackson.impl.Utf8Generator", + "org.codehaus.jackson.node.NumericNode", + "org.jboss.resteasy.annotations.providers.NoJackson", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$SetterAndGetterMethodFilter", + "org.codehaus.jackson.JsonNode", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer", + "org.codehaus.jackson.annotate.JacksonAnnotation", + "org.codehaus.jackson.map.ObjectWriter", + "org.codehaus.jackson.schema.SchemaAware", + "org.codehaus.jackson.io.OutputDecorator", + "org.codehaus.jackson.FormatSchema", + "org.codehaus.jackson.format.MatchStrength", + "org.codehaus.jackson.ObjectCodec", + "org.codehaus.jackson.map.introspect.AnnotatedMethod", + "org.codehaus.jackson.JsonGenerationException", + "org.codehaus.jackson.format.InputAccessor", + "org.codehaus.jackson.JsonFactory", + "org.codehaus.jackson.node.ArrayNode", + "org.codehaus.jackson.util.BufferRecycler", + "org.codehaus.jackson.io.SegmentedStringWriter", + "org.codehaus.jackson.map.jsontype.TypeResolverBuilder", + "org.codehaus.jackson.map.type.HierarchicType", + "org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector$GetterMethodFilter", + "org.codehaus.jackson.JsonParser$Feature", + "org.codehaus.jackson.map.annotate.JsonSerialize", + "org.codehaus.jackson.map.BeanDescription", + "org.codehaus.jackson.JsonParser$1", + "org.codehaus.jackson.impl.WriterBasedGenerator", + "org.codehaus.jackson.JsonGenerator$Feature", + "org.codehaus.jackson.sym.Name", + "org.codehaus.jackson.Version", + "org.codehaus.jackson.io.CharacterEscapes", + "org.codehaus.jackson.map.introspect.BasicBeanDescription", + "org.codehaus.jackson.schema.JsonSchema", + "org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion", + "org.codehaus.jackson.util.TokenBuffer", + "org.codehaus.jackson.map.MappingIterator", + "org.codehaus.jackson.map.DeserializationContext", + "org.codehaus.jackson.map.ObjectMapper$DefaultTyping", + "org.codehaus.jackson.impl.JsonParserBase", + "org.codehaus.jackson.map.JsonMappingException", + "org.codehaus.jackson.map.introspect.AnnotatedMember", + "org.codehaus.jackson.node.JsonNodeFactory", + "org.codehaus.jackson.type.JavaType", + "org.codehaus.jackson.map.annotate.NoClass", + "org.codehaus.jackson.map.introspect.VisibilityChecker$Std", + "org.codehaus.jackson.annotate.JsonTypeInfo$As", + "org.codehaus.jackson.map.annotate.JsonRootName", + "org.codehaus.jackson.JsonParser", + "org.codehaus.jackson.node.NullNode", + "org.codehaus.jackson.map.InjectableValues", + "org.codehaus.jackson.map.jsontype.impl.StdSubtypeResolver", + "org.codehaus.jackson.node.TreeTraversingParser", + "org.codehaus.jackson.map.type.CollectionType", + "org.codehaus.jackson.map.MapperConfig", + "org.codehaus.jackson.map.Module$SetupContext", + "org.codehaus.jackson.map.introspect.VisibilityChecker$1", + "org.codehaus.jackson.io.UTF8Writer", + "org.codehaus.jackson.map.type.MapType", + "org.codehaus.jackson.map.JsonSerializer$None", + "org.codehaus.jackson.annotate.JsonAutoDetect", + "org.codehaus.jackson.map.type.ArrayType", + "org.codehaus.jackson.map.ClassIntrospector$MixInResolver" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(SDNCServiceResponseESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.codehaus.jackson.map.annotate.JsonSerialize$Inclusion", + "org.codehaus.jackson.map.annotate.JsonSerialize$Typing", + "org.codehaus.jackson.map.introspect.AnnotatedClass", + "org.codehaus.jackson.map.introspect.BasicClassIntrospector", + "org.codehaus.jackson.annotate.JsonAutoDetect$Visibility", + "org.codehaus.jackson.annotate.JsonMethod", + "org.codehaus.jackson.map.introspect.VisibilityChecker$Std", + "org.codehaus.jackson.map.ObjectMapper", + "org.codehaus.jackson.JsonParser$Feature", + "org.codehaus.jackson.JsonGenerator$Feature", + "org.codehaus.jackson.JsonFactory", + "org.codehaus.jackson.sym.CharsToNameCanonicalizer", + "org.codehaus.jackson.sym.BytesToNameCanonicalizer", + "org.codehaus.jackson.map.type.TypeFactory", + "org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon", + "org.openecomp.mso.adapters.sdncrest.SDNCServiceResponse" + ); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationESTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationESTest.java new file mode 100644 index 0000000000..0cfe6dcd67 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationESTest.java @@ -0,0 +1,118 @@ +/* + * This file was automatically generated by EvoSuite + * Mon Feb 20 14:09:38 GMT 2017 + */ + +package org.openecomp.mso.adapters.sdncrest; + +import org.junit.Test; +import static org.junit.Assert.*; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class ServiceInformationESTest extends ServiceInformationESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + ServiceInformation serviceInformation0 = new ServiceInformation("J|^", ":N1Q`D JY", "org.openecomp.mso.adapters.sdncrest.ServiceInformation", ":N1Q`D JY"); + String string0 = serviceInformation0.getSubscriberName(); + assertEquals("org.openecomp.mso.adapters.sdncrest.ServiceInformation", string0); + assertEquals("J|^", serviceInformation0.getServiceType()); + assertEquals(":N1Q`D JY", serviceInformation0.getSubscriberGlobalId()); + assertEquals(":N1Q`D JY", serviceInformation0.getServiceInstanceId()); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + ServiceInformation serviceInformation0 = new ServiceInformation("", (String) null, "", ""); + String string0 = serviceInformation0.getSubscriberName(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + ServiceInformation serviceInformation0 = new ServiceInformation("J|^", ":N1Q`D JY", "org.openecomp.mso.adapters.sdncrest.ServiceInformation", ":N1Q`D JY"); + String string0 = serviceInformation0.getSubscriberGlobalId(); + assertEquals(":N1Q`D JY", serviceInformation0.getServiceInstanceId()); + assertEquals("org.openecomp.mso.adapters.sdncrest.ServiceInformation", serviceInformation0.getSubscriberName()); + assertEquals("J|^", serviceInformation0.getServiceType()); + assertEquals(":N1Q`D JY", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + ServiceInformation serviceInformation0 = new ServiceInformation(); + serviceInformation0.setSubscriberGlobalId(""); + String string0 = serviceInformation0.getSubscriberGlobalId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + ServiceInformation serviceInformation0 = new ServiceInformation(); + serviceInformation0.setServiceType("org.openecomp.mso.adapters.sdncrest.ServiceInformation"); + String string0 = serviceInformation0.getServiceType(); + assertEquals("org.openecomp.mso.adapters.sdncrest.ServiceInformation", string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + ServiceInformation serviceInformation0 = new ServiceInformation(); + serviceInformation0.setServiceInstanceId("q3jc2(qb=E+3uz_L%"); + String string0 = serviceInformation0.getServiceInstanceId(); + assertEquals("q3jc2(qb=E+3uz_L%", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + ServiceInformation serviceInformation0 = new ServiceInformation(); + serviceInformation0.setServiceInstanceId(""); + String string0 = serviceInformation0.getServiceInstanceId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + ServiceInformation serviceInformation0 = new ServiceInformation(); + String string0 = serviceInformation0.getSubscriberName(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + ServiceInformation serviceInformation0 = new ServiceInformation(); + serviceInformation0.setSubscriberName((String) null); + assertNull(serviceInformation0.getServiceInstanceId()); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + ServiceInformation serviceInformation0 = new ServiceInformation(); + String string0 = serviceInformation0.getServiceInstanceId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + ServiceInformation serviceInformation0 = new ServiceInformation(); + String string0 = serviceInformation0.getSubscriberGlobalId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + ServiceInformation serviceInformation0 = new ServiceInformation(); + String string0 = serviceInformation0.getServiceType(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + ServiceInformation serviceInformation0 = new ServiceInformation(); + serviceInformation0.setServiceType(""); + String string0 = serviceInformation0.getServiceType(); + assertEquals("", string0); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTestscaffolding.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationESTestscaffolding.java similarity index 54% rename from bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTestscaffolding.java rename to adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationESTestscaffolding.java index 69ee3dcd48..c9d31980c2 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTestscaffolding.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationESTestscaffolding.java @@ -1,10 +1,10 @@ /** - * Scaffolding file used to store all the setups needed to run + * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite - * Mon Nov 14 11:35:23 GMT 2016 + * Mon Feb 20 14:09:38 GMT 2017 */ -package org.openecomp.mso.bpmn.core; +package org.openecomp.mso.adapters.sdncrest; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; @@ -14,70 +14,68 @@ import org.junit.AfterClass; import org.evosuite.runtime.sandbox.Sandbox; @EvoSuiteClassExclude -public class BadInjectedFieldExceptionESTestscaffolding { +public class ServiceInformationESTestscaffolding { - @org.junit.Rule + @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.bpmn.core.BadInjectedFieldException"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.adapters.sdncrest.ServiceInformation"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; + org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); + } - @Before - public void initTestCase(){ + @Before + public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } - @After - public void doneWithTestCase(){ + @After + public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } - + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(BadInjectedFieldExceptionESTestscaffolding.class.getClassLoader() , - "org.openecomp.mso.bpmn.core.BadInjectedFieldException" + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ServiceInformationESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.adapters.sdncrest.ServiceInformation" ); - } + } private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(BadInjectedFieldExceptionESTestscaffolding.class.getClassLoader()); + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ServiceInformationESTestscaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "org.openecomp.mso.bpmn.core.BadInjectedFieldException" + "org.openecomp.mso.adapters.sdncrest.ServiceInformation" ); } } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponseESTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponseESTest.java index b6719ef398..77f48a1232 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponseESTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponseESTest.java @@ -1,193 +1,127 @@ /* * This file was automatically generated by EvoSuite - * Mon Nov 14 09:29:29 GMT 2016 + * Mon Feb 20 14:10:17 GMT 2017 */ package org.openecomp.mso.adapters.vnfrest; import org.junit.Test; import static org.junit.Assert.*; - -import org.openecomp.mso.entity.MsoRequest; -import org.openecomp.mso.openstack.beans.VnfRollback; -import java.util.HashMap; import java.util.Map; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; +import org.openecomp.mso.adapters.vnfrest.CreateVfModuleResponse; +import org.openecomp.mso.adapters.vnfrest.VfModuleRollback; -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) public class CreateVfModuleResponseESTest extends CreateVfModuleResponseESTestscaffolding { - @Test(timeout = 4000) - public void test00() throws Throwable { - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); - createVfModuleResponse0.setVnfId("IJ@"); - String string0 = createVfModuleResponse0.getVnfId(); - assertEquals("IJ@", string0); - } - - @Test(timeout = 4000) - public void test01() throws Throwable { - Boolean boolean0 = Boolean.TRUE; - HashMap hashMap0 = new HashMap(); - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse("", "", "", boolean0, (Map) hashMap0, (VfModuleRollback) null, ""); - String string0 = createVfModuleResponse0.getVnfId(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test02() throws Throwable { - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); - createVfModuleResponse0.setVfModuleStackId(", tenantCreated="); - String string0 = createVfModuleResponse0.getVfModuleStackId(); - assertEquals(", tenantCreated=", string0); - } - - @Test(timeout = 4000) - public void test03() throws Throwable { - Boolean boolean0 = new Boolean(true); - HashMap hashMap0 = new HashMap(); - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse("j|[9Y&=Ke", ", tenant=", "", boolean0, (Map) hashMap0, (VfModuleRollback) null, ", tenant="); - String string0 = createVfModuleResponse0.getVfModuleStackId(); - assertEquals(", tenant=", createVfModuleResponse0.getVfModuleId()); - assertEquals("", string0); - assertEquals("j|[9Y&=Ke", createVfModuleResponse0.getVnfId()); - } - - @Test(timeout = 4000) - public void test04() throws Throwable { - Boolean boolean0 = new Boolean(""); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(); - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse("Dz?II3`92;Y(@b$'\"", "Dz?II3`92;Y(@b$'\"", "", boolean0, (Map) null, vfModuleRollback0, "Dz?II3`92;Y(@b$'\""); - createVfModuleResponse0.getVfModuleOutputs(); - assertEquals("", createVfModuleResponse0.getVfModuleStackId()); - assertEquals("Dz?II3`92;Y(@b$'\"", createVfModuleResponse0.getVfModuleId()); - assertEquals("Dz?II3`92;Y(@b$'\"", createVfModuleResponse0.getVnfId()); - } - - @Test(timeout = 4000) - public void test05() throws Throwable { - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); - HashMap hashMap0 = new HashMap(); - hashMap0.put("01.rc\"}EZ", "01.rc\"}EZ"); - createVfModuleResponse0.setVfModuleOutputs(hashMap0); - Map map0 = createVfModuleResponse0.getVfModuleOutputs(); - assertFalse(map0.isEmpty()); - } - - @Test(timeout = 4000) - public void test06() throws Throwable { - Boolean boolean0 = new Boolean(true); - HashMap hashMap0 = new HashMap(); - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse("j|[9Y&=Ke", ", tenant=", "", boolean0, (Map) hashMap0, (VfModuleRollback) null, ", tenant="); - String string0 = createVfModuleResponse0.getVfModuleId(); - assertEquals("", createVfModuleResponse0.getVfModuleStackId()); - assertEquals(", tenant=", string0); - assertEquals("j|[9Y&=Ke", createVfModuleResponse0.getVnfId()); - } - - @Test(timeout = 4000) - public void test07() throws Throwable { - Boolean boolean0 = Boolean.TRUE; - HashMap hashMap0 = new HashMap(); - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse("", "", "", boolean0, (Map) hashMap0, (VfModuleRollback) null, ""); - String string0 = createVfModuleResponse0.getVfModuleId(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test08() throws Throwable { - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); - Boolean boolean0 = createVfModuleResponse0.getVfModuleCreated(); - assertNull(boolean0); - } - - @Test(timeout = 4000) - public void test09() throws Throwable { - Boolean boolean0 = new Boolean(true); - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); - Map map0 = createVfModuleResponse0.getVfModuleOutputs(); - MsoRequest msoRequest0 = new MsoRequest("a", ""); - VnfRollback vnfRollback0 = new VnfRollback("a", "", (String) null, true, false, msoRequest0, "", (String) null, "a"); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(vnfRollback0, "a", "", "W[dY"); - CreateVfModuleResponse createVfModuleResponse1 = new CreateVfModuleResponse("a", "", "", boolean0, (Map) map0, vfModuleRollback0, "Q"); - createVfModuleResponse1.getVfModuleCreated(); - assertEquals("", createVfModuleResponse1.getVfModuleStackId()); - assertEquals("", createVfModuleResponse1.getVfModuleId()); - assertEquals("a", createVfModuleResponse1.getVnfId()); - } - - @Test(timeout = 4000) - public void test10() throws Throwable { - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); - createVfModuleResponse0.setRollback((VfModuleRollback) null); - VfModuleRollback vfModuleRollback0 = createVfModuleResponse0.getRollback(); - assertNull(vfModuleRollback0); - } - - @Test(timeout = 4000) - public void test11() throws Throwable { - Boolean boolean0 = Boolean.FALSE; - MsoRequest msoRequest0 = new MsoRequest(); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback("", "", "GC", true, "", "", msoRequest0, ""); - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse("", "", "", boolean0, (Map) null, vfModuleRollback0, "xoOjQ;h*'Qx&0ys4"); - createVfModuleResponse0.getRollback(); - assertEquals("", createVfModuleResponse0.getVnfId()); - assertEquals("", createVfModuleResponse0.getVfModuleStackId()); - assertEquals("", createVfModuleResponse0.getVfModuleId()); - } - - @Test(timeout = 4000) - public void test12() throws Throwable { - Boolean boolean0 = new Boolean(""); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(); - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse("Dz?II3`92;Y(@b$'\"", "Dz?II3`92;Y(@b$'\"", "", boolean0, (Map) null, vfModuleRollback0, "Dz?II3`92;Y(@b$'\""); - createVfModuleResponse0.getVfModuleCreated(); - assertEquals("Dz?II3`92;Y(@b$'\"", createVfModuleResponse0.getVfModuleId()); - assertEquals("", createVfModuleResponse0.getVfModuleStackId()); - assertEquals("Dz?II3`92;Y(@b$'\"", createVfModuleResponse0.getVnfId()); - } - - @Test(timeout = 4000) - public void test13() throws Throwable { - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); - String string0 = createVfModuleResponse0.getVnfId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test14() throws Throwable { - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); - String string0 = createVfModuleResponse0.getVfModuleId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test15() throws Throwable { - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); - VfModuleRollback vfModuleRollback0 = createVfModuleResponse0.getRollback(); - assertNull(vfModuleRollback0.getCloudSiteId()); - } - - @Test(timeout = 4000) - public void test16() throws Throwable { - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); - String string0 = createVfModuleResponse0.getVfModuleStackId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test17() throws Throwable { - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); - createVfModuleResponse0.setVfModuleCreated((Boolean) null); - assertNull(createVfModuleResponse0.getVfModuleStackId()); - } - - @Test(timeout = 4000) - public void test18() throws Throwable { - CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); - createVfModuleResponse0.setVfModuleId((String) null); - assertNull(createVfModuleResponse0.getVnfId()); - } + @Test(timeout = 4000) + public void test00() throws Throwable { + CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); + createVfModuleResponse0.setVnfId(""); + String string0 = createVfModuleResponse0.getVnfId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); + createVfModuleResponse0.setVfModuleStackId("}V=E6z^$czD"); + String string0 = createVfModuleResponse0.getVfModuleStackId(); + assertEquals("}V=E6z^$czD", string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); + createVfModuleResponse0.setVfModuleOutputs((Map) null); + Map map0 = createVfModuleResponse0.getVfModuleOutputs(); + assertNull(map0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); + createVfModuleResponse0.setVfModuleId("Zc%GM]/E*oKC:3T=N_"); + String string0 = createVfModuleResponse0.getVfModuleId(); + assertEquals("Zc%GM]/E*oKC:3T=N_", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); + Boolean boolean0 = createVfModuleResponse0.getVfModuleCreated(); + assertNull(boolean0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); + String string0 = createVfModuleResponse0.getVnfId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); + Map map0 = createVfModuleResponse0.getVfModuleOutputs(); + CreateVfModuleResponse createVfModuleResponse1 = new CreateVfModuleResponse((String) null, (String) null, (String) null, (Boolean) null, map0, (VfModuleRollback) null, "g[03BX;$B"); + VfModuleRollback vfModuleRollback0 = createVfModuleResponse1.getRollback(); + assertNull(vfModuleRollback0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); + String string0 = createVfModuleResponse0.getVfModuleStackId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); + VfModuleRollback vfModuleRollback0 = createVfModuleResponse0.getRollback(); + createVfModuleResponse0.setRollback(vfModuleRollback0); + assertNull(vfModuleRollback0.getVnfId()); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); + createVfModuleResponse0.setVnfId("z"); + String string0 = createVfModuleResponse0.getVnfId(); + assertEquals("z", string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); + createVfModuleResponse0.setVfModuleStackId(""); + String string0 = createVfModuleResponse0.getVfModuleStackId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); + createVfModuleResponse0.setVfModuleId(""); + String string0 = createVfModuleResponse0.getVfModuleId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); + String string0 = createVfModuleResponse0.getVfModuleId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + CreateVfModuleResponse createVfModuleResponse0 = new CreateVfModuleResponse(); + createVfModuleResponse0.setVfModuleCreated((Boolean) null); + assertNull(createVfModuleResponse0.getVnfId()); + } } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponseESTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponseESTest.java index e141f4b4e1..e11a30e336 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponseESTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponseESTest.java @@ -1,112 +1,100 @@ /* * This file was automatically generated by EvoSuite - * Mon Nov 14 09:11:34 GMT 2016 + * Mon Feb 20 14:09:17 GMT 2017 */ package org.openecomp.mso.adapters.vnfrest; import org.junit.Test; import static org.junit.Assert.*; - +import java.util.Map; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; +import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleResponse; -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) public class DeleteVfModuleResponseESTest extends DeleteVfModuleResponseESTestscaffolding { - @Test(timeout = 4000) - public void test00() throws Throwable { - DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse(); - String string0 = deleteVfModuleResponse0.getVnfId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test01() throws Throwable { - Boolean boolean0 = new Boolean(true); - DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse("", "", boolean0, ""); - String string0 = deleteVfModuleResponse0.getVnfId(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test02() throws Throwable { - DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse(); - String string0 = deleteVfModuleResponse0.getVfModuleId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test03() throws Throwable { - Boolean boolean0 = Boolean.valueOf(""); - DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse("", "", boolean0, ""); - String string0 = deleteVfModuleResponse0.getVfModuleId(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test04() throws Throwable { - DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse(); - Boolean boolean0 = deleteVfModuleResponse0.getVfModuleDeleted(); - assertNull(boolean0); - } - - @Test(timeout = 4000) - public void test05() throws Throwable { - Boolean boolean0 = Boolean.valueOf(""); - DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse("", "", boolean0, ""); - Boolean boolean1 = deleteVfModuleResponse0.getVfModuleDeleted(); - assertFalse(boolean1); - } - - @Test(timeout = 4000) - public void test06() throws Throwable { - Boolean boolean0 = Boolean.valueOf(true); - DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse("0ID1Ty#VhJ)'G`m%:", "ZtG4nF]b8,X8", boolean0, "V)B9%\"dq&%l{_Ou@"); - String string0 = deleteVfModuleResponse0.getVfModuleId(); - assertEquals("ZtG4nF]b8,X8", string0); - assertEquals("0ID1Ty#VhJ)'G`m%:", deleteVfModuleResponse0.getVnfId()); - } - - @Test(timeout = 4000) - public void test07() throws Throwable { - DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse(); - Boolean boolean0 = Boolean.valueOf(""); - deleteVfModuleResponse0.setVfModuleDeleted(boolean0); - assertNull(deleteVfModuleResponse0.getVfModuleId()); - } - - @Test(timeout = 4000) - public void test08() throws Throwable { - DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse(); - deleteVfModuleResponse0.setVfModuleId("D:`0Q"); - assertNull(deleteVfModuleResponse0.getMessageId()); - } - - @Test(timeout = 4000) - public void test09() throws Throwable { - Boolean boolean0 = Boolean.FALSE; - DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse("%cklg~Aa", "h*U[;Rpm9k o5[<", boolean0, "%cklg~Aa"); - String string0 = deleteVfModuleResponse0.getVnfId(); - assertEquals("h*U[;Rpm9k o5[<", deleteVfModuleResponse0.getVfModuleId()); - assertEquals("%cklg~Aa", string0); - } - - @Test(timeout = 4000) - public void test10() throws Throwable { - Boolean boolean0 = Boolean.valueOf(true); - DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse("0ID1Ty#VhJ)'G`m%:", "ZtG4nF]b8,X8", boolean0, "V)B9%\"dq&%l{_Ou@"); - deleteVfModuleResponse0.getVfModuleDeleted(); - assertEquals("ZtG4nF]b8,X8", deleteVfModuleResponse0.getVfModuleId()); - assertEquals("0ID1Ty#VhJ)'G`m%:", deleteVfModuleResponse0.getVnfId()); - } - - @Test(timeout = 4000) - public void test11() throws Throwable { - Boolean boolean0 = Boolean.valueOf(""); - DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse("", "", boolean0, ""); - deleteVfModuleResponse0.setVnfId(""); - assertEquals("", deleteVfModuleResponse0.getVnfId()); - } + @Test(timeout = 4000) + public void test00() throws Throwable { + DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse(); + deleteVfModuleResponse0.setVnfId("|Hny"); + String string0 = deleteVfModuleResponse0.getVnfId(); + assertEquals("|Hny", string0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse(); + deleteVfModuleResponse0.setVnfId(""); + String string0 = deleteVfModuleResponse0.getVnfId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse(); + deleteVfModuleResponse0.setVfModuleOutputs((Map) null); + Map map0 = deleteVfModuleResponse0.getVfModuleOutputs(); + assertNull(map0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse(); + deleteVfModuleResponse0.setVfModuleId("z"); + String string0 = deleteVfModuleResponse0.getVfModuleId(); + assertEquals("z", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse(); + String string0 = deleteVfModuleResponse0.getVnfId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse(); + Boolean boolean0 = deleteVfModuleResponse0.getVfModuleDeleted(); + assertNull(boolean0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse(); + Map map0 = deleteVfModuleResponse0.getVfModuleOutputs(); + deleteVfModuleResponse0.setVfModuleOutputs(map0); + assertNull(deleteVfModuleResponse0.getVnfId()); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse(); + String string0 = deleteVfModuleResponse0.getVfModuleId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse("as~HC[>z,.,Z :hLu", "as~HC[>z,.,Z :hLu", (Boolean) null, "as~HC[>z,.,Z :hLu", (Map) null); + assertEquals("as~HC[>z,.,Z :hLu", deleteVfModuleResponse0.getVnfId()); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse(); + deleteVfModuleResponse0.setVfModuleDeleted((Boolean) null); + assertNull(deleteVfModuleResponse0.getMessageId()); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + DeleteVfModuleResponse deleteVfModuleResponse0 = new DeleteVfModuleResponse(); + deleteVfModuleResponse0.setVfModuleId(""); + String string0 = deleteVfModuleResponse0.getVfModuleId(); + assertEquals("", string0); + } } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleRequestESTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleRequestESTest.java index 326205981a..919475eb5d 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleRequestESTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleRequestESTest.java @@ -1,48 +1,32 @@ /* * This file was automatically generated by EvoSuite - * Mon Nov 14 09:14:23 GMT 2016 + * Mon Feb 20 14:11:28 GMT 2017 */ package org.openecomp.mso.adapters.vnfrest; import org.junit.Test; import static org.junit.Assert.*; - -import org.openecomp.mso.entity.MsoRequest; -import org.openecomp.mso.openstack.beans.VnfRollback; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; +import org.openecomp.mso.adapters.vnfrest.RollbackVfModuleRequest; +import org.openecomp.mso.adapters.vnfrest.VfModuleRollback; -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) public class RollbackVfModuleRequestESTest extends RollbackVfModuleRequestESTestscaffolding { - @Test(timeout = 4000) - public void test0() throws Throwable { - RollbackVfModuleRequest rollbackVfModuleRequest0 = new RollbackVfModuleRequest(); - MsoRequest msoRequest0 = new MsoRequest(); - VnfRollback vnfRollback0 = new VnfRollback("iL", "cG!", "", true, true, msoRequest0, "cG!", "", (String) null); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(vnfRollback0, "", "", (String) null); - rollbackVfModuleRequest0.setVfModuleRollback(vfModuleRollback0); - VfModuleRollback vfModuleRollback1 = rollbackVfModuleRequest0.getVfModuleRollback(); - assertEquals("", vfModuleRollback1.getVfModuleStackId()); - } - - @Test(timeout = 4000) - public void test1() throws Throwable { - RollbackVfModuleRequest rollbackVfModuleRequest0 = new RollbackVfModuleRequest(); - MsoRequest msoRequest0 = new MsoRequest("MJ|D", "MJ|D"); - VnfRollback vnfRollback0 = new VnfRollback("jaxb.formatted.output", "jaxb.formatted.output", "jaxb.formatted.output", false, false, msoRequest0, "", "", ""); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(vnfRollback0, (String) null, "jaxb.formatted.output", "jaxb.formatted.output"); - rollbackVfModuleRequest0.setVfModuleRollback(vfModuleRollback0); - VfModuleRollback vfModuleRollback1 = rollbackVfModuleRequest0.getVfModuleRollback(); - assertEquals("jaxb.formatted.output", vfModuleRollback1.getTenantId()); - } + @Test(timeout = 4000) + public void test0() throws Throwable { + RollbackVfModuleRequest rollbackVfModuleRequest0 = new RollbackVfModuleRequest(); + VfModuleRollback vfModuleRollback0 = rollbackVfModuleRequest0.getVfModuleRollback(); + assertNull(vfModuleRollback0); + } - @Test(timeout = 4000) - public void test2() throws Throwable { - RollbackVfModuleRequest rollbackVfModuleRequest0 = new RollbackVfModuleRequest(); - VfModuleRollback vfModuleRollback0 = rollbackVfModuleRequest0.getVfModuleRollback(); - assertNull(vfModuleRollback0); - } + @Test(timeout = 4000) + public void test1() throws Throwable { + RollbackVfModuleRequest rollbackVfModuleRequest0 = new RollbackVfModuleRequest(); + rollbackVfModuleRequest0.setVfModuleRollback((VfModuleRollback) null); + assertTrue(rollbackVfModuleRequest0.isSynchronous()); + } } diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/VfModuleRollbackESTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/VfModuleRollbackESTest.java index 1ba09e124f..470fff5981 100644 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/VfModuleRollbackESTest.java +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/vnfrest/VfModuleRollbackESTest.java @@ -1,6 +1,6 @@ /* * This file was automatically generated by EvoSuite - * Mon Nov 14 09:20:21 GMT 2016 + * Mon Feb 20 14:10:44 GMT 2017 */ package org.openecomp.mso.adapters.vnfrest; @@ -8,239 +8,252 @@ package org.openecomp.mso.adapters.vnfrest; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.shaded.org.mockito.Mockito.*; +import static org.evosuite.runtime.MockitoExtension.*; import static org.evosuite.runtime.EvoAssertions.*; - -import org.openecomp.mso.entity.MsoRequest; -import org.openecomp.mso.openstack.beans.VnfRollback; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.ViolatedAssumptionAnswer; import org.junit.runner.RunWith; +import org.openecomp.mso.adapters.vnfrest.VfModuleRollback; +import org.openecomp.mso.entity.MsoRequest; +import org.openecomp.mso.openstack.beans.VnfRollback; -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) public class VfModuleRollbackESTest extends VfModuleRollbackESTestscaffolding { - @Test(timeout = 4000) - public void test00() throws Throwable { - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(); - boolean boolean0 = vfModuleRollback0.isVfModuleCreated(); - assertFalse(boolean0); - } - - @Test(timeout = 4000) - public void test01() throws Throwable { - MsoRequest msoRequest0 = mock(MsoRequest.class, new ViolatedAssumptionAnswer()); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback("", (String) null, "", false, "", "", msoRequest0, ""); - String string0 = vfModuleRollback0.getVnfId(); - assertNotNull(string0); - assertFalse(vfModuleRollback0.isVfModuleCreated()); - } - - @Test(timeout = 4000) - public void test02() throws Throwable { - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(); - vfModuleRollback0.setVfModuleStackId("ORmnn<.2+zb!'teC5"); - vfModuleRollback0.getVfModuleStackId(); - assertFalse(vfModuleRollback0.isVfModuleCreated()); - } - - @Test(timeout = 4000) - public void test03() throws Throwable { - MsoRequest msoRequest0 = mock(MsoRequest.class, new ViolatedAssumptionAnswer()); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback("", (String) null, "", false, "", "", msoRequest0, ""); - String string0 = vfModuleRollback0.getVfModuleStackId(); - assertFalse(vfModuleRollback0.isVfModuleCreated()); - assertNotNull(string0); - } - - @Test(timeout = 4000) - public void test04() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(vnfRollback0, "", "", ""); - String string0 = vfModuleRollback0.getVfModuleId(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test05() throws Throwable { - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(); - vfModuleRollback0.setTenantId("ORmnn<.2+zb!'teC5"); - vfModuleRollback0.getTenantId(); - assertFalse(vfModuleRollback0.isVfModuleCreated()); - } - - @Test(timeout = 4000) - public void test06() throws Throwable { - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(); - vfModuleRollback0.setTenantId(""); - vfModuleRollback0.getTenantId(); - assertFalse(vfModuleRollback0.isVfModuleCreated()); - } - - @Test(timeout = 4000) - public void test07() throws Throwable { - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(); - vfModuleRollback0.getMsoRequest(); - assertFalse(vfModuleRollback0.isVfModuleCreated()); - } - - @Test(timeout = 4000) - public void test08() throws Throwable { - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(); - vfModuleRollback0.getMessageId(); - assertFalse(vfModuleRollback0.isVfModuleCreated()); - } - - @Test(timeout = 4000) - public void test09() throws Throwable { - VnfRollback vnfRollback0 = new VnfRollback(); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(vnfRollback0, "", "", ""); - String string0 = vfModuleRollback0.getMessageId(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test10() throws Throwable { - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(); - vfModuleRollback0.setCloudSiteId("yIF#jVMha"); - vfModuleRollback0.getCloudSiteId(); - assertFalse(vfModuleRollback0.isVfModuleCreated()); - } - - @Test(timeout = 4000) - public void test11() throws Throwable { - VfModuleRollback vfModuleRollback0 = new VfModuleRollback("^4s-K=q)*Tb/", "XG?<}b?*4B", "XG?<}b?*4B", false, "", "", (MsoRequest) null, (String) null); - String string0 = vfModuleRollback0.getCloudSiteId(); - assertEquals("", string0); - assertEquals("XG?<}b?*4B", vfModuleRollback0.getVfModuleId()); - assertEquals("", vfModuleRollback0.getTenantId()); - assertNotNull(string0); - assertEquals("^4s-K=q)*Tb/", vfModuleRollback0.getVnfId()); - assertEquals("XG?<}b?*4B", vfModuleRollback0.getVfModuleStackId()); - assertFalse(vfModuleRollback0.isVfModuleCreated()); - } - - @Test(timeout = 4000) - public void test12() throws Throwable { - VfModuleRollback vfModuleRollback0 = null; - try { - vfModuleRollback0 = new VfModuleRollback((VnfRollback) null, ", tenantCreated=", ", tenantCreated=", ", tenantCreated="); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.adapters.vnfrest.VfModuleRollback", e); - } - } - - @Test(timeout = 4000) - public void test13() throws Throwable { - MsoRequest msoRequest0 = new MsoRequest(); - VnfRollback vnfRollback0 = new VnfRollback("", ", requestType = ", "", true, true, msoRequest0, " .~y_qT", "", ""); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(vnfRollback0, (String) null, (String) null, "TgLE(4jqRR&B*tjC*6"); - boolean boolean0 = vfModuleRollback0.isVfModuleCreated(); - assertTrue(boolean0); - } - - @Test(timeout = 4000) - public void test14() throws Throwable { - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(); - vfModuleRollback0.getVnfId(); - assertFalse(vfModuleRollback0.isVfModuleCreated()); - } - - @Test(timeout = 4000) - public void test15() throws Throwable { - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(); - vfModuleRollback0.getCloudSiteId(); - assertFalse(vfModuleRollback0.isVfModuleCreated()); - } - - @Test(timeout = 4000) - public void test16() throws Throwable { - MsoRequest msoRequest0 = new MsoRequest(); - VnfRollback vnfRollback0 = new VnfRollback("", ", requestType = ", "", true, true, msoRequest0, " .~y_qT", "", ""); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(vnfRollback0, (String) null, (String) null, "TgLE(4jqRR&B*tjC*6"); - MsoRequest msoRequest1 = vfModuleRollback0.getMsoRequest(); - assertNull(msoRequest1.getRequestId()); - } - - @Test(timeout = 4000) - public void test17() throws Throwable { - MsoRequest msoRequest0 = new MsoRequest(); - VnfRollback vnfRollback0 = new VnfRollback("", ", requestType = ", "", true, true, msoRequest0, " .~y_qT", "", ""); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(vnfRollback0, (String) null, (String) null, "TgLE(4jqRR&B*tjC*6"); - vfModuleRollback0.setVfModuleId("TUj9qO3IbhX0v~"); - String string0 = vfModuleRollback0.getVfModuleId(); - assertEquals("TUj9qO3IbhX0v~", string0); - } - - @Test(timeout = 4000) - public void test18() throws Throwable { - MsoRequest msoRequest0 = new MsoRequest(); - VnfRollback vnfRollback0 = new VnfRollback("", ", requestType = ", "", true, true, msoRequest0, " .~y_qT", "", ""); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(vnfRollback0, (String) null, (String) null, "TgLE(4jqRR&B*tjC*6"); - vfModuleRollback0.setMessageId(", tenantCreated="); - assertNull(vfModuleRollback0.getVfModuleId()); - } - - @Test(timeout = 4000) - public void test19() throws Throwable { - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(); - vfModuleRollback0.setVnfId("n+S7/*fyf8oP5jpt#"); - vfModuleRollback0.getVnfId(); - assertFalse(vfModuleRollback0.isVfModuleCreated()); - } - - @Test(timeout = 4000) - public void test20() throws Throwable { - MsoRequest msoRequest0 = new MsoRequest(); - VnfRollback vnfRollback0 = new VnfRollback("", ", requestType = ", "", true, true, msoRequest0, " .~y_qT", "", ""); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(vnfRollback0, (String) null, (String) null, "TgLE(4jqRR&B*tjC*6"); - vfModuleRollback0.setVfModuleCreated(true); - assertTrue(vfModuleRollback0.isVfModuleCreated()); - } - - @Test(timeout = 4000) - public void test21() throws Throwable { - MsoRequest msoRequest0 = new MsoRequest(); - VnfRollback vnfRollback0 = new VnfRollback("", ", requestType = ", "", true, true, msoRequest0, " .~y_qT", "", ""); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(vnfRollback0, (String) null, (String) null, "TgLE(4jqRR&B*tjC*6"); - vfModuleRollback0.setMsoRequest(msoRequest0); - assertEquals(", requestType = ", vfModuleRollback0.getTenantId()); - } - - @Test(timeout = 4000) - public void test22() throws Throwable { - MsoRequest msoRequest0 = new MsoRequest(); - VnfRollback vnfRollback0 = new VnfRollback("", ", requestType = ", "", true, true, msoRequest0, " .~y_qT", "", ""); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(vnfRollback0, (String) null, (String) null, "TgLE(4jqRR&B*tjC*6"); - String string0 = vfModuleRollback0.getMessageId(); - assertEquals("TgLE(4jqRR&B*tjC*6", string0); - } - - @Test(timeout = 4000) - public void test23() throws Throwable { - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(); - vfModuleRollback0.getVfModuleStackId(); - assertFalse(vfModuleRollback0.isVfModuleCreated()); - } - - @Test(timeout = 4000) - public void test24() throws Throwable { - MsoRequest msoRequest0 = new MsoRequest(); - VnfRollback vnfRollback0 = new VnfRollback("", ", requestType = ", "", true, true, msoRequest0, " .~y_qT", "", ""); - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(vnfRollback0, (String) null, (String) null, "TgLE(4jqRR&B*tjC*6"); - String string0 = vfModuleRollback0.getVfModuleId(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test25() throws Throwable { - VfModuleRollback vfModuleRollback0 = new VfModuleRollback(); - vfModuleRollback0.getTenantId(); - assertFalse(vfModuleRollback0.isVfModuleCreated()); - } + @Test(timeout = 4000) + public void test00() throws Throwable { + VnfRollback vnfRollback0 = mock(VnfRollback.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(vnfRollback0).getCloudSiteId(); + doReturn((MsoRequest) null).when(vnfRollback0).getMsoRequest(); + doReturn((String) null).when(vnfRollback0).getTenantId(); + doReturn(false).when(vnfRollback0).getVnfCreated(); + doReturn((String) null).when(vnfRollback0).getVnfId(); + VfModuleRollback vfModuleRollback0 = new VfModuleRollback(vnfRollback0, "Gf(%P^Jj)\u0005JzrF?~", "Gf(%P^Jj)\u0005JzrF?~", "Gf(%P^Jj)\u0005JzrF?~"); + vfModuleRollback0.setVfModuleCreated(true); + boolean boolean0 = vfModuleRollback0.isVfModuleCreated(); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + VfModuleRollback vfModuleRollback0 = new VfModuleRollback(); + vfModuleRollback0.setVnfId("G\"nvy + + + + + + + + + + + + + + + + diff --git a/adapters/mso-catalog-db-adapter/WebContent/WEB-INF/jboss-web.xml b/adapters/mso-catalog-db-adapter/WebContent/WEB-INF/jboss-web.xml new file mode 100644 index 0000000000..2493bdb8b1 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/WebContent/WEB-INF/jboss-web.xml @@ -0,0 +1,3 @@ + + ecomp/mso/catalog + \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/WebContent/WEB-INF/web.xml b/adapters/mso-catalog-db-adapter/WebContent/WEB-INF/web.xml new file mode 100644 index 0000000000..98b6860366 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/WebContent/WEB-INF/web.xml @@ -0,0 +1,49 @@ + + + mso-catalog-db + + + log.configuration + logback.catalog.xml + + + mso.configuration + MSO_PROP_TOPOLOGY=topology.properties + + + resteasy.resources + + org.openecomp.mso.adapters.catalogdb.CatalogDbAdapterRest + + + + Resteasy + org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher + + + Resteasy + /* + + + + LogFilter + org.openecomp.mso.logger.LogFilter + + + LogFilter + /* + + + resteasy.scan + true + + + resteasy.scan.providers + true + + + resteasy.scan.resources + true + + + diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml new file mode 100644 index 0000000000..828edf772d --- /dev/null +++ b/adapters/mso-catalog-db-adapter/pom.xml @@ -0,0 +1,105 @@ + + 4.0.0 + + org.openecomp.mso + adapters + 1.1.0-SNAPSHOT + + + org.openecomp.mso.adapters + mso-catalog-db-adapter + war + + + ${project.artifactId}-${project.version} + + + maven-war-plugin + 2.4 + + WebContent + false + true + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.jvnet.jax-ws-commons + + + jaxws-maven-plugin + + + [2.3,) + + + wsgen + + + + + + + + + + + + + + + + + org.openecomp.mso + mso-catalog-db + ${project.version} + + + org.openecomp.mso.adapters + mso-adapters-rest-interface + ${project.version} + + + + org.jboss.resteasy + resteasy-jaxrs + 3.0.19.Final + provided + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + + + org.apache.httpcomponents + httpclient + + + + + org.openecomp.mso + status-control + ${project.version} + + + + \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org.openecomp.mso/adapters/catalogdb/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org.openecomp.mso/adapters/catalogdb/CatalogDbAdapterRest.java new file mode 100644 index 0000000000..729aaa0f9a --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org.openecomp.mso/adapters/catalogdb/CatalogDbAdapterRest.java @@ -0,0 +1,393 @@ +/*- + * ============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.adapters.catalogdb; + +/* +Create an initial query to retrieve a VNF Resource definition (including a list of possible module types) +within the context of a given service. Input is a vnf resource model customization ID (new field for 1702), +or a composite key (from 1610) of service name, service version, vnf instance name + +Returns a structure (JSON?) containing VNF RESOURCE attributes, plus a list of VF Module structures. + +Query a NETWORK_RESOURCE from the MSO Catalog, based on a networkModelCustomizationUUID (new for 1702), +a network type (unique type identifier in 1610), or based on network role within a service. + +Create Adapter framework for access to Catalog DB, including connection management, +login/password access, transaction logic, etc. This can be modeled after the Request DB Adapter + +Update the MSO Catalog DB schema to include the new fields defined in this user story. + +Note that the resourceModelCustomizationUUID (or vfModuleModelCustomizationUUID) will be unique keys (indexes) +on the VNF_RESOURCE and VF_MODULE tables respectively. +The previously constructed "vnf-type" and "vf-module-type" field may continue to be populated, +but should no longer be needed and can deprecate in future release. + +For migration, a new randomly generated UUID field may be generated for the *ModelCustomizationUUID" fields +until such time that the model is redistributed from ASDC. + +All other fields Check with Mike Z for appropriate value for the vfModuleLabel. +We might be able to derive it's value from the current vnf-type (using the "middle" piece that identifies the module type). + +min and initial counts can be 0. max can be null to indicate no maximum. + +Once the network-level distribution artifacts are defined, similar updates can be made to the NETWORK_RESOURCE table. +*/ + +import java.util.Map; +import java.util.List; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HEAD; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.GenericEntity; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.xml.ws.Holder; + +import org.apache.http.HttpStatus; + +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; +import org.openecomp.mso.adapters.vnfrest.VfModuleExceptionResponse; +import org.openecomp.mso.adapters.catalogrest.QueryServiceVnfs; +import org.openecomp.mso.adapters.catalogrest.QueryServiceNetworks; +import org.openecomp.mso.adapters.catalogrest.QueryServiceMacroHolder; +import org.openecomp.mso.adapters.catalogrest.QueryAllottedResourceCustomization; +import org.openecomp.mso.db.catalog.CatalogDatabase; +import org.openecomp.mso.db.catalog.beans.VnfResource; +import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; +import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder; +import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; + +/** + * This class services calls to the REST interface for VF Modules (http://host:port/ecomp/mso/catalog/v1) + * Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. + * Requests respond synchronously only + */ +@Path("/v1") +public class CatalogDbAdapterRest { + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + + @HEAD + @GET + @Path("healthcheck") + @Produces(MediaType.TEXT_HTML) + public Response healthcheck () { + String CHECK_HTML = "Health CheckApplication ready"; + return Response.ok().entity(CHECK_HTML).build(); + } + + /* + * GET {http-catalog-adapter-root}/v1/serviceVnfs?vnfModelCustomizationUuid= + * URL:http://localhost:8080/ecomp/mso/catalog/v1/getVfModuleType?vnfType=Test/vSAMP10&vfModuleType=vSAMP10::base::module-0 + * RESP: + * {"queryVfModule":{"version":1,"asdcUuid":"MANUAL RECORD","created":{"nanos":0},"description":"vSAMP10","environmentId":15184,"id":2312,"isBase":1,"modelName":"vSAMP10::base::module-0","modelVersion":1,"templateId":15123,"type":"Test\/vSAMP10::vSAMP10::base::module-0","vnfResourceId":15187}} + */ + @GET + @Path("serviceVnfs") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public Response serviceVnfs( + @QueryParam("vnfModelCustomizationUuid") String vnfUuid, + @QueryParam("serviceModelUuid") String smUuid, + @QueryParam("serviceModelInvariantUuid") String smiUuid, + @QueryParam("serviceModelVersion") String smVer, + @QueryParam("serviceModelName") String smName + ) { + QueryServiceVnfs qryResp; + int respStatus = HttpStatus.SC_OK; + String uuid = ""; + List ret; + + try { + + if (vnfUuid != null && !vnfUuid.equals("")) { + uuid = vnfUuid; + LOGGER.debug ("Query serviceVnfs getAllVnfsByVnfModelCustomizationUuid vnfModelCustomizationUuid: " + uuid); + ret = (new CatalogDatabase ()).getAllVnfsByVnfModelCustomizationUuid(uuid); + } + else if (smUuid != null && !smUuid.equals("")) { + uuid = smUuid; + LOGGER.debug ("Query serviceVnfs getAllVnfsByServiceModelUuid serviceModelUuid: " + uuid); + ret = (new CatalogDatabase ()).getAllVnfsByServiceModelUuid(uuid); + } + else if (smiUuid != null && !smiUuid.equals("")) { + uuid = smiUuid; + if (smVer != null && !smVer.equals("")) { + LOGGER.debug ("Query serviceVnfs getAllNetworksByServiceModelInvariantUuid serviceModelInvariantUuid: " + uuid+ " serviceModelVersion: "+ smVer); + ret = (new CatalogDatabase ()).getAllVnfsByServiceModelInvariantUuid(uuid, smVer); + } + else { + LOGGER.debug ("Query serviceVnfs getAllNetworksByServiceModelInvariantUuid serviceModelUuid: " + uuid); + ret = (new CatalogDatabase ()).getAllVnfsByServiceModelInvariantUuid(uuid); + } + } + else if (smName != null && !smName.equals("")) { + if (smVer != null && !smVer.equals("")) { + LOGGER.debug ("Query serviceVnfs getAllVnfsByServiceName serviceModelInvariantName: " + smName+ " serviceModelVersion: "+ smVer); + ret = (new CatalogDatabase ()).getAllVnfsByServiceName(smName, smVer); + } + else { + LOGGER.debug ("Query serviceVnfs getAllVnfsByServiceName serviceModelName: " + smName); + ret = (new CatalogDatabase ()).getAllVnfsByServiceName(smName); + } + } + else { + throw(new Exception("no matching parameters")); + } + + if (ret == null || ret.isEmpty()) { + LOGGER.debug ("serviceVnfs not found"); + respStatus = HttpStatus.SC_NOT_FOUND; + qryResp = new QueryServiceVnfs(); + } else { + LOGGER.debug ("serviceVnfs found"); + qryResp = new QueryServiceVnfs(ret); + LOGGER.debug ("serviceVnfs qryResp="+ qryResp); + LOGGER.debug ("serviceVnfs tojsonstring="+ qryResp.toJsonString()); + } + LOGGER.debug ("Query serviceVnfs exit"); + return Response + .status(respStatus) + //.entity(new GenericEntity(qryResp) {}) + .entity(qryResp.toJsonString()) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + } catch (Exception e) { + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryServiceVnfs", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryServiceVnfs", e); + VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity(excResp) {}) + .build(); + } + } + + @GET + @Path("serviceNetworks") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public Response serviceNetworks ( + @QueryParam("networkModelCustomizationUuid") String nUuid, + @QueryParam("networkType") String nType, + @QueryParam("serviceModelUuid") String smUuid, + @QueryParam("serviceModelInvariantUuid") String smiUuid, + @QueryParam("serviceModelVersion") String smVer + ) { + QueryServiceNetworks qryResp; + int respStatus = HttpStatus.SC_OK; + String uuid = ""; + List ret; + + try { + if (nUuid != null && !nUuid.equals("")) { + uuid = nUuid; + LOGGER.debug ("Query serviceNetworks getAllNetworksByNetworkModelCustomizationUuid networkModelCustomizationUuid: " + uuid); + ret = (new CatalogDatabase ()).getAllNetworksByNetworkModelCustomizationUuid(uuid); + } + else if (smUuid != null && !smUuid.equals("")) { + uuid = smUuid; + LOGGER.debug ("Query serviceNetworks getAllNetworksByServiceModelUuid serviceModelUuid: " + uuid); + ret = (new CatalogDatabase ()).getAllNetworksByServiceModelUuid(uuid); + } + else if (nType != null && !nType.equals("")) { + uuid = nType; + LOGGER.debug ("Query serviceNetworks getAllNetworksByNetworkType serviceModelUuid: " + uuid); + ret = (new CatalogDatabase ()).getAllNetworksByNetworkType(uuid); + } + else if (smiUuid != null && !smiUuid.equals("")) { + uuid = smiUuid; + if (smVer != null && !smVer.equals("")) { + LOGGER.debug ("Query serviceNetworks getAllNetworksByServiceModelInvariantUuid serviceModelInvariantUuid: " + uuid+ " serviceModelVersion: "+ smVer); + ret = (new CatalogDatabase ()).getAllNetworksByServiceModelInvariantUuid(uuid, smVer); + } + else { + LOGGER.debug ("Query serviceNetworks getAllNetworksByServiceModelInvariantUuid serviceModelUuid: " + uuid); + ret = (new CatalogDatabase ()).getAllNetworksByServiceModelInvariantUuid(uuid); + } + } + else { + throw(new Exception("no matching parameters")); + } + + if (ret == null || ret.isEmpty()) { + LOGGER.debug ("serviceNetworks not found"); + respStatus = HttpStatus.SC_NOT_FOUND; + qryResp = new QueryServiceNetworks(); + } else { + LOGGER.debug ("serviceNetworks found"); + qryResp = new QueryServiceNetworks(ret); + LOGGER.debug ("serviceNetworks qryResp="+ qryResp); + LOGGER.debug ("serviceNetworks tojsonstring="+ qryResp.toJsonString()); + } + LOGGER.debug ("Query serviceNetworks exit"); + return Response + .status(respStatus) + //.entity(new GenericEntity(qryResp) {}) + .entity(qryResp.toJsonString()) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + } catch (Exception e) { + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryServiceNetworks", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryServiceNetworks", e); + VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity(excResp) {}) + .build(); + } + } + + @GET + @Path("serviceResources") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public Response serviceResources( + @QueryParam("serviceModelUuid") String smUuid, + @QueryParam("serviceModelInvariantUuid") String smiUuid, + @QueryParam("serviceModelVersion") String smVer + ) { + QueryServiceMacroHolder qryResp; + int respStatus = HttpStatus.SC_OK; + String uuid = ""; + ServiceMacroHolder ret; + + try { + + if (smUuid != null && !smUuid.equals("")) { + uuid = smUuid; + LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelUuid serviceModelUuid: " + uuid); + ret = (new CatalogDatabase ()).getAllResourcesByServiceModelUuid(uuid); + } + else if (smiUuid != null && !smiUuid.equals("")) { + uuid = smiUuid; + if (smVer != null && !smVer.equals("")) { + LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: " + uuid+ " serviceModelVersion: "+ smVer); + ret = (new CatalogDatabase ()).getAllResourcesByServiceModelInvariantUuid(uuid, smVer); + } + else { + LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelUuid: " + uuid); + ret = (new CatalogDatabase ()).getAllResourcesByServiceModelInvariantUuid(uuid); + } + } + else { + throw(new Exception("no matching parameters")); + } + + if (ret == null) { + LOGGER.debug ("serviceMacroHolder not found"); + respStatus = HttpStatus.SC_NOT_FOUND; + qryResp = new QueryServiceMacroHolder(); + } else { + LOGGER.debug ("serviceMacroHolder found"); + qryResp = new QueryServiceMacroHolder(ret); + LOGGER.debug ("serviceMacroHolder qryResp="+ qryResp); + LOGGER.debug ("serviceMacroHolder tojsonstring="+ qryResp.toJsonString()); + } + LOGGER.debug ("Query serviceMacroHolder exit"); + return Response + .status(respStatus) + //.entity(new GenericEntity(qryResp) {}) + .entity(qryResp.toJsonString()) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + } catch (Exception e) { + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryServiceMacroHolder", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryServiceMacroHolder", e); + VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity(excResp) {}) + .build(); + } + } + + @GET + @Path("serviceAllottedResources") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public Response serviceAllottedResources( + @QueryParam("serviceModelUuid") String smUuid, + @QueryParam("serviceModelInvariantUuid") String smiUuid, + @QueryParam("serviceModelVersion") String smVer, + @QueryParam("arModelCustomizationUuid") String aUuid + ) { + QueryAllottedResourceCustomization qryResp; + int respStatus = HttpStatus.SC_OK; + String uuid = ""; + List ret; + + try { + + if (smUuid != null && !smUuid.equals("")) { + uuid = smUuid; + LOGGER.debug ("Query AllottedResourceCustomization getAllAllottedResourcesByServiceModelUuid serviceModelUuid: " + uuid); + ret = (new CatalogDatabase ()).getAllAllottedResourcesByServiceModelUuid(uuid); + } + else if (smiUuid != null && !smiUuid.equals("")) { + uuid = smiUuid; + if (smVer != null && !smVer.equals("")) { + LOGGER.debug ("Query AllottedResourceCustomization getAllAllottedResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: " + uuid+ " serviceModelVersion: "+ smVer); + ret = (new CatalogDatabase ()).getAllAllottedResourcesByServiceModelInvariantUuid(uuid, smVer); + } + else { + LOGGER.debug ("Query AllottedResourceCustomization getAllAllottedResourcesByServiceModelInvariantUuid serviceModelUuid: " + uuid); + ret = (new CatalogDatabase ()).getAllAllottedResourcesByServiceModelInvariantUuid(uuid); + } + } + else if (aUuid != null && !aUuid.equals("")) { + uuid = aUuid; + LOGGER.debug ("Query AllottedResourceCustomization getAllAllottedResourcesByArModelCustomizationUuid serviceModelUuid: " + uuid); + ret = (new CatalogDatabase ()).getAllAllottedResourcesByArModelCustomizationUuid(uuid); + } + else { + throw(new Exception("no matching parameters")); + } + + if (ret == null || ret.isEmpty()) { + LOGGER.debug ("AllottedResourceCustomization not found"); + respStatus = HttpStatus.SC_NOT_FOUND; + qryResp = new QueryAllottedResourceCustomization(); + } else { + LOGGER.debug ("AllottedResourceCustomization found"); + qryResp = new QueryAllottedResourceCustomization(ret); + LOGGER.debug ("AllottedResourceCustomization qryResp="+ qryResp); + LOGGER.debug ("AllottedResourceCustomization tojsonstring="+ qryResp.toJsonString()); + } + LOGGER.debug ("Query AllottedResourceCustomization exit"); + return Response + .status(respStatus) + //.entity(new GenericEntity(qryResp) {}) + .entity(qryResp.toJsonString()) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + } catch (Exception e) { + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryAllottedResourceCustomization", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryAllottedResourceCustomization", e); + VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity(excResp) {}) + .build(); + } + } +} \ No newline at end of file diff --git a/adapters/mso-network-adapter-async-client/pom.xml b/adapters/mso-network-adapter-async-client/pom.xml index a8b96154af..e1ed626f7e 100644 --- a/adapters/mso-network-adapter-async-client/pom.xml +++ b/adapters/mso-network-adapter-async-client/pom.xml @@ -52,7 +52,7 @@ - org.eclipse.m2e @@ -87,4 +87,5 @@
+ diff --git a/adapters/mso-network-adapter-async-client/src/main/resources/NetworkAdapterNotify.wsdl b/adapters/mso-network-adapter-async-client/src/main/resources/NetworkAdapterNotify.wsdl index fe5346da49..ae3c31b625 100644 --- a/adapters/mso-network-adapter-async-client/src/main/resources/NetworkAdapterNotify.wsdl +++ b/adapters/mso-network-adapter-async-client/src/main/resources/NetworkAdapterNotify.wsdl @@ -1,8 +1,8 @@ - + - + @@ -218,24 +218,24 @@ - - + + - - + + - - + + - - + + - - + + diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java index dcd12d24e7..4218ad8d2f 100644 --- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java +++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java @@ -7,9 +7,9 @@ * 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. @@ -239,7 +239,10 @@ public class BpelRestClient { LOGGER.debug("Sending to BPEL server: "+bpelUrl); LOGGER.debug("Content is: "+toBpelStr); - //POST + //Client 4.3+ + CloseableHttpClient client = HttpClients.createDefault(); + + //POST HttpPost post = new HttpPost(bpelUrl); if (credentials != null && !credentials.isEmpty()) post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(credentials.getBytes())); @@ -258,8 +261,8 @@ public class BpelRestClient { //Client 4.3+ //Execute & GetResponse - try (CloseableHttpClient client = HttpClients.createDefault(); - CloseableHttpResponse response = client.execute(post)) { + try { + CloseableHttpResponse response = client.execute(post); if (response != null) { lastResponseCode = response.getStatusLine().getStatusCode(); HttpEntity entity = response.getEntity(); @@ -273,32 +276,15 @@ public class BpelRestClient { LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, error, "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Exception sending Bpel notification", e); lastResponseCode = 900; lastResponse = ""; + } finally { + try { + client.close(); + } catch (IOException e) { + // ignore + } } LOGGER.debug("Response code from BPEL server: "+lastResponseCode); LOGGER.debug("Response body is: "+lastResponse); } - public static void main(String[] a) throws MsoPropertiesException { - final String bpelengine = "http://mtmac1.research.att.com:8080/catch.jsp"; - final String propfile = "/tmp/mso.vnf.properties"; - // "/Users/eby/src/mso.rest/mso/packages/mso-config-centralized/mso-po-adapter-config/mso.vnf.properties" - final String xml = - "" + - "1464013300723" + - "clyde10" + - "wayne99" + - "mickey7" + - ""; - - MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); - msoPropertiesFactory.initializeMsoProperties (MSO_PROP_NETWORK_ADAPTER, propfile); - - BpelRestClient bc = new BpelRestClient(); - System.out.println(bc.getRetryList()); - System.out.println(bc.getCredentials()); // poAvos:Domain2.0! - - bc.bpelPost(xml, bpelengine, true); - System.out.println("respcode = "+bc.getLastResponseCode()); - System.out.println("resp = "+bc.getLastResponse()); - } } diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapter.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapter.java index 4960877b8a..4f6fc3ca7f 100644 --- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapter.java +++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapter.java @@ -37,7 +37,7 @@ import org.openecomp.mso.openstack.beans.NetworkRollback; import org.openecomp.mso.openstack.beans.NetworkStatus; import org.openecomp.mso.openstack.beans.Subnet; -@WebService (name="NetworkAdapter", targetNamespace="http://com.att.mso/network") +@WebService (name="NetworkAdapter", targetNamespace="http://org.openecomp.mso/network") public interface MsoNetworkAdapter { // TODO: Rename all of these to include Vlan in the service name? At least for the diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsync.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsync.java index e79ba125e2..99394f2256 100644 --- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsync.java +++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsync.java @@ -38,7 +38,7 @@ import java.util.List; * (by the client service WSDL). * */ -@WebService (name="NetworkAdapterAsync", targetNamespace="http://com.att.mso/networkA") +@WebService (name="NetworkAdapterAsync", targetNamespace="http://org.openecomp.mso/networkA") public interface MsoNetworkAdapterAsync { /** diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java index 75cbc636cc..11b16365d9 100644 --- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -53,7 +53,7 @@ import org.openecomp.mso.openstack.beans.Subnet; import org.openecomp.mso.properties.MsoPropertiesFactory; -@WebService(serviceName = "NetworkAdapterAsync", endpointInterface = "org.openecomp.mso.adapters.network.MsoNetworkAdapterAsync", targetNamespace = "http://com.att.mso/networkA") +@WebService(serviceName = "NetworkAdapterAsync", endpointInterface = "org.openecomp.mso.adapters.network.MsoNetworkAdapterAsync", targetNamespace = "http://org.openecomp.mso/networkA") public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory(); @@ -584,7 +584,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { } NetworkAdapterNotify_Service notifySvc = new NetworkAdapterNotify_Service (warWsdlLoc, - new QName ("http://com.att.mso/networkNotify", + new QName ("http://org.openecomp.mso/networkNotify", "networkAdapterNotify")); NetworkAdapterNotify notifyPort = notifySvc.getMsoNetworkAdapterAsyncImplPort (); diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java index 97624dae30..c1c351916c 100644 --- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java @@ -7,9 +7,9 @@ * 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. @@ -64,7 +64,7 @@ import org.openecomp.mso.properties.MsoPropertiesFactory; import static org.openecomp.mso.openstack.utils.MsoCommonUtils.isNullOrEmpty; -@WebService(serviceName = "NetworkAdapter", endpointInterface = "org.openecomp.mso.adapters.network.MsoNetworkAdapter", targetNamespace = "http://com.att.mso/network") +@WebService(serviceName = "NetworkAdapter", endpointInterface = "org.openecomp.mso.adapters.network.MsoNetworkAdapter", targetNamespace = "http://org.openecomp.mso/network") public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory(); @@ -281,7 +281,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { throw new NetworkException (error, MsoExceptionCategory.USERDATA); } - try (CatalogDatabase db = getCatalogDb()) { + // Get a handle to the Catalog Database + CatalogDatabase db = getCatalogDB (); + + // Make sure DB connection is always closed + try { NetworkResource networkResource = networkCheck (db, startTime, networkType, @@ -387,7 +391,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Use an MsoHeatUtils for all Heat commands MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_NETWORK_ADAPTER, msoPropertiesFactory,cloudConfigFactory); - + HeatTemplate heatTemplate = db.getHeatTemplate (networkResource.getTemplateId ()); if (heatTemplate == null) { String error = "Network error - undefined Heat Template. Network Type = " + networkType; @@ -401,11 +405,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.toString ()); - + // "Fix" the template if it has CR/LF (getting this from Oracle) String template = heatTemplate.getHeatTemplate (); template = template.replaceAll ("\r\n", "\n"); - + boolean aic3template=false; String aic3nw = AIC3_NW; try { @@ -414,10 +418,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { String error = "Unable to get properties:" + MSO_PROP_NETWORK_ADAPTER; LOGGER.error (MessageEnum.RA_CONFIG_EXC, error, "", "", MsoLogger.ErrorCode.DataError, "Exception - Unable to get properties", e); } - + if (template.contains(aic3nw)) aic3template = true; - + // First, look up to see if the Network already exists (by name). // For HEAT orchestration of networks, the stack name will always match the network name StackInfo heatStack = null; @@ -466,14 +470,14 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (outputs != null) { for (String key : outputs.keySet ()) { if (key != null && key.startsWith ("subnet")) { - if (aic3template) //one subnet_id output + if (aic3template) //one subnet_id output { - Map map = getSubnetUUId(key, outputs, subnets); + Map map = getSubnetUUId(key, outputs, subnets); sMap.putAll(map); } else //multiples subnet_%aaid% outputs { - String subnetUUId = (String) outputs.get(key); + String subnetUUId = (String) outputs.get(key); sMap.put (key.substring("subnet_id_".length()), subnetUUId); } } @@ -494,7 +498,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { physicalNetworkName, vlans, routeTargets, - shared, + shared, external, aic3template); @@ -557,7 +561,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { throw new NetworkException (me); } } - + if (routeTableFqdns != null && !routeTableFqdns.isEmpty() && aic3template) { try { mergeRouteTableRefs (routeTableFqdns, stackParams); @@ -624,12 +628,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (key != null && key.startsWith ("subnet")) { if (aic3template) //one subnet output expected { - Map map = getSubnetUUId(key, outputs, subnets); + Map map = getSubnetUUId(key, outputs, subnets); sMap.putAll(map); } else //multiples subnet_%aaid% outputs allowed { - String subnetUUId = (String) outputs.get(key); + String subnetUUId = (String) outputs.get(key); sMap.put (key.substring("subnet_id_".length()), subnetUUId); } } @@ -646,6 +650,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { LOGGER.debug ("Network " + networkName + " successfully created via HEAT"); } + } finally { + db.close (); } LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Suc, "Successfully created network"); return; @@ -792,295 +798,295 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { throw new NetworkException (error, MsoExceptionCategory.USERDATA); } - try(CatalogDatabase db = getCatalogDb()) { - NetworkResource networkResource = networkCheck (db, - startTime, - networkType, - networkName, - physicalNetworkName, - vlans, - routeTargets, - cloudSite); - String mode = networkResource.getOrchestrationMode (); - NetworkType neutronNetworkType = NetworkType.valueOf (networkResource.getNeutronNetworkType ()); + // Get a handle to the Catalog Database + CatalogDatabase db = getCatalogDB (); + + // Make sure DB connection is always closed + try { + NetworkResource networkResource = networkCheck(db, + startTime, + networkType, + networkName, + physicalNetworkName, + vlans, + routeTargets, + cloudSite); + String mode = networkResource.getOrchestrationMode(); + NetworkType neutronNetworkType = NetworkType.valueOf(networkResource.getNeutronNetworkType()); // Use an MsoNeutronUtils for all Neutron commands - MsoNeutronUtils neutron = new MsoNeutronUtils (MSO_PROP_NETWORK_ADAPTER, cloudConfigFactory); + MsoNeutronUtils neutron = new MsoNeutronUtils(MSO_PROP_NETWORK_ADAPTER, cloudConfigFactory); - if (NEUTRON_MODE.equals (mode)) { + if (NEUTRON_MODE.equals(mode)) { // Verify that the Network exists // For Neutron-based orchestration, the networkId is the Neutron Network UUID. NetworkInfo netInfo = null; - long queryNetworkStarttime = System.currentTimeMillis (); + long queryNetworkStarttime = System.currentTimeMillis(); try { - netInfo = neutron.queryNetwork (networkId, tenantId, cloudSiteId); - LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryNetwork", null); + netInfo = neutron.queryNetwork(networkId, tenantId, cloudSiteId); + LOGGER.recordMetricEvent(queryNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryNetwork", null); } catch (MsoException me) { - me.addContext (UPDATE_NETWORK_CONTEXT); - String error = "Update Network (neutron): query " + networkId - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.recordMetricEvent (queryNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryNetwork", null); - LOGGER.error (MessageEnum.RA_QUERY_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "QueryNetwork", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryNetwork", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); - throw new NetworkException (me); + me.addContext(UPDATE_NETWORK_CONTEXT); + String error = "Update Network (neutron): query " + networkId + + " in " + + cloudSiteId + + "/" + + tenantId + + ": " + + me; + LOGGER.recordMetricEvent(queryNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryNetwork", null); + LOGGER.error(MessageEnum.RA_QUERY_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "QueryNetwork", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryNetwork", me); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + throw new NetworkException(me); } if (netInfo == null) { String error = "Update Nework: Network " + networkId - + " does not exist in " - + cloudSiteId - + "/" - + tenantId; - LOGGER.error (MessageEnum.RA_NETWORK_NOT_FOUND, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Network not found"); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); + + " does not exist in " + + cloudSiteId + + "/" + + tenantId; + LOGGER.error(MessageEnum.RA_NETWORK_NOT_FOUND, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Network not found"); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); // Does not exist. Throw an exception (can't update a non-existent network) throw new NetworkException(error, MsoExceptionCategory.USERDATA); } - long updateNetworkStarttime = System.currentTimeMillis (); + long updateNetworkStarttime = System.currentTimeMillis(); try { - netInfo = neutron.updateNetwork (cloudSiteId, - tenantId, - networkId, - neutronNetworkType, - physicalNetworkName, - vlans); - LOGGER.recordMetricEvent (updateNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "UpdateNetwork", null); + netInfo = neutron.updateNetwork(cloudSiteId, + tenantId, + networkId, + neutronNetworkType, + physicalNetworkName, + vlans); + LOGGER.recordMetricEvent(updateNetworkStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "UpdateNetwork", null); } catch (MsoException me) { - me.addContext (UPDATE_NETWORK_CONTEXT); + me.addContext(UPDATE_NETWORK_CONTEXT); String error = "Update Network (neutron): " + networkId - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.error (MessageEnum.RA_UPDATE_NETWORK_ERR, networkId, cloudSiteId, tenantId, "Openstack", "updateNetwork", MsoLogger.ErrorCode.DataError, "Exception - updateNetwork", me); - LOGGER.recordMetricEvent (updateNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "UpdateNetwork", null); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); - throw new NetworkException (me); + + " in " + + cloudSiteId + + "/" + + tenantId + + ": " + + me; + LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, networkId, cloudSiteId, tenantId, "Openstack", "updateNetwork", MsoLogger.ErrorCode.DataError, "Exception - updateNetwork", me); + LOGGER.recordMetricEvent(updateNetworkStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "UpdateNetwork", null); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + throw new NetworkException(me); } // Add the network ID and previously queried vlans to the rollback object - networkRollback.setNetworkId (netInfo.getId ()); - networkRollback.setNeutronNetworkId (netInfo.getId ()); - networkRollback.setNetworkType (networkType); + networkRollback.setNetworkId(netInfo.getId()); + networkRollback.setNeutronNetworkId(netInfo.getId()); + networkRollback.setNetworkType(networkType); // Save previous parameters - networkRollback.setNetworkName (netInfo.getName ()); - networkRollback.setPhysicalNetwork (netInfo.getProvider ()); - networkRollback.setVlans (netInfo.getVlans ()); + networkRollback.setNetworkName(netInfo.getName()); + networkRollback.setPhysicalNetwork(netInfo.getProvider()); + networkRollback.setVlans(netInfo.getVlans()); - LOGGER.debug ("Network " + networkId + " updated, id = " + netInfo.getId ()); - } else if ("HEAT".equals (mode)) { + LOGGER.debug("Network " + networkId + " updated, id = " + netInfo.getId()); + } else if ("HEAT".equals(mode)) { // Use an MsoHeatUtils for all Heat commands - MsoHeatUtilsWithUpdate heat = new MsoHeatUtilsWithUpdate (MSO_PROP_NETWORK_ADAPTER, msoPropertiesFactory,cloudConfigFactory); + MsoHeatUtilsWithUpdate heat = new MsoHeatUtilsWithUpdate(MSO_PROP_NETWORK_ADAPTER, msoPropertiesFactory, cloudConfigFactory); // First, look up to see that the Network already exists. // For Heat-based orchestration, the networkId is the network Stack ID. StackInfo heatStack = null; - long queryStackStarttime = System.currentTimeMillis (); + long queryStackStarttime = System.currentTimeMillis(); try { - heatStack = heat.queryStack (cloudSiteId, tenantId, networkName); - LOGGER.recordMetricEvent (queryStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", null); + heatStack = heat.queryStack(cloudSiteId, tenantId, networkName); + LOGGER.recordMetricEvent(queryStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", null); } catch (MsoException me) { - me.addContext (UPDATE_NETWORK_CONTEXT); + me.addContext(UPDATE_NETWORK_CONTEXT); String error = "UpdateNetwork (heat): query " + networkName - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.recordMetricEvent (queryStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null); - LOGGER.error (MessageEnum.RA_QUERY_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Exception - QueryStack", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); - throw new NetworkException (me); + + " in " + + cloudSiteId + + "/" + + tenantId + + ": " + + me; + LOGGER.recordMetricEvent(queryStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null); + LOGGER.error(MessageEnum.RA_QUERY_NETWORK_EXC, networkId, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Exception - QueryStack", me); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + throw new NetworkException(me); } - if (heatStack == null || (heatStack.getStatus () == HeatStatus.NOTFOUND)) { + if (heatStack == null || (heatStack.getStatus() == HeatStatus.NOTFOUND)) { String error = "UpdateNetwork: Stack " + networkName - + " does not exist in " - + cloudSiteId - + "/" - + tenantId; - LOGGER.error (MessageEnum.RA_NETWORK_NOT_FOUND, networkId, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Network not found"); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); + + " does not exist in " + + cloudSiteId + + "/" + + tenantId; + LOGGER.error(MessageEnum.RA_NETWORK_NOT_FOUND, networkId, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Network not found"); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); // Network stack does not exist. Return an error throw new NetworkException(error, MsoExceptionCategory.USERDATA); } // Get the previous parameters for rollback - Map heatParams = heatStack.getParameters (); + Map heatParams = heatStack.getParameters(); - String previousNetworkName = (String) heatParams.get ("network_name"); - String previousPhysicalNetwork = (String) heatParams.get (PHYSICAL_NETWORK); + String previousNetworkName = (String) heatParams.get("network_name"); + String previousPhysicalNetwork = (String) heatParams.get(PHYSICAL_NETWORK); - List previousVlans = new ArrayList (); - String vlansParam = (String) heatParams.get (VLANS); + List previousVlans = new ArrayList(); + String vlansParam = (String) heatParams.get(VLANS); if (vlansParam != null) { - for (String vlan : vlansParam.split (",")) { + for (String vlan : vlansParam.split(",")) { try { - previousVlans.add (Integer.parseInt (vlan)); + previousVlans.add(Integer.parseInt(vlan)); } catch (NumberFormatException e) { - LOGGER.warn (MessageEnum.RA_VLAN_PARSE, networkId, vlansParam, "", "", MsoLogger.ErrorCode.DataError, "Exception - VLAN parse", e); + LOGGER.warn(MessageEnum.RA_VLAN_PARSE, networkId, vlansParam, "", "", MsoLogger.ErrorCode.DataError, "Exception - VLAN parse", e); } } } - LOGGER.debug ("Update Stack: Previous VLANS: " + previousVlans); + LOGGER.debug("Update Stack: Previous VLANS: " + previousVlans); // Ready to deploy the updated Network via Heat - HeatTemplate heatTemplate = db.getHeatTemplate (networkResource.getTemplateId ()); + HeatTemplate heatTemplate = db.getHeatTemplate(networkResource.getTemplateId()); if (heatTemplate == null) { String error = "Network error - undefined Heat Template. Network Type=" + networkType; - LOGGER.error (MessageEnum.RA_PARAM_NOT_FOUND, "Heat Template", "Network Type", networkType, "OpenStack", "getHeatTemplate", MsoLogger.ErrorCode.DataError, "Network error - undefined Heat Template. Network Type=" + networkType); - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); - throw new NetworkException (error, MsoExceptionCategory.INTERNAL); + LOGGER.error(MessageEnum.RA_PARAM_NOT_FOUND, "Heat Template", "Network Type", networkType, "OpenStack", "getHeatTemplate", MsoLogger.ErrorCode.DataError, "Network error - undefined Heat Template. Network Type=" + networkType); + alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); + throw new NetworkException(error, MsoExceptionCategory.INTERNAL); } - LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.toString ()); - + LOGGER.debug("Got HEAT Template from DB: " + heatTemplate.toString()); + // "Fix" the template if it has CR/LF (getting this from Oracle) - String template = heatTemplate.getHeatTemplate (); - template = template.replaceAll ("\r\n", "\n"); - - boolean aic3template=false; + String template = heatTemplate.getHeatTemplate(); + template = template.replaceAll("\r\n", "\n"); + + boolean aic3template = false; String aic3nw = AIC3_NW; try { - aic3nw = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_NETWORK_ADAPTER).getProperty(AIC3_NW_PROPERTY, AIC3_NW); - } catch (MsoPropertiesException e) { - String error = "Unable to get properties:" + MSO_PROP_NETWORK_ADAPTER; - LOGGER.error (MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - Unable to get properties", e); - } + aic3nw = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_NETWORK_ADAPTER).getProperty(AIC3_NW_PROPERTY, AIC3_NW); + } catch (MsoPropertiesException e) { + String error = "Unable to get properties:" + MSO_PROP_NETWORK_ADAPTER; + LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - Unable to get properties", e); + } if (template.contains(aic3nw)) - aic3template = true; + aic3template = true; // Build the common set of HEAT template parameters - Map stackParams = populateNetworkParams (neutronNetworkType, - networkName, - physicalNetworkName, - vlans, - routeTargets, - shared, - external, - aic3template); + Map stackParams = populateNetworkParams(neutronNetworkType, + networkName, + physicalNetworkName, + vlans, + routeTargets, + shared, + external, + aic3template); // Validate (and update) the input parameters against the DB definition // Shouldn't happen unless DB config is wrong, since all networks use same inputs try { - stackParams = heat.validateStackParams (stackParams, heatTemplate); + stackParams = heat.validateStackParams(stackParams, heatTemplate); } catch (IllegalArgumentException e) { String error = "UpdateNetwork: Configuration Error: Network Type=" + networkType; - LOGGER.error (MessageEnum.RA_CONFIG_EXC, "Network Type=" + networkType, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork: Configuration Error"); - alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, error); - throw new NetworkException (error, MsoExceptionCategory.INTERNAL, e); + LOGGER.error(MessageEnum.RA_CONFIG_EXC, "Network Type=" + networkType, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork: Configuration Error"); + alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, error); + throw new NetworkException(error, MsoExceptionCategory.INTERNAL, e); } if (subnets != null) { try { - if (aic3template) - { - template = mergeSubnetsAIC3 (template, subnets, stackParams); - } - else - { - template = mergeSubnets (template, subnets); - } + if (aic3template) { + template = mergeSubnetsAIC3(template, subnets, stackParams); + } else { + template = mergeSubnets(template, subnets); + } } catch (MsoException me) { - me.addContext (UPDATE_NETWORK_CONTEXT); + me.addContext(UPDATE_NETWORK_CONTEXT); String error = "Update Network (heat): type " + neutronNetworkType - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.error (MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork mergeSubnets ", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error); - throw new NetworkException (me); + + " in " + + cloudSiteId + + "/" + + tenantId + + ": " + + me; + LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork mergeSubnets ", me); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error); + throw new NetworkException(me); } } if (policyFqdns != null && aic3template) { try { - mergePolicyRefs (policyFqdns, stackParams); + mergePolicyRefs(policyFqdns, stackParams); } catch (MsoException me) { - me.addContext (UPDATE_NETWORK_CONTEXT); - String error = "UpdateNetwork (heat) mergePolicyRefs type " + neutronNetworkType - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.error (MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork mergePolicyRefs", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error); - throw new NetworkException (me); + me.addContext(UPDATE_NETWORK_CONTEXT); + String error = "UpdateNetwork (heat) mergePolicyRefs type " + neutronNetworkType + + " in " + + cloudSiteId + + "/" + + tenantId + + ": " + + me; + LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork mergePolicyRefs", me); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error); + throw new NetworkException(me); } } - + if (routeTableFqdns != null && !routeTableFqdns.isEmpty() && aic3template) { try { - mergeRouteTableRefs (routeTableFqdns, stackParams); + mergeRouteTableRefs(routeTableFqdns, stackParams); } catch (MsoException me) { - me.addContext (UPDATE_NETWORK_CONTEXT); - String error = "UpdateNetwork (heat) mergeRouteTableRefs type " + neutronNetworkType - + " in " - + cloudSiteId - + "/" - + tenantId - + ": " - + me; - LOGGER.error (MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork mergeRouteTableRefs", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error); - throw new NetworkException (me); + me.addContext(UPDATE_NETWORK_CONTEXT); + String error = "UpdateNetwork (heat) mergeRouteTableRefs type " + neutronNetworkType + + " in " + + cloudSiteId + + "/" + + tenantId + + ": " + + me; + LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, neutronNetworkType.toString(), cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - UpdateNetwork mergeRouteTableRefs", me); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error); + throw new NetworkException(me); } } - + // Update the network stack // Ignore MsoStackNotFound exception because we already checked. - long updateStackStarttime = System.currentTimeMillis (); + long updateStackStarttime = System.currentTimeMillis(); try { - heatStack = heat.updateStack (cloudSiteId, - tenantId, - networkId, - template, - stackParams, - true, - heatTemplate.getTimeoutMinutes ()); - LOGGER.recordMetricEvent (updateStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "UpdateStack", null); + heatStack = heat.updateStack(cloudSiteId, + tenantId, + networkId, + template, + stackParams, + true, + heatTemplate.getTimeoutMinutes()); + LOGGER.recordMetricEvent(updateStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "UpdateStack", null); } catch (MsoException me) { - me.addContext (UPDATE_NETWORK_CONTEXT); + me.addContext(UPDATE_NETWORK_CONTEXT); String error = "Update Network: " + networkId + " in " + cloudSiteId + "/" + tenantId + ": " + me; - LOGGER.recordMetricEvent (updateStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "UpdateStack", null); - LOGGER.error (MessageEnum.RA_UPDATE_NETWORK_ERR, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - update network", me); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); - throw new NetworkException (me); + LOGGER.recordMetricEvent(updateStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "UpdateStack", null); + LOGGER.error(MessageEnum.RA_UPDATE_NETWORK_ERR, networkId, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - update network", me); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + throw new NetworkException(me); } - Map outputs = heatStack.getOutputs (); - Map sMap = new HashMap (); + Map outputs = heatStack.getOutputs(); + Map sMap = new HashMap(); if (outputs != null) { - for (String key : outputs.keySet ()) { - if (key != null && key.startsWith ("subnet")) { - if (aic3template) //one subnet output expected - { - Map map = getSubnetUUId(key, outputs, subnets); - sMap.putAll(map); - } - else //multiples subnet_%aaid% outputs allowed - { - String subnetUUId = (String) outputs.get(key); - sMap.put (key.substring("subnet_id_".length()), subnetUUId); - } + for (String key : outputs.keySet()) { + if (key != null && key.startsWith("subnet")) { + if (aic3template) //one subnet output expected + { + Map map = getSubnetUUId(key, outputs, subnets); + sMap.putAll(map); + } else //multiples subnet_%aaid% outputs allowed + { + String subnetUUId = (String) outputs.get(key); + sMap.put(key.substring("subnet_id_".length()), subnetUUId); + } } } } @@ -1088,18 +1094,20 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Reach this point if createStack is successful. // Populate remaining rollback info and response parameters. - networkRollback.setNetworkStackId (heatStack.getCanonicalName ()); - networkRollback.setNeutronNetworkId ((String) outputs.get (NETWORK_ID)); - networkRollback.setNetworkType (networkType); + networkRollback.setNetworkStackId(heatStack.getCanonicalName()); + networkRollback.setNeutronNetworkId((String) outputs.get(NETWORK_ID)); + networkRollback.setNetworkType(networkType); // Save previous parameters - networkRollback.setNetworkName (previousNetworkName); - networkRollback.setPhysicalNetwork (previousPhysicalNetwork); - networkRollback.setVlans (previousVlans); + networkRollback.setNetworkName(previousNetworkName); + networkRollback.setPhysicalNetwork(previousPhysicalNetwork); + networkRollback.setVlans(previousVlans); rollback.value = networkRollback; - LOGGER.debug ("Network " + networkId + " successfully updated via HEAT"); + LOGGER.debug("Network " + networkId + " successfully updated via HEAT"); } + } finally { + db.close (); } LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully updated network"); return; @@ -1138,26 +1146,31 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { MavenLikeVersioning aicV = new MavenLikeVersioning(); aicV.setVersion(cloudSite.getAic_version()); - if ((aicV.isMoreRecentThan(networkResource.getAicVersionMin()) || aicV.isTheSameVersion(networkResource.getAicVersionMin())) // aic >= min - && (aicV.isTheSameVersion(networkResource.getAicVersionMax()) || !(aicV.isMoreRecentThan(networkResource.getAicVersionMax())))) //aic <= max - { - LOGGER.debug ("Network Type:" + networkType - + " VersionMin:" + networkResource.getAicVersionMin() - + " VersionMax:" + networkResource.getAicVersionMax() - + " supported on Cloud:" + cloudSite.getId() - + " with AIC_Version:" + cloudSite.getAic_version()); - } - else - { - String error = "Network Type:" + networkType - + " Version_Min:" + networkResource.getAicVersionMin() - + " Version_Max:" + networkResource.getAicVersionMax() - + " not supported on Cloud:" + cloudSite.getId() - + " with AIC_Version:" + cloudSite.getAic_version(); - LOGGER.error (MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Network Type not supported on Cloud"); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error); - throw new NetworkException (error, MsoExceptionCategory.USERDATA); - } + try { + if ((aicV.isMoreRecentThan(networkResource.getAicVersionMin()) || aicV.isTheSameVersion(networkResource.getAicVersionMin())) // aic >= min + && (aicV.isTheSameVersion(networkResource.getAicVersionMax()) || !(aicV.isMoreRecentThan(networkResource.getAicVersionMax())))) //aic <= max + { + LOGGER.debug("Network Type:" + networkType + + " VersionMin:" + networkResource.getAicVersionMin() + + " VersionMax:" + networkResource.getAicVersionMax() + + " supported on Cloud:" + cloudSite.getId() + + " with AIC_Version:" + cloudSite.getAic_version()); + } else { + String error = "Network Type:" + networkType + + " Version_Min:" + networkResource.getAicVersionMin() + + " Version_Max:" + networkResource.getAicVersionMax() + + " not supported on Cloud:" + cloudSite.getId() + + " with AIC_Version:" + cloudSite.getAic_version(); + LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Network Type not supported on Cloud"); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error); + throw new NetworkException(error, MsoExceptionCategory.USERDATA); + } + } catch (Exception e) { + String error = "Exception during Network version check"; + LOGGER.error (MessageEnum.RA_GENERAL_EXCEPTION_ARG, e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, error); + + throw new NetworkException (error, MsoExceptionCategory.INTERNAL); + } // Validate the Network parameters. @@ -1317,12 +1330,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { for (String key : outputs.keySet ()) { if (key != null && key.startsWith ("subnet_id_")) //multiples subnet_%aaid% outputs { - String subnetUUId = (String) outputs.get(key); + String subnetUUId = (String) outputs.get(key); sMap.put (key.substring("subnet_id_".length()), subnetUUId); } else if (key != null && key.startsWith ("subnet")) //one subnet output expected { - Map map = getSubnetUUId(key, outputs, null); + Map map = getSubnetUUId(key, outputs, null); sMap.putAll(map); } @@ -1425,7 +1438,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Will capture execution time for metrics long startTime = System.currentTimeMillis (); - try (CatalogDatabase db = getCatalogDb()) { + // Get a handle to the Catalog Database + CatalogDatabase db = getCatalogDB (); + + // Make sure DB connection is always closed + try { if (isNullOrEmpty (cloudSiteId) || isNullOrEmpty(tenantId) || isNullOrEmpty(networkId)) { @@ -1437,15 +1454,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Retrieve the Network Resource definition NetworkResource networkResource = db.getNetworkResource (networkType); - if (networkResource == null) { - String error = "Unknown Network Type: " + networkType; - LOGGER.error (MessageEnum.RA_UNKOWN_PARAM, "Network Type", networkType, "Openstack", "", MsoLogger.ErrorCode.DataError, "Unknown Network Type"); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); - throw new NetworkException (error, MsoExceptionCategory.USERDATA); - } - LOGGER.debug ("Got Network definition from Catalog: " + networkResource.toString ()); + String mode = ""; + if (networkResource != null) { + LOGGER.debug ("Got Network definition from Catalog: " + networkResource.toString ()); - String mode = networkResource.getOrchestrationMode (); + mode = networkResource.getOrchestrationMode (); + } if (NEUTRON_MODE.equals (mode)) { @@ -1472,14 +1486,14 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); throw new NetworkException (me); } - } else if ("HEAT".equals (mode)) { + } else { // DEFAULT to ("HEAT".equals (mode)) long deleteStackStarttime = System.currentTimeMillis (); // Use MsoHeatUtils for all HEAT commands MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_NETWORK_ADAPTER, msoPropertiesFactory,cloudConfigFactory); try { // The deleteStack function in MsoHeatUtils returns NOTFOUND if the stack was not found or if the stack was deleted. - // So query first to report back if stack WAS deleted or just NOTOFUND + // So query first to report back if stack WAS deleted or just NOTOFUND StackInfo heatStack = null; heatStack = heat.queryStack(cloudSiteId, tenantId, networkId); if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) @@ -1507,6 +1521,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { throw new NetworkException (me); } } + } finally { + db.close (); } // On success, nothing is returned. @@ -1514,7 +1530,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { return; } - public CatalogDatabase getCatalogDb() { + public CatalogDatabase getCatalogDB() { return new CatalogDatabase(); } @@ -1551,20 +1567,20 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // rollback may be null (e.g. if network already existed when Create was called) // Get a handle to the Catalog Database + CatalogDatabase db = getCatalogDB (); - try (CatalogDatabase db = getCatalogDb()){ + // Make sure DB connection is always closed + try { // Retrieve the Network Resource definition NetworkResource networkResource = db.getNetworkResource (networkType); - if (networkResource == null) { - String error = "Rollback Network: Unknown Network Type: " + networkType; - LOGGER.error (MessageEnum.RA_UNKOWN_PARAM, "Network Type", networkType, "Openstack", "", MsoLogger.ErrorCode.DataError, "Rollback Network: Unknown Network Type"); - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); - throw new NetworkException (error, MsoExceptionCategory.USERDATA); - } - LOGGER.debug ("Got Network definition from Catalog: " + networkResource.toString ()); + String mode = ""; + if (networkResource != null) { - String mode = networkResource.getOrchestrationMode (); + LOGGER.debug ("Got Network definition from Catalog: " + networkResource.toString ()); + + mode = networkResource.getOrchestrationMode (); + } if (rollback.getNetworkCreated ()) { // Rolling back a newly created network, so delete it. @@ -1591,7 +1607,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); throw new NetworkException (me); } - } else if ("HEAT".equals (mode)) { + } else { // DEFAULT to if ("HEAT".equals (mode)) // Use MsoHeatUtils for all HEAT commands MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_NETWORK_ADAPTER, msoPropertiesFactory,cloudConfigFactory); long deleteStackStarttime = System.currentTimeMillis (); @@ -1615,7 +1631,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { throw new NetworkException (me); } } - } + } + } finally { + db.close (); } LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully rolled back network"); return; @@ -1710,9 +1728,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } return stackParams; } - - + + /** policyRef_list structure in stackParams [ { @@ -1743,11 +1761,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { prlist.add(pr); } } - + JsonNode node = null; try { - ObjectMapper mapper = new ObjectMapper(); + ObjectMapper mapper = new ObjectMapper(); node = mapper.convertValue(prlist, JsonNode.class); String jsonString = mapper.writeValueAsString(prlist); LOGGER.debug("Json PolicyRefs Data:" + jsonString); @@ -1778,9 +1796,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { LOGGER.debug ("StackParams updated with policy refs"); return; } - + private void mergeRouteTableRefs(List rtFqdns, Map stackParams) throws MsoException { - + //update parameters if (rtFqdns != null) { @@ -1801,7 +1819,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { return; } - + /*** Subnet Output structure from Juniper { "ipam_subnets": [ @@ -1909,13 +1927,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { /* make these optional + " ip_version: %ipversion%\n" + " enable_dhcp: %enabledhcp%\n" - + " gateway_ip: %gatewayip%\n" + + " gateway_ip: %gatewayip%\n" + " allocation_pools:\n" + " - start: %poolstart%\n" + " end: %poolend%\n"; */ - + String outputTempl = " subnet_id_%subnetId%:\n" + " description: Openstack subnet identifier\n" + " value: {get_resource: subnet_%subnetId%}\n"; @@ -1934,13 +1952,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { LOGGER.error (MessageEnum.RA_MISSING_PARAM, error, "Openstack", "", MsoLogger.ErrorCode.DataError, "Missing Required AAI ID for subnet in HEAT Template"); throw new MsoAdapterException (error); } - + if (subnet.getSubnetName () != null) { curR = curR.replace ("%name%", subnet.getSubnetName ()); } else { curR = curR.replace ("%name%", subnet.getSubnetId ()); } - + if (subnet.getCidr () != null) { curR = curR.replace ("%cidr%", subnet.getCidr ()); } else { @@ -1957,11 +1975,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } if (subnet.getGatewayIp () != null && !subnet.getGatewayIp ().isEmpty() ) { curR = curR + " gateway_ip: " + subnet.getGatewayIp () + "\n"; - } + } - if (subnet.getAllocationPools() != null) { + if (subnet.getAllocationPools() != null) { curR = curR + " allocation_pools:\n"; - for (Pool pool : subnet.getAllocationPools()) + for (Pool pool : subnet.getAllocationPools()) { if (!isNullOrEmpty(pool.getStart()) && !isNullOrEmpty(pool.getEnd())) { @@ -2013,10 +2031,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { for (Subnet subnet : subnets) { if ( subnet != null && !isNullOrEmpty(subnet.getSubnetName())) - { + { if (subnet.getSubnetName().equals(name)) { - aaiId = subnet.getSubnetId(); + aaiId = subnet.getSubnetId(); break; } } diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/exceptions/NetworkException.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/exceptions/NetworkException.java index 0fd4d02933..1b9fde7a88 100644 --- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/exceptions/NetworkException.java +++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/exceptions/NetworkException.java @@ -34,7 +34,7 @@ import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; * * */ -@WebFault (name="NetworkException", faultBean="org.openecomp.mso.adapters.network.exceptions.NetworkExceptionBean", targetNamespace="http://com.att.mso/network") +@WebFault (name="NetworkException", faultBean="org.openecomp.mso.adapters.network.exceptions.NetworkExceptionBean", targetNamespace="http://org.openecomp.mso/network") public class NetworkException extends Exception { private static final long serialVersionUID = 1L; diff --git a/adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/NetworkAdapterTest.java b/adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/NetworkAdapterTest.java index 41cc3f5533..f099046e03 100644 --- a/adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/NetworkAdapterTest.java +++ b/adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/NetworkAdapterTest.java @@ -7,9 +7,9 @@ * 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. @@ -29,6 +29,7 @@ import java.util.Map; import javax.xml.ws.Holder; +import org.evosuite.runtime.System; import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mock; @@ -60,7 +61,7 @@ public class NetworkAdapterTest { networkResource.setId (1); networkResource.setOrchestrationMode ("toto"); Mockito.when (db.getNetworkResource ("PROVIDER")).thenReturn (networkResource); - Mockito.when (adapter.getCatalogDb()).thenReturn (db); + Mockito.when (adapter.getCatalogDB()).thenReturn (db); } @Test @@ -260,7 +261,8 @@ public class NetworkAdapterTest { try { adapter.deleteNetwork ("toto", "tenant", "PROVIDER", "networkId", msoRequest, networkDeleted); } catch (NetworkException e) { - assertTrue (e.getMessage ().contains ("Configuration Error")); + e.printStackTrace(); + assertTrue (e.getMessage ().contains ("Cloud Site [toto] not found")); } } } diff --git a/adapters/mso-requests-db-adapter/WebContent/WEB-INF/web.xml b/adapters/mso-requests-db-adapter/WebContent/WEB-INF/web.xml index 7fa3f2a24c..d43d244099 100644 --- a/adapters/mso-requests-db-adapter/WebContent/WEB-INF/web.xml +++ b/adapters/mso-requests-db-adapter/WebContent/WEB-INF/web.xml @@ -56,6 +56,17 @@ true + + + SoapRequests + Soap Ingress Requests + /RequestsDbAdapter + POST + + + BPEL-Client + + SiteStatus diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java index 5b4009fb77..58299ea9d9 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java @@ -7,9 +7,9 @@ * 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. @@ -32,7 +32,7 @@ import org.openecomp.mso.requestsdb.SiteStatus; /** * MSO Request DB Adapter Web Service */ -@WebService(name = "RequestsDbAdapter", targetNamespace = "http://com.att.mso/requestsdb") +@WebService(name = "RequestsDbAdapter", targetNamespace = "http://org.openecomp.mso/requestsdb") public interface MsoRequestsDbAdapter { @WebMethod @@ -47,7 +47,8 @@ public interface MsoRequestsDbAdapter { @WebParam(name = "networkId") @XmlElement(required = false) String networkId, @WebParam(name = "vnfId") @XmlElement(required = false) String vnfId, @WebParam(name = "vfModuleId") @XmlElement(required = false) String vfModuleId, - @WebParam(name = "volumeGroupId") @XmlElement(required = false) String volumeGroupId) throws MsoRequestsDbException; + @WebParam(name = "volumeGroupId") @XmlElement(required = false) String volumeGroupId, + @WebParam(name = "serviceInstanceName") @XmlElement(required = false) String serviceInstanceName) throws MsoRequestsDbException; @WebMethod public InfraActiveRequests getInfraRequest (@WebParam(name="requestId") @XmlElement(required = true) String requestId) throws MsoRequestsDbException; diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java index e1b752af24..0ff8b5ff43 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java @@ -7,9 +7,9 @@ * 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. @@ -34,12 +34,15 @@ import org.hibernate.Session; import org.openecomp.mso.adapters.requestsdb.exceptions.MsoRequestsDbException; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.requestsdb.HibernateUtil; +import org.openecomp.mso.db.HibernateUtils; +import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb; import org.openecomp.mso.requestsdb.InfraActiveRequests; -@WebService(serviceName = "RequestsDbAdapter", endpointInterface = "org.openecomp.mso.adapters.requestsdb.MsoRequestsDbAdapter", targetNamespace = "http://com.att.mso/requestsdb") +@WebService(serviceName = "RequestsDbAdapter", endpointInterface = "org.openecomp.mso.adapters.requestsdb.MsoRequestsDbAdapter", targetNamespace = "http://org.openecomp.mso/requestsdb") public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { + protected HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb (); + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); @Override @@ -54,9 +57,10 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { String networkId, String vnfId, String vfModuleId, - String volumeGroupId) throws MsoRequestsDbException { + String volumeGroupId, + String serviceInstanceName) throws MsoRequestsDbException { MsoLogger.setLogContext (requestId, null); - Session session = HibernateUtil.getSessionFactory ().openSession (); + Session session = hibernateUtils.getSessionFactory ().openSession (); int result = 0; long startTime = System.currentTimeMillis (); try { @@ -92,20 +96,23 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { if (volumeGroupId != null) { queryString += "volumeGroupId = :volumeGroupId, "; } + if (serviceInstanceName != null) { + queryString += "serviceInstanceName = :serviceInstanceName, "; + } if (requestStatus == RequestStatusType.COMPLETE || requestStatus == RequestStatusType.FAILED) { queryString += "endTime = :endTime, "; } else { queryString += "modifyTime = :modifyTime, "; } queryString += "lastModifiedBy = :lastModifiedBy where requestId = :requestId OR clientRequestId = :requestId"; - - LOGGER.debug("Executing update: " + queryString); - + + LOGGER.debug("Executing update: " + queryString); + Query query = session.createQuery (queryString); query.setParameter ("requestId", requestId); if (statusMessage != null) { query.setParameter ("statusMessage", statusMessage); - LOGGER.debug ("StatusMessage in updateInfraRequest is set to: " + statusMessage); + LOGGER.debug ("StatusMessage in updateInfraRequest is set to: " + statusMessage); } if (responseBody != null) { query.setParameter ("responseBody", responseBody); @@ -115,7 +122,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { query.setParameter ("requestStatus", requestStatus.toString ()); LOGGER.debug ("RequestStatus in updateInfraRequest is set to: " + requestStatus.toString()); } - + if (progress != null) { query.setParameter ("progress", Long.parseLong (progress)); LOGGER.debug ("Progress in updateInfraRequest is set to: " + progress); @@ -144,6 +151,10 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { query.setParameter ("volumeGroupId", volumeGroupId); LOGGER.debug ("VolumeGroupId in updateInfraRequest is set to: " + volumeGroupId); } + if (serviceInstanceName != null) { + query.setParameter ("serviceInstanceName", serviceInstanceName); + LOGGER.debug ("ServiceInstanceName in updateInfraRequest is set to: " + serviceInstanceName); + } Timestamp nowTimeStamp = new Timestamp (System.currentTimeMillis ()); if (requestStatus == RequestStatusType.COMPLETE || requestStatus == RequestStatusType.FAILED) { query.setParameter ("endTime", nowTimeStamp); @@ -156,7 +167,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { LOGGER.debug ("LastModifiedBy in updateInfraRequest is set to: " + lastModifiedBy); result = query.executeUpdate (); checkIfExists (result, requestId, startTime); - session.getTransaction ().commit (); + session.getTransaction ().commit (); } catch (HibernateException e) { String error = "Unable to update MSO Requests DB: " + e.getMessage (); LOGGER.error (MessageEnum.RA_CANT_UPDATE_REQUEST, "infra request parameters", requestId, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "HibernateException - " + error, e); @@ -184,7 +195,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { public InfraActiveRequests getInfraRequest (String requestId) throws MsoRequestsDbException { long startTime = System.currentTimeMillis (); MsoLogger.setLogContext (requestId, null); - Session session = HibernateUtil.getSessionFactory ().openSession (); + Session session = hibernateUtils.getSessionFactory ().openSession (); LOGGER.debug ("Call to MSO Infra RequestsDb adapter get method with request Id: " + requestId); @@ -218,7 +229,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { */ public boolean getSiteStatus (String siteName) { UUIDChecker.generateUUID (LOGGER); - Session session = HibernateUtil.getSessionFactory ().openSession (); + Session session = hibernateUtils.getSessionFactory ().openSession (); long startTime = System.currentTimeMillis (); SiteStatus siteStatus = null; diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbException.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbException.java index 8e4fcf4083..5de06ca1c1 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbException.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbException.java @@ -30,7 +30,7 @@ import javax.xml.ws.WebFault; * * */ -@WebFault (name="MsoRequestsDbException", faultBean="org.openecomp.mso.adapters.requestsdb.exceptions.MsoRequestsDbExceptionBean", targetNamespace="http://com.att.mso/requestsdb") +@WebFault (name="MsoRequestsDbException", faultBean="org.openecomp.mso.adapters.requestsdb.exceptions.MsoRequestsDbExceptionBean", targetNamespace="http://org.openecomp.mso/requestsdb") public class MsoRequestsDbException extends Exception { private static final long serialVersionUID = 1L; diff --git a/adapters/mso-sdnc-adapter/WebContent/WEB-INF/web.xml b/adapters/mso-sdnc-adapter/WebContent/WEB-INF/web.xml index bb58197bf1..cce3f14ff9 100644 --- a/adapters/mso-sdnc-adapter/WebContent/WEB-INF/web.xml +++ b/adapters/mso-sdnc-adapter/WebContent/WEB-INF/web.xml @@ -4,7 +4,7 @@ check.html - + resteasy.jndi.resources java:module/MsoPropertiesFactory,java:module/CloudConfigFactory @@ -23,7 +23,7 @@ resteasy.resources - org.openecomp.mso.logger.MsoLoggingServlet,org.openecomp.mso.adapters.sdnc.notify.SDNCNotifyResource,org.openecomp.mso.adapters.sdnc.impl.SDNCAdapterRestImpl,org.openecomp.mso.MsoStatusHandler + org.openecomp.mso.logger.MsoLoggingServlet,org.openecomp.mso.adapters.sdnc.notify.SDNCNotifyResource,org.openecomp.mso.adapters.sdnc.impl.SDNCAdapterRestImpl,org.openecomp.mso.MsoStatusHandler,org.openecomp.mso.adapters.sdnc.sdncrest.SNIROResponse,org.openecomp.mso.adapters.sdnc.sdncrest.SDNCAdapterRest resteasy.servlet.mapping.prefix @@ -78,6 +78,7 @@ SDNCNotification Rest Async Notification from SDNC /rest/SDNCNotify + /rest/SDNCNotify/* POST @@ -86,9 +87,10 @@ - SoapRequests + SDNCRequests Soap Ingress Requests /SDNCAdapter + /rest/v1/sdnc/* POST diff --git a/adapters/mso-sdnc-adapter/null/mso-config/uuid/uuid_null b/adapters/mso-sdnc-adapter/null/mso-config/uuid/uuid_null deleted file mode 100644 index 1e111235e7..0000000000 --- a/adapters/mso-sdnc-adapter/null/mso-config/uuid/uuid_null +++ /dev/null @@ -1 +0,0 @@ -57df7036-93ea-48bb-9667-f97098b99742 \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml index 5e6c5c6b36..f439459955 100644 --- a/adapters/mso-sdnc-adapter/pom.xml +++ b/adapters/mso-sdnc-adapter/pom.xml @@ -100,5 +100,11 @@ mso-adapters-rest-interface ${project.version}
+ + + org.springframework + spring-web + 4.3.2.RELEASE + \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/readme b/adapters/mso-sdnc-adapter/readme index 34c09fdf7c..aa112c8578 100644 --- a/adapters/mso-sdnc-adapter/readme +++ b/adapters/mso-sdnc-adapter/readme @@ -19,7 +19,7 @@ http://host:port/adapters/rest/properties/show - Lists all the properties loaded org.openecomp.mso.adapters.sdnc.bpelcauth=avosAdmin:jboss123 org.openecomp.mso.adapters.sdnc.sdncconnecttime=2000 org.openecomp.mso.adapters.sdnc.myurl=http://192.20.205.182:8380/adapters/rest/SDNCNotify - org.openecomp.mso.adapters.sdnc.sdncurl=https://odl.node01.it.app.sdn.labs.att.com:8443/restconf/operations/L3SDN-API: + org.openecomp.mso.adapters.sdnc.sdncurl=https://sdnchost:8443/restconf/operations/L3SDN-API: org.openecomp.mso.adapters.sdnc.sdncauth=admin:admin org.openecomp.mso.adapters.sdnc.bpelurl=http://NJCDTL21RA1926.ITServices.sbc.com:8088/mockSDNCCallbackAdapterSoapHttpBinding?wsdl org.openecomp.mso.adapters.sdnc.sdncreadtime=5000 diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterPortType.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterPortType.java index 254fea0ba3..f4c8234407 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterPortType.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterPortType.java @@ -36,15 +36,15 @@ import javax.xml.bind.annotation.XmlSeeAlso; * */ //BPEL SDNCAdapter SOAP WebService - impl class in impl pkg -@WebService(targetNamespace = "http://domain2.att.com/workflow/sdnc/adapter/wsdl/v1", name = "SDNCAdapterPortType") +@WebService(targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/wsdl/v1", name = "SDNCAdapterPortType") @XmlSeeAlso({ObjectFactory.class}) @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) public interface SDNCAdapterPortType { - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://domain2.att.com/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterResponse") + @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterResponse") @WebMethod(operationName = "SDNCAdapter") public SDNCAdapterResponse sdncAdapter( - @WebParam(partName = "SDNCAdapterRequest", name = "SDNCAdapterRequest", targetNamespace = "http://domain2.att.com/workflow/sdnc/adapter/schema/v1") + @WebParam(partName = "SDNCAdapterRequest", name = "SDNCAdapterRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1") SDNCAdapterRequest sdncAdapterRequest ); diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequest.java index 6b75949453..5da1e51d43 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequest.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequest.java @@ -41,7 +41,7 @@ import org.openecomp.mso.adapters.sdnc.impl.Utils; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <element ref="{http://domain2.att.com/workflow/sdnc/adapter/schema/v1}RequestHeader"/> + * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}RequestHeader"/> * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/> * </sequence> * </restriction> diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterService.java index 0b63ad6dea..1e33789ba8 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterService.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterService.java @@ -42,15 +42,15 @@ import org.openecomp.mso.logger.MessageEnum; //BPEL SDNCAdapter SOAP WebService @WebServiceClient(name = "SDNCAdapterService", wsdlLocation = "main/resources/SDNCAdapter.wsdl", - targetNamespace = "http://domain2.att.com/workflow/sdnc/adapter/wsdl/v1") + targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/wsdl/v1") public class SDNCAdapterService extends Service { private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); public final static URL WSDL_LOCATION; - public final static QName SERVICE = new QName("http://domain2.att.com/workflow/sdnc/adapter/wsdl/v1", "SDNCAdapterService"); - public final static QName SDNCAdapterSoapHttpPort = new QName("http://domain2.att.com/workflow/sdnc/adapter/wsdl/v1", "SDNCAdapterSoapHttpPort"); + public final static QName SERVICE = new QName("http://org.openecomp/workflow/sdnc/adapter/wsdl/v1", "SDNCAdapterService"); + public final static QName SDNCAdapterSoapHttpPort = new QName("http://org.openecomp/workflow/sdnc/adapter/wsdl/v1", "SDNCAdapterSoapHttpPort"); static { URL wsdlUrl = null; try { diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequest.java index fd16e4754c..f62c984ef9 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequest.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequest.java @@ -42,7 +42,7 @@ import org.openecomp.mso.logger.MessageEnum; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <element ref="{http://domain2.att.com/workflow/sdnc/adapter/schema/v1}CallbackHeader"/> + * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}CallbackHeader"/> * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/> * </sequence> * </restriction> diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java index 6818e67e75..d792b9ca18 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java @@ -37,15 +37,15 @@ import org.openecomp.mso.adapters.sdnc.SDNCAdapterResponse; * */ //SDNCAdapter to BPEL Async response WEB Service -@WebService(targetNamespace = "http://domain2.att.com/workflow/sdnc/adapter/callback/wsdl/v1", name = "SDNCCallbackAdapterPortType") +@WebService(targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", name = "SDNCCallbackAdapterPortType") @XmlSeeAlso({ObjectFactory.class}) @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) public interface SDNCCallbackAdapterPortType { - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://domain2.att.com/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") + @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") @WebMethod(operationName = "SDNCAdapterCallback") public SDNCAdapterResponse sdncAdapterCallback( - @WebParam(partName = "SDNCAdapterCallbackRequest", name = "SDNCAdapterCallbackRequest", targetNamespace = "http://domain2.att.com/workflow/sdnc/adapter/schema/v1") + @WebParam(partName = "SDNCAdapterCallbackRequest", name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1") SDNCAdapterCallbackRequest sdncAdapterCallbackRequest ); } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java index 6fa8e035a5..bbac6a30cb 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java @@ -40,14 +40,14 @@ import org.openecomp.mso.logger.MsoLogger; //SDNCAdapter to BPEL Async response WEB Service @WebServiceClient(name = "SDNCCallbackAdapterService", wsdlLocation = "main/resources/SDNCCallbackAdapter.wsdl", - targetNamespace = "http://domain2.att.com/workflow/sdnc/adapter/callback/wsdl/v1") + targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1") public class SDNCCallbackAdapterService extends Service { private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); public final static URL WSDL_LOCATION; - public final static QName SERVICE = new QName("http://domain2.att.com/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterService"); - public final static QName SDNCCallbackAdapterSoapHttpPort = new QName("http://domain2.att.com/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterSoapHttpPort"); + public final static QName SERVICE = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterService"); + public final static QName SDNCCallbackAdapterSoapHttpPort = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterSoapHttpPort"); static { URL wsdlUrl = null; try { diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/package-info.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/package-info.java index 0d6f900f47..35334dfa74 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/package-info.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/package-info.java @@ -18,6 +18,6 @@ * ============LICENSE_END========================================================= */ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://domain2.att.com/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package org.openecomp.mso.adapters.sdnc.client; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Constants.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Constants.java index 6cc0ecbd92..78983291c6 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Constants.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Constants.java @@ -7,9 +7,9 @@ * 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. @@ -23,11 +23,12 @@ package org.openecomp.mso.adapters.sdnc.impl; public interface Constants { + public static final String BPEL_REST_URL_PROP = "org.openecomp.mso.adapters.sdnc.rest.bpelurl"; public static final String BPEL_URL_PROP = "org.openecomp.mso.adapters.sdnc.bpelurl"; - public static final String DEFAULT_BPEL_URL = "http://msobpel.mtcnj.aic.cip.att.com:8080//active-bpel/services/SDNCAdapterCallbackV1"; + public static final String DEFAULT_BPEL_URL = "http://localhost:8080//active-bpel/services/SDNCAdapterCallbackV1"; public static final String MY_URL_PROP = "org.openecomp.mso.adapters.sdnc.myurl"; - public static final String DEFAULT_MY_URL = "https://msojra.mtcnj.aic.cip.att.com:8443/adapters/rest/SDNCNotify"; + public static final String DEFAULT_MY_URL = "https://localhost:8443/adapters/rest/SDNCNotify"; public static final String SDNC_AUTH_PROP = "org.openecomp.mso.adapters.sdnc.sdncauth"; public static final String DEFAULT_SDNC_AUTH = "406B2AE613211B6FB52466DE6E1769AC"; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java index 887c0a9990..0eeacaf5fc 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java @@ -35,7 +35,7 @@ import org.openecomp.mso.properties.MsoPropertiesException; import org.openecomp.mso.properties.MsoPropertiesFactory; //BPEL SDNCAdapter SOAP Web Service implementation -@WebService(serviceName = "SDNCAdapterService", endpointInterface = "org.openecomp.mso.adapters.sdnc.SDNCAdapterPortType", targetNamespace = "http://domain2.att.com/workflow/sdnc/adapter/wsdl/v1") +@WebService(serviceName = "SDNCAdapterService", endpointInterface = "org.openecomp.mso.adapters.sdnc.SDNCAdapterPortType", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/wsdl/v1") public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { private MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory(); diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/package-info.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/package-info.java index 58359c69b0..55819c6e4d 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/package-info.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/package-info.java @@ -18,6 +18,6 @@ * ============LICENSE_END========================================================= */ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://domain2.att.com/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package org.openecomp.mso.adapters.sdnc; diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java new file mode 100644 index 0000000000..52b1f19b5f --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java @@ -0,0 +1,173 @@ +/*- + * ============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.adapters.sdnc.sdncrest; + +import org.openecomp.mso.adapters.sdnc.impl.Constants; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoAlarmLogger; +import org.openecomp.mso.logger.MsoLogger; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; + +import javax.xml.bind.DatatypeConverter; + +/** + * Sends asynchronous messages to the BPMN workflow message service. + */ +public class BPRestCallback { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); + + /** + * Sends a message to the BPMN workflow message service. The URL path is + * constructed using the specified message type and correlator. + * @param workflowMessageUrl the base BPMN WorkflowMessage URL + * @param messageType the message type + * @param correlator the message correlator + * @param message the JSON content + * @return true if the message was consumed successfully by the endpoint + */ + public boolean send(String workflowMessageUrl, String messageType, String correlator, String message) { + LOGGER.debug(getClass().getSimpleName() + ".send(" + + "workflowMessageUrl=" + workflowMessageUrl + + " messageType=" + messageType + + " correlator=" + correlator + + " message=" + message + + ")"); + + while (workflowMessageUrl.endsWith("/")) { + workflowMessageUrl = workflowMessageUrl.substring(0, workflowMessageUrl.length()-1); + } + + String endpoint = workflowMessageUrl + "/" + SDNCAdapterUtils.encodeURLPathSegment(messageType) + + "/" + SDNCAdapterUtils.encodeURLPathSegment(correlator); + + return send(endpoint, message); + } + + /** + * Sends a message to the BPMN workflow message service. The specified URL + * must have the message type and correlator already embedded in it. + * @param url the endpoint URL + * @param message the JSON content + * @return true if the message was consumed successfully by the endpoint + */ + public boolean send(String url, String message) { + LOGGER.debug(getClass().getSimpleName() + ".send(" + + "url=" + url + + " message=" + message + + ")"); + + LOGGER.info(MessageEnum.RA_CALLBACK_BPEL, message == null ? "[no content]" : message, "Camunda", ""); + + HttpPost method = null; + HttpResponse httpResponse = null; + + try { + // TODO: configurable timeout? + int timeout = 60 * 1000; + + RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(timeout) + .setConnectTimeout(timeout) + .setConnectionRequestTimeout(timeout) + .build(); + + HttpClient client = HttpClientBuilder.create().build(); + method = new HttpPost(url); + method.setConfig(requestConfig); + + if (message != null) { + method.setEntity(new StringEntity(message, ContentType.APPLICATION_JSON)); + } + + boolean error = false; + + try { + // AAF Integration, disabled for now due to the constrains from other party + // String userCredentials = CredentialConstants.getDecryptedCredential(Constants.DEFAULT_BPEL_AUTH); + // Once AAF enabled, the credential shall be get by triggering the CredentialConstants.getDecryptedCredential -- remove line + String userCredentials = SDNCAdapterProperties.getEncryptedProperty(Constants.BPEL_AUTH_PROP, + Constants.DEFAULT_BPEL_AUTH, Constants.ENCRYPTION_KEY); + String authorization = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); + method.setHeader("Authorization", authorization); + } catch (Exception e) { + LOGGER.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, + "Unable to set authorization in callback request", e); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, + "Unable to set authorization in callback request: " + e.getMessage()); + error = true; + } + + if (!error) { + httpResponse = client.execute(method); + + @SuppressWarnings("unused") + String responseContent = null; + + if (httpResponse.getEntity() != null) { + responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); + } + + if (httpResponse.getStatusLine().getStatusCode() >= 300) { + String msg = "Received error response to callback request: " + httpResponse.getStatusLine(); + LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, msg); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, msg); + } + + httpResponse = null; + } + + method.reset(); + method = null; + return true; + } catch (Exception e) { + LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, + "Error sending callback request", e); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, + "Error sending callback request: " + e.getMessage()); + return false; + } finally { + if (httpResponse != null) { + try { + EntityUtils.consume(httpResponse.getEntity()); + } catch (Exception e) { + // Ignore + } + } + + if (method != null) { + try { + method.reset(); + } catch (Exception e) { + // Ignore + } + } + + LOGGER.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE, "Camunda", ""); + } + } +} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterProperties.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterProperties.java new file mode 100644 index 0000000000..ba8fdfb936 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterProperties.java @@ -0,0 +1,85 @@ +/*- + * ============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.adapters.sdnc.sdncrest; + +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.properties.MsoJavaProperties; +import org.openecomp.mso.properties.MsoPropertiesException; +import org.openecomp.mso.properties.MsoPropertiesFactory; + +/** + * Static methods to access SDNC adapter properties. + */ +public final class SDNCAdapterProperties { + private static final String MSO_PROPERTIES_ID = "MSO_PROP_SDNC_ADAPTER"; + private static final MsoPropertiesFactory MSO_PROPERTIES_FACTORY = new MsoPropertiesFactory(); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + + /** + * Gets the value of an SDNC adapter property. + * @param key the property key + * @param defaultValue the default value to use if the property does not + * exist or if an error occurs + */ + public static String getProperty(String key, String defaultValue) { + MsoJavaProperties properties; + + try { + properties = MSO_PROPERTIES_FACTORY.getMsoJavaProperties(MSO_PROPERTIES_ID); + } catch (MsoPropertiesException e) { + LOGGER.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: " + MSO_PROPERTIES_ID, + "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); + return defaultValue; + } + + String value = properties.getProperty(key, defaultValue); + LOGGER.debug("Config read for " + MSO_PROPERTIES_ID + " - key:" + key + " value:" + value); + return value; + } + + /** + * Gets the value of an SDNC adapter property. + * @param key the property key + * @param defaultValue the default value to use if the property does not + * exist or if an error occurs + */ + public static String getEncryptedProperty(String key, String defaultValue, String encryptionKey) { + MsoJavaProperties properties; + + try { + properties = MSO_PROPERTIES_FACTORY.getMsoJavaProperties(MSO_PROPERTIES_ID); + } catch (MsoPropertiesException e) { + LOGGER.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: " + MSO_PROPERTIES_ID, + "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); + return defaultValue; + } + + String value = properties.getEncryptedProperty(key, defaultValue, encryptionKey); + LOGGER.debug("Config read for " + MSO_PROPERTIES_ID + " - key:" + key); + return value; + } + + /** + * Instantiation is not allowed. + */ + private SDNCAdapterProperties() { + } +} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java new file mode 100644 index 0000000000..c4ed50a1b1 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java @@ -0,0 +1,239 @@ +/*- + * ============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.adapters.sdnc.sdncrest; + +import org.openecomp.mso.HealthCheckUtils; +import org.openecomp.mso.adapters.sdnc.impl.Constants; +import org.openecomp.mso.adapters.sdncrest.SDNCEvent; +import org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon; +import org.openecomp.mso.adapters.sdncrest.SDNCServiceError; +import org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoAlarmLogger; +import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.utils.UUIDChecker; +import org.apache.http.HttpStatus; + +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.*; +import javax.ws.rs.core.GenericEntity; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.text.ParseException; + +/** + * SDNC REST adapter interface added in 1702 to support the SDNC "agnostic" API. + */ +@Path("/") +public class SDNCAdapterRest { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); + + private static final String MSO_PROPERTIES_ID = "MSO_PROP_SDNC_ADAPTER"; + + @HEAD + @GET + @Path("/v1/sdnc/healthcheck") + @Produces(MediaType.TEXT_HTML) + public Response healthcheck(@QueryParam("requestId") String requestId) { + long startTime = System.currentTimeMillis(); + MsoLogger.setServiceName("Healthcheck"); + UUIDChecker.verifyOldUUID(requestId, LOGGER); + HealthCheckUtils healthCheck = new HealthCheckUtils(); + + if (!healthCheck.siteStatusCheck(LOGGER, startTime)) { + return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; + } + + if (!healthCheck.configFileCheck(LOGGER, startTime, MSO_PROPERTIES_ID)) { + return HealthCheckUtils.NOT_STARTED_RESPONSE; + } + + LOGGER.debug("healthcheck - Successful"); + return HealthCheckUtils.HEALTH_CHECK_RESPONSE; + } + + /** + * Processes an SDNCServiceRequest (a request for "agnostic" API services) from BP. + * @param request the request + * @param msoRequestId the request ID for the top-level MSO flow (used for logging only) + * @param msoServiceInstanceId the top-level service-instance-id (used for logging only) + */ + @POST + @Path("/v1/sdnc/services") + @Consumes({MediaType.APPLICATION_JSON}) + @Produces({MediaType.APPLICATION_JSON}) + public Response service( + SDNCServiceRequest request, + @HeaderParam(value="att-mso-request-id") String msoRequestId, + @HeaderParam(value="att-mso-service-instance-id") String msoServiceInstanceId) { + + MsoLogger.setLogContext(msoRequestId, msoServiceInstanceId); + + try { + LOGGER.debug(getClass().getSimpleName() + ".service(request)" + + " entered with request: " + request.toJson()); + + SDNCServiceRequestTask task = new SDNCServiceRequestTask(request, msoRequestId, + msoServiceInstanceId, "/services"); + + try { + Thread thread = new Thread(task); + thread.start(); + } catch (Exception e) { + String msg = "Failed to start thread to run SDNCServiceTask"; + LOGGER.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, msg, e); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, msg); + SDNCServiceError error = new SDNCServiceError(request.getSDNCRequestId(), + String.valueOf(HttpStatus.SC_INTERNAL_SERVER_ERROR), e.toString(), "Y"); + LOGGER.debug(getClass().getSimpleName() + ".service(request)" + + " exited with error: " + msg); + return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity(error){}) + .build(); + } + + // Send sync response to caller + LOGGER.debug(getClass().getSimpleName() + ".service(request)" + + " exited successfully"); + return Response.status(HttpStatus.SC_ACCEPTED).build(); + } catch (Exception e) { + String msg = "Caught " + e.getClass().getSimpleName() + " in 'service' method"; + LOGGER.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, msg, e); + LOGGER.debug(getClass().getSimpleName() + ".service(request)" + + " exited with error: " + msg); + SDNCServiceError error = new SDNCServiceError(request.getSDNCRequestId(), + String.valueOf(HttpStatus.SC_INTERNAL_SERVER_ERROR), e.toString(), "Y"); + return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity(error){}) + .build(); + } + } + + /** + * Processes a notification from SDNC for "agnostic" API services. + * Note that the "myurl" configuration property specifies the path + * up to and including /SDNCNotify. The /services part of the path + * is added by this class. + * @param content the notification content + */ + @POST + @Path("/SDNCNotify/services") + @Consumes({MediaType.APPLICATION_XML}) + @Produces({MediaType.APPLICATION_XML}) + public Response serviceNotification(String content) { + LOGGER.info(MessageEnum.RA_RECEIVE_SDNC_NOTIF, content, "SDNC", "SDNCNotify/services"); + + long startTime = System.currentTimeMillis(); + + try { + // Because the format of a notification is exactly the same as that of + // a synchronous response, we can use the same code to parse it. + SDNCResponseCommon response = SDNCServiceRequestConnector.parseResponseContent(content); + + String bpUrl = SDNCAdapterProperties.getProperty(Constants.BPEL_REST_URL_PROP, null); + + if (bpUrl == null) { + String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP; + LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "", + MsoLogger.ErrorCode.DataError, "Missing config param"); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build(); + } + + long bpStartTime = System.currentTimeMillis(); + BPRestCallback callback = new BPRestCallback(); + boolean callbackSuccess = callback.send(bpUrl, "SDNCAResponse", response.getSDNCRequestId(), response.toJson()); + + if (callbackSuccess) { + LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Sent notification", "BPMN", bpUrl, null); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); + } else { + LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, + "Failed to send notification", "BPMN", bpUrl, null); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, + "Failed to send notification"); + } + + return Response.ok().build(); + } catch (ParseException e) { + LOGGER.error(MessageEnum.RA_PARSING_REQUEST_ERROR, "SDNC", "SDNCNotify/services", + MsoLogger.ErrorCode.SchemaError, e.getMessage()); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, + MsoLogger.ResponseCode.SchemaError, e.getMessage()); + return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(e.getMessage()).build(); + } + } + + /** + * Processes an event notification from SDNC. + * Note that the "myurl" configuration property specifies the path + * up to and including /SDNCNotify. The /activate part of the path + * is added by this class. + * @param content the notification content + */ + @POST + @Path("/SDNCNotify/event") + @Consumes({MediaType.APPLICATION_XML}) + @Produces({MediaType.APPLICATION_XML}) + public Response eventNotification(String content) { + LOGGER.info(MessageEnum.RA_RECEIVE_SDNC_NOTIF, content, "SDNC", "SDNCNotify/event"); + + long startTime = System.currentTimeMillis(); + + try { + SDNCEvent event = SDNCEventParser.parse(content); + + String bpUrl = SDNCAdapterProperties.getProperty(Constants.BPEL_REST_URL_PROP, null); + + if (bpUrl == null) { + String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP; + LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "", + MsoLogger.ErrorCode.DataError, "Missing config param"); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build(); + } + + long bpStartTime = System.currentTimeMillis(); + BPRestCallback callback = new BPRestCallback(); + boolean callbackSuccess = callback.send(bpUrl, "SDNCAEvent", event.getEventCorrelator(), event.toJson()); + + if (callbackSuccess) { + LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Sent notification", "BPMN", bpUrl, null); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); + } else { + LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, + "Failed to send notification", "BPMN", bpUrl, null); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, + "Failed to send notification"); + } + + return Response.ok().build(); + } catch (ParseException e) { + LOGGER.error(MessageEnum.RA_PARSING_REQUEST_ERROR, "SDNC", "SDNCNotify/event", + MsoLogger.ErrorCode.SchemaError, e.getMessage()); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, + MsoLogger.ResponseCode.SchemaError, e.getMessage()); + return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(e.getMessage()).build(); + } + } +} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java new file mode 100644 index 0000000000..d97f340a7c --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java @@ -0,0 +1,70 @@ +/*- + * ============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.adapters.sdnc.sdncrest; + +import org.springframework.web.util.UriUtils; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; + +/** + * Utility methods used by SDNCAdapterRest. + */ +public final class SDNCAdapterUtils { + /** + * Returns a node's child elements in a list. + */ + public static List childElements(Node node) { + List elements = new ArrayList(); + + NodeList nodeList = node.getChildNodes(); + for (int i = 0; i < nodeList.getLength(); i++) { + Node child = nodeList.item(i); + if (child.getNodeType() == Node.ELEMENT_NODE) { + elements.add((Element) child); + } + } + + return elements; + } + + /** + * Encodes a URL path segment according to RFC 3986 Section 2. + * @param pathSegment the path segment to encode + * @return the encoded path segment + */ + public static String encodeURLPathSegment(String pathSegment) { + try { + return UriUtils.encodePathSegment(pathSegment, "UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException("UTF-8 encoding is not supported"); + } + } + + /** + * Instantiation is not allowed. + */ + private SDNCAdapterUtils() { + } +} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java new file mode 100644 index 0000000000..26c186599c --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java @@ -0,0 +1,309 @@ +/*- + * ============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.adapters.sdnc.sdncrest; + +import org.openecomp.mso.adapters.sdnc.impl.Constants; +import org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon; +import org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoAlarmLogger; +import org.openecomp.mso.logger.MsoLogger; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.*; +import org.apache.http.conn.ConnectTimeoutException; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +import javax.xml.XMLConstants; +import javax.xml.bind.DatatypeConverter; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; +import java.io.StringReader; +import java.net.HttpURLConnection; +import java.net.SocketTimeoutException; + +/** + * Sends requests to SDNC and processes the responses. + */ +public abstract class SDNCConnector { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); + + public SDNCResponseCommon send(String content, TypedRequestTunables rt) { + LOGGER.info(MessageEnum.RA_SEND_REQUEST_SDNC, rt.toString(), "SDNC", ""); + LOGGER.debug("SDNC Request Body:\n" + content); + + HttpRequestBase method = null; + HttpResponse httpResponse = null; + + try { + int timeout = Integer.parseInt(rt.getTimeout()); + + RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(timeout) + .setConnectTimeout(timeout) + .setConnectionRequestTimeout(timeout) + .build(); + + HttpClient client = HttpClientBuilder.create().build(); + + if ("POST".equals(rt.getReqMethod())) { + HttpPost httpPost = new HttpPost(rt.getSdncUrl()); + httpPost.setConfig(requestConfig); + httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_XML)); + method = httpPost; + } else if ("PUT".equals(rt.getReqMethod())) { + HttpPut httpPut = new HttpPut(rt.getSdncUrl()); + httpPut.setConfig(requestConfig); + httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_XML)); + method = httpPut; + } else if ("GET".equals(rt.getReqMethod())) { + HttpGet httpGet = new HttpGet(rt.getSdncUrl()); + httpGet.setConfig(requestConfig); + method = httpGet; + } else if ("DELETE".equals(rt.getReqMethod())) { + HttpDelete httpDelete = new HttpDelete(rt.getSdncUrl()); + httpDelete.setConfig(requestConfig); + method = httpDelete; + } + + // AAF Integration, disabled for now due to the constrains from other party + // String userCredentials = CredentialConstants.getSecurityProperties().getEncryptedProperty(CredentialConstants.DEFAULT_AUTH, "", CredentialConstants.getEncryptionKey()); + // if (userCredentials == null) { + // userCredentials = ""; + //} + String userCredentials = SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP, + Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY); + String authorization = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); + method.setHeader("Authorization", authorization); + + method.setHeader("Accept", "application/yang.data+xml"); + + httpResponse = client.execute(method); + + String responseContent = null; + if (httpResponse.getEntity() != null) { + responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8"); + } + + int statusCode = httpResponse.getStatusLine().getStatusCode(); + String statusMessage = httpResponse.getStatusLine().getReasonPhrase(); + + LOGGER.debug("SDNC Response: " + statusCode + " " + statusMessage + + (responseContent == null ? "" : System.lineSeparator() + responseContent)); + + if (httpResponse.getStatusLine().getStatusCode() >= 300) { + String errMsg = "SDNC returned " + statusCode + " " + statusMessage; + + String errors = analyzeErrors(responseContent); + if (errors != null) { + errMsg += " " + errors; + } + + logError(errMsg); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); + return createErrorResponse(statusCode, errMsg, rt); + } + + httpResponse = null; + + method.reset(); + method = null; + + LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", ""); + return createResponseFromContent(statusCode, statusMessage, responseContent, rt); + + } catch (SocketTimeoutException e) { + String errMsg = "Request to SDNC timed out"; + logError(errMsg, e); + return createErrorResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg, rt); + + } catch (ConnectTimeoutException e) { + String errMsg = "Request to SDNC timed out"; + logError(errMsg, e); + return createErrorResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg, rt); + + } catch (Exception e) { + String errMsg = "Error processing request to SDNC"; + logError(errMsg, e); + return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg, rt); + + } finally { + if (httpResponse != null) { + try { + EntityUtils.consume(httpResponse.getEntity()); + } catch (Exception e) { + // Ignore + } + } + + if (method != null) { + try { + method.reset(); + } catch (Exception e) { + // Ignore + } + } + } + } + + protected void logError(String errMsg) { + LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", + MsoLogger.ErrorCode.AvailabilityError, errMsg); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); + } + + protected void logError(String errMsg, Throwable t) { + LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", + MsoLogger.ErrorCode.AvailabilityError, errMsg, t); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); + } + + /** + * Generates a response object from content received from SDNC. The response + * object may be a success response object or an error response object. This + * method must be overridden by the subclass to return the correct object type. + * @param statusCode the response status code from SDNC (e.g. 200) + * @param statusMessage the response status message from SDNC (e.g. "OK") + * @param responseContent the body of the response from SDNC (possibly null) + * @param rt request tunables + * @return a response object + */ + protected abstract SDNCResponseCommon createResponseFromContent(int statusCode, + String statusMessage, String responseContent, TypedRequestTunables rt); + + /** + * Generates an error response object. This method must be overridden by the + * subclass to return the correct object type. + * @param statusCode the response status code (from SDNC, or internally generated) + * @param errMsg the error message (normally a verbose explanation of the error) + * @param rt request tunables + * @return an error response object + */ + protected abstract SDNCErrorCommon createErrorResponse(int statusCode, + String errMsg, TypedRequestTunables rt); + + /** + * Called by the send() method to analyze errors that may be encoded in the + * content of non-2XX responses. By default, this method tries to parse the + * content as a restconf error. + *
+	 *     xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf"
+	 * 
+ * If an error (or errors) can be obtained from the content, then the result + * is a string in this format: + *
+	 * [error-type:TYPE, error-tag:TAG, error-message:MESSAGE] ...
+	 * 
+ * If no error could be obtained from the content, then the result is null. + *

+ * The subclass can override this method to provide another implementation. + */ + protected String analyzeErrors(String content) { + if (content == null || content.isEmpty()) { + return null; + } + + // Confirmed with Andrew Shen on 11/1/16 that SDNC will send content like + // this in error responses (non-2XX response codes) to "agnostic" service + // requests. + // + // + // + // protocol + // malformed-message + // Error parsing input: The element type "input" must be terminated by the matching end-tag "</input>". + // + // + + String output = null; + + try { + XPathFactory xpathFactory = XPathFactory.newInstance(); + XPath xpath = xpathFactory.newXPath(); + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + InputSource source = new InputSource(new StringReader(content)); + Document doc = documentBuilderFactory.newDocumentBuilder().parse(source); + NodeList errors = (NodeList) xpath.evaluate("errors/error", doc, XPathConstants.NODESET); + + for (int i = 0; i < errors.getLength(); i++) + { + Element error = (Element) errors.item(i); + + String info = ""; + + try { + String errorType = xpath.evaluate("error-type", error); + info += "error-type:" + errorType; + } catch (XPathExpressionException e) { + LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-type", error.toString(), "SDNC", "", + MsoLogger.ErrorCode.DataError, "XPath Exception", e); + } + + try { + String errorTag = xpath.evaluate( "error-tag", error); + if (!info.isEmpty()) { + info += ", "; + } + info += "error-tag:" + errorTag; + } catch (XPathExpressionException e) { + LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-tag", error.toString(), "SDNC", "", + MsoLogger.ErrorCode.DataError, "XPath Exception", e); + } + + try { + String errorMessage = xpath.evaluate("error-message", error); + if (!info.isEmpty()) { + info += ", "; + } + info += "error-message:" + errorMessage; + } catch (Exception e) { + LOGGER.error(MessageEnum.RA_EVALUATE_XPATH_ERROR, "error-message", error.toString(), "SDNC", "", + MsoLogger.ErrorCode.DataError, "XPath Exception", e); + } + + if (!info.isEmpty()) { + if (output == null) { + output = "[" + info + "]"; + } else { + output += " [" + info + "]"; + } + } + } + } catch (Exception e) { + LOGGER.error (MessageEnum.RA_ANALYZE_ERROR_EXC, "SDNC", "", + MsoLogger.ErrorCode.DataError, "Exception while analyzing errors", e); + } + + return output; + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java new file mode 100644 index 0000000000..9808f48e7e --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java @@ -0,0 +1,156 @@ +/*- + * ============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.adapters.sdnc.sdncrest; + +import org.openecomp.mso.adapters.sdncrest.SDNCEvent; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.InputSource; + +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.StringReader; +import java.text.ParseException; + +/** + * SDNCConnector for "agnostic" API services. + */ +public class SDNCEventParser { + /** + * Parses SDNC event XML. If the content can be parsed and contains all required + * elements, then an object is returned. Otherwise, a ParseException is thrown. + * This method performs no logging or alarming. + * @throws ParseException on error + */ + public static SDNCEvent parse(String content) throws ParseException { + try { + // Note: this document builder is not namespace-aware, so namespaces are ignored. + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + InputSource source = new InputSource(new StringReader(content)); + Document doc = documentBuilderFactory.newDocumentBuilder().parse(source); + + // Find the configuration-event child under the root element. + // The root element is expected to be an "output" element, but we don't really care. + + Element root = doc.getDocumentElement(); + Element configurationEvent = null; + + for (Element child : SDNCAdapterUtils.childElements(root)) { + if ("configuration-event".equals(child.getNodeName())) { + configurationEvent = child; + break; + } + } + + if (configurationEvent == null) { + throw new ParseException("No configuration-event element in SDNC event", 0); + } + + // Process the children of configuration-event + + String eventType = null; + String eventCorrelatorType = null; + String eventCorrelator = null; + Element eventParameters = null; + + for (Element child : SDNCAdapterUtils.childElements(configurationEvent)) { + if ("event-type".equals(child.getNodeName())) { + eventType = child.getTextContent(); + } else if ("event-correlator-type".equals(child.getNodeName())) { + eventCorrelatorType = child.getTextContent(); + } else if ("event-correlator".equals(child.getNodeName())) { + eventCorrelator = child.getTextContent(); + } else if ("event-parameters".equals(child.getNodeName())) { + eventParameters = (Element) child; + } + } + + // event-type is mandatory. + + if (eventType == null || eventType.isEmpty()) { + throw new ParseException("No event-type in SDNC event", 0); + } + + // event-correlator-type is mandatory. + + if (eventCorrelatorType == null || eventCorrelatorType.isEmpty()) { + throw new ParseException("No event-correlator-type in SDNC event", 0); + } + + // event-correlator is mandatory. + + if (eventCorrelator == null || eventCorrelator.isEmpty()) { + throw new ParseException("No event-correlator in SDNC event", 0); + } + + // Create an event object. + + SDNCEvent event = new SDNCEvent(eventType, eventCorrelatorType, eventCorrelator); + + // event-parameters is an optional container element. If present, + // process its children, adding values to the event object. + + if (eventParameters != null) { + for (Element element : SDNCAdapterUtils.childElements(eventParameters)) { + if (!"event-parameter".equals(element.getNodeName())) { + continue; + } + + String tagName = null; + String tagValue = null; + + for (Element child : SDNCAdapterUtils.childElements(element)) { + if ("tag-name".equals(child.getNodeName())) { + tagName = child.getTextContent(); + } else if ("tag-value".equals(child.getNodeName())) { + tagValue = child.getTextContent(); + } + } + + // tag-name is mandatory + + if (tagName == null) { + throw new ParseException("Missing tag-name in SDNC event parameter", 0); + } + + // tag-value is optional. If absent, make it an empty string so we don't + // end up with null values in the parameter map. + + if (tagValue == null) { + tagValue = ""; + } + + event.addParam(tagName, tagValue); + } + } + + return event; + } catch (ParseException e) { + throw e; + } catch (Exception e) { + throw new ParseException("Failed to parse SDNC event", 0); + } + } + + // Instantiation is not allowed. + private SDNCEventParser() { + } +} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java new file mode 100644 index 0000000000..bd864d085a --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java @@ -0,0 +1,194 @@ +/*- + * ============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.adapters.sdnc.sdncrest; + +import org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon; +import org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon; +import org.openecomp.mso.adapters.sdncrest.SDNCServiceError; +import org.openecomp.mso.adapters.sdncrest.SDNCServiceResponse; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.InputSource; + +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.StringReader; +import java.net.HttpURLConnection; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.List; + +/** + * SDNCConnector for "agnostic" API services. + */ +public class SDNCServiceRequestConnector extends SDNCConnector { + + @Override + protected SDNCResponseCommon createResponseFromContent(int statusCode, String statusMessage, + String responseContent, TypedRequestTunables rt) { + try { + return parseResponseContent(responseContent); + } catch (ParseException e) { + logError(e.getMessage()); + return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage(), rt); + } + } + + @Override + protected SDNCErrorCommon createErrorResponse(int statusCode, String errMsg, + TypedRequestTunables rt) { + return new SDNCServiceError(rt.getReqId(), String.valueOf(statusCode), errMsg, "Y"); + } + + /** + * Parses SDNC synchronous service response content or service notification content. + * If the content can be parsed and contains all required elements, then an object + * is returned. The type of the returned object depends on the response code + * contained in the content. For 2XX response codes, an SDNCServiceResponse is + * returned. Otherwise, an SDNCServiceError is returned. If the content cannot + * be parsed, or if the content does not contain all required elements, a parse + * exception is thrown. This method performs no logging or alarming. + * @throws ParseException on error + */ + public static SDNCResponseCommon parseResponseContent(String responseContent) + throws ParseException { + try { + // Note: this document builder is not namespace-aware, so namespaces are ignored. + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + InputSource source = new InputSource(new StringReader(responseContent)); + Document doc = documentBuilderFactory.newDocumentBuilder().parse(source); + + // Find the configuration-response-common child under the root element. + // The root element is expected to be an "output" element, but we don't really care. + + Element root = doc.getDocumentElement(); + Element configurationResponseCommon = null; + + for (Element child : SDNCAdapterUtils.childElements(root)) { + if ("configuration-response-common".equals(child.getNodeName())) { + configurationResponseCommon = child; + break; + } + } + + if (configurationResponseCommon == null) { + throw new ParseException("No configuration-response-common element in SDNC response", 0); + } + + // Process the children of configuration-response-common. + + String responseCode = null; + String responseMessage = null; + String svcRequestId = null; + String ackFinalIndicator = null; + List responseParameters = new ArrayList(); + + for (Element child : SDNCAdapterUtils.childElements(configurationResponseCommon)) { + if ("response-code".equals(child.getNodeName())) { + responseCode = child.getTextContent(); + } else if ("response-message".equals(child.getNodeName())) { + responseMessage = child.getTextContent(); + } else if ("svc-request-id".equals(child.getNodeName())) { + svcRequestId = child.getTextContent(); + } else if ("ack-final-indicator".equals(child.getNodeName())) { + ackFinalIndicator = child.getTextContent(); + } else if ("response-parameters".equals(child.getNodeName())) { + responseParameters.add((Element) child); + } + } + + // svc-request-id is mandatory. + + if (svcRequestId == null || svcRequestId.isEmpty()) { + throw new ParseException("No svc-request-id in SDNC response", 0); + } + + // response-code is mandatory. + + if (responseCode == null || responseCode.isEmpty()) { + throw new ParseException("No response-code in SDNC response", 0); + } + + // ack-final-indicator is optional: default to "Y". + + if (ackFinalIndicator == null) { + ackFinalIndicator = "Y"; + } + + if (!ackFinalIndicator.equals("Y") && !ackFinalIndicator.equals("N")) { + throw new ParseException("Invalid ack-final-indicator in SDNC response: '" + ackFinalIndicator + "'", 0); + } + + // response-message is optional. If the value is empty, omit it from the response object. + + if (responseMessage != null && responseMessage.isEmpty()) { + responseMessage = null; + } + + // If the response code in the message from SDNC was not 2XX, return SDNCServiceError. + + if (!responseCode.matches("2[0-9][0-9]")) { + // Not a 2XX response. Return SDNCServiceError. + return new SDNCServiceError(svcRequestId, responseCode, responseMessage, ackFinalIndicator); + } + + // Create a success response object. + + SDNCServiceResponse response = new SDNCServiceResponse(svcRequestId, + responseCode, responseMessage, ackFinalIndicator); + + // Process any response-parameters that might be present. + + for (Element element : responseParameters) { + String tagName = null; + String tagValue = null; + + for (Element child : SDNCAdapterUtils.childElements(element)) { + if ("tag-name".equals(child.getNodeName())) { + tagName = child.getTextContent(); + } else if ("tag-value".equals(child.getNodeName())) { + tagValue = child.getTextContent(); + } + } + + // tag-name is mandatory + + if (tagName == null) { + throw new ParseException("Missing tag-name in SDNC response parameter", 0); + } + + // tag-value is optional. If absent, make it an empty string so we don't + // end up with null values in the parameter map. + + if (tagValue == null) { + tagValue = ""; + } + + response.addParam(tagName, tagValue); + } + return response; + } catch (ParseException e) { + throw e; + } catch (Exception e) { + throw new ParseException("Failed to parse SDNC response", 0); + } + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java new file mode 100644 index 0000000000..e52a426b4d --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java @@ -0,0 +1,205 @@ +/*- + * ============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.adapters.sdnc.sdncrest; + +import org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon; +import org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon; +import org.openecomp.mso.adapters.sdncrest.SDNCServiceError; +import org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; +import org.apache.http.HttpStatus; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import java.io.StringWriter; + +public class SDNCServiceRequestTask implements Runnable { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + + private final SDNCServiceRequest request; + private final String msoRequestId; + private final String msoServiceInstanceId; + private final String myUrlSuffix; + + public SDNCServiceRequestTask(SDNCServiceRequest request, + String msoRequestId, String msoServiceInstanceId, + String myUrlSuffix) { + this.request = request; + this.msoRequestId = msoRequestId; + this.msoServiceInstanceId = msoServiceInstanceId; + this.myUrlSuffix = myUrlSuffix; + } + + @Override + public void run() + { + MsoLogger.setLogContext(msoRequestId, msoServiceInstanceId); + MsoLogger.setServiceName(getClass().getSimpleName()); + + LOGGER.debug(getClass().getSimpleName() + ".run()" + + " entered with request: " + request.toJson()); + + String sdncRequestId = request.getSDNCRequestId(); + String sdncService = request.getSDNCService(); + String sdncOperation = request.getSDNCOperation(); + + TypedRequestTunables rt = new TypedRequestTunables(sdncRequestId, myUrlSuffix); + rt.setServiceKey(sdncService, sdncOperation); + + if (!rt.setTunables()) { + // Note that the error was logged and alarmed by setTunables() + SDNCServiceError error = new SDNCServiceError(request.getSDNCRequestId(), + String.valueOf(HttpStatus.SC_INTERNAL_SERVER_ERROR), rt.getError(), "Y"); + BPRestCallback callback = new BPRestCallback(); + callback.send(request.getBPNotificationUrl(), error.toJson()); + return; + } + + String xml = genSdncReq(request, rt); + + long sdncStartTime = System.currentTimeMillis(); + SDNCConnector connector = new SDNCServiceRequestConnector(); + SDNCResponseCommon response = connector.send(xml, rt); + + if (response instanceof SDNCErrorCommon) { + LOGGER.recordMetricEvent(sdncStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Received success response from SDNC", "SDNC", sdncService + "." + sdncOperation, null); + } else { + LOGGER.recordMetricEvent(sdncStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, + "Received error response from SDNC", "SDNC", sdncService + "." + sdncOperation, null); + } + + long bpStartTime = System.currentTimeMillis(); + BPRestCallback callback = new BPRestCallback(); + boolean callbackSuccess = callback.send(request.getBPNotificationUrl(), response.toJson()); + + if (callbackSuccess) { + LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Sent notification", "BPMN", request.getBPNotificationUrl(), null); + } else { + LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, + "Failed to send notification", "BPMN", request.getBPNotificationUrl(), null); + } + } + + private Element addChild(Element parent, String tag) { + Element child = parent.getOwnerDocument().createElement(tag); + parent.appendChild(child); + return child; + } + + private void addTextChild(Element parent, String tag, String text) { + if (text != null) { + Element child = parent.getOwnerDocument().createElement(tag); + child.setTextContent(text); + parent.appendChild(child); + } + } + + private String genSdncReq(SDNCServiceRequest request, TypedRequestTunables rt) { + Document doc; + + try { + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); + + doc = documentBuilder.newDocument(); + Element root = doc.createElementNS(rt.getNamespace(), "input"); + doc.appendChild(root); + + Element hdr = addChild(root, rt.getHeaderName()); + addTextChild(hdr, "svc-request-id", rt.getReqId()); + addTextChild(hdr, "svc-notification-url", rt.getMyUrl()); + + Element requestInformation = addChild(root, "request-information"); + addTextChild(requestInformation, "request-id", request.getRequestInformation().getRequestId()); + addTextChild(requestInformation, "source", request.getRequestInformation().getSource()); + addTextChild(requestInformation, "notification-url", request.getRequestInformation().getNotificationUrl()); + + Element serviceInformation = addChild(root, "service-information"); + addTextChild(serviceInformation, "service-type", request.getServiceInformation().getServiceType()); + addTextChild(serviceInformation, "service-instance-id", request.getServiceInformation().getServiceInstanceId()); + addTextChild(serviceInformation, "subscriber-name", request.getServiceInformation().getSubscriberName()); + addTextChild(serviceInformation, "subscriber-global-id", request.getServiceInformation().getSubscriberGlobalId()); + + Element agnosticServiceInformation = addChild(root, "agnostic-service-information"); + addTextChild(agnosticServiceInformation, "operation", request.getSDNCOperation()); + addTextChild(agnosticServiceInformation, "service", request.getSDNCService()); + + // anydata is mandatory in the SDNC schema, so if the data we got is null, + // set use an empty string instead to ensure we generate an empty element. + + String anydata = request.getSDNCServiceData(); + if (anydata == null) { + anydata = ""; + } + + // content-type is also mandatory. + + String contentType = request.getSDNCServiceDataType(); + + if (contentType == null || contentType.isEmpty()) { + if (anydata.isEmpty()) { + contentType = "XML"; + } else { + if (anydata.startsWith("<")) { + contentType = "XML"; + } else { + contentType = "JSON"; + } + } + } + + addTextChild(agnosticServiceInformation, "content-type", contentType); + addTextChild(agnosticServiceInformation, "anydata", anydata); + } catch (Exception e) { + LOGGER.error(MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST, "SDNC", "", + MsoLogger.ErrorCode.BusinessProcesssError, "Exception in genSdncReq", e); + return null; + } + + String xml; + + try { + StringWriter writer = new StringWriter(); + Transformer transformer = TransformerFactory.newInstance().newTransformer(); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); + transformer.transform(new DOMSource(doc), new StreamResult(writer)); + xml = writer.toString(); + } catch (Exception e) { + LOGGER.error(MessageEnum.RA_ERROR_CONVERT_XML2STR, "", "", + MsoLogger.ErrorCode.DataError, "Exception - domToStr", e); + return(null); + } + + LOGGER.debug("Formatted SDNC service request XML:\n" + xml); + return xml; + } +} diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SNIROResponse.java new file mode 100644 index 0000000000..2045b8c353 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SNIROResponse.java @@ -0,0 +1,78 @@ +/*- + * ============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.adapters.sdnc.sdncrest; + +import org.openecomp.mso.adapters.sdnc.impl.Constants; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoAlarmLogger; +import org.openecomp.mso.logger.MsoLogger; + +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +/** + * A temporary interface to support notifications from SNIRO to BPMN. + * We added this to the SDNC adapter because we didn't have time to + * develop a SNIRO adapter in 1702. + */ +@Path("/") +public class SNIROResponse { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); + + @POST + @Path("/SDNCNotify/SNIROResponse/{correlator}") + @Consumes("*/*") + @Produces({MediaType.TEXT_PLAIN}) + public Response serviceNotification(@PathParam("correlator") String correlator, String content) { + LOGGER.info(MessageEnum.RA_RECEIVE_SDNC_NOTIF, content, "SDNC", "SDNCNotify/SNIROResponse"); + + long startTime = System.currentTimeMillis(); + + String bpUrl = SDNCAdapterProperties.getProperty(Constants.BPEL_REST_URL_PROP, null); + + if (bpUrl == null) { + String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP; + LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "", + MsoLogger.ErrorCode.DataError, "Missing config param"); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build(); + } + + long bpStartTime = System.currentTimeMillis(); + BPRestCallback callback = new BPRestCallback(); + boolean callbackSuccess = callback.send(bpUrl, "SNIROResponse", correlator, content); + + if (callbackSuccess) { + LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Sent notification", "BPMN", bpUrl, null); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); + } else { + LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, + "Failed to send notification", "BPMN", bpUrl, null); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, + "Failed to send notification"); + } + + return Response.status(204).build(); + } +} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunables.java new file mode 100644 index 0000000000..4c270cee60 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunables.java @@ -0,0 +1,224 @@ +/*- + * ============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.adapters.sdnc.sdncrest; + +import org.openecomp.mso.adapters.sdnc.impl.Constants; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoAlarmLogger; +import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.properties.MsoJavaProperties; +import org.openecomp.mso.properties.MsoPropertiesException; +import org.openecomp.mso.properties.MsoPropertiesFactory; + +/** + * Typed Request Tunables. Each entry is identified by a TYPE in the property name. + * Different types can have different keys. + *

+ * General format: + *

+ * org.openecomp.mso.adapters.sdnc.TYPE.KEY1[.KEY2...]=METHOD|TIMEOUT|URL|HEADER|NAMESPACE
+ * 
+ * Currently supported type(s): service + *
+ * org.openecomp.mso.adapters.sdnc.service.SERVICE.OPERATION=METHOD|TIMEOUT|URL|HEADER|NAMESPACE
+ * 
+ */ +public class TypedRequestTunables { + + private static final String MSO_PROPERTIES_ID = "MSO_PROP_SDNC_ADAPTER"; + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger(); + + private final MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); + + private final String reqId; + private final String myUrlSuffix; + private String key = null; + private String error = null; + + // tunables (all are required) + private String reqMethod = null; + private String timeout = null; + private String sdncUrl = null; + private String headerName = null; + private String namespace = null; + private String myUrl = null; + + public TypedRequestTunables(String reqId, String myUrlSuffix) { + this.reqId = reqId; + this.myUrlSuffix = myUrlSuffix; + } + + /** + * Sets the key for a service request: + *
+	 * org.openecomp.mso.adapters.sdnc.service.SERVICE.OPERATION
+	 * 
+ * @param service the sdncService + * @param operation the sdncOperation + */ + public void setServiceKey(String service, String operation) { + key = Constants.REQUEST_TUNABLES + ".service." + service + "." + operation; + LOGGER.debug("Generated " + getClass().getSimpleName() + " key: " + key); + } + + /** + * Gets the SDNC request ID. + */ + public String getReqId() { + return reqId; + } + + /** + * Gets the generated key. + */ + public String getKey() { + return key; + } + + /** + * Gets the most recent error, or null if there was no error. + */ + public String getError() { + return error; + } + + public String getReqMethod() { + return reqMethod; + } + + public String getTimeout() { + return timeout; + } + + public String getSdncUrl() { + return sdncUrl; + } + + public String getHeaderName() { + return headerName; + } + + public String getNamespace() { + return namespace; + } + + /** + * Gets the SDNC adapter notification URL, trimmed of trailing '/' characters. + */ + public String getMyUrl() { + return myUrl; + } + + /** + * Returns true if successful. If there is an error, it is logged and alarmed. + * The error description may be retrieved by calling getError(). + */ + public boolean setTunables() { + error = null; + MsoJavaProperties properties; + + try { + properties = msoPropertiesFactory.getMsoJavaProperties(MSO_PROPERTIES_ID); + } catch (MsoPropertiesException e) { + error = "Mso Properties ID not found in cache: " + MSO_PROPERTIES_ID; + LOGGER.error(MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. " + error, "SDNC", "", + MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + return false; + } + + String value = properties.getProperty(key, ""); + + if (value.equals("")) { + error = "Missing configuration for: " + key; + LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, key, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param"); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + return false; + } + + String[] parts = value.split("\\|"); + + if (parts.length != 5) { + error = "Invalid configuration for: " + key; + LOGGER.error(MessageEnum.RA_SDNC_INVALID_CONFIG, key, value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config"); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + return false; + } + + reqMethod = parts[0]; + LOGGER.debug("Request Method is set to: " + reqMethod); + + timeout = parts[1]; + LOGGER.debug("Timeout is set to: " + timeout); + + String urlPropKey = Constants.REQUEST_TUNABLES + "." + parts[2]; + sdncUrl = properties.getProperty(urlPropKey, ""); + + if (sdncUrl.equals("")) { + error = "Missing configuration for: " + urlPropKey; + LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, urlPropKey, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param"); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + return false; + } + + LOGGER.debug("SDNC Url is set to: " + sdncUrl); + + headerName = parts[3]; + LOGGER.debug("Header Name is set to: " + headerName); + + namespace = parts[4]; + LOGGER.debug("Namespace is set to: " + namespace); + + myUrl = properties.getProperty(Constants.MY_URL_PROP, ""); + + if (myUrl.equals("")) { + error = "Missing configuration for: " + Constants.MY_URL_PROP; + LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.MY_URL_PROP, "SDNC", "", + MsoLogger.ErrorCode.DataError, "Missing config param"); + ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + return false; + } + + while (myUrl.endsWith("/")) { + myUrl = myUrl.substring(0, myUrl.length()-1); + } + + myUrl += myUrlSuffix; + + LOGGER.debug(toString()); + return true; + } + + @Override + public String toString() { + return getClass().getSimpleName() + "[" + + "reqId=" + reqId + + (key == null ? "" : ", key=" + key) + + (reqMethod == null ? "" : ", reqMethod=" + reqMethod) + + (sdncUrl == null ? "" : ", sdncUrl=" + sdncUrl) + + (timeout == null ? "" : ", timeout=" + timeout) + + (headerName == null ? "" : ", headerName=" + headerName) + + (namespace == null ? "" : ", namespace=" + namespace) + + (myUrl == null ? "" : ", myUrl=" + myUrl) + + "]"; + } +} \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapter.wsdl b/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapter.wsdl index 2f4c5ad5eb..7a66cd418b 100644 --- a/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapter.wsdl +++ b/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapter.wsdl @@ -1,16 +1,16 @@ + targetNamespace="http://org.openecomp/workflow/sdnc/adapter/wsdl/v1"> - + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapterSchema.xsd b/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapterSchema.xsd index f0e4435771..ed904d4a2e 100644 --- a/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapterSchema.xsd +++ b/adapters/mso-sdnc-adapter/src/main/resources/SDNCAdapterSchema.xsd @@ -1,8 +1,8 @@ - diff --git a/adapters/mso-sdnc-adapter/src/main/resources/SDNCCallbackAdapter.wsdl b/adapters/mso-sdnc-adapter/src/main/resources/SDNCCallbackAdapter.wsdl index 1429b5f1c7..0a106752fb 100644 --- a/adapters/mso-sdnc-adapter/src/main/resources/SDNCCallbackAdapter.wsdl +++ b/adapters/mso-sdnc-adapter/src/main/resources/SDNCCallbackAdapter.wsdl @@ -1,16 +1,16 @@ + targetNamespace="http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1"> - + diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/ObjectMappingTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/ObjectMappingTest.java new file mode 100644 index 0000000000..39090158b3 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/ObjectMappingTest.java @@ -0,0 +1,477 @@ +/*- + * ============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.adapters.sdnc.sdncrest; + +import org.openecomp.mso.adapters.sdncrest.SDNCEvent; +import org.openecomp.mso.adapters.sdncrest.SDNCServiceError; +import org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest; +import org.openecomp.mso.adapters.sdncrest.SDNCServiceResponse; +import org.codehaus.jackson.map.DeserializationConfig; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.map.SerializationConfig; +import org.junit.Test; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.Arrays; + +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertEquals; + + + +/** + * JSON object mapping tests. + */ +public class ObjectMappingTest { + private static final String EOL = "\n"; + + private final String SDNC_SERVICE_REQUEST = + "{" + EOL + + " \"SDNCServiceRequest\": {" + EOL + + " \"requestInformation\": {" + EOL + + " \"requestId\": \"413658f4-7f42-482e-b834-23a5c15657da\"," + EOL + + " \"source\": \"CCD\"," + EOL + + " \"notificationUrl\": \"https://ccd-host:8080/notifications\"" + EOL + + " }," + EOL + + " \"serviceInformation\": {" + EOL + + " \"serviceType\": \"vHNFaaS\"," + EOL + + " \"serviceInstanceId\": \"74e65b2b637441bca078e63e44bb511b\"," + EOL + + " \"subscriberName\": \"IST_SG_0902_3003\"," + EOL + + " \"subscriberGlobalId\": \"IST15_0902_3003\"" + EOL + + " }," + EOL + + " \"bpNotificationUrl\": \"http://localhost:8080/mso/SDNCAdapterCallbackService\"," + EOL + + "((BP-TIMEOUT))" + + " \"sdncRequestId\": \"413658f4-7f42-482e-b834-23a5c15657da-1474471336781\"," + EOL + + " \"sdncService\": \"vhnf\"," + EOL + + " \"sdncOperation\": \"service-topology-cust-assign-operation\"," + EOL + + " \"sdncServiceDataType\": \"XML\"," + EOL + + " \"sdncServiceData\": \"c26dfed652164d60a17461734422b085HOSTNAME\"" + EOL + + " }" + EOL + + "}" + EOL; + + private final String SDNC_SERVICE_RESPONSE = + "{" + EOL + + " \"SDNCServiceResponse\": {" + EOL + + " \"sdncRequestId\": \"413658f4-7f42-482e-b834-23a5c15657da-1474471336781\"," + EOL + + " \"responseCode\": \"200\"," + EOL + + "((RESPONSE-MESSAGE))" + + " \"ackFinalIndicator\": \"Y\"" + EOL + + "((RESPONSE-PARAMS))" + + " }" + EOL + + "}" + EOL; + + private final String SDNC_SERVICE_ERROR = + "{" + EOL + + " \"SDNCServiceError\": {" + EOL + + " \"sdncRequestId\": \"413658f4-7f42-482e-b834-23a5c15657da-1474471336781\"," + EOL + + " \"responseCode\": \"500\"," + EOL + + "((RESPONSE-MESSAGE))" + + " \"ackFinalIndicator\": \"Y\"" + EOL + + " }" + EOL + + "}" + EOL; + + private final String SDNC_EVENT = + "{" + EOL + + " \"SDNCEvent\": {" + EOL + + " \"eventType\": \"ACTIVATION\"," + EOL + + " \"eventCorrelatorType\": \"HOST-NAME\"," + EOL + + " \"eventCorrelator\": \"USOSTCDALTX0101UJZZ31\"" + EOL + + "((EVENT-PARAMS))" + + " }" + EOL + + "}" + EOL; + + private final String PARAMS = + "{\"entry\":[{\"key\":\"P1\",\"value\":\"V1\"},{\"key\":\"P2\",\"value\":\"V2\"},{\"key\":\"P3\",\"value\":\"V3\"}]}"; + + @Test + public final void jsonToSDNCServiceRequest() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + + String json = SDNC_SERVICE_REQUEST; + json = json.replace("((BP-TIMEOUT))", "\"bpTimeout\": \"" + "PT5M" + "\"," + EOL); + + SDNCServiceRequest object = mapper.readValue(json, SDNCServiceRequest.class); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da", object.getRequestInformation().getRequestId()); + assertEquals("CCD", object.getRequestInformation().getSource()); + assertEquals("https://ccd-host:8080/notifications", object.getRequestInformation().getNotificationUrl()); + assertEquals("vHNFaaS", object.getServiceInformation().getServiceType()); + assertEquals("74e65b2b637441bca078e63e44bb511b", object.getServiceInformation().getServiceInstanceId()); + assertEquals("IST_SG_0902_3003", object.getServiceInformation().getSubscriberName()); + assertEquals("IST15_0902_3003", object.getServiceInformation().getSubscriberGlobalId()); + assertEquals("http://localhost:8080/mso/SDNCAdapterCallbackService", object.getBPNotificationUrl()); + assertEquals("PT5M", object.getBPTimeout()); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId()); + assertEquals("vhnf", object.getSDNCService()); + assertEquals("service-topology-cust-assign-operation", object.getSDNCOperation()); + assertEquals("XML", object.getSDNCServiceDataType()); + assertTrue(object.getSDNCServiceData().startsWith("")); + } + + @Test + public final void jsonToSDNCServiceRequestWithoutOptionalFields() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + + // bpTimeout is optional. + String json = SDNC_SERVICE_REQUEST; + json = json.replace("((BP-TIMEOUT))", ""); + + SDNCServiceRequest object = mapper.readValue(json, SDNCServiceRequest.class); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da", object.getRequestInformation().getRequestId()); + assertEquals("CCD", object.getRequestInformation().getSource()); + assertEquals("https://ccd-host:8080/notifications", object.getRequestInformation().getNotificationUrl()); + assertEquals("vHNFaaS", object.getServiceInformation().getServiceType()); + assertEquals("74e65b2b637441bca078e63e44bb511b", object.getServiceInformation().getServiceInstanceId()); + assertEquals("IST_SG_0902_3003", object.getServiceInformation().getSubscriberName()); + assertEquals("IST15_0902_3003", object.getServiceInformation().getSubscriberGlobalId()); + assertEquals("http://localhost:8080/mso/SDNCAdapterCallbackService", object.getBPNotificationUrl()); + assertNull(object.getBPTimeout()); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId()); + assertEquals("vhnf", object.getSDNCService()); + assertEquals("service-topology-cust-assign-operation", object.getSDNCOperation()); + assertEquals("XML", object.getSDNCServiceDataType()); + assertTrue(object.getSDNCServiceData().startsWith("")); + } + + @Test + public final void jsonFromSDNCServiceRequest() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + + // Convert source json string to object. + String json1 = SDNC_SERVICE_REQUEST; + json1 = json1.replace("((BP-TIMEOUT))", "\"bpTimeout\": \"" + "PT5M" + "\"," + EOL); + SDNCServiceRequest object1 = mapper.readValue(json1, SDNCServiceRequest.class); + + // Convert resulting object back to json. + String json2 = object1.toJson(); + System.out.println("Generated JSON for " + object1.getClass().getSimpleName() + + ":" + System.lineSeparator() + json2); + assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceRequest\":{")); + + // Convert generated json string to another object. + SDNCServiceRequest object2 = mapper.readValue(json2, SDNCServiceRequest.class); + + // Compare the first object to the second object. + assertTrue(serializedEquals(object1, object2)); + } + + @Test + public final void jsonFromSDNCServiceRequestWithoutOptionalFields() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + + // Convert source json string to object. + String json1 = SDNC_SERVICE_REQUEST; + json1 = json1.replace("((BP-TIMEOUT))", ""); + SDNCServiceRequest object1 = mapper.readValue(json1, SDNCServiceRequest.class); + + // Convert resulting object back to json. + String json2 = object1.toJson(); + System.out.println("Generated JSON for " + object1.getClass().getSimpleName() + + ":" + System.lineSeparator() + json2); + assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceRequest\":{")); + + // Convert generated json string to another object. + SDNCServiceRequest object2 = mapper.readValue(json2, SDNCServiceRequest.class); + + // Compare the first object to the second object. + assertTrue(serializedEquals(object1, object2)); + } + + @Test + public final void jsonToSDNCServiceResponse() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + + String json = SDNC_SERVICE_RESPONSE; + json = json.replace("((RESPONSE-MESSAGE))", " \"responseMessage\": \"" + "OK" + "\"," + EOL); + json = json.replace(EOL + "((RESPONSE-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL); + + SDNCServiceResponse object = mapper.readValue(json, SDNCServiceResponse.class); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId()); + assertEquals("200", object.getResponseCode()); + assertEquals("OK", object.getResponseMessage()); + assertEquals("Y", object.getAckFinalIndicator()); + assertEquals("V1", object.getParams().get("P1")); + assertEquals("V2", object.getParams().get("P2")); + assertEquals("V3", object.getParams().get("P3")); + } + + @Test + public final void jsonToSDNCServiceResponseWithoutOptionalFields() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + + // responseMessage is optional. + String json = SDNC_SERVICE_RESPONSE; + json = json.replace("((RESPONSE-MESSAGE))", ""); + json = json.replace("((RESPONSE-PARAMS))", ""); + + SDNCServiceResponse object = mapper.readValue(json, SDNCServiceResponse.class); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId()); + assertEquals("200", object.getResponseCode()); + assertNull(object.getResponseMessage()); + assertEquals("Y", object.getAckFinalIndicator()); + assertNull(object.getParams()); + } + + @Test + public final void jsonFromSDNCServiceResponse() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + + // Convert source json string to object. + String json1 = SDNC_SERVICE_RESPONSE; + json1 = json1.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "OK" + "\"," + EOL); + json1 = json1.replace(EOL + "((RESPONSE-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL); + SDNCServiceResponse object1 = mapper.readValue(json1, SDNCServiceResponse.class); + + // Convert resulting object back to json. + String json2 = object1.toJson(); + System.out.println("Generated JSON for " + object1.getClass().getSimpleName() + + ":" + System.lineSeparator() + json2); + assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceResponse\":{")); + + // Convert generated json string to another object. + SDNCServiceResponse object2 = mapper.readValue(json2, SDNCServiceResponse.class); + + // Compare the first object to the second object. + assertTrue(serializedEquals(object1, object2)); + } + + @Test + public final void jsonFromSDNCServiceResponseWithoutOptionalFields() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + + // Convert source json string to object. + String json1 = SDNC_SERVICE_RESPONSE; + json1 = json1.replace("((RESPONSE-MESSAGE))", ""); + json1 = json1.replace("((RESPONSE-PARAMS))", ""); + SDNCServiceResponse object1 = mapper.readValue(json1, SDNCServiceResponse.class); + + // Convert resulting object back to json. + String json2 = object1.toJson(); + System.out.println("Generated JSON for " + object1.getClass().getSimpleName() + + ":" + System.lineSeparator() + json2); + assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceResponse\":{")); + + // Convert generated json string to another object. + SDNCServiceResponse object2 = mapper.readValue(json2, SDNCServiceResponse.class); + + // Compare the first object to the second object. + assertTrue(serializedEquals(object1, object2)); + } + + @Test + public final void jsonToSDNCServiceError() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + + String json = SDNC_SERVICE_ERROR; + json = json.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "SOMETHING BAD" + "\"," + EOL); + + SDNCServiceError object = mapper.readValue(json, SDNCServiceError.class); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId()); + assertEquals("500", object.getResponseCode()); + assertEquals("SOMETHING BAD", object.getResponseMessage()); + assertEquals("Y", object.getAckFinalIndicator()); + } + + @Test + public final void jsonToSDNCServiceErrorWithoutOptionalFields() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + + // responseMessage is optional. + String json = SDNC_SERVICE_ERROR; + json = json.replace("((RESPONSE-MESSAGE))", ""); + + SDNCServiceError object = mapper.readValue(json, SDNCServiceError.class); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId()); + assertEquals("500", object.getResponseCode()); + assertNull(object.getResponseMessage()); + assertEquals("Y", object.getAckFinalIndicator()); + } + + @Test + public final void jsonFromSDNCServiceError() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + + // Convert source json string to object. + String json1 = SDNC_SERVICE_ERROR; + json1 = json1.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "OK" + "\"," + EOL); + SDNCServiceError object1 = mapper.readValue(json1, SDNCServiceError.class); + + // Convert resulting object back to json. + String json2 = object1.toJson(); + System.out.println("Generated JSON for " + object1.getClass().getSimpleName() + + ":" + System.lineSeparator() + json2); + assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceError\":{")); + + // Convert generated json string to another object. + SDNCServiceError object2 = mapper.readValue(json2, SDNCServiceError.class); + + // Compare the first object to the second object. + assertTrue(serializedEquals(object1, object2)); + } + + @Test + public final void jsonFromSDNCServiceErrorWithoutOptionalFields() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + + // Convert source json string to object. + String json1 = SDNC_SERVICE_ERROR; + json1 = json1.replace("((RESPONSE-MESSAGE))", ""); + SDNCServiceError object1 = mapper.readValue(json1, SDNCServiceError.class); + + // Convert resulting object back to json. + String json2 = object1.toJson(); + System.out.println("Generated JSON for " + object1.getClass().getSimpleName() + + ":" + System.lineSeparator() + json2); + assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceError\":{")); + + // Convert generated json string to another object. + SDNCServiceError object2 = mapper.readValue(json2, SDNCServiceError.class); + + // Compare the first object to the second object. + assertTrue(serializedEquals(object1, object2)); + } + + @Test + public final void jsonToSDNCEvent() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + + String json = SDNC_EVENT; + json = json.replace(EOL + "((EVENT-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL); + + SDNCEvent object = mapper.readValue(json, SDNCEvent.class); + assertEquals("ACTIVATION", object.getEventType()); + assertEquals("HOST-NAME", object.getEventCorrelatorType()); + assertEquals("USOSTCDALTX0101UJZZ31", object.getEventCorrelator()); + assertEquals("V1", object.getParams().get("P1")); + assertEquals("V2", object.getParams().get("P2")); + assertEquals("V3", object.getParams().get("P3")); + } + + @Test + public final void jsonToSDNCEventWithoutOptionalFields() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + + // params are optional. + String json = SDNC_EVENT; + json = json.replace("((EVENT-PARAMS))", ""); + + SDNCEvent object = mapper.readValue(json, SDNCEvent.class); + assertEquals("ACTIVATION", object.getEventType()); + assertEquals("HOST-NAME", object.getEventCorrelatorType()); + assertEquals("USOSTCDALTX0101UJZZ31", object.getEventCorrelator()); + assertNull(object.getParams()); + } + + @Test + public final void jsonFromSDNCEvent() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationConfig.Feature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE); + + // Convert source json string to object. + String json1 = SDNC_EVENT; + json1 = json1.replace(EOL + "((EVENT-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL); + SDNCEvent object1 = mapper.readValue(json1, SDNCEvent.class); + + // Convert resulting object back to json. + String json2 = object1.toJson(); + System.out.println("Generated JSON for " + object1.getClass().getSimpleName() + + ":" + System.lineSeparator() + json2); + assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCEvent\":{")); + + // Convert generated json string to another object. + SDNCEvent object2 = mapper.readValue(json2, SDNCEvent.class); + + // Compare the first object to the second object. + assertTrue(serializedEquals(object1, object2)); + } + + /** + * Tests equality of two objects by comparing their serialized form. + * WARNING: this works pretty well as long as the objects don't contain + * collections like maps and sets that are semantically equal, but have + * different internal ordering of elements. + */ + private boolean serializedEquals(Serializable object1, Serializable object2) throws IOException { + ByteArrayOutputStream byteStream1 = new ByteArrayOutputStream(); + ObjectOutputStream objectStream1 = new ObjectOutputStream(byteStream1); + objectStream1.writeObject(object1); + objectStream1.close(); + + ByteArrayOutputStream byteStream2 = new ByteArrayOutputStream(); + ObjectOutputStream objectStream2 = new ObjectOutputStream(byteStream2); + objectStream2.writeObject(object2); + objectStream2.close(); + + return Arrays.equals(byteStream1.toByteArray(), byteStream2.toByteArray()); + } + + private void logTest() { + StackTraceElement[] st = Thread.currentThread().getStackTrace(); + String method = st[2].getMethodName(); + System.out.println("RUNNING TEST: " + method); + } +} diff --git a/adapters/mso-sdnc-adapter/src/test/resources/mso.properties b/adapters/mso-sdnc-adapter/src/test/resources/mso.properties index 5384285306..2428b512b1 100644 --- a/adapters/mso-sdnc-adapter/src/test/resources/mso.properties +++ b/adapters/mso-sdnc-adapter/src/test/resources/mso.properties @@ -23,26 +23,16 @@ #EE# org.openecomp.mso.adapters.sdnc.sdncgeturl=https://localhost:8443/restconf/config/L3SDN-API: org.openecomp.mso.adapters.sdnc.sdncposturl=https://localhost:8443/restconf/operations/L3SDN-API: -#ST#org.openecomp.mso.adapters.sdnc.sdncgeturl=https://sdncodl.mtsnjdcp1.aic.cip.att.com:8443/restconf/config/L3SDN-API: -#ST#org.openecomp.mso.adapters.sdnc.sdncposturl=https://sdncodl.mtsnjdcp1.aic.cip.att.com:8443/restconf/operations/L3SDN-API: -#IT#org.openecomp.mso.adapters.sdnc.sdncgeturl=https://odl.node01.it.app.sdn.labs.att.com:8443/restconf/config/L3SDN-API: -#IT#org.openecomp.mso.adapters.sdnc.sdncposturl=https://odl.node01.it.app.sdn.labs.att.com:8443/restconf/operations/L3SDN-API: ### ### BPEL ASYNC CALLLBACK/NOTIFICATION URL ### #EE# org.openecomp.mso.adapters.sdnc.bpelurl=http://localhost:8080/active-bpel/services/SDNCAdapterCallbackV1 -#ST#org.openecomp.mso.adapters.sdnc.bpelurl=http://mtsnjv9mobp01.aic.cip.att.com:8080/active-bpel/services/SDNCAdapterCallbackV1 -#IT#org.openecomp.mso.adapters.sdnc.bpelurl=http://mtanjv9mobp01.aic.cip.att.com:8080/active-bpel/services/SDNCAdapterCallbackV1 -#DV#org.openecomp.mso.adapters.sdnc.bpelurl=http://NJCDTL21RA1926.ITServices.sbc.com:8088/mockSDNCCallbackAdapterSoapHttpBinding?wsdl ### ### SDNC ASYNC NOTIFICATION/RESPONSE URL ### #EE# org.openecomp.mso.adapters.sdnc.myurl=https://localhost:8443/adapters/rest/SDNCNotify -#ST#org.openecomp.mso.adapters.sdnc.myurl=https://msojra.mtsnjdcp1.aic.cip.att.com:8443/adapters/rest/SDNCNotify -#IT#org.openecomp.mso.adapters.sdnc.myurl=http://mtanjv9moja01.aic.cip.att.com:8080/adapters/rest/SDNCNotify -#DV#org.openecomp.mso.adapters.sdnc.myurl=http://NJCDTL21RA1926.ITServices.sbc.com:8080/adapters/rest/SDNCNotify ### org.openecomp.mso.adapters.sdnc.sdncauth=admin:admin org.openecomp.mso.adapters.sdnc.bpelauth=avosAdmin:jboss123 diff --git a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapter.java b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapter.java index a86c93828f..9e874bcc00 100644 --- a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapter.java +++ b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapter.java @@ -35,7 +35,7 @@ import org.openecomp.mso.adapters.tenant.exceptions.TenantException; import org.openecomp.mso.adapters.tenantrest.TenantRollback; import org.openecomp.mso.entity.MsoRequest; -@WebService (name="TenantAdapter", targetNamespace="http://com.att.mso/tenant") +@WebService (name="TenantAdapter", targetNamespace="http://org.openecomp.mso/tenant") public interface MsoTenantAdapter { /** diff --git a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java index 040c682b3d..c90308394e 100644 --- a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java +++ b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java @@ -41,7 +41,7 @@ import org.openecomp.mso.openstack.exceptions.MsoException; import org.openecomp.mso.openstack.utils.MsoTenantUtils; import org.openecomp.mso.openstack.utils.MsoTenantUtilsFactory; -@WebService(serviceName = "TenantAdapter", endpointInterface = "org.openecomp.mso.adapters.tenant.MsoTenantAdapter", targetNamespace = "http://com.att.mso/tenant") +@WebService(serviceName = "TenantAdapter", endpointInterface = "org.openecomp.mso.adapters.tenant.MsoTenantAdapter", targetNamespace = "http://org.openecomp.mso/tenant") public class MsoTenantAdapterImpl implements MsoTenantAdapter { MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); diff --git a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantAlreadyExists.java b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantAlreadyExists.java index cc80b949dd..e5de100348 100644 --- a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantAlreadyExists.java +++ b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantAlreadyExists.java @@ -34,7 +34,7 @@ import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; * * */ -@WebFault (name="TenantAlreadyExists", faultBean="org.openecomp.mso.adapters.tenant.exceptions.TenantExceptionBean", targetNamespace="http://com.att.mso/tenant") +@WebFault (name="TenantAlreadyExists", faultBean="org.openecomp.mso.adapters.tenant.exceptions.TenantExceptionBean", targetNamespace="http://org.openecomp.mso/tenant") public class TenantAlreadyExists extends TenantException { private static final long serialVersionUID = 1L; diff --git a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantException.java b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantException.java index f68b0fa65b..f6f1e68bda 100644 --- a/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantException.java +++ b/adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantException.java @@ -34,7 +34,7 @@ import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; * * */ -@WebFault (name="TenantException", faultBean="org.openecomp.mso.adapters.tenant.exceptions.TenantExceptionBean", targetNamespace="http://com.att.mso/tenant") +@WebFault (name="TenantException", faultBean="org.openecomp.mso.adapters.tenant.exceptions.TenantExceptionBean", targetNamespace="http://org.openecomp.mso/tenant") public class TenantException extends Exception { private static final long serialVersionUID = 1L; diff --git a/adapters/mso-vnf-adapter-async-client/pom.xml b/adapters/mso-vnf-adapter-async-client/pom.xml index 1ae4b16e05..d00044ed4b 100644 --- a/adapters/mso-vnf-adapter-async-client/pom.xml +++ b/adapters/mso-vnf-adapter-async-client/pom.xml @@ -52,7 +52,7 @@ - org.eclipse.m2e @@ -87,4 +87,5 @@ + diff --git a/adapters/mso-vnf-adapter-async-client/src/main/resources/VnfAdapterNotify.wsdl b/adapters/mso-vnf-adapter-async-client/src/main/resources/VnfAdapterNotify.wsdl index aecef0dd03..951d702467 100644 --- a/adapters/mso-vnf-adapter-async-client/src/main/resources/VnfAdapterNotify.wsdl +++ b/adapters/mso-vnf-adapter-async-client/src/main/resources/VnfAdapterNotify.wsdl @@ -1,8 +1,8 @@ - + - + @@ -161,19 +161,19 @@ - + - + - + - + - + diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java index e76aa40304..2f734f2e6c 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java @@ -7,9 +7,9 @@ * 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. @@ -239,6 +239,9 @@ public class BpelRestClient { LOGGER.debug("Sending to BPEL server: "+bpelUrl); LOGGER.debug("Content is: "+toBpelStr); + //Client 4.3+ + CloseableHttpClient client = HttpClients.createDefault(); + //POST HttpPost post = new HttpPost(bpelUrl); if (credentials != null && !credentials.isEmpty()) @@ -258,8 +261,8 @@ public class BpelRestClient { //Client 4.3+ //Execute & GetResponse - try (CloseableHttpClient client = HttpClients.createDefault(); - CloseableHttpResponse response = client.execute(post)) { + try { + CloseableHttpResponse response = client.execute(post); if (response != null) { lastResponseCode = response.getStatusLine().getStatusCode(); HttpEntity entity = response.getEntity(); @@ -273,32 +276,15 @@ public class BpelRestClient { LOGGER.error (MessageEnum.RA_SEND_VNF_NOTIF_ERR, error, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Error sending Bpel notification", e); lastResponseCode = 900; lastResponse = ""; + } finally { + try { + client.close(); + } catch (IOException e) { + // ignore + } } LOGGER.debug("Response code from BPEL server: "+lastResponseCode); LOGGER.debug("Response body is: "+lastResponse); } - public static void main(String[] a) throws MsoPropertiesException { - final String bpelengine = "http://mtmac1.research.att.com:8080/catch.jsp"; - final String propfile = "/tmp/mso.vnf.properties"; - // "/Users/eby/src/mso.rest/mso/packages/mso-config-centralized/mso-po-adapter-config/mso.vnf.properties" - final String xml = - "" + - "1464013300723" + - "clyde10" + - "wayne99" + - "mickey7" + - ""; - - MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); - msoPropertiesFactory.initializeMsoProperties (MSO_PROP_VNF_ADAPTER, propfile); - - BpelRestClient bc = new BpelRestClient(); - System.out.println(bc.getRetryList()); - System.out.println(bc.getCredentials()); // poAvos:Domain2.0! - - bc.bpelPost(xml, bpelengine, true); - System.out.println("respcode = "+bc.getLastResponseCode()); - System.out.println("resp = "+bc.getLastResponse()); - } } diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapter.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapter.java index 95d8ee23a0..d1646bf9ea 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapter.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapter.java @@ -7,9 +7,9 @@ * 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. @@ -36,7 +36,7 @@ import org.openecomp.mso.entity.MsoRequest; import java.util.Map; -@WebService (name="VnfAdapter", targetNamespace="http://com.att.mso/vnf") +@WebService (name="VnfAdapter", targetNamespace="http://org.openecomp.mso/vnf") public interface MsoVnfAdapter { /** @@ -58,7 +58,7 @@ public interface MsoVnfAdapter @WebParam(name="outputs", mode=Mode.OUT) Holder> outputs, @WebParam(name="rollback", mode=Mode.OUT) Holder rollback ) throws VnfException, VnfAlreadyExists; - + @WebMethod public void updateVnf (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @@ -72,7 +72,7 @@ public interface MsoVnfAdapter @WebParam(name="outputs", mode=Mode.OUT) Holder> outputs, @WebParam(name="rollback", mode=Mode.OUT) Holder rollback ) throws VnfException; - + @WebMethod public void queryVnf (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @@ -83,19 +83,19 @@ public interface MsoVnfAdapter @WebParam(name="status", mode=Mode.OUT) Holder status, @WebParam(name="outputs", mode=Mode.OUT) Holder> outputs ) throws VnfException; - + @WebMethod public void deleteVnf (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @WebParam(name="vnfName") @XmlElement(required=true) String vnfName, @WebParam(name="request") MsoRequest msoRequest) throws VnfException; - - + + @WebMethod public void rollbackVnf (@WebParam(name="rollback") @XmlElement(required=true) VnfRollback rollback) throws VnfException; - + @WebMethod public void createVfModule (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @@ -105,6 +105,7 @@ public interface MsoVnfAdapter @WebParam(name="requestType") @XmlElement(required=false) String requestType, @WebParam(name="volumeGroupHeatStackId") @XmlElement(required=false) String volumeGroupHeatStackId, @WebParam(name="baseVfHeatStackId") @XmlElement(required=false) String baseVfHeatStackId, + @WebParam(name = "modelCustomizationUuid") @XmlElement(required = false) String modelCustomizationUuid, @WebParam(name="inputs") Map inputs, @WebParam(name="failIfExists") Boolean failIfExists, @WebParam(name="backout") Boolean backout, @@ -113,14 +114,15 @@ public interface MsoVnfAdapter @WebParam(name="outputs", mode=Mode.OUT) Holder> outputs, @WebParam(name="rollback", mode=Mode.OUT) Holder rollback ) throws VnfException, VnfAlreadyExists; - + @WebMethod public void deleteVfModule (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @WebParam(name="vfName") @XmlElement(required=true) String vfName, - @WebParam(name="request") MsoRequest msoRequest) + @WebParam(name="request") MsoRequest msoRequest, + @WebParam(name = "vfModuleOutputs", mode = Mode.OUT) Holder> vfModuleOutputs) throws VnfException; - + @WebMethod public void updateVfModule (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, @@ -131,12 +133,13 @@ public interface MsoVnfAdapter @WebParam(name="volumeGroupHeatStackId") @XmlElement(required=false) String volumeGroupHeatStackId, @WebParam(name="baseVfHeatStackId") @XmlElement(required=false) String baseVfHeatStackId, @WebParam(name="vfModuleStackId") @XmlElement(required=false) String vfModuleStackId, + @WebParam(name = "modelCustomizationUuid") @XmlElement(required = false) String modelCustomizationUuid, @WebParam(name="inputs") Map inputs, @WebParam(name="request") MsoRequest msoRequest, @WebParam(name="outputs", mode=Mode.OUT) Holder> outputs, @WebParam(name="rollback", mode=Mode.OUT) Holder rollback ) throws VnfException; - + @WebMethod public void healthCheck (); } diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsync.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsync.java index d58e9ee6a8..fcd78069d3 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsync.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsync.java @@ -37,7 +37,7 @@ import java.util.Map; * (by the client service WSDL). * */ -@WebService (name="VnfAdapterAsync", targetNamespace="http://com.att.mso/vnfA") +@WebService (name="VnfAdapterAsync", targetNamespace="http://org.openecomp.mso/vnfA") public interface MsoVnfAdapterAsync { /** diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java index c192eb6063..d2b1699116 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java @@ -50,7 +50,7 @@ import org.openecomp.mso.properties.MsoPropertiesFactory; import org.openecomp.mso.openstack.beans.VnfStatus; import org.openecomp.mso.openstack.beans.VnfRollback; -@WebService(serviceName = "VnfAdapterAsync", endpointInterface = "org.openecomp.mso.adapters.vnf.MsoVnfAdapterAsync", targetNamespace = "http://com.att.mso/vnfA") +@WebService(serviceName = "VnfAdapterAsync", endpointInterface = "org.openecomp.mso.adapters.vnf.MsoVnfAdapterAsync", targetNamespace = "http://org.openecomp.mso/vnfA") public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); @@ -611,7 +611,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { } VnfAdapterNotify_Service notifySvc = new VnfAdapterNotify_Service (warWsdlLoc, - new QName ("http://com.att.mso/vnfNotify", + new QName ("http://org.openecomp.mso/vnfNotify", "vnfAdapterNotify")); VnfAdapterNotify notifyPort = notifySvc.getMsoVnfAdapterAsyncImplPort (); diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java index 757f875128..e998fe8afe 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java @@ -7,9 +7,9 @@ * 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. @@ -68,7 +68,7 @@ import org.codehaus.jackson.JsonParser; import org.codehaus.jackson.JsonParseException; import org.codehaus.jackson.map.ObjectMapper; -@WebService(serviceName = "VnfAdapter", endpointInterface = "org.openecomp.mso.adapters.vnf.MsoVnfAdapter", targetNamespace = "http://com.att.mso/vnf") +@WebService(serviceName = "VnfAdapter", endpointInterface = "org.openecomp.mso.adapters.vnf.MsoVnfAdapter", targetNamespace = "http://org.openecomp.mso/vnf") public class MsoVnfAdapterImpl implements MsoVnfAdapter { CloudConfigFactory cloudConfigFactory = new CloudConfigFactory(); @@ -84,6 +84,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); private static final String CHECK_REQD_PARAMS = "org.openecomp.mso.adapters.vnf.checkRequiredParameters"; private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.openecomp.mso.adapters.vnf.addGetFilesOnVolumeReq"; + private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); /** * Health Check web method. Does nothing but return to show the adapter is deployed. @@ -178,24 +179,25 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // might be ok - both are just blank LOGGER.debug("ERROR trying to parse the volumeGroupHeatStackId " + volumeGroupHeatStackId); } - this.createVfModule(cloudSiteId, - tenantId, - vnfType, - vnfVersion, - vnfName, - newRequestType, - vfVolGroupHeatStackId, - vfBaseHeatStackId, - inputs, - failIfExists, - backout, - msoRequest, - vnfId, - outputs, + this.createVfModule(cloudSiteId, + tenantId, + vnfType, + vnfVersion, + vnfName, + newRequestType, + vfVolGroupHeatStackId, + vfBaseHeatStackId, + null, + inputs, + failIfExists, + backout, + msoRequest, + vnfId, + outputs, rollback); return; } - } + } // createVf will know if the requestType starts with "X" that it's the "old" way StringBuilder newRequestTypeSb = new StringBuilder("X"); String vfVolGroupHeatStackId = ""; @@ -203,20 +205,21 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (requestType != null) { newRequestTypeSb.append(requestType); } - this.createVfModule(cloudSiteId, - tenantId, - vnfType, - vnfVersion, - vnfName, - newRequestTypeSb.toString(), - vfVolGroupHeatStackId, - vfBaseHeatStackId, - inputs, - failIfExists, - backout, - msoRequest, - vnfId, - outputs, + this.createVfModule(cloudSiteId, + tenantId, + vnfType, + vnfVersion, + vnfName, + newRequestTypeSb.toString(), + vfVolGroupHeatStackId, + vfBaseHeatStackId, + null, + inputs, + failIfExists, + backout, + msoRequest, + vnfId, + outputs, rollback); return; // End createVf shortcut @@ -290,7 +293,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { outputs.value = copyStringOutputs (heatStack.getOutputs ()); rollback.value = vnfRollback; // Default rollback - no updates performed } - + // 1604 Cinder Volume support - handle a nestedStackId if sent (volumeGroupHeatStackId): StackInfo nestedHeatStack = null; long queryStackStarttime2 = System.currentTimeMillis (); @@ -319,14 +322,18 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } else { LOGGER.debug("Found nested heat stack - copying values to inputs"); this.sendMapToDebug(inputs); - heat.copyStringOutputsToInputs(inputs, nestedHeatStack.getOutputs(), false); + heat.copyStringOutputsToInputs(inputs, nestedHeatStack.getOutputs(), false); this.sendMapToDebug(inputs); } } // Ready to deploy the new VNF - try(CatalogDatabase db = new CatalogDatabase ()) { + // Get a handle to the Catalog Database + CatalogDatabase db = new CatalogDatabase (); + + // Make sure DB session is closed + try { // Retrieve the VNF definition VnfResource vnf; if (vnfVersion != null && !vnfVersion.isEmpty ()) { @@ -351,8 +358,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error); throw new VnfException (error, MsoExceptionCategory.INTERNAL); } - - //1604 - Need to handle an updateVolume request. + + //1604 - Need to handle an updateVolume request. VnfComponent vnfComponent = null; if (requestTypeString != null && !requestTypeString.equals("")) { LOGGER.debug("About to query for vnfComponent id = " + vnf.getId() + ", type = " + requestTypeString.toUpperCase()); @@ -398,7 +405,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.toString ()); - + // Add check for any Environment variable HeatEnvironment heatEnvironment = null; String heatEnvironmentString = null; @@ -425,7 +432,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } else { LOGGER.debug ("no environment parameter for this VNF " + vnfType); } - + //1604 - override the VNF environment with the one for the component if(vnfComponent != null) { if (vnfComponent.getHeatEnvironmentId () != null) { @@ -451,8 +458,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } } // End 1604 - - + + LOGGER.debug ("In MsoVnfAdapterImpl, about to call db.getNestedTemplates avec templateId=" + heatTemplate.getId ()); Map nestedTemplates = db.getNestedTemplates (heatTemplate.getId ()); @@ -565,8 +572,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { inputs.remove (alias); inputs.put (realParamName, value); LOGGER.debug (alias + " entry removed from inputs, added back using " + realParamName); - } - // enhanced - check if it's in the Environment (note: that method + } + // enhanced - check if it's in the Environment (note: that method else if (mhee != null && mhee.containsParameter(parm.getParamName())) { LOGGER.debug ("Required parameter " + parm.getParamName () @@ -596,9 +603,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } else { LOGGER.debug ("No missing parameters found - ok to proceed"); } - + // Here - modify heatEnvironmentString - StringBuilder parsedEnvironmentString = null; + StringBuilder parsedEnvironmentString = null; String newEnvironmentString = null; if (mhee != null) { LOGGER.debug("Environment before:\n" + heatEnvironmentString); @@ -648,6 +655,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); throw new VnfException (me); } + } finally { + // Make sure DB session is closed + db.close (); } // Reach this point if updateStack is successful. @@ -929,7 +939,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } return string; } - + private void sendMapToDebug(Map inputs) { int i = 0; StringBuilder sb = new StringBuilder("inputs:"); @@ -947,6 +957,63 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { return; } + private String convertNode(final JsonNode node) { + try { + final Object obj = JSON_MAPPER.treeToValue(node, Object.class); + final String json = JSON_MAPPER.writeValueAsString(obj); + return json; + } catch (JsonParseException jpe) { + LOGGER.debug("Error converting json to string " + jpe.getMessage()); + } catch (Exception e) { + LOGGER.debug("Error converting json to string " + e.getMessage()); + } + return "[Error converting json to string]"; + } + + private Map convertMapStringObjectToStringString(Map objectMap) { + if (objectMap == null) { + return null; + } + Map stringMap = new HashMap(); + for (String key : objectMap.keySet()) { + if (!stringMap.containsKey(key)) { + Object obj = objectMap.get(key); + if (obj instanceof String) { + stringMap.put(key, (String) objectMap.get(key)); + } else if (obj instanceof JsonNode ){ + // This is a bit of mess - but I think it's the least impacting + // let's convert it BACK to a string - then it will get converted back later + try { + String str = this.convertNode((JsonNode) obj); + stringMap.put(key, str); + } catch (Exception e) { + LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for "+ key); + //okay in this instance - only string values (fqdn) are expected to be needed + } + } else if (obj instanceof java.util.LinkedHashMap) { + LOGGER.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode"); + try { + String str = JSON_MAPPER.writeValueAsString(obj); + stringMap.put(key, str); + } catch (Exception e) { + LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for "+ key); + } + } else { + // just try to cast it - could be an integer or some such + try { + String str = (String) obj; + stringMap.put(key, str); + } catch (Exception e) { + LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for "+ key); + //okay here - only expecting fqdn's + } + } + } + } + + return stringMap; + } + public void createVfModule(String cloudSiteId, String tenantId, String vnfType, @@ -955,6 +1022,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String requestType, String volumeGroupHeatStackId, String baseVfHeatStackId, + String modelCustomizationUuid, Map inputs, Boolean failIfExists, Boolean backout, @@ -965,6 +1033,18 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String vfModuleName = vnfName; String vfModuleType = vnfType; String vfVersion = vnfVersion; + String mcu = modelCustomizationUuid; + boolean useMCUuid = false; + if (mcu != null && !mcu.isEmpty()) { + if (mcu.equalsIgnoreCase("null")) { + LOGGER.debug("modelCustomizationUuid: passed in as the string 'null' - will ignore: " + modelCustomizationUuid); + useMCUuid = false; + mcu = ""; + } else { + LOGGER.debug("Found modelCustomizationUuid! Will use that: " + mcu); + useMCUuid = true; + } + } MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName ("CreateVfModule"); String requestTypeString = ""; @@ -983,7 +1063,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { nestedBaseStackId = baseVfHeatStackId; } } - + if (inputs == null) { // Create an empty set of inputs inputs = new HashMap(); @@ -998,13 +1078,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { LOGGER.debug("orchestrating a VNF - *NOT* a module!"); requestTypeString = requestTypeString.substring(1); } - + // 1607 - let's parse out the request type we're being sent boolean isBaseRequest = false; boolean isVolumeRequest = false; if (requestTypeString.startsWith("VOLUME")) { isVolumeRequest = true; - } + } LOGGER.debug("requestTypeString = " + requestTypeString + ", nestedStackId = " + nestedStackId + ", nestedBaseStackId = " + nestedBaseStackId); // Will capture execution time for metrics @@ -1019,7 +1099,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { vfRollback.setVolumeGroupHeatStackId(volumeGroupHeatStackId); vfRollback.setBaseGroupHeatStackId(baseVfHeatStackId); vfRollback.setIsBase(isBaseRequest); - + vfRollback.setModelCustomizationUuid(mcu); + // First, look up to see if the VF already exists. MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_VNF_ADAPTER, msoPropertiesFactory,cloudConfigFactory); @@ -1038,7 +1119,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); throw new VnfException (me); } - // New with 1607 - more precise handling/messaging if the stack already exists + // New with 1607 - more precise handling/messaging if the stack already exists if (heatStack != null && !(heatStack.getStatus () == HeatStatus.NOTFOUND)) { // INIT, CREATED, NOTFOUND, FAILED, BUILDING, DELETING, UNKNOWN, UPDATING, UPDATED HeatStatus status = heatStack.getStatus(); @@ -1054,22 +1135,22 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String error = "Create VF: Stack " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Stack " + vfModuleName + " already exists and is in FAILED state"); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error); - throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ()); + throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ()); } if (status == HeatStatus.UNKNOWN || status == HeatStatus.UPDATED) { // fail - it exists and is in a FAILED state String error = "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Stack " + vfModuleName + " already exists and is in UPDATED or UNKNOWN state"); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error); - throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ()); + throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ()); } if (status == HeatStatus.CREATED) { - // fail - it exists + // fail - it exists if (failIfExists != null && failIfExists) { String error = "Create VF: Stack " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId; LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Stack " + vfModuleName + " already exists"); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error); - throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ()); + throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ()); } else { LOGGER.debug ("Found Existing stack, status=" + heatStack.getStatus ()); // Populate the outputs from the existing stack. @@ -1080,9 +1161,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create VF Module"); return; - + } - + // handle a nestedStackId if sent- this one would be for the volume - so applies to both Vf and Vnf StackInfo nestedHeatStack = null; long subStartTime2 = System.currentTimeMillis (); @@ -1111,11 +1192,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } else { LOGGER.debug("Found nested volume heat stack - copying values to inputs"); this.sendMapToDebug(inputs); - heat.copyStringOutputsToInputs(inputs, nestedHeatStack.getOutputs(), false); + heat.copyStringOutputsToInputs(inputs, nestedHeatStack.getOutputs(), false); this.sendMapToDebug(inputs); } } - + // handle a nestedBaseStackId if sent- this is the stack ID of the base. Should be null for VNF requests StackInfo nestedBaseHeatStack = null; long subStartTime3 = System.currentTimeMillis (); @@ -1144,19 +1225,43 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } else { LOGGER.debug("Found nested base heat stack - copying values to inputs"); this.sendMapToDebug(inputs); - heat.copyStringOutputsToInputs(inputs, nestedBaseHeatStack.getOutputs(), false); + heat.copyStringOutputsToInputs(inputs, nestedBaseHeatStack.getOutputs(), false); this.sendMapToDebug(inputs); } } - + // Ready to deploy the new VNF - - try (CatalogDatabase db = new CatalogDatabase()) { - // Retrieve the VF + + CatalogDatabase db = new CatalogDatabase(); + + try { + // Retrieve the VF VfModule vf = null; VnfResource vnfResource = null; LOGGER.debug("version: " + vfVersion); - if (!oldWay) { + if (useMCUuid) { + // 1702 - this will be the new way going forward. We find the vf by mcu - otherwise, code is the same. + vf = db.getVfModuleByModelCustomizationUuid(mcu); + if (vf == null) { + LOGGER.debug("Unable to find vfModule with modelCustomizationUuid=" + mcu); + String error = "Create vfModule error: Unable to find vfModule with modelCustomizationUuid=" + mcu; + LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, + "VF Module ModelCustomizationUuid", modelCustomizationUuid, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Create VF Module: Unable to find vfModule with modelCustomizationUuid=" + mcu); + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); + throw new VnfException(error, MsoExceptionCategory.USERDATA); + } else { + LOGGER.debug("Found vfModule entry in table! " + vf.toString()); + } + if (vf.isBase()) { + isBaseRequest = true; + LOGGER.debug("This is a BASE VF request!"); + } else { + LOGGER.debug("This is *not* a BASE VF request!"); + if (!isVolumeRequest && nestedBaseStackId == null) { + LOGGER.debug("DANGER WILL ROBINSON! This is unexpected - no nestedBaseStackId with this non-base request"); + } + } + } else if (!oldWay) { // Need to handle old and new schema methods - for a time. Try the new way first. if (vfVersion != null && !vfVersion.isEmpty()) { vf = db.getVfModuleType(vfModuleType, vfVersion); @@ -1222,14 +1327,14 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // First - see if it's in the VnfResource record // if we have a vf Module - then we have to query to get the VnfResource record. if (!oldWay) { - if (vf.getVnfResourceId() != null) { + if (vf.getVnfResourceId() != null) { int vnfResourceId = vf.getVnfResourceId(); vnfResource = db.getVnfResourceById(vnfResourceId); if (vnfResource == null) { LOGGER.debug("Unable to find vnfResource at " + vnfResourceId + " will not error for now..."); } } - } + } String minVersionVnf = null; String maxVersionVnf = null; if (vnfResource != null) { @@ -1281,10 +1386,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // End Version check 1607 // with VF_MODULE - we have both the non-vol and vol template/envs in that object - // with VNF_RESOURCE - we use the old methods. + // with VNF_RESOURCE - we use the old methods. Integer heatTemplateId = null; Integer heatEnvtId = null; - + if (!oldWay) { if (isVolumeRequest) { heatTemplateId = vf.getVolTemplateId(); @@ -1334,7 +1439,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { throw new VnfException(error, MsoExceptionCategory.INTERNAL); } LOGGER.debug("Got HEAT Template from DB"); - + HeatEnvironment heatEnvironment = null; String heatEnvironmentString = null; @@ -1359,7 +1464,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } else { LOGGER.debug ("no environment parameter found for this Type " + vfModuleType); } - + // 1510 - Add the files: for nested templates *if* there are any LOGGER.debug ("In MsoVnfAdapterImpl, createVfModule about to call db.getNestedTemplates avec templateId=" + heatTemplate.getId ()); @@ -1579,8 +1684,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { inputs.remove (alias); inputs.put (realParamName, value); LOGGER.debug (alias + " entry removed from inputs, added back using " + realParamName); - } - // enhanced - check if it's in the Environment (note: that method + } + // enhanced - check if it's in the Environment (note: that method else if (mhee != null && mhee.containsParameter(parm.getParamName())) { LOGGER.debug ("Required parameter " + parm.getParamName () @@ -1609,9 +1714,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } else { LOGGER.debug ("No missing parameters found - ok to proceed"); } - + // Here - modify heatEnvironmentString - StringBuilder parsedEnvironmentString = null; + StringBuilder parsedEnvironmentString = null; String newEnvironmentString = null; if (mhee != null) { LOGGER.debug("Environment before:\n" + heatEnvironmentString); @@ -1715,7 +1820,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } catch (Exception e) { LOGGER.debug("unhandled exception in create VF"); throw new VnfException("Exception during create VF " + e.getMessage()); - + + } finally { + // Make sure DB session is closed + db.close (); } // Reach this point if createStack is successful. @@ -1731,13 +1839,14 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create VF Module"); return; - + } - + public void deleteVfModule (String cloudSiteId, String tenantId, String vnfName, - MsoRequest msoRequest) throws VnfException { + MsoRequest msoRequest, + Holder > outputs) throws VnfException { MsoLogger.setLogContext (msoRequest); MsoLogger.setServiceName ("DeleteVf"); LOGGER.debug ("Deleting VF " + vnfName + " in " + cloudSiteId + "/" + tenantId); @@ -1746,6 +1855,24 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_VNF_ADAPTER, msoPropertiesFactory,cloudConfigFactory); + // 1702 capture the output parameters on a delete + // so we'll need to query first + Map stackOutputs = null; + try { + stackOutputs = heat.queryStackForOutputs(cloudSiteId, tenantId, vnfName); + } catch (MsoException me) { + // Failed to query the Stack due to an openstack exception. + // Convert to a generic VnfException + me.addContext ("DeleteVFModule"); + String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null); + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, "Exception - QueryStack", me); + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); + throw new VnfException (me); + } + // call method which handles the conversion from Map to Map for our expected Object types + outputs.value = this.convertMapStringObjectToStringString(stackOutputs); + // Use the MsoHeatUtils to delete the stack. Set the polling flag to true. // The possible outcomes of deleteStack are a StackInfo object with status // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException @@ -1780,6 +1907,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String volumeGroupHeatStackId, String baseVfHeatStackId, String vfModuleStackId, + String modelCustomizationUuid, Map inputs, MsoRequest msoRequest, Holder > outputs, @@ -1792,6 +1920,19 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { String serviceName = VNF_ADAPTER_SERVICE_NAME + methodName; MsoLogger.setServiceName (serviceName); + String mcu = modelCustomizationUuid; + boolean useMCUuid = false; + if (mcu != null && !mcu.isEmpty()) { + if (mcu.equalsIgnoreCase("null")) { + LOGGER.debug("modelCustomizationUuid: passed in as the string 'null' - will ignore: " + modelCustomizationUuid); + useMCUuid = false; + mcu = ""; + } else { + LOGGER.debug("Found modelCustomizationUuid! Will use that: " + mcu); + useMCUuid = true; + } + } + String requestTypeString = ""; if (requestType != null && !requestType.equals("")) { requestTypeString = requestType; @@ -1843,6 +1984,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { vfRollback.setBaseGroupHeatStackId(baseVfHeatStackId); vfRollback.setIsBase(isBaseRequest); vfRollback.setVfModuleStackId(vfModuleStackId); + vfRollback.setModelCustomizationUuid(mcu); // First, look up to see if the VNF already exists. MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_VNF_ADAPTER, msoPropertiesFactory,cloudConfigFactory); @@ -1947,12 +2089,21 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } // Ready to deploy the new VNF + // Get a handle to the Catalog Database + CatalogDatabase db = new CatalogDatabase (); - try (CatalogDatabase db = new CatalogDatabase ()) { + // Make sure DB session is closed + try { // Retrieve the VF definition //VnfResource vnf; VfModule vf = null; - if (vfVersion != null && !vfVersion.isEmpty ()) { + if (useMCUuid) { + vf = db.getVfModuleByModelCustomizationUuid(mcu); + if (vf == null) { + LOGGER.debug("Unable to find a vfModule matching modelCustomizationUuid=" + mcu); + } + } + else if (vfVersion != null && !vfVersion.isEmpty ()) { vf = db.getVfModuleType(vfModuleType, vfVersion); if (vf == null) { LOGGER.debug("Unable to find " + vfModuleType + " and version = " + vfVersion + " in the TYPE column - will try in MODEL_NAME"); @@ -1972,16 +2123,21 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } } if (vf == null) { - String error = "Update VFModule: Unknown VF Module Type: " + vfModuleType; - if (vfVersion != null && !vfVersion.isEmpty()) { - error += " with version = " + vfVersion; + String error; + if (!useMCUuid) { + error = "Update VFModule: Unknown VF Module Type: " + vfModuleType; + if (vfVersion != null && !vfVersion.isEmpty()) { + error += " with version = " + vfVersion; + } + } else { + error = "Update VfModule: unable to find vfModule with modelCustomizationUuid=" + mcu; } LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "VF Module Type", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error); throw new VnfException (error, MsoExceptionCategory.USERDATA); } LOGGER.debug ("Got VF module definition from Catalog: " + vf.toString ()); - + HeatTemplate heatTemplate = null; Integer heatTemplateId = null; Integer heatEnvtId = null; @@ -2167,7 +2323,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // New for 1607 - support params of json type HashMap jsonParams = new HashMap(); boolean hasJson = false; - + for (HeatTemplateParam parm : heatTemplate.getParameters ()) { LOGGER.debug ("Parameter:'" + parm.getParamName () + "', isRequired=" @@ -2348,7 +2504,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { nestedTemplatesChecked, heatFilesObjects); LOGGER.recordMetricEvent (updateStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack", "UpdateStack", null); - + } } catch (MsoException me) { me.addContext ("UpdateVFModule"); @@ -2358,6 +2514,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); throw new VnfException (me); } + } finally { + // Make sure DB session is closed + db.close (); } // Reach this point if updateStack is successful. @@ -2377,7 +2536,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (vfModuleStackId == null) return null; int index = vfModuleStackId.lastIndexOf('/'); - if (index <= 0) + if (index <= 0) return null; String vfModuleName = null; try { diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VnfAdapterRest.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VnfAdapterRest.java index 6906f816a7..3efab60409 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VnfAdapterRest.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VnfAdapterRest.java @@ -7,9 +7,9 @@ * 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. @@ -173,11 +173,12 @@ public class VnfAdapterRest { public void run() { try { String cloudsite = req.getCloudSiteId(); + Holder> outputs = new Holder > (); if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) { //vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest()); - vnfAdapter.deleteVfModule (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest()); + vnfAdapter.deleteVfModule (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest(), outputs); } - response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId()); + response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value); } catch (VnfException e) { LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "VnfException - Delete VNF Module", e); eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId()); @@ -365,7 +366,7 @@ public class VnfAdapterRest { } vnfRollback.value = new VnfRollback(req.getVnfId(), tenant, cloudsite, true, false, new MsoRequest("reqid", "svcid"), - req.getVolumeGroupId(), req.getVolumeGroupId(), req.getRequestType()); + req.getVolumeGroupId(), req.getVolumeGroupId(), req.getRequestType(), req.getModelCustomizationUuid()); vfModuleStackId.value = "479D3D8B-6360-47BC-AB75-21CC91981484"; outputs.value = VolumeAdapterRest.testMap(); } else { @@ -392,6 +393,7 @@ public class VnfAdapterRest { req.getRequestType(), req.getVolumeGroupStackId(), req.getBaseVfModuleStackId(), + req.getModelCustomizationUuid(), req.getVfModuleParams(), req.getFailIfExists(), req.getBackout(), @@ -496,7 +498,7 @@ public class VnfAdapterRest { updateReq.getVfModuleParams(), updateReq.getMsoRequest(), outputs, - vnfRollback); + vnfRollback); */ vnfAdapter.updateVfModule (req.getCloudSiteId(), req.getTenantId(), @@ -508,10 +510,11 @@ public class VnfAdapterRest { req.getVolumeGroupStackId(), req.getBaseVfModuleId(), req.getVfModuleStackId(), + req.getModelCustomizationUuid(), req.getVfModuleParams(), req.getMsoRequest(), outputs, - vnfRollback); + vnfRollback); response = new UpdateVfModuleResponse(req.getVnfId(), req.getVfModuleId(), vfModuleStackId.value, outputs.value, req.getMessageId()); @@ -610,7 +613,7 @@ public class VnfAdapterRest { VfModuleRollback vmr = req.getVfModuleRollback(); VnfRollback vrb = new VnfRollback( vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudSiteId(), true, true, - vmr.getMsoRequest(), null, null, null); + vmr.getMsoRequest(), null, null, null, null); vnfAdapter.rollbackVnf (vrb); response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId()); } catch (VnfException e) { diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRest.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRest.java index 8fa1552bb0..5514c27a46 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRest.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRest.java @@ -7,9 +7,9 @@ * 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. @@ -166,21 +166,22 @@ public class VolumeAdapterRest { // outputs, // vnfRollback); vnfAdapter.createVfModule( - req.getCloudSiteId(), //cloudSiteId, - req.getTenantId(), //tenantId, - //req.getVnfType(), //vnfType, + req.getCloudSiteId(), //cloudSiteId, + req.getTenantId(), //tenantId, + //req.getVnfType(), //vnfType, completeVnfVfModuleType, - req.getVnfVersion(), //vnfVersion, - req.getVolumeGroupName(), //vnfName, - "VOLUME", //requestType, - null, //volumeGroupHeatStackId, - null, //baseVfHeatStackId, - req.getVolumeGroupParams(), //inputs, - req.getFailIfExists(), //failIfExists, - req.getSuppressBackout(), //backout, - req.getMsoRequest(), // msoRequest, - stackId, - outputs, + req.getVnfVersion(), //vnfVersion, + req.getVolumeGroupName(), //vnfName, + "VOLUME", //requestType, + null, //volumeGroupHeatStackId, + null, //baseVfHeatStackId, + req.getModelCustomizationUuid(), + req.getVolumeGroupParams(), //inputs, + req.getFailIfExists(), //failIfExists, + req.getSuppressBackout(), //backout, + req.getMsoRequest(), // msoRequest, + stackId, + outputs, vnfRollback); } VolumeGroupRollback rb = new VolumeGroupRollback( @@ -370,7 +371,7 @@ public class VolumeAdapterRest { VolumeGroupRollback vgr = req.getVolumeGroupRollback(); VnfRollback vrb = new VnfRollback( vgr.getVolumeGroupStackId(), vgr.getTenantId(), vgr.getCloudSiteId(), true, true, - vgr.getMsoRequest(), null, null, null); + vgr.getMsoRequest(), null, null, null, null); vnfAdapter.rollbackVnf(vrb); response = new RollbackVolumeGroupResponse(true, req.getMessageId()); } catch (VnfException e) { @@ -383,6 +384,7 @@ public class VolumeAdapterRest { } LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); } + } @PUT @@ -487,10 +489,11 @@ public class VolumeAdapterRest { null, null, req.getVolumeGroupStackId(), + req.getModelCustomizationUuid(), req.getVolumeGroupParams(), req.getMsoRequest(), outputs, - vnfRollback); + vnfRollback); } response = new UpdateVolumeGroupResponse( req.getVolumeGroupId(), req.getVolumeGroupStackId(), diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfAlreadyExists.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfAlreadyExists.java index 7cec0cd99e..149192cbac 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfAlreadyExists.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfAlreadyExists.java @@ -7,9 +7,9 @@ * 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. @@ -28,15 +28,15 @@ import javax.xml.ws.WebFault; * This class reports an exception when trying to create a VNF when another * VNF of the same name already exists in the target cloud/tenant. Note that * the createVnf method suppresses this exception by default. - * + * * */ -@WebFault (name="VnfAlreadyExists", faultBean="org.openecomp.mso.adapters.vnf.exceptions.VnfExceptionBean", targetNamespace="http://com.att.mso/vnf") +@WebFault (name="VnfAlreadyExists", faultBean="org.openecomp.mso.adapters.vnf.exceptions.VnfExceptionBean", targetNamespace="http://org.openecomp.mso/vnf") public class VnfAlreadyExists extends VnfException { private static final long serialVersionUID = 1L; public VnfAlreadyExists (String name, String cloudId, String tenantId, String vnfId) { - super("VNF " + name + " already exists in cloud/tenant " + cloudId + "/" + tenantId + " with ID " + vnfId); + super("Resource " + name + " already exists in cloud/tenant " + cloudId + "/" + tenantId + " with ID " + vnfId); } } diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfException.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfException.java index ceef76b468..f25b1d7f47 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfException.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfException.java @@ -33,7 +33,7 @@ import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; * * */ -@WebFault (name="VnfException", faultBean="org.openecomp.mso.adapters.vnf.exceptions.VnfExceptionBean", targetNamespace="http://com.att.mso/vnf") +@WebFault (name="VnfException", faultBean="org.openecomp.mso.adapters.vnf.exceptions.VnfExceptionBean", targetNamespace="http://org.openecomp.mso/vnf") public class VnfException extends Exception { private static final long serialVersionUID = 1L; diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfExceptionBean.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfExceptionBean.java index 15918eabb8..022f651b01 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfExceptionBean.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfExceptionBean.java @@ -7,9 +7,9 @@ * 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. @@ -39,7 +39,8 @@ public class VnfExceptionBean implements Serializable { public VnfExceptionBean () {} public VnfExceptionBean (String message) { - this.message = message; + // Create a default category to prevent null pointer exceptions + this(message, MsoExceptionCategory.INTERNAL); } public VnfExceptionBean (String message, MsoExceptionCategory category) { diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfNotFound.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfNotFound.java index 3c27d03daa..3f6a65a551 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfNotFound.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfNotFound.java @@ -7,9 +7,9 @@ * 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. @@ -29,15 +29,15 @@ import org.openecomp.mso.adapters.vnf.exceptions.VnfException; * This class reports an exception when trying to update a Network that does * not exist in the target cloud/tenant. Note that deleteNetwork suppresses * this exception (deletion of non-existent network is considered a success). - * + * * */ -@WebFault (name="VnfNotFound", faultBean="org.openecomp.mso.adapters.vnf.exceptions.VnfExceptionBean", targetNamespace="http://com.att.mso/vnf") +@WebFault (name="VnfNotFound", faultBean="org.openecomp.mso.adapters.vnf.exceptions.VnfExceptionBean", targetNamespace="http://org.openecomp.mso/vnf") public class VnfNotFound extends VnfException { private static final long serialVersionUID = 1L; public VnfNotFound (String cloudId, String tenantId, String vnfName) { - super("VNF " + vnfName + " not found in cloud/tenant " + cloudId + "/" + tenantId); + super("Resource " + vnfName + " not found in cloud/tenant " + cloudId + "/" + tenantId); } } diff --git a/adapters/pom.xml b/adapters/pom.xml index 8ccd8cdc71..67946aabf8 100644 --- a/adapters/pom.xml +++ b/adapters/pom.xml @@ -24,9 +24,16 @@ mso-vnf-adapter mso-vnf-adapter-async-client mso-requests-db-adapter + mso-catalog-db-adapter + + org.evosuite + evosuite-standalone-runtime + ${evosuiteVersion} + test + org.apache.httpcomponents httpclient diff --git a/asdc-controller/WebContent/WEB-INF/web.xml b/asdc-controller/WebContent/WEB-INF/web.xml index a8ccd17fec..f9b9e9279a 100644 --- a/asdc-controller/WebContent/WEB-INF/web.xml +++ b/asdc-controller/WebContent/WEB-INF/web.xml @@ -2,8 +2,8 @@ ASDC Controller - - + + resteasy.async.job.service.enabled @@ -15,7 +15,7 @@ java:module/MsoPropertiesFactory - @@ -45,8 +45,8 @@ resteasy.scan true - - org.slf4j diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.java index 1d87ccbe21..61ca698678 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCConfiguration.java @@ -7,9 +7,9 @@ * 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. @@ -75,8 +75,8 @@ public class ASDCConfiguration implements IConfiguration { public static final String HEAT_VOL="HEAT_VOL"; public static final String OTHER="OTHER"; public static final String VF_MODULES_METADATA="VF_MODULES_METADATA"; - - + + private static final String[] SUPPORTED_ARTIFACT_TYPES = {HEAT, HEAT_ARTIFACT, HEAT_ENV, @@ -84,10 +84,10 @@ public class ASDCConfiguration implements IConfiguration { HEAT_NET, HEAT_VOL, OTHER, - VF_MODULES_METADATA}; - - public static final List SUPPORTED_ARTIFACT_TYPES_LIST = Collections.unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES)); - + VF_MODULES_METADATA}; + + public static final List SUPPORTED_ARTIFACT_TYPES_LIST = Collections.unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES)); + /** * Default constructor, the mso.properties is searched in the classpath (for testing) * Or in /etc/ecomp/mso/config/mso.properties @@ -97,7 +97,7 @@ public class ASDCConfiguration implements IConfiguration { * @throws IOException If the key file has not been loaded properly */ public ASDCConfiguration (String controllerName) throws ASDCParametersException, IOException { - + Properties keyProp = new Properties (); this.asdcControllerName = controllerName; @@ -287,7 +287,7 @@ public class ASDCConfiguration implements IConfiguration { return 0; } } - + @Override public boolean activateServerTLSAuth() { JsonNode masterConfigNode = getASDCControllerConfigJsonNode(); @@ -415,4 +415,12 @@ public class ASDCConfiguration implements IConfiguration { } + /** + * The flag allows the client to receive metadata for all resources of the service regardless of the artifacts associated to them. + * Setting the flag to false will preserve legacy behavior. + */ + public boolean isFilterInEmptyResources() { + return true; + } + } diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java index b553100816..a0de24a9cd 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/client/ASDCController.java @@ -7,9 +7,9 @@ * 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. @@ -270,17 +270,17 @@ public class ASDCController { this.changeControllerStatus (ASDCControllerStatus.STOPPED); } - private boolean checkResourceAlreadyDeployed (VfResourceStructure vfResource) throws ArtifactInstallerException { + private boolean checkResourceAlreadyDeployed (VfResourceStructure resource) throws ArtifactInstallerException { - if (this.resourceInstaller.isResourceAlreadyDeployed (vfResource)) { + if (this.resourceInstaller.isResourceAlreadyDeployed (resource)) { LOGGER.info (MessageEnum.ASDC_ARTIFACT_ALREADY_EXIST, - vfResource.getResourceInstance().getResourceInstanceName(), - vfResource.getResourceInstance().getResourceUUID(), - vfResource.getResourceInstance().getResourceName(), "", ""); - - this.sendDeployNotificationsForResource(vfResource,DistributionStatusEnum.ALREADY_DOWNLOADED,null); - this.sendDeployNotificationsForResource(vfResource,DistributionStatusEnum.ALREADY_DEPLOYED,null); - + resource.getResourceInstance().getResourceInstanceName(), + resource.getResourceInstance().getResourceUUID(), + resource.getResourceInstance().getResourceName(), "", ""); + + this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DOWNLOADED,null); + this.sendDeployNotificationsForResource(resource,DistributionStatusEnum.ALREADY_DEPLOYED,null); + return true; } else { return false; @@ -289,7 +289,7 @@ public class ASDCController { } private final static String UUID_PARAM = "(UUID:"; - + private IDistributionClientDownloadResult downloadTheArtifact (IArtifactInfo artifact, String distributionId) throws ASDCDownloadException { @@ -299,7 +299,7 @@ public class ASDCController { + ")"); IDistributionClientDownloadResult downloadResult; - + try { downloadResult = distributionClient.download (artifact); if (null == downloadResult) { @@ -366,14 +366,14 @@ public class ASDCController { } - + private void sendDeployNotificationsForResource(VfResourceStructure vfResourceStructure,DistributionStatusEnum distribStatus, String errorReason) { - + for (IArtifactInfo artifactInfo : vfResourceStructure.getResourceInstance().getArtifacts()) { - - if (DistributionStatusEnum.DEPLOY_OK.equals(distribStatus) + + if (DistributionStatusEnum.DEPLOY_OK.equals(distribStatus) // This could be NULL if the artifact is a VF module artifact, this won't be present in the MAP - && vfResourceStructure.getArtifactsMapByUUID().get(artifactInfo.getArtifactUUID()) != null + && vfResourceStructure.getArtifactsMapByUUID().get(artifactInfo.getArtifactUUID()) != null && vfResourceStructure.getArtifactsMapByUUID().get(artifactInfo.getArtifactUUID()).getDeployedInDb() == 0) { this.sendASDCNotification (NotificationType.DEPLOY, artifactInfo.getArtifactURL (), @@ -393,26 +393,30 @@ public class ASDCController { } } } - - private void deployResourceStructure (VfResourceStructure vfResourceStructure) throws ArtifactInstallerException { - LOGGER.info (MessageEnum.ASDC_START_DEPLOY_ARTIFACT, vfResourceStructure.getResourceInstance().getResourceInstanceName(), vfResourceStructure.getResourceInstance().getResourceUUID(), "ASDC", "deployResourceStructure"); + private void deployResourceStructure (VfResourceStructure resourceStructure) throws ArtifactInstallerException { + + LOGGER.info (MessageEnum.ASDC_START_DEPLOY_ARTIFACT, resourceStructure.getResourceInstance().getResourceInstanceName(), resourceStructure.getResourceInstance().getResourceUUID(), "ASDC", "deployResourceStructure"); try { - vfResourceStructure.createVfModuleStructures(); - resourceInstaller.installTheResource (vfResourceStructure); - + String resourceType = resourceStructure.getResourceInstance().getResourceType(); + String category = resourceStructure.getResourceInstance().getCategory(); + if(resourceType.equals("VF") && !category.equalsIgnoreCase("Allotted Resource")){ + resourceStructure.createVfModuleStructures(); + } + resourceInstaller.installTheResource (resourceStructure); + } catch (ArtifactInstallerException e) { - - sendDeployNotificationsForResource(vfResourceStructure,DistributionStatusEnum.DEPLOY_ERROR,e.getMessage()); + + sendDeployNotificationsForResource(resourceStructure,DistributionStatusEnum.DEPLOY_ERROR,e.getMessage()); throw e; } - if (vfResourceStructure.isDeployedSuccessfully()) { + if (resourceStructure.isDeployedSuccessfully()) { LOGGER.info (MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC, - vfResourceStructure.getResourceInstance().getResourceName(), - vfResourceStructure.getResourceInstance().getResourceUUID(), - String.valueOf (vfResourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure"); - sendDeployNotificationsForResource(vfResourceStructure,DistributionStatusEnum.DEPLOY_OK ,null); + resourceStructure.getResourceInstance().getResourceName(), + resourceStructure.getResourceInstance().getResourceUUID(), + String.valueOf (resourceStructure.getVfModuleStructure().size()), "ASDC", "deployResourceStructure"); + sendDeployNotificationsForResource(resourceStructure,DistributionStatusEnum.DEPLOY_OK ,null); } } @@ -428,14 +432,14 @@ public class ASDCController { DistributionStatusEnum status, String errorReason, long timestamp) { - + String event = "Sending " + notificationType.name () + "(" + status.name () + ")" + " notification to ASDC for artifact:" + artifactURL; - + if (errorReason != null) { event=event+"("+errorReason+")"; } @@ -480,7 +484,7 @@ public class ASDCController { } public void treatNotification (INotificationData iNotif) { - + int noOfArtifacts = 0; for (IResourceInstance resource : iNotif.getResources ()) { noOfArtifacts += resource.getArtifacts ().size (); @@ -488,7 +492,7 @@ public class ASDCController { LOGGER.info (MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF, String.valueOf (noOfArtifacts), iNotif.getServiceUUID (), "ASDC", "treatNotification"); - + try { LOGGER.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif)); LOGGER.info(MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF, iNotif.getServiceUUID(), "ASDC", "treatNotification"); @@ -496,14 +500,15 @@ public class ASDCController { // Process only the Resource artifacts in MSO for (IResourceInstance resource : iNotif.getResources()) { + // We process only VNF(VF) and Network(VL) resources on MSO Side // We process only VNF resource on MSO Side - if ("VF".equals(resource.getResourceType())) { - this.processResourceNotification(iNotif,resource); + if ("VF".equals(resource.getResourceType()) || "VL".equals(resource.getResourceType())) { + this.processResourceNotification(iNotif,resource); } } - - - + + + } catch (RuntimeException e) { LOGGER.error (MessageEnum.ASDC_GENERAL_EXCEPTION_ARG, "Unexpected exception caught during the notification processing", "ASDC", "treatNotification", MsoLogger.ErrorCode.SchemaError, "RuntimeException in treatNotification", @@ -513,40 +518,41 @@ public class ASDCController { } } - + private void processResourceNotification (INotificationData iNotif,IResourceInstance resource) { // For each artifact, create a structure describing the VFModule in a ordered flat level - VfResourceStructure vfResourceStructure = new VfResourceStructure(iNotif,resource); + VfResourceStructure resourceStructure = new VfResourceStructure(iNotif,resource); + try { - - if (!this.checkResourceAlreadyDeployed(vfResourceStructure)) { + + if (!this.checkResourceAlreadyDeployed(resourceStructure)) { for (IArtifactInfo artifact : resource.getArtifacts()) { - - IDistributionClientDownloadResult resultArtifact = this.downloadTheArtifact(artifact, + + IDistributionClientDownloadResult resultArtifact = this.downloadTheArtifact(artifact, iNotif.getDistributionID()); if (resultArtifact != null) { if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifact.getArtifactType())) { LOGGER.debug("VF_MODULE_ARTIFACT: "+new String(resultArtifact.getArtifactPayload(),"UTF-8")); - LOGGER.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(distributionClient.decodeVfModuleArtifact(resultArtifact.getArtifactPayload()))); + LOGGER.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(resourceStructure.decodeVfModuleArtifact(resultArtifact.getArtifactPayload()))); } - vfResourceStructure.addArtifactToStructure(distributionClient,artifact, resultArtifact); - - } + resourceStructure.addArtifactToStructure(distributionClient,artifact, resultArtifact); + + } } - - this.deployResourceStructure(vfResourceStructure); - - } + + this.deployResourceStructure(resourceStructure); + + } } catch (ArtifactInstallerException | ASDCDownloadException | UnsupportedEncodingException e) { LOGGER.error(MessageEnum.ASDC_GENERAL_EXCEPTION_ARG, "Exception caught during Installation of artifact", "ASDC", "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processResourceNotification", e); } } - + private static final String UNKNOWN="Unknown"; - + /** * @return the address of the ASDC we are connected to. */ diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ASDCElementInfo.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ASDCElementInfo.java index 5e59be526f..e649a992f8 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ASDCElementInfo.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/ASDCElementInfo.java @@ -7,9 +7,9 @@ * 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. @@ -35,12 +35,12 @@ import org.openecomp.mso.asdc.client.ASDCConfiguration; * A class representing a generic element whose information can be used for example to log artifacts, resource... data. */ public class ASDCElementInfo { - + /** * A default, empty instance used in case a source element was not correctly provided. */ public static final ASDCElementInfo EMPTY_INSTANCE = new ASDCElementInfo(); - + /** * Used to define the other possible ASDC Element types (usually in addition to existing artifact types, etc.).
*
@@ -60,17 +60,17 @@ public class ASDCElementInfo { * The map of element information fields useful for logging. The complete contents of this list will be concatenated. */ private final Map elementInfoMap = new HashMap<>(); - + /** * The type of this element. */ private final String type; - + private ASDCElementInfo () { // Private parameterless constructor. Not visible, only used for EMPTY_INSTANCE. this.type = ""; } - + /** * Artifact-type based constructor. Requires a valid artifact type. * @param artifactType The artifact type @@ -79,7 +79,7 @@ public class ASDCElementInfo { // We need the exact type name here... this.type = artifactType; } - + /** * 'Other element type'-based constructor. Requires a valid element type. * @param elementType An ASDCElementTypeEnum entry. This will usually contain enumerated types not in the existing @@ -88,10 +88,10 @@ public class ASDCElementInfo { // We need the exact type name here... this.type = elementType.name(); } - + /** * Add an information entry (name, UUID, etc.) from an artifact/resource/..., once a at time. - * + * * @param key The key (name) of the information entry (Artifact UUID, Resource Name, etc.) * @param value The value bound to the information entry. */ @@ -100,7 +100,7 @@ public class ASDCElementInfo { this.getElementInfoMap().put(key, value); } } - + /** * Returns an aggregated, formatted list of the expected details about an ASDC element. * (non-Javadoc) @@ -123,7 +123,7 @@ public class ASDCElementInfo { } return sb.toString(); } - + /** * The type that was defined at creation time. This is typically VNF_RESOURCE, VF_MODULE_METADATA, HEAT_ENV, etc. * @return The type of this element information type. This will usually be either an ArtifactTypeEnum entry name or an ASDCElementTypeEnum entry name. @@ -150,7 +150,7 @@ public class ASDCElementInfo { *
  • Resource Instance Name
  • *
  • Resource Instance UUID
  • * - * + * * @param vfResourceStructure The VfResourceStructure to use as source of information (see {@link VfResourceStructure}). * @return an ASDCElementInfo using the information held in the VNF Resource. */ @@ -173,7 +173,7 @@ public class ASDCElementInfo { *
  • Module Model Name
  • *
  • Module Model UUID
  • * - * + * * @param vfModuleStructure The VfModuleStructure to use as source of information (see {@link VfModuleStructure}). * @return an ASDCElementInfo using the information held in the VF Module. */ @@ -182,12 +182,12 @@ public class ASDCElementInfo { return EMPTY_INSTANCE; } ASDCElementInfo elementInfo = new ASDCElementInfo(ASDCConfiguration.VF_MODULES_METADATA); - IVfModuleMetadata moduleMetadata = vfModuleStructure.getVfModuleMetadata(); + IVfModuleData moduleMetadata = vfModuleStructure.getVfModuleMetadata(); elementInfo.addElementInfo("Module Model Name", moduleMetadata.getVfModuleModelName()); elementInfo.addElementInfo("Module Model Invariant UUID", moduleMetadata.getVfModuleModelInvariantUUID()); return elementInfo; } - + /** * Create an ASDCElementInfo object from an IArtfiactInfo instance.
    *
    @@ -196,7 +196,7 @@ public class ASDCElementInfo { *
  • IArtifactInfo Name
  • *
  • IArtifactInfo UUID
  • * - * + * * @param artifactInfo The VfModuleStructure to use as source of information (see {@link IArtifactInfo}). * @return an ASDCElementInfo using the information held in the IArtifactInfo instance. */ diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IVfModuleData.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IVfModuleData.java new file mode 100644 index 0000000000..d3aa0411a9 --- /dev/null +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/IVfModuleData.java @@ -0,0 +1,54 @@ +/*- + * ============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.asdc.installer; + +import java.util.Map; + + +public interface IVfModuleData { + + // Method descriptor #4 ()Ljava/lang/String; + public abstract java.lang.String getVfModuleModelName(); + + // Method descriptor #4 ()Ljava/lang/String; + public abstract java.lang.String getVfModuleModelInvariantUUID(); + + // Method descriptor #4 ()Ljava/lang/String; + public abstract java.lang.String getVfModuleModelCustomizationUUID(); + + // Method descriptor #4 ()Ljava/lang/String; + public abstract java.lang.String getVfModuleModelVersion(); + + // Method descriptor #4 ()Ljava/lang/String; + public abstract java.lang.String getVfModuleModelUUID(); + + // Method descriptor #4 ()Ljava/lang/String; + public abstract java.lang.String getVfModuleModelDescription(); + + // Method descriptor #10 ()Z + public abstract boolean isBase(); + + // Method descriptor #12 ()Ljava/util/List; + // Signature: ()Ljava/util/List; + public abstract java.util.List getArtifacts(); + + public abstract java.util.Map getProperties(); +} diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleMetaData.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleMetaData.java new file mode 100644 index 0000000000..284141b91d --- /dev/null +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleMetaData.java @@ -0,0 +1,99 @@ +/*- + * ============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.asdc.installer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.codehaus.jackson.annotate.JsonAnySetter; +import org.codehaus.jackson.annotate.JsonIgnore; +import org.codehaus.jackson.annotate.JsonProperty; + +import org.openecomp.sdc.api.notification.IVfModuleMetadata; + +public class VfModuleMetaData implements IVfModuleData { + + @JsonProperty("artifacts") + private List artifacts; + + @JsonProperty("properties") + //private List> properties = new ArrayList<>(); + private Map properties = new HashMap<>(); + + @JsonIgnore + private Map attributesMap = new HashMap<>(); + + @Override + public List getArtifacts() { + return artifacts; + } + + public Map getProperties() { + return properties; + } + + @Override + public String getVfModuleModelDescription() { + return (String)attributesMap.get("vfModuleModelDescription"); + } + + @Override + public String getVfModuleModelInvariantUUID() { + return (String)attributesMap.get("vfModuleModelInvariantUUID"); + } + + public String getVfModuleModelCustomizationUUID() { + return (String)attributesMap.get("vfModuleModelCustomizationUUID"); + } + + @Override + public String getVfModuleModelName() { + return (String)attributesMap.get("vfModuleModelName"); + } + + @Override + public String getVfModuleModelUUID() { + return (String)attributesMap.get("vfModuleModelUUID"); + } + + @Override + public String getVfModuleModelVersion() { + return (String)attributesMap.get("vfModuleModelVersion"); + } + + @Override + public boolean isBase() { + return (boolean)attributesMap.get("isBase"); + } + + + + @SuppressWarnings("unused") + @JsonAnySetter + public final void setAttribute(String attrName, Object attrValue) { + if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) { + this.attributesMap.put(attrName,attrValue); + } + } + +} diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.java index 239bc8ab99..b1e670883c 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfModuleStructure.java @@ -7,9 +7,9 @@ * 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. @@ -31,24 +31,24 @@ import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException; import org.openecomp.mso.db.catalog.beans.VfModule; public final class VfModuleStructure { - - private final IVfModuleMetadata vfModuleMetadata; - + + private final IVfModuleData vfModuleMetadata; + private final VfResourceStructure parentVfResource; - + private VfModule catalogVfModule; /** * The list of artifact existing in this resource hashed by artifactType. */ private final Map> artifactsMap; - - public VfModuleStructure(VfResourceStructure vfParentResource,IVfModuleMetadata vfmoduleMetadata) throws ArtifactInstallerException { - + + public VfModuleStructure(VfResourceStructure vfParentResource,IVfModuleData vfmoduleMetadata) throws ArtifactInstallerException { + vfModuleMetadata = vfmoduleMetadata; parentVfResource = vfParentResource; - + artifactsMap = new HashMap>(); - + for (String artifactUUID:this.vfModuleMetadata.getArtifacts()) { if (vfParentResource.getArtifactsMapByUUID().containsKey(artifactUUID)) { this.addToStructure(vfParentResource.getArtifactsMapByUUID().get(artifactUUID)); @@ -57,42 +57,42 @@ public final class VfModuleStructure { } } } - + private void addToStructure(VfModuleArtifact vfModuleArtifact) { - + if (artifactsMap.containsKey(vfModuleArtifact.getArtifactInfo().getArtifactType())) { artifactsMap.get(vfModuleArtifact.getArtifactInfo().getArtifactType()).add(vfModuleArtifact); - + } else { List nestedList = new LinkedList(); nestedList.add(vfModuleArtifact); - + artifactsMap.put(vfModuleArtifact.getArtifactInfo().getArtifactType(), nestedList); } } - + public List getOrderedArtifactList() { - + List artifactsList = new LinkedList (); - + artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT)); artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_ENV)); artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_VOL)); - + for (VfModuleArtifact artifact:(artifactsMap.get(ASDCConfiguration.HEAT_NESTED))) { artifactsList.add(artifact); } - + for (VfModuleArtifact artifact:(artifactsMap.get(ASDCConfiguration.HEAT_ARTIFACT))) { artifactsList.add(artifact); } - + artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_VOL)); - + return null; } - public IVfModuleMetadata getVfModuleMetadata() { + public IVfModuleData getVfModuleMetadata() { return vfModuleMetadata; } @@ -112,6 +112,6 @@ public final class VfModuleStructure { public void setCatalogVfModule(VfModule catalogVfModule) { this.catalogVfModule = catalogVfModule; } - - + + } diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java index 7be5e7010b..d27819bb38 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/VfResourceStructure.java @@ -7,9 +7,9 @@ * 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. @@ -20,13 +20,18 @@ package org.openecomp.mso.asdc.installer; - +import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; +import org.codehaus.jackson.JsonParseException; +import org.codehaus.jackson.map.JsonMappingException; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.type.TypeReference; + import org.openecomp.sdc.api.IDistributionClient; import org.openecomp.sdc.api.notification.IArtifactInfo; import org.openecomp.sdc.api.notification.INotificationData; @@ -35,72 +40,84 @@ import org.openecomp.sdc.api.notification.IVfModuleMetadata; import org.openecomp.sdc.api.results.IDistributionClientDownloadResult; import org.openecomp.mso.asdc.client.ASDCConfiguration; import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException; +import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; +import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; import org.openecomp.mso.db.catalog.beans.Service; +import org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources; +import org.openecomp.mso.db.catalog.beans.ServiceToNetworks; import org.openecomp.mso.db.catalog.beans.VnfResource; /** * This structure exists to avoid having issues if the order of the vfResource/vfmodule artifact is not good (tree structure). - * * */ public final class VfResourceStructure { - + private boolean isDeployedSuccessfully=false; /** - * The Raw notification data. + * The Raw notification data. */ private final INotificationData notification; - + /** * The resource we will try to deploy. */ private final IResourceInstance resourceInstance; - + /** * The list of VfModules defined for this resource. */ private final List vfModulesStructureList; - + /** * The list of VfModulesMetadata defined for this resource. */ - private List vfModulesMetadataList; - + private List vfModulesMetadataList; + private VnfResource catalogVnfResource; - + + private NetworkResourceCustomization catalogNetworkResourceCustomization; + + private ServiceToNetworks catalogServiceToNetworks; + + private ServiceToAllottedResources catalogServiceToAllottedResources; + + private AllottedResourceCustomization catalogResourceCustomization; + private Service catalogService; - + /** * The list of artifacts existing in this resource hashed by UUID. */ - private final Map artifactsMapByUUID; - - + private final Map artifactsMapByUUID; + + public VfResourceStructure(INotificationData notificationdata, IResourceInstance resourceinstance) { notification=notificationdata; resourceInstance=resourceinstance; - + vfModulesStructureList = new LinkedList(); artifactsMapByUUID = new HashMap(); } - + + //@Override public void addArtifactToStructure(IDistributionClient distributionClient,IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException { VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactinfo,clientResult); - + switch(artifactinfo.getArtifactType()) { case ASDCConfiguration.HEAT: case ASDCConfiguration.HEAT_ENV: case ASDCConfiguration.HEAT_VOL: case ASDCConfiguration.HEAT_NESTED: // For 1607 only 1 level tree is supported - case ASDCConfiguration.HEAT_ARTIFACT: + case ASDCConfiguration.HEAT_ARTIFACT: case ASDCConfiguration.HEAT_NET: case ASDCConfiguration.OTHER: artifactsMapByUUID.put(artifactinfo.getArtifactUUID(), vfModuleArtifact); break; case ASDCConfiguration.VF_MODULES_METADATA: - vfModulesMetadataList = distributionClient.decodeVfModuleArtifact(clientResult.getArtifactPayload()); + vfModulesMetadataList = this.decodeVfModuleArtifact(clientResult.getArtifactPayload()); break; default: @@ -110,15 +127,15 @@ public final class VfResourceStructure { } public void createVfModuleStructures() throws ArtifactInstallerException { - + if (vfModulesMetadataList == null) { throw new ArtifactInstallerException("VfModule Meta DATA could not be decoded properly or was not present in the notification"); } - for (IVfModuleMetadata vfModuleMeta:vfModulesMetadataList) { + for (IVfModuleData vfModuleMeta:vfModulesMetadataList) { vfModulesStructureList.add(new VfModuleStructure(this,vfModuleMeta)); } } - + public INotificationData getNotification() { return notification; } @@ -134,7 +151,7 @@ public final class VfResourceStructure { public boolean isDeployedSuccessfully() { return isDeployedSuccessfully; } - + public void setSuccessfulDeployment() { isDeployedSuccessfully = true; } @@ -155,6 +172,42 @@ public final class VfResourceStructure { this.catalogVnfResource = catalogVnfResource; } + // Network Only + public NetworkResourceCustomization getCatalogNetworkResourceCustomization() { + return catalogNetworkResourceCustomization; + } + // Network Only + public void setCatalogNetworkResourceCustomization(NetworkResourceCustomization catalogNetworkResourceCustomization) { + this.catalogNetworkResourceCustomization = catalogNetworkResourceCustomization; + } + // Network Only + public ServiceToNetworks getCatalogServiceToNetworks() { + return catalogServiceToNetworks; + } + // Network Only + public void setCatalogServiceToNetworks( + ServiceToNetworks catalogServiceToNetworks) { + this.catalogServiceToNetworks = catalogServiceToNetworks; + } + + public ServiceToAllottedResources getCatalogServiceToAllottedResources() { + return catalogServiceToAllottedResources; + } + + public void setCatalogServiceToAllottedResources( + ServiceToAllottedResources catalogServiceToAllottedResources) { + this.catalogServiceToAllottedResources = catalogServiceToAllottedResources; + } + + public AllottedResourceCustomization getCatalogResourceCustomization() { + return catalogResourceCustomization; + } + + public void setCatalogResourceCustomization( + AllottedResourceCustomization catalogResourceCustomization) { + this.catalogResourceCustomization = catalogResourceCustomization; + } + public Service getCatalogService() { return catalogService; } @@ -162,4 +215,19 @@ public final class VfResourceStructure { public void setCatalogService(Service catalogService) { this.catalogService = catalogService; } + + public List decodeVfModuleArtifact(byte[] arg0) { + try { + List listVFModuleMetaData = new ObjectMapper().readValue(arg0, new TypeReference>(){}); + return listVFModuleMetaData; + + } catch (JsonParseException e) { + e.printStackTrace(); + } catch (JsonMappingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } } diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java index 4cef0f1013..114f6f246b 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/installer/heat/VfResourceInstaller.java @@ -7,9 +7,9 @@ * 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. @@ -20,15 +20,19 @@ package org.openecomp.mso.asdc.installer.heat; - +import java.sql.Timestamp; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Set; import org.hibernate.exception.ConstraintViolationException; import org.hibernate.exception.LockAcquisitionException; - import org.openecomp.sdc.api.notification.IArtifactInfo; + import org.openecomp.mso.asdc.client.ASDCConfiguration; import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException; import org.openecomp.mso.asdc.installer.ASDCElementInfo; @@ -43,7 +47,11 @@ import org.openecomp.mso.db.catalog.beans.HeatEnvironment; import org.openecomp.mso.db.catalog.beans.HeatFiles; import org.openecomp.mso.db.catalog.beans.HeatTemplate; import org.openecomp.mso.db.catalog.beans.HeatTemplateParam; +import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; +import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; import org.openecomp.mso.db.catalog.beans.Service; +import org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources; +import org.openecomp.mso.db.catalog.beans.ServiceToNetworks; import org.openecomp.mso.db.catalog.beans.VfModule; import org.openecomp.mso.db.catalog.beans.VnfResource; import org.openecomp.mso.logger.MessageEnum; @@ -58,18 +66,26 @@ public class VfResourceInstaller implements IVfResourceInstaller { } @Override - public boolean isResourceAlreadyDeployed(VfResourceStructure vfResourceStructure) + public boolean isResourceAlreadyDeployed(VfResourceStructure vfResourceStruct) throws ArtifactInstallerException { + + CatalogDatabase db = new CatalogDatabase(); boolean status = false; + VfResourceStructure vfResourceStructure = (VfResourceStructure)vfResourceStruct; + + try { - try (CatalogDatabase db = new CatalogDatabase()) { + String resourceType = vfResourceStruct.getResourceInstance().getResourceType(); + String category = vfResourceStruct.getResourceInstance().getCategory(); - logger.info(MessageEnum.ASDC_CHECK_HEAT_TEMPLATE, "VNFResource", + // Check for duplicate VF Module that is not an Allotted Resource + if(resourceType.equals("VF") && !category.equalsIgnoreCase("Allotted Resource")){ + logger.info(MessageEnum.ASDC_CHECK_HEAT_TEMPLATE, "VNFResource", VfResourceInstaller.createVNFName(vfResourceStructure), BigDecimalVersion.castAndCheckNotificationVersionToString( vfResourceStructure.getNotification().getServiceVersion()), "", ""); - VnfResource vnfResource = db.getVnfResource( + VnfResource vnfResource = db.getVnfResource( VfResourceInstaller.createVNFName(vfResourceStructure), BigDecimalVersion.castAndCheckNotificationVersionToString( vfResourceStructure.getNotification().getServiceVersion())); @@ -79,23 +95,73 @@ public class VfResourceInstaller implements IVfResourceInstaller { } + } + + // Check dup for VF Allotted Resource + if(resourceType.equals("VF") && category.equalsIgnoreCase("Allotted Resource")){ + logger.info(MessageEnum.ASDC_CHECK_HEAT_TEMPLATE, "AllottedResource", + vfResourceStruct.getResourceInstance().getResourceInstanceName(), + BigDecimalVersion.castAndCheckNotificationVersionToString( + vfResourceStructure.getNotification().getServiceVersion()), "", ""); + + List allottedResources = db.getAllAllottedResourcesByServiceModelUuid(vfResourceStruct.getNotification().getServiceUUID()); + + if(allottedResources != null && allottedResources.size() > 0){ + for(AllottedResourceCustomization allottedResource : allottedResources){ + + String existingAllottedResource = allottedResource.getModelCustomizationUuid(); + String notificationAllottedResource = vfResourceStruct.getResourceInstance().getResourceCustomizationUUID(); + + if(existingAllottedResource.equals(notificationAllottedResource)){ + status=true; + break; + } + } + + } + } + + // Check Network for duplicates + if(resourceType.equals("VL")){ + logger.info(MessageEnum.ASDC_CHECK_HEAT_TEMPLATE, "NetworkResource", + vfResourceStruct.getResourceInstance().getResourceInstanceName(), + BigDecimalVersion.castAndCheckNotificationVersionToString( + vfResourceStructure.getNotification().getServiceVersion()), "", ""); + + List networkResources = db.getAllNetworksByServiceModelUuid(vfResourceStruct.getNotification().getServiceUUID()); + + if(networkResources != null && networkResources.size() > 0){ + for(NetworkResourceCustomization networkResource : networkResources){ + + String existingNetworkResource = networkResource.getModelCustomizationUuid(); + String notificationNetworkResource = vfResourceStruct.getResourceInstance().getResourceCustomizationUUID(); + + if(existingNetworkResource.equals(notificationNetworkResource)){ + status=true; + break; + } + } + + } + } + if (status) { logger.info(MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED_DETAIL, vfResourceStructure.getResourceInstance().getResourceInstanceName(), - vfResourceStructure.getResourceInstance().getResourceUUID(), + vfResourceStructure.getResourceInstance().getResourceCustomizationUUID(), vfResourceStructure.getNotification().getServiceName(), BigDecimalVersion.castAndCheckNotificationVersionToString( vfResourceStructure.getNotification().getServiceVersion()), vfResourceStructure.getNotification().getServiceUUID(), - vfResourceStructure.getResourceInstance().getResourceName(), "", ""); + vfResourceStructure.getResourceInstance().getResourceName(),"", ""); } else { logger.info(MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL, vfResourceStructure.getResourceInstance().getResourceInstanceName(), - vfResourceStructure.getResourceInstance().getResourceUUID(), + vfResourceStructure.getResourceInstance().getResourceCustomizationUUID(), vfResourceStructure.getNotification().getServiceName(), BigDecimalVersion.castAndCheckNotificationVersionToString( vfResourceStructure.getNotification().getServiceVersion()), - vfResourceStructure.getNotification().getServiceUUID(), + vfResourceStructure.getNotification().getServiceUUID(), vfResourceStructure.getResourceInstance().getResourceName(),"", ""); } @@ -108,13 +174,15 @@ public class VfResourceInstaller implements IVfResourceInstaller { } @Override - public void installTheResource(VfResourceStructure vfResourceStructure) throws ArtifactInstallerException { + public void installTheResource(VfResourceStructure vfResourceStruct) throws ArtifactInstallerException { // 1. Add the DB object list (Hashed) to be created from the HashMap // UUID // The DB objects will be stored in each VfModuleArtifact objects // Those objects could be reused by different VfModule + VfResourceStructure vfResourceStructure = (VfResourceStructure)vfResourceStruct; + for (VfModuleArtifact vfModuleArtifact : vfResourceStructure.getArtifactsMapByUUID().values()) { switch (vfModuleArtifact.getArtifactInfo().getArtifactType()) { @@ -138,26 +206,53 @@ public class VfResourceInstaller implements IVfResourceInstaller { } } - + // in case of deployment failure, use a string that will represent the type of artifact that failed... List artifactListForLogging = new ArrayList<>(); - + CatalogDatabase catalogDB = new CatalogDatabase(); // 2. Create the VFModules/VNFResource objects by linking them to the // objects created before and store them in Resource/module structure // Opening a DB transaction, starting from here try { - + VfResourceInstaller.createService(vfResourceStructure); - - VfResourceInstaller.createVnfResource(vfResourceStructure); + + String resourceType = vfResourceStructure.getResourceInstance().getResourceType(); + String resourceCategory = vfResourceStructure.getResourceInstance().getCategory(); + + if(resourceType.equals("VF")){ + + if(resourceCategory.equalsIgnoreCase("Allotted Resource")){ + VfResourceInstaller.createAllottedResourceCustomization(vfResourceStructure); + catalogDB.saveAllottedResourceCustomization(vfResourceStructure.getCatalogResourceCustomization()); + } else { + VfResourceInstaller.createVnfResource(vfResourceStructure); + catalogDB.saveOrUpdateVnfResource(vfResourceStructure.getCatalogVnfResource()); + } + } + + if(resourceType.equals("VL")){ + VfResourceInstaller.createNetworkResourceCustomization(vfResourceStructure); + catalogDB.saveNetworkResourceCustomization(vfResourceStructure.getCatalogNetworkResourceCustomization()); + } // Add this one for logging artifactListForLogging.add(ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure)); - - catalogDB.saveOrUpdateVnfResource(vfResourceStructure.getCatalogVnfResource()); + + //catalogDB.saveOrUpdateVnfResource(vfResourceStructure.getCatalogVnfResource()); catalogDB.saveService(vfResourceStructure.getCatalogService()); - + + // Now that the service has been added we can populate the Service_to_AllottedResources table + if(resourceType.equals("VF") && resourceCategory.equalsIgnoreCase("Allotted Resource")){ + catalogDB.saveServiceToAllottedResources(vfResourceStructure.getCatalogServiceToAllottedResources()); + } + + // Now that the service has been added we can populate the Service_to_Network table + if(resourceType.equals("VL")){ + catalogDB.saveServiceToNetworks(vfResourceStructure.getCatalogServiceToNetworks()); + } + for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) { // Here we set the right db structure according to the Catalog @@ -170,14 +265,14 @@ public class VfResourceInstaller implements IVfResourceInstaller { HeatTemplate heatMainTemplate = null; HeatEnvironment heatEnv = null; - + HeatTemplate heatVolumeTemplate = null; HeatEnvironment heatVolumeEnv = null; - + if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT)) { IArtifactInfo mainEnvArtifactInfo = vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT) .get(0).getArtifactInfo().getGeneratedArtifact(); - + // MAIN HEAT heatMainTemplate = (HeatTemplate) vfModuleStructure.getArtifactsMap() .get(ASDCConfiguration.HEAT).get(0).getCatalogObject(); @@ -185,77 +280,77 @@ public class VfResourceInstaller implements IVfResourceInstaller { // Add this one for logging artifactListForLogging.add(ASDCElementInfo .createElementFromVfArtifactInfo(vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0).getArtifactInfo())); - + catalogDB.saveHeatTemplate(heatMainTemplate, heatMainTemplate.getParameters()); // Indicate we have deployed it in the DB vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0).incrementDeployedInDB(); - - + + // VOLUME HEAT // We expect only one VOL HEAT per VFMODULE // we can also obtain from it the Env ArtifactInfo, that's why // we get the Volume IArtifactInfo - + if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_VOL)) { IArtifactInfo volEnvArtifactInfo = vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0) .getArtifactInfo().getGeneratedArtifact(); - + heatVolumeTemplate = (HeatTemplate) vfModuleStructure.getArtifactsMap() .get(ASDCConfiguration.HEAT_VOL).get(0).getCatalogObject(); - + // Add this one for logging artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo())); catalogDB.saveHeatTemplate(heatVolumeTemplate, heatVolumeTemplate.getParameters()); // Indicate we have deployed it in the DB vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).incrementDeployedInDB(); - + if (volEnvArtifactInfo != null) { heatVolumeEnv = (HeatEnvironment) vfResourceStructure.getArtifactsMapByUUID() .get(volEnvArtifactInfo.getArtifactUUID()).getCatalogObject(); // Add this one for logging artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(volEnvArtifactInfo)); - + catalogDB.saveHeatEnvironment(heatVolumeEnv); // Indicate we have deployed it in the DB vfResourceStructure.getArtifactsMapByUUID().get(volEnvArtifactInfo.getArtifactUUID()).incrementDeployedInDB(); } - + } - + // NESTED HEAT // Here we expect many HEAT_NESTED template to be there // check first if we really have nested heat templates if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_NESTED)) { for (VfModuleArtifact heatNestedArtifact : vfModuleStructure.getArtifactsMap() .get(ASDCConfiguration.HEAT_NESTED)) { - + // Check if this nested is well referenced by the MAIN HEAT String parentArtifactType = VfResourceInstaller.identifyParentOfNestedTemplate(vfModuleStructure,heatNestedArtifact); HeatTemplate heatNestedTemplate = (HeatTemplate) heatNestedArtifact.getCatalogObject(); - + if (parentArtifactType != null) { - + switch (parentArtifactType) { case ASDCConfiguration.HEAT: - + // Add this one for logging artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo())); - + catalogDB.saveNestedHeatTemplate (heatMainTemplate.getId(), heatNestedTemplate, heatNestedTemplate.getTemplateName()); // Indicate we have deployed it in the DB heatNestedArtifact.incrementDeployedInDB(); break; case ASDCConfiguration.HEAT_VOL: - + // Add this one for logging artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo())); catalogDB.saveNestedHeatTemplate (heatVolumeTemplate.getId(), heatNestedTemplate, heatNestedTemplate.getTemplateName()); // Indicate we have deployed it in the DB heatNestedArtifact.incrementDeployedInDB(); break; - + default: break; @@ -263,49 +358,49 @@ public class VfResourceInstaller implements IVfResourceInstaller { } else { // Assume it belongs to HEAT MAIN // Add this one for logging artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatNestedArtifact.getArtifactInfo())); - + catalogDB.saveNestedHeatTemplate (heatMainTemplate.getId(), heatNestedTemplate, heatNestedTemplate.getTemplateName()); // Indicate we have deployed it in the DB heatNestedArtifact.incrementDeployedInDB(); } } } - + if (mainEnvArtifactInfo != null) { heatEnv = (HeatEnvironment) vfResourceStructure.getArtifactsMapByUUID() .get(mainEnvArtifactInfo.getArtifactUUID()).getCatalogObject(); // Add this one for logging artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(mainEnvArtifactInfo)); - + catalogDB.saveHeatEnvironment(heatEnv); // Indicate we have deployed it in the DB vfResourceStructure.getArtifactsMapByUUID().get(mainEnvArtifactInfo.getArtifactUUID()).incrementDeployedInDB(); } - + } - - + + // here we expect one VFModule to be there VfResourceInstaller.createVfModule(vfModuleStructure,heatMainTemplate, heatVolumeTemplate, heatEnv, heatVolumeEnv); VfModule vfModule = vfModuleStructure.getCatalogVfModule(); // Add this one for logging artifactListForLogging.add(ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure)); - + catalogDB.saveOrUpdateVfModule(vfModule); // Here we expect many HEAT_TEMPLATE files to be there if (vfModuleStructure.getArtifactsMap().containsKey(ASDCConfiguration.HEAT_ARTIFACT)) { for (VfModuleArtifact heatArtifact : vfModuleStructure.getArtifactsMap() .get(ASDCConfiguration.HEAT_ARTIFACT)) { - + HeatFiles heatFile = (HeatFiles) heatArtifact.getCatalogObject(); - + // Add this one for logging artifactListForLogging.add(ASDCElementInfo.createElementFromVfArtifactInfo(heatArtifact.getArtifactInfo())); - - + + catalogDB.saveVfModuleToHeatFiles (vfModule.getId(), heatFile); // Indicate we will deploy it in the DB heatArtifact.incrementDeployedInDB(); @@ -313,10 +408,10 @@ public class VfResourceInstaller implements IVfResourceInstaller { } } - + catalogDB.commit(); vfResourceStructure.setSuccessfulDeployment(); - + } catch (Exception e) { Throwable dbExceptionToCapture = e; @@ -329,12 +424,12 @@ public class VfResourceInstaller implements IVfResourceInstaller { logger.warn(MessageEnum.ASDC_ARTIFACT_ALREADY_DEPLOYED, vfResourceStructure.getResourceInstance().getResourceName(), vfResourceStructure.getNotification().getServiceVersion(), "", "", MsoLogger.ErrorCode.DataError, "Exception - ASCDC Artifact already deployed", e); } else { - String endEvent = "Exception caught during installation of the VFResource. Transaction rollback."; + String endEvent = "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback."; String elementToLog = (artifactListForLogging.size() > 0 ? artifactListForLogging.get(artifactListForLogging.size()-1).toString() : "No element listed"); - logger.error(MessageEnum.ASDC_ARTIFACT_INSTALL_EXC, elementToLog, "", "", MsoLogger.ErrorCode.DataError, "Exception caught during installation of the VFResource. Transaction rollback", e); + logger.error(MessageEnum.ASDC_ARTIFACT_INSTALL_EXC, elementToLog, "", "", MsoLogger.ErrorCode.DataError, "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback", e); catalogDB.rollback(); throw new ArtifactInstallerException( - "Exception caught during installation of the VFResource. Transaction rollback.", e); + "Exception caught during installation of " + vfResourceStructure.getResourceInstance().getResourceName() + ". Transaction rollback.", e); } } finally { @@ -344,10 +439,10 @@ public class VfResourceInstaller implements IVfResourceInstaller { } } - + private static String identifyParentOfNestedTemplate(VfModuleStructure vfModuleStructure,VfModuleArtifact heatNestedArtifact) { - if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT) != null + if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT) != null && vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0).getArtifactInfo().getRelatedArtifacts() != null) { for (IArtifactInfo unknownArtifact : vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT).get(0) .getArtifactInfo().getRelatedArtifacts()) { @@ -356,29 +451,29 @@ public class VfResourceInstaller implements IVfResourceInstaller { } } - } - - if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL) != null + } + + if (vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL) != null && vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo().getRelatedArtifacts() != null) { for (IArtifactInfo unknownArtifact:vfModuleStructure.getArtifactsMap().get(ASDCConfiguration.HEAT_VOL).get(0).getArtifactInfo().getRelatedArtifacts()) { if (heatNestedArtifact.getArtifactInfo().getArtifactUUID().equals(unknownArtifact.getArtifactUUID())) { return ASDCConfiguration.HEAT_VOL; } - + } } - + // Does not belong to anything return null; - + } - + private static void createVnfResource(VfResourceStructure vfResourceStructure) { VnfResource vnfResource = new VnfResource(); - + vnfResource.setAsdcUuid(vfResourceStructure.getResourceInstance().getResourceUUID()); vnfResource.setDescription(vfResourceStructure.getNotification().getServiceDescription()); - + vnfResource.setOrchestrationMode("HEAT"); // Set the version but Version is stored into ASDC_SERVICE_MODEL_VERSION vnfResource.setVersion(BigDecimalVersion @@ -386,15 +481,59 @@ public class VfResourceInstaller implements IVfResourceInstaller { vnfResource.setVnfType(VfResourceInstaller.createVNFName(vfResourceStructure)); vnfResource.setModelVersion(BigDecimalVersion .castAndCheckNotificationVersionToString(vfResourceStructure.getResourceInstance().getResourceVersion())); - + vnfResource.setModelInvariantUuid(vfResourceStructure.getResourceInstance().getResourceInvariantUUID()); vnfResource.setModelCustomizationName(vfResourceStructure.getResourceInstance().getResourceInstanceName()); + vnfResource.setModelCustomizationUuid(vfResourceStructure.getResourceInstance().getResourceCustomizationUUID()); vnfResource.setModelName(vfResourceStructure.getResourceInstance().getResourceName()); vnfResource.setServiceModelInvariantUUID(vfResourceStructure.getNotification().getServiceInvariantUUID()); - + //vnfResource.setCreated(getCurrentTimeStamp()); + vfResourceStructure.setCatalogVnfResource(vnfResource); } + private static void createNetworkResourceCustomization(VfResourceStructure vfResourceStructure) { + NetworkResourceCustomization networkResourceCustomization = new NetworkResourceCustomization(); + + networkResourceCustomization.setModelCustomizationUuid(vfResourceStructure.getResourceInstance().getResourceCustomizationUUID().trim()); + networkResourceCustomization.setModelName(vfResourceStructure.getResourceInstance().getResourceName().trim()); + networkResourceCustomization.setModelInstanceName(vfResourceStructure.getResourceInstance().getResourceInstanceName().trim()); + networkResourceCustomization.setModelInvariantUuid(vfResourceStructure.getResourceInstance().getResourceInvariantUUID().trim()); + networkResourceCustomization.setModelUuid(vfResourceStructure.getResourceInstance().getResourceUUID().trim()); + networkResourceCustomization.setModelVersion(vfResourceStructure.getResourceInstance().getResourceVersion().trim()); + //networkResourceCustomization.setCreated(getCurrentTimeStamp()); + + vfResourceStructure.setCatalogNetworkResourceCustomization(networkResourceCustomization); + + ServiceToNetworks serviceNetworks = new ServiceToNetworks(); + serviceNetworks.setNetworkModelCustomizationUuid(networkResourceCustomization.getModelCustomizationUuid()); + serviceNetworks.setServiceModelUuid(vfResourceStructure.getNotification().getServiceUUID()); + + vfResourceStructure.setCatalogServiceToNetworks(serviceNetworks); + + } + + private static void createAllottedResourceCustomization(VfResourceStructure vfResourceStructure) { + AllottedResourceCustomization resourceCustomization = new AllottedResourceCustomization(); + + resourceCustomization.setModelCustomizationUuid(vfResourceStructure.getResourceInstance().getResourceCustomizationUUID().trim()); + resourceCustomization.setModelName(vfResourceStructure.getResourceInstance().getResourceName().trim()); + resourceCustomization.setModelInstanceName(vfResourceStructure.getResourceInstance().getResourceInstanceName().trim()); + resourceCustomization.setModelInvariantUuid(vfResourceStructure.getResourceInstance().getResourceInvariantUUID().trim()); + resourceCustomization.setModelUuid(vfResourceStructure.getResourceInstance().getResourceUUID().trim()); + resourceCustomization.setVersion(vfResourceStructure.getResourceInstance().getResourceVersion().trim()); + //resourceCustomization.setCreated(getCurrentTimeStamp()); + + vfResourceStructure.setCatalogResourceCustomization(resourceCustomization); + + ServiceToAllottedResources serviceAllottedResources = new ServiceToAllottedResources(); + serviceAllottedResources.setArModelCustomizationUuid(resourceCustomization.getModelCustomizationUuid()); + serviceAllottedResources.setServiceModelUuid(vfResourceStructure.getNotification().getServiceUUID()); + + vfResourceStructure.setCatalogServiceToAllottedResources(serviceAllottedResources); + + } + private static void createVfModule(VfModuleStructure vfModuleStructure,HeatTemplate heatMain, HeatTemplate heatVolume,HeatEnvironment heatEnv, HeatEnvironment heatVolumeEnv) { VfModule vfModule = new VfModule(); vfModule.setType(createVfModuleName(vfModuleStructure)); @@ -407,21 +546,41 @@ public class VfResourceInstaller implements IVfResourceInstaller { vfModule.setIsBase(0); } + vfModule.setModelCustomizationUuid(vfModuleStructure.getVfModuleMetadata().getVfModuleModelCustomizationUUID()); vfModule.setModelInvariantUuid(vfModuleStructure.getVfModuleMetadata().getVfModuleModelInvariantUUID()); vfModule.setModelName(vfModuleStructure.getVfModuleMetadata().getVfModuleModelName()); - + vfModule.setVersion(BigDecimalVersion.castAndCheckNotificationVersionToString(vfModuleStructure.getParentVfResource().getNotification().getServiceVersion())); vfModule.setModelVersion(BigDecimalVersion.castAndCheckNotificationVersionToString( vfModuleStructure.getVfModuleMetadata().getVfModuleModelVersion())); - + + Map map = vfModuleStructure.getVfModuleMetadata().getProperties(); + + if(map != null){ + + if(map.get("vf_module_label") != null){ + vfModule.setLabel(map.get("vf_module_label")); + } + if(map.get("initial_count") != null && map.get("initial_count").length() > 0){ + vfModule.setInitialCount(Integer.parseInt(map.get("initial_count"))); + } + if(map.get("min_vf_module_instances") != null && map.get("min_vf_module_instances").length() > 0){ + vfModule.setMinInstances(Integer.parseInt(map.get("min_vf_module_instances"))); + } + if(map.get("max_vf_module_instances") != null && map.get("max_vf_module_instances").length() > 0){ + vfModule.setMaxInstances(Integer.parseInt(map.get("max_vf_module_instances"))); + } + + } + vfModuleStructure.setCatalogVfModule(vfModule); - + VfResourceInstaller.createVfModuleLinks(vfModule, vfModuleStructure.getParentVfResource().getCatalogVnfResource(), heatMain,heatVolume, heatEnv,heatVolumeEnv); } private static void createVfModuleLinks(VfModule vfModule, VnfResource vnfResource, HeatTemplate heatMain, HeatTemplate heatVolume, HeatEnvironment heatEnv, HeatEnvironment heatVolumeEnv) { - + if (heatMain !=null) { vfModule.setTemplateId(heatMain.getId()); } @@ -434,7 +593,7 @@ public class VfResourceInstaller implements IVfResourceInstaller { if (heatVolumeEnv != null) { vfModule.setVolEnvironmentId(heatVolumeEnv.getId()); } - + vfModule.setVnfResourceId(vnfResource.getId()); } @@ -448,53 +607,53 @@ public class VfResourceInstaller implements IVfResourceInstaller { } - + public static String verifyTheFilePrefixInArtifacts(String filebody, VfResourceStructure vfResourceStructure, List listTypes) { String newFileBody = filebody; for (VfModuleArtifact moduleArtifact:vfResourceStructure.getArtifactsMapByUUID().values()) { - + if (listTypes.contains(moduleArtifact.getArtifactInfo().getArtifactType())) { - + newFileBody = verifyTheFilePrefixInString(newFileBody,moduleArtifact.getArtifactInfo().getArtifactName()); } } return newFileBody; } - + public static String verifyTheFilePrefixInString(final String body, final String filenameToVerify) { - + String needlePrefix = "file:///"; String prefixedFilenameToVerify = needlePrefix+filenameToVerify; - - if ((body == null) || (body.length() == 0) || (filenameToVerify == null) || (filenameToVerify.length() == 0)) { - return body; - } - - StringBuffer sb = new StringBuffer(body.length()); - - int currentIndex = 0; - int startIndex = 0; - - while (currentIndex != -1) { - startIndex = currentIndex; - currentIndex = body.indexOf(prefixedFilenameToVerify, startIndex); - - if (currentIndex == -1) { - break; - } - - // We append from the startIndex up to currentIndex (start of File Name) - sb.append(body.substring(startIndex, currentIndex)); - sb.append(filenameToVerify); - - currentIndex += prefixedFilenameToVerify.length(); - } - - sb.append(body.substring(startIndex)); - + + if ((body == null) || (body.length() == 0) || (filenameToVerify == null) || (filenameToVerify.length() == 0)) { + return body; + } + + StringBuffer sb = new StringBuffer(body.length()); + + int currentIndex = 0; + int startIndex = 0; + + while (currentIndex != -1) { + startIndex = currentIndex; + currentIndex = body.indexOf(prefixedFilenameToVerify, startIndex); + + if (currentIndex == -1) { + break; + } + + // We append from the startIndex up to currentIndex (start of File Name) + sb.append(body.substring(startIndex, currentIndex)); + sb.append(filenameToVerify); + + currentIndex += prefixedFilenameToVerify.length(); + } + + sb.append(body.substring(startIndex)); + return sb.toString(); } - + private static void createHeatTemplateFromArtifact(VfResourceStructure vfResourceStructure, VfModuleArtifact vfModuleArtifact) { HeatTemplate heatTemplate = new HeatTemplate(); @@ -505,11 +664,11 @@ public class VfResourceInstaller implements IVfResourceInstaller { // reused heatTemplate.setAsdcResourceName(vfResourceStructure.getResourceInstance().getResourceName()); heatTemplate.setAsdcUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID()); - + List typeList = new ArrayList(); typeList.add(ASDCConfiguration.HEAT_NESTED); typeList.add(ASDCConfiguration.HEAT_ARTIFACT); - + heatTemplate.setTemplateBody(verifyTheFilePrefixInArtifacts(vfModuleArtifact.getResult(),vfResourceStructure,typeList)); heatTemplate.setTemplateName(vfModuleArtifact.getArtifactInfo().getArtifactName()); @@ -522,6 +681,13 @@ public class VfResourceInstaller implements IVfResourceInstaller { heatTemplate.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription()); heatTemplate.setVersion(BigDecimalVersion .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion())); + + if(vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null){ + heatTemplate.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum()); + } else { + heatTemplate.setArtifactChecksum("MANUAL_RECORD"); + } + Set heatParam = VfResourceInstaller .extractHeatTemplateParameters(vfModuleArtifact.getResult()); heatTemplate.setParameters(heatParam); @@ -536,11 +702,11 @@ public class VfResourceInstaller implements IVfResourceInstaller { heatEnvironment.setName(vfModuleArtifact.getArtifactInfo().getArtifactName()); // TODO Set the label heatEnvironment.setAsdcLabel("Label"); - + List typeList = new ArrayList(); typeList.add(ASDCConfiguration.HEAT); typeList.add(ASDCConfiguration.HEAT_VOL); - + heatEnvironment.setEnvironment(verifyTheFilePrefixInArtifacts(vfModuleArtifact.getResult(),vfResourceStructure,typeList)); heatEnvironment.setAsdcUuid(vfModuleArtifact.getArtifactInfo().getArtifactUUID()); heatEnvironment.setDescription(vfModuleArtifact.getArtifactInfo().getArtifactDescription()); @@ -548,8 +714,14 @@ public class VfResourceInstaller implements IVfResourceInstaller { .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion())); heatEnvironment.setAsdcResourceName(VfResourceInstaller.createVNFName(vfResourceStructure)); + if(vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null){ + heatEnvironment.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum()); + } else{ + heatEnvironment.setArtifactChecksum("MANUAL_RECORD"); + } + vfModuleArtifact.setCatalogObject(heatEnvironment); - + } private static void createHeatFileFromArtifact(VfResourceStructure vfResourceStructure, @@ -566,31 +738,45 @@ public class VfResourceInstaller implements IVfResourceInstaller { .castAndCheckNotificationVersionToString(vfModuleArtifact.getArtifactInfo().getArtifactVersion())); heatFile.setAsdcResourceName(vfResourceStructure.getResourceInstance().getResourceName()); + + if(vfModuleArtifact.getArtifactInfo().getArtifactChecksum() != null){ + heatFile.setArtifactChecksum(vfModuleArtifact.getArtifactInfo().getArtifactChecksum()); + } else { + heatFile.setArtifactChecksum("MANUAL_RECORD"); + } + vfModuleArtifact.setCatalogObject(heatFile); - + } private static void createService(VfResourceStructure vfResourceStructure) { - + Service service = new Service(); service.setDescription(vfResourceStructure.getNotification().getServiceDescription()); service.setServiceName(vfResourceStructure.getNotification().getServiceName()); service.setServiceNameVersionId(vfResourceStructure.getNotification().getServiceUUID()); service.setVersion(vfResourceStructure.getNotification().getServiceVersion()); service.setModelInvariantUUID(vfResourceStructure.getNotification().getServiceInvariantUUID()); - + vfResourceStructure.setCatalogService(service); } - - + + private static String createVNFName(VfResourceStructure vfResourceStructure) { return vfResourceStructure.getNotification().getServiceName() + "/" + vfResourceStructure.getResourceInstance().getResourceInstanceName(); } private static String createVfModuleName(VfModuleStructure vfModuleStructure) { - + return createVNFName(vfModuleStructure.getParentVfResource())+"::"+vfModuleStructure.getVfModuleMetadata().getVfModuleModelName(); } + + private static Timestamp getCurrentTimeStamp() { + + return new Timestamp(new Date().getTime()); + } + + } diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java index 312613d1bc..a355f0547a 100644 --- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java +++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/util/ASDCNotificationLogging.java @@ -7,9 +7,9 @@ * 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. @@ -22,122 +22,126 @@ package org.openecomp.mso.asdc.util; import java.util.List; +import java.util.Map; import org.openecomp.sdc.api.notification.IArtifactInfo; import org.openecomp.sdc.api.notification.INotificationData; import org.openecomp.sdc.api.notification.IResourceInstance; -import org.openecomp.sdc.api.notification.IVfModuleMetadata; + +import org.openecomp.mso.asdc.installer.IVfModuleData; public class ASDCNotificationLogging { public static String dumpASDCNotification(INotificationData asdcNotification) { - + if (asdcNotification == null) { return "NULL"; } StringBuffer buffer = new StringBuffer("ASDC Notification:"); buffer.append(System.lineSeparator()); - + buffer.append("DistributionID:"); buffer.append(testNull(asdcNotification.getDistributionID())); buffer.append(System.lineSeparator()); - - + + buffer.append("ServiceName:"); buffer.append(testNull(asdcNotification.getServiceName())); buffer.append(System.lineSeparator()); - - + + buffer.append("ServiceVersion:"); buffer.append(testNull(asdcNotification.getServiceVersion())); buffer.append(System.lineSeparator()); - - + + buffer.append("ServiceUUID:"); buffer.append(testNull(asdcNotification.getServiceUUID())); buffer.append(System.lineSeparator()); - - + + buffer.append("ServiceInvariantUUID:"); buffer.append(testNull(asdcNotification.getServiceInvariantUUID())); buffer.append(System.lineSeparator()); - - + + buffer.append("ServiceDescription:"); buffer.append(testNull(asdcNotification.getServiceDescription())); buffer.append(System.lineSeparator()); - - + + buffer.append("Service Artifacts List:"); buffer.append(System.lineSeparator()); buffer.append(testNull(dumpArtifactInfoList(asdcNotification.getServiceArtifacts()))); buffer.append(System.lineSeparator()); - + buffer.append("Resource Instances List:"); buffer.append(System.lineSeparator()); buffer.append(testNull(dumpASDCResourcesList(asdcNotification))); buffer.append(System.lineSeparator()); - - + + return buffer.toString(); } - - public static String dumpVfModuleMetaDataList(List moduleMetaDataList) { + + public static String dumpVfModuleMetaDataList(List moduleMetaDataList) { if (moduleMetaDataList == null ) { return null; } - - StringBuffer buffer = new StringBuffer(); + + StringBuffer buffer = new StringBuffer("VfModuleMetaData List:"); + buffer.append(System.lineSeparator()); + buffer.append("{"); - - for (IVfModuleMetadata moduleMetaData:moduleMetaDataList) { + + for (IVfModuleData moduleMetaData:moduleMetaDataList) { buffer.append(System.lineSeparator()); buffer.append(testNull(dumpVfModuleMetaData(moduleMetaData))); buffer.append(System.lineSeparator()); buffer.append(","); - + } buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator()); buffer.append("}"); buffer.append(System.lineSeparator()); - + return buffer.toString(); } - - private static String dumpVfModuleMetaData(IVfModuleMetadata moduleMetaData) { - + + private static String dumpVfModuleMetaData(IVfModuleData moduleMetaData) { + if (moduleMetaData == null ) { return "NULL"; } - + StringBuffer buffer = new StringBuffer("VfModuleMetaData:"); buffer.append(System.lineSeparator()); - + buffer.append("VfModuleModelName:"); buffer.append(testNull(moduleMetaData.getVfModuleModelName())); buffer.append(System.lineSeparator()); - + buffer.append("VfModuleModelVersion:"); buffer.append(testNull(moduleMetaData.getVfModuleModelVersion())); buffer.append(System.lineSeparator()); - + buffer.append("VfModuleModelUUID:"); buffer.append(testNull(moduleMetaData.getVfModuleModelUUID())); buffer.append(System.lineSeparator()); - + buffer.append("VfModuleModelInvariantUUID:"); buffer.append(testNull(moduleMetaData.getVfModuleModelInvariantUUID())); buffer.append(System.lineSeparator()); - + buffer.append("VfModuleModelDescription:"); buffer.append(testNull(moduleMetaData.getVfModuleModelDescription())); buffer.append(System.lineSeparator()); - + buffer.append("Artifacts UUID List:"); - + if (moduleMetaData.getArtifacts() != null) { buffer.append("{"); - + for (String artifactUUID:moduleMetaData.getArtifacts()) { buffer.append(System.lineSeparator()); buffer.append(testNull(artifactUUID)); @@ -150,17 +154,33 @@ public class ASDCNotificationLogging { } else { buffer.append("NULL"); } - - + + if (moduleMetaData.getProperties() != null) { + Map vfModuleMap = moduleMetaData.getProperties(); + buffer.append("Properties List:"); + buffer.append("{"); + + for (Map.Entry entry : vfModuleMap.entrySet()) { + buffer.append(System.lineSeparator()); + buffer.append(" " + entry.getKey() + " : " + entry.getValue()); + } + buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator()); + buffer.append("}"); + buffer.append(System.lineSeparator()); + } else { + buffer.append("NULL"); + } + + buffer.append(System.lineSeparator()); - + buffer.append("isBase:"); buffer.append(moduleMetaData.isBase()); buffer.append(System.lineSeparator()); - + return buffer.toString(); } - + private static String testNull(Object object) { if (object == null) { return "NULL"; @@ -172,15 +192,15 @@ public class ASDCNotificationLogging { return "Type not recognized"; } } - + private static String dumpASDCResourcesList(INotificationData asdcNotification) { if (asdcNotification == null || asdcNotification.getResources() == null) { return null; } - - StringBuffer buffer = new StringBuffer(); + + StringBuffer buffer = new StringBuffer(); buffer.append("{"); - + for (IResourceInstance resourceInstanceElem:asdcNotification.getResources()) { buffer.append(System.lineSeparator()); buffer.append(testNull(dumpASDCResourceInstance(resourceInstanceElem))); @@ -190,136 +210,148 @@ public class ASDCNotificationLogging { buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator()); buffer.append("}"); buffer.append(System.lineSeparator()); - + return buffer.toString(); - + } - + private static String dumpASDCResourceInstance(IResourceInstance resourceInstance) { - + if (resourceInstance == null) { return null; } - + StringBuffer buffer = new StringBuffer("Resource Instance Info:"); buffer.append(System.lineSeparator()); - + buffer.append("ResourceInstanceName:"); buffer.append(testNull(resourceInstance.getResourceInstanceName())); buffer.append(System.lineSeparator()); - + + buffer.append("ResourceCustomizationUUID:"); + buffer.append(testNull(resourceInstance.getResourceCustomizationUUID())); + buffer.append(System.lineSeparator()); + buffer.append("ResourceInvariantUUID:"); buffer.append(testNull(resourceInstance.getResourceInvariantUUID())); buffer.append(System.lineSeparator()); - + buffer.append("ResourceName:"); buffer.append(testNull(resourceInstance.getResourceName())); buffer.append(System.lineSeparator()); - + buffer.append("ResourceType:"); buffer.append(testNull(resourceInstance.getResourceType())); buffer.append(System.lineSeparator()); - + buffer.append("ResourceUUID:"); buffer.append(testNull(resourceInstance.getResourceUUID())); buffer.append(System.lineSeparator()); - + buffer.append("ResourceVersion:"); buffer.append(testNull(resourceInstance.getResourceVersion())); buffer.append(System.lineSeparator()); - + + buffer.append("Category:"); + buffer.append(testNull(resourceInstance.getCategory())); + buffer.append(System.lineSeparator()); + + buffer.append("SubCategory:"); + buffer.append(testNull(resourceInstance.getSubcategory())); + buffer.append(System.lineSeparator()); + buffer.append("Resource Artifacts List:"); buffer.append(System.lineSeparator()); buffer.append(testNull(dumpArtifactInfoList(resourceInstance.getArtifacts()))); buffer.append(System.lineSeparator()); - + return buffer.toString(); - + } - - + + private static String dumpArtifactInfoList(List artifactsList) { - + if (artifactsList == null || artifactsList.isEmpty()) { return null; } - - StringBuffer buffer = new StringBuffer(); + + StringBuffer buffer = new StringBuffer(); buffer.append("{"); for (IArtifactInfo artifactInfoElem:artifactsList) { buffer.append(System.lineSeparator()); buffer.append(testNull(dumpASDCArtifactInfo(artifactInfoElem))); buffer.append(System.lineSeparator()); buffer.append(","); - + } buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator()); buffer.append("}"); buffer.append(System.lineSeparator()); - + return buffer.toString(); } - + private static String dumpASDCArtifactInfo(IArtifactInfo artifactInfo) { - + if (artifactInfo == null) { return null; } - + StringBuffer buffer = new StringBuffer("Service Artifacts Info:"); buffer.append(System.lineSeparator()); - + buffer.append("ArtifactName:"); buffer.append(testNull(artifactInfo.getArtifactName())); buffer.append(System.lineSeparator()); - + buffer.append("ArtifactVersion:"); buffer.append(testNull(artifactInfo.getArtifactVersion())); buffer.append(System.lineSeparator()); - + buffer.append("ArtifactType:"); buffer.append(testNull(artifactInfo.getArtifactType())); buffer.append(System.lineSeparator()); - + buffer.append("ArtifactDescription:"); buffer.append(testNull(artifactInfo.getArtifactDescription())); buffer.append(System.lineSeparator()); - + buffer.append("ArtifactTimeout:"); buffer.append(testNull(artifactInfo.getArtifactTimeout())); buffer.append(System.lineSeparator()); - + buffer.append("ArtifactURL:"); buffer.append(testNull(artifactInfo.getArtifactURL())); buffer.append(System.lineSeparator()); - + buffer.append("ArtifactUUID:"); buffer.append(testNull(artifactInfo.getArtifactUUID())); buffer.append(System.lineSeparator()); - + buffer.append("ArtifactChecksum:"); buffer.append(testNull(artifactInfo.getArtifactChecksum())); buffer.append(System.lineSeparator()); - + buffer.append("GeneratedArtifact:"); buffer.append("{"); buffer.append(testNull(dumpASDCArtifactInfo(artifactInfo.getGeneratedArtifact()))); buffer.append(System.lineSeparator()); buffer.append("}"); buffer.append(System.lineSeparator()); - + buffer.append("RelatedArtifacts:"); - - + + if (artifactInfo.getRelatedArtifacts() != null) { buffer.append("{"); buffer.append(System.lineSeparator()); for (IArtifactInfo artifactInfoElem:artifactInfo.getRelatedArtifacts()) { - + buffer.append(testNull(dumpASDCArtifactInfo(artifactInfoElem))); buffer.append(System.lineSeparator()); buffer.append(","); - + } buffer.replace(buffer.length()-1,buffer.length(), System.lineSeparator()); buffer.append("}"); @@ -327,9 +359,9 @@ public class ASDCNotificationLogging { } else { buffer.append("NULL"); } - + buffer.append(System.lineSeparator()); - + return buffer.toString(); } } diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java index 23b7a80dbe..63da38d8c1 100644 --- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/client/tests/ASDCElementInfoTest.java @@ -7,9 +7,9 @@ * 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. @@ -33,7 +33,6 @@ import java.util.UUID; import org.junit.Test; import org.mockito.Mockito; - import org.openecomp.sdc.api.notification.IArtifactInfo; import org.openecomp.sdc.api.notification.INotificationData; import org.openecomp.sdc.api.notification.IResourceInstance; @@ -43,20 +42,20 @@ import org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException; import org.openecomp.mso.asdc.installer.ASDCElementInfo; import org.openecomp.mso.asdc.installer.VfModuleStructure; import org.openecomp.mso.asdc.installer.VfResourceStructure; - +import org.openecomp.mso.asdc.installer.IVfModuleData; public class ASDCElementInfoTest { - + @Test public void createASDCElementInfoWithNullParameterTest() { ASDCElementInfo elementInfoFromNullVfArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(null); ASDCElementInfo elementInfoFromNullVfModuleStructure = ASDCElementInfo.createElementFromVfModuleStructure(null); ASDCElementInfo elementInfoFromNullVfResourceStructure = ASDCElementInfo.createElementFromVfResourceStructure(null); - + elementInfoFromNullVfArtifact.addElementInfo(null, null); elementInfoFromNullVfModuleStructure.addElementInfo(null, "someValue"); elementInfoFromNullVfResourceStructure.addElementInfo("someKey", null); - + assertEquals(elementInfoFromNullVfArtifact.toString(), ""); assertEquals(elementInfoFromNullVfModuleStructure.toString(), ""); assertEquals(elementInfoFromNullVfResourceStructure.toString(), ""); @@ -66,107 +65,107 @@ public class ASDCElementInfoTest { assertNotNull(elementInfoFromNullVfResourceStructure); assertNotNull(ASDCElementInfo.EMPTY_INSTANCE); - + assertEquals(elementInfoFromNullVfArtifact, ASDCElementInfo.EMPTY_INSTANCE); assertEquals(elementInfoFromNullVfModuleStructure, ASDCElementInfo.EMPTY_INSTANCE); assertEquals(elementInfoFromNullVfResourceStructure, ASDCElementInfo.EMPTY_INSTANCE); - + assertEquals(ASDCElementInfo.EMPTY_INSTANCE.getType(), ""); assertEquals(ASDCElementInfo.EMPTY_INSTANCE.toString(), ""); - + assertEquals(elementInfoFromNullVfArtifact.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType()); assertEquals(elementInfoFromNullVfModuleStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType()); assertEquals(elementInfoFromNullVfResourceStructure.getType(), ASDCElementInfo.EMPTY_INSTANCE.getType()); } - + @Test public void createASDCElementInfoFromVfResourceTest() { - + String resourceInstanceName = "Resource 1"; - + UUID generatedUUID = UUID.randomUUID(); - + INotificationData notificationData = Mockito.mock(INotificationData.class); IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class); - + Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName); Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString()); - + VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance); - + ASDCElementInfo elementInfoFromVfResource = ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure); - + assertTrue(elementInfoFromVfResource.toString().contains(resourceInstanceName)); assertTrue(elementInfoFromVfResource.toString().contains(generatedUUID.toString())); - + assertFalse(ASDCConfiguration.VF_MODULES_METADATA.equals(elementInfoFromVfResource.getType())); assertEquals(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name(), elementInfoFromVfResource.getType()); - + assertFalse(elementInfoFromVfResource.toString().contains("MyInfo1: someValue")); elementInfoFromVfResource.addElementInfo("MyInfo1", "someValue"); assertTrue(elementInfoFromVfResource.toString().contains("MyInfo1: someValue")); } - + @Test public void createASDCElementInfoFromVfModuleTest() throws ArtifactInstallerException { - + String resourceInstanceName = "Resource 1"; - + UUID generatedUUID = UUID.randomUUID(); - + INotificationData notificationData = Mockito.mock(INotificationData.class); IResourceInstance resourceInstance = Mockito.mock(IResourceInstance.class); - + Mockito.when(resourceInstance.getResourceInstanceName()).thenReturn(resourceInstanceName); Mockito.when(resourceInstance.getResourceInvariantUUID()).thenReturn(generatedUUID.toString()); - + VfResourceStructure vfResourceStructure = new VfResourceStructure(notificationData, resourceInstance); - + // Create module structure now - + String vfModuleModelName = "Module Model XYZ"; - + UUID generatedUUIDForModule = UUID.randomUUID(); - - IVfModuleMetadata moduleMetadata = Mockito.mock(IVfModuleMetadata.class); + + IVfModuleData moduleMetadata = Mockito.mock(IVfModuleData.class); Mockito.when(moduleMetadata.getVfModuleModelName()).thenReturn(vfModuleModelName); Mockito.when(moduleMetadata.getVfModuleModelInvariantUUID()).thenReturn(generatedUUIDForModule.toString()); Mockito.when(moduleMetadata.getArtifacts()).thenReturn(Collections. emptyList()); - + VfModuleStructure vfModuleStructure = new VfModuleStructure(vfResourceStructure, moduleMetadata); - + ASDCElementInfo elementInfoFromVfModule = ASDCElementInfo.createElementFromVfModuleStructure(vfModuleStructure); - + assertTrue(elementInfoFromVfModule.toString().contains(vfModuleModelName)); assertTrue(elementInfoFromVfModule.toString().contains(generatedUUIDForModule.toString())); - + assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromVfModule.getType())); assertEquals(ASDCConfiguration.VF_MODULES_METADATA, elementInfoFromVfModule.getType()); - + assertFalse(elementInfoFromVfModule.toString().contains("MyInfo2: someValue")); elementInfoFromVfModule.addElementInfo("MyInfo2", "someValue"); assertTrue(elementInfoFromVfModule.toString().contains("MyInfo2: someValue")); } - + @Test public void createASDCElementInfoFromArtifact() { for (String eVal : ASDCConfiguration.SUPPORTED_ARTIFACT_TYPES_LIST) { String generatedArtifactName = eVal + " 1"; UUID generatedUUIDForArtifact = UUID.randomUUID(); - + IArtifactInfo artifactInfo = Mockito.mock(IArtifactInfo.class); Mockito.when(artifactInfo.getArtifactType()).thenReturn(eVal); Mockito.when(artifactInfo.getArtifactName()).thenReturn(generatedArtifactName); Mockito.when(artifactInfo.getArtifactUUID()).thenReturn(generatedUUIDForArtifact.toString()); - + ASDCElementInfo elementInfoFromArtifact = ASDCElementInfo.createElementFromVfArtifactInfo(artifactInfo); assertTrue(elementInfoFromArtifact.toString().contains(generatedArtifactName)); assertTrue(elementInfoFromArtifact.toString().contains(generatedUUIDForArtifact.toString())); - + assertFalse(ASDCElementInfo.ASDCElementTypeEnum.VNF_RESOURCE.name().equals(elementInfoFromArtifact.getType())); assertEquals(eVal, elementInfoFromArtifact.getType()); - + assertFalse(elementInfoFromArtifact.toString().contains("MyInfo3: someValue")); elementInfoFromArtifact.addElementInfo("MyInfo3", "someValue"); assertTrue(elementInfoFromArtifact.toString().contains("MyInfo3: someValue")); diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTest.java deleted file mode 100644 index 8dd5afe7e0..0000000000 --- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTest.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Fri Nov 25 13:35:55 GMT 2016 - */ - -package org.openecomp.mso.asdc.installer; - -import org.junit.Test; -import static org.junit.Assert.*; -import static org.evosuite.shaded.org.mockito.Mockito.*; -import static org.evosuite.runtime.EvoAssertions.*; - -import java.util.List; -import java.util.Map; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.evosuite.runtime.PrivateAccess; -import org.evosuite.runtime.ViolatedAssumptionAnswer; -import org.junit.runner.RunWith; -import org.openecomp.sdc.api.notification.IArtifactInfo; -import org.openecomp.sdc.api.notification.INotificationData; -import org.openecomp.sdc.api.notification.IResourceInstance; -import org.openecomp.sdc.api.notification.IVfModuleMetadata; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class ASDCElementInfoESTest extends ASDCElementInfoESTestscaffolding { - - @Test(timeout = 4000) - public void test00() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iResourceInstance0).getResourceInstanceName(); - doReturn((String) null).when(iResourceInstance0).getResourceInvariantUUID(); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure0); - String string0 = aSDCElementInfo0.getType(); - assertEquals("VNF_RESOURCE", string0); - } - - @Test(timeout = 4000) - public void test01() throws Throwable { - ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfModuleStructure((VfModuleStructure) null); - Map map0 = aSDCElementInfo0.getElementInfoMap(); - assertTrue(map0.isEmpty()); - } - - @Test(timeout = 4000) - public void test02() throws Throwable { - Map map0 = ASDCElementInfo.EMPTY_INSTANCE.getElementInfoMap(); - assertTrue(map0.isEmpty()); - } - - @Test(timeout = 4000) - public void test03() throws Throwable { - ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.EMPTY_INSTANCE; - IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iArtifactInfo0).getArtifactName(); - doReturn((String) null).when(iArtifactInfo0).getArtifactType(); - doReturn((String) null).when(iArtifactInfo0).getArtifactUUID(); - ASDCElementInfo aSDCElementInfo1 = ASDCElementInfo.createElementFromVfArtifactInfo(iArtifactInfo0); - aSDCElementInfo0.toString(); - PrivateAccess.setVariable((Class) ASDCElementInfo.class, aSDCElementInfo1, "elementInfoMap", (Object) null); - aSDCElementInfo0.toString(); - // Undeclared exception! - try { - aSDCElementInfo1.toString(); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.asdc.installer.ASDCElementInfo", e); - } - } - - @Test(timeout = 4000) - public void test05() throws Throwable { - ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.EMPTY_INSTANCE; - aSDCElementInfo0.addElementInfo("V$", (String) null); - assertEquals("", aSDCElementInfo0.getType()); - } - - @Test(timeout = 4000) - public void test06() throws Throwable { - ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfModuleStructure((VfModuleStructure) null); - String string0 = aSDCElementInfo0.EMPTY_INSTANCE.getType(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test07() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, (IResourceInstance) null); - IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - doReturn((List) null).when(iVfModuleMetadata0).getArtifacts(); - VfModuleStructure vfModuleStructure0 = null; - try { - vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleMetadata0); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e); - } - } - - @Test(timeout = 4000) - public void test08() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - doReturn(" Name").when(iResourceInstance0).getResourceInstanceName(); - doReturn(" Name").when(iResourceInstance0).getResourceInvariantUUID(); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfResourceStructure(vfResourceStructure0); - String string0 = aSDCElementInfo0.toString(); - assertEquals("Resource Instance Invariant UUID: Name, Resource Instance Name: Name", string0); - } - - @Test(timeout = 4000) - public void test09() throws Throwable { - ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfArtifactInfo((IArtifactInfo) null); - aSDCElementInfo0.addElementInfo((String) null, ""); - assertEquals("", aSDCElementInfo0.getType()); - } - - @Test(timeout = 4000) - public void test10() throws Throwable { - IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iArtifactInfo0).getArtifactName(); - doReturn((String) null).when(iArtifactInfo0).getArtifactType(); - doReturn((String) null).when(iArtifactInfo0).getArtifactUUID(); - ASDCElementInfo aSDCElementInfo0 = ASDCElementInfo.createElementFromVfArtifactInfo(iArtifactInfo0); - String string0 = aSDCElementInfo0.getType(); - assertNull(string0); - } -} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTestscaffolding.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTestscaffolding.java deleted file mode 100644 index 075970b066..0000000000 --- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/ASDCElementInfoESTestscaffolding.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Scaffolding file used to store all the setups needed to run - * tests automatically generated by EvoSuite - * Fri Nov 25 13:35:55 GMT 2016 - */ - -package org.openecomp.mso.asdc.installer; - -import org.evosuite.runtime.annotation.EvoSuiteClassExclude; -import org.junit.BeforeClass; -import org.junit.Before; -import org.junit.After; -import org.junit.AfterClass; -import org.evosuite.runtime.sandbox.Sandbox; - -@EvoSuiteClassExclude -public class ASDCElementInfoESTestscaffolding { - - @org.junit.Rule - public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); - - private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.asdc.installer.ASDCElementInfo"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); - initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } - - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } - - @Before - public void initTestCase(){ - threadStopper.storeCurrentThreads(); - threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } - - @After - public void doneWithTestCase(){ - threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } - - private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ASDCElementInfoESTestscaffolding.class.getClassLoader() , - "org.openecomp.sdc.api.IDistributionClient", - "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", - "org.openecomp.mso.asdc.installer.VfResourceStructure", - "org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException", - "org.openecomp.mso.db.catalog.beans.VnfResource", - "org.openecomp.sdc.api.notification.IVfModuleMetadata", - "org.openecomp.mso.db.catalog.beans.VfModule", - "org.openecomp.sdc.api.results.IDistributionClientResult", - "org.openecomp.sdc.api.notification.IArtifactInfo", - "org.openecomp.mso.db.catalog.beans.Service", - "org.openecomp.mso.asdc.installer.VfModuleStructure", - "org.openecomp.sdc.api.notification.INotificationData", - "org.openecomp.mso.asdc.installer.VfModuleArtifact", - "org.openecomp.sdc.api.notification.IResourceInstance", - "org.openecomp.mso.asdc.installer.ASDCElementInfo", - "org.openecomp.sdc.api.results.IDistributionClientDownloadResult", - "org.openecomp.mso.asdc.installer.ASDCElementInfo$ASDCElementTypeEnum" - ); - } - - private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ASDCElementInfoESTestscaffolding.class.getClassLoader()); - - org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "org.openecomp.mso.asdc.installer.ASDCElementInfo$ASDCElementTypeEnum", - "org.openecomp.mso.asdc.installer.ASDCElementInfo", - "org.openecomp.mso.asdc.client.exceptions.ArtifactInstallerException" - ); - } -} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleMetaDataESTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleMetaDataESTest.java new file mode 100644 index 0000000000..f87f9068f2 --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleMetaDataESTest.java @@ -0,0 +1,517 @@ +/* + * This file was automatically generated by EvoSuite + * Fri Feb 24 16:02:34 GMT 2017 + */ + +package org.openecomp.mso.asdc.installer; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; +import static org.evosuite.runtime.EvoAssertions.*; +import java.util.List; +import java.util.Map; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.PrivateAccess; +import org.evosuite.runtime.ViolatedAssumptionAnswer; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class VfModuleMetaDataESTest extends VfModuleMetaDataESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + List list0 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + Integer integer0 = new Integer((-13)); + vfModuleMetaData0.setAttribute("", integer0); + vfModuleMetaData0.setAttribute("", ""); + Map map0 = (Map) mock(Map.class, new ViolatedAssumptionAnswer()); + doReturn((Object) null).when(map0).put(any() , any()); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) map0); + List list1 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "artifacts", (Object) list1); + vfModuleMetaData0.setAttribute("kup1s\"/L_ ", "kup1s\"/L_ "); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "artifacts", (Object) list0); + Map map1 = (Map) mock(Map.class, new ViolatedAssumptionAnswer()); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "properties", (Object) map1); + Map map2 = (Map) mock(Map.class, new ViolatedAssumptionAnswer()); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) map2); + Map map3 = (Map) mock(Map.class, new ViolatedAssumptionAnswer()); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) map3); + VfModuleMetaData vfModuleMetaData1 = new VfModuleMetaData(); + List list2 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData1, "artifacts", (Object) list2); + vfModuleMetaData1.setAttribute((String) null, ""); + vfModuleMetaData1.setAttribute("", ""); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData1, "properties", (Object) null); + vfModuleMetaData1.getProperties(); + vfModuleMetaData0.setAttribute("", integer0); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) null); + // Undeclared exception! + try { + vfModuleMetaData1.isBase(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e); + } + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + Map map0 = vfModuleMetaData0.getProperties(); + List list0 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "artifacts", (Object) list0); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) map0); + vfModuleMetaData0.setAttribute(")aPjhY=.[,~@B5", ")aPjhY=.[,~@B5"); + vfModuleMetaData0.setAttribute(")aPjhY=.[,~@B5", ""); + vfModuleMetaData0.setAttribute(")aPjhY=.[,~@B5", ""); + Integer integer0 = new Integer((-6)); + vfModuleMetaData0.setAttribute(")aPjhY=.[,~@B5", integer0); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "properties", (Object) map0); + Map map1 = (Map) mock(Map.class, new ViolatedAssumptionAnswer()); + doReturn((Object) null).when(map1).put(any() , any()); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) map1); + vfModuleMetaData0.setAttribute((String) null, integer0); + Integer integer1 = new Integer((-1)); + vfModuleMetaData0.setAttribute("&$*6wB^=VXY/.Gj`T", integer1); + Map map2 = vfModuleMetaData0.getProperties(); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) map2); + Map map3 = vfModuleMetaData0.getProperties(); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "attributesMap", (Object) map3); + List list1 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(list1).toString(); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "artifacts", (Object) list1); + List list2 = vfModuleMetaData0.getArtifacts(); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "properties", (Object) map3); + PrivateAccess.setVariable((Class) VfModuleMetaData.class, vfModuleMetaData0, "artifacts", (Object) list2); + // Undeclared exception! + try { + vfModuleMetaData0.isBase(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e); + } + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + vfModuleMetaData0.getVfModuleModelUUID(); + vfModuleMetaData0.setAttribute("", ""); + vfModuleMetaData0.setAttribute("X0s-/&YT>", "X0s-/&YT>"); + vfModuleMetaData0.getArtifacts(); + vfModuleMetaData0.setAttribute("vfModuleModelUUID", ""); + vfModuleMetaData0.setAttribute("RHO{0R!FJsK+:s.q", ""); + vfModuleMetaData0.setAttribute((String) null, ""); + vfModuleMetaData0.setAttribute("", ""); + vfModuleMetaData0.getVfModuleModelUUID(); + vfModuleMetaData0.getArtifacts(); + vfModuleMetaData0.getProperties(); + vfModuleMetaData0.getVfModuleModelUUID(); + vfModuleMetaData0.getArtifacts(); + vfModuleMetaData0.setAttribute("", ""); + vfModuleMetaData0.getVfModuleModelUUID(); + vfModuleMetaData0.getArtifacts(); + // Undeclared exception! + try { + vfModuleMetaData0.isBase(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e); + } + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + vfModuleMetaData0.setAttribute("6NJ#o #-{", "6NJ#o #-{"); + vfModuleMetaData0.setAttribute("", ""); + vfModuleMetaData0.setAttribute("", "3o(D\" map0 = vfModuleMetaData0.getProperties(); + vfModuleMetaData0.getVfModuleModelInvariantUUID(); + vfModuleMetaData0.setAttribute("", ""); + vfModuleMetaData0.setAttribute("", "w(f2d"); + vfModuleMetaData0.setAttribute("", map0); + vfModuleMetaData0.setAttribute(" map0 = vfModuleMetaData0.getProperties(); + vfModuleMetaData0.setAttribute("vfModuleModelDescription", "vfModuleModelDescription"); + vfModuleMetaData0.setAttribute("vfModuleModelDescription", map0); + vfModuleMetaData0.getVfModuleModelCustomizationUUID(); + vfModuleMetaData0.getArtifacts(); + vfModuleMetaData0.getProperties(); + // Undeclared exception! + try { + vfModuleMetaData0.getVfModuleModelDescription(); + fail("Expecting exception: ClassCastException"); + + } catch(ClassCastException e) { + // + // java.util.HashMap cannot be cast to java.lang.String + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e); + } + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + vfModuleMetaData0.setAttribute("vfModuleModelDescription", "vfModuleModelDescription"); + vfModuleMetaData0.setAttribute("}U?", ""); + vfModuleMetaData0.getVfModuleModelVersion(); + vfModuleMetaData0.setAttribute("f78C:y", (Object) null); + vfModuleMetaData0.getArtifacts(); + vfModuleMetaData0.getVfModuleModelVersion(); + vfModuleMetaData0.getVfModuleModelUUID(); + vfModuleMetaData0.getVfModuleModelVersion(); + vfModuleMetaData0.getVfModuleModelDescription(); + vfModuleMetaData0.setAttribute("", ""); + vfModuleMetaData0.getVfModuleModelVersion(); + vfModuleMetaData0.getVfModuleModelDescription(); + vfModuleMetaData0.getVfModuleModelName(); + vfModuleMetaData0.getProperties(); + vfModuleMetaData0.getVfModuleModelVersion(); + // Undeclared exception! + try { + vfModuleMetaData0.isBase(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e); + } + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + vfModuleMetaData0.setAttribute("Q> 'piXimPhE", "Q> 'piXimPhE"); + vfModuleMetaData0.setAttribute("Q> 'piXimPhE", "("); + vfModuleMetaData0.setAttribute("D0kbC~", "Q> 'piXimPhE"); + vfModuleMetaData0.setAttribute("", "D0kbC~"); + vfModuleMetaData0.setAttribute("(", ""); + vfModuleMetaData0.setAttribute("vfModuleModelVersion", "][,6>~[xc,"); + vfModuleMetaData0.setAttribute("", "("); + vfModuleMetaData0.getVfModuleModelCustomizationUUID(); + vfModuleMetaData0.getVfModuleModelCustomizationUUID(); + vfModuleMetaData0.getVfModuleModelDescription(); + vfModuleMetaData0.getVfModuleModelDescription(); + vfModuleMetaData0.getVfModuleModelInvariantUUID(); + vfModuleMetaData0.getVfModuleModelVersion(); + vfModuleMetaData0.setAttribute("D0kbC~", "vfModuleModelVersion"); + // Undeclared exception! + try { + vfModuleMetaData0.isBase(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e); + } + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + vfModuleMetaData0.setAttribute("vfModuleModelUUID", ""); + vfModuleMetaData0.setAttribute("vfModuleModelCustomizationUUID", ""); + vfModuleMetaData0.setAttribute("", ""); + vfModuleMetaData0.getVfModuleModelCustomizationUUID(); + // Undeclared exception! + try { + vfModuleMetaData0.isBase(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e); + } + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + vfModuleMetaData0.setAttribute("", ""); + vfModuleMetaData0.setAttribute("isBase", "isBase"); + vfModuleMetaData0.setAttribute("isBase", ""); + vfModuleMetaData0.getVfModuleModelCustomizationUUID(); + vfModuleMetaData0.getArtifacts(); + // Undeclared exception! + try { + vfModuleMetaData0.isBase(); + fail("Expecting exception: ClassCastException"); + + } catch(ClassCastException e) { + // + // java.lang.String cannot be cast to java.lang.Boolean + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e); + } + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + vfModuleMetaData0.setAttribute("vfModuleModelName", "vfModuleModelName"); + vfModuleMetaData0.getVfModuleModelInvariantUUID(); + vfModuleMetaData0.setAttribute("mp+0S", (Object) null); + vfModuleMetaData0.setAttribute("EVNf'G}^Q", "mp+0S"); + vfModuleMetaData0.getVfModuleModelInvariantUUID(); + vfModuleMetaData0.getVfModuleModelInvariantUUID(); + vfModuleMetaData0.getVfModuleModelName(); + vfModuleMetaData0.getVfModuleModelName(); + vfModuleMetaData0.getArtifacts(); + vfModuleMetaData0.getVfModuleModelName(); + vfModuleMetaData0.setAttribute("Pw5`cyIph)xX&#zj~'", (Object) null); + vfModuleMetaData0.getVfModuleModelVersion(); + vfModuleMetaData0.getVfModuleModelName(); + // Undeclared exception! + try { + vfModuleMetaData0.isBase(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e); + } + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + vfModuleMetaData0.setAttribute("vfModuleModelName", "vfModuleModelName"); + vfModuleMetaData0.getVfModuleModelVersion(); + vfModuleMetaData0.getVfModuleModelInvariantUUID(); + vfModuleMetaData0.getVfModuleModelVersion(); + vfModuleMetaData0.setAttribute("", (Object) null); + vfModuleMetaData0.setAttribute((String) null, "vfModuleModelName"); + vfModuleMetaData0.setAttribute("vfModuleModelName", ""); + vfModuleMetaData0.getVfModuleModelDescription(); + vfModuleMetaData0.getVfModuleModelInvariantUUID(); + vfModuleMetaData0.getVfModuleModelCustomizationUUID(); + vfModuleMetaData0.getVfModuleModelInvariantUUID(); + vfModuleMetaData0.getProperties(); + vfModuleMetaData0.getProperties(); + vfModuleMetaData0.getVfModuleModelVersion(); + vfModuleMetaData0.getVfModuleModelCustomizationUUID(); + vfModuleMetaData0.getVfModuleModelName(); + // Undeclared exception! + try { + vfModuleMetaData0.isBase(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e); + } + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + vfModuleMetaData0.setAttribute("vfModuleModelInvariantUUID", "vfModuleModelInvariantUUID"); + vfModuleMetaData0.setAttribute("vfModuleModelInvariantUUID", "vfModuleModelInvariantUUID"); + vfModuleMetaData0.getVfModuleModelUUID(); + vfModuleMetaData0.getVfModuleModelName(); + vfModuleMetaData0.getProperties(); + vfModuleMetaData0.setAttribute("k", "k"); + vfModuleMetaData0.getVfModuleModelInvariantUUID(); + vfModuleMetaData0.setAttribute("", (Object) null); + VfModuleMetaData vfModuleMetaData1 = new VfModuleMetaData(); + vfModuleMetaData1.getProperties(); + // Undeclared exception! + try { + vfModuleMetaData1.isBase(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e); + } + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + vfModuleMetaData0.setAttribute("y&g B,yQlt!e=p`Q1", "y&g B,yQlt!e=p`Q1"); + vfModuleMetaData0.setAttribute("vfModuleModelCustomizationUUID", "vfModuleModelCustomizationUUID"); + vfModuleMetaData0.setAttribute("vfModuleModelCustomizationUUID", "vfModuleModelCustomizationUUID"); + vfModuleMetaData0.setAttribute("y&g B,yQlt!e=p`Q1", "vfModuleModelCustomizationUUID"); + vfModuleMetaData0.setAttribute("vfModuleModelCustomizationUUID", (Object) null); + vfModuleMetaData0.setAttribute("3m%.ng=pp5", "vfModuleModelCustomizationUUID"); + vfModuleMetaData0.getVfModuleModelInvariantUUID(); + vfModuleMetaData0.setAttribute((String) null, (Object) null); + vfModuleMetaData0.getVfModuleModelCustomizationUUID(); + vfModuleMetaData0.setAttribute((String) null, "vfModuleModelDescription"); + vfModuleMetaData0.getVfModuleModelCustomizationUUID(); + vfModuleMetaData0.setAttribute("n8'>kSe2Hv:m| ", "vfModuleModelCustomizationUUID"); + vfModuleMetaData0.getVfModuleModelUUID(); + vfModuleMetaData0.getVfModuleModelInvariantUUID(); + vfModuleMetaData0.getVfModuleModelName(); + vfModuleMetaData0.getVfModuleModelInvariantUUID(); + vfModuleMetaData0.getVfModuleModelVersion(); + String string0 = vfModuleMetaData0.getVfModuleModelVersion(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + vfModuleMetaData0.getVfModuleModelDescription(); + vfModuleMetaData0.setAttribute((String) null, (Object) null); + vfModuleMetaData0.getVfModuleModelName(); + vfModuleMetaData0.getVfModuleModelVersion(); + vfModuleMetaData0.setAttribute(".+7u)hv;7kUOz", (Object) null); + vfModuleMetaData0.getVfModuleModelCustomizationUUID(); + vfModuleMetaData0.getVfModuleModelInvariantUUID(); + String string0 = vfModuleMetaData0.getVfModuleModelUUID(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + String string0 = "$"; + vfModuleMetaData0.setAttribute("$", "$"); + vfModuleMetaData0.setAttribute("$", ""); + vfModuleMetaData0.setAttribute("", "$"); + // Undeclared exception! + try { + vfModuleMetaData0.isBase(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e); + } + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + vfModuleMetaData0.getArtifacts(); + Map map0 = vfModuleMetaData0.getProperties(); + assertEquals(0, map0.size()); + } +} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleMetaDataESTestscaffolding.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleMetaDataESTestscaffolding.java new file mode 100644 index 0000000000..39bb3a7227 --- /dev/null +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleMetaDataESTestscaffolding.java @@ -0,0 +1,78 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Fri Feb 24 16:02:34 GMT 2017 + */ + +package org.openecomp.mso.asdc.installer; + +import org.evosuite.runtime.annotation.EvoSuiteClassExclude; +import org.junit.BeforeClass; +import org.junit.Before; +import org.junit.After; +import org.junit.AfterClass; +import org.evosuite.runtime.sandbox.Sandbox; +import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; + +@EvoSuiteClassExclude +public class VfModuleMetaDataESTestscaffolding { + + @org.junit.Rule + public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); + + private static final java.util.Properties defaultProperties = (java.util.Properties) System.getProperties().clone(); + + private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); + + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.asdc.installer.VfModuleMetaData"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = SandboxMode.RECOMMENDED; + Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); + initializeClasses(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } + + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + System.setProperties((java.util.Properties) defaultProperties.clone()); + } + + @Before + public void initTestCase(){ + threadStopper.storeCurrentThreads(); + threadStopper.startRecordingTime(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } + + @After + public void doneWithTestCase(){ + threadStopper.killAndJoinClientThreads(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } + + private static void initializeClasses() { + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(VfModuleMetaDataESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.asdc.installer.VfModuleMetaData", + "org.openecomp.mso.asdc.installer.IVfModuleData" + ); + } + + private static void resetClasses() { + } +} diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleStructureESTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleStructureESTest.java index f3c20c5eb7..e63680b4c7 100644 --- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleStructureESTest.java +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfModuleStructureESTest.java @@ -1,108 +1,97 @@ /* * This file was automatically generated by EvoSuite - * Fri Nov 25 13:37:00 GMT 2016 + * Fri Feb 24 13:34:51 GMT 2017 */ package org.openecomp.mso.asdc.installer; +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.shaded.org.mockito.Mockito.*; +import static org.evosuite.runtime.MockitoExtension.*; +import static org.evosuite.runtime.EvoAssertions.*; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.ViolatedAssumptionAnswer; -import org.junit.Test; import org.junit.runner.RunWith; +import org.openecomp.mso.asdc.installer.IVfModuleData; +import org.openecomp.mso.asdc.installer.VfModuleArtifact; +import org.openecomp.mso.asdc.installer.VfModuleStructure; +import org.openecomp.mso.asdc.installer.VfResourceStructure; +import org.openecomp.mso.db.catalog.beans.VfModule; import org.openecomp.sdc.api.notification.INotificationData; import org.openecomp.sdc.api.notification.IResourceInstance; -import org.openecomp.sdc.api.notification.IVfModuleMetadata; -import java.util.LinkedList; -import java.util.List; - -import static org.evosuite.runtime.EvoAssertions.verifyException; -import static org.evosuite.shaded.org.mockito.Mockito.doReturn; -import static org.evosuite.shaded.org.mockito.Mockito.mock; -import static org.junit.Assert.fail; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) public class VfModuleStructureESTest extends VfModuleStructureESTestscaffolding { - @Test(timeout = 4000) - public void test1() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - doReturn((List) null).when(iVfModuleMetadata0).getArtifacts(); - VfModuleStructure vfModuleStructure0 = null; - try { - vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleMetadata0); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e); - } - } + @Test(timeout = 4000) + public void test0() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer()); + doReturn(linkedList0).when(iVfModuleData0).getArtifacts(); + VfModuleStructure vfModuleStructure0 = new VfModuleStructure((VfResourceStructure) null, iVfModuleData0); + VfModule vfModule0 = new VfModule(); + vfModule0.setIsBase(1); + vfModuleStructure0.setCatalogVfModule(vfModule0); + VfModule vfModule1 = vfModuleStructure0.getCatalogVfModule(); + assertNull(vfModule1.getModelInvariantUuid()); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer()); + doReturn(linkedList0).when(iVfModuleData0).getArtifacts(); + VfModuleStructure vfModuleStructure0 = new VfModuleStructure((VfResourceStructure) null, iVfModuleData0); + VfModule vfModule0 = new VfModule(); + vfModuleStructure0.setCatalogVfModule(vfModule0); + VfModule vfModule1 = vfModuleStructure0.getCatalogVfModule(); + assertNull(vfModule1.getModelVersion()); + } + @Test(timeout = 4000) + public void test4() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer()); + doReturn(linkedList0).when(iVfModuleData0).getArtifacts(); + VfModuleStructure vfModuleStructure0 = new VfModuleStructure((VfResourceStructure) null, iVfModuleData0); + Map> map0 = vfModuleStructure0.getArtifactsMap(); + assertTrue(map0.isEmpty()); + } - @Test(timeout = 4000) - public void test2() throws Throwable { - IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - doReturn((List) null).when(iVfModuleMetadata0).getArtifacts(); - VfModuleStructure vfModuleStructure0 = null; - try { - vfModuleStructure0 = new VfModuleStructure((VfResourceStructure) null, iVfModuleMetadata0); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e); - } - } + @Test(timeout = 4000) + public void test5() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); + IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer()); + doReturn((List) null).when(iVfModuleData0).getArtifacts(); + VfModuleStructure vfModuleStructure0 = null; + try { + vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleData0); + fail("Expecting exception: NullPointerException"); - @Test(timeout = 4000) - public void test3() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - LinkedList linkedList0 = new LinkedList(); - IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - doReturn(linkedList0).when(iVfModuleMetadata0).getArtifacts(); - linkedList0.add(""); - VfModuleStructure vfModuleStructure0 = null; - try { - vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleMetadata0); - fail("Expecting exception: Exception"); - - } catch(Exception e) { - // - // Artifact (UUID:) referenced in the VFModule UUID list has not been downloaded, cancelling the Resource deployment - // - verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e); - } - } + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e); + } + } - @Test(timeout = 4000) - public void test4() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - vfResourceStructure0.setSuccessfulDeployment(); - IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - doReturn((List) null).when(iVfModuleMetadata0).getArtifacts(); - vfResourceStructure0.setSuccessfulDeployment(); - VfModuleStructure vfModuleStructure0 = null; - try { - vfModuleStructure0 = new VfModuleStructure(vfResourceStructure0, iVfModuleMetadata0); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.asdc.installer.VfModuleStructure", e); - } - } + @Test(timeout = 4000) + public void test6() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer()); + doReturn(linkedList0).when(iVfModuleData0).getArtifacts(); + VfModuleStructure vfModuleStructure0 = new VfModuleStructure((VfResourceStructure) null, iVfModuleData0); + VfModule vfModule0 = vfModuleStructure0.getCatalogVfModule(); + assertNull(vfModule0); + } } diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTest.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTest.java deleted file mode 100644 index 4a27df3a48..0000000000 --- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/installer/VfResourceStructureESTest.java +++ /dev/null @@ -1,400 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Fri Nov 25 13:29:36 GMT 2016 - */ - -package org.openecomp.mso.asdc.installer; - -import org.junit.Test; -import static org.junit.Assert.*; -import static org.evosuite.shaded.org.mockito.Mockito.*; -import static org.evosuite.runtime.EvoAssertions.*; - -import org.openecomp.mso.db.catalog.beans.Service; -import org.openecomp.mso.db.catalog.beans.VnfResource; -import java.time.chrono.ChronoLocalDate; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.evosuite.runtime.PrivateAccess; -import org.evosuite.runtime.ViolatedAssumptionAnswer; -import org.evosuite.runtime.mock.java.time.chrono.MockHijrahDate; -import org.junit.runner.RunWith; -import org.openecomp.sdc.api.IDistributionClient; -import org.openecomp.sdc.api.notification.IArtifactInfo; -import org.openecomp.sdc.api.notification.INotificationData; -import org.openecomp.sdc.api.notification.IResourceInstance; -import org.openecomp.sdc.impl.DistributionClientDownloadResultImpl; -import org.openecomp.sdc.impl.mock.DistributionClientDownloadResultStubImpl; -import org.openecomp.sdc.impl.mock.DistributionClientStubImpl; -import org.openecomp.sdc.utils.DistributionActionResultEnum; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class VfResourceStructureESTest extends VfResourceStructureESTestscaffolding { - - @Test(timeout = 4000) - public void test00() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - PrivateAccess.setVariable((Class) VfResourceStructure.class, vfResourceStructure0, "vfModulesStructureList", (Object) null); - vfResourceStructure0.getVfModuleStructure(); - assertFalse(vfResourceStructure0.isDeployedSuccessfully()); - } - - @Test(timeout = 4000) - public void test01() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - LinkedList linkedList0 = new LinkedList(); - linkedList0.add((Object) vfResourceStructure0); - PrivateAccess.setVariable((Class) VfResourceStructure.class, vfResourceStructure0, "vfModulesStructureList", (Object) linkedList0); - vfResourceStructure0.getVfModuleStructure(); - assertFalse(vfResourceStructure0.isDeployedSuccessfully()); - } - - @Test(timeout = 4000) - public void test02() throws Throwable { - VfResourceStructure vfResourceStructure0 = new VfResourceStructure((INotificationData) null, (IResourceInstance) null); - vfResourceStructure0.getResourceInstance(); - assertFalse(vfResourceStructure0.isDeployedSuccessfully()); - } - - @Test(timeout = 4000) - public void test03() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn("").when(iNotificationData0).toString(); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - vfResourceStructure0.getNotification(); - assertFalse(vfResourceStructure0.isDeployedSuccessfully()); - } - - @Test(timeout = 4000) - public void test04() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - Service service0 = new Service(); - service0.setId(6); - vfResourceStructure0.setCatalogService(service0); - vfResourceStructure0.getCatalogService(); - assertFalse(vfResourceStructure0.isDeployedSuccessfully()); - } - - @Test(timeout = 4000) - public void test05() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - Iterator iterator0 = (Iterator) mock(Iterator.class, new ViolatedAssumptionAnswer()); - List list0 = (List) mock(List.class, new ViolatedAssumptionAnswer()); - doReturn((Iterator) null).when(list0).iterator(); - PrivateAccess.setVariable((Class) VfResourceStructure.class, vfResourceStructure0, "vfModulesMetadataList", (Object) list0); - PrivateAccess.setVariable((Class) VfResourceStructure.class, vfResourceStructure0, "isDeployedSuccessfully", (Object) true); - List list1 = (List) mock(List.class, new ViolatedAssumptionAnswer()); - PrivateAccess.setVariable((Class) VfResourceStructure.class, vfResourceStructure0, "isDeployedSuccessfully", (Object) true); - PrivateAccess.setVariable((Class) VfResourceStructure.class, vfResourceStructure0, "vfModulesStructureList", (Object) list1); - // Undeclared exception! - try { - vfResourceStructure0.createVfModuleStructures(); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.asdc.installer.VfResourceStructure", e); - } - } - - @Test(timeout = 4000) - public void test06() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - Iterator iterator0 = (Iterator) mock(Iterator.class, new ViolatedAssumptionAnswer()); - doReturn(false).when(iterator0).hasNext(); - List list0 = (List) mock(List.class, new ViolatedAssumptionAnswer()); - doReturn(iterator0).when(list0).iterator(); - PrivateAccess.setVariable((Class) VfResourceStructure.class, vfResourceStructure0, "vfModulesMetadataList", (Object) list0); - PrivateAccess.setVariable((Class) VfResourceStructure.class, vfResourceStructure0, "isDeployedSuccessfully", (Object) true); - List list1 = (List) mock(List.class, new ViolatedAssumptionAnswer()); - PrivateAccess.setVariable((Class) VfResourceStructure.class, vfResourceStructure0, "isDeployedSuccessfully", (Object) true); - PrivateAccess.setVariable((Class) VfResourceStructure.class, vfResourceStructure0, "vfModulesStructureList", (Object) list1); - vfResourceStructure0.createVfModuleStructures(); - IDistributionClient iDistributionClient0 = mock(IDistributionClient.class, new ViolatedAssumptionAnswer()); - IArtifactInfo iArtifactInfo0 = null; - DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.ARTIFACT_NOT_FOUND; - DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, ""); - List list2 = (List) mock(List.class, new ViolatedAssumptionAnswer()); - PrivateAccess.setVariable((Class) VfResourceStructure.class, vfResourceStructure0, "vfModulesMetadataList", (Object) list2); - // Undeclared exception! - try { - vfResourceStructure0.addArtifactToStructure(iDistributionClient0, (IArtifactInfo) null, distributionClientDownloadResultImpl0); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - } - } - - @Test(timeout = 4000) - public void test07() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - ChronoLocalDate chronoLocalDate0 = mock(ChronoLocalDate.class, new ViolatedAssumptionAnswer()); - Iterator iterator0 = (Iterator) mock(Iterator.class, new ViolatedAssumptionAnswer()); - doReturn(true).when(iterator0).hasNext(); - doReturn(chronoLocalDate0).when(iterator0).next(); - List list0 = (List) mock(List.class, new ViolatedAssumptionAnswer()); - doReturn(iterator0).when(list0).iterator(); - PrivateAccess.setVariable((Class) VfResourceStructure.class, vfResourceStructure0, "vfModulesMetadataList", (Object) list0); - // Undeclared exception! - try { - vfResourceStructure0.createVfModuleStructures(); - fail("Expecting exception: ClassCastException"); - - } catch(ClassCastException e) { - // - // $java.time.chrono.ChronoLocalDate$$EnhancerByMockitoWithCGLIB$$27d47344 cannot be cast to org.openecomp.sdc.api.notification.IVfModuleMetadata - // - verifyException("org.openecomp.mso.asdc.installer.VfResourceStructure", e); - } - } - - @Test(timeout = 4000) - public void test08() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - try { - vfResourceStructure0.createVfModuleStructures(); - fail("Expecting exception: Exception"); - - } catch(Exception e) { - // - // VfModule Meta DATA could not be decoded properly or was not present in the notification - // - verifyException("org.openecomp.mso.asdc.installer.VfResourceStructure", e); - } - } - - @Test(timeout = 4000) - public void test09() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl(); - IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); - doReturn("%[76").when(iArtifactInfo0).getArtifactType(); - DistributionClientDownloadResultStubImpl distributionClientDownloadResultStubImpl0 = (DistributionClientDownloadResultStubImpl)distributionClientStubImpl0.download(iArtifactInfo0); - vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo0, distributionClientDownloadResultStubImpl0); - assertFalse(vfResourceStructure0.isDeployedSuccessfully()); - } - - @Test(timeout = 4000) - public void test10() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl(); - IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); - doReturn("HEAT_ARTIFACT").when(iArtifactInfo0).getArtifactType(); - doReturn((String) null).when(iArtifactInfo0).getArtifactUUID(); - DistributionClientDownloadResultStubImpl distributionClientDownloadResultStubImpl0 = (DistributionClientDownloadResultStubImpl)distributionClientStubImpl0.download(iArtifactInfo0); - vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo0, distributionClientDownloadResultStubImpl0); - assertFalse(vfResourceStructure0.isDeployedSuccessfully()); - } - - @Test(timeout = 4000) - public void test11() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl(); - IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); - DistributionClientDownloadResultStubImpl distributionClientDownloadResultStubImpl0 = (DistributionClientDownloadResultStubImpl)distributionClientStubImpl0.download(iArtifactInfo0); - IArtifactInfo iArtifactInfo1 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); - doReturn("HEAT").when(iArtifactInfo1).getArtifactType(); - doReturn("%[76").when(iArtifactInfo1).getArtifactUUID(); - vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo1, distributionClientDownloadResultStubImpl0); - assertFalse(vfResourceStructure0.isDeployedSuccessfully()); - } - - @Test(timeout = 4000) - public void test12() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl(); - IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); - DistributionClientDownloadResultStubImpl distributionClientDownloadResultStubImpl0 = (DistributionClientDownloadResultStubImpl)distributionClientStubImpl0.download(iArtifactInfo0); - IArtifactInfo iArtifactInfo1 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); - doReturn("HEAT_NET").when(iArtifactInfo1).getArtifactType(); - doReturn("HEAT_ENV").when(iArtifactInfo1).getArtifactUUID(); - vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo1, distributionClientDownloadResultStubImpl0); - assertFalse(vfResourceStructure0.isDeployedSuccessfully()); - } - - @Test(timeout = 4000) - public void test13() throws Throwable { - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure((INotificationData) null, iResourceInstance0); - DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl(); - IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); - doReturn("HEAT_ENV").when(iArtifactInfo0).getArtifactType(); - doReturn("*Z\"P4rvOA+mW").when(iArtifactInfo0).getArtifactUUID(); - DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.UEB_KEYS_CREATION_FAILED; - byte[] byteArray0 = new byte[6]; - DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, "]=)|;N.$hV]d^", "s:h+", byteArray0); - vfResourceStructure0.addArtifactToStructure(distributionClientStubImpl0, iArtifactInfo0, distributionClientDownloadResultImpl0); - Map map0 = vfResourceStructure0.getArtifactsMapByUUID(); - assertFalse(vfResourceStructure0.isDeployedSuccessfully()); - assertFalse(map0.isEmpty()); - } - - @Test(timeout = 4000) - public void test14() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - VfResourceStructure vfResourceStructure0 = new VfResourceStructure(iNotificationData0, iResourceInstance0); - DistributionClientStubImpl distributionClientStubImpl0 = new DistributionClientStubImpl(); - IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); - doReturn("VF_MODULES_METADATA").when(iArtifactInfo0).getArtifactType(); - DistributionActionResultEnum distributionActionResultEnum0 = DistributionActionResultEnum.BAD_REQUEST; - byte[] byteArray0 = new byte[2]; - DistributionClientDownloadResultImpl distributionClientDownloadResultImpl0 = new DistributionClientDownloadResultImpl(distributionActionResultEnum0, ") null); - LinkedList linkedList0 = new LinkedList(); - LinkedList linkedList1 = new LinkedList(); - Integer integer0 = new Integer(2147483645); - Integer integer1 = new Integer(2147483645); - Integer integer2 = new Integer(2147483645); - IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iArtifactInfo0).getArtifactChecksum(); - doReturn((String) null).when(iArtifactInfo0).getArtifactDescription(); - doReturn((String) null).when(iArtifactInfo0).getArtifactName(); - doReturn((Integer) null).when(iArtifactInfo0).getArtifactTimeout(); - doReturn((String) null).when(iArtifactInfo0).getArtifactType(); - doReturn((String) null).when(iArtifactInfo0).getArtifactURL(); - doReturn((String) null).when(iArtifactInfo0).getArtifactUUID(); - doReturn((String) null).when(iArtifactInfo0).getArtifactVersion(); - doReturn((IArtifactInfo) null).when(iArtifactInfo0).getGeneratedArtifact(); - doReturn((List) null).when(iArtifactInfo0).getRelatedArtifacts(); - IArtifactInfo iArtifactInfo1 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); - doReturn("Resource Instance Info:").when(iArtifactInfo1).getArtifactChecksum(); - doReturn("~1xF'ZQr|qhuc{").when(iArtifactInfo1).getArtifactDescription(); - doReturn("").when(iArtifactInfo1).getArtifactName(); - doReturn(integer1).when(iArtifactInfo1).getArtifactTimeout(); - doReturn("7<\"g").when(iArtifactInfo1).getArtifactType(); - doReturn("").when(iArtifactInfo1).getArtifactURL(); - doReturn("").when(iArtifactInfo1).getArtifactUUID(); - doReturn("7<\"g").when(iArtifactInfo1).getArtifactVersion(); - doReturn(iArtifactInfo0).when(iArtifactInfo1).getGeneratedArtifact(); - doReturn(linkedList1, linkedList1).when(iArtifactInfo1).getRelatedArtifacts(); - LinkedList linkedList2 = new LinkedList(); - Integer integer3 = new Integer(1); - LinkedList linkedList3 = new LinkedList(); - IArtifactInfo iArtifactInfo2 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); - doReturn("-X^ og(1=?-*/%4", "%jgpj", (String) null).when(iArtifactInfo2).getArtifactChecksum(); - doReturn("7<\"g", "", (String) null).when(iArtifactInfo2).getArtifactDescription(); - doReturn("7 'W{]65Y%Vh_ynFOr", "]+O?<_o+Mx?P@|^<:|/", (String) null).when(iArtifactInfo2).getArtifactName(); - doReturn(integer0, integer3, (Integer) null).when(iArtifactInfo2).getArtifactTimeout(); - doReturn("]+O?<_o+Mx?P@|^<:|/", "", (String) null).when(iArtifactInfo2).getArtifactType(); - doReturn("i]\r7Wr. ) null); - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData1).getDistributionID(); - doReturn(linkedList0, linkedList0).when(iNotificationData1).getResources(); - doReturn(linkedList1).when(iNotificationData1).getServiceArtifacts(); - doReturn("").when(iNotificationData1).getServiceDescription(); - doReturn("Tz)|, ,").when(iNotificationData1).getServiceInvariantUUID(); - doReturn("").when(iNotificationData1).getServiceName(); - doReturn("").when(iNotificationData1).getServiceUUID(); - doReturn("Tz)|, ,").when(iNotificationData1).getServiceVersion(); - String string1 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData1); - assertFalse(string1.equals((Object)string0)); - } + @Test(timeout = 4000) + public void test00() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + vfModuleMetaData0.setAttribute("vfModuleModelInvariantUUID", vfModuleMetaData0); + linkedList0.add((IVfModuleData) vfModuleMetaData0); + // Undeclared exception! + try { + ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); + fail("Expecting exception: ClassCastException"); + + } catch(ClassCastException e) { + // + // org.openecomp.mso.asdc.installer.VfModuleMetaData cannot be cast to java.lang.String + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e); + } + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + List list0 = (List) mock(List.class, new ViolatedAssumptionAnswer()); + doReturn(false).when(list0).isEmpty(); + doReturn((Iterator) null).when(list0).iterator(); + doReturn(0).when(list0).size(); + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + doReturn("rGQA").when(iNotificationData0).getDistributionID(); + doReturn(list0).when(iNotificationData0).getServiceArtifacts(); + doReturn("rGQA").when(iNotificationData0).getServiceDescription(); + doReturn("").when(iNotificationData0).getServiceInvariantUUID(); + doReturn("").when(iNotificationData0).getServiceName(); + doReturn("rGQA").when(iNotificationData0).getServiceUUID(); + doReturn("").when(iNotificationData0).getServiceVersion(); + // Undeclared exception! + try { + ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.util.ASDCNotificationLogging", e); + } + } - @Test(timeout = 4000) - public void test01() throws Throwable { - ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging(); - LinkedList linkedList0 = new LinkedList(); - IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - linkedList0.add(iVfModuleMetadata0); - LinkedList linkedList1 = new LinkedList(); - Object object0 = new Object(); - linkedList1.push(object0); - linkedList0.spliterator(); - linkedList0.removeAll(linkedList1); - linkedList0.clear(); - LinkedList linkedList2 = new LinkedList(); - IVfModuleMetadata iVfModuleMetadata1 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - doReturn((List) null, (List) null, linkedList2, (List) null).when(iVfModuleMetadata1).getArtifacts(); - doReturn("e.tf%6&", "e.tf%6&", "").when(iVfModuleMetadata1).getVfModuleModelDescription(); - doReturn("", "", "").when(iVfModuleMetadata1).getVfModuleModelInvariantUUID(); - doReturn("", "", "e.tf%6&").when(iVfModuleMetadata1).getVfModuleModelName(); - doReturn("VfModuleMetaData:", "e.tf%6&", "BaseArtifactInfoImpl [artifactName=").when(iVfModuleMetadata1).getVfModuleModelUUID(); - doReturn("e.tf%6&", "e.tf%6&", "e.tf%6&").when(iVfModuleMetadata1).getVfModuleModelVersion(); - doReturn(false, false).when(iVfModuleMetadata1).isBase(); - linkedList0.add(iVfModuleMetadata1); - ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - // Undeclared exception! - try { - ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.asdc.util.ASDCNotificationLogging", e); - } - } + @Test(timeout = 4000) + public void test02() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + LinkedList linkedList1 = new LinkedList(); + linkedList0.offerFirst((IResourceInstance) null); + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + doReturn("").when(iNotificationData0).getDistributionID(); + doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources(); + doReturn(linkedList1).when(iNotificationData0).getServiceArtifacts(); + doReturn("").when(iNotificationData0).getServiceDescription(); + doReturn("]U5JAkfdX0Cs").when(iNotificationData0).getServiceInvariantUUID(); + doReturn("jV13a").when(iNotificationData0).getServiceName(); + doReturn("").when(iNotificationData0).getServiceUUID(); + doReturn("jV13a").when(iNotificationData0).getServiceVersion(); + String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); + assertEquals("ASDC Notification:\nDistributionID:\nServiceName:jV13a\nServiceVersion:jV13a\nServiceUUID:\nServiceInvariantUUID:]U5JAkfdX0Cs\nServiceDescription:\nService Artifacts List:\nNULL\nResource Instances List:\n{\nNULL\n\n}\n\n", string0); + } - @Test(timeout = 4000) - public void test02() throws Throwable { - ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging(); - ASDCNotificationLogging aSDCNotificationLogging1 = new ASDCNotificationLogging(); - LinkedList linkedList0 = new LinkedList(); - IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - doReturn((List) null, (List) null).when(iVfModuleMetadata0).getArtifacts(); - doReturn("TTq", (String) null).when(iVfModuleMetadata0).getVfModuleModelDescription(); - doReturn("", (String) null).when(iVfModuleMetadata0).getVfModuleModelInvariantUUID(); - doReturn("w1e~\"rjNBjuq*0HB!3&", (String) null).when(iVfModuleMetadata0).getVfModuleModelName(); - doReturn("+l", (String) null).when(iVfModuleMetadata0).getVfModuleModelUUID(); - doReturn("]", (String) null).when(iVfModuleMetadata0).getVfModuleModelVersion(); - doReturn(true, false).when(iVfModuleMetadata0).isBase(); - linkedList0.add(iVfModuleMetadata0); - IVfModuleMetadata iVfModuleMetadata1 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - linkedList0.removeFirstOccurrence(aSDCNotificationLogging1); - ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - assertEquals("{\nVfModuleMetaData:\nVfModuleModelName:NULL\nVfModuleModelVersion:NULL\nVfModuleModelUUID:NULL\nVfModuleModelInvariantUUID:NULL\nVfModuleModelDescription:NULL\nArtifacts UUID List:NULL\nisBase:false\n\n\n}\n", string0); - } + @Test(timeout = 4000) + public void test03() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + LinkedList linkedList1 = new LinkedList(); + IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); + doReturn((List) null).when(iResourceInstance0).getArtifacts(); + doReturn((String) null).when(iResourceInstance0).getCategory(); + doReturn((String) null).when(iResourceInstance0).getResourceCustomizationUUID(); + doReturn((String) null).when(iResourceInstance0).getResourceInstanceName(); + doReturn((String) null).when(iResourceInstance0).getResourceInvariantUUID(); + doReturn((String) null).when(iResourceInstance0).getResourceName(); + doReturn((String) null).when(iResourceInstance0).getResourceType(); + doReturn((String) null).when(iResourceInstance0).getResourceUUID(); + doReturn((String) null).when(iResourceInstance0).getResourceVersion(); + doReturn((String) null).when(iResourceInstance0).getSubcategory(); + linkedList0.add(iResourceInstance0); + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + doReturn("").when(iNotificationData0).getDistributionID(); + doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources(); + doReturn(linkedList1).when(iNotificationData0).getServiceArtifacts(); + doReturn("").when(iNotificationData0).getServiceDescription(); + doReturn("").when(iNotificationData0).getServiceInvariantUUID(); + doReturn("36-s.n1@").when(iNotificationData0).getServiceName(); + doReturn("36-s.n1@").when(iNotificationData0).getServiceUUID(); + doReturn("").when(iNotificationData0).getServiceVersion(); + String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); + assertEquals("ASDC Notification:\nDistributionID:\nServiceName:36-s.n1@\nServiceVersion:\nServiceUUID:36-s.n1@\nServiceInvariantUUID:\nServiceDescription:\nService Artifacts List:\nNULL\nResource Instances List:\n{\nResource Instance Info:\nResourceInstanceName:NULL\nResourceCustomizationUUID:NULL\nResourceInvariantUUID:NULL\nResourceName:NULL\nResourceType:NULL\nResourceUUID:NULL\nResourceVersion:NULL\nCategory:NULL\nSubCategory:NULL\nResource Artifacts List:\nNULL\n\n\n}\n\n", string0); + } - @Test(timeout = 4000) - public void test03() throws Throwable { - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - List list0 = (List) mock(List.class, new ViolatedAssumptionAnswer()); - List list1 = (List) mock(List.class, new ViolatedAssumptionAnswer()); - doReturn(false).when(list1).isEmpty(); - doReturn((Iterator) null).when(list1).iterator(); - doReturn(0).when(list1).size(); - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData0).getDistributionID(); - doReturn(list1).when(iNotificationData0).getServiceArtifacts(); - doReturn("9").when(iNotificationData0).getServiceDescription(); - doReturn("9").when(iNotificationData0).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData0).getServiceName(); - doReturn("Type not recognized").when(iNotificationData0).getServiceUUID(); - doReturn("").when(iNotificationData0).getServiceVersion(); - // Undeclared exception! - try { - ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.asdc.util.ASDCNotificationLogging", e); - } - } + @Test(timeout = 4000) + public void test04() throws Throwable { + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(iNotificationData0).getDistributionID(); + doReturn((List) null).when(iNotificationData0).getResources(); + doReturn((List) null).when(iNotificationData0).getServiceArtifacts(); + doReturn((String) null).when(iNotificationData0).getServiceDescription(); + doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID(); + doReturn((String) null).when(iNotificationData0).getServiceName(); + doReturn((String) null).when(iNotificationData0).getServiceUUID(); + doReturn((String) null).when(iNotificationData0).getServiceVersion(); + String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); + assertEquals("ASDC Notification:\nDistributionID:NULL\nServiceName:NULL\nServiceVersion:NULL\nServiceUUID:NULL\nServiceInvariantUUID:NULL\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n", string0); + } - @Test(timeout = 4000) - public void test04() throws Throwable { - LinkedList linkedList0 = new LinkedList(); - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn("(ICU8j3G)Z4Z[GAE").when(iNotificationData0).getDistributionID(); - doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources(); - doReturn((List) null).when(iNotificationData0).getServiceArtifacts(); - doReturn(")&42fB6dZT&HRAb1a").when(iNotificationData0).getServiceDescription(); - doReturn("(ICU8j3G)Z4Z[GAE").when(iNotificationData0).getServiceInvariantUUID(); - doReturn(")&42fB6dZT&HRAb1a").when(iNotificationData0).getServiceName(); - doReturn(")&42fB6dZT&HRAb1a").when(iNotificationData0).getServiceUUID(); - doReturn("cHH N9Ha9YUPSpX00i").when(iNotificationData0).getServiceVersion(); - String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); - assertEquals("ASDC Notification:\nDistributionID:(ICU8j3G)Z4Z[GAE\nServiceName:)&42fB6dZT&HRAb1a\nServiceVersion:cHH N9Ha9YUPSpX00i\nServiceUUID:)&42fB6dZT&HRAb1a\nServiceInvariantUUID:(ICU8j3G)Z4Z[GAE\nServiceDescription:)&42fB6dZT&HRAb1a\nService Artifacts List:\nNULL\nResource Instances List:\n\n}\n\n", string0); - } + @Test(timeout = 4000) + public void test05() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + Map map0 = vfModuleMetaData0.getProperties(); + IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer()); + doReturn((List) null, (List) null).when(iVfModuleData0).getArtifacts(); + doReturn(map0, map0, (Map) null).when(iVfModuleData0).getProperties(); + doReturn("vfModuleModelUUID", "isBase:").when(iVfModuleData0).getVfModuleModelDescription(); + doReturn((String) null, "vfModuleModelName").when(iVfModuleData0).getVfModuleModelInvariantUUID(); + doReturn("", "").when(iVfModuleData0).getVfModuleModelName(); + doReturn("vfModuleModelUUID", "isBase:").when(iVfModuleData0).getVfModuleModelUUID(); + doReturn("|:\\KD91", "vfModuleModelName").when(iVfModuleData0).getVfModuleModelVersion(); + doReturn(false, false).when(iVfModuleData0).isBase(); + linkedList0.add(iVfModuleData0); + String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); + assertEquals("VfModuleMetaData List:\n{\nVfModuleMetaData:\nVfModuleModelName:\nVfModuleModelVersion:|:\\KD91\nVfModuleModelUUID:vfModuleModelUUID\nVfModuleModelInvariantUUID:NULL\nVfModuleModelDescription:vfModuleModelUUID\nArtifacts UUID List:NULLProperties List:\n}\n\nisBase:false\n\n\n}\n", string0); - @Test(timeout = 4000) - public void test05() throws Throwable { - LinkedList linkedList0 = new LinkedList(); - assertEquals(0, linkedList0.size()); - - LinkedList linkedList1 = new LinkedList(); - IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - doReturn(linkedList1, linkedList1).when(iVfModuleMetadata0).getArtifacts(); - doReturn(", artifactTimeout=").when(iVfModuleMetadata0).getVfModuleModelDescription(); - doReturn(", artifactChecksum=").when(iVfModuleMetadata0).getVfModuleModelInvariantUUID(); - doReturn(", artifactTimeout=").when(iVfModuleMetadata0).getVfModuleModelName(); - doReturn(", artifactTimeout=").when(iVfModuleMetadata0).getVfModuleModelUUID(); - doReturn(", artifactTimeout=").when(iVfModuleMetadata0).getVfModuleModelVersion(); - doReturn(false).when(iVfModuleMetadata0).isBase(); - IVfModuleMetadata iVfModuleMetadata1 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - linkedList0.add(iVfModuleMetadata1); - linkedList1.push("dzjz-zmMzFE"); - linkedList0.listIterator(); - linkedList0.toArray(); - linkedList0.add(iVfModuleMetadata0); - linkedList0.pollFirst(); - String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - assertEquals("{\nVfModuleMetaData:\nVfModuleModelName:, artifactTimeout=\nVfModuleModelVersion:, artifactTimeout=\nVfModuleModelUUID:, artifactTimeout=\nVfModuleModelInvariantUUID:, artifactChecksum=\nVfModuleModelDescription:, artifactTimeout=\nArtifacts UUID List:{\ndzjz-zmMzFE\n\n}\n\nisBase:false\n\n\n}\n", string0); - - ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging(); - LinkedList linkedList2 = new LinkedList(); - LinkedList linkedList3 = new LinkedList((Collection) linkedList2); - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData0).getDistributionID(); - doReturn((List) null).when(iNotificationData0).getResources(); - doReturn((List) null).when(iNotificationData0).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData0).getServiceDescription(); - doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData0).getServiceName(); - doReturn((String) null).when(iNotificationData0).getServiceUUID(); - doReturn((String) null).when(iNotificationData0).getServiceVersion(); - String string1 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); - assertEquals("ASDC Notification:\nDistributionID:NULL\nServiceName:NULL\nServiceVersion:NULL\nServiceUUID:NULL\nServiceInvariantUUID:NULL\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n", string1); - } + String string1 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); + assertEquals("VfModuleMetaData List:\n{\nVfModuleMetaData:\nVfModuleModelName:\nVfModuleModelVersion:vfModuleModelName\nVfModuleModelUUID:isBase:\nVfModuleModelInvariantUUID:vfModuleModelName\nVfModuleModelDescription:isBase:\nArtifacts UUID List:NULLNULL\nisBase:false\n\n\n}\n", string1); + } - @Test(timeout = 4000) - public void test06() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData0).getDistributionID(); - doReturn((List) null).when(iNotificationData0).getResources(); - doReturn((List) null).when(iNotificationData0).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData0).getServiceDescription(); - doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData0).getServiceName(); - doReturn((String) null).when(iNotificationData0).getServiceUUID(); - doReturn((String) null).when(iNotificationData0).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); - LinkedList linkedList0 = new LinkedList(); - List list0 = linkedList0.subList(0, 0); - ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - linkedList0.removeAll(list0); - ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - Comparator comparator0 = (Comparator) mock(Comparator.class, new ViolatedAssumptionAnswer()); - linkedList0.sort(comparator0); - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - linkedList0.offerLast(iVfModuleMetadata0); - ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging(); - INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData1).getDistributionID(); - doReturn((List) null).when(iNotificationData1).getResources(); - doReturn((List) null).when(iNotificationData1).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData1).getServiceDescription(); - doReturn((String) null).when(iNotificationData1).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData1).getServiceName(); - doReturn((String) null).when(iNotificationData1).getServiceUUID(); - doReturn((String) null).when(iNotificationData1).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData1); - // Undeclared exception! - try { - ASDCNotificationLogging.dumpVfModuleMetaDataList(list0); - fail("Expecting exception: ConcurrentModificationException"); - - } catch(ConcurrentModificationException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("java.util.SubList", e); - } - } + @Test(timeout = 4000) + public void test06() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + LinkedList linkedList1 = new LinkedList(); + IVfModuleData iVfModuleData0 = mock(IVfModuleData.class, new ViolatedAssumptionAnswer()); + doReturn((List) null, (List) null).when(iVfModuleData0).getArtifacts(); + doReturn((Map) null, (Map) null).when(iVfModuleData0).getProperties(); + doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelDescription(); + doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelInvariantUUID(); + doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelName(); + doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelUUID(); + doReturn((String) null, (String) null).when(iVfModuleData0).getVfModuleModelVersion(); + doReturn(false, false).when(iVfModuleData0).isBase(); + linkedList1.add(iVfModuleData0); + String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList1); + String string1 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList1); + assertTrue(string1.equals((Object)string0)); + assertEquals("VfModuleMetaData List:\n{\nVfModuleMetaData:\nVfModuleModelName:NULL\nVfModuleModelVersion:NULL\nVfModuleModelUUID:NULL\nVfModuleModelInvariantUUID:NULL\nVfModuleModelDescription:NULL\nArtifacts UUID List:NULLNULL\nisBase:false\n\n\n}\n", string1); + } - @Test(timeout = 4000) - public void test07() throws Throwable { - ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging(); - ASDCNotificationLogging aSDCNotificationLogging1 = new ASDCNotificationLogging(); - LinkedList linkedList0 = new LinkedList(); - LinkedList linkedList1 = new LinkedList(); - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn("ResourceInstanceName:").when(iNotificationData0).getDistributionID(); - doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources(); - doReturn(linkedList1).when(iNotificationData0).getServiceArtifacts(); - doReturn("ResourceInstanceName:").when(iNotificationData0).getServiceDescription(); - doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID(); - doReturn("ResourceInstanceName:").when(iNotificationData0).getServiceName(); - doReturn("pr26M0Ud8~n6#j/;g").when(iNotificationData0).getServiceUUID(); - doReturn((String) null).when(iNotificationData0).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); - ASDCNotificationLogging aSDCNotificationLogging2 = new ASDCNotificationLogging(); - INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn("ResourceInstanceName:").when(iNotificationData1).getDistributionID(); - doReturn(linkedList0, linkedList0).when(iNotificationData1).getResources(); - doReturn(linkedList1).when(iNotificationData1).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData1).getServiceDescription(); - doReturn("").when(iNotificationData1).getServiceInvariantUUID(); - doReturn("pr26M0Ud8~n6#j/;g").when(iNotificationData1).getServiceName(); - doReturn("").when(iNotificationData1).getServiceUUID(); - doReturn("Resource Artifacts List:").when(iNotificationData1).getServiceVersion(); - String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData1); - assertEquals("ASDC Notification:\nDistributionID:ResourceInstanceName:\nServiceName:pr26M0Ud8~n6#j/;g\nServiceVersion:Resource Artifacts List:\nServiceUUID:\nServiceInvariantUUID:\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\n\n}\n\n", string0); - - ASDCNotificationLogging aSDCNotificationLogging3 = new ASDCNotificationLogging(); - LinkedList linkedList2 = new LinkedList(); - ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList2); - LinkedList linkedList3 = new LinkedList(); - IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); - doReturn((String) null, (String) null, (String) null).when(iArtifactInfo0).getArtifactChecksum(); - doReturn((String) null, (String) null, (String) null).when(iArtifactInfo0).getArtifactDescription(); - doReturn((String) null, (String) null, (String) null).when(iArtifactInfo0).getArtifactName(); - doReturn((Integer) null, (Integer) null, (Integer) null).when(iArtifactInfo0).getArtifactTimeout(); - doReturn((String) null, (String) null, (String) null).when(iArtifactInfo0).getArtifactType(); - doReturn((String) null, (String) null, (String) null).when(iArtifactInfo0).getArtifactURL(); - doReturn((String) null, (String) null, (String) null).when(iArtifactInfo0).getArtifactUUID(); - doReturn((String) null, (String) null, (String) null).when(iArtifactInfo0).getArtifactVersion(); - doReturn((IArtifactInfo) null, (IArtifactInfo) null, (IArtifactInfo) null).when(iArtifactInfo0).getGeneratedArtifact(); - doReturn((List) null, (List) null, (List) null).when(iArtifactInfo0).getRelatedArtifacts(); - linkedList1.add(iArtifactInfo0); - INotificationData iNotificationData2 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn("tlh7ku").when(iNotificationData2).getDistributionID(); - doReturn(linkedList3, linkedList0).when(iNotificationData2).getResources(); - doReturn(linkedList1).when(iNotificationData2).getServiceArtifacts(); - doReturn("").when(iNotificationData2).getServiceDescription(); - doReturn("").when(iNotificationData2).getServiceInvariantUUID(); - doReturn("tlh7ku").when(iNotificationData2).getServiceName(); - doReturn("_B4BTx//Er%IWM}et0").when(iNotificationData2).getServiceUUID(); - doReturn("").when(iNotificationData2).getServiceVersion(); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - doReturn(linkedList1).when(iResourceInstance0).getArtifacts(); - doReturn("").when(iResourceInstance0).getResourceInstanceName(); - doReturn("Resource Artifacts List:").when(iResourceInstance0).getResourceInvariantUUID(); - doReturn("Hq^8Xl<>T").when(iResourceInstance0).getResourceName(); - doReturn((String) null).when(iResourceInstance0).getResourceType(); - doReturn("ASDC Notification:\nDistributionID:ResourceInstanceName:\nServiceName:ResourceInstanceName:\nServiceVersion:NULL\nServiceUUID:pr26M0Ud8~n6#j/;g\nServiceInvariantUUID:NULL\nServiceDescription:ResourceInstanceName:\nService Artifacts List:\nNULL\nResource Instances List:\n\n}\n\n").when(iResourceInstance0).getResourceUUID(); - doReturn("zIQ?4(U$K ").when(iResourceInstance0).getResourceVersion(); - linkedList0.add(iResourceInstance0); - IResourceInstance iResourceInstance1 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - doReturn(linkedList1).when(iResourceInstance1).getArtifacts(); - doReturn("ASDC Notification:\nDistributionID:ResourceInstanceName:\nServiceName:pr26M0Ud8~n6#j/;g\nServiceVersion:Resource Artifacts List:\nServiceUUID:\nServiceInvariantUUID:\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\n\n}\n\n").when(iResourceInstance1).getResourceInstanceName(); - doReturn("5yNU;|<:T-ixwLB").when(iResourceInstance1).getResourceInvariantUUID(); - doReturn("").when(iResourceInstance1).getResourceName(); - doReturn("xguM[yK-\"").when(iResourceInstance1).getResourceType(); - doReturn("").when(iResourceInstance1).getResourceUUID(); - doReturn("ASDC Notification:\nDistributionID:ResourceInstanceName:\nServiceName:pr26M0Ud8~n6#j/;g\nServiceVersion:Resource Artifacts List:\nServiceUUID:\nServiceInvariantUUID:\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\n\n}\n\n").when(iResourceInstance1).getResourceVersion(); - linkedList1.removeFirstOccurrence((Object) null); - linkedList0.add(iResourceInstance1); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData2); - IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - String string1 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList2); - assertEquals("\n}\n", string1); - } + @Test(timeout = 4000) + public void test07() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + linkedList0.add((IVfModuleData) vfModuleMetaData0); + UnaryOperator unaryOperator0 = (UnaryOperator) mock(UnaryOperator.class, new ViolatedAssumptionAnswer()); + doReturn((Object) null).when(unaryOperator0).apply(any()); + linkedList0.replaceAll(unaryOperator0); + String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); + assertEquals("VfModuleMetaData List:\n{\nNULL\n\n}\n", string0); + } - @Test(timeout = 4000) - public void test08() throws Throwable { - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData0).getDistributionID(); - doReturn((List) null).when(iNotificationData0).getResources(); - doReturn((List) null).when(iNotificationData0).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData0).getServiceDescription(); - doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData0).getServiceName(); - doReturn((String) null).when(iNotificationData0).getServiceUUID(); - doReturn((String) null).when(iNotificationData0).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); - INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData1).getDistributionID(); - doReturn((List) null).when(iNotificationData1).getResources(); - doReturn((List) null).when(iNotificationData1).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData1).getServiceDescription(); - doReturn((String) null).when(iNotificationData1).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData1).getServiceName(); - doReturn((String) null).when(iNotificationData1).getServiceUUID(); - doReturn((String) null).when(iNotificationData1).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData1); - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging(); - INotificationData iNotificationData2 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData2).getDistributionID(); - doReturn((List) null).when(iNotificationData2).getResources(); - doReturn((List) null).when(iNotificationData2).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData2).getServiceDescription(); - doReturn((String) null).when(iNotificationData2).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData2).getServiceName(); - doReturn((String) null).when(iNotificationData2).getServiceUUID(); - doReturn((String) null).when(iNotificationData2).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData2); - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - INotificationData iNotificationData3 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData3).getDistributionID(); - doReturn((List) null).when(iNotificationData3).getResources(); - doReturn((List) null).when(iNotificationData3).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData3).getServiceDescription(); - doReturn((String) null).when(iNotificationData3).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData3).getServiceName(); - doReturn((String) null).when(iNotificationData3).getServiceUUID(); - doReturn((String) null).when(iNotificationData3).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData3); - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - INotificationData iNotificationData4 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData4).getDistributionID(); - doReturn((List) null).when(iNotificationData4).getResources(); - doReturn((List) null).when(iNotificationData4).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData4).getServiceDescription(); - doReturn((String) null).when(iNotificationData4).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData4).getServiceName(); - doReturn((String) null).when(iNotificationData4).getServiceUUID(); - doReturn((String) null).when(iNotificationData4).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData4); - INotificationData iNotificationData5 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData5).getDistributionID(); - doReturn((List) null).when(iNotificationData5).getResources(); - doReturn((List) null).when(iNotificationData5).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData5).getServiceDescription(); - doReturn((String) null).when(iNotificationData5).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData5).getServiceName(); - doReturn((String) null).when(iNotificationData5).getServiceUUID(); - doReturn((String) null).when(iNotificationData5).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData5); - INotificationData iNotificationData6 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData6).getDistributionID(); - doReturn((List) null).when(iNotificationData6).getResources(); - doReturn((List) null).when(iNotificationData6).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData6).getServiceDescription(); - doReturn((String) null).when(iNotificationData6).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData6).getServiceName(); - doReturn((String) null).when(iNotificationData6).getServiceUUID(); - doReturn((String) null).when(iNotificationData6).getServiceVersion(); - String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData6); - assertEquals("ASDC Notification:\nDistributionID:NULL\nServiceName:NULL\nServiceVersion:NULL\nServiceUUID:NULL\nServiceInvariantUUID:NULL\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n", string0); - - ASDCNotificationLogging.dumpASDCNotification((INotificationData) null); - String string1 = ASDCNotificationLogging.dumpASDCNotification((INotificationData) null); - assertEquals("NULL", string1); - } + @Test(timeout = 4000) + public void test08() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + VfModuleMetaData vfModuleMetaData0 = new VfModuleMetaData(); + linkedList0.add((IVfModuleData) vfModuleMetaData0); + // Undeclared exception! + try { + ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); + fail("Expecting exception: NullPointerException"); - @Test(timeout = 4000) - public void test09() throws Throwable { - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - LinkedList linkedList0 = new LinkedList(); - IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iArtifactInfo0).getArtifactChecksum(); - doReturn((String) null).when(iArtifactInfo0).getArtifactDescription(); - doReturn((String) null).when(iArtifactInfo0).getArtifactName(); - doReturn((Integer) null).when(iArtifactInfo0).getArtifactTimeout(); - doReturn((String) null).when(iArtifactInfo0).getArtifactType(); - doReturn((String) null).when(iArtifactInfo0).getArtifactURL(); - doReturn((String) null).when(iArtifactInfo0).getArtifactUUID(); - doReturn((String) null).when(iArtifactInfo0).getArtifactVersion(); - doReturn((IArtifactInfo) null).when(iArtifactInfo0).getGeneratedArtifact(); - doReturn((List) null).when(iArtifactInfo0).getRelatedArtifacts(); - linkedList0.add(iArtifactInfo0); - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData0).getDistributionID(); - doReturn((List) null).when(iNotificationData0).getResources(); - doReturn(linkedList0).when(iNotificationData0).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData0).getServiceDescription(); - doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData0).getServiceName(); - doReturn((String) null).when(iNotificationData0).getServiceUUID(); - doReturn("(").when(iNotificationData0).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - assertNull(string0); - } + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.asdc.installer.VfModuleMetaData", e); + } + } - @Test(timeout = 4000) - public void test10() throws Throwable { - LinkedList linkedList0 = new LinkedList(); - LinkedList linkedList1 = new LinkedList(); - IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - linkedList1.add(iVfModuleMetadata0); - LinkedList linkedList2 = new LinkedList(); - LinkedList linkedList3 = new LinkedList(); - linkedList1.removeFirst(); - linkedList0.addAll((Collection) linkedList1); - LinkedList linkedList4 = new LinkedList(); - LinkedList linkedList5 = new LinkedList(); - ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - LinkedList linkedList6 = new LinkedList(); - LinkedList linkedList7 = new LinkedList(); - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn("]=ztki(=]").when(iNotificationData0).getDistributionID(); - doReturn(linkedList6, linkedList6).when(iNotificationData0).getResources(); - doReturn(linkedList7).when(iNotificationData0).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData0).getServiceDescription(); - doReturn("").when(iNotificationData0).getServiceInvariantUUID(); - doReturn("").when(iNotificationData0).getServiceName(); - doReturn("VG).").when(iNotificationData0).getServiceUUID(); - doReturn("").when(iNotificationData0).getServiceVersion(); - linkedList0.spliterator(); - linkedList0.containsAll(linkedList1); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); - LinkedList linkedList8 = new LinkedList(); - INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn("C'K").when(iNotificationData1).getDistributionID(); - doReturn(linkedList6, linkedList8).when(iNotificationData1).getResources(); - doReturn(linkedList7).when(iNotificationData1).getServiceArtifacts(); - doReturn("NotificationDataImpl [distributionID=").when(iNotificationData1).getServiceDescription(); - doReturn((String) null).when(iNotificationData1).getServiceInvariantUUID(); - doReturn("B.").when(iNotificationData1).getServiceName(); - doReturn("").when(iNotificationData1).getServiceUUID(); - doReturn("").when(iNotificationData1).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData1); - ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging(); - } + @Test(timeout = 4000) + public void test09() throws Throwable { + String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); + assertNull(string0); + } - @Test(timeout = 4000) - public void test11() throws Throwable { - LinkedList linkedList0 = new LinkedList(); - IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - linkedList0.add(iVfModuleMetadata0); - linkedList0.add((IVfModuleMetadata) null); - LinkedList linkedList1 = new LinkedList(); - IVfModuleMetadata iVfModuleMetadata1 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - doReturn(linkedList1, linkedList1, linkedList1, linkedList1).when(iVfModuleMetadata1).getArtifacts(); - doReturn("8u1XbrrMy{J2", "").when(iVfModuleMetadata1).getVfModuleModelDescription(); - doReturn("YR/UZ7qrmvO", "8u1XbrrMy{J2").when(iVfModuleMetadata1).getVfModuleModelInvariantUUID(); - doReturn("8u1XbrrMy{J2", ".l=(8f`8f}.9>yn").when(iVfModuleMetadata1).getVfModuleModelName(); - doReturn("", "YR/UZ7qrmvO").when(iVfModuleMetadata1).getVfModuleModelUUID(); - doReturn("[66/OPYLD.B%", ".l=(8f`8f}.9>yn").when(iVfModuleMetadata1).getVfModuleModelVersion(); - doReturn(false, true).when(iVfModuleMetadata1).isBase(); - LinkedList linkedList2 = new LinkedList(); - linkedList2.add((IVfModuleMetadata) null); - linkedList2.offer((IVfModuleMetadata) null); - Predicate predicate0 = (Predicate) mock(Predicate.class, new ViolatedAssumptionAnswer()); - doReturn(true, false).when(predicate0).test(any()); - linkedList2.removeIf(predicate0); - linkedList0.retainAll(linkedList2); - LinkedList linkedList3 = new LinkedList(); - IVfModuleMetadata iVfModuleMetadata2 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - doReturn(linkedList3, linkedList3, linkedList3, linkedList1).when(iVfModuleMetadata2).getArtifacts(); - doReturn("YR/UZ7qrmvO", "8u1XbrrMy{J2").when(iVfModuleMetadata2).getVfModuleModelDescription(); - doReturn("", "8u1XbrrMy{J2").when(iVfModuleMetadata2).getVfModuleModelInvariantUUID(); - doReturn("[66/OPYLD.B%", "").when(iVfModuleMetadata2).getVfModuleModelName(); - doReturn("", "[66/OPYLD.B%").when(iVfModuleMetadata2).getVfModuleModelUUID(); - doReturn((String) null, "").when(iVfModuleMetadata2).getVfModuleModelVersion(); - doReturn(true, false).when(iVfModuleMetadata2).isBase(); - linkedList0.add(iVfModuleMetadata2); - linkedList0.push(iVfModuleMetadata1); - ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging(); - ASDCNotificationLogging aSDCNotificationLogging1 = new ASDCNotificationLogging(); - ASDCNotificationLogging aSDCNotificationLogging2 = new ASDCNotificationLogging(); - ASDCNotificationLogging aSDCNotificationLogging3 = new ASDCNotificationLogging(); - String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - assertEquals("{\nVfModuleMetaData:\nVfModuleModelName:.l=(8f`8f}.9>yn\nVfModuleModelVersion:.l=(8f`8f}.9>yn\nVfModuleModelUUID:YR/UZ7qrmvO\nVfModuleModelInvariantUUID:8u1XbrrMy{J2\nVfModuleModelDescription:\nArtifacts UUID List:\n}\n\nisBase:true\n\n,\nNULL\n,\nVfModuleMetaData:\nVfModuleModelName:\nVfModuleModelVersion:\nVfModuleModelUUID:[66/OPYLD.B%\nVfModuleModelInvariantUUID:8u1XbrrMy{J2\nVfModuleModelDescription:8u1XbrrMy{J2\nArtifacts UUID List:\n}\n\nisBase:false\n\n\n}\n", string0); - - LinkedList linkedList4 = new LinkedList(); - LinkedList linkedList5 = new LinkedList((Collection) linkedList4); - LinkedList linkedList6 = new LinkedList(); - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn("95y$c-.BW5V()41WR").when(iNotificationData0).getDistributionID(); - doReturn(linkedList5, linkedList4).when(iNotificationData0).getResources(); - doReturn(linkedList6).when(iNotificationData0).getServiceArtifacts(); - doReturn(", artifactTimeout=").when(iNotificationData0).getServiceDescription(); - doReturn("[66/OPYLD.B%").when(iNotificationData0).getServiceInvariantUUID(); - doReturn("[66/OPYLD.B%").when(iNotificationData0).getServiceName(); - doReturn(", artifactChecksum=").when(iNotificationData0).getServiceUUID(); - doReturn("W1vX^KnIx[x").when(iNotificationData0).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); - ASDCNotificationLogging aSDCNotificationLogging4 = new ASDCNotificationLogging(); - ASDCNotificationLogging aSDCNotificationLogging5 = new ASDCNotificationLogging(); - LinkedList linkedList7 = new LinkedList(); - INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn("").when(iNotificationData1).getDistributionID(); - doReturn(linkedList4, linkedList7).when(iNotificationData1).getResources(); - doReturn(linkedList6).when(iNotificationData1).getServiceArtifacts(); - doReturn("3l\"ZrTP`IQ-4x]").when(iNotificationData1).getServiceDescription(); - doReturn("").when(iNotificationData1).getServiceInvariantUUID(); - doReturn("").when(iNotificationData1).getServiceName(); - doReturn("").when(iNotificationData1).getServiceUUID(); - doReturn("").when(iNotificationData1).getServiceVersion(); - String string1 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData1); - assertEquals("ASDC Notification:\nDistributionID:\nServiceName:\nServiceVersion:\nServiceUUID:\nServiceInvariantUUID:\nServiceDescription:3l\"ZrTP`IQ-4x]\nService Artifacts List:\nNULL\nResource Instances List:\n\n}\n\n", string1); - } + @Test(timeout = 4000) + public void test10() throws Throwable { + String string0 = ASDCNotificationLogging.dumpASDCNotification((INotificationData) null); + assertEquals("NULL", string0); + } - @Test(timeout = 4000) - public void test12() throws Throwable { - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData0).getDistributionID(); - doReturn((List) null).when(iNotificationData0).getResources(); - doReturn((List) null).when(iNotificationData0).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData0).getServiceDescription(); - doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData0).getServiceName(); - doReturn((String) null).when(iNotificationData0).getServiceUUID(); - doReturn((String) null).when(iNotificationData0).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); - INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData1).getDistributionID(); - doReturn((List) null).when(iNotificationData1).getResources(); - doReturn((List) null).when(iNotificationData1).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData1).getServiceDescription(); - doReturn((String) null).when(iNotificationData1).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData1).getServiceName(); - doReturn((String) null).when(iNotificationData1).getServiceUUID(); - doReturn((String) null).when(iNotificationData1).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData1); - ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging(); - INotificationData iNotificationData2 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData2).getDistributionID(); - doReturn((List) null).when(iNotificationData2).getResources(); - doReturn((List) null).when(iNotificationData2).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData2).getServiceDescription(); - doReturn((String) null).when(iNotificationData2).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData2).getServiceName(); - doReturn((String) null).when(iNotificationData2).getServiceUUID(); - doReturn((String) null).when(iNotificationData2).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData2); - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - ASDCNotificationLogging aSDCNotificationLogging1 = new ASDCNotificationLogging(); - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - INotificationData iNotificationData3 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData3).getDistributionID(); - doReturn((List) null).when(iNotificationData3).getResources(); - doReturn((List) null).when(iNotificationData3).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData3).getServiceDescription(); - doReturn((String) null).when(iNotificationData3).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData3).getServiceName(); - doReturn((String) null).when(iNotificationData3).getServiceUUID(); - doReturn((String) null).when(iNotificationData3).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData3); - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - ASDCNotificationLogging aSDCNotificationLogging2 = new ASDCNotificationLogging(); - LinkedList linkedList0 = new LinkedList(); - IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - doReturn((List) null, (List) null, (List) null).when(iVfModuleMetadata0).getArtifacts(); - doReturn((String) null, (String) null, (String) null).when(iVfModuleMetadata0).getVfModuleModelDescription(); - doReturn((String) null, (String) null, (String) null).when(iVfModuleMetadata0).getVfModuleModelInvariantUUID(); - doReturn((String) null, (String) null, (String) null).when(iVfModuleMetadata0).getVfModuleModelName(); - doReturn((String) null, (String) null, (String) null).when(iVfModuleMetadata0).getVfModuleModelUUID(); - doReturn((String) null, (String) null, (String) null).when(iVfModuleMetadata0).getVfModuleModelVersion(); - doReturn(false, false, false).when(iVfModuleMetadata0).isBase(); - linkedList0.add(iVfModuleMetadata0); - linkedList0.removeLastOccurrence("ASDC Notification:\nDistributionID:NULL\nServiceName:NULL\nServiceVersion:NULL\nServiceUUID:NULL\nServiceInvariantUUID:NULL\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\n\n}\n\n"); - linkedList0.remove((Object) null); - ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - ASDCNotificationLogging aSDCNotificationLogging3 = new ASDCNotificationLogging(); - String string0 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - String string1 = ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - assertEquals("{\nVfModuleMetaData:\nVfModuleModelName:NULL\nVfModuleModelVersion:NULL\nVfModuleModelUUID:NULL\nVfModuleModelInvariantUUID:NULL\nVfModuleModelDescription:NULL\nArtifacts UUID List:NULL\nisBase:false\n\n\n}\n", string1); - assertTrue(string1.equals((Object)string0)); - - ASDCNotificationLogging aSDCNotificationLogging4 = new ASDCNotificationLogging(); - ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); - INotificationData iNotificationData4 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(iNotificationData4).getDistributionID(); - doReturn((List) null).when(iNotificationData4).getResources(); - doReturn((List) null).when(iNotificationData4).getServiceArtifacts(); - doReturn((String) null).when(iNotificationData4).getServiceDescription(); - doReturn((String) null).when(iNotificationData4).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData4).getServiceName(); - doReturn((String) null).when(iNotificationData4).getServiceUUID(); - doReturn((String) null).when(iNotificationData4).getServiceVersion(); - String string2 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData4); - assertEquals("ASDC Notification:\nDistributionID:NULL\nServiceName:NULL\nServiceVersion:NULL\nServiceUUID:NULL\nServiceInvariantUUID:NULL\nServiceDescription:NULL\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n", string2); - } + @Test(timeout = 4000) + public void test11() throws Throwable { + LinkedList linkedList0 = new LinkedList(); + INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + doReturn("io7<{~.v|%").when(iNotificationData0).getDistributionID(); + doReturn((List) null).when(iNotificationData0).getResources(); + doReturn(linkedList0).when(iNotificationData0).getServiceArtifacts(); + doReturn("io7<{~.v|%").when(iNotificationData0).getServiceDescription(); + doReturn("io7<{~.v|%").when(iNotificationData0).getServiceInvariantUUID(); + doReturn("io7<{~.v|%").when(iNotificationData0).getServiceName(); + doReturn((String) null).when(iNotificationData0).getServiceUUID(); + doReturn("io7<{~.v|%").when(iNotificationData0).getServiceVersion(); + String string0 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); + assertEquals("ASDC Notification:\nDistributionID:io7<{~.v|%\nServiceName:io7<{~.v|%\nServiceVersion:io7<{~.v|%\nServiceUUID:NULL\nServiceInvariantUUID:io7<{~.v|%\nServiceDescription:io7<{~.v|%\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n", string0); - @Test(timeout = 4000) - public void test13() throws Throwable { - ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging(); - LinkedList linkedList0 = new LinkedList(); - IResourceInstance iResourceInstance0 = mock(IResourceInstance.class, new ViolatedAssumptionAnswer()); - doReturn((List) null).when(iResourceInstance0).getArtifacts(); - doReturn((String) null).when(iResourceInstance0).getResourceInstanceName(); - doReturn((String) null).when(iResourceInstance0).getResourceInvariantUUID(); - doReturn((String) null).when(iResourceInstance0).getResourceName(); - doReturn((String) null).when(iResourceInstance0).getResourceType(); - doReturn((String) null).when(iResourceInstance0).getResourceUUID(); - doReturn((String) null).when(iResourceInstance0).getResourceVersion(); - linkedList0.add(iResourceInstance0); - LinkedList linkedList1 = new LinkedList(); - INotificationData iNotificationData0 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); - doReturn("(n,0").when(iNotificationData0).getDistributionID(); - doReturn(linkedList0, linkedList0).when(iNotificationData0).getResources(); - doReturn(linkedList1).when(iNotificationData0).getServiceArtifacts(); - doReturn("(n,0").when(iNotificationData0).getServiceDescription(); - doReturn((String) null).when(iNotificationData0).getServiceInvariantUUID(); - doReturn((String) null).when(iNotificationData0).getServiceName(); - doReturn("").when(iNotificationData0).getServiceUUID(); - doReturn("t1N;ZSJsATt:&Ug").when(iNotificationData0).getServiceVersion(); - ASDCNotificationLogging.dumpASDCNotification(iNotificationData0); - LinkedList linkedList2 = new LinkedList(); - linkedList2.clear(); - // Undeclared exception! - try { - linkedList2.remove(); - fail("Expecting exception: NoSuchElementException"); - - } catch(NoSuchElementException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("java.util.LinkedList", e); - } - } + ASDCNotificationLogging.dumpVfModuleMetaDataList((List) null); + IArtifactInfo iArtifactInfo0 = mock(IArtifactInfo.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(iArtifactInfo0).getArtifactChecksum(); + doReturn((String) null).when(iArtifactInfo0).getArtifactDescription(); + doReturn((String) null).when(iArtifactInfo0).getArtifactName(); + doReturn((Integer) null).when(iArtifactInfo0).getArtifactTimeout(); + doReturn((String) null).when(iArtifactInfo0).getArtifactType(); + doReturn((String) null).when(iArtifactInfo0).getArtifactURL(); + doReturn((String) null).when(iArtifactInfo0).getArtifactUUID(); + doReturn((String) null).when(iArtifactInfo0).getArtifactVersion(); + doReturn((IArtifactInfo) null).when(iArtifactInfo0).getGeneratedArtifact(); + doReturn((List) null).when(iArtifactInfo0).getRelatedArtifacts(); + linkedList0.push(iArtifactInfo0); + INotificationData iNotificationData1 = mock(INotificationData.class, new ViolatedAssumptionAnswer()); + doReturn("t2J^4~*i|btm ib&").when(iNotificationData1).getDistributionID(); + doReturn((List) null).when(iNotificationData1).getResources(); + doReturn(linkedList0).when(iNotificationData1).getServiceArtifacts(); + doReturn("N~a W7").when(iNotificationData1).getServiceDescription(); + doReturn("N~a W7").when(iNotificationData1).getServiceInvariantUUID(); + doReturn("/&*/=").when(iNotificationData1).getServiceName(); + doReturn((String) null).when(iNotificationData1).getServiceUUID(); + doReturn("ASDC Notification:\nDistributionID:io7<{~.v|%\nServiceName:io7<{~.v|%\nServiceVersion:io7<{~.v|%\nServiceUUID:NULL\nServiceInvariantUUID:io7<{~.v|%\nServiceDescription:io7<{~.v|%\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n").when(iNotificationData1).getServiceVersion(); + String string1 = ASDCNotificationLogging.dumpASDCNotification(iNotificationData1); + assertEquals("ASDC Notification:\nDistributionID:t2J^4~*i|btm ib&\nServiceName:/&*/=\nServiceVersion:ASDC Notification:\nDistributionID:io7<{~.v|%\nServiceName:io7<{~.v|%\nServiceVersion:io7<{~.v|%\nServiceUUID:NULL\nServiceInvariantUUID:io7<{~.v|%\nServiceDescription:io7<{~.v|%\nService Artifacts List:\nNULL\nResource Instances List:\nNULL\n\nServiceUUID:NULL\nServiceInvariantUUID:N~a W7\nServiceDescription:N~a W7\nService Artifacts List:\n{\nService Artifacts Info:\nArtifactName:NULL\nArtifactVersion:NULL\nArtifactType:NULL\nArtifactDescription:NULL\nArtifactTimeout:NULL\nArtifactURL:NULL\nArtifactUUID:NULL\nArtifactChecksum:NULL\nGeneratedArtifact:{NULL\n}\nRelatedArtifacts:NULL\n\n\n}\n\nResource Instances List:\nNULL\n", string1); + } - @Test(timeout = 4000) - public void test14() throws Throwable { - LinkedList linkedList0 = new LinkedList(); - ASDCNotificationLogging.dumpVfModuleMetaDataList(linkedList0); - IVfModuleMetadata iVfModuleMetadata0 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - linkedList0.add(iVfModuleMetadata0); - linkedList0.remove((Object) "\n}\n"); - IVfModuleMetadata iVfModuleMetadata1 = mock(IVfModuleMetadata.class, new ViolatedAssumptionAnswer()); - linkedList0.offerLast(iVfModuleMetadata1); - // Undeclared exception! - try { - linkedList0.subList((-1), (-1)); - fail("Expecting exception: IndexOutOfBoundsException"); - - } catch(IndexOutOfBoundsException e) { - // - // fromIndex = -1 - // - verifyException("java.util.SubList", e); - } - } + @Test(timeout = 4000) + public void test12() throws Throwable { + ASDCNotificationLogging aSDCNotificationLogging0 = new ASDCNotificationLogging(); + Object object0 = PrivateAccess.callMethod((Class) ASDCNotificationLogging.class, aSDCNotificationLogging0, "dumpASDCResourcesList", (Object) null, (Class) INotificationData.class); + assertNull(object0); + } } diff --git a/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/ASDCNotificationLoggingESTestscaffolding.java b/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/ASDCNotificationLoggingESTestscaffolding.java index 1344bbe45d..62663e7397 100644 --- a/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/ASDCNotificationLoggingESTestscaffolding.java +++ b/asdc-controller/src/test/java/org/openecomp/mso/asdc/util/ASDCNotificationLoggingESTestscaffolding.java @@ -1,7 +1,7 @@ /** - * Scaffolding file used to store all the setups needed to run + * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite - * Fri Nov 25 13:31:27 GMT 2016 + * Mon Mar 13 15:55:23 GMT 2017 */ package org.openecomp.mso.asdc.util; @@ -12,69 +12,70 @@ import org.junit.Before; import org.junit.After; import org.junit.AfterClass; import org.evosuite.runtime.sandbox.Sandbox; +import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; @EvoSuiteClassExclude public class ASDCNotificationLoggingESTestscaffolding { - @org.junit.Rule + @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + private static final java.util.Properties defaultProperties = (java.util.Properties) System.getProperties().clone(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.asdc.util.ASDCNotificationLogging"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.asdc.util.ASDCNotificationLogging"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = SandboxMode.RECOMMENDED; + Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + System.setProperties((java.util.Properties) defaultProperties.clone()); + } - @Before - public void initTestCase(){ + @Before + public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } - @After - public void doneWithTestCase(){ + @After + public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ASDCNotificationLoggingESTestscaffolding.class.getClassLoader() , "org.openecomp.sdc.api.notification.INotificationData", + "org.openecomp.mso.asdc.installer.VfModuleMetaData", + "org.openecomp.mso.asdc.installer.IVfModuleData", "org.openecomp.sdc.api.notification.IResourceInstance", - "org.openecomp.sdc.api.notification.IVfModuleMetadata", - "org.openecomp.mso.asdc.util.ASDCNotificationLogging", - "org.openecomp.sdc.api.notification.IArtifactInfo" + "org.openecomp.sdc.api.notification.IArtifactInfo", + "org.openecomp.mso.asdc.util.ASDCNotificationLogging" ); - } + } private static void resetClasses() { } diff --git a/bpmn/MSOCockpit/pom.xml b/bpmn/MSOCockpit/pom.xml index 939c185950..a985dc91b1 100644 --- a/bpmn/MSOCockpit/pom.xml +++ b/bpmn/MSOCockpit/pom.xml @@ -36,16 +36,16 @@ - + - + org.camunda.bpm.webapp camunda-webapp-jboss-standalone ${camunda.version} war - + org.openecomp.mso common @@ -61,6 +61,12 @@ MSOCoreBPMN ${project.version} + + org.evosuite + evosuite-standalone-runtime + ${evosuiteVersion} + test + - + diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml new file mode 100644 index 0000000000..ee84d82f8f --- /dev/null +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -0,0 +1,392 @@ + + + 4.0.0 + + org.openecomp.mso + bpmn + 1.1.0-SNAPSHOT + + MSOCommonBPMN + MSOCommonBPMN + war + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + test-compile + compile + + testCompile + + + false + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + + default-jar + package + + jar + + + + org/openecomp/mso/bpmn/common/MSOCommonApplication.class + META-INF/ + + + + + + test-jar + + + true + false + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 + + + + attach-artifact + + package + + + + ${project.build.directory}/${project.artifactId}-${project.version}.jar + jar + + + + + + + + + org.apache.maven.plugins + maven-war-plugin + 2.3 + + false + + + + org.apache.cxf + cxf-codegen-plugin + 2.5.2 + + + org.apache.maven.plugins + maven-eclipse-plugin + 2.8 + + + org.eclipse.jdt.groovy.core.groovyNature + + + **/*.groovy + + + + + maven-antrun-plugin + + + compile + compile + + + + + + + + + + + + + + run + + + + test-compile + test-compile + + + + + + + + + + + + + + run + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.apache.maven.plugins + + + maven-antrun-plugin + + + [1.3,) + + + run + + + + + + + + + + + + + + + + + + + org.camunda.bpm + camunda-engine + compile + + + org.slf4j + slf4j-api + + + + + + + org.camunda.bpm + camunda-engine-cdi + + + + + org.camunda.bpm.extension + camunda-bpm-assert + 1.2 + test + + + org.mockito + mockito-all + 1.10.19 + test + + + + org.camunda.bpm.workbench + camunda-workbench-dist-embeddable + 1.0.0-alpha8 + test + + + + + org.camunda.spin + camunda-spin-dataformat-all + compile + + + org.camunda.bpm + camunda-engine-plugin-spin + compile + + + + org.camunda.bpm + camunda-engine-plugin-connect + compile + + + + + org.webjars + bootstrap + 2.3.2 + + + + org.jboss.resteasy + resteasy-client + 3.0.19.Final + provided + + + org.apache.httpcomponents + httpclient + + + + + + + com.h2database + h2 + test + + + + com.fasterxml.uuid + java-uuid-generator + + + org.codehaus.groovy + groovy-all + + + org.apache.commons + commons-lang3 + 3.4 + + + org.openecomp.mso + MSOCoreBPMN + ${project.version} + + + + org.openecomp.mso + MSOCoreBPMN + ${project.version} + tests + test + + + javax.ws.rs + javax.ws.rs-api + 2.0 + + + + org.springframework + spring-web + 4.3.2.RELEASE + + + org.openecomp.mso + MSOMockServer + ${project.version} + classes + test + + + org.openecomp.mso + MSORESTClient + ${project.version} + + + + javax.servlet + javax.servlet-api + 3.0.1 + provided + + + + com.github.tomakehurst + wiremock + 1.56 + test + standalone + + + org.mortbay.jetty + jetty + + + com.google.guava + guava + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-databind + + + org.apache.httpcomponents + httpclient + + + org.skyscreamer + jsonassert + + + xmlunit + xmlunit + + + com.jayway.jsonpath + json-path + + + net.sf.jopt-simple + jopt-simple + + + + + diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy similarity index 57% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/AaiUtil.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy index 96431b6d1f..01e25a5741 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy @@ -18,32 +18,20 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.common.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution - +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; import org.openecomp.mso.rest.APIResponse; import org.openecomp.mso.rest.RESTClient import org.openecomp.mso.rest.RESTConfig class AaiUtil { - + public MsoUtils utils = new MsoUtils() - public static final String NETWORK_GENERIC_VNF = 'aai_network_generic_vnf_uri' - public static final String NETWORK_VPN_BINDING = 'aai_network_vpn_binding_uri' - public static final String NETWORK_POLICY = 'aai_network_policy_uri' - public static final String NETWORK_VCE = 'aai_network_vce_uri' - public static final String NETWORK_L3_NETWORK = 'aai_network_l3_network_uri' - public static final String NETWORK_TABLE_REFERENCES = 'aai_network_table_reference_uri' - public static final String BUSINESS_CUSTOMER = 'aai_business_customer_uri' - public static final String BUSINESS_CUSTOMERV7 = 'aaiv7_business_customer_uri' - public static final String CLOUD_INFRASTRUCTURE_VOLUME_GROUP = 'aai_cloud_infrastructure_volume_group_uri' - public static final String CLOUD_INFRASTRUCTURE_CLOUD_REGION = 'aai_cloud_infrastructure_cloud_region_uri' - public static final String CLOUD_INFRASTRUCTURE_TENANT = 'aai_cloud_infrastructure_tenant_uri' - public static final String SEARCH_GENERIC_QUERY = 'aai_search_generic_query_uri' - public static final String SEARCH_NODES_QUERY = 'aai_search_nodes_query_uri' public static final String AAI_NAMESPACE_STRING = 'http://org.openecomp.aai.inventory/' - + public static final String DEFAULT_VERSION_KEY = 'URN_mso_workflow_global_default_aai_version' + private AbstractServiceTaskProcessor taskProcessor public AaiUtil(AbstractServiceTaskProcessor taskProcessor) { @@ -51,288 +39,185 @@ class AaiUtil { } public String getNetworkGenericVnfEndpoint(Execution execution) { - def method = getClass().getSimpleName() + '.getNetworkGenericVnfUri(' + - 'execution=' + execution.getId() + - ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - String endpoint = execution.getVariable("URN_aai_endpoint") - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, NETWORK_GENERIC_VNF) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + def uri = getNetworkGenericVnfUri(execution) + taskProcessor.logDebug('AaiUtil.getNetworkGenericVnfEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled) return endpoint + uri } public String getNetworkGenericVnfUri(Execution execution) { - def method = getClass().getSimpleName() + '.getNetworkGenericVnfUri(' + - 'execution=' + execution.getId() + - ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, NETWORK_GENERIC_VNF) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + def uri = getUri(execution, 'generic_vnf') + taskProcessor.logDebug('AaiUtil.getNetworkGenericVnfUri() - AAI URI: ' + uri, isDebugLogEnabled) return uri } - - - + public String getNetworkVpnBindingUri(Execution execution) { - def method = getClass().getSimpleName() + '.getNetworkVpnBindingUri(' + - 'execution=' + execution.getId() + - ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, NETWORK_VPN_BINDING) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + def uri = getUri(execution, 'vpn_binding') + taskProcessor.logDebug('AaiUtil.getNetworkVpnBindingUri() - AAI URI: ' + uri, isDebugLogEnabled) return uri } public String getNetworkPolicyUri(Execution execution) { - def method = getClass().getSimpleName() + '.getNetworkPolicyUri(' + - 'execution=' + execution.getId() + - ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, NETWORK_POLICY) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + def uri = getUri(execution, 'network_policy') + taskProcessor.logDebug('AaiUtil.getNetworkPolicyUri() - AAI URI: ' + uri, isDebugLogEnabled) return uri } public String getNetworkTableReferencesUri(Execution execution) { - def method = getClass().getSimpleName() + '.getNetworkTableReferencesUri(' + - 'execution=' + execution.getId() + - ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, NETWORK_TABLE_REFERENCES) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + def uri = getUri(execution, 'route_table_reference') + taskProcessor.logDebug('AaiUtil.getNetworkTableReferencesUri() - AAI URI: ' + uri, isDebugLogEnabled) return uri } public String getNetworkVceUri(Execution execution) { - def method = getClass().getSimpleName() + '.getNetworkVceUri(' + - 'execution=' + execution.getId() + - ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, NETWORK_VCE) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + def uri = getUri(execution, 'vce') + taskProcessor.logDebug('AaiUtil.getNetworkVceUri() - AAI URI: ' + uri, isDebugLogEnabled) return uri } public String getNetworkL3NetworkUri(Execution execution) { - def method = getClass().getSimpleName() + '.getNetworkL3NetworkUri(' + - 'execution=' + execution.getId() + - ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, NETWORK_L3_NETWORK) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + def uri = getUri(execution, 'l3_network') + taskProcessor.logDebug('AaiUtil.getNetworkL3NetworkUri() - AAI URI: ' + uri, isDebugLogEnabled) return uri } public String getBusinessCustomerUri(Execution execution) { - def method = getClass().getSimpleName() + '.getBusinessCustomerUri(' + - 'execution=' + execution.getId() + - ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, BUSINESS_CUSTOMER) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + def uri = getUri(execution, 'customer') + taskProcessor.logDebug('AaiUtil.getBusinessCustomerUri() - AAI URI: ' + uri, isDebugLogEnabled) return uri } - public String getBusinessCustomerUriv7(Execution execution) { - def method = getClass().getSimpleName() + '.getBusinessCustomerUriv7(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, BUSINESS_CUSTOMERV7) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) - return uri - } + //public String getBusinessCustomerUriv7(Execution execution) { + // def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + // //def uri = getUri(execution, BUSINESS_CUSTOMERV7) + // def uri = getUri(execution, 'Customer') + // taskProcessor.logDebug('AaiUtil.getBusinessCustomerUriv7() - AAI URI: ' + uri, isDebugLogEnabled) + // return uri + //} public String getCloudInfrastructureCloudRegionEndpoint(Execution execution) { - def method = getClass().getSimpleName() + '.getCloudInfrastructureCloudRegionUri(' + - 'execution=' + execution.getId() + - ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - String endpoint = execution.getVariable("URN_aai_endpoint") - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, CLOUD_INFRASTRUCTURE_CLOUD_REGION) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + def uri = getCloudInfrastructureCloudRegionUri(execution) + taskProcessor.logDebug('AaiUtil.getCloudInfrastructureCloudRegionEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled) return endpoint + uri } - /** - * This method is depracated, use getCloudInfrastructureRegionEndpoint instead - */ - //@Deprecated public String getCloudInfrastructureCloudRegionUri(Execution execution) { - def method = getClass().getSimpleName() + '.getCloudInfrastructureCloudRegionUri(' + - 'execution=' + execution.getId() + - ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, CLOUD_INFRASTRUCTURE_CLOUD_REGION) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + def uri = getUri(execution, 'cloud_region') + taskProcessor.logDebug('AaiUtil.getCloudInfrastructureCloudRegionUri() - AAI URI: ' + uri, isDebugLogEnabled) return uri } - public String getCloudInfrastructureVolumeGroupEndpoint(Execution execution) { - def method = getClass().getSimpleName() + '.getCloudInfrastructureVolumeGroupUri(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - String endpoint = execution.getVariable("URN_aai_endpoint") - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, CLOUD_INFRASTRUCTURE_VOLUME_GROUP) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) - return endpoint + uri - } - public String getCloudInfrastructureVolumeGroupUri(Execution execution) { - def method = getClass().getSimpleName() + '.getCloudInfrastructureVolumeGroupUri(' + - 'execution=' + execution.getId() + - ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, CLOUD_INFRASTRUCTURE_VOLUME_GROUP) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + def uri = getUri(execution, 'volume_group') + taskProcessor.logDebug('AaiUtil.getCloudInfrastructureVolumeGroupUri() - AAI URI: ' + uri, isDebugLogEnabled) return uri } public String getCloudInfrastructureTenantUri(Execution execution) { - def method = getClass().getSimpleName() + '.getCloudInfrastructureTenantUri(' + - 'execution=' + execution.getId() + - ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, CLOUD_INFRASTRUCTURE_TENANT) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + def uri = getUri(execution, 'tenant') + taskProcessor.logDebug('AaiUtil.getCloudInfrastructureTenantUri() - AAI URI: ' + uri, isDebugLogEnabled) return uri } public String getSearchNodesQueryUri(Execution execution) { - def method = getClass().getSimpleName() + '.getSearchNodesQueryUri(' + - 'execution=' + execution.getId() + - ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, SEARCH_NODES_QUERY) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + def uri = getUri(execution, 'nodes_query') + taskProcessor.logDebug('AaiUtil.getSearchNodesQueryUri() - AAI URI: ' + uri, isDebugLogEnabled) return uri } public String getSearchNodesQueryEndpoint(Execution execution) { - def method = getClass().getSimpleName() + '.getSearchNodesQueryUri(' + - 'execution=' + execution.getId() + - ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - String endpoint = execution.getVariable("URN_aai_endpoint") - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, SEARCH_NODES_QUERY) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + def uri = getSearchNodesQueryUri(execution) + taskProcessor.logDebug('AaiUtil.getSearchNodesQueryEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled) return endpoint + uri } public String getSearchGenericQueryUri(Execution execution) { - def method = getClass().getSimpleName() + '.getSearchGenericQueryUri(' + - 'execution=' + execution.getId() + - ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - def processKey = taskProcessor.getProcessKey(execution) - def uri = getUri(execution, SEARCH_GENERIC_QUERY) - - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + def uri = getUri(execution, 'generic_query') + taskProcessor.logDebug('AaiUtil.getSearchGenericQueryUri() - AAI URI: ' + uri, isDebugLogEnabled) return uri } - public String getUri(Execution execution, String key) { - def method = getClass().getSimpleName() + '.getUri(' + - 'execution=' + execution.getId() + - ')' + public String getVersion(Execution execution, resourceName, processKey) { def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - def processKey = taskProcessor.getProcessKey(execution) - def uriKey = "URN_mso_workflow_${processKey}_${key}" - def defaultUriKey = "URN_mso_workflow_default_${key}" + resourceName = resourceName.replaceAll('-', '_') + + def versionWithResourceKey = "URN_mso_workflow_default_aai_${resourceName}_version" + def versionWithProcessKey = "URN_mso_workflow_custom_${processKey}_aai_version" - taskProcessor.logDebug('URI Key ' + uriKey, isDebugLogEnabled) - taskProcessor.logDebug('Default URI Key ' + defaultUriKey, isDebugLogEnabled) + def version = execution.getVariable(versionWithProcessKey) + if (version) { + taskProcessor.logDebug("AaiUtil.getVersion() - using flow specific ${versionWithProcessKey}=${version}", isDebugLogEnabled) + return version + } + + version = execution.getVariable(versionWithResourceKey) + if (version) { + taskProcessor.logDebug("AaiUtil.getVersion() - using resource specific ${versionWithResourceKey}=${version}", isDebugLogEnabled) + return version + } + + version = execution.getVariable(DEFAULT_VERSION_KEY) + if (version) { + taskProcessor.logDebug("AaiUtil.getVersion() - using default version ${DEFAULT_VERSION_KEY}=${version}", isDebugLogEnabled) + return version + } + + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, "Internal Error: One of the following should be defined in MSO URN properties file: ${versionWithResourceKey}, ${versionWithProcessKey}, ${DEFAULT_VERSION_KEY}") + } + + public String getUri(Execution execution, resourceName) { - def uri = execution.getVariable(uriKey) - if (uri == null || uri == "") { - taskProcessor.logDebug("Process specific key not defined, using default key $defaultUriKey", isDebugLogEnabled) - uri = execution.getVariable(defaultUriKey) + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + def processKey = taskProcessor.getMainProcessKey(execution) + + resourceName = resourceName.replaceAll('-', '_') + + // Check for flow+resource specific first + def key = "URN_mso_workflow_${processKey}_aai_${resourceName}_uri" + def uri = execution.getVariable(key) + if(uri) { + taskProcessor.logDebug("AaiUtil.getUri() - using flow+resource specific key: ${key}=${uri}", isDebugLogEnabled) + return uri + } + + // Check for versioned key + def version = getVersion(execution, resourceName, processKey) + key = "URN_mso_workflow_default_aai_v${version}_${resourceName}_uri" + uri = execution.getVariable(key) + + if(uri) { + taskProcessor.logDebug("AaiUtil.getUri() - using versioned URI key: ${key}=${uri}", isDebugLogEnabled) + return uri } - taskProcessor.logDebug('AAI URI is ' + uri, isDebugLogEnabled) - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) - return uri + (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + key + ' not defined in the MSO URN properties file') } public String getNamespaceFromUri(String uri) { - String namespace = AAI_NAMESPACE_STRING - if(uri!=null){ - return namespace + uri.substring(uri.indexOf("v"), uri.indexOf("v")+2) - }else{ - return namespace - } + String namespace = AAI_NAMESPACE_STRING + if(uri!=null){ + return namespace + uri.substring(uri.indexOf("v"), uri.indexOf("v")+2) + }else{ + return namespace + } } @@ -391,8 +276,8 @@ class AaiUtil { try{ String uuid = UUID.randomUUID() taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled) - taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) + String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) RESTConfig config = new RESTConfig(url); @@ -427,10 +312,10 @@ class AaiUtil { try{ String uuid = UUID.randomUUID() taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled) - taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) + String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) + RESTConfig config = new RESTConfig(url); RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml"); if (basicAuthCred != null && !"".equals(basicAuthCred)) { @@ -447,6 +332,78 @@ class AaiUtil { taskProcessor.logDebug( "======== Completed Execute AAI Delete Process ======== ", isDebugEnabled) } + /** + * This reusable method can be used for making AAI Delete Calls. The url should + * be passed as a parameter along with the execution. The method will + * return an APIResponse. + * + * @param execution + * @param url + * @param payload + * + * @return APIResponse + */ + public APIResponse executeAAIDeleteCall(Execution execution, String url, String payload, String authHeader){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled) + try{ + String uuid = UUID.randomUUID() + taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled) + taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) + + String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml").addAuthorizationHeader(authHeader); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + + APIResponse apiResponse = client.httpDelete(payload) + + return apiResponse + + }catch(Exception e){ + taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Delete Call. Exception is: \n" + e, isDebugEnabled) + return e + } + taskProcessor.logDebug( "======== Completed Execute AAI Delete Process ======== ", isDebugEnabled) + } + + /** + * This reusable method can be used for making AAI Post Calls. The url should + * be passed as a parameter along with the execution. The method will + * return an APIResponse. + * + * @param execution + * @param url + * @param payload + * + * @return APIResponse + */ + public APIResponse executeAAIPostCall(Execution execution, String url, String payload){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + taskProcessor.logDebug( " ======== Started Execute AAI Post Process ======== ", isDebugEnabled) + try{ + String uuid = UUID.randomUUID() + taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled) + taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled) + + String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) + RESTConfig config = new RESTConfig(url); + RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml"); + if (basicAuthCred != null && !"".equals(basicAuthCred)) { + client.addAuthorizationHeader(basicAuthCred) + } + APIResponse apiResponse = client.httpPost(payload) + + return apiResponse + + }catch(Exception e){ + taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Post Call. Exception is: \n" + e, isDebugEnabled) + return e + } + taskProcessor.logDebug( "======== Completed Execute AAI Post Process ======== ", isDebugEnabled) + } /** Utilitty to get the Cloud Region from AAI * Returns String cloud region id, (ie, cloud-region-id) @@ -523,8 +480,4 @@ class AaiUtil { def ret = xmlInput.'**'.find {it.'service-instance-id' == searchValue} return ret } - - - -} - +} \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy similarity index 88% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/AbstractServiceTaskProcessor.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy index 168cf0bc41..5a23d17da0 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/AbstractServiceTaskProcessor.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy @@ -18,32 +18,20 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts; +package org.openecomp.mso.bpmn.common.scripts; -import javax.xml.transform.Transformer -import javax.xml.transform.TransformerException; +import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.impl.core.variable.value.ObjectValueImpl import org.camunda.bpm.engine.runtime.Execution import org.camunda.bpm.engine.variable.VariableMap - - - +import org.camunda.bpm.engine.variable.Variables +import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats +import org.camunda.bpm.engine.variable.impl.value.ObjectValueImpl +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowCallbackResponse +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowContextHolder import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.gamma.workflow.service.WorkflowCallbackResponse -import org.openecomp.mso.bpmn.gamma.workflow.service.WorkflowContextHolder - -import groovy.json.JsonSlurper - -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import org.camunda.bpm.engine.variable.VariableMap; -import org.camunda.bpm.engine.variable.Variables; -import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats; -import org.w3c.dom.Node; +import org.springframework.web.util.UriUtils public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcessor { public MsoUtils utils = new MsoUtils() @@ -218,7 +206,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess def encErrorMessage = errorMessage.replace("&", "&").replace("<", "<").replace(">", ">") def content = """ - + ${encErrorMessage} ${errorCode} @@ -404,9 +392,9 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess /** - * Validates that the request exists and that the att-mso-request-id variable is set. + * Validates that the request exists and that the mso-request-id variable is set. * Additional required variables may be checked by specifying their names. - * NOTE: services requiring att-mso-service-instance-id must specify it explicitly! + * NOTE: services requiring mso-service-instance-id must specify it explicitly! * If a problem is found, buildAndThrowWorkflowException builds a WorkflowException * and throws an MSOWorkflowException. This method also sets up the log context for * the workflow. @@ -456,7 +444,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess String serviceInstanceId = null List allRequiredVariables = new ArrayList() - allRequiredVariables.add("att-mso-request-id") + allRequiredVariables.add("mso-request-id") if (requiredVariables != null) { for (String variable : requiredVariables) { @@ -473,15 +461,15 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess " request was received with no '" + variable + "' variable") } - if ("att-mso-request-id".equals(variable)) { + if ("mso-request-id".equals(variable)) { requestId = (String) value - } else if ("att-mso-service-instance-id".equals(variable)) { + } else if ("mso-service-instance-id".equals(variable)) { serviceInstanceId = (String) value } } if (serviceInstanceId == null) { - serviceInstanceId = (String) execution.getVariable("att-mso-service-instance-id") + serviceInstanceId = (String) execution.getVariable("mso-service-instance-id") } utils.logContext(requestId, serviceInstanceId) @@ -512,8 +500,8 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess String processKey = getProcessKey(execution); def prefix = execution.getVariable("prefix") - def requestId =getVariable(execution, "att-mso-request-id") - def serviceInstanceId = getVariable(execution, "att-mso-service-instance-id") + def requestId =getVariable(execution, "mso-request-id") + def serviceInstanceId = getVariable(execution, "mso-service-instance-id") if(requestId!=null && serviceInstanceId!=null){ utils.logContext(requestId, serviceInstanceId) } @@ -614,7 +602,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess WorkflowContextHolder.getInstance().processCallback( processKey, execution.getProcessInstanceId(), - execution.getVariable("att-mso-request-id"), + execution.getVariable("mso-request-id"), callbackResponse) execution.setVariable(processKey + "WorkflowResponseSent", "true"); @@ -636,8 +624,9 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess } /** - * Returns the process definition key (i.e. the process name) from the - * execution. + * Returns the process definition key (i.e. the process name) of the + * current process. + * * @param execution the execution */ public String getProcessKey(Execution execution) { @@ -649,6 +638,32 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess .getProcessDefinition(execution.getProcessDefinitionId()).getKey() } + /** + * Returns the process definition key (i.e. the process name) of the + * top-level process. + * @param execution the execution + */ + public String getMainProcessKey(Execution execution) { + Execution exec = execution + + while (true) { + Execution parent = exec.getSuperExecution() + + if (parent == null) { + parent = exec.getParent() + + if (parent == null) { + break + } + } + + exec = parent + } + + return execution.getProcessEngineServices().getRepositoryService() + .getProcessDefinition(exec.getProcessDefinitionId()).getKey() + } + /** * Gets the node for the named element from the given xml. If the element * does not exist in the xml or is empty, a WorkflowException is created @@ -813,7 +828,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess public void sendSyncError(Execution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String requestId = execution.getVariable("att-mso-request-id") + String requestId = execution.getVariable("mso-request-id") logDebug('sendSyncError, requestId: ' + requestId, isDebugEnabled) WorkflowException workflowExceptionObj = execution.getVariable("WorkflowException") if (workflowExceptionObj != null) { @@ -870,5 +885,80 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess } } } + + /** + *This method determines and adds the appropriate ending to come + *after a number (-st, -nd, -rd, or -th) + * + *@param int n + * + *@return String ending - number with suffix + */ + + public static String labelMaker(Object n) { + Integer num + if(n instanceof String){ + num = Integer.parseInt(n) + }else{ + num = n + } + + String ending = ""; //the end to be added to the number + if(num != null){ + if ((num % 10 == 1) && (num != 11)) { + ending = num + "st"; + } else if ((num % 10 == 2) && (num != 12)) { + ending = num + "nd"; + } else if ((num % 10 == 3) && (num != 13)) { + ending = num + "rd"; + } else { + ending = num + "th"; + } + } + return ending + } + + /** + * + *This method gets and decodes SDNC Response's "RequestData". + * + *@param response - the sdnc response + * + *@return data - the response "RequestData" decoded + * + */ + public String getRequestDataDecoded(String response){ + String data = utils.getNodeText1(response, "RequestData") + if(data != null){ + data = data.replaceAll("<", "<") + data = data.replaceAll(">", ">") + } + + return data + } + + + /** + * Constructs a workflow message callback URL for the specified message type and correlator. + * @param messageType the message type (e.g. SDNCAResponse or VNFAResponse) + * @param correlator the correlator value (e.g. a request ID) + */ + public String createCallbackURL(Execution execution, String messageType, String correlator) { + String endpoint = (String) execution.getVariable('URN_mso_workflow_message_endpoint') + + if (endpoint == null || endpoint.isEmpty()) { + ExceptionUtil exceptionUtil = new ExceptionUtil() + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, + 'mso:workflow:message:endpoint URN mapping is not set') + } + + while (endpoint.endsWith('/')) { + endpoint = endpoint.substring(0, endpoint.length()-1) + } + + return endpoint + + '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') + + '/' + UriUtils.encodePathSegment(correlator, 'UTF-8') + } } diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy new file mode 100644 index 0000000000..f74717b510 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy @@ -0,0 +1,550 @@ +/*- + * ============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.common.scripts + +import org.json.JSONObject; +import org.json.JSONArray; +import org.json.XML; +import org.springframework.web.util.UriUtils; + +import org.openecomp.mso.bpmn.core.json.JsonUtils + + +import groovy.json.JsonBuilder +import groovy.json.JsonSlurper +import groovy.util.slurpersupport.GPathResult +import groovy.xml.QName; + +import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + + +/*** + * Utilities for accessing Catalog DB Adapter to retrieve Networks, VNF/VFModules, AllottedResources and complete ServiceResources information + * + */ + +class CatalogDbUtils { + + MsoUtils utils = new MsoUtils() + JsonUtils jsonUtils = new JsonUtils() + MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + + public JSONArray getAllNetworksByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid) { + JSONArray networksList = null + String endPoint = catalogDbEndpoint + "/v1/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(endPoint) + + if (catalogDbResponse != null) { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return networksList + } + + public JSONArray getAllNetworksByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) { + JSONArray networksList = null + String endPoint = catalogDbEndpoint + "/v1/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(endPoint) + + if (catalogDbResponse != null) { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return networksList + } + + public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) { + JSONArray networksList = null + String endPoint = catalogDbEndpoint + "/v1/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(endPoint) + + if (catalogDbResponse != null) { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return networksList + } + + public JSONArray getAllNetworksByNetworkModelCustomizationUuid(String catalogDbEndpoint, String networkModelCustomizationUuid) { + JSONArray networksList = null + String endPoint = catalogDbEndpoint + "/v1/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(endPoint) + + if (catalogDbResponse != null) { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return networksList + } + + public JSONArray getAllNetworksByNetworkType(String catalogDbEndpoint, String networkType) { + JSONArray networksList = null + String endPoint = catalogDbEndpoint + "/v1/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(endPoint) + + if (catalogDbResponse != null) { + networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return networksList + } + + + public JSONArray getAllVnfsByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid) { + JSONArray vnfsList = null + String endPoint = catalogDbEndpoint + "/v1/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return vnfsList + } + + public JSONArray getAllVnfsByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) { + JSONArray vnfsList = null + String endPoint = catalogDbEndpoint + "/v1/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return vnfsList + } + + public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) { + JSONArray vnfsList = null + String endPoint = catalogDbEndpoint + "/v1/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return vnfsList + } + + public JSONArray getAllVnfsByVnfModelCustomizationUuid(String catalogDbEndpoint, String vnfModelCustomizationUuid) { + JSONArray vnfsList = null + String endPoint = catalogDbEndpoint + "/v1/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8") + try { + msoLogger.debug("ENDPOINT: " + endPoint) + String catalogDbResponse = getResponseFromCatalogDb(endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return vnfsList + } + + + public JSONArray getAllottedResourcesByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid) { + JSONArray vnfsList = null + String endPoint = catalogDbEndpoint + "/v1/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return vnfsList + } + + public JSONArray getAllottedResourcesByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) { + JSONArray vnfsList = null + String endPoint = catalogDbEndpoint + "/v1/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return vnfsList + } + + public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) { + JSONArray vnfsList = null + String endPoint = catalogDbEndpoint + "/v1/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return vnfsList + } + + public JSONArray getAllottedResourcesByArModelCustomizationUuid(String catalogDbEndpoint, String arModelCustomizationUuid) { + JSONArray vnfsList = null + String endPoint = catalogDbEndpoint + "/v1/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(endPoint) + + if (catalogDbResponse != null) { + vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources") + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return vnfsList + } + + public JSONObject getServiceResourcesByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) { + JSONObject resources = null + String endPoint = catalogDbEndpoint + "/v1/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(endPoint) + + if (catalogDbResponse != null) { + resources = parseServiceResourcesJson(catalogDbResponse) + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return resources + } + + public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) { + JSONObject resources = null + String endPoint = catalogDbEndpoint + "/v1/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8") + try { + String catalogDbResponse = getResponseFromCatalogDb(endPoint) + + if (catalogDbResponse != null) { + resources = parseServiceResourcesJson(catalogDbResponse) + } + + } + catch (Exception e) { + utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message) + } + + return resources + } + + + + private JSONArray parseNetworksJson (String catalogDbResponse, String arrayName) { + JSONArray modelInfos = null + + try { + // Create array of jsons + + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONArray networks = responseJson.getJSONArray(arrayName) + modelInfos = new JSONArray() + + for (int i = 0; i < networks.length(); i++) { + + JSONObject network = networks.getJSONObject(i) + JSONObject modelInfo = buildModelInfo("network", network) + JSONObject modelJson = new JSONObject() + modelJson.put("modelInfo", modelInfo) + String networkType = jsonUtils.getJsonValueForKey(network, "networkType") + modelJson.put("networkType", networkType) + modelInfos.put(modelJson) + } + + String modelInfosString = modelInfos.toString() + msoLogger.debug("Returning networks JSON: " + modelInfosString) + + } catch (Exception e) { + utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message) + } + + return modelInfos + } + + private JSONArray parseVnfsJson (String catalogDbResponse, String arrayName) { + JSONArray modelInfos = null + + try { + // Create array of jsons + + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONArray vnfs = responseJson.getJSONArray(arrayName) + modelInfos = new JSONArray() + + for (int i = 0; i < vnfs.length(); i++) { + JSONObject vnf = vnfs.getJSONObject(i) + + msoLogger.debug(vnf.toString(2)) + JSONObject modelInfo = buildModelInfo("vnf", vnf) + JSONObject modelJson = new JSONObject() + modelJson.put("modelInfo", modelInfo) + + JSONArray vfModules = null + try { + vfModules = vnf.getJSONArray("vfModules") + } catch (Exception e) + { + msoLogger.debug("Cannot find VF MODULE ARRAY: " + i + ", exception is " + e.message) + } + + if (vfModules != null) { + JSONArray vfModuleInfo = new JSONArray() + for (int j = 0; j < vfModules.length(); j++) { + JSONObject vfModule = vfModules.getJSONObject(j) + JSONObject vfModuleModelInfo = buildModelInfo("vfModule", vfModule) + JSONObject vfModuleModelJson = new JSONObject() + vfModuleModelJson.put("modelInfo", vfModuleModelInfo) + String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type") + vfModuleModelJson.put("vfModuleType", vfModuleType) + Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase") + if (isBase.intValue() == 1) { + vfModuleModelJson.put("isBase", "true") + } + else { + vfModuleModelJson.put("isBase", "false") + } + String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label") + vfModuleModelJson.put("vfModuleLabel", vfModuleLabel) + Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount") + vfModuleModelJson.put("initialCount", initialCount.intValue()) + vfModuleInfo.put(vfModuleModelJson) + } + modelJson.put("vfModules", vfModuleInfo) + } + modelInfos.put(modelJson) + } + + String modelInfosString = modelInfos.toString() + msoLogger.debug("Returning vnfs JSON: " + modelInfosString) + + } catch (Exception e) { + utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message) + } + + return modelInfos + } + + private JSONArray parseAllottedResourcesJson (String catalogDbResponse, String arrayName) { + JSONArray modelInfos = null + + try { + // Create array of jsons + + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONArray allottedResources = responseJson.getJSONArray(arrayName) + modelInfos = new JSONArray() + + for (int i = 0; i < allottedResources.length(); i++) { + JSONObject allottedResource = allottedResources.getJSONObject(i) + JSONObject modelInfo = buildModelInfo("allottedResource", allottedResource) + JSONObject modelJson = new JSONObject() + modelJson.put("modelInfo", modelInfo) + modelInfos.put(modelJson) + } + + String modelInfosString = modelInfos.toString() + msoLogger.debug("Returning allottedResources JSON: " + modelInfosString) + + } catch (Exception e) { + utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message) + } + + return modelInfos + } + + private JSONObject parseServiceResourcesJson (String catalogDbResponse) { + JSONObject serviceResources = new JSONObject() + + try { + // Create array of jsons + + JSONObject responseJson = new JSONObject(catalogDbResponse) + JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources") + JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "vnfResources") + serviceResources.put("vnfs", vnfsArray) + JSONArray networksArray = parseNetworksJson(serviceResourcesRoot.toString(), "networkResourceCustomization") + serviceResources.put("networks", networksArray) + JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "allottedResourceCustomization") + serviceResources.put("allottedResources", allottedResourcesArray) + + String serviceResourcesString = serviceResources.toString() + msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString) + + } catch (Exception e) { + utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message) + } + + return serviceResources + } + + private JSONObject buildModelInfo(String modelType, JSONObject modelFromDb) { + JSONObject modelInfo = null + try { + modelInfo = new JSONObject() + modelInfo.put("modelType", modelType) + String modelInvariantId = jsonUtils.getJsonValueForKey(modelFromDb, "modelInvariantUuid") + modelInfo.put("modelInvariantId", modelInvariantId) + if(modelType.equalsIgnoreCase("allottedResource")){ + String modelInstanceName = jsonUtils.getJsonValueForKey(modelFromDb, "modelInstanceName") + modelInfo.put("modelInstanceName", modelInstanceName) + } + if (!"vfModule".equals(modelType) && !"vnf".equals(modelType)) { + String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "modelUuid") + modelInfo.put("modelVersionId", modelVersionId) + } + else { + String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "asdcUuid") + modelInfo.put("modelVersionId", modelVersionId) + } + String modelName = jsonUtils.getJsonValueForKey(modelFromDb, "modelName") + modelInfo.put("modelName", modelName) + String modelVersion = jsonUtils.getJsonValueForKey(modelFromDb, "modelVersion") + modelInfo.put("modelVersion", modelVersion) + if (!"vfModule".equals(modelType)) { + String modelCustomizationName = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationName") + modelInfo.put("modelCustomizationName", modelCustomizationName) + } + String modelCustomizationId = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationUuid") + modelInfo.put("modelCustomizationId", modelCustomizationId) + JSONObject modelJson = new JSONObject() + modelJson.put("modelInfo", modelInfo) + } + catch (Exception e) { + utils.log("ERROR", "Exception while parsing model information: " + e.message) + } + return modelInfo + } + + private String getResponseFromCatalogDb (String endPoint) { + try { + RESTConfig config = new RESTConfig(endPoint); + def responseData = '' + def bpmnRequestId = UUID.randomUUID().toString() + RESTClient client = new RESTClient(config). + addHeader('X-TransactionId', bpmnRequestId). + addHeader('X-FromAppId', 'BPMN'). + addHeader('Content-Type', 'application/json'). + addHeader('Accept','application/json'); + msoLogger.debug('sending GET to Catalog DB endpoint' + endPoint) + APIResponse response = client.httpGet() + + responseData = response.getResponseBodyAsString() + if (responseData != null) { + msoLogger.debug("Received data from Catalog DB: " + responseData) + } + + msoLogger.debug('Response code:' + response.getStatusCode()) + msoLogger.debug('Response:' + System.lineSeparator() + responseData) + if (response.getStatusCode() == 200) { + // parse response as needed + return responseData + } + else { + return null + } + } + catch (Exception e) { + msoLogger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message) + return null + } + + } +} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CommonExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CommonExceptionUtil.groovy similarity index 96% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CommonExceptionUtil.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CommonExceptionUtil.groovy index fae12c343e..cce05feca8 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CommonExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CommonExceptionUtil.groovy @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.common.scripts import org.camunda.bpm.engine.runtime.Execution import org.apache.commons.lang3.* @@ -287,14 +287,14 @@ class CommonExceptionUtil { } def message = "" if(messageId.startsWith("SVC")){ - message = """ + message = """ ${messageId} ${messageTxt}${msgVarsBuff} """ }else{ - message =""" + message =""" ${messageId} ${messageTxt}${msgVarsBuff} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy similarity index 59% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CompleteMsoProcess.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy index 8ec267dd19..e7277b602b 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CompleteMsoProcess.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy @@ -18,9 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts - -import java.text.SimpleDateFormat +package org.openecomp.mso.bpmn.common.scripts import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError @@ -35,43 +33,29 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { // Complete MSO Request processing public initializeProcessVariables(Execution execution){ - def method = getClass().getSimpleName() + '.sendResponse(' +'execution=' + execution.getId() +')' + def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) try { /* Initialize all the process request variables in this block */ execution.setVariable("prefix",Prefix) - //execution.setVariable("getLayer3ServiceDetailsV1Response","") execution.setVariable("CMSO_request_id","") execution.setVariable("CMSO_notification-url","") execution.setVariable("CMSO_mso-bpel-name","") execution.setVariable("CMSO_request_action","") - execution.setVariable("CMSO_notification-url-Ok", false) execution.setVariable("CMSO_request_id-Ok", false) - //These variabels are for Get Mso Aai Password Adapter - execution.setVariable("CMSO_deliveryStatus", false) - //updateRequest Adapter process variables execution.setVariable("CMSO_updateRequestResponse", "") execution.setVariable("CMSO_updateRequestResponseCode", "") - execution.setVariable("CMSO_updateFinalNotifyAckStatusSuccessPayload", "") execution.setVariable("CMSO_updateFinalNotifyAckStatusFailedPayload", "") - execution.setVariable("CMSO_gSendManagedNetworkStatusNotificationResponse", "") //Set DB adapter variables here - execution.setVariable("CMSO_updateFinalStatusSuccessPayload", "") execution.setVariable("CMSO_updateDBStatusToSuccessPayload", "") execution.setVariable("CMSO_updateInfraRequestDBPayload", "") execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", "") - execution.setVariable("CMSO_setUpdateFinalNotifyAckStatusPayload", "") - - //NotifyOMXSuccessFailureViaCSI Adapter variables - execution.setVariable("CMSO_notifyOMXSuccessFailureViaCSIPayload", "") - execution.setVariable("CMSO_notifyOMXSuccessFailureViaCSIResponseCode", null) - execution.setVariable("CMSO_notifyOMXSuccessFailureViaCSIResponse", "") //Auth variables execution.setVariable("BasicAuthHeaderValue","") @@ -95,9 +79,9 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { public void preProcessRequest (Execution execution) { initializeProcessVariables(execution) - def method = getClass().getSimpleName() + '.sendResponse(' +'execution=' + execution.getId() +')' + def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - utils.log("DEBUG", "*** Started CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled); +// utils.log("DEBUG", "*** Started CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled); logDebug('Entered ' + method, isDebugLogEnabled) try { def xml = execution.getVariable("CompleteMsoProcessRequest") @@ -155,6 +139,23 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { utils.log("DEBUG", "CMSO_notification-url-Ok --> " + execution.getVariable("CMSO_notification-url-Ok"), isDebugLogEnabled) utils.log("DEBUG", "CMSO_request_id-Ok --> " + execution.getVariable("CMSO_request_id-Ok"), isDebugLogEnabled) + // set the DHV/Service Instantiation values if specified in the request + execution.setVariable("CMSO_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText1(xml, "is-srv-inst-req")))) + utils.log("DEBUG", "CMSO_is_srv_inst_req --> " + execution.getVariable("CMSO_is_srv_inst_req"), isDebugLogEnabled) + execution.setVariable("CMSO_is_json_content", String.valueOf("JSON".equals(utils.getNodeText1(xml, "resp-content-type")))) + utils.log("DEBUG", "CMSO_is_json_content --> " + execution.getVariable("CMSO_is_json_content"), isDebugLogEnabled) + execution.setVariable("CMSO_service_inst_id", utils.getNodeText1(xml, "service-instance-id")) + utils.log("DEBUG", "CMSO_service_inst_id --> " + execution.getVariable("CMSO_service_inst_id"), isDebugLogEnabled) + execution.setVariable("CMSO_start_time", utils.getNodeText1(xml, "start-time")) + utils.log("DEBUG", "CMSO_start_time --> " + execution.getVariable("CMSO_start_time"), isDebugLogEnabled) + // this variable is used by the camunda flow to set the Content-Type for the async response + if (execution.getVariable("CMSO_is_srv_inst_req").equals("true") && + execution.getVariable("CMSO_is_json_content").equals("true")) { + execution.setVariable("CMSO_content_type", "application/json") + } else { + execution.setVariable("CMSO_content_type", "text/xml") + } + logDebug('Exited ' + method, isDebugLogEnabled) } catch (BpmnError e) { throw e; @@ -163,19 +164,19 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in " + method) } - utils.log("DEBUG", "*** Completed CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled); +// utils.log("DEBUG", "*** Completed CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled); } public void postProcessResponse (Execution execution) { - def method = getClass().getSimpleName() + '.sendResponse(' +'execution=' + execution.getId() +')' + def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - utils.log("DEBUG", "*** Started CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled); +// utils.log("DEBUG", "*** Started CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled); try { def msoCompletionResponse = """ - + BPEL ${execution.getVariable("CMSO_mso-bpel-name")} completed """.trim() @@ -200,98 +201,32 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { logError('Caught exception in ' + method, e) exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } - utils.log("DEBUG", "*** Completed CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled); +// utils.log("DEBUG", "*** Completed CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled); } - public void updateFinalNotifyAckStatusSuccessPayload (Execution execution){ - def method = getClass().getSimpleName() + '.sendResponse(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - try { - - def deliveryStatus = execution.getVariable("CMSO_deliveryStatus") - String responseStatus = "" - String responseCode = "" - String responseBodyXml = "" - - if(deliveryStatus == true){ - responseStatus = "SUCCESS" - responseCode = "200" - responseBodyXml = """${execution.getVariable("CMSO_gSendManagedNetworkStatusNotificationResponse")}""" - }else{ - responseStatus = "FAILED" - responseCode = execution.getVariable("CCDStatusCode") - } - - String payload = """ - - - - - ${execution.getVariable("CMSO_request_id")} - BPEL - ${responseStatus} - ${responseCode} - ${responseBodyXml} - - - """ - - execution.setVariable("CMSO_updateFinalNotifyAckStatusSuccessPayload", payload) - utils.logAudit("updateFinalNotifyAckStatusPayload: " + payload) - logDebug('Exited ' + method, isDebugLogEnabled) - - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - } - - - public String updateFinalStatusSuccessPayload (Execution execution){ - - def method = getClass().getSimpleName() + '.sendResponse(' +'execution=' + execution.getId() +')' + public void updateDBStatusToSuccessPayload (Execution execution){ + def method = getClass().getSimpleName() + '.updateDBStatusToSuccessPayload(' +'execution=' + execution.getId() +')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) + try { - String payload = """ - - - - - ${execution.getVariable("CMSO_request_id")} - BPEL - SUCCESS - - - - """ - execution.setVariable("CMSO_updateFinalStatusSuccessPayload", payload) - utils.logAudit("updateFinalStatusSuccessPayload: " + payload) - logDebug('Exited ' + method, isDebugLogEnabled) - //println("CMSO_updateFinalStatusSuccessPayload --> " + execution.getVariable("CMSO_updateFinalStatusSuccessPayload")) - - return execution.getVariable("CMSO_updateFinalStatusSuccessPayload") - - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + // Catalog DB headers Authorization + String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth") + utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled) + + def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey")) + execution.setVariable("BasicAuthHeaderValueDB",encodedString) + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } - } - - public void updateDBStatusToSuccessPayload (Execution execution){ - def method = getClass().getSimpleName() + '.sendResponse(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) + try { String payload = """ - + @@ -317,9 +252,22 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { public void setUpdateDBstatustoSuccessPayload (Execution execution){ - def method = getClass().getSimpleName() + '.sendResponse(' +'execution=' + execution.getId() +')' + def method = getClass().getSimpleName() + '.setUpdateDBstatustoSuccessPayload(' +'execution=' + execution.getId() +')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) + + try { + String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth") + utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled) + + def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey")) + execution.setVariable("BasicAuthHeaderValueDB",encodedString) + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + try { def xml = execution.getVariable("CompleteMsoProcessRequest") @@ -351,7 +299,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { utils.log("DEBUG", "Incoming Instance Id Xml: " + idXml, isDebugLogEnabled) String payload = """ - + @@ -378,104 +326,15 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor { logDebug('Exited ' + method, isDebugLogEnabled) } - public String updateFinalNotifyAckStatusPayload (Execution execution){ - - def method = getClass().getSimpleName() + '.sendResponse(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - try { - String payload = """ - - - - - ${execution.getVariable("CMSO_request_id")} - BPEL - SENDING_FINAL_NOTIFY - - - - """ - execution.setVariable("CMSO_setUpdateFinalNotifyAckStatusPayload", payload) - utils.logAudit("updateFinalNotifyAckStatusPayload: " + payload) - logDebug('Exited ' + method, isDebugLogEnabled) - - return execution.getVariable("CMSO_setUpdateFinalNotifyAckStatusPayload") - - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - - } - - // public void decryptMsoPassword (Execution execution) { - // - // def method = getClass().getSimpleName() + '.sendResponse(' +'execution=' + execution.getId() +')' - // def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - // logDebug('Entered ' + method, isDebugLogEnabled) - // try { - // def encryptedPwd=execution.getVariable("URN_mso_csi_pwd") - // def msoKey = execution.getVariable("URN_mso_msoKey") - // - // String basicAuthValue = utils.getBasicAuth(encryptedPwd, msoKey) - // execution.setVariable("BasicAuthHeaderValueCSI",basicAuthValue) - // logDebug('Exited ' + method, isDebugLogEnabled) - // } catch (BpmnError e) { - // throw e; - // } catch (IOException e) { - // logError('Caught exception in ' + method, e) - // workflowException(execution, 'Internal Error', 2000) - // } - // } - - public String notifyOMXSuccessFailureViaCSIPayload (Execution execution) { - - return ""; - } - - public String notifyCCDSuccessPayload (Execution execution) { - - def method = getClass().getSimpleName() + '.sendResponse(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - try { - - String payload =""" - - ${execution.getVariable("CMSO_request_id")} - ${execution.getVariable("CMSO_request_action")} - ${execution.getVariable("CMSO_source")} - Y - - """ - execution.setVariable("CMSO_notifyCCDSuccessPayload", payload) - utils.logAudit("notifyCCDSuccessPayload: " + payload) - logDebug('Exited ' + method, isDebugLogEnabled) - - return execution.getVariable("CMSO_notifyCCDSuccessPayload") - - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - - - } - public void buildDataError (Execution execution, String message) { - def method = getClass().getSimpleName() + '.sendResponse(' +'execution=' + execution.getId() +')' + def method = getClass().getSimpleName() + '.buildDataError(' +'execution=' + execution.getId() +')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) try { def msoCompletionResponse = """ - + BPEL ${execution.getVariable("CMSO_mso-bpel-name")} FAILED """.trim() diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy similarity index 86% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/ConfirmVolumeGroupName.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy index b13fff7ae9..0a6f251653 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/ConfirmVolumeGroupName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy @@ -18,16 +18,9 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts -import java.io.Serializable; - +package org.openecomp.mso.bpmn.common.scripts import org.camunda.bpm.engine.runtime.Execution - import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ @@ -65,7 +58,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ AaiUtil aaiUriUtil = new AaiUtil(this) def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution) logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - + utils.logAudit("AAI URI: " + aai_uri) execution.setVariable("CVGN_volumeGroupGetEndpoint","${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" + volumeGroupId) } @@ -75,26 +68,22 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ public void queryAAIForVolumeGroupId(Execution execution) { def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CVGN_volumeGroupGetEndpoint") - def aaiRequestId = UUID.randomUUID().toString() - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(endPoint); - utils.log("DEBUG","queryAAIForVolumeGroupId() endpoint-" + endPoint, isDebugLogEnabled) - def responseData = "" + try { - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO").addHeader("Content-Type", "application/xml"). - addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } logDebug("invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugLogEnabled) - APIResponse response = client.httpGet() - - responseData = response.getResponseBodyAsString() - execution.setVariable("CVGN_queryVolumeGroupResponseCode", response.getStatusCode()) + utils.log("DEBUG","queryAAIForVolumeGroupId() endpoint-" + endPoint, isDebugLogEnabled) + utils.logAudit("ConfirmVolumeGroup sending GET call to AAI Endpoint: " + endPoint) + + AaiUtil aaiUtil = new AaiUtil(this) + APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) + def responseData = response.getResponseBodyAsString() + def responseStatusCode = response.getStatusCode() + execution.setVariable("CVGN_queryVolumeGroupResponseCode", responseStatusCode) execution.setVariable("CVGN_queryVolumeGroupResponse", responseData) - logDebug("Response code:" + response.getStatusCode(), isDebugLogEnabled) + + utils.logAudit("Response code:" + responseStatusCode) + utils.logAudit("Response:" + responseData) + logDebug("Response code:" + responseStatusCode, isDebugLogEnabled) logDebug("Response:" + System.lineSeparator()+responseData,isDebugLogEnabled) } catch (Exception ex) { ex.printStackTrace() @@ -165,7 +154,4 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{ def responseXML = "" execution.setVariable("WorkflowResponse", responseXML) } - - - } diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy similarity index 94% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/ConfirmVolumeGroupTenant.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy index 45ffd5552f..bca2475a2f 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/ConfirmVolumeGroupTenant.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy @@ -18,31 +18,21 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts - -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig +package org.openecomp.mso.bpmn.common.scripts import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory -import javax.xml.transform.Transformer -import javax.xml.transform.TransformerFactory -import javax.xml.transform.TransformerException -import javax.xml.transform.dom.DOMSource -import javax.xml.transform.stream.StreamResult +import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution; +import org.camunda.bpm.engine.runtime.Execution +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse import org.w3c.dom.Document import org.w3c.dom.Element -import org.w3c.dom.NamedNodeMap import org.w3c.dom.Node -import org.w3c.dom.NodeList; +import org.w3c.dom.NodeList import org.xml.sax.InputSource -import org.apache.commons.codec.binary.Base64 -import org.apache.commons.lang3.* /** @@ -84,6 +74,9 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{ String response = queryAAIForVolumeGroupResponse.getResponseBodyAsString() response = StringEscapeUtils.unescapeXml(response) + utils.logAudit("ConfirmVolumeGroup Response: " + response) + utils.logAudit("ConfirmVolumeGroup Response Code: " + responseCode) + if(responseCode == 200 && response != null){ execution.setVariable("queryAAIVolumeGroupResponse", response) utils.log("DEBUG", "QueryAAIForVolumeGroup Received a Good REST Response is: \n" + response, isDebugEnabled) diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy similarity index 85% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateAAIVfModule.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy index ea01503811..39383609c8 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy @@ -18,17 +18,12 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts -import java.io.Serializable; - +package org.openecomp.mso.bpmn.common.scripts import org.camunda.bpm.engine.runtime.Execution -import org.springframework.web.util.UriUtils - -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig import org.openecomp.mso.bpmn.core.RollbackData import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse +import org.springframework.web.util.UriUtils public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ @@ -43,6 +38,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("CAAIVfMod_serviceId",null) execution.setVariable("CAAIVfMod_personaId",null) execution.setVariable("CAAIVfMod_personaVer",null) + execution.setVariable("CAAIVfMod_modelCustomizationId",null) execution.setVariable("CAAIVfMod_vnfPersonaId",null) execution.setVariable("CAAIVfMod_vnfPersonaVer",null) execution.setVariable("CAAIVfMod_isBaseVfModule", false) @@ -80,64 +76,75 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ // and VF Module data in the flow Execution public void preProcessRequest(Execution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def xml = execution.getVariable("CreateAAIVfModuleRequest") - utils.log("DEBUG", "input request xml:" + xml, isDebugEnabled) initProcessVariables(execution) - def vnfId = "" - if (utils.nodeExists(xml, "vnf-id")) { - vnfId = utils.getNodeText(xml,"vnf-id") - } - if (vnfId.isEmpty()) { + def vnfId = execution.getVariable("vnfId") + if (vnfId == null || vnfId.isEmpty()) { execution.setVariable("CAAIVfMod_newGenericVnf", true) + execution.setVariable("CAAIVfMod_vnfId","") } - execution.setVariable("CAAIVfMod_vnfId",vnfId) - - def vnfName = "" - if (utils.nodeExists(xml, "vnf-name")) { - vnfName = utils.getNodeText(xml,"vnf-name") + else { + execution.setVariable("CAAIVfMod_vnfId",vnfId) } + + def vnfName = execution.getVariable("vnfName") execution.setVariable("CAAIVfMod_vnfName", vnfName) - if (utils.nodeExists(xml, "vnf-type")) { - execution.setVariable("CAAIVfMod_vnfType",utils.getNodeText(xml,"vnf-type")) + String vnfType = execution.getVariable("vnfType") + if (vnfType != null && !vnfType.isEmpty()) { + execution.setVariable("CAAIVfMod_vnfType", vnfType) } else { execution.setVariable("CAAIVfMod_vnfType","") } - execution.setVariable("CAAIVfMod_serviceId",utils.getNodeText(xml,"service-id")) + execution.setVariable("CAAIVfMod_serviceId", execution.getVariable("serviceId")) + + String personaModelId = execution.getVariable("personaModelId") - if (utils.nodeExists(xml, "persona-model-id")) { - execution.setVariable("CAAIVfMod_personaId",utils.getNodeText(xml,"persona-model-id")) + if (personaModelId != null && !personaModelId.isEmpty()) { + execution.setVariable("CAAIVfMod_personaId",personaModelId) } else { execution.setVariable("CAAIVfMod_personaId","") } + + String personaModelVersion = execution.getVariable("personaModelVersion") - if (utils.nodeExists(xml, "persona-model-version")) { - execution.setVariable("CAAIVfMod_personaVer",utils.getNodeText(xml,"persona-model-version")) + if (personaModelVersion != null && !personaModelVersion.isEmpty()) { + execution.setVariable("CAAIVfMod_personaVer", personaModelVersion) } else { execution.setVariable("CAAIVfMod_personaVer","") } - if (utils.nodeExists(xml, "vnf-persona-model-id")) { - execution.setVariable("CAAIVfMod_vnfPersonaId",utils.getNodeText(xml,"vnf-persona-model-id")) + + String modelCustomizationId = execution.getVariable("modelCustomizationId") + + if (modelCustomizationId != null && !modelCustomizationId.isEmpty()) { + execution.setVariable("CAAIVfMod_modelCustomizationId",modelCustomizationId) + } else { + execution.setVariable("CAAIVfMod_modelCustomizationId","") + } + + String vnfPersonaModelId = execution.getVariable("vnfPersonaModelId") + + if (vnfPersonaModelId != null && !vnfPersonaModelId.isEmpty()) { + execution.setVariable("CAAIVfMod_vnfPersonaId",vnfPersonaModelId) } else { execution.setVariable("CAAIVfMod_vnfPersonaId","") } + + String vnfPersonaModelVersion = execution.getVariable("vnfPersonaModelVersion") - if (utils.nodeExists(xml, "vnf-persona-model-version")) { - execution.setVariable("CAAIVfMod_vnfPersonaVer",utils.getNodeText(xml,"vnf-persona-model-version")) + if (vnfPersonaModelVersion != null && !vnfPersonaModelVersion.isEmpty()) { + execution.setVariable("CAAIVfMod_vnfPersonaVer",vnfPersonaModelVersion) } else { execution.setVariable("CAAIVfMod_vnfPersonaVer","") } //isBaseVfModule Boolean isBaseVfModule = false - if (utils.nodeExists(xml, "is-base-vf-module")) { - String isBaseVfModuleString = utils.getNodeText(xml, "is-base-vf-module") - if (isBaseVfModuleString.equals("true")) { - isBaseVfModule = true - } + String isBaseVfModuleString = execution.getVariable("isBaseVfModule") + if (isBaseVfModuleString != null && isBaseVfModuleString.equals("true")) { + isBaseVfModule = true } execution.setVariable("CAAIVfMod_isBaseVfModule", isBaseVfModule) @@ -146,8 +153,8 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ logDebug("VID Request received", isDebugEnabled) } - execution.setVariable("CAAIVfMod_moduleName",utils.getNodeText(xml,"vf-module-name")) - execution.setVariable("CAAIVfMod_moduleModelName",utils.getNodeText(xml,"vf-module-model-name")) + execution.setVariable("CAAIVfMod_moduleName",execution.getVariable("vfModuleName")) + execution.setVariable("CAAIVfMod_moduleModelName",execution.getVariable("vfModuleModelName")) AaiUtil aaiUriUtil = new AaiUtil(this) def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) @@ -155,20 +162,19 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ String aaiNamespace = aaiUriUtil.getNamespaceFromUri(aai_uri) logDebug('AAI namespace is: ' + aaiNamespace, isDebugEnabled) - execution.setVariable("CAAIVfMod_aaiNamespace","${aaiNamespace}") - + execution.setVariable("CAAIVfMod_aaiNamespace","${aaiNamespace}") - if (vnfId.isEmpty()) { + if (vnfId == null || vnfId.isEmpty()) { // TBD - assert that the vnfName is not empty execution.setVariable("CAAIVfMod_genericVnfGetEndpoint", "${aai_uri}/?vnf-name=" + - UriUtils.encode(vnfName,"UTF-8")) + UriUtils.encode(vnfName,"UTF-8") + "&depth=1") } else { execution.setVariable("CAAIVfMod_genericVnfGetEndpoint", - "${aai_uri}/" + UriUtils.encode(vnfId,"UTF-8")) + "${aai_uri}/" + UriUtils.encode(vnfId,"UTF-8") + "?depth=1") } - + utils.logAudit("CreateAAIVfModule VNF PUT Endpoint: ${aai_uri}/") execution.setVariable("CAAIVfMod_genericVnfPutEndpoint","${aai_uri}/") } @@ -177,27 +183,22 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ public void queryAAIForGenericVnf(Execution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CAAIVfMod_genericVnfGetEndpoint") - def aaiRequestId = UUID.randomUUID().toString() - - RESTConfig config = new RESTConfig(endPoint); - utils.log("DEBUG","queryAAIForGenericVnf() endpoint-" + endPoint, isDebugEnabled) - def responseData = "" - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) try { - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO").addHeader("Content-Type", "application/xml"). - addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } + utils.log("DEBUG","queryAAIForGenericVnf() endpoint-" + endPoint, isDebugEnabled) utils.log("DEBUG", "invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugEnabled) - APIResponse response = client.httpGet() - - responseData = response.getResponseBodyAsString() - execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode", response.getStatusCode()) + utils.logAudit("CreateAAIVfModule sending GET call to AAI Endpoint: " + endPoint) + + AaiUtil aaiUtil = new AaiUtil(this) + APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) + def responseData = response.getResponseBodyAsString() + def statusCode = response.getStatusCode() + execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode", statusCode) execution.setVariable("CAAIVfMod_queryGenericVnfResponse", responseData) - utils.log("DEBUG", "Response code:" + response.getStatusCode(), isDebugEnabled) + + utils.logAudit("CreateAAIVfModule Response Code: " + statusCode) + utils.logAudit("CreateAAIVfModule Response data: " + responseData) + utils.log("DEBUG", "Response code:" + statusCode, isDebugEnabled) utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled) } catch (Exception ex) { ex.printStackTrace() @@ -238,16 +239,13 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ // note: to get here, the vnf-id in the original CREATE_VF_MODULE request was absent or "" public void createGenericVnf(Execution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def aaiRequestId = UUID.randomUUID().toString() // TBD - is this how we want to generate the Id for the new Generic VNF? def newVnfId = UUID.randomUUID().toString() def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CAAIVfMod_genericVnfPutEndpoint") + newVnfId // update the flow execution with the new Vnf Id execution.setVariable("CAAIVfMod_vnfId",newVnfId) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - + // AaiUriUtil aaiUriUtil = new AaiUriUtil(this) // def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) // logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) @@ -266,22 +264,21 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ """ as String execution.setVariable("CAAIVfMod_createGenericVnfPayload", payload) - RESTConfig config = new RESTConfig(endPoint); - utils.log("DEBUG","createGenericVnf() endpoint-" + endPoint, isDebugEnabled) - def responseData = "" try { - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO").addHeader("Content-Type", "application/xml"). - addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } + utils.log("DEBUG","createGenericVnf() endpoint-" + endPoint, isDebugEnabled) utils.log("DEBUG", "invoking PUT call to AAI with payload:"+System.lineSeparator()+payload,isDebugEnabled) - APIResponse response = client.httpPut(payload) - - responseData = response.getResponseBodyAsString() - execution.setVariable("CAAIVfMod_createGenericVnfResponseCode", response.getStatusCode()) + utils.logAudit("Sending PUT call to AAI with Endpoint /n" + endPoint + " with payload /n" + payload) + + AaiUtil aaiUtil = new AaiUtil(this); + APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload); + def responseData = response.getResponseBodyAsString() + def responseStatusCode = response.getStatusCode() + execution.setVariable("CAAIVfMod_createGenericVnfResponseCode", responseStatusCode) execution.setVariable("CAAIVfMod_createGenericVnfResponse", responseData) - utils.log("DEBUG", "Response code:" + response.getStatusCode(), isDebugEnabled) + + utils.logAudit("Response Code: " + responseStatusCode) + utils.logAudit("Response Data: " + responseData) + utils.log("DEBUG", "Response code:" + responseStatusCode, isDebugEnabled) utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled) } catch (Exception ex) { ex.printStackTrace() @@ -305,9 +302,6 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ // need to append the existing Vnf Id or the one generated in createGenericVnf() to the url endPoint = endPoint + UriUtils.encode(execution.getVariable("CAAIVfMod_vnfId"), "UTF-8") + "/vf-modules/vf-module/" + newModuleId; - def aaiRequestId = UUID.randomUUID().toString() - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) // if we get to this point, we may be about to create the Vf Module, // add rollback information about the Generic VNF for this base/add-on module @@ -325,32 +319,31 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ ${execution.getVariable("CAAIVfMod_moduleName")} ${execution.getVariable("CAAIVfMod_personaId")} ${execution.getVariable("CAAIVfMod_personaVer")} + ${execution.getVariable("CAAIVfMod_modelCustomizationId")} ${isBaseModule} pending-create """ as String execution.setVariable("CAAIVfMod_createVfModulePayload", payload) - RESTConfig config = new RESTConfig(endPoint); - utils.log("DEBUG","createVfModule() endpoint-" + endPoint, isDebugEnabled) - def responseData = "" try { - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO").addHeader("Content-Type", "application/xml"). - addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } + utils.log("DEBUG","createVfModule() endpoint-" + endPoint, isDebugEnabled) utils.log("DEBUG", "invoking PUT call to AAI with payload:"+System.lineSeparator()+payload,isDebugEnabled) - APIResponse response = client.httpPut(payload) - - responseData = response.getResponseBodyAsString() - execution.setVariable("CAAIVfMod_createVfModuleResponseCode", response.getStatusCode()) + utils.logAudit("CreateAAIVfModule sending PUT call to AAI with endpoint /n" + endPoint + " with payload /n " + payload) + + AaiUtil aaiUtil = new AaiUtil(this) + APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload) + def responseData = response.getResponseBodyAsString() + def statusCode = response.getStatusCode() + execution.setVariable("CAAIVfMod_createVfModuleResponseCode", statusCode) execution.setVariable("CAAIVfMod_createVfModuleResponse", responseData) - utils.log("DEBUG", "Response code:" + response.getStatusCode(), isDebugEnabled) + + utils.log("DEBUG", "Response code:" + statusCode, isDebugEnabled) utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled) - + utils.logAudit("Response Code: " + statusCode) + utils.logAudit("Response data: " + responseData) // the base or add-on VF Module was successfully created, // add the module name to the rollback data and the response - if (isOneOf(response.getStatusCode(), 200, 201)) { + if (isOneOf(statusCode, 200, 201)) { rollbackData.put("VFMODULE", "vfModuleId", newModuleId) rollbackData.put("VFMODULE", "vfModuleName", execution.getVariable("CAAIVfMod_moduleName")) execution.setVariable("RollbackData", rollbackData) @@ -377,6 +370,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("CreateAAIVfModuleResponse", responseOut) utils.log("DEBUG", "CreateAAIVfModuleResponse:" + System.lineSeparator()+responseOut,isDebugEnabled) + utils.logAudit("CreateAAIVfModule Response /n " + responseOut) } } catch (Exception ex) { ex.printStackTrace() @@ -544,6 +538,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ String processKey = getProcessKey(execution); WorkflowException exception = new WorkflowException(processKey, errorCode, errorResponse) execution.setVariable("WorkflowException", exception) + utils.logAudit("Workflow exception occurred in CreateAAIVfModule: " + errorResponse) } /** @@ -566,6 +561,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{ AaiUtil aaiUriUtil = new AaiUtil(this) def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) + utils.logAudit("CreateAAIVfModule rollback AAI URI: " + aai_uri) if (rollbackData != null) { if (rollbackData.hasType("VFMODULE")) { diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateAAIVfModuleVolumeGroup.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy similarity index 95% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateAAIVfModuleVolumeGroup.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy index 51e77a813d..03a8596f20 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateAAIVfModuleVolumeGroup.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy @@ -18,22 +18,11 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts - -import groovy.util.Node -import groovy.util.XmlParser; -import groovy.xml.QName - -import java.io.Serializable; +package org.openecomp.mso.bpmn.common.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution - import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor { @@ -72,6 +61,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor { try { def xml = execution.getVariable('CreateAAIVfModuleVolumeGroupRequest') logDebug('Received request xml:\n' + xml, isDebugLogEnabled) + utils.logAudit("CreateAAIVfModuleVolume Received Request XML: " + xml) initProcessVariables(execution) def vnfId = getRequiredNodeText(execution, xml,'vnf-id') @@ -120,10 +110,14 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor { try { logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) + utils.logAudit("aaiResponse GET TO AAI Endpoint: " + endPoint) APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) def responseData = response.getResponseBodyAsString() execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', response.getStatusCode()) execution.setVariable('CAAIVfModVG_getVfModuleResponse', responseData) + + utils.logAudit("CreateAAIVfModule Response Code: " + response.getStatusCode()) + utils.logAudit("CreateAAIVfModule Response: " + response) logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) } catch (Exception ex) { @@ -182,11 +176,15 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor { String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + URLEncoder.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + URLEncoder.encode(vfModuleId, "UTF-8") try { + utils.logAudit("CreateAAIVfModuleVolume Sendind PUT to AAI Endpoint \n " + endPoint + " with payload \n " + payload) logDebug('sending PUT to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled) APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload) def responseData = response.getResponseBodyAsString() execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', response.getStatusCode()) execution.setVariable('CAAIVfModVG_updateVfModuleResponse', responseData) + + utils.logAudit("CreateAAIVfModule Response code: " + response.getStatusCode()) + utils.logAudit("CreateAAIVfModule Response: " + responseData) logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) } catch (Exception ex) { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateGenericVNFUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateGenericVNFUtils.groovy new file mode 100644 index 0000000000..ffc706d263 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateGenericVNFUtils.groovy @@ -0,0 +1,280 @@ +/*- + * ============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.common.scripts + +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; + +import org.camunda.bpm.engine.runtime.Execution; +import org.camunda.bpm.engine.delegate.BpmnError + +/** + * Please describe the CreateGenericVNFUtils.groovy class + * + */ +class CreateGenericVNFUtils{ + + String Prefix="CRTGVNF_" + + def utils=new MsoUtils() + + private AbstractServiceTaskProcessor taskProcessor + + public CreateGenericVNFUtils(AbstractServiceTaskProcessor taskProcessor) { + this.taskProcessor = taskProcessor + } + + /** + * This method is executed during the Initialization task of the process. + * + * @param execution + * + */ + + public APIResponse queryAAI(Execution execution, String path){ + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + utils.log("DEBUG", " ======== STARTED queryAAI Process ======== ", isDebugEnabled) + + def uuid = execution.getVariable("CRTGVNF_uuid") + utils.log("DEBUG", "UUID is: " + uuid, isDebugEnabled) + + //Setting request path + String queryAAIRequestPath = execution.getVariable("URN_aai_endpoint")+path +// execution.setVariable("CRTGVNF_queryAAIRequestPath", queryAAIRequestPath) + utils.log("DEBUG", "QueryAAIRequest Path is: " + "\n" + queryAAIRequestPath, isDebugEnabled) + + try { + AaiUtil aaiUtil = new AaiUtil(taskProcessor) + return aaiUtil.executeAAIGetCall(execution, queryAAIRequestPath) + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing queryAAI. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CRTGVNF_dataValidationFlag", false) + execution.setVariable("CRTGVNF_ErrorResponse", "Error Occured during queryAAI Method:\n" + e.getMessage()) + } + utils.log("DEBUG", "======== COMPLETED queryAAI Process ======== ", isDebugEnabled) +} + + public String buildSDNCRequest(Execution execution, String svcInstId, String action){ + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("att-mso-request-id") + "-" + System.currentTimeMillis() + } + def callbackURL = execution.getVariable("CRTGVNF_sdncCallbackUrl") + def requestId = execution.getVariable("CRTGVNF_requestId") + def serviceType = execution.getVariable("CRTGVNF_serviceType") + def vnfType = execution.getVariable("CRTGVNF_vnfType") + def vnfName = execution.getVariable("CRTGVNF_vnfName") + def tenantId = execution.getVariable("CRTGVNF_tenantId") + def source = execution.getVariable("CRTGVNF_source") + String vnfId = svcInstId + String sdncVNFParamsXml = "" + + if(execution.getVariable("CRTGVNF_vnfParamsExistFlag") == true){ + sdncVNFParamsXml = buildSDNCParamsXml(execution) + }else{ + sdncVNFParamsXml = "" + } + + String sdncRequest = + """ + + ${uuid} + ${svcInstId} + ${action} + vnf-topology-operation + ${callbackURL} + + + + ${requestId} + VNFActivateRequest + ${source} + + + ${serviceType} + ${vnfId} + notsurewecare + + + ${vnfId} + ${vnfType} + ${vnfName} + ${tenantId} +${sdncVNFParamsXml} + + + """ + + return sdncRequest + + } + + public String buildSDNCParamsXml(Execution execution){ + + String params = "" + StringBuilder sb = new StringBuilder() + Map paramsMap = execution.getVariable("CRTGVNF_vnfParamsMap") + + for (Map.Entry entry : paramsMap.entrySet()) { + String paramsXml + String key = entry.getKey(); + if(key.endsWith("_network")){ + String requestKey = key.substring(0, key.indexOf("_network")) + String requestValue = entry.getValue() + paramsXml = +""" + { functx:substring-before-match(data($param/@name), '_network') } + { $param/text() } +""" + }else{ + paramsXml = "" + } + params = sb.append(paramsXml) + } + return params + } + + /** + * Builds a "CompletionHandler" request and stores it in the specified + * execution variable. + * @param execution the execution + */ + public void buildCompletionHandlerRequest(Execution execution, String flowName) { + def method = getClass().getSimpleName() + '.completionHandlerPrep(' + + 'execution=' + execution.getId() + + ')' + def prefix = execution.getVariable('prefix') + def resultVar = prefix + "CompletionHandlerRequest" + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def request = taskProcessor.getVariable(execution, prefix+'Request') + def requestInformation = taskProcessor.utils.getNodeXml(request, 'request-information', false) + if (requestInformation == null || requestInformation == ""){ + requestInformation = taskProcessor.utils.getNodeXml(request, 'request-info', false) + } + + String content = """ + + ${requestInformation} + ${flowName} + + """ + + content = taskProcessor.utils.removeXmlPreamble(taskProcessor.utils.formatXML(content)) + taskProcessor.logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) + execution.setVariable(resultVar, content) + + taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + taskProcessor.logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error Occured during completion handler request") + } + } + + /** + * Builds a "FalloutHandler" request and stores it in the specified + * execution variable. + * @param execution the execution + */ + public void buildfalloutHandlerRequest(Execution execution) { + def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + + 'execution=' + execution.getId() + + ')' + def prefix = execution.getVariable('prefix') + def resultVar = prefix + "FalloutHandlerRequest" + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) + try { + def request = taskProcessor.getVariable(execution, prefix+'Request') + + def requestInformation = "" + if (request != null){ + requestInformation = taskProcessor.utils.getNodeXml(request, 'request-information', false) + if (requestInformation == null || requestInformation == ""){ + requestInformation = taskProcessor.utils.getNodeXml(request, 'request-info', false) + } + } + def errorInformation = "" + def encErrorResponseMsg = "" + def errorResponseCode = "" + String content = "" + + def WorkflowException workflowException + def exception = execution.getVariable("WorkflowException") + + if (exception instanceof WorkflowException) + { + workflowException = execution.getVariable("WorkflowException") + } + + if (workflowException != null){ + errorResponseCode = workflowException.getErrorCode() + def errorResponseMsg = workflowException.getErrorMessage() + + if (errorResponseMsg != null) { + encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">") + } + + errorInformation = """ + ${encErrorResponseMsg} + ${errorResponseCode} + """ + } + else { + errorInformation = execution.getVariable(prefix+'ErrorResponse') + + if (errorInformation == null) errorInformation = "" + } + + content = """ + + ${requestInformation} + ${errorInformation} + + """ + + content = taskProcessor.utils.removeXmlPreamble(taskProcessor.utils.formatXML(content)) + + taskProcessor.logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) + execution.setVariable(resultVar, content) + taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) + } catch (Exception e) { + taskProcessor.logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error in buildfalloutHandlerRequest") + } + } + +} + + + + + diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy similarity index 90% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteAAIVfModule.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy index 0e5360de7f..ca9a2e0849 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy @@ -18,16 +18,10 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts -import java.io.Serializable; - +package org.openecomp.mso.bpmn.common.scripts import org.camunda.bpm.engine.runtime.Execution - -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.core.RollbackData import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ @@ -56,7 +50,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode",null) execution.setVariable("DAAIVfMod_deleteVfModuleResponse","") - } + } // parse the incoming DELETE_VF_MODULE request and store the Generic Vnf // and Vf Module Ids in the flow Execution @@ -68,7 +62,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ initProcessVariables(execution) def vnfId = utils.getNodeText(xml,"vnf-id") def vfModuleId = utils.getNodeText(xml,"vf-module-id") - execution.setVariable("DAAIVfMod_vnfId", vnfId) + execution.setVariable("DAAIVfMod_vnfId", vnfId) execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId) AaiUtil aaiUriUtil = new AaiUtil(this) @@ -85,24 +79,18 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ public void queryAAIForGenericVnf(Execution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId") - def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + "?depth=1" utils.logAudit("DeleteAAIVfModule endPoint: " + endPoint) def aaiRequestId = UUID.randomUUID().toString() - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(endPoint); utils.log("DEBUG","queryAAIForGenericVnf() endpoint-" + endPoint, isDebugEnabled) def responseData = "" try { - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO"). - addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } utils.log("DEBUG", "invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugEnabled) - APIResponse response = client.httpGet() utils.logAudit("DeleteAAIVfModule - invoking httpGet to AAI") + + AaiUtil aaiUtil = new AaiUtil(this) + APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) responseData = response.getResponseBodyAsString() execution.setVariable("DAAIVfMod_queryGenericVnfResponseCode", response.getStatusCode()) @@ -126,19 +114,11 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + "/?resource-version=" + execution.getVariable("DAAIVfMod_genVnfRsrcVer") utils.logAudit("AAI endPoint: " + endPoint) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(endPoint); utils.log("DEBUG","deleteGenericVnf() endpoint-" + endPoint, isDebugEnabled) def responseData = "" try { - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO"). - addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.httpDelete() + AaiUtil aaiUtil = new AaiUtil(this) + APIResponse response = aaiUtil.executeAAIDeleteCall(execution, endPoint) responseData = response.getResponseBodyAsString() execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", response.getStatusCode()) @@ -150,7 +130,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ utils.log("DEBUG", "Exception occurred while executing AAI DELETE:" + ex.getMessage(),isDebugEnabled) execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", 500) execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", "AAI DELETE Failed:" + ex.getMessage()) - } + } } // construct and send a DELETE request to A&AI to delete the Base or Add-on Vf Module @@ -160,18 +140,12 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ "/?resource-version=" + execution.getVariable("DAAIVfMod_vfModRsrcVer") def aaiRequestId = UUID.randomUUID().toString() - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(endPoint); utils.log("DEBUG","deleteVfModule() endpoint-" + endPoint, isDebugEnabled) def responseData = "" try { - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO"). - addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.httpDelete() + AaiUtil aaiUtil = new AaiUtil(this) + APIResponse response = aaiUtil.executeAAIDeleteCall(execution, endPoint) + utils.logAudit("DeleteAAIVfModule - invoking httpDelete to AAI") responseData = response.getResponseBodyAsString() @@ -186,7 +160,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ utils.log("DEBUG", "Exception occurred while executing AAI PUT:" + ex.getMessage(),isDebugEnabled) execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode", 500) execution.setVariable("DAAIVfMod_deleteVfModuleResponse", "AAI PUT Failed:" + ex.getMessage()) - } + } } // parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module @@ -205,7 +179,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("DAAIVfMod_moduleExists", false) execution.setVariable("DAAIVfMod_isBaseModule", false) execution.setVariable("DAAIVfMod_isLastModule", false) - // + // def isBaseVfModule = "false" // loop through the Vf Module Ids looking for a match if (qryModuleIdList != null && !qryModuleIdList.empty) { @@ -267,7 +241,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("DAAIVfMod_parseModuleResponse", "Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " + execution.getVariable("DAAIVfMod_vnfName")) - } + } } // parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module @@ -279,7 +253,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ utils.logAudit("DeleteAAIVfModule - queryGenericVnfResponse" + xml) String resourceVer = utils.getNodeText1(xml, "resource-version") execution.setVariable("DAAIVfMod_genVnfRsrcVer", resourceVer) - utils.log("DEBUG", "Latest Generic VNF Resource Version: " + resourceVer) + utils.log("DEBUG", "Latest Generic VNF Resource Version: " + resourceVer) } @@ -357,4 +331,4 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{ execution.getVariable("DAAIVfMod_deleteGenericVnfResponse")) execution.setVariable("WorkflowException", exception) } -} +} \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy similarity index 80% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/ExceptionUtil.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy index 2f32367e5d..fb68f4efe9 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/ExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy @@ -18,15 +18,14 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.common.scripts -import org.openecomp.mso.bpmn.core.WorkflowException +import static org.apache.commons.lang3.StringUtils.* +import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution -import org.apache.commons.lang3.* - -import static org.apache.commons.lang3.StringUtils.*; +import org.openecomp.mso.bpmn.core.WorkflowException /** * @version 1.0 @@ -74,7 +73,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { String modifiedErrorMessage = 'Received error from A&AI (' + text +')' utils.log("DEBUG", "ModifiedErrorMessage " + modifiedErrorMessage, isDebugEnabled) // let $ModifiedErrorMessage := concat( 'Received error from A',$exceptionaai:ampersand,'AI (' ,functx:replace-multi($ErrorMessage,$from,$Variables ),')') - String message = """ + String message = """ $modifiedErrorMessage $errorCode """ @@ -86,7 +85,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { errorCode = MapErrorCode(errorMsg) String mappedErrorMessage = MapErrorMessage(errorMsg, errorCode) - String message = """ + String message = """ $mappedErrorMessage $errorCode """ @@ -253,7 +252,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { */ @Deprecated String buildWorkflowExceptionXml(String errorCode, String errorMessage) { - return """ + return """ ${errorMessage} ${errorCode} """ @@ -276,14 +275,14 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { String mes = wfex.getErrorMessage() int code = wfex.getErrorCode() xml = - """ + """ ${mes} ${code} """ }else{ xml = - """ + """ Internal Error 2500 """ @@ -315,12 +314,14 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { if(errorMessage == null){ errorMessage="" } - if( errorCode.equals('5010')) - return 'Could not communicate with A&AI' - else if (errorCode.equals('5020')) + if( errorCode.equals('5010')) { + return 'Could not communicate with A&AI' + } else if (errorCode.equals('5020')) { return 'No response from A&AI' - else + } else { + errorMessage = errorMessage.replace("&", "&").replace("<", "<").replace(">", ">") return 'Received error from A&AI (' +errorMessage +')' + } } String MapCategoryToErrorCode(String errorCategory) @@ -451,11 +452,11 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { int errorCode = wfex.getErrorCode() String falloutHandlerRequest = - """ + """ ${requestInfo} - + ${errorMessage} ${errorCode} @@ -473,6 +474,73 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { utils.log("DEBUG", "Completed ProcessMainflowBPMNException Method", isDebugEnabled) } + /** + * + * This method should only be used by DHV Flows. This method is + * executed after an MSOWorkflowException is caught by a Mainflow. + * It builds and returns a FalloutHandler Request. It also + * verifies the WorkflowException variable is populated. + * + * @param - execution + * @param - requestInfo + * + * @return - falloutHandlerRequest + * + */ + public String processMainflowsBPMNExceptionDHV(Execution execution, String requestId, def source, def action, def notificationUrl, def serviceInstanceId, def startTime){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + String processKey = getProcessKey(execution) + try{ + utils.log("DEBUG", "Started ProcessMainflowBPMNExceptionDHV Method", isDebugEnabled) + + def WorkflowException workflowException = execution.getVariable("WorkflowException") + int errorResponseCode = 0 + def errorResponseMsg = "" + if(workflowException != null){ + errorResponseCode = workflowException.getErrorCode() + def errorMsg = workflowException.getErrorMessage() + if (errorMsg != null) { + errorResponseMsg = errorMsg.replace("&", "&").replace("<", "<").replace(">", ">") + } + }else{ + errorResponseCode = 2500 + errorResponseMsg = "Internal Error occured during " + action + ", unable to retrieve error information." + } + + + String request = + """ + + ${requestId} + ${action} + ${source} + ${notificationUrl} + + BPMN + true + JSON + ${serviceInstanceId} + ${startTime} + + ${errorResponseMsg} + ${errorResponseCode} + + """ + + + request = utils.formatXml(request) + utils.log("DEBUG", processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled) + utils.log("DEBUG", processKey + " Outgoing FalloutHandler Request is: " + request, isDebugEnabled) + + return request + + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during ProcessMainflowBPMNException Method: " + e, isDebugEnabled) + return null + } + utils.log("DEBUG", "Completed ProcessMainflowBPMNExceptionDHV Method", isDebugEnabled) + } + /** * This method is executed after an Java Exception is caught. * It sets the WorkflowException variable and throws an MSOWorkflowException. @@ -480,6 +548,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { * @param - execution * */ + @Deprecated public void processSubflowsJavaException(Execution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") String processKey = getProcessKey(execution) @@ -497,13 +566,34 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) } + /** + * + * This method is executed after an Java Exception is caught + * It sets the WorkflowException variable. The method can be used in either mainflow or subflows. + * + * @param - execution + * + */ + public void processJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + String processKey = getProcessKey(execution) + try{ + utils.log("DEBUG", "Caught a Java Exception in " + processKey, isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + buildWorkflowException(execution, 2500, "Catch a Java Lang Exception in " + processKey) - public void preProcessRequest(Execution execution) { - // TODO Auto-generated method stub - + }catch(BpmnError b){ + throw b + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + buildWorkflowException(execution, 2500, "Internal Error - During Process Java Exception") + } + utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) } + public void preProcessRequest(Execution execution) { + // TODO Auto-generated method stub - + } } diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy similarity index 68% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/FalloutHandler.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy index eefcf47e1b..62bf7be5ec 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/FalloutHandler.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.common.scripts import java.text.SimpleDateFormat @@ -26,18 +26,17 @@ import org.apache.commons.lang3.* import org.camunda.bpm.engine.runtime.Execution public class FalloutHandler extends AbstractServiceTaskProcessor { - String Prefix="FH_" ExceptionUtil exceptionUtil = new ExceptionUtil() - + public initializeProcessVariables(Execution execution){ def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - + try { execution.setVariable("prefix",Prefix) - + //These variables are form the input Message to the BPMN execution.setVariable("FH_request_id","") execution.setVariable("FH_request_action","") @@ -51,74 +50,81 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { //These variables are for Get Mso Aai Password Adapter execution.setVariable("FH_deliveryStatus", true) - - //Notify CSI Adapter variables - execution.setVariable("FH_notifyCSIPayload", "") - execution.setVariable("FH_notifyCSIResponseCode", null) - execution.setVariable("FH_notifyCSIResponse", "") - + //update Response Status to pending ...Adapter variables execution.setVariable("FH_updateResponseStatusPayload", null) execution.setVariable("FH_updateResponseStatusResponse", null) - + //update Request Gamma ...Adapter variables execution.setVariable("FH_updateRequestGammaPayload", "") execution.setVariable("FH_updateRequestGammaResponse", null) execution.setVariable("FH_updateRequestGammaResponseCode", null) - + //update Request Infra ...Adapter variables execution.setVariable("FH_updateRequestInfraPayload", "") execution.setVariable("FH_updateRequestInfraResponse", null) execution.setVariable("FH_updateRequestInfraResponseCode", null) - + //assign True to success variable execution.setVariable("FH_success", true) - + //Set notify status to Failed variable execution.setVariable("FH_NOTIFY_STATUS", "SUCCESS") - + //Set DB update variable execution.setVariable("FH_updateRequestPayload", "") execution.setVariable("FH_updateRequestResponse", null) execution.setVariable("FH_updateRequestResponseCode", null) - + //Auth variables execution.setVariable("BasicAuthHeaderValue","") - + //Parameter list execution.setVariable("FH_parameterList", "") - + //Response variables execution.setVariable("FalloutHandlerResponse","") execution.setVariable("FH_ErrorResponse", null) execution.setVariable("FH_ResponseCode", "") - + } catch (Exception e) { logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) } } - + public void preProcessRequest (Execution execution) { def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - + // Initialize flow variables initializeProcessVariables(execution) setSuccessIndicator(execution, false) - + + try { + String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth") + utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled) + + def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey")) + execution.setVariable("BasicAuthHeaderValueDB",encodedString) + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + try { def xml = execution.getVariable("FalloutHandlerRequest") utils.log("DEBUG", " XML --> " + xml, isDebugLogEnabled) utils.logAudit("FalloutHandler request: " + xml) - + //Check the incoming request type //Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node) if (utils.nodeExists(xml, "request-information")) { execution.setVariable("FH_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS } - + //Check notification-url for the incoming request type //ACTIVE_REQUESTS may have notificationurl node //INFRA_ACTIVE_REQUESTS notificationurl node does not exist @@ -126,11 +132,12 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { if (utils.nodeExists(xml, "notification-url")) { notificationurl = utils.getNodeText(xml,"notification-url") if(notificationurl != null && !notificationurl.isEmpty()) { + utils.log("DEBUG", "********** Incoming notification Url is: " + notificationurl,isDebugLogEnabled); execution.setVariable("FH_notification-url-Ok", true) execution.setVariable("FH_notification-url",notificationurl) } } - + //Check request_id for the incoming request type //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not) //For ACTIVE_REQUESTS payload request-id is NOT optional @@ -139,7 +146,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { execution.setVariable("FH_request_id",utils.getNodeText(xml,"request-id")) } utils.logAudit("FH_request_id: " + execution.getVariable("FH_request_id")) - + // INFRA_ACTIVE_REQUESTS have "action" element ... mandatory // ACTIVE_REQUEST have "request-action" ... mandatory if (utils.nodeExists(xml, "request-action")) { @@ -147,8 +154,8 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { } else if (utils.nodeExists(xml, "action")) { execution.setVariable("FH_request_action",utils.getNodeText(xml,"action")) } - - + + //Check source for the incoming request type //For INFRA_ACTIVE_REQUESTS payload source IS optional //For ACTIVE_REQUESTS payload source is NOT optional @@ -156,7 +163,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { if (utils.nodeExists(xml, "source")) { execution.setVariable("FH_source",utils.getNodeText(xml,"source")) } - + //Check if ErrorCode node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above. def errorCode = "" if (utils.nodeExists(xml, "ErrorCode")) { @@ -166,7 +173,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { } } utils.logAudit("FH_ErrorCode: " + errorCode) - + //Check if ErrorMessage node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above. def errorMessage = "" if (utils.nodeExists(xml, "ErrorMessage")) { @@ -176,197 +183,178 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { execution.setVariable("FH_ErrorMessage", errorCode) } } - + //Check for Parameter List if (utils.nodeExists(xml, "parameter-list")) { def parameterList = utils.getNodeXml(xml, "parameter-list", false) execution.setVariable("FH_parameterList", parameterList) } - + utils.log("DEBUG","FH_notification-url-Ok --> " + execution.getVariable("FH_notification-url-Ok"),isDebugLogEnabled) utils.log("DEBUG","FH_request_id-OK --> " + execution.getVariable("FH_request_id-Ok"),isDebugLogEnabled) - + + // set the DHV/Service Instantiation values if specified in the request + execution.setVariable("FH_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText1(xml, "is-srv-inst-req")))) + utils.log("DEBUG", "FH_is_srv_inst_req --> " + execution.getVariable("FH_is_srv_inst_req"), isDebugLogEnabled) + execution.setVariable("FH_is_json_content", String.valueOf("JSON".equals(utils.getNodeText1(xml, "resp-content-type")))) + utils.log("DEBUG", "FH_is_json_content --> " + execution.getVariable("FH_is_json_content"), isDebugLogEnabled) + execution.setVariable("FH_service_inst_id", utils.getNodeText1(xml, "service-instance-id")) + utils.log("DEBUG", "FH_service_inst_id --> " + execution.getVariable("FH_service_inst_id"), isDebugLogEnabled) + execution.setVariable("FH_start_time", utils.getNodeText1(xml, "start-time")) + utils.log("DEBUG", "FH_start_time --> " + execution.getVariable("FH_start_time"), isDebugLogEnabled) + // this variable is used by the camunda flow to set the Content-Type for the async response + if (execution.getVariable("FH_is_srv_inst_req").equals("true") && + execution.getVariable("FH_is_json_content").equals("true")) { + execution.setVariable("FH_content_type", "application/json") + } else { + execution.setVariable("FH_content_type", "text/xml") + } } catch (Exception e) { logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } - + utils.log("DEBUG","OUTOF --> Initialize Variables Fallout Handler #########",isDebugLogEnabled); } - + public String updateRequestPayload (Execution execution){ def method = getClass().getSimpleName() + '.updateRequestPayload(' +'execution=' + execution.getId() +')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - + try { String payload = """ - - - - - ${execution.getVariable("FH_request_id")} - BPEL - ${execution.getVariable("FH_ErrorMessage")} - ${execution.getVariable("FH_ErrorCode")} - FAILED - ${execution.getVariable("FH_NOTIFY_STATUS")} - - - - """ - + + + + + ${execution.getVariable("FH_request_id")} + BPEL + ${execution.getVariable("FH_ErrorMessage")} + ${execution.getVariable("FH_ErrorCode")} + FAILED + ${execution.getVariable("FH_NOTIFY_STATUS")} + + + + """ + utils.logAudit("updateRequestPayload: " + payload) execution.setVariable("FH_updateRequestPayload", payload) return execution.getVariable("FH_updateRequestPayload") } catch (Exception e) { logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) } } - + public String updateRequestInfraPayload (Execution execution){ def method = getClass().getSimpleName() + '.updateRequestInfraPayload(' +'execution=' + execution.getId() +')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - + try { String payload = """ - - - - - ${execution.getVariable("FH_request_id")} - BPEL - ${execution.getVariable("FH_ErrorMessage")} - FAILED - 100 - - - - """ - + + + + + ${execution.getVariable("FH_request_id")} + BPEL + ${execution.getVariable("FH_ErrorMessage")} + FAILED + 100 + + + + """ + execution.setVariable("FH_updateRequestInfraPayload", payload) utils.logAudit("updateRequestInfraPayload: " + payload) return execution.getVariable("FH_updateRequestInfraPayload") } catch (Exception e) { logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) } } - + public String updateRequestGammaPayload (Execution execution){ def method = getClass().getSimpleName() + '.updateRequestGammaPayload(' +'execution=' + execution.getId() +')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - + try { String payload = """ - - - - - ${execution.getVariable("FH_request_id")} - BPEL - ${execution.getVariable("FH_ErrorMessage")} - ${execution.getVariable("FH_ErrorCode")} - FAILED - - - - """ - + + + + + ${execution.getVariable("FH_request_id")} + BPEL + ${execution.getVariable("FH_ErrorMessage")} + ${execution.getVariable("FH_ErrorCode")} + FAILED + + + + """ + execution.setVariable("FH_updateRequestGammaPayload", payload) utils.logAudit("updateRequestGammaPayload: " + payload) return execution.getVariable("FH_updateRequestGammaPayload") } catch (Exception e) { logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) } } - + public String updateResponseStatusPayload (Execution execution){ def method = getClass().getSimpleName() + '.updateResponseStatusPayload(' +'execution=' + execution.getId() +')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - + try { String payload = """ - - - - - ${execution.getVariable("FH_request_id")} - BPEL - SENDING_FINAL_NOTIFY - - - - """ - + + + + + ${execution.getVariable("FH_request_id")} + BPEL + SENDING_FINAL_NOTIFY + + + + """ + execution.setVariable("FH_updateResponseStatusPayload", payload) utils.logAudit("updateResponseStatusPayload: " + payload) return execution.getVariable("FH_updateResponseStatusPayload") } catch (Exception e) { logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) - } - } - - public String notifyCSIPayload (Execution execution) { - return ""; - } - - public String notifyCCDFailurePayload (Execution execution) { - def method = getClass().getSimpleName() + '.notifyCCDFailurePayload(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def parameterList = execution.getVariable('FH_parameterList') - String payload =""" - - ${execution.getVariable("FH_request_id")} - ${execution.getVariable("FH_request_action")} - ${execution.getVariable("FH_source")} - ${execution.getVariable("FH_ErrorCode")} - ${execution.getVariable("FH_ErrorMessage")} - Y - ${parameterList} - - """ - - payload = utils.formatXml(payload) - utils.logAudit("notifyCCDFailurePayload: " + payload) - - execution.setVariable("FH_notifyCCDFailurePayload", payload) - utils.log("DEBUG", "FH_notifyCCDFailurePayload --> " + "\n" + execution.getVariable("FH_notifyCCDFailurePayload"), isDebugLogEnabled) - return execution.getVariable("FH_notifyCCDFailurePayload") - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) } } - + public void buildDBWorkflowException(Execution execution, String responseCodeVariable) { def method = getClass().getSimpleName() + '.buildDBWorkflowException(' + 'execution=' + execution.getId() + ', responseCodeVariable=' + responseCodeVariable + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - + try { def responseCode = execution.getVariable(responseCodeVariable) // If the HTTP response code was null, it means a connection fault occurred (a java exception) def errorMessage = responseCode == null ? "Could not connect to DB Adapter" : "DB Adapter returned ${responseCode} response" def errorCode = responseCode == null ? 7000 : 7020 - exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage) + // exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage) } catch (Exception e) { logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) + // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method) } } - + /** * Used to create a workflow response in success and failure cases. */ @@ -374,29 +362,29 @@ public class FalloutHandler extends AbstractServiceTaskProcessor { def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - + try { Boolean success = (Boolean) execution.getVariable("FH_success") String out = success ? "Fallout Handler Succeeded" : "Fallout Handler Failed"; - + def falloutHandlerResponse = """ - - ${out} - - """ - + + ${out} + + """ + falloutHandlerResponse = utils.formatXml(falloutHandlerResponse) utils.logAudit("FalloutHandler Response: " + falloutHandlerResponse); - + execution.setVariable("FalloutHandlerResponse", falloutHandlerResponse) execution.setVariable("WorkflowResponse", falloutHandlerResponse) execution.setVariable("FH_ResponseCode", success ? "200" : "500") setSuccessIndicator(execution, success) - + logDebug("FalloutHandlerResponse =\n" + falloutHandlerResponse, isDebugLogEnabled) } catch (Exception e) { // Do NOT throw WorkflowException! logError('Caught exception in ' + method, e) } } -} +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy new file mode 100644 index 0000000000..8001931525 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.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.common.scripts +import java.io.Serializable; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.springframework.web.util.UriUtils + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + +public class GenerateVfModuleName extends AbstractServiceTaskProcessor{ + + def Prefix="GVFMN_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + + + public void preProcessRequest(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + def vnfId = execution.getVariable("vnfId") + utils.log("DEBUG", "vnfId is " + vnfId, isDebugEnabled) + def vnfName = execution.getVariable("vnfName") + utils.log("DEBUG", "vnfName is " + vnfName, isDebugEnabled) + def vfModuleLabel = execution.getVariable("vfModuleLabel") + utils.log("DEBUG", "vfModuleLabel is " + vfModuleLabel, isDebugEnabled) + def personaModelId = execution.getVariable("personaModelId") + utils.log("DEBUG", "personaModelId is " + personaModelId, isDebugEnabled) + execution.setVariable("GVFMN_vfModuleXml", "") + }catch(BpmnError b){ + throw b + }catch(Exception e){ + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in initVariables method!") + } + } + + + public void queryAAI(Execution execution) { + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") + def method = getClass().getSimpleName() + '.queryAAI(' + + 'execution=' + execution.getId() + + ')' + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def vnfId = execution.getVariable('vnfId') + def personaModelId = execution.getVariable('personaModelId') + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) + logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) + + String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" + utils.logAudit("AAI endPoint: " + endPoint) + + try { + RESTConfig config = new RESTConfig(endPoint); + def responseData = '' + def aaiRequestId = UUID.randomUUID().toString() + RESTClient client = new RESTClient(config). + addHeader('X-TransactionId', aaiRequestId). + addHeader('X-FromAppId', 'MSO'). + addHeader('Content-Type', 'application/xml'). + addHeader('Accept','application/xml'); + logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) + APIResponse response = client.httpGet() + utils.logAudit("GenerateVfModuleName - invoking httpGet() to AAI") + + responseData = response.getResponseBodyAsString() + if (responseData != null) { + logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled) + + } + + utils.logAudit("GenerateVfModuleName - queryAAIVfModule Response: " + responseData) + utils.logAudit("GenerateVfModuleName - queryAAIVfModule ResponseCode: " + response.getStatusCode()) + + execution.setVariable('GVFMN_queryAAIVfModuleResponseCode', response.getStatusCode()) + execution.setVariable('GVFMN_queryAAIVfModuleResponse', responseData) + logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) + logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) + if (response.getStatusCode() == 200) { + // Set the VfModuleXML + if (responseData != null) { + String vfModulesText = utils.getNodeXml(responseData, "vf-modules") + if (vfModulesText == null || vfModulesText.isEmpty()) { + logDebug("There are no VF modules in this VNF yet", isDebugLogEnabled) + execution.setVariable("GVFMN_vfModuleXml", null) + } + else { + def xmlVfModules= new XmlSlurper().parseText(vfModulesText) + def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} + int vfModulesSize = 0 + if (vfModules != null) { + vfModulesSize = vfModules.size() + } + String matchingVfModules = "" + for (i in 0..vfModulesSize-1) { + def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) + def personaModelIdFromAAI = utils.getNodeText(vfModuleXml, "persona-model-id") + if (personaModelIdFromAAI != null && personaModelIdFromAAI.equals(personaModelId)) { + matchingVfModules = matchingVfModules + utils.removeXmlPreamble(vfModuleXml) + } + } + matchingVfModules = matchingVfModules + "" + logDebug("Matching VF Modules: " + matchingVfModules, isDebugLogEnabled) + execution.setVariable("GVFMN_vfModuleXml", matchingVfModules) + } + } + } + } catch (Exception ex) { + ex.printStackTrace() + logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage()) + } + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAI(): ' + e.getMessage()) + } + + } + + public void generateName (Execution execution) { + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") + def method = getClass().getSimpleName() + '.generateName() ' + + 'execution=' + execution.getId() + + ')' + logDebug('Entered ' + method, isDebugLogEnabled) + + String vfModuleXml = execution.getVariable("GVFMN_vfModuleXml") + + String moduleIndex = utils.getLowestUnusedIndex(vfModuleXml) + logDebug("moduleIndex is: " + moduleIndex, isDebugLogEnabled) + def vnfName = execution.getVariable("vnfName") + def vfModuleLabel = execution.getVariable("vfModuleLabel") + def vfModuleName = vnfName + "_" + vfModuleLabel + "_" + moduleIndex + logDebug("vfModuleName is: " + vfModuleName, isDebugLogEnabled) + execution.setVariable("vfModuleName", vfModuleName) + } +} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/GenericDeleteService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy similarity index 96% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/GenericDeleteService.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy index 53cd254b73..2db3d97853 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/GenericDeleteService.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy @@ -18,20 +18,14 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.common.scripts -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution; -import org.apache.commons.codec.binary.Base64 import org.apache.commons.lang3.* - -import org.openecomp.mso.bpmn.core.WorkflowException +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - import org.springframework.web.util.UriUtils @@ -184,16 +178,19 @@ class GenericDeleteService extends AbstractServiceTaskProcessor{ execution.setVariable("GENDS_serviceAaiPath", serviceAaiPath) utils.log("DEBUG", "GET Service Instance AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled) - + utils.logAudit("GenericDeleteService GET AAI Path: " + serviceAaiPath) + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath) int responseCode = response.getStatusCode() execution.setVariable("GENDS_getServiceResponseCode", responseCode) utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled) - + utils.logAudit("GET Service Instance response code: " + responseCode) + String aaiResponse = response.getResponseBodyAsString() aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) execution.setVariable("GENDS_getServiceResponse", aaiResponse) + utils.logAudit("GET Service Instance response : " + aaiResponse) //Process Response if(responseCode == 200 || responseCode == 202){ utils.log("DEBUG", "GET Service Received a Good Response: \n" + aaiResponse, isDebugEnabled) @@ -268,16 +265,19 @@ class GenericDeleteService extends AbstractServiceTaskProcessor{ execution.setVariable("GENDS_deleteServiceAaiPath", serviceAaiPath) utils.log("DEBUG", "DELETE Service AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled) - + utils.logAudit("DELETE Service AAI Path: " + serviceAaiPath) + APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, serviceAaiPath) int responseCode = response.getStatusCode() execution.setVariable("GENDS_deleteServiceResponseCode", responseCode) utils.log("DEBUG", " DELETE Service response code is: " + responseCode, isDebugEnabled) + utils.logAudit("DELETE Service Response Code: " + responseCode) String aaiResponse = response.getResponseBodyAsString() aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) execution.setVariable("GENDS_deleteServiceResponse", aaiResponse) - + utils.logAudit("DELETE Service Response: " + aaiResponse) + //Process Response if(responseCode == 200 || responseCode == 204){ utils.log("DEBUG", " DELETE Service Received a Good Response", isDebugEnabled) diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/GenericDeleteVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy similarity index 96% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/GenericDeleteVnf.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy index c68ea47505..979083377e 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/GenericDeleteVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy @@ -18,20 +18,14 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.common.scripts -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution; -import org.apache.commons.codec.binary.Base64 import org.apache.commons.lang3.* - -import org.openecomp.mso.bpmn.core.WorkflowException +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - import org.springframework.web.util.UriUtils @@ -166,10 +160,12 @@ class GenericDeleteVnf extends AbstractServiceTaskProcessor{ execution.setVariable("GENDV_getVnfResponseCode", responseCode) utils.log("DEBUG", " GET Vnf response code is: " + responseCode, isDebugEnabled) + utils.logAudit("GenericDeleteVnf Get VNF Response Code: " + responseCode) String aaiResponse = response.getResponseBodyAsString() aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) execution.setVariable("GENDV_getVnfResponse", aaiResponse) + utils.logAudit("GenericDeleteVnf Get VNF Response: " + aaiResponse) //Process Response if(responseCode == 200 || responseCode == 202){ utils.log("DEBUG", "GET Vnf Received a Good Response: \n" + aaiResponse, isDebugEnabled) @@ -244,10 +240,12 @@ class GenericDeleteVnf extends AbstractServiceTaskProcessor{ execution.setVariable("GENDV_deleteVnfResponseCode", responseCode) utils.log("DEBUG", " DELETE Vnf response code is: " + responseCode, isDebugEnabled) + utils.logAudit("GenericDeleteVnf Delete VNF Response Code: " + responseCode) String aaiResponse = response.getResponseBodyAsString() aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) execution.setVariable("GENDV_deleteVnfResponse", aaiResponse) + utils.logAudit("GenericDeleteVnf Delete VNF Response: " + aaiResponse) //Process Response if(responseCode == 204){ utils.log("DEBUG", " DELETE Vnf Received a Good Response", isDebugEnabled) diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/GenericGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy similarity index 94% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/GenericGetService.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy index 89728bf7b8..304f33edcc 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/GenericGetService.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy @@ -18,20 +18,14 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.common.scripts -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution; -import org.apache.commons.codec.binary.Base64 import org.apache.commons.lang3.* - -import org.openecomp.mso.bpmn.core.WorkflowException +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - import org.springframework.web.util.UriUtils @@ -178,6 +172,8 @@ class GenericGetService extends AbstractServiceTaskProcessor{ AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) String aai_endpoint = execution.getVariable("URN_aai_endpoint") + + utils.logAudit("GenericGetService AAI Endpoint: " + aai_endpoint) String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}" //String url = "${aai_endpoint}${path}" host name needs to be removed from property @@ -187,12 +183,13 @@ class GenericGetService extends AbstractServiceTaskProcessor{ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) int responseCode = response.getStatusCode() execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode) - utils.log("DEBUG", " DELETE Service Instance response code is: " + responseCode, isDebugEnabled) + utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled) + utils.logAudit("GenericGetService AAI GET Response Code: " + responseCode) String aaiResponse = response.getResponseBodyAsString() aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse) - + utils.logAudit("GenericGetService AAI Response: " + aaiResponse) //Process Response if(responseCode == 200){ utils.log("DEBUG", " Query for Service Instance Url Received a Good Response Code", isDebugEnabled) @@ -248,15 +245,17 @@ class GenericGetService extends AbstractServiceTaskProcessor{ String url = "${path}" execution.setVariable("GENGS_obtainSIUrlPath", url) + utils.logAudit("GenericGetService AAI Endpoint: " + aai_endpoint) APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url) int responseCode = response.getStatusCode() execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode) - utils.log("DEBUG", " DELETE Service Instance response code is: " + responseCode, isDebugEnabled) - + utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled) + utils.logAudit("GenericGetService AAI Response Code: " + responseCode) + String aaiResponse = response.getResponseBodyAsString() aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse) - + utils.logAudit("GenericGetService AAI Response: " + aaiResponse) //Process Response if(responseCode == 200){ utils.log("DEBUG", " Query for Service Instance Url Received a Good Response Code", isDebugEnabled) @@ -305,7 +304,8 @@ class GenericGetService extends AbstractServiceTaskProcessor{ AaiUtil aaiUriUtil = new AaiUtil(this) String aai_endpoint = execution.getVariable("URN_aai_endpoint") String serviceEndpoint = "" - + + utils.logAudit("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint) if(type.equalsIgnoreCase("service-instance")){ String siResourceLink = execution.getVariable("GENGS_siResourceLink") if(isBlank(siResourceLink)){ @@ -340,11 +340,13 @@ class GenericGetService extends AbstractServiceTaskProcessor{ int responseCode = response.getStatusCode() execution.setVariable("GENGS_getServiceResponseCode", responseCode) utils.log("DEBUG", " GET Service response code is: " + responseCode, isDebugEnabled) - + utils.logAudit("GenericGetService AAI Response Code: " + responseCode) + String aaiResponse = response.getResponseBodyAsString() aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) execution.setVariable("GENGS_getServiceResponse", aaiResponse) - + utils.logAudit("GenericGetService AAI Response: " + aaiResponse) + //Process Response if(responseCode == 200 || responseCode == 202){ utils.log("DEBUG", "GET Service Received a Good Response Code", isDebugEnabled) diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/GenericGetVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy similarity index 96% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/GenericGetVnf.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy index 81c8c01da2..5f03786180 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/GenericGetVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy @@ -18,20 +18,14 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.common.scripts -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution; -import org.apache.commons.codec.binary.Base64 import org.apache.commons.lang3.* - -import org.openecomp.mso.bpmn.core.WorkflowException +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - import org.springframework.web.util.UriUtils @@ -153,7 +147,7 @@ class GenericGetVnf extends AbstractServiceTaskProcessor{ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENGV_type") } - String getVnfPath = "${aai_endpoint}${aai_uri}?vnf-name=" + UriUtils.encode(vnfName, "UTF-8") + String getVnfPath = "${aai_endpoint}${aai_uri}?vnf-name=" + UriUtils.encode(vnfName, "UTF-8") + "&depth=1" execution.setVariable("GENGV_getVnfPath", getVnfPath) utils.logAudit("Get Vnf Url is: " + getVnfPath) @@ -229,7 +223,7 @@ class GenericGetVnf extends AbstractServiceTaskProcessor{ } utils.log("DEBUG", "Using AAI Uri: " + aai_uri, isDebugEnabled) - String getVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + String getVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" utils.log("DEBUG", "GET Vnf Endpoint is: " + getVnfPath, isDebugEnabled) execution.setVariable("GENGV_getVnfPath", getVnfPath) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy new file mode 100644 index 0000000000..9609103228 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy @@ -0,0 +1,280 @@ +/*- + * ============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.common.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution; +import org.apache.commons.codec.binary.Base64 +import org.apache.commons.lang3.* + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + +import java.net.URLEncoder; +import org.springframework.web.util.UriUtils + +/** + * This class supports the GenericPutService Sub Flow. + * This Generic sub flow can be used by any flow for the + * goal of creating a Service Instance or Service-Subscription in AAI. Upon successful completion of + * this sub flow the GENPS_SuccessIndicator will be true. + * The calling flow must set the GENPS_type variable as "service-instance" + * or "service-subscription". + * A MSOWorkflowException will be thrown Upon unsuccessful + * completion or if an error occurs within this flow. + * Please map variables to the corresponding variable names + * below. + * + * + * Incoming Required Variables: + * @param - GENPS_type - Required field. This will be required field populated as service-instance or service-subscription + * @param - GENPS_globalSubscriberId - Required field + * @param - GENPS_serviceType - Required Field + * @param - GENPS_payload - Required Field This will be the payload that needs to be sent. + * + * @param - GENPS_serviceInstanceId - Conditional Field. Required for service-instance. + * @param - GENPS_allottedResourceId - Conditional Field. Required for allotted-resource. + * @param - GENPS_tunnelXconnectId - Conditional Field. Required for tunnel-xconnect. + * + * @param - GENPS_requestId to trace the request id + * @param - GENPS_serviceResourceVersion optional needs to be provided only in case of update for both service-instance and service subscription. The calling flows + * should check if a service-instance or servic-subscription exists by calling the subflow GenericGetService. if it exists then resourceversion should be + * obtained from aai and sent as an input parameter. + * + * Outgoing Variables: + * @param - GENPS_SuccessIndicator + * @param - WorkflowException + * + * + */ + + +class GenericPutService extends AbstractServiceTaskProcessor{ + + String Prefix = "GENPS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + + public void preProcessRequest(Execution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + utils.log("DEBUG", " *** STARTED GenericPutService PreProcessRequest Process*** ", isDebugEnabled) + + execution.setVariable("GENPS_SuccessIndicator", false) + + try{ + // Get Variables + String requestId = execution.getVariable("GENPS_requestId") + utils.log("DEBUG", "Incoming GENPS_requestId is: " + requestId, isDebugEnabled) + + String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + String serviceType = execution.getVariable("GENPS_serviceType") + String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") + String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") + String type = execution.getVariable("GENPS_type") + + if(type != null){ + utils.log("DEBUG", "Incoming GENPS_type is: " + type, isDebugEnabled) + if(type.equalsIgnoreCase("service-instance")){ + if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ + utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") + }else{ + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + } + }else if(type.equalsIgnoreCase("service-subscription")){ + if(isBlank(serviceType) || isBlank(globalSubscriberId)){ + utils.log("DEBUG", "Incoming ServiceType or GlobalSubscriberId is null. These variables are required to create a service-subscription.", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") + }else{ + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + } + }else if(type.equalsIgnoreCase("allotted-resource")){ + if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId)){ + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") + }else{ + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) + } + }else if(type.equalsIgnoreCase("tunnel-xconnect")){ + if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId) || isBlank(tunnelXconnectId)){ + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Tunnel Xconnect Id is: " + tunnelXconnectId, isDebugEnabled) + utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") + }else{ + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Tunnel Xconnect Id is: " + tunnelXconnectId, isDebugEnabled) + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENPS_type is null. Variable is Required.") + } + + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("ERROR", " Error encountered within GenericPutService PreProcessRequest method!" + e, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericPutService PreProcessRequest") + + } + utils.log("DEBUG", "*** COMPLETED GenericPutService PreProcessRequest Process ***", isDebugEnabled) + + } + + + + /** + * This method executes a Put call to AAI for the provided + * service instance. + * + * @param - execution + * + */ + public void putServiceInstance(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + utils.log("DEBUG", " *** STARTED GenericPutService PutServiceInstance method*** ", isDebugEnabled) + try { + String type = execution.getVariable("GENPS_type") + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) + String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) + logDebug('AAI namespace is: ' + namespace, isDebugEnabled) + + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String serviceAaiPath = "" + String payload = execution.getVariable("GENPS_payload") + execution.setVariable("GENPS_payload", payload) + utils.log("DEBUG", "Incoming GENPS_payload is: " + payload, isDebugEnabled) + utils.logAudit(payload) + + String serviceType = execution.getVariable("GENPS_serviceType") + utils.log("DEBUG", " Incoming GENPS_serviceType is: " + serviceType, isDebugEnabled) + String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + + // This IF clause is if we need to create a new Service Instance + if(type.equalsIgnoreCase("service-instance")){ + + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + URLEncoder.encode(serviceInstanceId,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + + }else if(type.equalsIgnoreCase("service-subscription")){ + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + }else if(type.equalsIgnoreCase("allotted-resource")){ + + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") + utils.log("DEBUG", " Incoming GENPS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + }else if(type.equalsIgnoreCase("tunnel-xconnect")){ + + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") + utils.log("DEBUG", " Incoming GENPS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) + String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") + utils.log("DEBUG", " Incoming GENPS_tunnelXconnectId is: " + tunnelXconnectId, isDebugEnabled) + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + "/tunnel-xconnects/tunnel-xconnect/" + UriUtils.encode(tunnelXconnectId,"UTF-8") + } + + String resourceVersion = execution.getVariable("GENPS_serviceResourceVersion") + utils.log("DEBUG", "Incoming Resource Version is: " + resourceVersion, isDebugEnabled) + if(resourceVersion !=null){ + serviceAaiPath = serviceAaiPath +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8") + } + + execution.setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) + utils.log("DEBUG", "PUT Service Instance AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled) + + APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) + int responseCode = response.getStatusCode() + execution.setVariable("GENPS_putServiceInstanceResponseCode", responseCode) + utils.log("DEBUG", " Put Service Instance response code is: " + responseCode, isDebugEnabled) + + String aaiResponse = response.getResponseBodyAsString() + aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) + execution.setVariable("GENPS_putServiceInstanceResponse", aaiResponse) + + + //Process Response + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + //200 OK 201 CREATED 202 ACCEPTED + { + utils.log("DEBUG", "PUT Service Instance Received a Good Response", isDebugEnabled) + execution.setVariable("GENPS_SuccessIndicator", true) + } + + else{ + utils.log("DEBUG", "Put Generic Service Instance Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("ERROR", " Error encountered within GenericPutService PutServiceInstance method!" + e, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Put Service Instance") + } + utils.log("DEBUG", " *** COMPLETED GenericPutService PutServiceInstance Process*** ", isDebugEnabled) + } + + + +} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/GenericPutVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy similarity index 95% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/GenericPutVnf.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy index 40948dc34b..9a7aa5ab9f 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/GenericPutVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy @@ -18,20 +18,14 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.common.scripts -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.* -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution; -import org.apache.commons.codec.binary.Base64 import org.apache.commons.lang3.* - -import org.openecomp.mso.bpmn.core.WorkflowException +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - import org.springframework.web.util.UriUtils /** diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy similarity index 86% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/MsoUtils.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy index 2721a20cf3..6796fb1a95 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/MsoUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy @@ -18,33 +18,24 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.common.scripts -import groovy.util.Node; import groovy.xml.XmlUtil import java.text.SimpleDateFormat import org.apache.commons.codec.binary.Base64 - - - -import org.apache.commons.codec.binary.Base64 -import org.camunda.bpm.engine.runtime.Execution; -import org.slf4j.MDC; -import org.w3c.dom.Element -//import org.w3c.dom.NodeList - import org.openecomp.mso.bpmn.core.BPMNLogger +import org.openecomp.mso.bpmn.core.xml.XmlTool import org.openecomp.mso.logger.MessageEnum import org.openecomp.mso.logger.MsoLogger import org.openecomp.mso.utils.CryptoUtils -import org.openecomp.mso.bpmn.core.xml.XmlTool +import org.w3c.dom.Element class MsoUtils { def initializeEndPoints(execution){ // use this placeholder to initialize end points, if called independently, this need to be set - execution.setVariable("AAIEndPoint","http://localhost:8080/SoapUIMocks") + execution.setVariable("AAIEndPoint","http://localhost:28080/SoapUIMocks") } def getNodeText(xmlInput,element){ def rtn=null @@ -209,7 +200,7 @@ class MsoUtils { return ret } - // for Trinity L3 delete bonding + // for Trinity L3 add/delete bonding def getPBGFList(isDebugLogEnabled, xmlInput){ xmlInput = xmlInput.replaceAll("&", "&") xmlInput = xmlInput.replaceAll("<", "<") @@ -220,13 +211,34 @@ class MsoUtils { def respInfo=getNodeXml(xmlInput,"nbnc-response-information", false) if(respInfo!=null){ def fxml= new XmlSlurper().parseText(respInfo) - def myNode fxml.'virtual-datacenter-list'.each { vdc -> - //we only want to add one BFG per VDC - log("DEBUG", "vdc " + vdc.text(),isDebugLogEnabled) - myNode = vdc.'**'.find {it.'border-element-tangibility'.text() =~ /PHYSICAL/} - log("DEBUG", "myNode " + myNode.text(),isDebugLogEnabled) - myNodes.add(XmlUtil.serialize(myNode)) + //we only want to add two BGF per VDC, BGF1 and BGF2 + def routerList = vdc.'router-list'.first() + routerList.each{ myList -> + def physNodes = myList.'**'.findAll {it.'border-element-tangibility'.text() =~ /PHYSICAL/} + def nodeToAdd + physNodes.each{ + if(nodeToAdd==null){ + nodeToAdd = it + }else{ + def beid = nodeToAdd.'border-element-id'.text() + + " " + nodeToAdd.'border-element-type'.text() + + " and " + + it.'border-element-id'.text() + + " " + it.'border-element-type'.text() + def mytag = nodeToAdd.'border-element-id' + mytag[0].replaceBody(beid) + } + } + def mytag = nodeToAdd.'vlan-id' + def ind = mytag.text().indexOf('.') + if(ind >= 0){ + def vlan = mytag.text().substring(0,ind) + mytag[0].replaceBody(vlan) + } + myNodes.add(XmlUtil.serialize(nodeToAdd)) + } + } } @@ -449,6 +461,16 @@ class MsoUtils { return xmlBuildUnbounded } + // Build l2-homing-information + def buildL2HomingInformation(xmlInput) { + def elementsL2HomingList = ["evc-name", "topology", "preferred-aic-clli"] + def rebuildL2Home = '' + if (xmlInput != null) { + rebuildL2Home = buildElements(xmlInput, elementsL2HomingList, "l2-homing-information") + } + return rebuildL2Home + } + // Build internet-evc-access-information def buildInternetEvcAccessInformation(xmlInput) { def elementsInternetEvcAccessInformationList = ["internet-evc-speed-value", "internet-evc-speed-units", "ip-version"] @@ -459,6 +481,38 @@ class MsoUtils { return rebuildInternetEvcAccess } + // Build ucpe-vms-service-information + def buildUcpeVmsServiceInformation(xmlInput) { + def rebuildUcpeVmsServiceInformation = '' + if (xmlInput != null) { + def ucpeVmsServiceInformation = getNodeXml(xmlInput, "ucpe-vms-service-information").drop(38).trim() + rebuildUcpeVmsServiceInformation = "" + // transport-service-information + rebuildUcpeVmsServiceInformation += "" + def transportServiceInformation = getNodeXml(ucpeVmsServiceInformation, "transport-service-information").drop(38).trim() + def elementsTransportServiceInformationList = ["transport-service-type"] + rebuildUcpeVmsServiceInformation += buildElements(transportServiceInformation, elementsTransportServiceInformationList, "") + try { // optional + def accessCircuitInfoList = ["access-circuit-id", "dual-mode"] + rebuildUcpeVmsServiceInformation += buildElementsUnbounded(transportServiceInformation, accessCircuitInfoList, "access-circuit-info") + } catch (Exception e) { + log("ERROR", " Optional - Exception ACCESS-CIRCUIT-INFO - 'access-circuit-info' ") + } + rebuildUcpeVmsServiceInformation += "" + // ucpe-information + def elementsUcpeInformationList = ["ucpe-host-name", "ucpe-activation-code", "out-of-band-management-modem" ] + rebuildUcpeVmsServiceInformation += buildElements(ucpeVmsServiceInformation, elementsUcpeInformationList, "ucpe-information") + // vnf-list + rebuildUcpeVmsServiceInformation += "" + def vnfListList = ["vnf-instance-id", "vnf-sequence-number", "vnf-type", "vnf-vendor", "vnf-model", "vnf-id", "prov-status", "operational-state", "orchestration-status", "equipment-role" ] + rebuildUcpeVmsServiceInformation += buildElementsUnbounded(ucpeVmsServiceInformation, vnfListList, "vnf-information") + rebuildUcpeVmsServiceInformation += "" + rebuildUcpeVmsServiceInformation += "" + } + log("DEBUG", " rebuildUcpeVmsServiceInformation - " + rebuildUcpeVmsServiceInformation) + return rebuildUcpeVmsServiceInformation + } + // Build internet-service-change-details def buildInternetServiceChangeDetails(xmlInput) { def rebuildInternetServiceChangeDetails = "" @@ -468,8 +522,12 @@ class MsoUtils { rebuildInternetServiceChangeDetails = "" rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["internet-evc-speed-value"], "") rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["internet-evc-speed-units"], "") - def tProvidedV4LanPublicPrefixesChangesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length"] - rebuildInternetServiceChangeDetails += buildElementsUnbounded(internetServiceChangeDetails, tProvidedV4LanPublicPrefixesChangesList, "t-provided-v4-lan-public-prefixes") + try { // optional + def tProvidedV4LanPublicPrefixesChangesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length"] + rebuildInternetServiceChangeDetails += buildElementsUnbounded(internetServiceChangeDetails, tProvidedV4LanPublicPrefixesChangesList, "t-provided-v4-lan-public-prefixes") + } catch (Exception e) { + log("ERROR"," Optional - Exception in INTERNET-SERVICE-CHANGE-DETAILS 't-provided-v4-lan-public-prefixes ") + } try { // optional def tProvidedV6LanPublicPrefixesChangesList = ["request-index", "v6-next-hop-address", "v6-lan-public-prefix", "v6-lan-public-prefix-length"] rebuildInternetServiceChangeDetails += buildElementsUnbounded(internetServiceChangeDetails, tProvidedV6LanPublicPrefixesChangesList, "t-provided-v6-lan-public-prefixes") @@ -837,7 +895,7 @@ class MsoUtils { def qualifiedHostName = System.getProperty("jboss.qualified.host.name") if(qualifiedHostName!=null){ log("DEBUG", "qualifiedHostName:\n" + qualifiedHostName) - callbackUrlToUse = callbackUrlToUse.replaceAll("(http://)(.*)(:8080*)", {orig, first, torepl, last -> "${first}${qualifiedHostName}${last}"}) + callbackUrlToUse = callbackUrlToUse.replaceAll("(http://)(.*)(:28080*)", {orig, first, torepl, last -> "${first}${qualifiedHostName}${last}"}) } }catch(Exception e){ log("DEBUG", "unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: " + e.printStackTrace()) @@ -860,5 +918,27 @@ class MsoUtils { } return text } + + /** + * + * Find the lowest unused module-index value in a given xml + */ + public String getLowestUnusedIndex(String xml) { + if (xml == null || xml.isEmpty()) { + return "0" + } + def moduleIndexList = getMultNodes(xml, "module-index") + if (moduleIndexList == null || moduleIndexList.size() == 0) { + return "0" + } + def sortedModuleIndexList = moduleIndexList.sort { a, b -> a.compareTo b } + + for (i in 0..sortedModuleIndexList.size()-1) { + if (Integer.parseInt(sortedModuleIndexList[i]) != i) { + return i.toString() + } + } + return sortedModuleIndexList.size().toString() + } } diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/NetworkUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy similarity index 88% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/NetworkUtils.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy index 7d2c53dc47..c9e243dd54 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/NetworkUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy @@ -18,11 +18,12 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts; +package org.openecomp.mso.bpmn.common.scripts; import org.apache.commons.lang3.* import groovy.xml.XmlUtil + import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory import javax.xml.transform.Transformer @@ -40,12 +41,12 @@ import org.w3c.dom.NamedNodeMap import org.w3c.dom.Node import org.w3c.dom.NodeList; import org.xml.sax.InputSource -import org.apache.commons.lang3.* + import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; import org.w3c.dom.Document import org.w3c.dom.Element - import org.w3c.dom.NamedNodeMap import org.w3c.dom.Node import org.w3c.dom.NodeList; @@ -64,12 +65,11 @@ class NetworkUtils { this.taskProcessor = taskProcessor } - /** * This method returns the string for Network request * V2 for Contrail 3.x will populate cloud-region data in same cloudSiteId filed * Network adapter will handle it properly - * @param requestId either 'request-id' or 'att-mso-request-id' + * @param requestId either 'request-id' or 'openecomp-mso-request-id' * @param requestInput the request in the process * @param queryIdResponse the response of REST AAI query by Id * @param routeCollection the collection @@ -106,12 +106,32 @@ class NetworkUtils { // requestInput String cloudRegion = cloudRegionId String tenantId = utils.getNodeText1(requestInput, "tenant-id") - + String networkType = "" + if (utils.nodeExists(requestInput, "networkModelInfo")) { + String networkModelInfo = utils.getNodeXml(requestInput, "networkModelInfo", false).replace("tag0:","").replace(":tag0","") + networkType = utils.getNodeText1(networkModelInfo, "modelName") + } else { + networkType = utils.getNodeText1(queryIdResponse, "network-type") + } + // queryIdResponse String networkName = utils.getNodeText1(queryIdResponse, "network-name") String networkId = utils.getNodeText1(queryIdResponse, "network-id") - String networkType = utils.getNodeText1(queryIdResponse, "network-type") - + String networkTechnology = utils.getNodeText1(queryIdResponse, "network-technology") + + // contrailNetwork - networkTechnology = 'Contrail' vs. 'AIC_SR_IOV') + String contrailNetwork = "" + if (networkTechnology.contains('Contrail') || networkTechnology.contains('contrail') || networkTechnology.contains('CONTRAIL')) { + contrailNetwork = """ + ${sharedValue} + ${externalValue} + ${routeCollection} + ${policyFqdns} + ${tableCollection} + """ + networkTechnology = "CONTRAIL" // replace + } + // rebuild subnets String subnets = "" if (utils.nodeExists(queryIdResponse, "subnets")) { @@ -134,18 +154,12 @@ class NetworkUtils { ${networkId} ${networkName} ${networkType} - CONTRAIL + ${networkTechnology} ${physicalNetworkName} ${vlansCollection} - - ${sharedValue} - ${externalValue} - ${routeCollection} - ${policyFqdns} - ${tableCollection} - + ${contrailNetwork} ${subnets} true ${backoutOnFailure} @@ -168,7 +182,7 @@ class NetworkUtils { * This method returns the string for Network request * V2 for Contrail 3.x will populate cloud-region data in same cloudSiteId filed * Network adapter will handle it properly - * @param requestId either 'request-id' or 'att-mso-request-id' + * @param requestId either 'request-id' or 'openecomp-mso-request-id' * @param requestInput the request in the process * @param queryIdResponse the response of REST AAI query by Id * @param routeCollection the collection @@ -276,7 +290,7 @@ class NetworkUtils { def String CreateNetworkVolumeRequest(groupId, volumeName, vnfType, tenantId) { String requestPayload = - """ + """ ${groupId} ${volumeName} @@ -296,7 +310,7 @@ class NetworkUtils { return requestPayload } - def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, tenantId, cloudRegion, namespace) { + def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, tenantId, cloudRegion, namespace, modelCustomizationId) { String requestPayload = """ @@ -305,6 +319,7 @@ class NetworkUtils { ${vnfType} Pending + ${modelCustomizationId} tenant @@ -314,7 +329,7 @@ class NetworkUtils { cloud-region.cloud-owner - att-aic + openecomp-aic cloud-region.cloud-region-id @@ -327,7 +342,7 @@ class NetworkUtils { return requestPayload } - def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, vnfId, tenantId, cloudRegion, namespace) { + def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, vnfId, tenantId, cloudRegion, namespace, modelCustomizationId) { String requestPayload = """ @@ -336,6 +351,7 @@ class NetworkUtils { ${vnfType} Pending + ${modelCustomizationId} generic-vnf @@ -352,7 +368,7 @@ class NetworkUtils { cloud-region.cloud-owner - att-aic + openecomp-aic cloud-region.cloud-region-id @@ -372,7 +388,7 @@ class NetworkUtils { * @param heatStackId the value of heat stack id * @return String request payload */ - def String updateCloudRegionVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId, namespace) { + def String updateCloudRegionVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId, namespace, modelCustomizationId) { String requestPayload = "" if (requeryAAIVolGrpNameResponse != null) { def groupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id") @@ -392,6 +408,7 @@ class NetworkUtils { ${vnfType} Active ${resourceVersion} + ${modelCustomizationId} ${relationshipList} """ } @@ -419,7 +436,7 @@ class NetworkUtils { } requestPayload = - """ + """ ${groupId} ${volumeName} ${heatStackId} @@ -624,7 +641,7 @@ class NetworkUtils { * * * vpn-binding - * https://aai-app-e2e.test.att.com:8443/aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ + * https://aai-app-e2e.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/ * * vpn-binding.vpn-id * 85f015d0-2e32-4c30-96d2-87a1a27f8017 @@ -632,7 +649,7 @@ class NetworkUtils { * * * vpn-binding - * https://aai-ext1.test.att.com:8443/aai/v6/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ + * https://aai-ext1.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/ * * vpn-binding.vpn-id * 24a4b507-853a-4a38-99aa-05fcc54be24d @@ -723,6 +740,59 @@ class NetworkUtils { return rtn } + /** + * similar to network policymethod + * @param xmlInput the XML document + * @return a list of IDs for related VNF instances + * + **/ + def getRelatedVnfIdList(xmlInput) { + //def rtn = null + List rtn = [] + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "generic-vnf") { + def relatedLink = utils.getNodeText1(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + rtn.add(relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length())) + } + } + } + } + } + return rtn + } + + /** + * similar to network policymethod + * @param xmlInput the XML document + * @return a list of IDs for related Network instances + * + **/ + def getRelatedNetworkIdList(xmlInput) { + //def rtn = null + List rtn = [] + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "l3-network") { + def relatedLink = utils.getNodeText1(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + rtn.add(relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length())) + } + } + } + } + } + return rtn + } def isVfRelationshipExist(xmlInput) { Boolean rtn = false @@ -742,6 +812,52 @@ class NetworkUtils { } + def getCloudRegion(xmlInput) { + String lcpCloudRegion = "" + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "cloud-region") { + def relatedLink = utils.getNodeText1(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/openecomp-aic/")+9, relatedLink.length()) + if (lcpCloudRegion.contains('/')) { + lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/openecomp-aic/")+9, relatedLink.length()-1) + } + } + } + } + } + } + return lcpCloudRegion + } + + def getTenantId(xmlInput) { + String tenantId = "" + if (xmlInput!=null) { + def relationshipList = getListWithElements(xmlInput, 'relationship') + def relationshipListSize = relationshipList.size() + if (relationshipListSize > 0) { + for (i in 0..relationshipListSize-1) { + def relationshipXml = XmlUtil.serialize(relationshipList[i]) + if (utils.getNodeText(relationshipXml, 'related-to') == "tenant") { + def relatedLink = utils.getNodeText1(relationshipXml, 'related-link') + if (relatedLink != null || relatedLink != "") { + tenantId = relatedLink.substring(relatedLink.indexOf("/tenant/")+8, relatedLink.length()) + if (tenantId.contains('/')) { + tenantId = relatedLink.substring(relatedLink.indexOf("/tenant/")+8, relatedLink.length()-1) + } + } + } + } + } + } + return tenantId + } + def isInstanceValueMatch(linkResource, globalSubscriberId, serviceType) { Boolean rtn = false try { @@ -1116,7 +1232,7 @@ class NetworkUtils { * Ex 2: xmlInput // no parent tag * * fec8ec88-151a-45c9-ad60-8233e0fc8ff2 - * https://msojra.mtsnj.aic.cip.att.com:8443/adapters/rest/SDNCNotify + * https://msojra.mtsnj.aic.cip.openecomp.com:8443/adapters/rest/SDNCNotify * assign * * Usage: @@ -1193,6 +1309,7 @@ class NetworkUtils { //TODO: This method still needs to be tested before using. /** + * * This method is similar to the gennetwork:ContrailNetworUpdateCompletedObject * BPEL method. It extracts all of the required subnet information * for each subnet listed with an orch status equal to the one provided @@ -1270,6 +1387,7 @@ class NetworkUtils { /** + * * This method extracts the "value" node text for the the given subnet Id. * * @param String inputSource - xml that contains the subnet id key and value @@ -1302,8 +1420,8 @@ class NetworkUtils { public boolean isRollbackEnabled (Execution execution, String payloadXml) { - boolean rollbackEnabled = false - boolean rollbackValueSet = false + def rollbackEnabled = false + def rollbackValueSet = false if (utils.nodeExists(payloadXml, "backout-on-failure")) { String backoutValue = utils.getNodeText1(payloadXml, "backout-on-failure") if (backoutValue != null && !backoutValue.isEmpty()) { @@ -1318,7 +1436,9 @@ class NetworkUtils { } if (!rollbackValueSet) { - rollbackEnabled = execution.getVariable("URN_mso_rollback") + if (execution.getVariable("URN_mso_rollback") != null) { + rollbackEnabled = execution.getVariable("URN_mso_rollback").toBoolean() + } } return rollbackEnabled } diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy similarity index 94% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/PrepareUpdateAAIVfModule.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy index b34467e57e..e64fda6356 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/PrepareUpdateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy @@ -18,23 +18,15 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts - -import groovy.util.Node -import groovy.xml.QName - -import java.io.Serializable; +package org.openecomp.mso.bpmn.common.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution -import org.springframework.web.util.UriUtils - +import org.openecomp.mso.bpmn.core.WorkflowException import org.openecomp.mso.rest.APIResponse import org.openecomp.mso.rest.RESTClient import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException -import com.jayway.jsonpath.internal.Utils; +import org.springframework.web.util.UriUtils public class PrepareUpdateAAIVfModule extends VfModuleBase { @@ -74,6 +66,8 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { try { def xml = execution.getVariable('PrepareUpdateAAIVfModuleRequest') logDebug('Received request xml:\n' + xml, isDebugLogEnabled) + utils.logAudit("PrepareUpdateAAIVfModule Request : " + xml) + initProcessVariables(execution) def vnfId = getRequiredNodeText(execution, xml,'vnf-id') @@ -114,10 +108,10 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") - + String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" + + utils.logAudit("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint) String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - try { RESTConfig config = new RESTConfig(endPoint); def responseData = '' @@ -132,10 +126,15 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { } logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) APIResponse response = client.httpGet() - + utils.logAudit("PrepareUpdateAAIVfModule: - invoking httpGet to AAI") + responseData = response.getResponseBodyAsString() execution.setVariable('PUAAIVfMod_getVnfResponseCode', response.getStatusCode()) execution.setVariable('PUAAIVfMod_getVnfResponse', responseData) + + utils.logAudit("PrepareUpdateAAIVfModule: AAI Response : " + responseData) + utils.logAudit("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode()) + logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) } catch (Exception ex) { @@ -234,6 +233,8 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { def VfModule newVfModule = new VfModule(newVfModuleNode, vfModule.isOnlyVfModule()) def payload = utils.nodeToString(newVfModuleNode) + utils.logAudit("VfModule payload : " + payload) + // Construct endpoint def vnfId = execution.getVariable('PUAAIVfMod_vnfId') def vfModuleId = execution.getVariable('PUAAIVfMod_vfModuleId') @@ -244,9 +245,8 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "/vf-modules/vf-module/" + UriUtils.encode(vfModuleId, "UTF-8") - + utils.logAudit("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint) String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - try { RESTConfig config = new RESTConfig(endPoint); def responseData = '' @@ -261,12 +261,15 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { } logDebug('sending PUT to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled) APIResponse response = client.httpPut(payload) - + utils.logAudit("PrepareUpdateAAIVfModule: - invoking httpPut to AAI") + responseData = response.getResponseBodyAsString() execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', response.getStatusCode()) execution.setVariable('PUAAIVfMod_updateVfModuleResponse', responseData) logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) + utils.logAudit("PrepareUpdateAAIVfModule: AAI Response : " + responseData) + utils.logAudit("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode()) // Set the output for this flow. The updated VfModule is an output, the generic VNF name, and for // backward compatibilty, the heat-stack-id is an output @@ -331,6 +334,8 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase { def String errorMsg = 'VF Module validation error: ' + execution.getVariable('PUAAIVfMod_vfModuleValidationError') logError(errorMsg) + utils.logAudit("PrepareUpdateAAIVfModule: Error Message : " + errorMsg) + String processKey = getProcessKey(execution); WorkflowException exception = new WorkflowException(processKey, 5000, errorMsg) execution.setVariable('WorkflowException', exception) diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy similarity index 84% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/SDNCAdapter.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy index 8bd6983cc4..d83f46e85f 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/SDNCAdapter.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy @@ -18,14 +18,12 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts; +package org.openecomp.mso.bpmn.common.scripts; -import org.openecomp.mso.bpmn.core.WorkflowException import java.text.SimpleDateFormat -import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution -import org.apache.commons.codec.binary.Base64; +import org.openecomp.mso.bpmn.core.WorkflowException // SDNC Adapter Request/Response processing @@ -102,7 +100,12 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { utils.log("DEBUG", "service-type: " + sdnca_serviceType, isDebugEnabled) def serviceConfigActivate = false def source = '' - + if ((sdnca_svcAction == 'activate') && (sdnca_svcOperation == 'service-configuration-operation') && (sdnca_serviceType == 'uCPE-VMS')) { + serviceConfigActivate = true + if (utils.nodeExists(sdncwfreq, 'source')) { + source = utils.getNodeText(sdncwfreq, 'source') + } + } execution.setVariable("serviceConfigActivate", serviceConfigActivate) utils.log("DEBUG", "serviceConfigActivate: " + serviceConfigActivate, isDebugEnabled) execution.setVariable("source", source) @@ -116,8 +119,8 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { String sdncAdapterRequest = """ - - + + ${requestId}""" if (sdnca_svcInstanceId != null) { @@ -162,7 +165,8 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { def sdnccallbackreq = execution.getVariable("sdncAdapterCallbackRequest") def callbackRequestData = "" def callbackHeader = "" - + utils.logAudit("SDNCAdapterCallback Request :" + sdnccallbackreq) + if(sdnccallbackreq != null){ callbackHeader = utils.getNodeXml(sdnccallbackreq, "CallbackHeader") callbackRequestData = utils.getNodeXml(sdnccallbackreq, "RequestData") @@ -174,7 +178,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { utils.log("DEBUG","DECODED SDNCCallback RequestData is:\n" + callbackRequestData, isDebugEnabled) String sdncAdapterWorkflowResponse =""" - + ${callbackHeader} ${callbackRequestData} @@ -184,6 +188,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { utils.log("DEBUG","Outgoing sdncAdapterWorkflowResponse:\n" + sdncAdapterWorkflowResponse, isDebugEnabled) sdncAdapterWorkflowResponse = utils.formatXml(sdncAdapterWorkflowResponse) + utils.logAudit("sdncAdapterWorkflowResponse :" + sdncAdapterWorkflowResponse) execution.setVariable("sdncAdapterResponse", sdncAdapterWorkflowResponse) // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead execution.setVariable("WorkflowResponse", sdncAdapterWorkflowResponse) @@ -220,6 +225,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { public void callbackResponsecheck(Execution execution){ def sdnccallbackreq=execution.getVariable("sdncAdapterCallbackRequest") + utils.logAudit("sdncAdapterCallbackRequest :" + sdnccallbackreq) if (sdnccallbackreq==null){ execution.setVariable("callbackResponseReceived",false); }else{ @@ -238,6 +244,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { // Determine and set SDNC Timeout Value def enhancedCallbackRequestData = execution.getVariable("enhancedCallbackRequestData") + utils.logAudit("sdncAdapter - enhancedCallbackRequestData :" + enhancedCallbackRequestData) def interim = false if (enhancedCallbackRequestData != null) { if (utils.nodeExists(enhancedCallbackRequestData, "ack-final-indicator")) { @@ -259,9 +266,6 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { utils.log("DEBUG","=========== End Reset Callback Info SDNCAdapter ===========", isDebugEnabled) } - public void prepareCSIMessage(Execution execution) { - - } public void prepareDBMessage(Execution execution) { @@ -270,11 +274,11 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { utils.log("DEBUG","=========== Begin Prepare DB Message SDNCAdapter ===========", isDebugEnabled) // Create DB Message - def dbRequestId = execution.getVariable("att-mso-request-id") + def dbRequestId = execution.getVariable("mso-request-id") String dbUpdateInterimStageCompletion = """ - + ${dbRequestId} 1 BPEL @@ -284,58 +288,12 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor { """ execution.setVariable("dbUpdateInterimStageCompletion", dbUpdateInterimStageCompletion) + utils.logAudit("sdncAdapter - dbUpdateInterimStageCompletion :" + dbUpdateInterimStageCompletion) utils.log("DEBUG","DB UpdateInterimStageCompletion:\n" + dbUpdateInterimStageCompletion, isDebugEnabled) - utils.log("DEBUG","=========== End Prepare DB Message SDNCAdapter ===========", isDebugEnabled) } - public void prepareCCDMessage(Execution execution) { - - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - utils.log("DEBUG","=========== Begin Prepare CCD Message SDNCAdapter ===========", isDebugEnabled) - - try { - def sdncwfreq= execution.getVariable("sdncAdapterWorkflowRequest") - def sdncRequestData = utils.getNodeXml(sdncwfreq, "SDNCRequestData", false) - - def ccdNotificationUrl = utils.getNodeText(sdncRequestData, 'notification-url') - execution.setVariable('ccd-notification-url', ccdNotificationUrl) - utils.log("DEBUG", 'ccd-notification-url: ' + ccdNotificationUrl, isDebugEnabled) - - def requestId = utils.getNodeText(sdncRequestData, 'request-id') - def requestAction = utils.getNodeText(sdncRequestData, 'request-action') - String payload =""" - - ${requestId} - ${requestAction} - CCD - N - - - request-stage - DataStagingComplete - - - - """ - payload = utils.formatXml(payload) - execution.setVariable('ccd-notification-payload', payload) - utils.log("DEBUG", 'ccd-notification-payload:\n' + payload, isDebugEnabled) - - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in prepareCCDMessage', e) - exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error') // TODO: what message and error code? - } - - utils.log("DEBUG","=========== End Prepare CCD Message SDNCAdapter ===========", isDebugEnabled) - } public String generateCurrentTimeInUtc(){ final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy similarity index 74% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/SDNCAdapterUtils.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy index 0a280b2015..5c01bb9c4d 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/SDNCAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy @@ -18,13 +18,13 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts; - -import org.openecomp.mso.bpmn.core.WorkflowException +package org.openecomp.mso.bpmn.common.scripts; +import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution -import org.apache.commons.lang3.* +import org.openecomp.mso.bpmn.core.WorkflowException +import org.springframework.web.util.UriUtils /** @@ -53,10 +53,10 @@ class SDNCAdapterUtils { def requestId = execution.getVariable('testReqId') // for junits if(requestId==null){ - requestId = execution.getVariable("att-mso-request-id") + "-" + System.currentTimeMillis() + requestId = execution.getVariable("openecomp-mso-request-id") + "-" + System.currentTimeMillis() } - def svcInstanceId = execution.getVariable("att-mso-service-instance-id") + def svcInstanceId = execution.getVariable("openecomp-mso-service-instance-id") def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) @@ -64,8 +64,8 @@ class SDNCAdapterUtils { def nnsFeatureParameters = utils.removeXmlNamespaces(featureParameters) String sdncAdapterFeatureRequest = """ - + ${requestId} ${svcInstanceId} @@ -97,18 +97,18 @@ class SDNCAdapterUtils { def requestId = execution.getVariable('testReqId') // for junits if(requestId==null){ - requestId = execution.getVariable("att-mso-request-id") + "-" + System.currentTimeMillis() + requestId = execution.getVariable("openecomp-mso-request-id") + "-" + System.currentTimeMillis() } - def svcInstanceId = execution.getVariable("att-mso-service-instance-id") + def svcInstanceId = execution.getVariable("openecomp-mso-service-instance-id") def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) def nnsVnfInformationList = utils.removeXmlNamespaces(vnfInformationList) String sdncAdapterActivateVnfRequest = """ - + ${requestId} ${svcInstanceId} @@ -136,7 +136,7 @@ class SDNCAdapterUtils { def request = taskProcessor.getVariable(execution, prefix+'Request') def requestInformation = """ - ${execution.getVariable("att-mso-request-id")} + ${execution.getVariable("openecomp-mso-request-id")} torepl ${execution.getVariable(prefix+"source")} ${execution.getVariable(prefix+"notificationUrl")} @@ -156,10 +156,10 @@ class SDNCAdapterUtils { def requestId = execution.getVariable('testReqId') // for junits if(requestId==null){ - requestId = execution.getVariable("att-mso-request-id") + "-" + System.currentTimeMillis() + requestId = execution.getVariable("openecomp-mso-request-id") + "-" + System.currentTimeMillis() } - def svcInstanceId = execution.getVariable("att-mso-service-instance-id") + def svcInstanceId = execution.getVariable("openecomp-mso-service-instance-id") //Build Service Information // Send serviceName from CANOPI to sdnc for service-type @@ -199,8 +199,8 @@ class SDNCAdapterUtils { //Build SDNC Adapter Request String sdncAdapterL3ToHLRequest = """ - + ${requestId} ${svcInstanceId} @@ -240,10 +240,10 @@ class SDNCAdapterUtils { def requestId = execution.getVariable('testReqId') // for junits if(requestId==null){ - requestId = execution.getVariable("att-mso-request-id") + "-" + System.currentTimeMillis() + requestId = execution.getVariable("openecomp-mso-request-id") + "-" + System.currentTimeMillis() } - def svcInstanceId = execution.getVariable("att-mso-service-instance-id") + def svcInstanceId = execution.getVariable("openecomp-mso-service-instance-id") def msoAction = 'gammainternet' def timeoutInMinutes = execution.getVariable('URN_mso_sdnc_timeout_firewall_minutes') @@ -254,21 +254,26 @@ class SDNCAdapterUtils { workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code? } + def l2HomingInformation = utils.getNodeXml(serviceParameters, 'l2-homing-information', false) def internetEvcAccessInformation = utils.getNodeXml(serviceParameters, 'internet-evc-access-information', false) def vrLan = utils.getNodeXml(serviceParameters, 'vr-lan', false) + def upceVmsServiceInformation = utils.getNodeXml(serviceParameters, 'ucpe-vms-service-information', false) + def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) + def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation) def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation) def nnsVrLan = utils.removeXmlNamespaces(vrLan) + def nnsUpceVmsServiceInformation = utils.removeXmlNamespaces(upceVmsServiceInformation) if (additionalData == null) { additionalData = "" } String content = """ - + ${requestId} ${svcInstanceId} @@ -281,8 +286,10 @@ class SDNCAdapterUtils { ${additionalData} ${nnsRequestInformation} ${nnsServiceInformation} + ${nnsl2HomingInformation} ${nnsInternetEvcAccessInformation} ${nnsVrLan} + ${nnsUpceVmsServiceInformation} ${timeoutInMinutes} @@ -336,10 +343,10 @@ class SDNCAdapterUtils { def requestId = execution.getVariable('testReqId') // for junits if(requestId==null){ - requestId = execution.getVariable("att-mso-request-id") + "-" + System.currentTimeMillis() + requestId = execution.getVariable("openecomp-mso-request-id") + "-" + System.currentTimeMillis() } - def svcInstanceId = execution.getVariable("att-mso-service-instance-id") + def svcInstanceId = execution.getVariable("openecomp-mso-service-instance-id") def msoAction = 'gammainternet' def callbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') @@ -348,14 +355,18 @@ class SDNCAdapterUtils { taskProcessor.workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code? } + def l2HomingInformation = utils.getNodeXml(request, 'l2-homing-information', false) def internetEvcAccessInformation = utils.getNodeXml(request, 'internet-evc-access-information', false) def vrLan = utils.getNodeXml(request, 'vr-lan', false) + def upceVmsServiceInfo = utils.getNodeXml(request, 'ucpe-vms-service-information', false) def vnfInformationList = utils.getNodeXml(request, 'vnf-information-list', false) def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation) def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation) + def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation) def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation) def nnsVrLan = utils.removeXmlNamespaces(vrLan) + def nnsUpceVmsServiceInfo = utils.removeXmlNamespaces(upceVmsServiceInfo) def nnsVnfInformationList = utils.removeXmlNamespaces(vrLan) def nnsinternetSvcChangeDetails = "" @@ -371,8 +382,8 @@ class SDNCAdapterUtils { } String content = """ - + ${requestId} ${svcInstanceId} @@ -385,8 +396,10 @@ class SDNCAdapterUtils { ${additionalData} ${nnsRequestInformation} ${nnsServiceInformation} + ${nnsl2HomingInformation} ${nnsInternetEvcAccessInformation} ${nnsVrLan} + ${nnsUpceVmsServiceInfo} ${nnsVnfInformationList} ${nnsinternetSvcChangeDetails} @@ -406,8 +419,6 @@ class SDNCAdapterUtils { } } - - /** * Builds a topology SDNC request and return String request. * As V2 will use 1607-style request, region instead of aic clli code @@ -418,15 +429,16 @@ class SDNCAdapterUtils { * @param action, the action element value * @param requestAction the svcOperation element value * @param cloudRegionId the aai's cloud-region-id + * @param networkId the aai's network-id * @param additionalData additional XML content to be inserted into the - * RequestData element (may be null) + * RequestData element (may be null) */ - public String sdncTopologyRequestV2 (Execution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String additionalData) { + public String sdncTopologyRequestV2 (Execution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String queryAAIResponse, String additionalData) { def utils=new MsoUtils() String requestId = "" try { - requestId = execution.getVariable("att-mso-request-id") + requestId = execution.getVariable("openecomp-mso-request-id") } catch (Exception ex) { requestId = utils.getNodeText1(requestXML, "request-id") } @@ -439,7 +451,13 @@ class SDNCAdapterUtils { String networkType = "" if (utils.nodeExists(requestXML, "network-type")) { networkType = utils.getNodeText1(requestXML, "network-type") - } + } + + // Replace/Use the value of network-type from aai query (vs input) during Delete Network flows. + if (queryAAIResponse != null) { + networkType = utils.getNodeText1(queryAAIResponse, "network-type") + } + String serviceId = "" if (utils.nodeExists(requestXML, "service-id")) { serviceId = utils.getNodeText1(requestXML, "service-id") @@ -462,17 +480,19 @@ class SDNCAdapterUtils { int serviceStart = siRelatedLink.indexOf("service-subscription/") int serviceEnd = siRelatedLink.indexOf("/service-instances/") serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd) + serviceType = UriUtils.decode(serviceType,"UTF-8") // get subscriber name int subscriberNameStart = siRelatedLink.indexOf("customers/customer/") int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/") subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd) + subscriberName = UriUtils.decode(subscriberName,"UTF-8") } String content = - """ + """ ${requestId} ${serviceInstanceId} @@ -508,97 +528,165 @@ class SDNCAdapterUtils { return content } - /** - * Validates a workflow response. - * @param execution the execution - * @param responseVar the execution variable in which the response is stored - * @param responseCodeVar the execution variable in which the response code is stored - * @param errorResponseVar the execution variable in which the error response is stored - */ - - public void validateSDNCResponseOld(Execution execution, String responseVar, - String responseCodeVar, String errorResponseVar) { - def method = getClass().getSimpleName() + '.validateWorkflowResponse(' + - 'execution=' + execution.getId() + - ', responseVar=' + responseVar + - ', responseCodeVar=' + responseCodeVar + - ', errorResponseVar=' + errorResponseVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def prefix = execution.getVariable('prefix') - execution.setVariable(prefix+'sdncResponseSuccess', false) - def response = execution.getVariable(responseVar) - taskProcessor.logDebug(responseVar + ' = ' + - (response == null ? "" : System.lineSeparator()) + - response, isDebugLogEnabled) - - def responseCode = execution.getVariable(responseCodeVar) - taskProcessor.logDebug(responseCodeVar + ' = ' + responseCode, isDebugLogEnabled) - - def errorResponse = execution.getVariable(errorResponseVar) - - errorResponse = taskProcessor.utils.getNodeText1(errorResponse,"ErrorMessage") - if (errorResponse == null) errorResponse = errorResponse - - taskProcessor.logDebug(errorResponseVar + ' = ' + - (errorResponse == null ? "" : System.lineSeparator()) + - errorResponse, isDebugLogEnabled) - - if ("200".equals(String.valueOf(responseCode)) || "201".equals(String.valueOf(responseCode))) { - - // we need to peer into the request data for error - def String callbackRequestData = taskProcessor.utils.getNodeXml(response, 'RequestData', false) - def String decodedXml = decodeXML(callbackRequestData) - taskProcessor.utils.log("DEBUG","decodedXml:\n" + decodedXml, isDebugLogEnabled) - - def int requestDataResponseCode = 200 - def String requestDataResponseMessage = '' - - if (taskProcessor.utils.nodeExists(decodedXml, "response-code")) { - try{ - requestDataResponseCode = ((String) taskProcessor.utils.getNodeText(decodedXml, "response-code")).toInteger() - }catch(Exception e){ - //TODO proper handling of new, non numerical response codes in 1607 and new error handling for common API - requestDataResponseCode = 500 - } - if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) { - requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message") - } - } - - taskProcessor.utils.log("DEBUG", "SDNC callback response-code: " + requestDataResponseCode, isDebugLogEnabled) - taskProcessor.utils.log("DEBUG", "SDNC callback response-message: " + requestDataResponseMessage, isDebugLogEnabled) - - // if response-code is not Success (200, 201, etc) we need to throw an exception - if (requestDataResponseCode < 200 || requestDataResponseCode > 299) { - ExceptionUtil exceptionUtil = new ExceptionUtil() - def convertedCode = exceptionUtil.MapSDNCResponseCodeToErrorCode(requestDataResponseCode.toString()) - taskProcessor.workflowException(execution, "Received error from SDN-C: " + requestDataResponseMessage, convertedCode) - - } - } - else { - taskProcessor.logWarn('Expected response code 200 or 201 in ' + responseCodeVar + ', got \'' + responseCode + '\'') - taskProcessor.workflowException(execution, errorResponse, responseCode) - } - - if (response == null || response.trim().equals("")) { - taskProcessor.logWarn(responseVar + ' is empty'); - taskProcessor.workflowException(execution, errorResponse, responseCode) - } - - execution.setVariable(prefix+'sdncResponseSuccess', true) - taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - taskProcessor.logError('Caught exception in ' + method, e) - taskProcessor.workflowException(execution, 'Internal Error- Unable to validate SDNC Response ' + e.getMessage(), 500) - } - } + /** + * Builds a topology SDNC request and return String request. + * As V2 will use 1607-style request, region instead of aic clli code + * @param execution, the execution + * @param requestXML, the incoming request for the flow + * @param serviceInstanceId, the serviceIntance (if available) + * @param callbackUrl, the call back url + * @param action, the action element value + * @param requestAction the svcOperation element value + * @param cloudRegionId the aai's cloud-region-id + * @param networkId the aai's network-id + * @param additionalData additional XML content to be inserted into the + * RequestData element (may be null) + */ + public String sdncTopologyRequestRsrc (Execution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String additionalData) { + def utils=new MsoUtils() + + // SNDC is expecting requestId as unique each call. + String requestId = "" + String testRequestId = execution.getVariable("testMessageId") // for test purposes. + if (testRequestId == null) { + requestId = UUID.randomUUID() // generate unique + } else { + requestId = testRequestId + } + + String aicCloudRegion = cloudRegionId + String tenantId = "" + if (utils.nodeExists(requestXML, "tenant-id")) { + tenantId = utils.getNodeText1(requestXML, "tenant-id") + } + String networkType = "" + if (utils.nodeExists(requestXML, "network-type")) { + networkType = utils.getNodeText1(requestXML, "network-type") + } + + String subscriptionServiceType = "" + if (utils.nodeExists(requestXML, "subscription-service-type")) { + subscriptionServiceType = utils.getNodeText1(requestXML, "subscription-service-type") + } + + String globalCustomerId = "" + if (utils.nodeExists(requestXML, "global-customer-id")) { + globalCustomerId = utils.getNodeText1(requestXML, "global-customer-id") + } + + String serviceId = "" + if (utils.nodeExists(requestXML, "service-id")) { + serviceId = utils.getNodeText1(requestXML, "service-id") + } + String networkName = "" + if (utils.nodeExists(requestXML, "network-name")) { + networkName = utils.getNodeText1(requestXML, "network-name") + } + String source = "" + if (utils.nodeExists(requestXML, "source")) { + source = utils.getNodeText1(requestXML, "source") + } + + // get resourceLink from subflow execution variable + String serviceType = "" + String subscriberName = "" + String siRelatedLink = execution.getVariable("GENGSI_siResourceLink") + if (siRelatedLink != null) { + // get service type + int serviceStart = siRelatedLink.indexOf("service-subscription/") + int serviceEnd = siRelatedLink.indexOf("/service-instances/") + serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd) + serviceType = UriUtils.decode(serviceType,"UTF-8") + // get subscriber name + int subscriberNameStart = siRelatedLink.indexOf("customers/customer/") + int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/") + subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd) + subscriberName = UriUtils.decode(subscriberName,"UTF-8") + } + + // network-information from 'networkModelInfo' // verify the DB Catalog response + String networkModelInfo = utils.getNodeXml(requestXML, "networkModelInfo", false).replace("tag0:","").replace(":tag0","") + String modelInvariantUuid = utils.getNodeText1(networkModelInfo, "modelInvariantUuid") !=null ? + utils.getNodeText1(networkModelInfo, "modelInvariantUuid") : "" + String modelCustomizationUuid = utils.getNodeText1(networkModelInfo, "modelCustomizationUuid") !=null ? + utils.getNodeText1(networkModelInfo, "modelCustomizationUuid") : "" + String modelUuid = utils.getNodeText1(networkModelInfo, "modelUuid") !=null ? + utils.getNodeText1(networkModelInfo, "modelUuid") : "" + String modelVersion = utils.getNodeText1(networkModelInfo, "modelVersion") !=null ? + utils.getNodeText1(networkModelInfo, "modelVersion") : "" + String modelName = utils.getNodeText1(networkModelInfo, "modelName") !=null ? + utils.getNodeText1(networkModelInfo, "modelName") : "" + + // service-information from 'networkModelInfo' // verify the DB Catalog response + String serviceModelInfo = utils.getNodeXml(requestXML, "serviceModelInfo", false).replace("tag0:","").replace(":tag0","") + String serviceModelInvariantUuid = utils.getNodeText1(serviceModelInfo, "modelInvariantUuid") !=null ? + utils.getNodeText1(serviceModelInfo, "modelInvariantUuid") : "" + String serviceModelUuid = utils.getNodeText1(serviceModelInfo, "modelUuid") !=null ? + utils.getNodeText1(serviceModelInfo, "modelUuid") : "" + String serviceModelVersion = utils.getNodeText1(serviceModelInfo, "modelVersion") !=null ? + utils.getNodeText1(serviceModelInfo, "modelVersion") : "" + String serviceModelName = utils.getNodeText1(serviceModelInfo, "modelName") !=null ? + utils.getNodeText1(serviceModelInfo, "modelName") : "" + + + String content = + """ + + ${requestId} + ${serviceInstanceId} + ${action} + network-topology-operation + sdncCallback + generic-resource + + + + ${requestId} + ${requestAction} + ${source} + + + + + + ${serviceId} + ${subscriptionServiceType} + + ${serviceModelInvariantUuid} + ${serviceModelUuid} + ${serviceModelVersion} + ${serviceModelName} + + ${serviceInstanceId} + ${globalCustomerId} + ${subscriberName} + + + ${networkId} + ${networkType} + + ${modelInvariantUuid} + ${modelCustomizationUuid} + ${modelUuid} + ${modelVersion} + ${modelName} + + + + ${networkName} + ${tenantId} + ${aicCloudRegion} + + + + + """.trim() + + return content + } + /** * Validates a workflow response. * @param execution the execution diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/ServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy similarity index 96% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/ServiceTaskProcessor.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy index 27699ca1c2..ef21818f81 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/ServiceTaskProcessor.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts; +package org.openecomp.mso.bpmn.common.scripts; import org.camunda.bpm.engine.runtime.Execution diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy similarity index 77% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/UpdateAAIGenericVnf.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy index 16edaf1410..2a13fb7d25 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/UpdateAAIGenericVnf.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy @@ -18,23 +18,13 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts - -import groovy.util.Node -import groovy.util.XmlParser; -import groovy.xml.QName - -import java.io.Serializable; +package org.openecomp.mso.bpmn.common.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution -import org.springframework.web.util.UriUtils - -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.core.RollbackData import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse +import org.springframework.web.util.UriUtils public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { @@ -51,6 +41,8 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { execution.setVariable('UAAIGenVnf_vnfId', null) execution.setVariable('UAAIGenVnf_personaModelId', null) execution.setVariable('UAAIGenVnf_personaModelVersion', null) + execution.setVariable("UAAIGenVnf_ipv4OamAddress", null) + execution.setVariable('UAAIGenVnf_managementV6Address', null) execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode' ,null) execution.setVariable('UAAIGenVnf_getGenericVnfResponse', '') execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', null) @@ -72,16 +64,31 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { try { def xml = execution.getVariable('UpdateAAIGenericVnfRequest') logDebug('Received request xml:\n' + xml, isDebugLogEnabled) + utils.logAudit("UpdateAAIGenericVnf Request XML: " + xml) initProcessVariables(execution) def vnfId = getRequiredNodeText(execution, xml,'vnf-id') execution.setVariable('UAAIGenVnf_vnfId', vnfId) - def personaModelId = getRequiredNodeText(execution, xml,'persona-model-id') - execution.setVariable('UAAIGenVnf_personaModelId', personaModelId) + def personaModelId = getNodeTextForce(xml,'persona-model-id') + if (personaModelId != null && !personaModelId.isEmpty()) { + execution.setVariable('UAAIGenVnf_personaModelId', personaModelId) + } - def personaModelVersion = getRequiredNodeText(execution, xml,'persona-model-version') - execution.setVariable('UAAIGenVnf_personaModelVersion', personaModelVersion) + def personaModelVersion = getNodeTextForce(xml,'persona-model-version') + if (personaModelVersion != null && !personaModelVersion.isEmpty()) { + execution.setVariable('UAAIGenVnf_personaModelVersion', personaModelVersion) + } + + def ipv4OamAddress = getNodeTextForce(xml, 'ipv4-oam-address') + if (ipv4OamAddress != null && !ipv4OamAddress.isEmpty()) { + execution.setVariable('UAAIGenVnf_ipv4OamAddress', ipv4OamAddress) + } + + def managementV6Address = getNodeTextForce(xml, 'management-v6-address') + if (managementV6Address != null && !managementV6Address.isEmpty()) { + execution.setVariable('UAAIGenVnf_managementV6Address', managementV6Address) + } logDebug('Exited ' + method, isDebugLogEnabled) } catch (BpmnError e) { @@ -112,29 +119,17 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { AaiUtil aaiUriUtil = new AaiUtil(this) def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) + String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" try { - RESTConfig config = new RESTConfig(endPoint); - def responseData = '' - def aaiRequestId = UUID.randomUUID().toString() - RESTClient client = new RESTClient(config). - addHeader('X-TransactionId', aaiRequestId). - addHeader('X-FromAppId', 'MSO'). - addHeader('Content-Type', 'application/xml'). - addHeader('Accept','application/xml'); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) - APIResponse response = client.httpGet() - - responseData = response.getResponseBodyAsString() + utils.logAudit("Sending GET to AAI endpoint: " + endPoint) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint) + def responseData = response.getResponseBodyAsString() execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode', response.getStatusCode()) execution.setVariable('UAAIGenVnf_getGenericVnfResponse', responseData) + utils.logAudit("UpdateAAIGenericVnf Response data: " + responseData) logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) } catch (Exception ex) { @@ -169,6 +164,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { def genericVnf = execution.getVariable('UAAIGenVnf_getGenericVnfResponse') def origRequest = execution.getVariable('UpdateAAIGenericVnfRequest') + utils.logAudit("UpdateGenericVnf Request: " + origRequest) // Confirm resource-version is in retrieved Generic VNF def Node genericVnfNode = xmlParser.parseText(genericVnf) if (utils.getChildNode(genericVnfNode, 'resource-version') == null) { @@ -178,23 +174,41 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { } // Handle persona-model-id/persona-model-version + def String newPersonaModelId = execution.getVariable('UAAIGenVnf_personaModelId') def String newPersonaModelVersion = execution.getVariable('UAAIGenVnf_personaModelVersion') + if (newPersonaModelId != null || newPersonaModelVersion != null) { - // Confirm "new" persona-model-id is same as "current" persona-model-id - def Node currPersonaModelIdNode = utils.getChildNode(genericVnfNode, 'persona-model-id') - def String currPersonaModelId = '' - if (currPersonaModelIdNode != null) { - currPersonaModelId = currPersonaModelIdNode.text() + // Confirm "new" persona-model-id is same as "current" persona-model-id + def Node currPersonaModelIdNode = utils.getChildNode(genericVnfNode, 'persona-model-id') + def String currPersonaModelId = '' + if (currPersonaModelIdNode != null) { + currPersonaModelId = currPersonaModelIdNode.text() + } + if (!newPersonaModelId.equals(currPersonaModelId)) { + def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values' + logError(msg) + throw new Exception(msg) + } + + // Construct payload + updateGenericVnfNode(origRequest, genericVnfNode, 'persona-model-version') } - if (!newPersonaModelId.equals(currPersonaModelId)) { - def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values' - logError(msg) - throw new Exception(msg) + + // Handle ipv4-oam-address + def String ipv4OamAddress = execution.getVariable('UAAIGenVnf_ipv4OamAddress') + if (ipv4OamAddress != null) { + // Construct payload + updateGenericVnfNode(origRequest, genericVnfNode, 'ipv4-oam-address') } - // Construct payload - updateGenericVnfNode(origRequest, genericVnfNode, 'persona-model-version') + // Handle management-v6-address + def String managementV6Address = execution.getVariable('UAAIGenVnf_managementV6Address') + if (managementV6Address != null) { + // Construct payload + updateGenericVnfNode(origRequest, genericVnfNode, 'management-v6-address') + } + def payload = utils.nodeToString(genericVnfNode) // Construct endpoint @@ -203,27 +217,15 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - try { - RESTConfig config = new RESTConfig(endPoint); - def responseData = '' - def aaiRequestId = UUID.randomUUID().toString() - RESTClient client = new RESTClient(config). - addHeader('X-TransactionId', aaiRequestId). - addHeader('X-FromAppId', 'MSO'). - addHeader('Content-Type', 'application/xml'). - addHeader('Accept','application/xml'); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - logDebug('sending PUT to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled) - APIResponse response = client.httpPut(payload) - - responseData = response.getResponseBodyAsString() + utils.logAudit("Sending PUT to AAI endpoint: " + endPoint) + + APIResponse response = aaiUriUtil.executeAAIPutCall(execution, endPoint, payload) + def responseData = response.getResponseBodyAsString() execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', response.getStatusCode()) execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', responseData) + utils.logAudit("UpdateAAIGenericVnf Response Data: " + responseData) logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) } catch (Exception ex) { @@ -302,6 +304,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { execution.getVariable('UAAIGenVnf_getGenericVnfResponse')) execution.setVariable('WorkflowException', exception) + utils.logAudit("Workflow Exception occurred when handling Quering AAI: " + exception.getErrorMessage()) logDebug('Exited ' + method, isDebugLogEnabled) } @@ -320,11 +323,13 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor { logError('Error occurred attempting to update Generic VNF in AAI, Response Code ' + execution.getVariable('UAAIGenVnf_updateGenericVnfResponseCode') + ', Error Response ' + execution.getVariable('UAAIGenVnf_updateGenericVnfResponse')) + String processKey = getProcessKey(execution); WorkflowException exception = new WorkflowException(processKey, 5000, execution.getVariable('UAAIGenVnf_updateGenericVnfResponse')) execution.setVariable('WorkflowException', exception) + utils.logAudit("Workflow Exception occurred when Updating GenericVnf: " + exception.getErrorMessage()) logDebug('Exited ' + method, isDebugLogEnabled) } } diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/UpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy similarity index 90% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/UpdateAAIVfModule.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy index b8b8b8baa2..e1949d981d 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/UpdateAAIVfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy @@ -18,23 +18,13 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts - -import groovy.util.Node -import groovy.util.XmlParser; -import groovy.xml.QName - -import java.io.Serializable; +package org.openecomp.mso.bpmn.common.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution -import org.springframework.web.util.UriUtils - -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.core.RollbackData import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse +import org.springframework.web.util.UriUtils public class UpdateAAIVfModule extends AbstractServiceTaskProcessor { @@ -74,6 +64,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor { try { def xml = execution.getVariable('UpdateAAIVfModuleRequest') logDebug('Received request xml:\n' + xml, isDebugLogEnabled) + utils.logAudit("UpdateAAIVfModule Request XML: " + xml) initProcessVariables(execution) def vnfId = getRequiredNodeText(execution, xml,'vnf-id') @@ -114,29 +105,17 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor { logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + UriUtils.encode(vfModuleId, "UTF-8") - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - try { - RESTConfig config = new RESTConfig(endPoint); - def responseData = '' - def aaiRequestId = UUID.randomUUID().toString() - RESTClient client = new RESTClient(config). - addHeader('X-TransactionId', aaiRequestId). - addHeader('X-FromAppId', 'MSO'). - addHeader('Content-Type', 'application/xml'). - addHeader('Accept','application/xml'); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) - APIResponse response = client.httpGet() + utils.logAudit("UpdateAAIVfModule sending GET to AAI endpoint: " + endPoint) - responseData = response.getResponseBodyAsString() + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint) + def responseData = response.getResponseBodyAsString() execution.setVariable('UAAIVfMod_getVfModuleResponseCode', response.getStatusCode()) execution.setVariable('UAAIVfMod_getVfModuleResponse', responseData) logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) + utils.logAudit("UpdateAAIVfModule response data: " + responseData) } catch (Exception ex) { ex.printStackTrace() logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled) @@ -171,6 +150,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor { def origRequest = execution.getVariable('UpdateAAIVfModuleRequest') def Node vfModuleNode = xmlParser.parseText(vfModule) + utils.logAudit("UpdateAAIVfModule request: " + origRequest) // Confirm resource-version is in retrieved VF Module if (utils.getChildNode(vfModuleNode, 'resource-version') == null) { def msg = 'Can\'t update VF Module ' + vfModuleId + ' since \'resource-version\' is missing' @@ -221,27 +201,15 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor { logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + UriUtils.encode(vfModuleId, "UTF-8") - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - try { - RESTConfig config = new RESTConfig(endPoint); - def responseData = '' - def aaiRequestId = UUID.randomUUID().toString() - RESTClient client = new RESTClient(config). - addHeader('X-TransactionId', aaiRequestId). - addHeader('X-FromAppId', 'MSO'). - addHeader('Content-Type', 'application/xml'). - addHeader('Accept','application/xml'); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - logDebug('sending PUT to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled) - APIResponse response = client.httpPut(payload) - - responseData = response.getResponseBodyAsString() + utils.logAudit("Sending PUT to AAI endpoint: " + endPoint) + + APIResponse response = aaiUriUtil.executeAAIPutCall(execution, endPoint, payload) + def responseData = response.getResponseBodyAsString() execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', response.getStatusCode()) execution.setVariable('UAAIVfMod_updateVfModuleResponse', responseData) + utils.logAudit("UpdateAAIVfModule Response data: " + responseData) logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) } catch (Exception ex) { @@ -387,7 +355,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor { WorkflowException exception = new WorkflowException(processKey, 5000, execution.getVariable('UAAIVfMod_getVfModuleResponse')) execution.setVariable('WorkflowException', exception) - + utils.logAudit("UpdateAAIVfModule query failure: " + exception.getErrorMessage()) logDebug('Exited ' + method, isDebugLogEnabled) } @@ -411,6 +379,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor { execution.getVariable('UAAIVfMod_updateVfModuleResponse')) execution.setVariable('WorkflowException', exception) + utils.logAudit("UpdateAAIVfModule failure: " + exception.getErrorMessage()) logDebug('Exited ' + method, isDebugLogEnabled) } } diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/VfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModule.groovy similarity index 91% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/VfModule.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModule.groovy index 98452810eb..f52d21513d 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/VfModule.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModule.groovy @@ -18,18 +18,10 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts; +package org.openecomp.mso.bpmn.common.scripts; -import groovy.util.Node; - -import java.util.concurrent.ExecutionException; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution import org.apache.commons.lang3.* -import org.openecomp.mso.bpmn.core.WorkflowException - public class VfModule implements Serializable { /** diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy similarity index 93% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/VfModuleBase.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy index ba920cec72..b4d3c6f4d8 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/VfModuleBase.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy @@ -18,30 +18,22 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts; +package org.openecomp.mso.bpmn.common.scripts; //import groovy.util.Node; -import java.util.concurrent.ExecutionException; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution -import org.apache.commons.lang3.* - import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.runtime.Execution import org.w3c.dom.Document import org.w3c.dom.Element -import org.w3c.dom.NamedNodeMap import org.w3c.dom.Node -import org.w3c.dom.NodeList; +import org.w3c.dom.NodeList import org.xml.sax.InputSource -import org.openecomp.mso.bpmn.core.WorkflowException - - public abstract class VfModuleBase extends AbstractServiceTaskProcessor { protected XmlParser xmlParser = new XmlParser() @@ -312,11 +304,13 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { String vnfNetworkSubNetId = "" String vnfNetworkV6SubNetId = "" String vnfNetworkNetFqdn = "" + String vnfNetworksSriovVlanFilters = "" StringBuilder sbNet = new StringBuilder() StringBuilder sbNet2 = new StringBuilder() StringBuilder sbNet3 = new StringBuilder() StringBuilder sbNet4 = new StringBuilder() StringBuilder sbNet5 = new StringBuilder() + StringBuilder sbNet6 = new StringBuilder() NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks") for (int x = 0; x < vnfNetworkList.getLength(); x++) { Node node = vnfNetworkList.item(x) @@ -358,7 +352,32 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { ${vnfNetworkNetFqdnValue} """ vnfNetworkNetFqdn = sbNet4.append(vnfNetworkNetFqdnXml) - } + + NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list") + StringBuffer sriovFilterBuf = new StringBuffer() + String values = "" + for(int i = 0; i < sriovVlanFilterList.getLength(); i++){ + Node node1 = sriovVlanFilterList.item(i) + if (node1.getNodeType() == Node.ELEMENT_NODE) { + Element eElement1 = (Element) node1 + String value = utils.getElementText(eElement1, "sriov-vlan-filter") + if (i != sriovVlanFilterList.getLength() - 1) { + values = sriovFilterBuf.append(value + ",") + } + else { + values = sriovFilterBuf.append(value); + } + } + } + if (!values.isEmpty()) { + String vnfNetworkSriovVlanFilterXml = + """ + ${vnfNetworkKey}_ATT_VF_VLAN_FILTER + ${values} + """ + vnfNetworksSriovVlanFilters = sbNet6.append(vnfNetworkSriovVlanFilterXml) + } + } } // VNF-VMS Data @@ -480,7 +499,10 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a) if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) { Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix - String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") + String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr") + if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) { + interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix") + } if (a != interfaceRoutePrefixesList.getLength() - 1) { interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",") } @@ -569,6 +591,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor { ${vnfNetworkSubNetId} ${vnfNetworkV6SubNetId} ${vnfNetworkNetFqdn} + ${vnfNetworksSriovVlanFilters} ${vnfVMS} ${vnfVMSPositions} ${vmNetworks} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/VidUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtils.groovy similarity index 57% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/VidUtils.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtils.groovy index 364c586325..de59c68a7d 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/VidUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtils.groovy @@ -18,17 +18,14 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts - -import org.json.JSONObject; -import org.json.XML; - -import org.openecomp.mso.bpmn.core.xml.XmlTool; +package org.openecomp.mso.bpmn.common.scripts import groovy.json.JsonBuilder import groovy.json.JsonSlurper -import groovy.util.slurpersupport.GPathResult -import groovy.xml.QName + +import org.json.JSONObject +import org.json.XML +import org.openecomp.mso.bpmn.core.xml.XmlTool class VidUtils { @@ -83,9 +80,14 @@ class VidUtils { def asdcServiceModelVersion = '' def suppressRollback = requestMap.requestDetails.requestInfo.suppressRollback - def rollbackEnabled = true - if(suppressRollback != null && suppressRollback == true) { - rollbackEnabled = false + + def backoutOnFailure = "" + if(suppressRollback != null){ + if ( suppressRollback == true) { + backoutOnFailure = "false" + } else if ( suppressRollback == false) { + backoutOnFailure = "true" + } } def volGrpName = requestMap.requestDetails.requestInfo?.instanceName ?: '' @@ -108,6 +110,8 @@ class VidUtils { if(userParams != null) { userParamsNode = buildUserParams(userParams) } + def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationId ?: '' + def xmlReq = """ @@ -124,7 +128,8 @@ class VidUtils { ${requestMap.requestDetails.cloudConfiguration.lcpCloudRegionId} ${requestMap.requestDetails.cloudConfiguration.tenantId} ${serviceId} - ${rollbackEnabled} + ${backoutOnFailure} + ${modelCustomizationId} $userParamsNode @@ -198,6 +203,7 @@ class VidUtils { * @param execution * @param xmlRequestDetails - requestDetails in xml * @return + * Note: See latest version: createXmlNetworkRequestInstance() */ public String createXmlNetworkRequestInfra(execution, def networkJsonIncoming) { @@ -214,7 +220,15 @@ class VidUtils { def lcpCloudRegionId = reqMap.requestDetails.cloudConfiguration.lcpCloudRegionId def tenantId = reqMap.requestDetails.cloudConfiguration.tenantId def serviceId = reqMap.requestDetails.requestInfo.productFamilyId - def backoutOnFailure = reqMap.requestDetails.requestInfo.suppressRollback + def suppressRollback = reqMap.requestDetails.requestInfo.suppressRollback.toString() + def backoutOnFailure = "" + if(suppressRollback != null){ + if (suppressRollback == true || suppressRollback == "true") { + backoutOnFailure = "false" + } else if (suppressRollback == false || suppressRollback == "false") { + backoutOnFailure = "true" + } + } //def userParams = reqMap.requestDetails.requestParameters.userParams //def userParamsNode = buildUserParams(userParams) @@ -223,7 +237,10 @@ class VidUtils { if(userParams != null) { userParamsNode = buildUserParams(userParams) } - + + //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC) + def sdncVersion = execution.getVariable("sdncVersion") + def xmlReq = """ @@ -240,6 +257,7 @@ class VidUtils { ${tenantId} ${serviceId} ${backoutOnFailure} + ${sdncVersion} ${userParamsNode} @@ -254,6 +272,169 @@ class VidUtils { } } + /** + * Create a network-request XML using a map, + * @param execution + * @return + */ + public String createXmlNetworkRequestInstance(execution) { + + def networkModelVersionId = "" + def networkModelName = "" + def networkModelType = "" + def networkModelVersion = "" + def networkModelCustomizationId = "" + def networkModelInvariantId = "" + + // verify the DB Catalog response JSON structure + def networkModelInfo = execution.getVariable("networkModelInfo") + def jsonSlurper = new JsonSlurper() + if (networkModelInfo != null) { + try { + Map modelMap = jsonSlurper.parseText(networkModelInfo) + if (modelMap != null) { + if (networkModelInfo.contains("modelVersionId")) { + networkModelVersionId = modelMap.modelVersionId !=null ? modelMap.modelVersionId : "" + } + if (networkModelInfo.contains("modelName")) { + networkModelName = modelMap.modelName !=null ? modelMap.modelName : "" + } + if (networkModelInfo.contains("modelType")) { + networkModelType = modelMap.modelType !=null ? modelMap.modelType : "" + } + if (networkModelInfo.contains("modelVersion")) { + networkModelVersion = modelMap.modelVersion !=null ? modelMap.modelVersion : "" + } + if (networkModelInfo.contains("modelCustomizationId")) { + networkModelCustomizationId = modelMap.modelCustomizationId !=null ? modelMap.modelCustomizationId : "" + } + if (networkModelInfo.contains("modelInvariantId")) { + networkModelInvariantId = modelMap.modelInvariantId !=null ? modelMap.modelInvariantId : "" + } + } + } catch (Exception ex) { + throw ex + } + } + + def serviceModelVersionId = "" + def serviceModelName = "" + def serviceModelType = "" + def serviceModelVersion = "" + def serviceModelCustomizationId = "" + def serviceModelInvariantId = "" + + // verify the DB Catalog response JSON structure + def serviceModelInfo = execution.getVariable("serviceModelInfo") + def jsonServiceSlurper = new JsonSlurper() + if (serviceModelInfo != null) { + try { + Map modelMap = jsonServiceSlurper.parseText(serviceModelInfo) + if (modelMap != null) { + if (serviceModelInfo.contains("modelVersionId")) { + serviceModelVersionId = modelMap.modelVersionId !=null ? modelMap.modelVersionId : "" + } + if (serviceModelInfo.contains("modelName")) { + serviceModelName = modelMap.modelName !=null ? modelMap.modelName : "" + } + if (serviceModelInfo.contains("modelType")) { + serviceModelType = modelMap.modelType !=null ? modelMap.modelType : "" + } + if (serviceModelInfo.contains("modelVersion")) { + serviceModelVersion = modelMap.modelVersion !=null ? modelMap.modelVersion : "" + } + if (serviceModelInfo.contains("modelCustomizationId")) { + serviceModelCustomizationId = modelMap.modelCustomizationId !=null ? modelMap.modelCustomizationId : "" + } + if (serviceModelInfo.contains("modelInvariantId")) { + serviceModelInvariantId = modelMap.modelInvariantId !=null ? modelMap.modelInvariantId : "" + } + } + } catch (Exception ex) { + throw ex + } + } + + + def subscriptionServiceType = execution.getVariable("subscriptionServiceType") != null ? execution.getVariable("subscriptionServiceType") : "" + def globalSubscriberId = execution.getVariable("globalSubscriberId") != null ? execution.getVariable("globalSubscriberId") : "" + def requestId = execution.getVariable("msoRequestId") + def serviceInstanceId = execution.getVariable("serviceInstanceId") != null ? execution.getVariable("serviceInstanceId") : "" + def networkId = (execution.getVariable("networkId")) != null ? execution.getVariable("networkId") : "" // optional + def networkName = execution.getVariable("networkName") != null ? execution.getVariable("networkName") : "" // optional + def aicCloudReqion = execution.getVariable("lcpCloudRegionId") != null ? execution.getVariable("lcpCloudRegionId") : "" + def tenantId = execution.getVariable("tenantId") != null ? execution.getVariable("tenantId") : "" + def serviceId = execution.getVariable("productFamilyId") != null ? execution.getVariable("productFamilyId") : "" + def failIfExist = execution.getVariable("failIfExists") != null ? execution.getVariable("failIfExists") : "" + def suppressRollback = execution.getVariable("disableRollback") + def backoutOnFailure = "" + if(suppressRollback != null){ + if (suppressRollback == true || suppressRollback == "true") { + backoutOnFailure = "false" + } else if (suppressRollback == false || suppressRollback == "'false") { + backoutOnFailure = "true" + } + } + + //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC) + def sdncVersion = execution.getVariable("sdncVersion") + + def source = "VID" + def action = execution.getVariable("action") + + def userParamsNode = "" + def userParams = execution.getVariable("networkInputParams") + if(userParams != null) { + userParamsNode = buildUserParams(userParams) + } + + def xmlReq = """ + + + ${requestId} + ${action} + ${source} + ${serviceInstanceId} + + + ${networkId} + ${networkName} + ${networkModelType} + ${subscriptionServiceType} + ${globalSubscriberId} + ${aicCloudReqion} + ${tenantId} + ${serviceId} + ${backoutOnFailure} + ${failIfExist} + + ${networkModelName} + ${networkModelVersionId} + ${networkModelInvariantId} + ${networkModelVersion} + ${networkModelCustomizationId} + ${networkModelType} + + + ${serviceModelName} + ${serviceModelVersionId} + ${serviceModelInvariantId} + ${serviceModelVersion} + ${serviceModelCustomizationId} + ${serviceModelType} + + ${sdncVersion} + + + ${userParamsNode} + + + """ + // return a pretty-print of the volume-request xml without the preamble + return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "") + + } + /** * Create a vnf-request XML using a map * @param requestMap - map created from VID JSON @@ -306,13 +487,18 @@ class VidUtils { isBaseVfModule = "true" } - def requestId = execution.getVariable("att-mso-request-id") + def requestId = execution.getVariable("mso-request-id") def vfModuleName = requestMap.requestDetails?.requestInfo?.instanceName ?: '' def vfModuleModelName = requestMap.requestDetails?.modelInfo?.modelName ?: '' def suppressRollback = requestMap.requestDetails?.requestInfo?.suppressRollback - def backoutOnFailure = "true" - if(suppressRollback != null && suppressRollback == true) { - backoutOnFailure = "false" + + def backoutOnFailure = "" + if(suppressRollback != null){ + if ( suppressRollback == true) { + backoutOnFailure = "false" + } else if ( suppressRollback == false) { + backoutOnFailure = "true" + } } def serviceId = requestMap.requestDetails?.requestParameters?.serviceId ?: '' @@ -320,6 +506,7 @@ class VidUtils { def tenantId = requestMap.requestDetails?.cloudConfiguration?.tenantId ?: '' def personaModelId = requestMap.requestDetails?.modelInfo?.modelInvariantId ?: '' def personaModelVersion = requestMap.requestDetails?.modelInfo?.modelVersion ?: '' + def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationId ?: '' def xmlReq = """ @@ -339,6 +526,7 @@ class VidUtils { ${vfModuleId} ${vfModuleName} ${vfModuleModelName} + ${modelCustomizationId} ${isBaseVfModule} ${asdcServiceModelInfo} ${aicCloudRegion} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy similarity index 94% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/VnfAdapterRestV1.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy index f952bee165..31c5596cbb 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/VnfAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -18,19 +18,11 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.common.scripts -import groovy.xml.XmlUtil - -import java.text.SimpleDateFormat -import java.net.URLEncoder - -import org.apache.commons.codec.binary.Base64 import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution - -import org.openecomp.mso.bpmn.core.WorkflowException import org.openecomp.mso.rest.APIResponse import org.openecomp.mso.rest.RESTClient import org.openecomp.mso.rest.RESTConfig @@ -52,7 +44,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { setSuccessIndicator(execution, false) try { - String request = validateRequest(execution, "att-mso-request-id") + String request = validateRequest(execution, "mso-request-id") // Get the request type (the name of the root element) from the request @@ -72,8 +64,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) } - execution.setVariable(prefix + 'messageId', messageId) - logDebug(getProcessKey(execution) + ': ' + prefix + 'messageId = ' + messageId, isDebugLogEnabled) + execution.setVariable('VNFAResponse_CORRELATOR', messageId) + logDebug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId, isDebugLogEnabled) // Get the notificationUrl from the request @@ -338,30 +330,27 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - String prefix = execution.getVariable('prefix') - String callback = execution.getVariable(prefix + 'callback') + String callback = execution.getVariable('VNFAResponse_MESSAGE') try { logDebug(getProcessKey(execution) + ": received callback:\n" + callback, isDebugLogEnabled) - Node root = new XmlParser().parseText(callback) - if (root.name().endsWith('Exception')) { - vnfAdapterWorkflowException(execution, callback) - } - // The XML callback is available to the calling flow in any case, - // even if a WorkflowException was generated. + // even if a WorkflowException is generated. execution.setVariable(getProcessKey(execution) + 'Response', callback) // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead. execution.setVariable("WorkflowResponse", callback) - } catch(BpmnError b){ - throw b + + Node root = new XmlParser().parseText(callback) + if (root.name().endsWith('Exception')) { + vnfAdapterWorkflowException(execution, callback) + } } catch (Exception e) { e.printStackTrace() callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback String msg = "Received error from VnfAdapter: " + callback logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7020, msg) + exceptionUtil.buildWorkflowException(execution, 7020, msg) } } @@ -379,13 +368,11 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { message = message == null || message.isEmpty() ? "" : " message='" + message + "'" String rolledBack = getChildText(root, "rolledBack") rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'" - exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Received " + root.name() + + exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() + " from VnfAdapter:" + category + message + rolledBack); - }catch(BpmnError b){ - throw b - }catch (Exception e) { + } catch (Exception e) { response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response - exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response) + exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response) } } diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy similarity index 71% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/VnfAdapterUtils.groovy rename to bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy index e92af96484..cd8d2a3374 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/VnfAdapterUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy @@ -7,9 +7,9 @@ * 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. @@ -17,11 +17,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.common.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution; +import org.openecomp.mso.bpmn.core.WorkflowException class VnfAdapterUtils { @@ -50,11 +50,22 @@ class VnfAdapterUtils { def responseCode = execution.getVariable(responseCodeVar) def errorResponse = execution.getVariable(errorResponseVar) + // The following if statement never appears to be true as any VNF Adapter error seems to be stored in 'errorResponse'. + // Also, the value is stored as a WorkflowException object, not a String. Added the else if to provide the proper + // functionality but leaving the original code in case it is hit under some circumstances. if (response.contains("WorkflowException")) { execution.setVariable(prefix + "ErrorResponse", response) //execution.setVariable(prefix + "ResponseCode", responseCode) taskProcessor.logDebug(" Sub Vnf flow Error WorkflowException Response - " + "\n" + response, isDebugLogEnabled) throw new BpmnError("MSOWorkflowException") + } else if (errorResponse != null && errorResponse instanceof WorkflowException) { + // Not sure the variables with the associated prefix are still used + execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage()) + execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode()) + taskProcessor.logDebug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + + errorResponse.getErrorMessage(), isDebugLogEnabled) + // this is the important part to ensure we hit the Fallout Handler + throw new BpmnError("MSOWorkflowException") } } catch (BpmnError e) { throw e; diff --git a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/MSOGammaApplication.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/MSOCommonApplication.java similarity index 93% rename from bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/MSOGammaApplication.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/MSOCommonApplication.java index 4dadd8c127..9931247885 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/MSOGammaApplication.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/MSOCommonApplication.java @@ -1,3 +1,4 @@ +package org.openecomp.mso.bpmn.common; /*- * ============LICENSE_START======================================================= * OPENECOMP - MSO @@ -18,7 +19,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.gamma; + import java.util.List; @@ -35,8 +36,8 @@ import org.openecomp.mso.logger.MsoLogger; * @since Version 1.0 * */ -@ProcessApplication("MSO Gamma Application") -public class MSOGammaApplication extends ServletProcessApplication { +@ProcessApplication("MSO Common Application") +public class MSOCommonApplication extends ServletProcessApplication { private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/CallbackHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java similarity index 92% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/CallbackHeader.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java index 38f7bc5cbb..031d963ff4 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/CallbackHeader.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/CallbackHeader.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.sdnc.adapter.schema.v1; +package org.openecomp.mso.bpmn.common.adapter.sdnc; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -53,15 +53,15 @@ import javax.xml.bind.annotation.XmlType; "requestId", "responseCode", "responseMessage" -}, namespace="http://domain2.att.com/workflow/sdnc/adapter/schema/v1") +}, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") @XmlRootElement(name = "CallbackHeader") public class CallbackHeader { - @XmlElement(name = "RequestId", required = true, namespace="http://domain2.att.com/workflow/sdnc/adapter/schema/v1") + @XmlElement(name = "RequestId", required = true, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") protected String requestId; - @XmlElement(name = "ResponseCode", required = true,namespace="http://domain2.att.com/workflow/sdnc/adapter/schema/v1") + @XmlElement(name = "ResponseCode", required = true,namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") protected String responseCode; - @XmlElement(name = "ResponseMessage", required = true,namespace="http://domain2.att.com/workflow/sdnc/adapter/schema/v1") + @XmlElement(name = "ResponseMessage", required = true,namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") protected String responseMessage; /** diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/ObjectFactory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java similarity index 73% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/ObjectFactory.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java index adb0a2335e..2e0ae1b930 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/ObjectFactory.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java @@ -7,9 +7,9 @@ * 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. @@ -18,39 +18,39 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.sdnc.adapter.schema.v1; +package org.openecomp.mso.bpmn.common.adapter.sdnc; import javax.xml.bind.annotation.XmlRegistry; /** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the com.att.domain2.workflow.sdnc.adapter.schema.v1 package. - *

    An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 package. + *

    An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are * provided in this class. - * + * */ @XmlRegistry public class ObjectFactory { /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.att.domain2.workflow.sdnc.adapter.schema.v1 - * + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 + * */ public ObjectFactory() { } /** * Create an instance of {@link RequestHeader } - * + * */ public RequestHeader createRequestHeader() { return new RequestHeader(); @@ -58,7 +58,7 @@ public class ObjectFactory { /** * Create an instance of {@link SDNCAdapterResponse } - * + * */ public SDNCAdapterResponse createSDNCAdapterResponse() { return new SDNCAdapterResponse(); @@ -66,7 +66,7 @@ public class ObjectFactory { /** * Create an instance of {@link SDNCAdapterCallbackRequest } - * + * */ public SDNCAdapterCallbackRequest createSDNCAdapterCallbackRequest() { return new SDNCAdapterCallbackRequest(); @@ -74,7 +74,7 @@ public class ObjectFactory { /** * Create an instance of {@link CallbackHeader } - * + * */ public CallbackHeader createCallbackHeader() { return new CallbackHeader(); @@ -82,7 +82,7 @@ public class ObjectFactory { /** * Create an instance of {@link SDNCAdapterRequest } - * + * */ public SDNCAdapterRequest createSDNCAdapterRequest() { return new SDNCAdapterRequest(); diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/RequestHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java similarity index 99% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/RequestHeader.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java index 40eeb11856..27b1245856 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/RequestHeader.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.sdnc.adapter.schema.v1; +package org.openecomp.mso.bpmn.common.adapter.sdnc; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/SDNCAdapterCallbackRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java similarity index 89% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/SDNCAdapterCallbackRequest.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java index 663983ace1..5abdbd667c 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/SDNCAdapterCallbackRequest.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.sdnc.adapter.schema.v1; +package org.openecomp.mso.bpmn.common.adapter.sdnc; import java.io.StringWriter; @@ -42,7 +42,7 @@ import javax.xml.bind.annotation.XmlType; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <element ref="{http://domain2.att.com/workflow/sdnc/adapter/schema/v1}CallbackHeader"/> + * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}CallbackHeader"/> * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType" minOccurs="0"/> * </sequence> * </restriction> @@ -53,16 +53,16 @@ import javax.xml.bind.annotation.XmlType; * */ @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", namespace="http://domain2.att.com/workflow/sdnc/adapter/schema/v1", propOrder = { +@XmlType(name = "", namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1", propOrder = { "callbackHeader", "requestData" }) -@XmlRootElement(name = "SDNCAdapterCallbackRequest", namespace="http://domain2.att.com/workflow/sdnc/adapter/schema/v1") +@XmlRootElement(name = "SDNCAdapterCallbackRequest", namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") public class SDNCAdapterCallbackRequest { - @XmlElement(name = "CallbackHeader", required = true, namespace="http://domain2.att.com/workflow/sdnc/adapter/schema/v1") + @XmlElement(name = "CallbackHeader", required = true, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") protected CallbackHeader callbackHeader; - @XmlElement(name = "RequestData", required=false, namespace="http://domain2.att.com/workflow/sdnc/adapter/schema/v1") + @XmlElement(name = "RequestData", required=false, namespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") protected Object requestData; /** diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/SDNCAdapterRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java similarity index 95% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/SDNCAdapterRequest.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java index 4de63090b7..1bcd053631 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/SDNCAdapterRequest.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.sdnc.adapter.schema.v1; +package org.openecomp.mso.bpmn.common.adapter.sdnc; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -37,7 +37,7 @@ import javax.xml.bind.annotation.XmlType; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <element ref="{http://domain2.att.com/workflow/sdnc/adapter/schema/v1}RequestHeader"/> + * <element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}RequestHeader"/> * <element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/> * </sequence> * </restriction> diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/SDNCAdapterResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java similarity index 96% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/SDNCAdapterResponse.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java index 88fbd8f993..829af2c20b 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/SDNCAdapterResponse.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.sdnc.adapter.schema.v1; +package org.openecomp.mso.bpmn.common.adapter.sdnc; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/callback/wsdl/v1/SDNCCallbackAdapterPortType.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java similarity index 75% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/callback/wsdl/v1/SDNCCallbackAdapterPortType.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java index f035b0204c..6458f4ba9d 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/callback/wsdl/v1/SDNCCallbackAdapterPortType.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java @@ -7,9 +7,9 @@ * 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. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.sdnc.adapter.callback.wsdl.v1; +package org.openecomp.mso.bpmn.common.adapter.sdnc; import javax.jws.WebMethod; import javax.jws.WebParam; @@ -26,9 +26,6 @@ import javax.jws.WebResult; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; -import com.att.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterCallbackRequest; -import com.att.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterResponse; - /** * This class was generated by the JAX-WS RI. @@ -36,7 +33,7 @@ import com.att.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterResponse; * Generated source version: 2.2 * */ -@WebService(name = "SDNCCallbackAdapterPortType", targetNamespace = "http://domain2.att.com/workflow/sdnc/adapter/callback/wsdl/v1") +@WebService(name = "SDNCCallbackAdapterPortType", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) public interface SDNCCallbackAdapterPortType { @@ -45,12 +42,12 @@ public interface SDNCCallbackAdapterPortType { * * @param sdncAdapterCallbackRequest * @return - * returns com.att.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterResponse + * returns org.openecomp.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterResponse */ @WebMethod(operationName = "SDNCAdapterCallback") - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://domain2.att.com/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") + @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") public SDNCAdapterResponse sdncAdapterCallback( - @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://domain2.att.com/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest") + @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest") SDNCAdapterCallbackRequest sdncAdapterCallbackRequest); } diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/package-info.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/package-info.java similarity index 81% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/package-info.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/package-info.java index 002e655a7b..23ae1aef49 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/sdnc/adapter/schema/v1/package-info.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/package-info.java @@ -18,5 +18,5 @@ * ============LICENSE_END========================================================= */ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://domain2.att.com/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package com.att.domain2.workflow.sdnc.adapter.schema.v1; +@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package org.openecomp.mso.bpmn.common.adapter.sdnc; diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/CreateVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java similarity index 97% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/CreateVnfNotification.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java index 220441a5ae..c2e610d695 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/CreateVnfNotification.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/CreateVnfNotification.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1; +package org.openecomp.mso.bpmn.common.adapter.vnf; import java.util.ArrayList; import java.util.List; @@ -41,7 +41,7 @@ import javax.xml.bind.annotation.XmlType; * <sequence> * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://com.att.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> + * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * <element name="outputs" minOccurs="0"> @@ -66,7 +66,7 @@ import javax.xml.bind.annotation.XmlType; * </complexContent> * </complexType> * </element> - * <element name="rollback" type="{http://com.att.mso/vnfNotify}vnfRollback" minOccurs="0"/> + * <element name="rollback" type="{http://org.openecomp.mso/vnfNotify}vnfRollback" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> @@ -436,7 +436,7 @@ public class CreateVnfNotification { public String toString() { String createVnfNotification = ""; if (exception==null) { - createVnfNotification = "" + '\n' + " "+messageId+"" + '\n' + " "+completed+"" + '\n' + @@ -445,7 +445,7 @@ public class CreateVnfNotification { " "+rollback+"" + '\n' + ""; } else { - createVnfNotification = "" + '\n' + " "+messageId+"" + '\n' + " "+completed+"" + '\n' + diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/DeleteVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java similarity index 91% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/DeleteVnfNotification.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java index 9ca53a8779..b408184ae3 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/DeleteVnfNotification.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java @@ -18,20 +18,13 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1; +package org.openecomp.mso.bpmn.common.adapter.vnf; -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; -import com.att.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterCallbackRequest; - /** *

    Java class for deleteVnfNotification complex type. @@ -45,7 +38,7 @@ import com.att.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterCallbackReques * <sequence> * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://com.att.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> + * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * </sequence> * </restriction> @@ -167,13 +160,13 @@ public class DeleteVnfNotification { public String toString() { String deleteVnfNotification = ""; if (exception==null) { - deleteVnfNotification = "" + '\n' + " "+messageId+"" + '\n' + " "+completed+"" + '\n' + ""; } else { - deleteVnfNotification = "" + '\n' + " "+messageId+"" + '\n' + " "+completed+"" + '\n' + diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/MsoExceptionCategory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java similarity index 96% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/MsoExceptionCategory.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java index 9d430ceaef..80673a0fb6 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/MsoExceptionCategory.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1; +package org.openecomp.mso.bpmn.common.adapter.vnf; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/MsoRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java similarity index 97% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/MsoRequest.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java index 981030689f..f251a31ce8 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/MsoRequest.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1; +package org.openecomp.mso.bpmn.common.adapter.vnf; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/ObjectFactory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java similarity index 88% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/ObjectFactory.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java index 3c42f35239..1a38539f45 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/ObjectFactory.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/ObjectFactory.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1; +package org.openecomp.mso.bpmn.common.adapter.vnf; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlElementDecl; @@ -43,11 +43,11 @@ import javax.xml.namespace.QName; @XmlRegistry public class ObjectFactory { - private final static QName _RollbackVnfNotification_QNAME = new QName("http://com.att.mso/vnfNotify", "rollbackVnfNotification"); - private final static QName _DeleteVnfNotification_QNAME = new QName("http://com.att.mso/vnfNotify", "deleteVnfNotification"); - private final static QName _CreateVnfNotification_QNAME = new QName("http://com.att.mso/vnfNotify", "createVnfNotification"); - private final static QName _UpdateVnfNotification_QNAME = new QName("http://com.att.mso/vnfNotify", "updateVnfNotification"); - private final static QName _QueryVnfNotification_QNAME = new QName("http://com.att.mso/vnfNotify", "queryVnfNotification"); + private final static QName _RollbackVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "rollbackVnfNotification"); + private final static QName _DeleteVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "deleteVnfNotification"); + private final static QName _CreateVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "createVnfNotification"); + private final static QName _UpdateVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "updateVnfNotification"); + private final static QName _QueryVnfNotification_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "queryVnfNotification"); /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.adapters.vnf.async.client @@ -164,7 +164,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link RollbackVnfNotification }{@code >}} * */ - @XmlElementDecl(namespace = "http://com.att.mso/vnfNotify", name = "rollbackVnfNotification") + @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "rollbackVnfNotification") public JAXBElement createRollbackVnfNotification(RollbackVnfNotification value) { return new JAXBElement(_RollbackVnfNotification_QNAME, RollbackVnfNotification.class, null, value); } @@ -173,7 +173,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link DeleteVnfNotification }{@code >}} * */ - @XmlElementDecl(namespace = "http://com.att.mso/vnfNotify", name = "deleteVnfNotification") + @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "deleteVnfNotification") public JAXBElement createDeleteVnfNotification(DeleteVnfNotification value) { return new JAXBElement(_DeleteVnfNotification_QNAME, DeleteVnfNotification.class, null, value); } @@ -182,7 +182,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link CreateVnfNotification }{@code >}} * */ - @XmlElementDecl(namespace = "http://com.att.mso/vnfNotify", name = "createVnfNotification") + @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "createVnfNotification") public JAXBElement createCreateVnfNotification(CreateVnfNotification value) { return new JAXBElement(_CreateVnfNotification_QNAME, CreateVnfNotification.class, null, value); } @@ -191,7 +191,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link UpdateVnfNotification }{@code >}} * */ - @XmlElementDecl(namespace = "http://com.att.mso/vnfNotify", name = "updateVnfNotification") + @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "updateVnfNotification") public JAXBElement createUpdateVnfNotification(UpdateVnfNotification value) { return new JAXBElement(_UpdateVnfNotification_QNAME, UpdateVnfNotification.class, null, value); } @@ -200,7 +200,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link QueryVnfNotification }{@code >}} * */ - @XmlElementDecl(namespace = "http://com.att.mso/vnfNotify", name = "queryVnfNotification") + @XmlElementDecl(namespace = "http://org.openecomp.mso/vnfNotify", name = "queryVnfNotification") public JAXBElement createQueryVnfNotification(QueryVnfNotification value) { return new JAXBElement(_QueryVnfNotification_QNAME, QueryVnfNotification.class, null, value); } diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/QueryVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java similarity index 96% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/QueryVnfNotification.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java index ebbf86744d..47ae04577e 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/QueryVnfNotification.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1; +package org.openecomp.mso.bpmn.common.adapter.vnf; import java.util.ArrayList; import java.util.List; @@ -28,8 +28,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; -import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.CreateVnfNotification.Outputs.Entry; - /** *

    Java class for queryVnfNotification complex type. @@ -43,11 +41,11 @@ import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.CreateVnfNoti * <sequence> * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://com.att.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> + * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * <element name="vnfExists" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> * <element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="status" type="{http://com.att.mso/vnfNotify}vnfStatus" minOccurs="0"/> + * <element name="status" type="{http://org.openecomp.mso/vnfNotify}vnfStatus" minOccurs="0"/> * <element name="outputs" minOccurs="0"> * <complexType> * <complexContent> @@ -465,7 +463,7 @@ public class QueryVnfNotification { public String toString() { String queryVnfNotification = ""; if (exception==null) { - queryVnfNotification = "" + '\n' + " "+messageId+"" + '\n' + " "+completed+"" + '\n' + @@ -475,7 +473,7 @@ public class QueryVnfNotification { (outputs == null ? "" : outputs.toString() + '\n') + ""; } else { - queryVnfNotification = "" + '\n' + " "+messageId+"" + '\n' + " "+completed+"" + '\n' + diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/RollbackVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java similarity index 94% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/RollbackVnfNotification.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java index 67c544de6d..6c05b4a075 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/RollbackVnfNotification.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/RollbackVnfNotification.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1; +package org.openecomp.mso.bpmn.common.adapter.vnf; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -38,7 +38,7 @@ import javax.xml.bind.annotation.XmlType; * <sequence> * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://com.att.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> + * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * </sequence> * </restriction> @@ -154,13 +154,13 @@ public class RollbackVnfNotification { public String toString() { String rollbackVnfNotification = ""; if (exception==null) { - rollbackVnfNotification = "" + '\n' + " "+messageId+"" + '\n' + " "+completed+"" + '\n' + ""; } else { - rollbackVnfNotification = "" + '\n' + " "+messageId+"" + '\n' + " "+completed+"" + '\n' + diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/UpdateVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java similarity index 96% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/UpdateVnfNotification.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java index 61ba43924e..92954800f2 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/UpdateVnfNotification.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/UpdateVnfNotification.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1; +package org.openecomp.mso.bpmn.common.adapter.vnf; import java.util.ArrayList; import java.util.List; @@ -41,7 +41,7 @@ import javax.xml.bind.annotation.XmlType; * <sequence> * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://com.att.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> + * <element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/> * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * <element name="outputs" minOccurs="0"> * <complexType> @@ -65,7 +65,7 @@ import javax.xml.bind.annotation.XmlType; * </complexContent> * </complexType> * </element> - * <element name="rollback" type="{http://com.att.mso/vnfNotify}vnfRollback" minOccurs="0"/> + * <element name="rollback" type="{http://org.openecomp.mso/vnfNotify}vnfRollback" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> @@ -390,14 +390,14 @@ public class UpdateVnfNotification { public String toString(){ String updateVnfNotification = ""; if (exception==null) { - updateVnfNotification = "" + '\n' + " "+messageId+"" + '\n' + " "+completed+"" + '\n' + " "+rollback+"" + '\n' + ""; } else { - updateVnfNotification = "" + '\n' + " "+messageId+"" + '\n' + " "+completed+"" + '\n' + diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/VnfAdapterNotify.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java similarity index 78% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/VnfAdapterNotify.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java index 8aaed54a4c..b714e528d1 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/VnfAdapterNotify.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1; +package org.openecomp.mso.bpmn.common.adapter.vnf; import javax.jws.Oneway; import javax.jws.WebMethod; @@ -35,7 +35,7 @@ import javax.xml.ws.RequestWrapper; * Generated source version: 2.2 * */ -@WebService(name = "vnfAdapterNotify", targetNamespace = "http://com.att.mso/vnfNotify") +@WebService(name = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify") @XmlSeeAlso({ ObjectFactory.class }) @@ -51,8 +51,8 @@ public interface VnfAdapterNotify { */ @WebMethod @Oneway - @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://com.att.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.RollbackVnfNotification") - @Action(input = "http://com.att.mso/notify/adapterNotify/rollbackVnfNotificationRequest") + @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.RollbackVnfNotification") + @Action(input = "http://org.openecomp.mso/notify/adapterNotify/rollbackVnfNotificationRequest") public void rollbackVnfNotification( @WebParam(name = "messageId", targetNamespace = "") String messageId, @@ -76,8 +76,8 @@ public interface VnfAdapterNotify { */ @WebMethod @Oneway - @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://com.att.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification") - @Action(input = "http://com.att.mso/notify/adapterNotify/queryVnfNotificationRequest") + @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification") + @Action(input = "http://org.openecomp.mso/notify/adapterNotify/queryVnfNotificationRequest") public void queryVnfNotification( @WebParam(name = "messageId", targetNamespace = "") String messageId, @@ -94,7 +94,7 @@ public interface VnfAdapterNotify { @WebParam(name = "status", targetNamespace = "") VnfStatus status, @WebParam(name = "outputs", targetNamespace = "") - com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.QueryVnfNotification.Outputs outputs); + org.openecomp.mso.bpmn.common.adapter.vnf.QueryVnfNotification.Outputs outputs); /** * @@ -108,8 +108,8 @@ public interface VnfAdapterNotify { */ @WebMethod @Oneway - @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://com.att.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification") - @Action(input = "http://com.att.mso/notify/adapterNotify/createVnfNotificationRequest") + @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification") + @Action(input = "http://org.openecomp.mso/notify/adapterNotify/createVnfNotificationRequest") public void createVnfNotification( @WebParam(name = "messageId", targetNamespace = "") String messageId, @@ -122,7 +122,7 @@ public interface VnfAdapterNotify { @WebParam(name = "vnfId", targetNamespace = "") String vnfId, @WebParam(name = "outputs", targetNamespace = "") - com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.CreateVnfNotification.Outputs outputs, + org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs outputs, @WebParam(name = "rollback", targetNamespace = "") VnfRollback rollback); @@ -137,8 +137,8 @@ public interface VnfAdapterNotify { */ @WebMethod @Oneway - @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://com.att.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification") - @Action(input = "http://com.att.mso/notify/adapterNotify/updateVnfNotificationRequest") + @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification") + @Action(input = "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest") public void updateVnfNotification( @WebParam(name = "messageId", targetNamespace = "") String messageId, @@ -149,7 +149,7 @@ public interface VnfAdapterNotify { @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage, @WebParam(name = "outputs", targetNamespace = "") - com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.UpdateVnfNotification.Outputs outputs, + org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs outputs, @WebParam(name = "rollback", targetNamespace = "") VnfRollback rollback); @@ -162,8 +162,8 @@ public interface VnfAdapterNotify { */ @WebMethod @Oneway - @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://com.att.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.DeleteVnfNotification") - @Action(input = "http://com.att.mso/notify/adapterNotify/deleteVnfNotificationRequest") + @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.DeleteVnfNotification") + @Action(input = "http://org.openecomp.mso/notify/adapterNotify/deleteVnfNotificationRequest") public void deleteVnfNotification( @WebParam(name = "messageId", targetNamespace = "") String messageId, diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/VnfAdapterNotify_Service.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java similarity index 85% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/VnfAdapterNotify_Service.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java index ba3bca169b..f79df76c5d 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/VnfAdapterNotify_Service.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1; +package org.openecomp.mso.bpmn.common.adapter.vnf; import java.net.URL; import javax.xml.namespace.QName; @@ -35,16 +35,16 @@ import javax.xml.ws.WebServiceFeature; * Generated source version: 2.2 * */ -@WebServiceClient(name = "vnfAdapterNotify", targetNamespace = "http://com.att.mso/vnfNotify", wsdlLocation = "/VnfAdapterNotify.wsdl") +@WebServiceClient(name = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify", wsdlLocation = "/VnfAdapterNotify.wsdl") public class VnfAdapterNotify_Service extends Service { private final static URL VNFADAPTERNOTIFY_WSDL_LOCATION; private final static WebServiceException VNFADAPTERNOTIFY_EXCEPTION; - private final static QName VNFADAPTERNOTIFY_QNAME = new QName("http://com.att.mso/vnfNotify", "vnfAdapterNotify"); + private final static QName VNFADAPTERNOTIFY_QNAME = new QName("http://org.openecomp.mso/vnfNotify", "vnfAdapterNotify"); static { - VNFADAPTERNOTIFY_WSDL_LOCATION = com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.VnfAdapterNotify_Service.class.getResource("/VnfAdapterNotify.wsdl"); + VNFADAPTERNOTIFY_WSDL_LOCATION = org.openecomp.mso.bpmn.common.adapter.vnf.VnfAdapterNotify_Service.class.getResource("/VnfAdapterNotify.wsdl"); WebServiceException e = null; if (VNFADAPTERNOTIFY_WSDL_LOCATION == null) { e = new WebServiceException("Cannot find '/VnfAdapterNotify.wsdl' wsdl. Place the resource correctly in the classpath."); @@ -83,7 +83,7 @@ public class VnfAdapterNotify_Service extends Service */ @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort() { - return super.getPort(new QName("http://com.att.mso/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class); + return super.getPort(new QName("http://org.openecomp.mso/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class); } /** @@ -95,7 +95,7 @@ public class VnfAdapterNotify_Service extends Service */ @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort") public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort(WebServiceFeature... features) { - return super.getPort(new QName("http://com.att.mso/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class, features); + return super.getPort(new QName("http://org.openecomp.mso/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class, features); } private static URL __getWsdlLocation() { diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/VnfRollback.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java similarity index 89% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/VnfRollback.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java index 4863023f5f..b37866cbe1 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/VnfRollback.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfRollback.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1; +package org.openecomp.mso.bpmn.common.adapter.vnf; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -36,7 +36,7 @@ import javax.xml.bind.annotation.XmlType; * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> * <element name="cloudSiteId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="msoRequest" type="{http://com.att.mso/vnfNotify}msoRequest" minOccurs="0"/> + * <element name="msoRequest" type="{http://org.openecomp.mso/vnfNotify}msoRequest" minOccurs="0"/> * <element name="tenantCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/> * <element name="tenantId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * <element name="vnfCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/> @@ -196,17 +196,15 @@ public class VnfRollback { } public String toString() { - String rollback = ""; - rollback = - ""+cloudSiteId+"" + '\n' + - ""+msoRequest.toString()+"" + '\n' + - ""+tenantCreated+"" + '\n' + - ""+tenantId+"" + '\n' + - ""+vnfCreated+"" + '\n' + - ""+vnfId+""; - return rollback; + String msoRequestElement = msoRequest == null ? "" + : ""+msoRequest+"" + '\n'; + + return + ""+cloudSiteId+"" + '\n' + + msoRequestElement + + ""+tenantCreated+"" + '\n' + + ""+tenantId+"" + '\n' + + ""+vnfCreated+"" + '\n' + + ""+vnfId+""; } - - - } diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/VnfStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java similarity index 96% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/VnfStatus.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java index b61a4b26b8..a9b2ee2732 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/VnfStatus.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1; +package org.openecomp.mso.bpmn.common.adapter.vnf; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; diff --git a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/package-info.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/package-info.java similarity index 86% rename from bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/package-info.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/package-info.java index f3038a3e38..6759fda81b 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/com/att/domain2/workflow/vnf/async/adapter/callback/wsdl/v1/package-info.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/package-info.java @@ -18,5 +18,5 @@ * ============LICENSE_END========================================================= */ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://com.att.mso/vnfNotify") -package com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1; +@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp.mso/vnfNotify") +package org.openecomp.mso.bpmn.common.adapter.vnf; diff --git a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java similarity index 97% rename from bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/util/CryptoHandler.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java index 66b170eb75..1759b208b7 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/util/CryptoHandler.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.util; +package org.openecomp.mso.bpmn.common.util; import java.security.GeneralSecurityException; diff --git a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/util/CryptoUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java similarity index 90% rename from bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/util/CryptoUtils.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java index e8b91bc776..70aeda01b0 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/util/CryptoUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java @@ -7,9 +7,9 @@ * 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. @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.util; +package org.openecomp.mso.bpmn.common.util; import java.security.GeneralSecurityException; @@ -27,23 +27,21 @@ import java.security.NoSuchAlgorithmException; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; -// import com.att.util.common.RttpBasicAuth; - //Need to add BPM error handler /** * CryptoUtils adapted from RTTP client. - * + * */ public class CryptoUtils { public static final String AES = "AES"; /** - * encrypt a value and generate a keyfile + * encrypt a value and generate a keyfile * if the keyfile is not found then a new one is created - * @throws GeneralSecurityException - * @throws IOException + * @throws GeneralSecurityException + * @throws IOException */ public static String encrypt(String value, String keyString) throws GeneralSecurityException { @@ -55,9 +53,9 @@ public class CryptoUtils { } /** - * decrypt a value - * @throws GeneralSecurityException - * @throws IOException + * decrypt a value + * @throws GeneralSecurityException + * @throws IOException */ public static String decrypt(String message, String keyString) throws GeneralSecurityException { @@ -99,12 +97,12 @@ public class CryptoUtils { } /** - * Not Used... - * + * Not Used... + * * Call Rttp utility jar to encrypt pwd * @param clearPassword * @return - * @throws GeneralSecurityException + * @throws GeneralSecurityException * @throws Exception * public static String encryptRttpPwd(String clearPassword) throws GeneralSecurityException { diff --git a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/util/ICryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java similarity index 96% rename from bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/util/ICryptoHandler.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java index 1ef96b683d..8d4f167596 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/util/ICryptoHandler.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.util; +package org.openecomp.mso.bpmn.common.util; public interface ICryptoHandler { public String getMsoAaiPassword(); diff --git a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java similarity index 93% rename from bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/SDNCAdapterCallbackServiceImpl.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java index 4b3b8eb36e..02a471c971 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/SDNCAdapterCallbackServiceImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.gamma.workflow.service; +package org.openecomp.mso.bpmn.common.workflow.service; import java.util.HashMap; import java.util.Map; @@ -34,10 +34,9 @@ import org.camunda.bpm.BpmPlatform; import org.camunda.bpm.engine.MismatchingMessageCorrelationException; import org.camunda.bpm.engine.ProcessEngineServices; import org.camunda.bpm.engine.RuntimeService; - -import com.att.domain2.workflow.sdnc.adapter.callback.wsdl.v1.SDNCCallbackAdapterPortType; -import com.att.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterCallbackRequest; -import com.att.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterResponse; +import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest; +import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse; +import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType; import org.openecomp.mso.bpmn.core.PropertyConfiguration; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; @@ -45,7 +44,7 @@ import org.openecomp.mso.logger.MsoLogger; * @version 1.0 * */ -@WebService(serviceName="SDNCAdapterCallbackService", targetNamespace="http://domain2.att.com/workflow/sdnc/adapter/schema/v1") +@WebService(serviceName="SDNCAdapterCallbackService", targetNamespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1") public class SDNCAdapterCallbackServiceImpl implements SDNCCallbackAdapterPortType { private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); @@ -59,17 +58,17 @@ public class SDNCAdapterCallbackServiceImpl implements SDNCCallbackAdapterPortTy private volatile ProcessEngineServices pes4junit = null; @WebMethod(operationName = "SDNCAdapterCallback") - @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://domain2.att.com/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") + @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse") public SDNCAdapterResponse sdncAdapterCallback( - @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://domain2.att.com/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest") + @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest") SDNCAdapterCallbackRequest sdncAdapterCallbackRequest) { - //Callback URL to use http://localhost:8080/mso/SDNCAdapterCallbackService + //Callback URL to use http://localhost:28080/mso/SDNCAdapterCallbackService ProcessEngineServices pes = getProcessEngineServices(); RuntimeService runtimeService = pes.getRuntimeService(); String receivedRequestId = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId(); - msoLogger.setServiceName("MSO." + "sdncAdapter"); - msoLogger.setLogContext(receivedRequestId, "N/A"); + MsoLogger.setServiceName("MSO." + "sdncAdapter"); + MsoLogger.setLogContext(receivedRequestId, "N/A"); msoLogger.debug(logMarker + "Received callback response:" + sdncAdapterCallbackRequest.toString()); SDNCAdapterResponse sdncAdapterResponse; long startTime = System.currentTimeMillis(); diff --git a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java similarity index 88% rename from bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/VnfAdapterNotifyServiceImpl.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java index 509f9c67f3..457717243a 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/VnfAdapterNotifyServiceImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.gamma.workflow.service; +package org.openecomp.mso.bpmn.common.workflow.service; import java.util.HashMap; import java.util.Map; @@ -36,16 +36,15 @@ import org.camunda.bpm.BpmPlatform; import org.camunda.bpm.engine.MismatchingMessageCorrelationException; import org.camunda.bpm.engine.ProcessEngineServices; import org.camunda.bpm.engine.RuntimeService; - -import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.CreateVnfNotification; -import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.DeleteVnfNotification; -import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.MsoExceptionCategory; -import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.QueryVnfNotification; -import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.RollbackVnfNotification; -import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.UpdateVnfNotification; -import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.VnfAdapterNotify; -import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.VnfRollback; -import com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.VnfStatus; +import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification; +import org.openecomp.mso.bpmn.common.adapter.vnf.DeleteVnfNotification; +import org.openecomp.mso.bpmn.common.adapter.vnf.MsoExceptionCategory; +import org.openecomp.mso.bpmn.common.adapter.vnf.QueryVnfNotification; +import org.openecomp.mso.bpmn.common.adapter.vnf.RollbackVnfNotification; +import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification; +import org.openecomp.mso.bpmn.common.adapter.vnf.VnfAdapterNotify; +import org.openecomp.mso.bpmn.common.adapter.vnf.VnfRollback; +import org.openecomp.mso.bpmn.common.adapter.vnf.VnfStatus; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; @@ -54,7 +53,7 @@ import org.openecomp.mso.logger.MsoLogger; * TODO: Add addition VnfAdapterNotify Methods for remaining VnfAdapterNotify operations. */ -@WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://com.att.mso/vnfNotify") +@WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify") public class VnfAdapterNotifyServiceImpl implements VnfAdapterNotify{ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); @@ -74,8 +73,8 @@ public class VnfAdapterNotifyServiceImpl implements VnfAdapterNotify{ */ @WebMethod(operationName = "rollbackVnfNotification") @Oneway - @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://com.att.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.RollbackVnfNotification") - @Action(input = "http://com.att.mso/notify/adapterNotify/rollbackVnfNotificationRequest") + @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.RollbackVnfNotification") + @Action(input = "http://org.openecomp.mso/notify/adapterNotify/rollbackVnfNotificationRequest") public void rollbackVnfNotification( @WebParam(name = "messageId", targetNamespace = "") String messageId, @@ -160,8 +159,8 @@ public class VnfAdapterNotifyServiceImpl implements VnfAdapterNotify{ */ @WebMethod(operationName = "queryVnfNotification") @Oneway - @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://com.att.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification") - @Action(input = "http://com.att.mso/notify/adapterNotify/queryVnfNotificationRequest") + @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification") + @Action(input = "http://org.openecomp.mso/notify/adapterNotify/queryVnfNotificationRequest") public void queryVnfNotification( @WebParam(name = "messageId", targetNamespace = "") String messageId, @@ -178,7 +177,7 @@ public class VnfAdapterNotifyServiceImpl implements VnfAdapterNotify{ @WebParam(name = "status", targetNamespace = "") VnfStatus status, @WebParam(name = "outputs", targetNamespace = "") - com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.QueryVnfNotification.Outputs outputs){ + org.openecomp.mso.bpmn.common.adapter.vnf.QueryVnfNotification.Outputs outputs){ QueryVnfNotification queryVnfNotification = new QueryVnfNotification(); @@ -195,8 +194,8 @@ public class VnfAdapterNotifyServiceImpl implements VnfAdapterNotify{ ProcessEngineServices pes = getProcessEngineServices(); RuntimeService runtimeService = pes.getRuntimeService(); - msoLogger.setServiceName("MSO." + "vnf Adapter Query"); - msoLogger.setLogContext(messageId, "N/A"); + MsoLogger.setServiceName("MSO." + "vnf Adapter Query"); + MsoLogger.setLogContext(messageId, "N/A"); msoLogger.debug(logMarker + "Received QueryVnfNotification" + queryVnfNotification.toString()); System.out.println("Received QueryVnfNotification : " + queryVnfNotification.toString()); @@ -253,8 +252,8 @@ public class VnfAdapterNotifyServiceImpl implements VnfAdapterNotify{ */ @WebMethod(operationName = "createVnfNotification") @Oneway - @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://com.att.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification") - @Action(input = "http://com.att.mso/notify/adapterNotify/createVnfNotificationRequest") + @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification") + @Action(input = "http://org.openecomp.mso/notify/adapterNotify/createVnfNotificationRequest") public void createVnfNotification( @WebParam(name = "messageId", targetNamespace = "") String messageId, @@ -267,7 +266,7 @@ public class VnfAdapterNotifyServiceImpl implements VnfAdapterNotify{ @WebParam(name = "vnfId", targetNamespace = "") String vnfId, @WebParam(name = "outputs", targetNamespace = "") - com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.CreateVnfNotification.Outputs outputs, + org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs outputs, @WebParam(name = "rollback", targetNamespace = "") VnfRollback rollback){ @@ -284,8 +283,8 @@ public class VnfAdapterNotifyServiceImpl implements VnfAdapterNotify{ ProcessEngineServices pes = getProcessEngineServices(); RuntimeService runtimeService = pes.getRuntimeService(); - msoLogger.setServiceName("MSO." + "vnf Adapter Create"); - msoLogger.setLogContext(messageId, "N/A"); + MsoLogger.setServiceName("MSO." + "vnf Adapter Create"); + MsoLogger.setLogContext(messageId, "N/A"); msoLogger.debug(logMarker + "Received CreateVnfNotification - " + createVnfNotification.toString()); long startTime = System.currentTimeMillis(); @@ -341,8 +340,8 @@ public class VnfAdapterNotifyServiceImpl implements VnfAdapterNotify{ */ @WebMethod(operationName = "updateVnfNotification") @Oneway - @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://com.att.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification") - @Action(input = "http://com.att.mso/notify/adapterNotify/updateVnfNotificationRequest") + @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification") + @Action(input = "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest") public void updateVnfNotification( @WebParam(name = "messageId", targetNamespace = "") String messageId, @@ -353,7 +352,7 @@ public class VnfAdapterNotifyServiceImpl implements VnfAdapterNotify{ @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage, @WebParam(name = "outputs", targetNamespace = "") - com.att.domain2.workflow.vnf.async.adapter.callback.wsdl.v1.UpdateVnfNotification.Outputs outputs, + org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs outputs, @WebParam(name = "rollback", targetNamespace = "") VnfRollback rollback){ @@ -369,8 +368,8 @@ public class VnfAdapterNotifyServiceImpl implements VnfAdapterNotify{ ProcessEngineServices pes = getProcessEngineServices(); RuntimeService runtimeService = pes.getRuntimeService(); - msoLogger.setServiceName("MSO." + "vnf Adapter Update"); - msoLogger.setLogContext(messageId, "N/A"); + MsoLogger.setServiceName("MSO." + "vnf Adapter Update"); + MsoLogger.setLogContext(messageId, "N/A"); msoLogger.debug(logMarker + "Received UpdateVnfNotification - " + updateVnfNotification.toString()); long startTime = System.currentTimeMillis(); @@ -423,11 +422,11 @@ public class VnfAdapterNotifyServiceImpl implements VnfAdapterNotify{ * @param completed */ - //@WebService(serviceName="VNFAdapterDeleteCallbackV1", targetNamespace="http://com.att.mso/vnfNotify") + //@WebService(serviceName="VNFAdapterDeleteCallbackV1", targetNamespace="http://org.openecomp.mso/vnfNotify") @WebMethod(operationName = "deleteVnfNotification") @Oneway - @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://com.att.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.DeleteVnfNotification") - @Action(input = "http://com.att.mso/notify/adapterNotify/deleteVnfNotificationRequest") + @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.DeleteVnfNotification") + @Action(input = "http://org.openecomp.mso/notify/adapterNotify/deleteVnfNotificationRequest") public void deleteVnfNotification( @WebParam(name = "messageId", targetNamespace = "") String messageId, @@ -438,7 +437,7 @@ public class VnfAdapterNotifyServiceImpl implements VnfAdapterNotify{ @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage) { - //Callback URL to use http://localhost:8080/mso/services/VNFAdapterDeleteCallbackV1 + //Callback URL to use http://localhost:28080/mso/services/VNFAdapterDeleteCallbackV1 //DeleteVnfNotification Class DeleteVnfNotification deleteVnfNotification = new DeleteVnfNotification(); diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/beans/SAOTSTRequest.groovy b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java similarity index 70% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/beans/SAOTSTRequest.groovy rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java index 9c60bb9dd0..5abd4e91da 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/beans/SAOTSTRequest.groovy +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java @@ -18,17 +18,19 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts.beans -import javax.xml.bind.annotation.XmlAccessType -import javax.xml.bind.annotation.XmlAccessorType -@XmlAccessorType(XmlAccessType.FIELD) -class SAOTSTRequest { - String vlanId - String functionalArea - String problem - String descr - String activeOrg - String managingOrg - String workQueue - String reportedProduct +package org.openecomp.mso.bpmn.common.workflow.service; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.ProcessEngines; + + +public class WorkflowAsyncCommonResource extends WorkflowAsyncResource { + + protected ProcessEngineServices getProcessEngineServices() { + if (pes4junit == null) { + return ProcessEngines.getProcessEngine("common"); + } else { + return pes4junit; + } + } } diff --git a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowAsyncResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java similarity index 91% rename from bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowAsyncResource.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java index 2302b76750..28541930ab 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowAsyncResource.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java @@ -17,8 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - -package org.openecomp.mso.bpmn.gamma.workflow.service; +package org.openecomp.mso.bpmn.common.workflow.service; import java.util.HashMap; import java.util.Map; @@ -34,15 +33,13 @@ import javax.ws.rs.core.Response; import org.camunda.bpm.engine.ProcessEngineServices; import org.camunda.bpm.engine.ProcessEngines; import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.impl.core.variable.VariableMapImpl; import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; import org.jboss.resteasy.annotations.Suspend; import org.jboss.resteasy.spi.AsynchronousResponse; -import org.slf4j.MDC; - import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; - +import org.slf4j.MDC; /** * @@ -55,10 +52,10 @@ import org.openecomp.mso.logger.MsoLogger; * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process */ @Path("/async") -public class WorkflowAsyncResource { +public abstract class WorkflowAsyncResource { private WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); - private ProcessEngineServices pes4junit = null; + protected ProcessEngineServices pes4junit = null; private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); @@ -210,33 +207,33 @@ public class WorkflowAsyncResource { // Note: the business key is used to identify the process in unit tests private String getBusinessKey(Map inputVariables) { - Object businessKey = inputVariables.get("att-mso-business-key"); + Object businessKey = inputVariables.get("mso-business-key"); if (businessKey == null ) { businessKey = UUID.randomUUID().toString(); - inputVariables.put("att-mso-business-key", businessKey); + inputVariables.put("mso-business-key", businessKey); } return businessKey.toString(); } private String getRequestId(Map inputVariables) { - Object requestId = inputVariables.get("att-mso-request-id"); + Object requestId = inputVariables.get("mso-request-id"); if (requestId == null ) { requestId = UUID.randomUUID().toString(); - inputVariables.put("att-mso-request-id", requestId); + inputVariables.put("mso-request-id", requestId); } return requestId.toString(); } private long getWaitTime(Map inputVariables) { - String timeout = inputVariables.get("att-mso-service-request-timeout") == null - ? null : inputVariables.get("att-mso-service-request-timeout").toString(); + String timeout = inputVariables.get("mso-service-request-timeout") == null + ? null : inputVariables.get("mso-service-request-timeout").toString(); if (timeout != null) { try { return Long.parseLong(timeout)*1000; } catch (NumberFormatException nex) { - msoLogger.debug("Invalid input for att-mso-service-request-timeout"); + msoLogger.debug("Invalid input for mso-service-request-timeout"); } } @@ -259,7 +256,7 @@ public class WorkflowAsyncResource { Map inputVariables) { MsoLogger.setServiceName("MSO." + processKey); if (inputVariables != null) { - MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"att-mso-request-id"), getKeyValueFromInputVariables(inputVariables,"att-mso-service-instance-id")); + MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"mso-service-instance-id")); } } @@ -276,13 +273,7 @@ public class WorkflowAsyncResource { } - private ProcessEngineServices getProcessEngineServices() { - if (pes4junit == null) { - return ProcessEngines.getDefaultProcessEngine(); - } else { - return pes4junit; - } - } + protected abstract ProcessEngineServices getProcessEngineServices(); public void setProcessEngineServices4junit(ProcessEngineServices pes) { pes4junit = pes; diff --git a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowCallbackResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java similarity index 96% rename from bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowCallbackResponse.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java index 425f0b20ad..b3e5ad1c58 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowCallbackResponse.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.gamma.workflow.service; +package org.openecomp.mso.bpmn.common.workflow.service; /** * @version 1.0 diff --git a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java similarity index 98% rename from bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowContext.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java index f44dfa9ccc..867226c02a 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowContext.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.gamma.workflow.service; +package org.openecomp.mso.bpmn.common.workflow.service; import java.util.concurrent.Delayed; import java.util.concurrent.TimeUnit; diff --git a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java similarity index 99% rename from bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowContextHolder.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java index a42a6d67a8..1c48e7173a 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowContextHolder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.gamma.workflow.service; +package org.openecomp.mso.bpmn.common.workflow.service; import java.util.concurrent.DelayQueue; import java.util.concurrent.TimeUnit; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java new file mode 100644 index 0000000000..da9376ddc0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java @@ -0,0 +1,141 @@ +package org.openecomp.mso.bpmn.common.workflow.service; + +import java.util.HashMap; +import java.util.Map; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.camunda.bpm.BpmPlatform; +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.RuntimeService; + +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; + +/** + * Generalized REST interface that injects a message event into a waiting BPMN process. + * Examples: + *

    + *     /WorkflowMessage/SDNCAResponse/6d10d075-100c-42d0-9d84-a52432681cae-1478486185286
    + *     /WorkflowMessage/SDNCAEvent/USOSTCDALTX0101UJZZ01
    + * 
    + */ +@Path("/") +public class WorkflowMessageResource { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private static final String LOGMARKER = "[WORKFLOW-MESSAGE]"; + + private ProcessEngineServices pes4junit = null; + + @POST + @Path("/WorkflowMessage/{messageType}/{correlator}") + @Consumes("*/*") + @Produces(MediaType.TEXT_PLAIN) + public Response deliver(@PathParam("messageType") String messageType, + @PathParam("correlator") String correlator, String message) { + + LOGGER.debug(LOGMARKER + " Received workflow message" + + " type='" + messageType + "'" + + " correlator='" + correlator + "'" + + System.lineSeparator() + message); + + MsoLogger.setServiceName("MSO." + "WorkflowMessage"); + + if (messageType == null || messageType.isEmpty()) { + String msg = "Missing message type"; + LOGGER.debug(LOGMARKER + " " + msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg); + return Response.status(400).entity(msg).build(); + } + + if (correlator == null || correlator.isEmpty()) { + String msg = "Missing correlator"; + LOGGER.debug(LOGMARKER + " " + msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg); + return Response.status(400).entity(msg).build(); + } + + String correlatorVariable = messageType + "_CORRELATOR"; + String messageVariable = messageType + "_MESSAGE"; + + long startTime = System.currentTimeMillis(); + + try { + RuntimeService runtimeService = getProcessEngineServices().getRuntimeService(); + + if (!isReadyforCorrelation(runtimeService, correlatorVariable, correlator)) { + String msg = "No process is waiting to receive '" + messageType + "' WorkflowMessage with correlator '" + correlator + "'"; + LOGGER.debug(LOGMARKER + " " + msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, LOGMARKER + ":" + msg); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BusinessProcesssError, msg, "BPMN", MsoLogger.getServiceName(), messageType); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BusinessProcesssError, msg); + return Response.status(500).entity(msg).build(); + } + + Map variables = new HashMap(); + variables.put(correlatorVariable, correlator); + variables.put(messageVariable, message); + + runtimeService.createMessageCorrelation("WorkflowMessage").setVariables(variables) + .processInstanceVariableEquals(correlatorVariable, correlator).correlate(); + + String msg = "Completed delivery of '" + messageType + "' WorkflowMessage with correlator '" + correlator + "'"; + LOGGER.debug(LOGMARKER + msg); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, msg, "BPMN", MsoLogger.getServiceName(), messageType); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, msg); + return Response.status(204).build(); + } catch (Exception e) { + // For example: MismatchingMessageCorrelationException + String msg = "Caught " + e.getClass().getSimpleName() + " processing '" + messageType + "' WorkflowMessage with " + correlatorVariable + "='" + correlator + "'"; + LOGGER.debug(LOGMARKER + " " + msg); + LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, LOGMARKER + ":" + msg, e); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, msg, "BPMN", MsoLogger.getServiceName(), messageType); + LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, msg); + return Response.status(500).entity(msg).build(); + } + } + + private boolean isReadyforCorrelation(RuntimeService runtimeService, + String correlationVariable, String correlationValue) + throws InterruptedException { + + long waitingInstances = runtimeService.createExecutionQuery() + .messageEventSubscriptionName("WorkflowMessage") + .processVariableValueEquals(correlationVariable, correlationValue) + .count(); + + int retries = 50; + while (waitingInstances == 0 && retries > 0) { + Thread.sleep(100); + + waitingInstances = runtimeService.createExecutionQuery() + .messageEventSubscriptionName("WorkflowMessage") + .processVariableValueEquals(correlationVariable, correlationValue) + .count(); + + retries--; + } + + return waitingInstances != 0; + } + + private ProcessEngineServices getProcessEngineServices() { + if (pes4junit == null) { + return BpmPlatform.getDefaultProcessEngine(); + } else { + return pes4junit; + } + } + + public void setProcessEngineServices4junit(ProcessEngineServices pes) { + pes4junit = pes; + } +} \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java similarity index 94% rename from bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowResource.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java index 1d90ac401c..d15bc31625 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowResource.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.gamma.workflow.service; +package org.openecomp.mso.bpmn.common.workflow.service; import java.util.HashMap; import java.util.List; @@ -41,12 +41,11 @@ import org.camunda.bpm.engine.ProcessEngineServices; import org.camunda.bpm.engine.ProcessEngines; import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.history.HistoricVariableInstance; -import org.camunda.bpm.engine.impl.core.variable.VariableMapImpl; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.variable.VariableMap; import org.camunda.bpm.engine.variable.Variables; import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats; - +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; import org.openecomp.mso.bpmn.core.WorkflowException; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; @@ -67,8 +66,8 @@ public class WorkflowResource { /** * Starts the process instance and responds to client synchronously - * If the request does not contain att-mso-service-request-timeout then it waits for the value specified in DEFAULT_WAIT_TIME - * Note: value specified in att-mso-service-request-timeout is in seconds + * If the request does not contain mso-service-request-timeout then it waits for the value specified in DEFAULT_WAIT_TIME + * Note: value specified in mso-service-request-timeout is in seconds * During polling time, if there is an exception encountered in the process execution then polling is stopped and the error response is * returned to the client * @param processKey @@ -208,14 +207,14 @@ public class WorkflowResource { */ private int getWaitTime(Map inputVariables) { - String timeout = inputVariables.get("att-mso-service-request-timeout") == null - ? null : inputVariables.get("att-mso-service-request-timeout").toString(); + String timeout = inputVariables.get("mso-service-request-timeout") == null + ? null : inputVariables.get("mso-service-request-timeout").toString(); if (timeout != null) { try { return Integer.parseInt(timeout)*1000; } catch (NumberFormatException nex) { - msoLogger.debug("Invalid input for att-mso-service-request-timeout"); + msoLogger.debug("Invalid input for mso-service-request-timeout"); } } return DEFAULT_WAIT_TIME; @@ -235,8 +234,8 @@ public class WorkflowResource { private void setLogContext(String processKey, Map inputVariables) { MsoLogger.setServiceName("MSO." + processKey); if (inputVariables != null) { - MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "att-mso-request-id"), - getValueFromInputVariables(inputVariables, "att-mso-service-instance-id")); + MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "mso-request-id"), + getValueFromInputVariables(inputVariables, "mso-service-instance-id")); } } @@ -522,23 +521,6 @@ public class WorkflowResource { return null; } - /** - * Gets a variable value from the specified execution. - * @return the variable value, or null if the variable could not be - * obtained - */ - private Object getVariableFromExecution(RuntimeService runtimeService, - String executionId, String variableName) { - try { - return runtimeService.getVariable(executionId, variableName); - } catch (ProcessEngineException e) { - // Most likely cause is that the execution no longer exists. - msoLogger.debug("Error retrieving execution " + executionId - + " variable " + variableName + ": " + e); - return null; - } - } - /** * Gets a variable value from specified historical process instance. * @return the variable value, or null if the variable could not be diff --git a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowResourceApplication.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java similarity index 84% rename from bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowResourceApplication.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java index 1e1a20ce45..afc7bdb128 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowResourceApplication.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.gamma.workflow.service; +package org.openecomp.mso.bpmn.common.workflow.service; import java.util.HashSet; import java.util.Set; @@ -26,6 +26,8 @@ import java.util.Set; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowMessageResource; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource; /** * @version 1.0 @@ -39,8 +41,8 @@ public class WorkflowResourceApplication extends Application { public WorkflowResourceApplication() { singletons.add(new WorkflowResource()); - singletons.add(new WorkflowAsyncResource()); - singletons.add(new VnfAdapterRestNotifyResource()); + singletons.add(new WorkflowAsyncCommonResource()); + singletons.add(new WorkflowMessageResource()); } @Override diff --git a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java similarity index 97% rename from bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowResponse.java rename to bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java index 37cc676b32..5da7c8fef4 100644 --- a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/WorkflowResponse.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.mso.bpmn.gamma.workflow.service; +package org.openecomp.mso.bpmn.common.workflow.service; import java.util.Map; diff --git a/bpmn/MSOGammaBPMN/src/main/resources/META-INF/persistence.xml b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml similarity index 97% rename from bpmn/MSOGammaBPMN/src/main/resources/META-INF/persistence.xml rename to bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml index 605d6f3624..fb027b8ed0 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/META-INF/persistence.xml +++ b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml @@ -25,7 +25,7 @@ http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> - + java:jboss/datasources/ProcessEngine diff --git a/bpmn/MSOGammaBPMN/src/main/resources/META-INF/processes.xml b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml similarity index 88% rename from bpmn/MSOGammaBPMN/src/main/resources/META-INF/processes.xml rename to bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml index 641e674c2e..1745af6558 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/META-INF/processes.xml +++ b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/processes.xml @@ -8,9 +8,9 @@ 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. @@ -19,11 +19,11 @@ ============LICENSE_END========================================================= --> - + - + org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration java:jboss/datasources/ProcessEngine @@ -39,7 +39,7 @@ org.camunda.bpm.application.impl.event.ProcessApplicationEventListenerPlugin - + org.camunda.spin.plugin.impl.SpinProcessEnginePlugin @@ -49,33 +49,33 @@ org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin - + org.openecomp.mso.bpmn.core.plugins.LoggingAndURNMappingPlugin - + org.openecomp.mso.bpmn.core.plugins.WorkflowExceptionPlugin - + + --> - - - - - false - true - - + + + + common + + false + true + + diff --git a/bpmn/MSOGammaBPMN/src/main/resources/logback.xml b/bpmn/MSOCommonBPMN/src/main/resources/logback.xml similarity index 100% rename from bpmn/MSOGammaBPMN/src/main/resources/logback.xml rename to bpmn/MSOCommonBPMN/src/main/resources/logback.xml diff --git a/bpmn/MSOCommonBPMN/src/main/resources/processengine.properties b/bpmn/MSOCommonBPMN/src/main/resources/processengine.properties new file mode 100644 index 0000000000..c21925c23f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/processengine.properties @@ -0,0 +1,20 @@ +### +# ============LICENSE_START======================================================= +# ECOMP 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========================================================= +### +processEngineName=common diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn new file mode 100644 index 0000000000..caf39010a7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn @@ -0,0 +1,447 @@ + + + + + SequenceFlow_1s593bx + SequenceFlow_1epmndu + + + + SequenceFlow_1s593bx + + + + + + + + ${CMSO_updateRequestResponse} + + + + SequenceFlow_19 + + + + SequenceFlow_19 + + + + + + SequenceFlow_21 + + + SequenceFlow_7 + SequenceFlow_24 + SequenceFlow_0fni7aq + + + SequenceFlow_9 + + + + SequenceFlow_72 + SequenceFlow_10 + + + + + SequenceFlow_13 + + + + SequenceFlow_1epmndu + SequenceFlow_72 + SequenceFlow_81 + + + + + + + SequenceFlow_25 + SequenceFlow_13 + Build Error Message @@@@" +import org.openecomp.mso.bpmn.common.scripts.* +def buildDataErrorMessage = new CompleteMsoProcess() +buildDataErrorMessage.buildDataError(execution, "Complete --Update DB status to SUCCESS-- Failed")]]> + + + + SequenceFlow_81 + SequenceFlow_49 + + + + + + + + ${URN_mso_adapters_db_endpoint} + + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + POST + + ${statusCode} + + soap-http-connector + + + SequenceFlow_10 + SequenceFlow_6 + + + + SequenceFlow_14 + + + + + SequenceFlow_1 + SequenceFlow_9 + Build Error Message @@@@" +//println "CMSO_updateRequestResponse IS --> " + execution.getVariable("CMSO_updateRequestResponse") +import org.openecomp.mso.bpmn.common.scripts.* +def buildDataErrorMessage = new CompleteMsoProcess() +buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB status to SUCCESS -- Failed")]]> + + + + SequenceFlow_23 + SequenceFlow_24 + SequenceFlow_25 + + + + + + + SequenceFlow_6 + SequenceFlow_7 + SequenceFlow_1 + + + + + + + + + + ${URN_mso_adapters_db_endpoint} + + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + POST + + ${statusCode} + + soap-http-connector + + + SequenceFlow_49 + SequenceFlow_23 + + + + SequenceFlow_14 + + + SequenceFlow_21 + + + + + SequenceFlow_0fni7aq + SequenceFlow_17 + Complete MSO Process Done SUCCESSFULLY" +import org.openecomp.mso.bpmn.common.scripts.* +def postProcessResponseData = new CompleteMsoProcess() +postProcessResponseData.postProcessResponse(execution) +println "CompleteMsoProcess Response -->" + "\n" + execution.getVariable("CompletionHandlerResponse")]]> + + + + SequenceFlow_17 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/ConfirmVolumeGroupName.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupName.bpmn similarity index 92% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/ConfirmVolumeGroupName.bpmn rename to bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupName.bpmn index 74e962f4d9..b190107d5e 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/ConfirmVolumeGroupName.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupName.bpmn @@ -1,229 +1,229 @@ - - - - - SequenceFlow_39 - SequenceFlow_23 - SequenceFlow_2 - - - - - - SequenceFlow_23 - SequenceFlow_18 - + + + + SequenceFlow_39 + SequenceFlow_23 + SequenceFlow_2 + + + + + + SequenceFlow_23 + SequenceFlow_18 + - - - - SequenceFlow_18 - - - - SequenceFlow_38 - SequenceFlow_39 - + + + + SequenceFlow_18 + + + + SequenceFlow_38 + SequenceFlow_39 + - - - - SequenceFlow_1 - SequenceFlow_38 - + + + + SequenceFlow_1 + SequenceFlow_38 + - - - - - SequenceFlow_2 - SequenceFlow_4 - + + + + + SequenceFlow_2 + SequenceFlow_4 + - - - - SequenceFlow_7 - SequenceFlow_11 - + + + + SequenceFlow_7 + SequenceFlow_11 + - - - SequenceFlow_4 - SequenceFlow_5 - SequenceFlow_7 - - - - - - - - - - +cvgn.handleVolumeGroupNameNoMatch(execution)]]> + + + SequenceFlow_4 + SequenceFlow_5 + SequenceFlow_7 + + + + + + + + + + SUCCESS - ]]> - - - - SequenceFlow_5 - - - - - SequenceFlow_11 - - - - SequenceFlow_1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ]]> + + + + SequenceFlow_5 + + + + + SequenceFlow_11 + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/ConfirmVolumeGroupTenant.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn similarity index 93% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/ConfirmVolumeGroupTenant.bpmn rename to bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn index 7da59a3f3f..fee4dbd2d3 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/ConfirmVolumeGroupTenant.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn @@ -1,190 +1,190 @@ - - - - - SequenceFlow_1 - SequenceFlow_2 - + + + + SequenceFlow_1 + SequenceFlow_2 + - - - SequenceFlow_2 - idsMatchNo - idsMatchYes - - - - - - - - SequenceFlow_7 - - - - idsMatchNo - SequenceFlow_8 - + + + SequenceFlow_2 + idsMatchNo + idsMatchYes + + + + + + + + SequenceFlow_7 + + + + idsMatchNo + SequenceFlow_8 + - - - - SequenceFlow_8 - - - - groupNamesMatchYes - SequenceFlow_7 - + + + + SequenceFlow_8 + + + + groupNamesMatchYes + SequenceFlow_7 + - - - - groupNamesMatchNo - SequenceFlow_9 - + + + + groupNamesMatchNo + SequenceFlow_9 + - - - - SequenceFlow_9 - - - - idsMatchYes - groupNamesMatchNo - groupNamesMatchYes - - - - - - - SequenceFlow_1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +volume.assignWorkflowException(execution, "name does not match")]]> + + + + SequenceFlow_9 + + + + idsMatchYes + groupNamesMatchNo + groupNamesMatchYes + + + + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/CreateAAIVfModule.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn similarity index 95% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/CreateAAIVfModule.bpmn rename to bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn index 8970324115..2ca2693b7c 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/CreateAAIVfModule.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn @@ -1,519 +1,519 @@ - - - - - SequenceFlow_24 - SequenceFlow_6 - SequenceFlow_7 - SequenceFlow_28 - - - - - - - SequenceFlow_39 - SequenceFlow_22 - SequenceFlow_23 - - - - - - - SequenceFlow_23 - SequenceFlow_18 - - - - - SequenceFlow_18 - - - - SequenceFlow_22 - SequenceFlow_24 - - - - - SequenceFlow_8 - SequenceFlow_5 - SequenceFlow_10 - - - SequenceFlow_4 - SequenceFlow_35 - SequenceFlow_8 - - - - - - SequenceFlow_28 - SequenceFlow_26 - SequenceFlow_33 - SequenceFlow_29 - - - - SequenceFlow_29 - - - - - SequenceFlow_7 - SequenceFlow_31 - - - - - SequenceFlow_34 - SequenceFlow_35 - - - - - SequenceFlow_31 - SequenceFlow_33 - SequenceFlow_34 - - - - - - - SequenceFlow_38 - SequenceFlow_39 - - - - - SequenceFlow_1 - SequenceFlow_38 - - - - - SequenceFlow_2 - - - - SequenceFlow_5 - SequenceFlow_2 - - - - - - - SequenceFlow_10 - - - - - - SequenceFlow_20 - SequenceFlow_13 - SequenceFlow_26 - SequenceFlow_27 - - - - - - - SequenceFlow_6 - SequenceFlow_9 - SequenceFlow_11 - - - - SequenceFlow_9 - SequenceFlow_20 - - - - - - - - SequenceFlow_27 - SequenceFlow_12 - SequenceFlow_4 - - - - - SequenceFlow_1 - - - - - SequenceFlow_11 - SequenceFlow_3 - - - - - SequenceFlow_3 - SequenceFlow_12 - SequenceFlow_13 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + SequenceFlow_24 + SequenceFlow_6 + SequenceFlow_7 + SequenceFlow_28 + + + + + + + SequenceFlow_39 + SequenceFlow_22 + SequenceFlow_23 + + + + + + + SequenceFlow_23 + SequenceFlow_18 + + + + + SequenceFlow_18 + + + + SequenceFlow_22 + SequenceFlow_24 + + + + + SequenceFlow_8 + SequenceFlow_5 + SequenceFlow_10 + + + SequenceFlow_4 + SequenceFlow_35 + SequenceFlow_8 + + + + + + SequenceFlow_28 + SequenceFlow_26 + SequenceFlow_33 + SequenceFlow_29 + + + + SequenceFlow_29 + + + + + SequenceFlow_7 + SequenceFlow_31 + + + + + SequenceFlow_34 + SequenceFlow_35 + + + + + SequenceFlow_31 + SequenceFlow_33 + SequenceFlow_34 + + + + + + + SequenceFlow_38 + SequenceFlow_39 + + + + + SequenceFlow_1 + SequenceFlow_38 + + + + + SequenceFlow_2 + + + + SequenceFlow_5 + SequenceFlow_2 + + + + + + + SequenceFlow_10 + + + + + + SequenceFlow_20 + SequenceFlow_13 + SequenceFlow_26 + SequenceFlow_27 + + + + + + + SequenceFlow_6 + SequenceFlow_9 + SequenceFlow_11 + + + + SequenceFlow_9 + SequenceFlow_20 + + + + + + + + SequenceFlow_27 + SequenceFlow_12 + SequenceFlow_4 + + + + + SequenceFlow_1 + + + + + SequenceFlow_11 + SequenceFlow_3 + + + + + SequenceFlow_3 + SequenceFlow_12 + SequenceFlow_13 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/CreateAAIVfModuleVolumeGroup.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModuleVolumeGroup.bpmn similarity index 93% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/CreateAAIVfModuleVolumeGroup.bpmn rename to bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModuleVolumeGroup.bpmn index bbdd21a3f7..dc94c898c2 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/CreateAAIVfModuleVolumeGroup.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModuleVolumeGroup.bpmn @@ -1,224 +1,224 @@ - - - - This flow expects its incoming request to be in the variable 'CreateAAIVfModuleVolumeGroupRequest'. This flow produces no output. - - SequenceFlow_38 - SequenceFlow_39 - + + + This flow expects its incoming request to be in the variable 'CreateAAIVfModuleVolumeGroupRequest'. This flow produces no output. + + SequenceFlow_38 + SequenceFlow_39 + - - - - SequenceFlow_18 - - - - SequenceFlow_23 - SequenceFlow_18 - + + + + SequenceFlow_18 + + + + SequenceFlow_23 + SequenceFlow_18 + - - - - SequenceFlow_8 - - - - - - - +cvfvg.handleAAIQueryFailure(execution)]]> + + + + SequenceFlow_8 + + + + + + + ${CCV1_subscriberglobalid} - ]]> - - - - SequenceFlow_13 - - - SequenceFlow_39 - SequenceFlow_22 - SequenceFlow_23 - - - #{execution.getVariable('CAAIVfModVG_getVfModuleResponseCode') == 200} - - - - SequenceFlow_4 - SequenceFlow_8 - ]]> + + + + SequenceFlow_13 + + + SequenceFlow_39 + SequenceFlow_22 + SequenceFlow_23 + + + #{execution.getVariable('CAAIVfModVG_getVfModuleResponseCode') == 200} + + + + SequenceFlow_4 + SequenceFlow_8 + - - - - SequenceFlow_2 - - - - SequenceFlow_2 - SequenceFlow_38 - + + + + SequenceFlow_2 + + + + SequenceFlow_2 + SequenceFlow_38 + - - - - SequenceFlow_22 - SequenceFlow_14 - + + + + SequenceFlow_22 + SequenceFlow_14 + - - - - SequenceFlow_14 - SequenceFlow_13 - SequenceFlow_4 - - - #{execution.getVariable('CAAIVfModVG_updateVfModuleResponseCode') == 200} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +cvfvg.updateVfModule(execution)]]> + + + + SequenceFlow_14 + SequenceFlow_13 + SequenceFlow_4 + + + #{execution.getVariable('CAAIVfModVG_updateVfModuleResponseCode') == 200} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/DeleteAAIVfModule.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn similarity index 95% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/DeleteAAIVfModule.bpmn rename to bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn index d043619fbb..0fce6d846f 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/DeleteAAIVfModule.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn @@ -1,482 +1,482 @@ - - - - - SequenceFlow_24 - SequenceFlow_6 - SequenceFlow_8 - - - - - - SequenceFlow_39 - SequenceFlow_22 - SequenceFlow_23 - - - - - - - SequenceFlow_23 - SequenceFlow_18 - + + + + SequenceFlow_24 + SequenceFlow_6 + SequenceFlow_8 + + + + + + SequenceFlow_39 + SequenceFlow_22 + SequenceFlow_23 + + + + + + + SequenceFlow_23 + SequenceFlow_18 + - - - - SequenceFlow_18 - - - - SequenceFlow_22 - SequenceFlow_24 - + + + + SequenceFlow_18 + + + + SequenceFlow_22 + SequenceFlow_24 + - - - - SequenceFlow_6 - SequenceFlow_20 - + + + + SequenceFlow_6 + SequenceFlow_20 + - - - - SequenceFlow_20 - SequenceFlow_26 - SequenceFlow_27 - SequenceFlow_11 - - - - - - - SequenceFlow_26 - SequenceFlow_8 - SequenceFlow_29 - + + + + SequenceFlow_20 + SequenceFlow_26 + SequenceFlow_27 + SequenceFlow_11 + + + + + + + SequenceFlow_26 + SequenceFlow_8 + SequenceFlow_29 + - - - - SequenceFlow_38 - SequenceFlow_39 - + + + + SequenceFlow_38 + SequenceFlow_39 + - - - - - SequenceFlow_29 - - - - - - - SequenceFlow_3 - SequenceFlow_9 - + + + + + SequenceFlow_29 + + + + + + + SequenceFlow_3 + SequenceFlow_9 + - - - - SequenceFlow_5 - SequenceFlow_2 - + + + + SequenceFlow_5 + SequenceFlow_2 + - - - - SequenceFlow_2 - - - - SequenceFlow_11 - SequenceFlow_4 - SequenceFlow_5 - SequenceFlow_7 - - - - - - - SequenceFlow_7 - SequenceFlow_15 - - - SequenceFlow_10 - SequenceFlow_12 - + + + + SequenceFlow_2 + + + + SequenceFlow_11 + SequenceFlow_4 + SequenceFlow_5 + SequenceFlow_7 + + + + + + + SequenceFlow_7 + SequenceFlow_15 + + + SequenceFlow_10 + SequenceFlow_12 + - - - - SequenceFlow_12 - - - - SequenceFlow_14 - SequenceFlow_4 - + + + + SequenceFlow_12 + + + + SequenceFlow_14 + SequenceFlow_4 + - - - - SequenceFlow_13 - SequenceFlow_14 - + + + + SequenceFlow_13 + SequenceFlow_14 + - - - - SequenceFlow_9 - SequenceFlow_10 - SequenceFlow_13 - - - - - - - SequenceFlow_1 - - - - - SequenceFlow_1 - SequenceFlow_38 - + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_13 + + + + + + + SequenceFlow_1 + + + + + SequenceFlow_1 + SequenceFlow_38 + - - - - SequenceFlow_27 - SequenceFlow_3 - SequenceFlow_15 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +dvm.preProcessRequest(execution)]]> + + + + SequenceFlow_27 + SequenceFlow_3 + SequenceFlow_15 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn new file mode 100644 index 0000000000..5f5fd3daae --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn @@ -0,0 +1,421 @@ + + + + + SequenceFlow_10 + SequenceFlow_1nn37a8 + + + + SequenceFlow_10 + + + + SequenceFlow_0fg02po + SequenceFlow_0x2jgo4 + + + + SequenceFlow_1nn37a8 + SequenceFlow_25 + SequenceFlow_26 + + + + + + + + + + ${URN_mso_adapters_db_endpoint} + POST + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + + update Request Gamma" +import org.openecomp.mso.bpmn.common.scripts.* +def updateRequestGamma= new FalloutHandler() +return updateRequestGamma.updateRequestGammaPayload(execution)]]> + + + ${statusCode} + + soap-http-connector + + + SequenceFlow_25 + SequenceFlow_29 + + + + SequenceFlow_72 + + + + SequenceFlow_35 + SequenceFlow_36 + SequenceFlow_0fg02po + + + SequenceFlow_0x2jgo4 + + + + SequenceFlow_72 + SequenceFlow_31 + SequenceFlow_79 + + + + + SequenceFlow_29 + SequenceFlow_31 + SequenceFlow_35 + + + + + + + SequenceFlow_32 + SequenceFlow_80 + SequenceFlow_73 + + + + + + + + ${URN_mso_adapters_db_endpoint} + POST + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + + update Request Infra" +import org.openecomp.mso.bpmn.common.scripts.* +def updateRequestInfra= new FalloutHandler() +return updateRequestInfra.updateRequestInfraPayload(execution)]]> + + + ${statusCode} + + soap-http-connector + + + SequenceFlow_26 + SequenceFlow_30 + + + + SequenceFlow_30 + SequenceFlow_32 + SequenceFlow_36 + + + + + + + SequenceFlow_80 + + + + + + SequenceFlow_1k7it63 + SequenceFlow_0celhl1 + + + + SequenceFlow_1k7it63 + + + + SequenceFlow_0celhl1 + + + + + + + SequenceFlow_73 + + + + SequenceFlow_79 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenerateVfModuleName.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenerateVfModuleName.bpmn new file mode 100644 index 0000000000..ab4afdad1c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenerateVfModuleName.bpmn @@ -0,0 +1,87 @@ + + + + + SequenceFlow_1opqmjl + + + SequenceFlow_1opqmjl + SequenceFlow_0aqc89s + + + + SequenceFlow_0aqc89s + SequenceFlow_1afb896 + + + + + + + + SequenceFlow_0o6nle0 + + + + SequenceFlow_1afb896 + SequenceFlow_0o6nle0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn similarity index 94% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn rename to bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn index 52364a0f7c..f4edac612c 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn @@ -1,303 +1,303 @@ - - - - - - SequenceFlow_9 - SequenceFlow_10 - + + + + + SequenceFlow_9 + SequenceFlow_10 + - - - - SequenceFlow_9 - - - - - SequenceFlow_10 - - - - - - SequenceFlow_12 - - - SequenceFlow_11 - SequenceFlow_12 - + + + + SequenceFlow_9 + + + + + SequenceFlow_10 + + + + + + SequenceFlow_12 + + + SequenceFlow_11 + SequenceFlow_12 + - - - SequenceFlow_11 - - - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_3 - - - - - SequenceFlow_3 - no - yes - - - - - - - SequenceFlow_7 - SequenceFlow_4 - - - - - yes - siExistYes - SequenceFlow_6 - - - - SequenceFlow_4 - - - - SequenceFlow_6 - SequenceFlow_7 - - - - - no - SequenceFlow_5 - - - - - SequenceFlow_5 - siExistYes - siExistNo - - - - - - - siExistNo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +]]> + + + SequenceFlow_11 + + + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_3 + + + + + SequenceFlow_3 + no + yes + + + + + + + SequenceFlow_7 + SequenceFlow_4 + + + + + yes + siExistYes + SequenceFlow_6 + + + + SequenceFlow_4 + + + + SequenceFlow_6 + SequenceFlow_7 + + + + + no + SequenceFlow_5 + + + + + SequenceFlow_5 + siExistYes + siExistNo + + + + + + + siExistNo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn similarity index 65% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn rename to bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn index b20a26a4c3..e68f6ec227 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn @@ -1,250 +1,251 @@ - - - - - SequenceFlow_1 - - - SequenceFlow_1 - SequenceFlow_9 - + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_9 + - - - - - SequenceFlow_9 - resourceVariableNotProvided - resourceVersionProvided - - - - - - - - SequenceFlow_2 - SequenceFlow_3 - + + + + + SequenceFlow_9 + resourceVariableNotProvided + resourceVersionProvided + + + + + + + + SequenceFlow_2 + SequenceFlow_3 + - - - - SequenceFlow_2 - - - - - SequenceFlow_3 - - - - - resourceVariableNotProvided - SequenceFlow_5 - - - - - SequenceFlow_7 - SequenceFlow_8 - + + + + SequenceFlow_2 + + + + + SequenceFlow_3 + + + + + resourceVariableNotProvided + SequenceFlow_5 + + + + + SequenceFlow_7 + SequenceFlow_8 + - - - - SequenceFlow_6 - SequenceFlow_7 - + + + + SequenceFlow_6 + SequenceFlow_7 + - - - - vnfFoundNo - - - - SequenceFlow_5 - vnfFoundYes - vnfFoundNo - - - - - - - resourceVersionProvided - vnfFoundYes - SequenceFlow_6 - - - - SequenceFlow_8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +deleteVnf.deleteVnf(execution)]]> + + + + vnfFoundNo + + + + SequenceFlow_5 + vnfFoundYes + vnfFoundNo + + + + + + + resourceVersionProvided + vnfFoundYes + SequenceFlow_6 + + + + SequenceFlow_8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/GenericGetService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn similarity index 96% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/GenericGetService.bpmn rename to bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn index cbaec1a29c..af615e379d 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/GenericGetService.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn @@ -1,321 +1,321 @@ - - - - - SequenceFlow_1 - SequenceFlow_2 - - - - - SequenceFlow_2 - getUrlYes - getUrlNo - - - - - - - - SequenceFlow_7 - SequenceFlow_8 - + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + SequenceFlow_2 + getUrlYes + getUrlNo + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + - - - - SequenceFlow_7 - - - - - SequenceFlow_8 - - - - SequenceFlow_3 - SequenceFlow_6 - - - - - SequenceFlow_5 - SequenceFlow_3 - - - - - getUrlNo - foundYes - SequenceFlow_5 - - - - obtainById - SequenceFlow_4 - - - - - obtainByName - SequenceFlow_13 - - - - - getUrlYes - obtainById - obtainByName - - - - - - - SequenceFlow_14 - foundYes - notFound - - - - - - - notFound - - - - SequenceFlow_4 - SequenceFlow_13 - SequenceFlow_14 - - - - SequenceFlow_6 - - - - SequenceFlow_1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +ex.processSubflowsBPMNException(execution)]]> + + + + SequenceFlow_7 + + + + + SequenceFlow_8 + + + + SequenceFlow_3 + SequenceFlow_6 + + + + + SequenceFlow_5 + SequenceFlow_3 + + + + + getUrlNo + foundYes + SequenceFlow_5 + + + + obtainById + SequenceFlow_4 + + + + + obtainByName + SequenceFlow_13 + + + + + getUrlYes + obtainById + obtainByName + + + + + + + SequenceFlow_14 + foundYes + notFound + + + + + + + notFound + + + + SequenceFlow_4 + SequenceFlow_13 + SequenceFlow_14 + + + + SequenceFlow_6 + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn similarity index 95% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn rename to bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn index 4fe0321820..db0d35d9ce 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn @@ -1,212 +1,212 @@ - - - - - SequenceFlow_1 - - - SequenceFlow_1 - SequenceFlow_2 - + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + - - - - - SequenceFlow_2 - noVnfId - haveVnfId - - - - - - - noVnfId - SequenceFlow_9 - + + + + + SequenceFlow_2 + noVnfId + haveVnfId + + + + + + + noVnfId + SequenceFlow_9 + - - - - SequenceFlow_9 - SequenceFlow_10 - SequenceFlow_7 - - - - haveVnfId - SequenceFlow_10 - + + + + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_7 + + + + haveVnfId + SequenceFlow_10 + - - - - - SequenceFlow_12 - - - - SequenceFlow_11 - SequenceFlow_12 - + + + + + SequenceFlow_12 + + + + SequenceFlow_11 + SequenceFlow_12 + - - - - SequenceFlow_11 - - - - - - SequenceFlow_7 - SequenceFlow_8 - + + + + SequenceFlow_11 + + + + + + SequenceFlow_7 + SequenceFlow_8 + - - - - SequenceFlow_8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +]]> + + + + SequenceFlow_8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn new file mode 100644 index 0000000000..8c8412dcac --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn @@ -0,0 +1,201 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_5 + + + + SequenceFlow_4 + SequenceFlow_5 + + + + + SequenceFlow_3 + SequenceFlow_4 + + + + + SequenceFlow_1 + SequenceFlow_3 + + + + + + SequenceFlow_6 + + + + + SequenceFlow_7 + + + SequenceFlow_6 + SequenceFlow_7 + + + + + + + SequenceFlow_9 + + + + + SequenceFlow_9 + SequenceFlow_10 + + + + SequenceFlow_10 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn similarity index 95% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn rename to bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn index bcda933fa5..bb73c09619 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn @@ -1,135 +1,135 @@ - - - - - SequenceFlow_1 - - - SequenceFlow_1 - SequenceFlow_2 - + + + + SequenceFlow_1 + + + SequenceFlow_1 + SequenceFlow_2 + - - - - - - SequenceFlow_6 - - - - SequenceFlow_5 - - - - SequenceFlow_5 - SequenceFlow_6 - - - - - - - SequenceFlow_2 - SequenceFlow_3 - + + + + + + SequenceFlow_6 + + + + SequenceFlow_5 + + + + SequenceFlow_5 + SequenceFlow_6 + + + + + + + SequenceFlow_2 + SequenceFlow_3 + - - - - SequenceFlow_3 - SequenceFlow_4 - + + + + SequenceFlow_3 + SequenceFlow_4 + - - - - SequenceFlow_4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +execution.setVariable("WorkflowResponse", " ") //for junits]]> + + + + SequenceFlow_4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/PrepareUpdateAAIVfModule.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/PrepareUpdateAAIVfModule.bpmn similarity index 94% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/PrepareUpdateAAIVfModule.bpmn rename to bpmn/MSOCommonBPMN/src/main/resources/subprocess/PrepareUpdateAAIVfModule.bpmn index bd16398e1a..956192c5af 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/PrepareUpdateAAIVfModule.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/PrepareUpdateAAIVfModule.bpmn @@ -1,308 +1,308 @@ - - - + + + - - SequenceFlow_38 - SequenceFlow_39 - + + SequenceFlow_38 + SequenceFlow_39 + - - - - SequenceFlow_39 - SequenceFlow_22 - SequenceFlow_23 - - - #{execution.getVariable('PUAAIVfMod_getVnfResponseCode') == 200} - - - - SequenceFlow_22 - SequenceFlow_10 - + + + + SequenceFlow_39 + SequenceFlow_22 + SequenceFlow_23 + + + #{execution.getVariable('PUAAIVfMod_getVnfResponseCode') == 200} + + + + SequenceFlow_22 + SequenceFlow_10 + - - - SequenceFlow_23 - SequenceFlow_18 - + + + SequenceFlow_23 + SequenceFlow_18 + - - - - SequenceFlow_18 - - - - - SequenceFlow_10 - SequenceFlow_12 - SequenceFlow_16 - - - SequenceFlow_12 - SequenceFlow_15 - + + + + SequenceFlow_18 + + + + + SequenceFlow_10 + SequenceFlow_12 + SequenceFlow_16 + + + SequenceFlow_12 + SequenceFlow_15 + - - - - - SequenceFlow_15 - - - - SequenceFlow_14 - SequenceFlow_13 - SequenceFlow_4 - - - #{execution.getVariable('PUAAIVfMod_updateVfModuleResponseCode') == 200} - - - - SequenceFlow_8 - - - - - - - +puvm.handleVfModuleValidationError(execution)]]> + + + + + SequenceFlow_15 + + + + SequenceFlow_14 + SequenceFlow_13 + SequenceFlow_4 + + + #{execution.getVariable('PUAAIVfMod_updateVfModuleResponseCode') == 200} + + + + SequenceFlow_8 + + + + + + + ${CCV1_subscriberglobalid} - ]]> - - - - SequenceFlow_13 - - - SequenceFlow_4 - SequenceFlow_8 - ]]> + + + + SequenceFlow_13 + + + SequenceFlow_4 + SequenceFlow_8 + - - - - SequenceFlow_16 - SequenceFlow_14 - + + + + SequenceFlow_16 + SequenceFlow_14 + - - - - #{execution.getVariable('PUAAIVfMod_vfModuleOK')} - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_38 - + + + + #{execution.getVariable('PUAAIVfMod_vfModuleOK')} + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_38 + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +puvm.preProcessRequest(execution)]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn new file mode 100644 index 0000000000..c94842382b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn @@ -0,0 +1,524 @@ + + + + + SequenceFlow_15 + badSynchronousResponse + goodSynchronousResponse + + + + + + + badSynchronousResponse + Exception + + + + + + + + ${URN_mso_adapters_sdnc_endpoint} + POST + + + application/soap+xml + #{BasicAuthHeaderValue} + + + ${sdncAdapterRequest} + ${response} + ${statusCode} + + soap-http-connector + + + SequenceFlow_8 + SequenceFlow_15 + + + + Exception + + + + SequenceFlow_1 + + + + + + + + + massageSDNCRequestScript + + + + + + SequenceFlow_1 + SequenceFlow_8 + + + + + SequenceFlow_9 + timeOut + SequenceFlow_29 + + + SequenceFlow_29 + SequenceFlow_14 + + + + + SequenceFlow_14 + noTimeoutError + SequenceFlow_19 + + + + + + + SequenceFlow_2 + SequenceFlow_9 + + SequenceFlow_16 + + + + SequenceFlow_18 + + + + SequenceFlow_18 + SequenceFlow_16 + + + + + + + timeOut + + ${sdncTimeoutValue} + + + + + SequenceFlow_19 + Error + + + + + Error + + + + goodSynchronousResponse + SequenceFlow_26 + SequenceFlow_2 + + + + + noTimeoutError + Done + SequenceFlow_30 + + + + + + + Done + SequenceFlow_17 + + + + + + + + ${sdncAdapterWorkflowResponse} + + + + SequenceFlow_17 + + + + SequenceFlow_30 + SequenceFlow_21 + SequenceFlow_26 + + + + + + SequenceFlow_22 + + + + + SequenceFlow_22 + SequenceFlow_27 + + + + + SequenceFlow_27 + + + + SequenceFlow_21 + SequenceFlow_15c4h5f + + + + SequenceFlow_15c4h5f + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/UpdateAAIGenericVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIGenericVnf.bpmn similarity index 93% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/UpdateAAIGenericVnf.bpmn rename to bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIGenericVnf.bpmn index 32206bd7ac..0932221944 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/UpdateAAIGenericVnf.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIGenericVnf.bpmn @@ -1,216 +1,216 @@ - - - - This flow expects its incoming request to be in the variable 'UpdateAAIGenericVnfRequest'. This flow produces no output. - - SequenceFlow_38 - SequenceFlow_39 - + + + This flow expects its incoming request to be in the variable 'UpdateAAIGenericVnfRequest'. This flow produces no output. + + SequenceFlow_38 + SequenceFlow_39 + - - - - SequenceFlow_8 - - - - SequenceFlow_14 - SequenceFlow_13 - SequenceFlow_4 - - - #{execution.getVariable('UAAIGenVnf_updateGenericVnfResponseCode') == 200} - - - - SequenceFlow_4 - SequenceFlow_8 - + + + + SequenceFlow_8 + + + + SequenceFlow_14 + SequenceFlow_13 + SequenceFlow_4 + + + #{execution.getVariable('UAAIGenVnf_updateGenericVnfResponseCode') == 200} + + + + SequenceFlow_4 + SequenceFlow_8 + - - - - - - - +ugv.handleUpdateGenericVnfFailure(execution)]]> + + + + + + + ${CCV1_subscriberglobalid} - ]]> - - - - SequenceFlow_13 - - - SequenceFlow_22 - SequenceFlow_14 - ]]> + + + + SequenceFlow_13 + + + SequenceFlow_22 + SequenceFlow_14 + - - - - SequenceFlow_39 - SequenceFlow_22 - SequenceFlow_23 - - - #{execution.getVariable('UAAIGenVnf_getGenericVnfResponseCode') == 200} - - - - SequenceFlow_23 - SequenceFlow_18 - + + + + SequenceFlow_39 + SequenceFlow_22 + SequenceFlow_23 + + + #{execution.getVariable('UAAIGenVnf_getGenericVnfResponseCode') == 200} + + + + SequenceFlow_23 + SequenceFlow_18 + - - - - SequenceFlow_18 - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_38 - + + + + SequenceFlow_18 + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_38 + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +ugv.preProcessRequest(execution)]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/UpdateAAIVfModule.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIVfModule.bpmn similarity index 93% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/UpdateAAIVfModule.bpmn rename to bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIVfModule.bpmn index fabd9c2f9d..6eacaee530 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/UpdateAAIVfModule.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/UpdateAAIVfModule.bpmn @@ -1,224 +1,224 @@ - - - - This flow expects its incoming request to be in the variable 'UpdateAAIVfModuleRequest'. This flow produces no output. - - SequenceFlow_38 - SequenceFlow_39 - + + + This flow expects its incoming request to be in the variable 'UpdateAAIVfModuleRequest'. This flow produces no output. + + SequenceFlow_38 + SequenceFlow_39 + - - - - SequenceFlow_18 - - - - SequenceFlow_23 - SequenceFlow_18 - + + + + SequenceFlow_18 + + + + SequenceFlow_23 + SequenceFlow_18 + - - - - SequenceFlow_8 - - - - - - - +uvm.handleAAIQueryFailure(execution)]]> + + + + SequenceFlow_8 + + + + + + + ${CCV1_subscriberglobalid} - ]]> - - - - SequenceFlow_13 - - - SequenceFlow_39 - SequenceFlow_22 - SequenceFlow_23 - - - #{execution.getVariable('UAAIVfMod_getVfModuleResponseCode') == 200} - - - - SequenceFlow_4 - SequenceFlow_8 - ]]> + + + + SequenceFlow_13 + + + SequenceFlow_39 + SequenceFlow_22 + SequenceFlow_23 + + + #{execution.getVariable('UAAIVfMod_getVfModuleResponseCode') == 200} + + + + SequenceFlow_4 + SequenceFlow_8 + - - - - SequenceFlow_14 - SequenceFlow_13 - SequenceFlow_4 - - - #{execution.getVariable('UAAIVfMod_updateVfModuleResponseCode') == 200} - - - - SequenceFlow_22 - SequenceFlow_14 - + + + + SequenceFlow_14 + SequenceFlow_13 + SequenceFlow_4 + + + #{execution.getVariable('UAAIVfMod_updateVfModuleResponseCode') == 200} + + + + SequenceFlow_22 + SequenceFlow_14 + - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_38 - + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_38 + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uvm.preProcessRequest(execution)]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn similarity index 95% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn rename to bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn index 04f9d02fe9..90964e5466 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn @@ -1,442 +1,442 @@ - - - - - SequenceFlow_3 - SequenceFlow_14 - + + + + SequenceFlow_3 + SequenceFlow_14 + - - - SequenceFlow_17 - SequenceFlow_35 - + + + SequenceFlow_17 + SequenceFlow_35 + - - - SequenceFlow_23 - SequenceFlow_36 - + + + SequenceFlow_23 + SequenceFlow_36 + - - - - SequenceFlow_14 - SequenceFlow_17 - SequenceFlow_23 - SequenceFlow_24 - - - - - - - - - - SequenceFlow_27 - - ${URN_mso_po_timeout} - - - - SequenceFlow_24 - SequenceFlow_28 - - SequenceFlow_25 - SequenceFlow_26 - - - - - SequenceFlow_25 - - - - SequenceFlow_26 - - - - - SequenceFlow_27 - SequenceFlow_34 - + + + + SequenceFlow_14 + SequenceFlow_17 + SequenceFlow_23 + SequenceFlow_24 + + + + + + + + + + SequenceFlow_27 + + ${URN_mso_po_timeout} + + + + SequenceFlow_24 + SequenceFlow_28 + + SequenceFlow_25 + SequenceFlow_26 + + + + + SequenceFlow_25 + + + + SequenceFlow_26 + + + + + SequenceFlow_27 + SequenceFlow_34 + - - - - SequenceFlow_28 - SequenceFlow_33 - + + + + SequenceFlow_28 + SequenceFlow_33 + - - - - - SequenceFlow_34 - - - - - SequenceFlow_35 - - - - SequenceFlow_36 - - - - - SequenceFlow_32 - - - - SequenceFlow_33 - SequenceFlow_31 - SequenceFlow_32 - - - - - - - SequenceFlow_31 - SequenceFlow_1 - + + + + + SequenceFlow_34 + + + + + SequenceFlow_35 + + + + SequenceFlow_36 + + + + + SequenceFlow_32 + + + + SequenceFlow_33 + SequenceFlow_31 + SequenceFlow_32 + + + + + + + SequenceFlow_31 + SequenceFlow_1 + - - - - SequenceFlow_1 - - - SequenceFlow_2 - SequenceFlow_3 - + + + + SequenceFlow_1 + + + SequenceFlow_2 + SequenceFlow_3 + - - - - - SequenceFlow_4 - SequenceFlow_5 - + + + + + SequenceFlow_4 + SequenceFlow_5 + - - - - SequenceFlow_5 - - - SequenceFlow_4 - - - - - - SequenceFlow_9 - SequenceFlow_2 - + + + + SequenceFlow_5 + + + SequenceFlow_4 + + + + + + SequenceFlow_9 + SequenceFlow_2 + - - - - SequenceFlow_9 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +]]> + + + + SequenceFlow_9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/urn.properties b/bpmn/MSOCommonBPMN/src/main/resources/urn.properties new file mode 100644 index 0000000000..5bf8e24815 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/urn.properties @@ -0,0 +1,29 @@ +### +# ============LICENSE_START======================================================= +# ECOMP 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========================================================= +### + +# URN mappings for this project. + +# TODO: Remove all the non-URN stuff that's in here. +# TODO: Implement a real URN mapping capability. + +#AAIEndPoint= http://localhost:28080/SoapUIMocks +AAIEndPoint= http://localhost:28090/ +SDNCEndPoint=http://localhost:28090/SDNCAdapter/ +msoRollback = true diff --git a/bpmn/MSOGammaBPMN/src/main/resources/wsdl/VnfAdapterNotify.wsdl b/bpmn/MSOCommonBPMN/src/main/resources/wsdl/VnfAdapterNotify.wsdl similarity index 93% rename from bpmn/MSOGammaBPMN/src/main/resources/wsdl/VnfAdapterNotify.wsdl rename to bpmn/MSOCommonBPMN/src/main/resources/wsdl/VnfAdapterNotify.wsdl index 471745cda2..a4f194045a 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/wsdl/VnfAdapterNotify.wsdl +++ b/bpmn/MSOCommonBPMN/src/main/resources/wsdl/VnfAdapterNotify.wsdl @@ -1,17 +1,17 @@ + targetNamespace="http://org.openecomp.mso/vnfNotify"> @@ -172,23 +172,23 @@ + wsam:Action="http://org.openecomp.mso/notify/adapterNotify/rollbackVnfNotificationRequest"/> + wsam:Action="http://org.openecomp.mso/notify/adapterNotify/queryVnfNotificationRequest"/> + wsam:Action="http://org.openecomp.mso/notify/adapterNotify/createVnfNotificationRequest"/> + wsam:Action="http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest"/> + wsam:Action="http://org.openecomp.mso/notify/adapterNotify/deleteVnfNotificationRequest"/> diff --git a/bpmn/MSOGammaBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml similarity index 100% rename from bpmn/MSOGammaBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml rename to bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml diff --git a/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-web.xml b/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-web.xml new file mode 100644 index 0000000000..f15ade0a70 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-web.xml @@ -0,0 +1,26 @@ + + + + + + other + /mso/common + diff --git a/bpmn/MSOGammaBPMN/src/main/webapp/WEB-INF/web.xml b/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/web.xml similarity index 78% rename from bpmn/MSOGammaBPMN/src/main/webapp/WEB-INF/web.xml rename to bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/web.xml index e046d1512d..0b3e4cf10b 100644 --- a/bpmn/MSOGammaBPMN/src/main/webapp/WEB-INF/web.xml +++ b/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/web.xml @@ -8,9 +8,9 @@ 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. @@ -18,65 +18,40 @@ limitations under the License. ============LICENSE_END========================================================= --> - - MSO Gamma BPMN Workflow Servlet - - - + MSO Common BPMN Workflow Servlet resteasy-servlet org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher javax.ws.rs.Application - org.openecomp.mso.bpmn.gamma.workflow.service.WorkflowResourceApplication + org.openecomp.mso.bpmn.common.workflow.service.WorkflowResourceApplication - resteasy-servlet /* - - - - - mso.configuration - - - log.configuration logback.bpmn.xml - resteasy.resources org.openecomp.mso.logger.MsoLoggingServlet,org.openecomp.mso.bpmn.core.HealthCheckHandler - LogFilter - org.openecomp.mso.logger.LogFilter + org.openecomp.mso.logger.LogFilter - LogFilter /* - HTTPBasicAuth @@ -89,14 +64,11 @@ BPMN-Client - - BASIC + BASIC ApplicationRealm - BPMN-Client - - + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy new file mode 100644 index 0000000000..7d698f8916 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtilTest.groovy @@ -0,0 +1,318 @@ +/*- + * ============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.common.scripts; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.* + +import org.openecomp.mso.rest.HttpHeader +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.junit.Before +import org.openecomp.mso.bpmn.common.scripts.AaiUtil; +import org.junit.Rule; +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.junit.Before; +import org.junit.Test; +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.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition + +@RunWith(MockitoJUnitRunner.class) +class AaiUtilTest extends MsoGroovyTest { + + @Test + public void testGetVersionDefault() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + assertEquals('8', version) + } + + @Test + public void testGetVersionResourceSpecific() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_l3_network_version")).thenReturn('7') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + assertEquals('7', version) + } + + @Test + public void testGetVersionFlowSpecific() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_custom_CreateAAIVfModule_aai_version")).thenReturn('6') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_l3_network_version")).thenReturn('7') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + assertEquals('6', version) + } + + @Test(expected=java.lang.Exception.class) + public void testGetVersionNotDefined() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def version = aaiUtil.getVersion(mockExecution, 'l3-network', 'CreateAAIVfModule') + } + + @Test + public void testGetUriDefaultVersion() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getUri(mockExecution, 'l3-network') + assertEquals('/aai/v8/network/l3-networks/l3-network', uri) + } + + @Test + public void testGetUriFlowAndResourceSpecific() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_CreateAAIVfModule_aai_l3_network_uri")).thenReturn('/aai/v6/network/l3-networks/l3-network') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_l3_network_uri")).thenReturn('/aai/v8/network/l3-networks/l3-network') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getUri(mockExecution, 'l3-network') + assertEquals('/aai/v6/network/l3-networks/l3-network', uri) + } + + @Test + public void testGetNetworkGenericVnfEndpoint() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_vnf_uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') + when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def endpoint = aaiUtil.getNetworkGenericVnfEndpoint(mockExecution) + assertEquals('http://localhost:28090/aai/v8/network/generic-vnfs/generic-vnf', endpoint) + } + + @Test + public void testGetNetworkGenericVnfUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_vnf_uri")).thenReturn('/aai/v8/network/generic-vnfs/generic-vnf') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkGenericVnfUri(mockExecution) + assertEquals('/aai/v8/network/generic-vnfs/generic-vnf', uri) + } + + @Test + public void testGetNetworkVpnBindingUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + 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') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkVpnBindingUri(mockExecution) + assertEquals('/aai/v8/network/vpn-bindings/vpn-binding', uri) + } + + @Test + public void testGetNetworkPolicyUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + 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') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkPolicyUri(mockExecution) + assertEquals('/aai/v8/network/network-policies/network-policy', uri) + } + + @Test + public void testGetNetworkTableReferencesUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + 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') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkTableReferencesUri(mockExecution) + assertEquals('/aai/v8/network/route-table-references/route-table-reference', uri) + } + + @Test + public void testGetNetworkVceUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_vce_uri")).thenReturn('/aai/v8/network/vces/vce') + + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkVceUri(mockExecution) + assertEquals('/aai/v8/network/vces/vce', uri) + } + + @Test + public void testGetNetworkL3NetworkUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + 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') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getNetworkL3NetworkUri(mockExecution) + assertEquals('/aai/v8/network/l3-networks/l3-network', uri) + } + + @Test + public void testGetBusinessCustomerUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_customer_uri")).thenReturn('/aai/v8/business/customers/customer') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getBusinessCustomerUri(mockExecution) + assertEquals('/aai/v8/business/customers/customer', uri) + } + + @Test + public void testGetCloudInfrastructureCloudRegionEndpoint() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + 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('URN_aai_endpoint')).thenReturn('http://localhost:28090') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getCloudInfrastructureCloudRegionEndpoint(mockExecution) + assertEquals('http://localhost:28090/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri) + } + + @Test + public void testGetCloudInfrastructureCloudRegionUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + 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') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getCloudInfrastructureCloudRegionUri(mockExecution) + assertEquals('/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic', uri) + } + + @Test + public void testGetCloudInfrastructureVolumeGroupUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_volume_group_uri")).thenReturn('/aai/v8/cloud-infrastructure/volume-groups/volume-group') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getCloudInfrastructureVolumeGroupUri(mockExecution) + assertEquals('/aai/v8/cloud-infrastructure/volume-groups/volume-group', uri) + } + + @Test + public void testGetCloudInfrastructureTenantUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_tenant_uri")).thenReturn('/aai/v8/cloud-infrastructure/tenants/tenant') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getCloudInfrastructureTenantUri(mockExecution) + assertEquals('/aai/v8/cloud-infrastructure/tenants/tenant', uri) + } + + @Test + public void testGetSearchNodesQueryUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn('/aai/v8/search/nodes-query') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getSearchNodesQueryUri(mockExecution) + assertEquals('/aai/v8/search/nodes-query', uri) + } + + @Test + public void testGetSearchNodesQueryEndpoint() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_nodes_query_uri")).thenReturn('/aai/v8/search/nodes-query') + when(mockExecution.getVariable('URN_aai_endpoint')).thenReturn('http://localhost:28090') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getSearchNodesQueryEndpoint(mockExecution) + assertEquals('http://localhost:28090/aai/v8/search/nodes-query', uri) + } + + @Test + public void testGetSearchGenericQueryUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + when(mockExecution.getVariable("URN_mso_workflow_global_default_aai_version")).thenReturn('8') + when(mockExecution.getVariable("URN_mso_workflow_default_aai_v8_generic_query_uri")).thenReturn('/aai/v8/search/generic-query') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def uri = aaiUtil.getSearchGenericQueryUri(mockExecution) + assertEquals('/aai/v8/search/generic-query', uri) + } + + @Test + public void testGetNamespaceFromUri() { + ExecutionEntity mockExecution = setupMock('CreateAAIVfModule') + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn('true') + CreateAAIVfModule myproc = new CreateAAIVfModule() + AaiUtil aaiUtil = new AaiUtil(myproc) + def ns = aaiUtil.getNamespaceFromUri('/aai/v6/search/generic-query') + assertEquals('http://org.openecomp.aai.inventory/v6', ns) + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CommonExceptionUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CommonExceptionUtilTest.groovy new file mode 100644 index 0000000000..abb369725e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CommonExceptionUtilTest.groovy @@ -0,0 +1,201 @@ +/*- + * ============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.common.scripts + +import org.junit.Assert +import org.junit.Ignore +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; + + + +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner +import org.openecomp.mso.bpmn.common.scripts.CommonExceptionUtil; +@RunWith(MockitoJUnitRunner.class) +import org.junit.Test + +class CommonExceptionUtilTest { + + def aotsFault =""" + xml:space + String + http://csi.att.com + + + + 400 + bad stuff + + + String + *** ERROR *** + String + String + String + String + + String + String + + String + String + String + String + + + + + + String + *** ERROR *** + String + String + String + String + String + String + String + + +""" + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + @Ignore + public void testMapAAIExceptionTCommonException() { + + + + String restFault = """ + + + +SVC3002 +Error writing output performing %1 on %2 (msg=%3) (ec=%4) + +PUTcustomer +SubName01 +Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id] +ERR.5.4.5105 + + + + + """ + def errorString = """ + +SVC3002 +Error writing output performing %1 on %2 (msg=%3) (ec=%4) + +PUTcustomer +SubName01 +Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id] +ERR.5.4.5105 + + +""" as String + + + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + CommonExceptionUtil util = new CommonExceptionUtil() + Assert.assertEquals(errorString, util.mapAAIExceptionTCommonException(restFault, mockExecution)) + } + + + + + @Test + public void testBuildException() { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_ResponseCode")).thenReturn("400") + ArrayList msgVars = new ArrayList() + msgVars.add("var1") + msgVars.add("var2") + when(mockExecution.getVariable("test_errVariables")).thenReturn(msgVars) + + + CommonExceptionUtil util = new CommonExceptionUtil() + String msg = "Bad request" + String errorString = """ + + SVC2000 + The following service error occurred: %1. Error code is %2. + var1 + var2 + +""" + Assert.assertEquals(errorString, util.buildException(msg, mockExecution)) + } + + @Test + public void testMapAOTSExecptionToCommonException() { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_ResponseCode")).thenReturn("400") + + CommonExceptionUtil util = new CommonExceptionUtil() + String errorString = """ + + SVC2000 + The following service error occurred: %1. Error code is %2. + Received error from AOTS: bad stuff + 400 + +""" + Assert.assertEquals(errorString, util.mapAOTSExecptionToCommonException(aotsFault, mockExecution)) + } + + + @Test + public void testParseError() { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + String errorString = "The following service error occurred: %1. Error code is %2." + ArrayList msgVars = new ArrayList() + msgVars.add("var1") + msgVars.add("var2") + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_errTxt")).thenReturn(errorString) + when(mockExecution.getVariable("test_errVariables")).thenReturn(msgVars) + + CommonExceptionUtil util = new CommonExceptionUtil() + + Assert.assertEquals("The following service error occurred: var1. Error code is var2.", util.parseError(mockExecution)) +} + + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcessTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcessTest.groovy new file mode 100644 index 0000000000..cd70fa9949 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcessTest.groovy @@ -0,0 +1,219 @@ +/*- + * ============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.common.scripts + +import org.junit.runner.RunWith; +import static org.junit.Assert.* +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.delegate.BpmnError +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.core.WorkflowException + + +@RunWith(MockitoJUnitRunner.class) +class CompleteMsoProcessTest { + @Before + public void init() { + MockitoAnnotations.initMocks(this) + } + + private String completeMsoProcessRequest = """ + + + uCPE1020_STUW105_5002 + Layer3ServiceActivateRequest + COMPLETE + OMX + http://localhost:28090/CCD/StatusNotification + 10205000 + 1 + + UCPELayer3ServiceActivateV1 + + """ + + + private String completeMsoProcessResponse = """ + BPEL UCPELayer3ServiceActivateV1 completed +""" + + + @Test + public void testPreProcessRequest() { + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("CompleteMsoProcessRequest")).thenReturn(completeMsoProcessRequest) + + CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() + completeMsoProcess.preProcessRequest(mockExecution) + + /* Initialize all the process request variables in this block */ + verify(mockExecution).setVariable("prefix","CMSO_") + //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","") + verify(mockExecution).setVariable("CMSO_request_id","") + verify(mockExecution).setVariable("CMSO_notification-url","") + verify(mockExecution).setVariable("CMSO_mso-bpel-name","") + verify(mockExecution).setVariable("CMSO_request_action","") + + verify(mockExecution).setVariable("CMSO_notification-url-Ok", false) + verify(mockExecution).setVariable("CMSO_request_id-Ok", false) + + //updateRequest Adapter process variables + verify(mockExecution).setVariable("CMSO_updateRequestResponse", "") + verify(mockExecution).setVariable("CMSO_updateRequestResponseCode", "") + verify(mockExecution).setVariable("CMSO_updateFinalNotifyAckStatusFailedPayload", "") + + //Set DB adapter variables here + verify(mockExecution).setVariable("CMSO_updateDBStatusToSuccessPayload", "") + verify(mockExecution).setVariable("CMSO_updateInfraRequestDBPayload", "") + verify(mockExecution).setVariable("CMSO_setUpdateDBstatustoSuccessPayload", "") + + //Auth variables + verify(mockExecution).setVariable("BasicAuthHeaderValue","") + + //Response variables + verify(mockExecution).setVariable("CompletionHandlerResponse","") + verify(mockExecution).setVariable("CMSO_ErrorResponse", null) + verify(mockExecution).setVariable("CMSO_ResponseCode", "") + + verify(mockExecution).setVariable("CMSO_notification-url-Ok",true) + verify(mockExecution).setVariable("CMSO_request_id-Ok",true) + verify(mockExecution).setVariable("CMSO_notification-url","http://localhost:28090/CCD/StatusNotification") + verify(mockExecution).setVariable("CMSO_request_id","uCPE1020_STUW105_5002") + verify(mockExecution).setVariable("CMSO_request_action","Layer3ServiceActivateRequest") + verify(mockExecution).setVariable("CMSO_source","OMX") + + } + + @Test + public void testpostProcessResponse(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("CMSO_mso-bpel-name")).thenReturn("UCPELayer3ServiceActivateV1") + + CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() + completeMsoProcess.postProcessResponse(mockExecution) + + verify(mockExecution).setVariable("CompleteMsoProcessResponse", completeMsoProcessResponse) + verify(mockExecution).setVariable("CMSO_ResponseCode","200") + } + + private String updateDBStatusToSuccessPayload = """ + + + + + testReqId + BPEL + COMPLETED + + + + """ + + @Test + public void testupdateDBStatusToSuccessPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("CMSO_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); + + CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() + completeMsoProcess.updateDBStatusToSuccessPayload(mockExecution) + + verify(mockExecution).setVariable("CMSO_updateDBStatusToSuccessPayload",updateDBStatusToSuccessPayload) + } + + private String setUpdateDBstatustoSuccessPayload = """ + + + + + testReqId + BPEL + Resource Completed Successfully + COMPLETE + 100 + + + + """ + + @Test + public void testsetUpdateDBstatustoSuccessPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("CMSO_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("CMSO_mso-bpel-name")).thenReturn("BPEL") + when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); + + CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() + completeMsoProcess.setUpdateDBstatustoSuccessPayload(mockExecution) + + verify(mockExecution).setVariable("CMSO_setUpdateDBstatustoSuccessPayload",setUpdateDBstatustoSuccessPayload) + } + + private String msoCompletionResponse = """onse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"> + BPEL BPEL-NAME FAILED +
    """ + +/* + private String msoCompletionResponse = """ + BPEL BPEL-NAME FAILED +""" +*/ + @Test + public void testbuildDataError(){ + + boolean thrown = false; + String msg = "Some-Message"; + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("CMSO_mso-bpel-name")).thenReturn("BPEL-NAME") + when(mockExecution.getVariable("testProcessKey")).thenReturn("CompleteMsoProcess") + + WorkflowException exception = new WorkflowException("CompleteMsoProcess", 500, msg); + + try{ + CompleteMsoProcess completeMsoProcess = new CompleteMsoProcess() + completeMsoProcess.buildDataError(mockExecution, msg) + } + catch (BpmnError e){ + thrown = true; + } + + + verify(mockExecution).setVariable("CompleteMsoProcessResponse",msoCompletionResponse) + // Can't seem to figure out how to verify the exception and have spent way too much time on fixing this test case! + //verify(mockExecution).setVariable("WorkflowException",exception) + assertTrue(thrown); + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy new file mode 100644 index 0000000000..98bbe7181e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtilTest.groovy @@ -0,0 +1,190 @@ +/*- + * ============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.common.scripts + +import org.junit.Assert +import org.junit.runner.RunWith; +import org.mockito.runners.MockitoJUnitRunner; + + +import org.junit.Ignore; + +import static org.mockito.Mockito.* + +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.mockito.runners.MockitoJUnitRunner +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +@RunWith(MockitoJUnitRunner.class) +import org.junit.Test + + + +class ExceptionUtilTest { + + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + public void testErrorMessageDetails() { + + + + String restFault = """ + + + +SVC3002 +Error writing output performing %1 on %2 (msg=%3) (ec=%4) + +PUTcustomer +SubName01 +Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id] +ERR.5.4.5105 + + + + + """ + def errorString = """ + Received error from A&AI (Error writing output performing PUTcustomer on SubName01 (msg=Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id]) (ec=ERR.5.4.5105)) + 5000 + """ as String + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals(errorString, util.MapAAIExceptionToWorkflowExceptionOld(restFault, mockExecution)) + } + + + @Test + public void testErrorMessage() { + String restFault = """ + + 500 + HTTP method: GET Internal Server Error + + """ + def errorString = """ + Received error from A&AI (HTTP method: GET Internal Server Error) + 5000 + """ as String + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_ErrorResponse")).thenReturn("HTTP method: GET Internal Server Error") + + ExceptionUtil util = new ExceptionUtil() + String msg = "HTTP method: GET Internal Server Error" + Assert.assertEquals(errorString, util.MapAAIExceptionToWorkflowExceptionOld(restFault, mockExecution)) + } + + @Test + public void testBadResponseErrorMessage() { + String restFault = "asfafasfasfd" + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("test_ErrorResponse")).thenReturn(null) + ExceptionUtil util = new ExceptionUtil() + String expected = ""+ + "\n Received error from A&AI ()"+ + "\n 5000"+ + "\n "; + Assert.assertEquals(expected,util.MapAAIExceptionToWorkflowExceptionOld(restFault, mockExecution)) + } + + @Test + public void testMapErrorCode5010(){ + String msg = "Connect to njcdtl20ew2988:8070 failed: Connection refused: connect" + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals("5010",util.MapErrorCode(msg)) + } + + @Test + public void testMapErrorCode5020(){ + String msg = "Connection timed out" + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals("5020",util.MapErrorCode(msg)) + } + + @Test + public void testMapCategoryToErrorCode5100 () { + String errorCategory = "OPENSTACK" + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals('5100', util.MapCategoryToErrorCode(errorCategory)) + } + + @Test + public void testMapCategoryToErrorCode5110 () { + String errorCategory = "IO" + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals('5110', util.MapCategoryToErrorCode(errorCategory)) + } + + @Test + public void testMapCategoryToErrorCode7020 () { + String errorCategory = "USERDATA" + ExceptionUtil util = new ExceptionUtil() + Assert.assertEquals('7020', util.MapCategoryToErrorCode(errorCategory)) + } + + @Test + @Ignore + public void testMapAdapterExecptionToWorkflowException_UserDataErrorMessage () { + String response = """USERDATACloud Site [CHCGILNE001] not found""" as String + String expected = """WorkflowException[processKey=ExceptionUtil,errorCode=7020,errorMessage=Received error from Tenant Adapter: Cloud Site [CHCGILNE001] not found]""" as String + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("testProcessKey")).thenReturn("ExceptionUtil") + + ExceptionUtil util = new ExceptionUtil() + String actual = util.MapAdapterExecptionToWorkflowException(response, mockExecution, "Tenant Adapter") + + verify(mockExecution).setVariable("WorkflowException",expected) + } + + @Test + @Ignore + public void testMapAdapterExecptionToWorkflowException_IOErrorMessage () { + String response = """IO[TokenAuth] Connect to test.aic.cip.att.com:5000 [test.aic.cip.att.com/300.200.100.100] failed: Connection refused""" as String + String expected = """WorkflowException[processKey=ExceptionUtil,errorCode=5110,errorMessage=Could not communicate with Platform Orchestrator]""" as String + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("prefix")).thenReturn("test_") + when(mockExecution.getVariable("testProcessKey")).thenReturn("ExceptionUtil") + + ExceptionUtil util = new ExceptionUtil() + String actual = util.MapAdapterExecptionToWorkflowException(response, mockExecution, "Tenant Adapter") + + verify(mockExecution).setVariable("WorkflowException",expected) + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy new file mode 100644 index 0000000000..7f691ca1b8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandlerTest.groovy @@ -0,0 +1,311 @@ +/*- + * ============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.common.scripts + +import org.junit.runner.RunWith; +import static org.mockito.Mockito.* +import static org.junit.Assert.*; + +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.ArgumentCaptor; +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.openecomp.mso.bpmn.common.scripts.MsoUtils; +import org.openecomp.mso.bpmn.common.scripts.FalloutHandler; + +@RunWith(MockitoJUnitRunner.class) +class FalloutHandlerTest { + + public MsoUtils utils = new MsoUtils() + + @Before + public void init() { + MockitoAnnotations.initMocks(this) + } + + private String falloutHandlerRequest = """ + + + uCPE1020_STUW105_5002 + Layer3ServiceActivateRequest + CANCEL + OMX + 10205000 + 1 + + + Some Error Message - Fallout Handler + Some Error Code - Fallout Handler + Some Source System Error Code- Fallout Handler + + + """ + + private String falloutHandlerResponse = """ + Fallout Handler Failed +""" + + @Test + public void testPreProcessRequest() { + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("FalloutHandlerRequest")).thenReturn(falloutHandlerRequest) + when(mockExecution.getVariable("URN_mso_adapters_db_auth")).thenReturn("757A94191D685FD2092AC1490730A4FC"); + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7"); + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.preProcessRequest(mockExecution) + + /* Initialize all the process request variables in this block */ + verify(mockExecution).setVariable("prefix","FH_") + //verify(mockExecution).setVariable("getLayer3ServiceDetailsV1Response","") + + //These variables are form the input Message to the BPMN + verify(mockExecution).setVariable("FH_request_id","") + verify(mockExecution).setVariable("FH_request_action","") + verify(mockExecution).setVariable("FH_notification-url","") + verify(mockExecution).setVariable("FH_mso-bpel-name","") + verify(mockExecution).setVariable("FH_ErrorCode", "") + verify(mockExecution).setVariable("FH_ErrorMessage", "") + + verify(mockExecution).setVariable("FH_notification-url-Ok", false) + verify(mockExecution).setVariable("FH_request_id-Ok", false) + + //These variables are for Get Mso Aai Password Adapter + verify(mockExecution).setVariable("FH_deliveryStatus", true) + + //update Response Status to pending ...Adapter variables + verify(mockExecution).setVariable("FH_updateResponseStatusPayload", null) + verify(mockExecution).setVariable("FH_updateResponseStatusResponse", null) + + //update Request Gamma ...Adapter variables + verify(mockExecution).setVariable("FH_updateRequestGammaPayload", "") + verify(mockExecution).setVariable("FH_updateRequestGammaResponse", null) + verify(mockExecution).setVariable("FH_updateRequestGammaResponseCode", null) + + //update Request Infra ...Adapter variables + verify(mockExecution).setVariable("FH_updateRequestInfraPayload", "") + verify(mockExecution).setVariable("FH_updateRequestInfraResponse", null) + verify(mockExecution).setVariable("FH_updateRequestInfraResponseCode", null) + + //assign False to success variable + verify(mockExecution).setVariable("FH_success", true) + + //Set notify status to Failed variable + verify(mockExecution).setVariable("FH_NOTIFY_STATUS", "SUCCESS") + + //Set DB update variable + verify(mockExecution).setVariable("FH_updateRequestPayload", "") + verify(mockExecution).setVariable("FH_updateRequestResponse", null) + verify(mockExecution).setVariable("FH_updateRequestResponseCode", null) + + //Auth variables + verify(mockExecution).setVariable("BasicAuthHeaderValue","") + + //Response variables + verify(mockExecution).setVariable("FalloutHandlerResponse","") + verify(mockExecution).setVariable("FH_ErrorResponse", null) + verify(mockExecution).setVariable("FH_ResponseCode", "") + + verify(mockExecution).setVariable("FH_request_id-Ok",true) + verify(mockExecution).setVariable("FH_request_id","uCPE1020_STUW105_5002") + verify(mockExecution).setVariable("FH_request_action","Layer3ServiceActivateRequest") + verify(mockExecution).setVariable("FH_source","OMX") + verify(mockExecution).setVariable("FH_ErrorCode","Some Error Code - Fallout Handler") + verify(mockExecution).setVariable("FH_ErrorMessage","Some Error Message - Fallout Handler") + + } + + @Test + public void testpostProcessResponse(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("FH_success")).thenReturn(false) + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.postProcessResponse(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(4)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadResponseActual = arg2List.get(1) + + assertEquals(falloutHandlerResponse.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) + + verify(mockExecution).setVariable("FH_ResponseCode","500") + } + + private String updateRequestPayload = """ + + + + + testReqId + BPEL + ErrorMessage + ErrorCode + FAILED + NotifyStatus + + + + """ + + @Test + public void testupdateRequestPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") + when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode") + when(mockExecution.getVariable("FH_NOTIFY_STATUS")).thenReturn("NotifyStatus") + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateRequestPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadRequestActual = arg2List.get(0) + + assertEquals(updateRequestPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) + } + + private String updateRequestInfraPayload = """ + + + + + testReqId + BPEL + ErrorMessage + FAILED + 100 + + + + """ + + @Test + public void testupdateRequestInfraPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateRequestInfraPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadRequestActual = arg2List.get(0) + + assertEquals(updateRequestInfraPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) + } + + private String updateRequestGammaPayload = """ + + + + + testReqId + BPEL + ErrorMessage + ErrorCode + FAILED + + + + """ + + @Test + public void testupdateRequestGammaPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + when(mockExecution.getVariable("FH_ErrorMessage")).thenReturn("ErrorMessage") + when(mockExecution.getVariable("FH_ErrorCode")).thenReturn("ErrorCode") + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateRequestGammaPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadRequestActual = arg2List.get(0) + + assertEquals(updateRequestGammaPayload.replaceAll("\\s+", ""), payloadRequestActual.replaceAll("\\s+", "")) + } + + + String updateResponseStatusPayload = """ + + + + + testReqId + BPEL + SENDING_FINAL_NOTIFY + + + + """ + + @Test + public void testupdateResponseStatusPayload(){ + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("FH_request_id")).thenReturn("testReqId") + + FalloutHandler falloutHandler = new FalloutHandler() + falloutHandler.updateResponseStatusPayload(mockExecution) + + // Capture the arguments to setVariable + ArgumentCaptor captor1 = ArgumentCaptor.forClass(String.class); + ArgumentCaptor captor2 = ArgumentCaptor.forClass(String.class); + + verify(mockExecution, times(1)).setVariable(captor1.capture(), captor2.capture()) + List arg2List = captor2.getAllValues() + String payloadResponseActual = arg2List.get(0) + + assertEquals(updateResponseStatusPayload.replaceAll("\\s+", ""), payloadResponseActual.replaceAll("\\s+", "")) + } + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoGroovyTest.groovy new file mode 100644 index 0000000000..174ca65bfd --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoGroovyTest.groovy @@ -0,0 +1,72 @@ +/*- + * ============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.common.scripts + +import static org.mockito.Mockito.* + +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +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.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition + +abstract class MsoGroovyTest { + + protected ExecutionEntity setupMock(String procName) { + ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) + when(mockProcessDefinition.getKey()).thenReturn(procName) + + RepositoryService mockRepositoryService = mock(RepositoryService.class) + when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) + when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn(procName) + when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + + ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) + + return mockExecution + } + + protected ExecutionEntity setupMockWithPrefix(String procName, String prefix) { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("prefix")).thenReturn(prefix) + + ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class) + RepositoryService repositoryService = mock(RepositoryService.class) + ProcessDefinition processDefinition = mock(ProcessDefinition.class) + + when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices) + when(processEngineServices.getRepositoryService()).thenReturn(repositoryService) + when(repositoryService.getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(processDefinition) + when(processDefinition.getKey()).thenReturn(procName) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + return mockExecution + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtilsTest.groovy new file mode 100644 index 0000000000..8e109bb6c8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtilsTest.groovy @@ -0,0 +1,233 @@ +/*- + * ============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.common.scripts + +// JUnit 4 +import org.junit.Test +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; + +import static groovy.test.GroovyAssert.shouldFail +import static groovy.test.GroovyAssert.assertTrue +import static groovy.test.GroovyAssert.assertEquals + +import org.openecomp.mso.bpmn.common.scripts.MsoUtils; +import org.apache.commons.lang3.* + + +class MsoUtilsTest { + + def utils = new MsoUtils() + def origXmlResponse = null + // Expected rebuilds + def expected_buildElements = "10Kbps1192.168.1.15192.168.1.15282192.168.1.16192.168.1.1628" + def expected_rebuildDhcp = "YNY192.168.1.7192.168.1.8192.155.2.328192.168.1.5192.168.1.62.2.2.11.1.1.1192.155.2.428192.168.1.6192.168.1.72.2.2.21.1.1.2N1:51:60:0281:12:23:34:40:0281:12:23:34:4" + def expected_rebuildFirewallLite = "YN0.0.0.11Y110.0.0.22Y22:0Y33:1Y44" + def expected_rebuildInternetEvcAccess = "8Mbpsds" + def expected_rebuildInternetServiceChangeDetails = "10Kbps1192.168.1.15192.168.1.15282192.168.1.16192.168.1.162812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:2da::28" + def expected_rebuildL2Home = "AS/VLXM/003717//SWMultiPointMTSNJA4LCP1" + def expected_rebuildNat = "Y0.0.0.00.0.0.00.0.0.00.0.0.10.0.0.10.0.0.1" + def expected_rebuildPat = "NY192.168.1.440192.168.1.5192.168.1.4528192.168.1.6" + def expected_rebuildStaticRoutes = "255.255.252.128192.168.1.15255.255.252.228192.168.1.15255.255.252.328192.168.1.152001:1890:12e3:2da::282001:1890:12e3:2da::2001:1890:12e3:2da::282001:1890:12e3:2da::" + def expected_rebuildUcpeVmsServiceInformation = "AVPN1Active2StandbyhostnameactivecodeOOB11ZZJUNIPERMODEL11111122HYJUNIPERMODEL222222" + def expected_rebuildVrLan = "noneprimary10.192.27.254242620:0:10d0:f:ffff:ffff:ffff:fffe64162.200.3.1442001:1890:12e3:2da::1192.168.1.2192.168.1.1281192.168.1.72192.168.1.71281192.168.1.68192.168.1.672812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:3da::2812001:1890:12e3:2da::2001:1890:12e3:4da::28YNY192.168.1.7192.168.1.8192.155.2.328192.168.1.5192.168.1.62.2.2.11.1.1.1192.155.2.428192.168.1.6192.168.1.72.2.2.21.1.1.2N1:51:60:0281:12:23:34:40:0281:12:23:34:4NY192.168.1.440192.168.1.5192.168.1.4528192.168.1.6Y0.0.0.00.0.0.00.0.0.00.0.0.10.0.0.10.0.0.1YN0.0.0.11Y110.0.0.22Y22:0Y33:1Y44255.255.252.128192.168.1.15255.255.252.228192.168.1.15255.255.252.328192.168.1.152001:1890:12e3:2da::282001:1890:12e3:2da::2001:1890:12e3:2da::282001:1890:12e3:2da::" + def expected_rebuildVrLanInterfacePartial = "primary10.192.27.254242620:0:10d0:f:ffff:ffff:ffff:fffe64162.200.3.1442001:1890:12e3:2da::1192.168.1.2192.168.1.1281192.168.1.72192.168.1.71281192.168.1.68192.168.1.67281192.168.1.15192.168.1.15282192.168.1.16192.168.1.162812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:3da::2812001:1890:12e3:2da::2001:1890:12e3:4da::2812001:1890:12e3:2da::2001:1890:12e3:2da::2812001:1890:12e3:2da::2001:1890:12e3:2da::28" + + @Before + public void setUp() { + def responseAsString = getFile("sdncadaptercallbackrequest.xml") + def varrequestData=utils.getNodeText(responseAsString,"RequestData") + //def varResponseListData = StringEscapeUtils.unescapeXml(varrequestData) + def varResponseListData = varrequestData.replace("&", "&") + origXmlResponse = utils.getNodeXml(varResponseListData, "layer3-service-list").drop(38).trim() + + } + + @Test + public void testBuildL2Home() { + def rebuildL2Home = utils.buildL2HomingInformation(origXmlResponse) + println " rebuildL2Home: " + println " actual - " + rebuildL2Home + println " expected - " + expected_rebuildL2Home + assertEquals("rebuildL2Home - expected vs actual", expected_rebuildL2Home, rebuildL2Home) + } + + @Test + public void testBuildInternetEvcAccess() { + def rebuildInternetEvcAccess = utils.buildInternetEvcAccessInformation(origXmlResponse) + println " rebuildInternetEvcAccess: " + println " actual - " + rebuildInternetEvcAccess + println " expected - " + expected_rebuildInternetEvcAccess + assertEquals("rebuildInternetEvcAccess - expected vs actual", expected_rebuildInternetEvcAccess, rebuildInternetEvcAccess) + } + + @Test + public void testBuildInternetServiceChangeDetails() { + def rebuildInternetServiceChangeDetails = utils.buildInternetServiceChangeDetails(origXmlResponse) + println " rebuildInternetServiceChangeDetails: " + println " actual - " + rebuildInternetServiceChangeDetails + println " expected - " + expected_rebuildInternetServiceChangeDetails + assertEquals("rebuildInternetServiceChangeDetails - expected vs actual", expected_rebuildInternetServiceChangeDetails, rebuildInternetServiceChangeDetails) + } + + // Coming v100 + @Test + @Ignore + public void testBuildUcpeVmsServiceInformation() { + def rebuildUcpeVmsServiceInformation = utils.buildUcpeVmsServiceInformation(origXmlResponse) + println " rebuildUcpeVmsServiceInformation: " + println " actual - " + rebuildUcpeVmsServiceInformation + println " expected - " + expected_rebuildUcpeVmsServiceInformation + assertEquals("rebuildUcpeVmsServiceInformation - expected vs actual", expected_rebuildUcpeVmsServiceInformation, rebuildUcpeVmsServiceInformation) + } + + @Test + public void testBuildElements() { + // testing utility codes: buildElements() & buildElementsUnblunded() + def internetServiceChangeDetails = utils.getNodeXml(origXmlResponse, "internet-service-change-details").drop(38).trim() + def buildElements = '' + buildElements = "" + buildElements += utils.buildElements(internetServiceChangeDetails, ["internet-evc-speed-value"], "") + buildElements += utils.buildElements(internetServiceChangeDetails, ["internet-evc-speed-units"], "") + def tProvidedV4LanPublicPrefixesChangesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length"] + buildElements += utils.buildElementsUnbounded(internetServiceChangeDetails, tProvidedV4LanPublicPrefixesChangesList, "t-provided-v4-lan-public-prefixes") + buildElements += "" + println " buildElements: " + println " actual - " + buildElements + println " expected - " + expected_buildElements + assertEquals("buildElements - expected vs actual", expected_buildElements, buildElements) + } + + @Test + public void testBuildVrLan() { + def rebuildVrLan = utils.buildVrLan(origXmlResponse) + println " rebuildVrLans: " + println " actual - " + rebuildVrLan + println " expected - " + expected_rebuildVrLan + assertEquals("rebuildVrLan - expected vs actual", expected_rebuildVrLan, rebuildVrLan) + } + + @Test + public void testBuildVrLanInterfacePartial() { + def rebuildVrLanInterfacePartial = utils.buildVrLanInterfacePartial(origXmlResponse) + println " rebuildVrLanInterfacePartial: " + println " actual - " + rebuildVrLanInterfacePartial + println " expected - " + expected_rebuildVrLanInterfacePartial + assertEquals("rebuildVrLanInterfacePartial - expected vs actual", expected_rebuildVrLanInterfacePartial, rebuildVrLanInterfacePartial) + } + + @Test + public void testBuildDhcp() { + def rebuildDhcp = utils.buildDhcp(origXmlResponse) + println " rebuildDhcp: " + println " actual - " + rebuildDhcp + println " expected - " + expected_rebuildDhcp + assertEquals("rebuildDhcp - expected vs actual", expected_rebuildDhcp, rebuildDhcp) + } + + @Test + public void testBuildPat() { + def rebuildPat = utils.buildPat(origXmlResponse) + println " rebuildPat: " + println " actual - " + rebuildPat + println " expected - " + expected_rebuildPat + assertEquals("rebuildPat - expected vs actual", expected_rebuildPat, rebuildPat) + } + + @Test + public void testBuildNat() { + def rebuildNat = utils.buildNat(origXmlResponse) + println " rebuildNat: " + println " actual - " + rebuildNat + println " expected - " + expected_rebuildNat + assertEquals("rebuildNat - expected vs actual", expected_rebuildNat, rebuildNat) + } + + @Test + public void testBuildFirewallLite() { + def rebuildFirewallLite = utils.buildFirewallLite(origXmlResponse) + println " rebuildFirewallLite: " + println " actual - " + rebuildFirewallLite + println " expected - " + expected_rebuildFirewallLite + assertEquals("rebuildFirewallLite - expected vs actual", expected_rebuildFirewallLite, rebuildFirewallLite) + } + + @Test + public void testBuildStaticRoutes() { + def rebuildStaticRoutes = utils.buildStaticRoutes(origXmlResponse) + println " rebuildStaticRoutes: " + println " actual - " + rebuildStaticRoutes + println " expected - " + expected_rebuildStaticRoutes + assertEquals("rebuildStaticRoutes - expected vs actual", expected_rebuildStaticRoutes, rebuildStaticRoutes) + } + + @Test + public void testGetBasicAuth(){ + def encodedAuth = utils.getBasicAuth("3E3CFA7BE2F6107AAD4AAA65F8976690","07a7159d3bf51a0e53be7a8f89699be7") + assertEquals("Basic bXlTdHJpbmc=", encodedAuth) + } + + @Test + public void testEncrypt(){ + def encrypted = utils.encrypt("myString","07a7159d3bf51a0e53be7a8f89699be7") + assertEquals("3E3CFA7BE2F6107AAD4AAA65F8976690", encrypted) + + //use to get value for urn properties + //println(utils.encrypt("password")) + } + + @Test + public void testDecrypt(){ + def decrypted = utils.decrypt("3E3CFA7BE2F6107AAD4AAA65F8976690", "07a7159d3bf51a0e53be7a8f89699be7") + assertEquals("myString", decrypted) + } + + @Test + public void testGetPBGFList(){ + def responseAsString = getFile("sdncDeleteResponse.xml") + def nodes = utils.getPBGFList("true", responseAsString) + //assertEquals(2, nodes.size()) + while(!nodes.empty){ + def myBGFXML = nodes.remove(0) + def myBGF= new XmlSlurper().parseText(myBGFXML) + println "borderElmtId: " + myBGF.'border-element-id' + println "vlanid: " + myBGF.'vlan-id' +"\n" + } + } + + public String getFile(String fileName) { + def SLASH = File.separator + def pathBase = ' ' + def fileAsString = '' + try { + pathBase = new File(".").getCanonicalPath() + //println "pathBase " + pathBase + "${SLASH}src${SLASH}test${SLASH}resources${SLASH}${fileName}" + fileAsString = new File(pathBase, "${SLASH}src${SLASH}test${SLASH}resources${SLASH}${fileName}").getText() + } catch (Exception ex) { + println " *** getFile error: " + ex.getStackTrace() + } finally { + return fileAsString + } + } + + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy new file mode 100644 index 0000000000..f71e4d2516 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterTest.groovy @@ -0,0 +1,948 @@ +/*- + * ============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.common.scripts; + +import static org.mockito.Mockito.* + +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.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapter; + +import org.openecomp.mso.bpmn.mock.FileUtil + +@RunWith(MockitoJUnitRunner.class) +public class SDNCAdapterTest { + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + System.setProperty("jboss.qualified.host.name","myhost.att.com") + } + + + def workflowResponse = """ + + + testRequestId + 200 + OK + + <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <vr-lan xmlns="com:att:sdnctl:l3api"> + <vr-lan-interface> + <static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + </static-routes> + <dhcp> + <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> + <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> + <use-v6-default-pool>N</use-v6-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.8</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.5</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:5</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:6</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + </dhcp> + <firewall-lite> + <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> + <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> + <v4-firewall-prefix-length>1</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>1</port-number> + </udp-ports> + <tcp-ports> + <port-number>1</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> + <v4-firewall-prefix-length>2</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>2</port-number> + </udp-ports> + <tcp-ports> + <port-number>2</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>0</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>3</port-number> + </udp-ports> + <tcp-ports> + <port-number>3</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>1</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>4</port-number> + </udp-ports> + <tcp-ports> + <port-number>4</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + </firewall-lite> + <pat> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> + </v4-pat-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <v4-pat-enabled>N</v4-pat-enabled> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> + </v4-pat-pools> + </pat> + <nat> + <v4-nat-enabled>Y</v4-nat-enabled> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.0</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.0</v4-nat-external> + </v4-nat-mapping-entries> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.1</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.1</v4-nat-external> + </v4-nat-mapping-entries> + </nat> + <vr-designation>primary</vr-designation> + <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> + <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> + <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> + <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> + <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> + <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> + <v4-public-lan-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.2</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.72</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.68</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + </v4-public-lan-prefixes> + <v6-public-lan-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </v6-public-lan-prefixes> + </vr-lan-interface> + <routing-protocol>none</routing-protocol> + </vr-lan> +<ucpe-vms-service-information> + <transport-service-information> + <transport-service-type>AVPN</transport-service-type> + <access-circuit-info> + <access-circuit-id>1</access-circuit-id> + <dual-mode>Active</dual-mode> + </access-circuit-info> + <access-circuit-info> + <access-circuit-id>2</access-circuit-id> + <dual-mode>Standby</dual-mode> + </access-circuit-info> + </transport-service-information> + <ucpe-information> + <ucpe-host-name>hostname</ucpe-host-name> + <ucpe-activation-code>activecode</ucpe-activation-code> + <out-of-band-management-modem>OOB</out-of-band-management-modem> + </ucpe-information> + <vnf-list> + <vnf-information> + <vnf-instance-id>1</vnf-instance-id> + <vnf-sequence-number>1</vnf-sequence-number> + <vnf-type>ZZ</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL1</vnf-model> + <vnf-id>1</vnf-id> + <prov-status>1</prov-status> + <operational-state>1</operational-state> + <orchestration-status>1</orchestration-status> + <equipment-role>1</equipment-role> + </vnf-information> + <vnf-information> + <vnf-instance-id>2</vnf-instance-id> + <vnf-sequence-number>2</vnf-sequence-number> + <vnf-type>HY</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL2</vnf-model> + <vnf-id>2</vnf-id> + <prov-status>2</prov-status> + <operational-state>2</operational-state> + <orchestration-status>2</orchestration-status> + <equipment-role>2</equipment-role> + </vnf-information> + </vnf-list> + </ucpe-vms-service-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <notification-url>https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.att.com:8443/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + <internet-service-change-details> + <internet-evc-speed-value>10</internet-evc-speed-value> + <internet-evc-speed-units>Kbps</internet-evc-speed-units> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>2</request-index> + <v4-next-hop-address>192.168.1.16</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </internet-service-change-details> + </service-data> + </layer3-service-list> + + +""" + + String sdncAdapterRequest = """ + + + + + 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 + query + services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET + http://myhost.att.com:28080/mso/sdncAdapterCallbackServiceImpl + + + + + 12570a36-7388-4c0a-bec4-189ce3kg9956 + GetLayer3ServiceDetailsRequest + OMX + + + SDN-ETHERNET-INTERNET + PD/VLXM/003717//SW_INTERNET + + +""" + +def sdncAdapterResponse = """ + + + 39542e39-ccc3-4d1a-8b79-04ce88526613 + 404 + Error processing request to SDNC. Not Found. + https://sdncodl.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist.] + + + +""" + +def workflowErrorResponse = """ + Received error from SDN-C: Error processing request to SDNC. Not Found. + https://sdncodl.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist.] + 5300 + 404 + """ + +def workflowErrorResponse1 = """ + Invalid Callback Response from SDNC Adapter + 5300 + """ + +def enhancedCallbackRequestData = + """ + FK/VLXM/003717//SW_INTERNET + + service-configuration-operation + activate + synccomplete + N + Layer3ServiceActivateRequest + SUPP + 2015-04-28T21:32:11.386Z + + + + ds + 8 + Mbps + + + + + + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 255.255.252.1 + 192.168.1.15 + 28 + + + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 255.255.252.2 + 192.168.1.15 + 28 + + + 255.255.252.3 + 192.168.1.15 + 28 + + + + N + Y + N + + 192.168.1.7 + + + 192.168.1.8 + + + 1.1.1.1 + 28 + + 192.168.1.5 + + 2.2.2.1 + + 192.168.1.6 + + 192.155.2.3 + + + 1.1.1.2 + 28 + + 192.168.1.6 + + 2.2.2.2 + + 192.168.1.7 + + 192.155.2.4 + + Y + + 1:5 + + + 1:6 + + + 4:4 + 28 + + 1:1 + + 3:3 + + 2:2 + + 0:0 + + + 4:4 + 28 + + 1:1 + + 3:3 + + 2:2 + + 0:0 + + + + N + Y + + 0.0.0.1 + 1 + Y + + 1 + + + 1 + + + + 0.0.0.2 + 2 + Y + + 2 + + + 2 + + + + : + 0 + Y + + 3 + + + 3 + + + + : + 1 + Y + + 4 + + + 4 + + + + + + 192.168.1.44 + 192.168.1.5 + 0 + + Y + N + + 192.168.1.45 + 192.168.1.6 + 28 + + + + Y + + 0.0.0.0 + 0.0.0.0 + 0.0.0.0 + + + 0.0.0.1 + 0.0.0.1 + 0.0.0.1 + + + primary + 162.200.3.144 + 64 + 2001:1890:12e3:2da:: + 2620:0:10d0:f:ffff:ffff:ffff:fffe + 24 + 10.192.27.254 + + + 1 + 192.168.1.2 + 192.168.1.1 + 28 + + + 1 + 192.168.1.72 + 192.168.1.71 + 28 + + + 1 + 192.168.1.68 + 192.168.1.67 + 28 + + + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:3da:: + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:4da:: + 28 + + + + none + + + + AVPN + + 1 + Active + + + 2 + Standby + + + + hostname + activecode + OOB + + + + 1 + 1 + ZZ + JUNIPER + MODEL1 + 1 + 1 + 1 + 1 + 1 + + + 2 + 2 + HY + JUNIPER + MODEL2 + 2 + 2 + 2 + 2 + 2 + + + + + Layer3ServiceActivateRequest + 4281555 + 155415ab-b4a7-4382-b4c6-d17d9sm42855 + https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws + OMX + 1 + + + activate + https://msojra.mtsnjdcp1.aic.cip.att.com:8443/adapters/rest/SDNCNotify + 5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760 + + + MultiPoint + MTSNJA4LCP1 + AS/VLXM/003717//SW + + + FK/VLXM/003717//SW_INTERNET + ST E2E Test42855_1300004281555 + SDN-ETHERNET-INTERNET + + + 10 + Kbps + + 1 + 192.168.1.15 + 192.168.1.15 + 28 + + + 2 + 192.168.1.16 + 192.168.1.16 + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + 1 + 2001:1890:12e3:2da:: + 2001:1890:12e3:2da:: + 28 + + + + + +""" + +def sdncAdapterResponseEmpty = +""" + +""" + +def sdncAdapterResponseError = +""" + + + 39542e39-ccc3-4d1a-8b79-04ce88526613 + 404 + Error processing request to SDNC. Not Found. + https://sdncodl.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist.] + + +""" + + + @Test + public void testPreProcessRequest() { + + String sdncAdapterWorkflowRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("URN_mso_adapters_po_auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") + when(mockExecution.getVariable("URN_mso_msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("sdncAdapterWorkflowRequest")).thenReturn(sdncAdapterWorkflowRequest) + when(mockExecution.getVariable("URN_mso_workflow_sdncadapter_callback")).thenReturn("http://someurl.someting.com:28080/mso/sdncAdapterCallbackServiceImpl") + when(mockExecution.getVariable("URN_mso_use_qualified_host")).thenReturn("true") + when(mockExecution.getProcessInstanceId()).thenReturn("745b1b50-e39e-4685-9cc8-c71f0bde8bf0") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + + + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.preProcessRequest(mockExecution) + + MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() + debugger.printInvocations(mockExecution) + + + verify(mockExecution).setVariable("prefix","SDNCA_") + verify(mockExecution).setVariable("sdncAdapterResponse","") + verify(mockExecution).setVariable("asynchronousResponseTimeout",false) + verify(mockExecution).setVariable("continueListening",false) + verify(mockExecution).setVariable("BasicAuthHeaderValue","Basic cGFzc3dvcmQ=") + verify(mockExecution).setVariable("serviceConfigActivate",false) + verify(mockExecution).setVariable("SDNCA_requestId", "745b1b50-e39e-4685-9cc8-c71f0bde8bf0") + verify(mockExecution).setVariable("SDNCA_SuccessIndicator",false) + verify(mockExecution).setVariable("source","") + verify(mockExecution).setVariable("sdncAdapterRequest", sdncAdapterRequest) + } + + @Test + public void testProcessResponse() + { + String sdncAdapterCallbackResponse = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackResponse) + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + +// MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() +// debugger.printInvocations(mockExecution) + + verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("sdncAdapterResponse",workflowResponse) + verify(mockExecution).setVariable("enhancedCallbackRequestData",enhancedCallbackRequestData) + verify(mockExecution).setVariable("continueListening",false) + + } + + @Test + public void testProcessResponse_ErrorCase_404() + { + String sdncAdapterCallbackErrorResponse = FileUtil.readResourceFile("sdncadaptercallbackrequest_404CallBack.xml"); + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(sdncAdapterCallbackErrorResponse) + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + + verify(mockExecution, times(1)).getVariable("isDebugLogEnabled") + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseError) + verify(mockExecution).setVariable("enhancedCallbackRequestData", "") + verify(mockExecution).setVariable("continueListening",false) + + } + + @Test + public void testProcessResponse_ErrorCase_InvalidCallback() + { + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn("

    Service Unavailable

    ") + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + + verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponseEmpty) + verify(mockExecution).setVariable("enhancedCallbackRequestData", "") + verify(mockExecution).setVariable("continueListening",false) + + } + + @Test + public void postProcessResponse() + { + + String SDNCAdapterCallbackRequest = + """ + + + 3bb02798-b344-4d28-9bca-1f029954d1c9 + 404 + Error processing request to SDNC. Not Found. + https://sdncodl.us.infra.aic.att.net:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist ] + +""" + + String sdncAdapterResponse = + """ + + + 3bb02798-b344-4d28-9bca-1f029954d1c9 + 404 + Error processing request to SDNC. Not Found. + https://sdncodl.us.infra.aic.att.net:8443/restconf/config/L3SDN-API:services/layer3-service-list/85%2FCSIP%2F141203%2FPT_CSI9999998693. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist ] + + +""" + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("sdncAdapterCallbackRequest")).thenReturn(SDNCAdapterCallbackRequest) + SDNCAdapter sdncAdapter = new SDNCAdapter() + sdncAdapter.postProcessResponse(mockExecution) + + verify(mockExecution).getVariable("isDebugLogEnabled") + verify(mockExecution,times(2)).getVariable("sdncAdapterCallbackRequest") + verify(mockExecution).setVariable("sdncAdapterResponse", sdncAdapterResponse) + verify(mockExecution).setVariable("enhancedCallbackRequestData", "") + verify(mockExecution).setVariable("continueListening",false) + + } + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtilsTest.groovy new file mode 100644 index 0000000000..645fbe6e8f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtilsTest.groovy @@ -0,0 +1,972 @@ +/*- + * ============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.common.scripts; + +import static org.mockito.Mockito.* + +import org.openecomp.mso.bpmn.common.scripts.VidUtils; +import org.openecomp.mso.bpmn.core.WorkflowException + +import groovy.json.JsonSlurper + +import org.camunda.bpm.engine.delegate.BpmnError +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.impl.pvm.process.ProcessDefinitionImpl +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.runtime.Execution; + +import static org.junit.Assert.*; + +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.mockito.internal.debugging.MockitoDebuggerImpl +import org.junit.Before +import org.junit.Rule; +import org.junit.Test +import org.junit.Ignore +import org.junit.runner.RunWith +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity; +import org.junit.Before; +import org.junit.Test; + +@RunWith(MockitoJUnitRunner.class) + +class VidUtilsTest { + + def vfModuleReqJson = """ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "STMTN5MMSC21-MMSC::model-1-0", + "modelVersion": "1", + "modelCustomizationId": "ee6478e5-ea33-3346-ac12-ab121484a3fe" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "MDTWNJ21", + "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" + }, + "requestInfo": { + "instanceName": "PCRF::module-0-2", + "source": "VID", + "suppressRollback": true + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", + "instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", + "modelInfo": { + "modelType": "volumeGroup", + "modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12..base..module-0", + "modelVersion": "1" + } + } + }, + { + "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", + "instanceName": "skask-test", + "modelInfo": { + "modelType": "vnf", + "modelInvariantId": "skask", + "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", + "modelName": "vSAMP12", + "modelVersion": "1.0", + "modelCustomizationName": "vSAMP12 1" + } + } + } + ], + "requestParameters": { + "userParams": [ + { + "name": "vnfName", + "value": "STMTN5MMSC20" + }, + { + "name": "tenantId", + "value": "vpe-tenant-123" + }, + { + "name": "aicCloudRegion", + "value": "MDTWNJ21" + }, + { + "name": "isAvpnService", + "value": "true" + }, + { + "name": "asn", + "value": "asn-1234" + }, + { + "name": "releaseForAero", + "value": "release-for-aero-something" + }, + { + "name": "aicClli", + "value": "MTJWNJA4LCP" + }, + { + "name": "svcProviderPartNumber", + "value": "svc-provide-number-1234" + } + ] + } + } +} +""" + def bpmnReq1 = """ +{ + "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 vidUtilResp1 = """ + + CREATE_VF_MODULE_VOL + VID + test-service-instance-id-123 + + + + 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 bpmnReq2 = """ +{ + "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" + } + } + } + ] + } +} +""" + + def bpmnReqJsonVolumeSuppressRollbackTrue = """ +{ + "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": true + }, + "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" + } + } + } + ] + } +} +""" + +def bpmnReqJsonVolumeSuppressRollbackFalse = """ +{ + "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" + } + } + } + ] + } +} +""" + +def bpmnReqJsonVolumeSuppressRollbackNone = """ +{ + "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" + }, + "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" + } + } + } + ] + } +} +""" + + def bpmnReqJsonVfModuleSuppressRollbackTrue = """ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "PCRF::module-0-2", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", +"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", +"modelInfo": { +"modelType": "volumeGroup", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12..base..module-0", +"modelVersion": "1" +} +} +}, +{ +"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", +"instanceName": "skask-test", +"modelInfo": { +"modelType": "vnf", +"modelInvariantId": "skask", +"modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationName": "vSAMP12 1" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} +} +""" + +def bpmnReqJsonVfModuleSuppressRollbackFalse = """ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "PCRF::module-0-2", +"source": "VID", +"suppressRollback": false +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", +"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", +"modelInfo": { +"modelType": "volumeGroup", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12..base..module-0", +"modelVersion": "1" +} +} +}, +{ +"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", +"instanceName": "skask-test", +"modelInfo": { +"modelType": "vnf", +"modelInvariantId": "skask", +"modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationName": "vSAMP12 1" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} +} +""" + +def bpmnReqJsonVfModuleSuppressRollbackNone = """ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "PCRF::module-0-2", +"source": "VID" +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", +"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", +"modelInfo": { +"modelType": "volumeGroup", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12..base..module-0", +"modelVersion": "1" +} +} +}, +{ +"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", +"instanceName": "skask-test", +"modelInfo": { +"modelType": "vnf", +"modelInvariantId": "skask", +"modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationName": "vSAMP12 1" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} +} +""" + def vidUtilResp2 = """ + + CREATE_VF_MODULE_VOL + VID + test-service-instance-id-123 + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + + true + + + + +""" + +def vidUtilVolumeRespBackoutOnFailureFalse = """ + + CREATE_VF_MODULE_VOL + VID + test-service-instance-id-123 + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + + false + + + + +""" + +def vidUtilVolumeRespBackoutOnFailureTrue = """ + + CREATE_VF_MODULE_VOL + VID + test-service-instance-id-123 + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + + true + + + + +""" + +def vidUtilVolumeRespBackoutOnFailureEmpty = """ + + CREATE_VF_MODULE_VOL + VID + test-service-instance-id-123 + + + + MSOTESTVOL101a-vSAMP12_base_vol_module-0 + Test/vSAMP12 + vSAMP12::base::module-0 + 2.0 + mdt1 + 88a6ca3ee0394ade9403f075db23167e + + + + + + +""" + +def vidUtilVfModuleRespBackoutOnFailureFalse = """ + + test-request-id-123 + CREATE_VF_MODULE + VID + + test-service-instance-id-123 + + + skask-test + test-vnf-type-123 + test-vnf-id-123 + test-volume-group-id-123 + test-vf-module-id-123 + PCRF::module-0-2 + STMTN5MMSC21-MMSC::model-1-0 + + false + 1.0 + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + + false + ff5256d2-5a33-55df-13ab-12abad84e7ff + 1 + + + +""" + +def vidUtilVfModuleRespBackoutOnFailureTrue = """ + + test-request-id-123 + CREATE_VF_MODULE + VID + + test-service-instance-id-123 + + + skask-test + test-vnf-type-123 + test-vnf-id-123 + test-volume-group-id-123 + test-vf-module-id-123 + PCRF::module-0-2 + STMTN5MMSC21-MMSC::model-1-0 + + false + 1.0 + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + + true + ff5256d2-5a33-55df-13ab-12abad84e7ff + 1 + + + +""" + +def vidUtilVfModuleRespBackoutOnFailureEmpty = """ + + test-request-id-123 + CREATE_VF_MODULE + VID + + test-service-instance-id-123 + + + skask-test + test-vnf-type-123 + test-vnf-id-123 + test-volume-group-id-123 + test-vf-module-id-123 + PCRF::module-0-2 + STMTN5MMSC21-MMSC::model-1-0 + + false + 1.0 + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + + + ff5256d2-5a33-55df-13ab-12abad84e7ff + 1 + + + +""" + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + + } + + @Test + public void test() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReq1) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') + print xmlReq + assertEquals(vidUtilResp1, xmlReq) + } + + //@Test + public void testVfModule() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(vfModuleReqJson) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVfModuleRequest(null, reqMap, "CREATE_VF_MODULE", "test-service-instance-id-123") + print xmlReq + assertTrue(true) + } + + @Test + public void testNoRequestParams() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReq2) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') + + assertEquals(vidUtilResp2, xmlReq) + } + + @Test + public void testVfModuleVolumeRollbackTrue() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVolumeSuppressRollbackTrue) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') + + assertEquals(vidUtilVolumeRespBackoutOnFailureFalse, xmlReq) + } + + @Test + public void testVfModuleVolumeRollbackFalse() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVolumeSuppressRollbackFalse) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') + + assertEquals(vidUtilVolumeRespBackoutOnFailureTrue, xmlReq) + } + + @Test + public void testVfModuleVolumeRollbackNone() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVolumeSuppressRollbackNone) + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVolumeRequest(reqMap, 'CREATE_VF_MODULE_VOL', 'test-service-instance-id-123') + + assertEquals(vidUtilVolumeRespBackoutOnFailureEmpty, xmlReq) + } + + @Test + public void testVfModuleRollbackTrue() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVfModuleSuppressRollbackTrue) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("vnfType")).thenReturn('test-vnf-type-123') + when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id-123') + when(mockExecution.getVariable("vfModuleId")).thenReturn('test-vf-module-id-123') + when(mockExecution.getVariable("volumeGroupId")).thenReturn('test-volume-group-id-123') + when(mockExecution.getVariable("isBaseVfModule")).thenReturn('false') + when(mockExecution.getVariable("mso-request-id")).thenReturn('test-request-id-123') + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVfModuleRequest(mockExecution, reqMap, 'CREATE_VF_MODULE', 'test-service-instance-id-123') + + println 'ggg->' + xmlReq + assertEquals(vidUtilVfModuleRespBackoutOnFailureFalse, xmlReq) + } + + @Test + public void testVfModuleRollbackFalse() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVfModuleSuppressRollbackFalse) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("vnfType")).thenReturn('test-vnf-type-123') + when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id-123') + when(mockExecution.getVariable("vfModuleId")).thenReturn('test-vf-module-id-123') + when(mockExecution.getVariable("volumeGroupId")).thenReturn('test-volume-group-id-123') + when(mockExecution.getVariable("isBaseVfModule")).thenReturn('false') + when(mockExecution.getVariable("mso-request-id")).thenReturn('test-request-id-123') + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVfModuleRequest(mockExecution, reqMap, 'CREATE_VF_MODULE', 'test-service-instance-id-123') + + println 'ggg->' + xmlReq + assertEquals(vidUtilVfModuleRespBackoutOnFailureTrue, xmlReq) + } + + @Test + public void testVfModuleRollbackNone() { + + def jsonSlurper = new JsonSlurper() + Map reqMap = jsonSlurper.parseText(bpmnReqJsonVfModuleSuppressRollbackNone) + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + when(mockExecution.getVariable("vnfType")).thenReturn('test-vnf-type-123') + when(mockExecution.getVariable("vnfId")).thenReturn('test-vnf-id-123') + when(mockExecution.getVariable("vfModuleId")).thenReturn('test-vf-module-id-123') + when(mockExecution.getVariable("volumeGroupId")).thenReturn('test-volume-group-id-123') + when(mockExecution.getVariable("isBaseVfModule")).thenReturn('false') + when(mockExecution.getVariable("mso-request-id")).thenReturn('test-request-id-123') + + VidUtils vidUtils = new VidUtils() + def xmlReq = vidUtils.createXmlVfModuleRequest(mockExecution, reqMap, 'CREATE_VF_MODULE', 'test-service-instance-id-123') + + println 'ggg->' + xmlReq + assertEquals(vidUtilVfModuleRespBackoutOnFailureEmpty, xmlReq) + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java new file mode 100644 index 0000000000..4e2b1e121a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/BPMNUtil.java @@ -0,0 +1,214 @@ +package org.openecomp.mso.bpmn.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.spy; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.Response; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.history.HistoricProcessInstance; +import org.camunda.bpm.engine.history.HistoricVariableInstance; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.jboss.resteasy.spi.AsynchronousResponse; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncCommonResource; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +/** + * Set of utility methods used for Unit testing + * + */ +public class BPMNUtil { + + public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) { + String pID = getProcessInstanceId(processEngineServices, + processDefinitionID); + assertProcessInstanceFinished(processEngineServices, pID); + HistoricVariableInstance responseData = processEngineServices.getHistoryService() + .createHistoricVariableInstanceQuery().processInstanceId(pID) + .variableName(name) + .singleResult(); + + if (responseData != null) { + return (responseData.getValue() != null ? responseData.getValue().toString(): null); + } + return null; + } + + @SuppressWarnings("unchecked") + public static T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) { + String pID = getProcessInstanceId(processEngineServices, + processDefinitionID); + assertProcessInstanceFinished(processEngineServices, pID); + Object responseData = processEngineServices.getHistoryService() + .createHistoricVariableInstanceQuery().processInstanceId(pID) + .variableName(name) + .singleResult() + .getValue(); + return (T) responseData; + } + + + public static void assertProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) { + assertEquals(1, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count()); + } + + public static void assertProcessInstanceNotFinished(ProcessEngineServices processEngineServices, String processDefinitionID) { + String pID = getProcessInstanceId(processEngineServices, + processDefinitionID); + assertEquals(0, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count()); + } + + private static String getProcessInstanceId( + ProcessEngineServices processEngineServices, String processDefinitionID) { + List historyList = processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list(); + String pID = null; + for (HistoricProcessInstance hInstance: historyList) { + if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) { + pID = hInstance.getId(); + break; + } + } + return pID; + } + + public static boolean isProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) { + return processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count() == 1 ? true: false; + } + + + private static void buildVariable(String key, String value, Map variableValueType) { + Map host = new HashMap(); + host.put("value", value); + host.put("type", "String"); + variableValueType.put(key, host); + } + + public static WorkflowResponse executeWorkFlow(ProcessEngineServices processEngineServices, String processKey, Map variables) { + WorkflowResource workflowResource = new WorkflowResource(); + VariableMapImpl variableMap = new VariableMapImpl(); + + Map variableValueType = new HashMap(); + for (String key : variables.keySet()) { + buildVariable(key, variables.get(key), variableValueType); + } + buildVariable("mso-service-request-timeout","600", variableValueType); + variableMap.put("variables", variableValueType); + + workflowResource.setProcessEngineServices4junit(processEngineServices); + Response response = workflowResource.startProcessInstanceByKey( + processKey, variableMap); + WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity(); + return workflowResponse; + } + + //Check the runtime service to see whether the process is completed + public static void waitForWorkflowToFinish(ProcessEngineServices processEngineServices, String pid) throws InterruptedException { + // Don't wait forever + long waitTime = 120000; + long endTime = System.currentTimeMillis() + waitTime; + + while (true) { + if (processEngineServices.getRuntimeService().createProcessInstanceQuery().processInstanceId(pid).singleResult() == null) { + break; + } + + if (System.currentTimeMillis() >= endTime) { + fail("Process " + pid + " did not finish in " + waitTime + "ms"); + } + + Thread.sleep(200); + } + } + + /** + * Executes the Asynchronous workflow in synchronous fashion and returns the WorkflowResponse object + * @param processEngineServices + * @param processKey + * @param variables + * @return + * @throws InterruptedException + */ + public static WorkflowResponse executeAsyncWorkflow(ProcessEngineServices processEngineServices, String processKey, Map variables) throws InterruptedException { + ProcessThread pthread = new ProcessThread(processKey, processEngineServices, variables); + pthread.start(); + BPMNUtil.assertProcessInstanceNotFinished(processEngineServices, processKey); + String pid = getProcessInstanceId(processEngineServices, processKey); + //Caution: If there is a problem with workflow, this may wait for ever + while (true) { + pid = getProcessInstanceId(processEngineServices, processKey); + if (!isProcessInstanceFinished(processEngineServices,pid)) { + Thread.sleep(200); + } else{ + break; + } + } + //need to retrieve for second time ? + pid = getProcessInstanceId(processEngineServices, processKey); + waitForWorkflowToFinish(processEngineServices, pid); + return pthread.workflowResponse; + } + + /** + * Execute workflow using async resource + * @param processEngineServices + * @param processKey + * @param asyncResponse + * @param variables + */ + private static void executeAsyncFlow(ProcessEngineServices processEngineServices, String processKey, AsynchronousResponse asyncResponse, Map variables) { + WorkflowAsyncCommonResource workflowResource = new WorkflowAsyncCommonResource(); + VariableMapImpl variableMap = new VariableMapImpl(); + + Map variableValueType = new HashMap(); + for (String key : variables.keySet()) { + buildVariable(key, variables.get(key), variableValueType); + } + buildVariable("mso-service-request-timeout","600", variableValueType); + variableMap.put("variables", variableValueType); + + workflowResource.setProcessEngineServices4junit(processEngineServices); + workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMap); + } + + /** + * Helper class which executes workflow in a thread + * + */ + static class ProcessThread extends Thread { + + public WorkflowResponse workflowResponse = null; + public String processKey; + public AsynchronousResponse asyncResponse = spy(AsynchronousResponse.class); + public boolean started; + public ProcessEngineServices processEngineServices; + public Map variables; + + public ProcessThread(String processKey, ProcessEngineServices processEngineServices, Map variables) { + this.processKey = processKey; + this.processEngineServices = processEngineServices; + this.variables = variables; + } + + public void run() { + started = true; + doAnswer(new Answer() { + public Void answer(InvocationOnMock invocation) { + Response response = (Response) invocation.getArguments()[0]; + workflowResponse = (WorkflowResponse) response.getEntity(); + return null; + } + }).when(asyncResponse).setResponse(any(Response.class)); + executeAsyncFlow(processEngineServices, processKey, asyncResponse, variables); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java new file mode 100644 index 0000000000..5cd59f38dd --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CompleteMsoProcessTest.java @@ -0,0 +1,207 @@ +/*- + * ============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.common; + +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 java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +/** + * Unit test for CompleteMsoProcess.bpmn. + */ +public class CompleteMsoProcessTest extends WorkflowTest { + + private void executeFlow(String inputRequestFile) throws InterruptedException { + mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml"); + + //String changeFeatureActivateRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/ChangeFeatureActivateV1/" + inputRequestFile); + Map variables = new HashMap(); + variables.put("CompleteMsoProcessRequest",inputRequestFile); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "CompleteMsoProcess", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + logEnd(); + } + + @Test + @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn"}) + public void msoCompletionRequestWithNotificationurl_200() throws Exception { + logStart(); + + //Execute Flow + executeFlow(gMsoCompletionRequestWithNotificationurl()); + + //Verify Error + String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode"); + Assert.assertEquals("200", CMSO_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator")); + logEnd(); + } + + @Test + @Ignore // BROKEN TEST + @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn"}) + public void msoCompletionRequestWithNotificationurl_500() throws Exception { + logStart(); + + //Execute Flow + executeFlow(gMsoCompletionRequestWithNotificationurl()); + + //Verify Error + String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode"); + Assert.assertEquals("500", CMSO_ResponseCode); + Assert.assertFalse((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator")); + logEnd(); + } + + @Test + @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn"}) + public void msoCompletionRequestWithNoNotificationurl() throws Exception { + logStart(); + + //Execute Flow + executeFlow(gMsoCompletionRequestWithNoNotificationurl()); + + //Verify Error + String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode"); + Assert.assertEquals("200", CMSO_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator")); + logEnd(); + } + + @Test + @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn"}) + public void msoCompletionRequestWithNotificationurlNoRequestId() throws Exception { + logStart(); + + //Execute Flow + executeFlow(gMsoCompletionRequestWithNotificationurlNoRequestId()); + + //Verify Error + String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode"); + Assert.assertEquals("200", CMSO_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator")); + logEnd(); + } + + @Test + @Deployment(resources = {"subprocess/CompleteMsoProcess.bpmn"}) + public void msoCompletionRequestWithNoNotificationurlNoRequestId() throws Exception { + logStart(); + + //Execute Flow + executeFlow(gMsoCompletionRequestWithNoNotificationurlNoRequestId()); + + //Verify Error + String CMSO_ResponseCode = BPMNUtil.getVariable(processEngineRule, "CompleteMsoProcess", "CMSO_ResponseCode"); + Assert.assertEquals("200", CMSO_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "CompleteMsoProcess", "CMSO_SuccessIndicator")); + logEnd(); + } + + public String gMsoCompletionRequestWithNotificationurl() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " uCPE1020_STUW105_5002" + + " Layer3ServiceActivateRequest" + + " COMPLETE" + + " OMX" + + " https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl" + + " 10205000" + + " 1" + + " " + + " UCPELayer3ServiceActivateV1" + + ""; + + return xml; + } + + + + public String gMsoCompletionRequestWithNoNotificationurl() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " uCPE1020_STUW105_5002" + + " Layer3ServiceActivateRequest" + + " COMPLETE" + + " OMX" + + " " + + " 10205000" + + " 1" + + " " + + " UCPELayer3ServiceActivateV1" + + ""; + + return xml; + } + + public String gMsoCompletionRequestWithNoNotificationurlNoRequestId() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " " + + " Layer3ServiceActivateRequest" + + " COMPLETE" + + " OMX" + + " " + + " 10205000" + + " 1" + + " " + + " UCPELayer3ServiceActivateV1" + + ""; + + return xml; + } + + public String gMsoCompletionRequestWithNotificationurlNoRequestId() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " " + + " Layer3ServiceActivateRequest" + + " COMPLETE" + + " OMX" + + " https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl" + + " 10205000" + + " 1" + + " " + + " UCPELayer3ServiceActivateV1" + + ""; + + return xml; + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java new file mode 100644 index 0000000000..5b10b8b89e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupNameTest.java @@ -0,0 +1,133 @@ +/*- + * ============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.common; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; + +/** + * Unit test cases for ConfirmVolumeGroupName.bpmn + */ +public class ConfirmVolumeGroupNameTest extends WorkflowTest { + /** + * Sunny day scenario. + * + * @throws Exception + */ + @Test + @Deployment(resources = { + "subprocess/ConfirmVolumeGroupName.bpmn" + }) + public void sunnyDay() throws Exception { + + logStart(); + MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml"); + + System.out.println("Before starting process"); + + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1"); + variables.put("ConfirmVolumeGroupName_volumeGroupName", "VOLUME_GROUP_ID_1_NAME"); + variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21"); + System.out.println("after setting variables"); + runtimeService.startProcessInstanceByKey("ConfirmVolumeGroupName", variables); + String response = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponse"); + String responseCode = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode"); + + assertEquals("200", responseCode); + System.out.println(response); + logEnd(); + } + + /** + * Rainy day scenario - nonexisting volume group id. + * + * @throws Exception + */ + @Test + @Deployment(resources = { + "subprocess/ConfirmVolumeGroupName.bpmn" + }) + public void rainyDayNoVolumeGroupId() throws Exception { + + logStart(); + MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml"); + + System.out.println("Before starting process"); + + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST"); + variables.put("ConfirmVolumeGroupName_volumeGroupName", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); + System.out.println("after setting variables"); + runtimeService.startProcessInstanceByKey("ConfirmVolumeGroupName", variables); + String response = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponse"); + String responseCode = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode"); + + assertEquals("404", responseCode); + System.out.println(response); + + logEnd(); + } + + /** + * Rainy day scenario - volume group name does not match the name in AAI + * + * + * @throws Exception + */ + @Test + @Deployment(resources = { + "subprocess/ConfirmVolumeGroupName.bpmn" + }) + public void rainyDayNameDoesNotMatch() throws Exception { + + logStart(); + MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml"); + + System.out.println("Before starting process"); + + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1"); + variables.put("ConfirmVolumeGroupName_volumeGroupName", "BAD_VOLUME_GROUP_NAME"); + System.out.println("after setting variables"); + runtimeService.startProcessInstanceByKey("ConfirmVolumeGroupName", variables); + String response = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponse"); + String responseCode = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode"); + + assertEquals("404", responseCode); + System.out.println(response); + + logEnd(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java new file mode 100644 index 0000000000..e62742da30 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/ConfirmVolumeGroupTenantTest.java @@ -0,0 +1,91 @@ +/* + * © 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.common; + +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.MockGetVolumeGroupById; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +/** + * Please describe the ConfirmVolumeGroupTenantTest.java class + * + */ +public class ConfirmVolumeGroupTenantTest extends WorkflowTest { + + @Test + @Deployment(resources = {"subprocess/ConfirmVolumeGroupTenant.bpmn"}) + public void testRemoveLayer3Service_success() throws Exception{ + MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume.xml"); + + Map variables = new HashMap(); + setVariables(variables); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "ConfirmVolumeGroupTenant", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String actualNameMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "groupNamesMatch"); + String actualIdMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "tenantIdsMatch"); + String actualResponse = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "volumeHeatStackId"); + + assertEquals("Response", "true", actualNameMatch); + assertEquals("Response", "true", actualIdMatch); + assertEquals("Response", "MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845", actualResponse); + } + + @Test + @Deployment(resources = {"subprocess/ConfirmVolumeGroupTenant.bpmn"}) + public void testRemoveLayer3Service_idsNotMatch() throws Exception{ + MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml"); + + Map variables = new HashMap(); + setVariables(variables); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "ConfirmVolumeGroupTenant", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String actualNameMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "groupNamesMatch"); + String actualIdMatch = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "tenantIdsMatch"); + String actualResponse = BPMNUtil.getVariable(processEngineRule, "ConfirmVolumeGroupTenant", "WorkflowException"); + + assertEquals("Response", "true", actualNameMatch); + assertEquals("Response", "false", actualIdMatch); + assertEquals("Response", "WorkflowException[processKey=ConfirmVolumeGroupTenant,errorCode=1,errorMessage=Volume Group a8399879-31b3-4973-be26-0a0cbe776b58 does not belong to your tenant]", actualResponse); + + } + + private void setVariables(Map variables) { + variables.put("isDebugLogEnabled", "true"); + variables.put("volumeGroupId","a8399879-31b3-4973-be26-0a0cbe776b58"); + variables.put("tenantId", "7dd5365547234ee8937416c65507d266"); + variables.put("aicCloudRegion", "MDTWNJ21"); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java new file mode 100644 index 0000000000..b41d2d2558 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleTest.java @@ -0,0 +1,277 @@ +/*- + * ============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.common; + +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.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static org.openecomp.mso.bpmn.common.DeleteAAIVfModuleTest.MockAAIGenericVnfSearch; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.core.WorkflowException; + +/** + * Unit test for CreateAAIVfModule.bpmn. + */ +public class CreateAAIVfModuleTest extends WorkflowTest { + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestCreateGenericVnfSuccess_200() { + + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfName", "STMTN5MMSC22"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC22-MMSC::module-0-0"); + variables.put("vfModuleModelName", "MMSC::module-0"); + + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + String response = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode"); + String responseCode = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode"); + Assert.assertEquals("201", responseCode); + System.out.println(response); + } + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestCreateVfModuleSuccess_200() { + // create Add-on VF Module for existing Generic VNF + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-1-0"); + variables.put("vfModuleModelName", "STMTN5MMSC21-MMSC::model-1-0"); + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + String response = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode"); + String responseCode = BPMNUtil.getVariable(processEngineRule, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode"); + Assert.assertEquals("201", responseCode); + System.out.println(response); + } + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestQueryGenericVnfFailure_5000() { + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfName", "STMTN5MMSC23"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC23-MMSC::module-0-0"); + variables.put("vfModuleModelName", "MMSC::module-0"); + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestCreateDupGenericVnfFailure_1002() { + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfName", "STMTN5MMSC21"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0"); + variables.put("vfModuleModelName", "MMSC::module-0"); + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("Invalid request for new Generic VNF which already exists")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestCreateDupVfModuleFailure_1002() { + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfId", "2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC20-MMSC::module-1-0"); + variables.put("vfModuleModelName", "STMTN5MMSC20-MMSC::model-1-0"); + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("already exists for Generic VNF")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestCreateGenericVnfFailure_5000() { + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfName", "STMTN5MMSC22"); + variables.put("serviceId", "99999999-9999-9999-9999-999999999999"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0"); + variables.put("vfModuleModelName", "PCRF::module-0"); + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestCreateGenericVnfFailure_1002() { + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfId", "768073c7-f41f-4822-9323-b75962763d74"); + variables.put("serviceId", "00000000-0000-0000-0000-000000000000"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0"); + variables.put("vfModuleModelName", "PCRF::module-0"); + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModule.bpmn" + }) + public void TestCreateVfModuleFailure_5000() { + MockAAIGenericVnfSearch(); + MockAAICreateGenericVnf(); + MockAAIVfModulePUT(true); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("isVidRequest", "false"); + variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721"); + variables.put("serviceId", "99999999-9999-9999-9999-999999999999"); + variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73"); + variables.put("personaModelVersion", "1.0"); + variables.put("vfModuleName", "STMTN5MMSC21-PCRF::module-1-0"); + variables.put("vfModuleModelName", "STMTN5MMSC21-PCRF::model-1-0"); + runtimeService.startProcessInstanceByKey("CreateAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "CreateAAIVfModule", "WorkflowException"); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + System.out.println(exception.getErrorMessage()); + } + + public static void MockAAICreateGenericVnf(){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + .withRequestBody(containing("00000000-0000-0000-0000-000000000000")) + .willReturn(aResponse() + .withStatus(201))); + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*")) + .withRequestBody(containing("99999999-9999-9999-9999-999999999999")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("aaiFault.xml"))); + } + + // 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))); + } + +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java new file mode 100644 index 0000000000..f1a2d7b4e2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/CreateAAIVfModuleVolumeGroupTest.java @@ -0,0 +1,136 @@ +/*- + * ============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.common; + +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVfModuleId; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse; + +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.mock.FileUtil; + +/** + * Unit tests for CreateAAIVfModuleVolumeGroup.bpmn. + */ +public class CreateAAIVfModuleVolumeGroupTest extends WorkflowTest { + + /** + * Test the happy path through the flow. + */ + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModuleVolumeGroup.bpmn" + }) + public void happyPath() throws IOException { + + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml"); + MockGetGenericVnfByIdWithPriority("skask", "lukewarm", 200, "VfModularity/VfModule-lukewarm.xml", 2); + MockPutVfModuleIdNoResponse("skask", "PCRF", "lukewarm"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest); + invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(200, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the case where the GET to AAI returns a 404. + */ + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModuleVolumeGroup.bpmn" + }) + public void badGet() throws IOException { + + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml"); + MockGetVfModuleId("skask", ".*", "VfModularity/VfModule-supercool.xml", 404); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest); + invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404. + */ + @Test + @Deployment(resources = { + "subprocess/CreateAAIVfModuleVolumeGroup.bpmn" + }) + public void badPut() throws IOException { + + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml"); + MockGetVfModuleId("skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest); + invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java new file mode 100644 index 0000000000..0136b675dd --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/DeleteAAIVfModuleTest.java @@ -0,0 +1,643 @@ +/*- + * ============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.common; + +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.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.core.WorkflowException; + +/** + * Unit test for DeleteAAIVfModule.bpmn. + */ +public class DeleteAAIVfModuleTest extends WorkflowTest { + private static final String EOL = "\n"; + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestDeleteGenericVnfSuccess_200() { + // delete the Base Module and Generic Vnf + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73 + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest"," DELETE_VF_MODULE PORTAL a27ce5a9-29c4-4c22-a017-6615ac73c721 STMTN5MMSC21 973ed047-d251-4fb9-bf1a-65b8949e0a73 STMTN5MMSC21-MMSC::module-0-0 "); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + String response = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode"); + String responseCode = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode"); + Assert.assertEquals("200", responseCode); + System.out.println(response); + } + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestDeleteVfModuleSuccess_200() { + // delete Add-on Vf Module for existing Generic Vnf + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a75 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c720" + EOL + + " STMTN5MMSC20" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a75" + EOL + + " STMTN5MMSC20-MMSC::module-1-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest",request); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + String response = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode"); + String responseCode = BPMNUtil.getVariable(processEngineRule, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode"); + Assert.assertEquals("200", responseCode); + System.out.println(response); + } + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestQueryGenericVnfFailure_5000() { + // query Generic Vnf failure (non-404) with A&AI + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c723, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a71 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c723" + EOL + + " STMTN5MMSC23" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a71" + EOL + + " STMTN5MMSC20-MMSC::module-1-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest",request); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestQueryGenericVnfFailure_1002() { + // attempt to delete Vf Module for Generic Vnf that does not exist (A&AI returns 404) + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c722, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a72 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c722" + EOL + + " STMTN5MMSC22" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a72" + EOL + + " STMTN5MMSC22-MMSC::module-1-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest",request); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestDeleteGenericVnfFailure_5000() { + // A&AI failure (non-200) when attempting to delete a Generic Vnf + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c718, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a78 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c718" + EOL + + " STMTN5MMSC18" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a78" + EOL + + " STMTN5MMSC18-MMSC::module-0-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest",request); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestDeleteVfModuleFailure_5000() { + // A&AI failure (non-200) when attempting to delete a Vf Module + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c719, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a77 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c719" + EOL + + " STMTN5MMSC19" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a77" + EOL + + " STMTN5MMSC19-MMSC::module-1-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest",request); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); + Assert.assertEquals(5000, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("SVC3002")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestDeleteVfModuleFailure_1002_1() { + // failure attempting to delete Base Module when not the last Vf Module + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a74 + String request = + "" + EOL + + " " + EOL + + " DELETE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c720" + EOL + + " STMTN5MMSC20" + EOL + + " 973ed047-d251-4fb9-bf1a-65b8949e0a74" + EOL + + " STMTN5MMSC20-MMSC::module-0-0" + EOL + + " " + EOL + + " " + EOL + + "" + EOL; + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest",request); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("is Base Module, not Last Module")); + System.out.println(exception.getErrorMessage()); + } + + @Test + @Deployment(resources = { + "subprocess/DeleteAAIVfModule.bpmn" + }) + public void TestDeleteVfModuleFailure_1002_2() { + // failure attempting to delete a Vf Module that does not exist (A&AI returns 404) + // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a76 + MockAAIGenericVnfSearch(); + MockAAIDeleteGenericVnf(); + MockAAIDeleteVfModule(); + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + Map variables = new HashMap(); + variables.put("isDebugLogEnabled","true"); + variables.put("DeleteAAIVfModuleRequest"," DELETE_VF_MODULE PORTAL a27ce5a9-29c4-4c22-a017-6615ac73c720 STMTN5MMSC20 973ed047-d251-4fb9-bf1a-65b8949e0a76 STMTN5MMSC20-MMSC::module-2-0 "); + runtimeService.startProcessInstanceByKey("DeleteAAIVfModule", variables); + WorkflowException exception = BPMNUtil.getRawVariable(processEngineRule, "DeleteAAIVfModule", "WorkflowException"); + Assert.assertEquals(1002, exception.getErrorCode()); + Assert.assertEquals(true, exception.getErrorMessage().contains("does not exist for Generic Vnf Id")); + System.out.println(exception.getErrorMessage()); + } + + // Start of VF Modularization A&AI mocks + + public static void MockAAIGenericVnfSearch(){ + 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))); + } + public static void MockAAIDeleteGenericVnf(){ + 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"))); + } + + public static void MockAAIDeleteVfModule(){ + 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))); + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java new file mode 100644 index 0000000000..77320751ee --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/FalloutHandlerTest.java @@ -0,0 +1,226 @@ +/*- + * ============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.common; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static org.openecomp.mso.bpmn.common.BPMNUtil.executeWorkFlow; +import static org.openecomp.mso.bpmn.common.BPMNUtil.waitForWorkflowToFinish; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +/** + * Unit test for FalloutHandler.bpmn. + */ +public class FalloutHandlerTest extends WorkflowTest { + private void setupMocks() { + stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody("Notified"))); + } + + private void executeFlow(String inputRequestFile) throws InterruptedException { + String method = getClass().getSimpleName() + "." + new Object() { + }.getClass().getEnclosingMethod().getName(); + System.out.println("STARTED TEST: " + method); + + //String changeFeatureActivateRequest = FileUtil.readResourceFile("__files/SDN-ETHERNET-INTERNET/ChangeFeatureActivateV1/" + inputRequestFile); + Map variables = new HashMap(); + variables.put("FalloutHandlerRequest",inputRequestFile); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "FalloutHandler", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + System.out.println("ENDED TEST: " + method); + } + + @Test + @Deployment(resources = {"subprocess/FalloutHandler.bpmn"}) + public void msoFalloutHandlerWithNotificationurl_200() throws Exception{ + String method = getClass().getSimpleName() + "." + new Object() { + }.getClass().getEnclosingMethod().getName(); + System.out.println("STARTED TEST: " + method); + + //Setup Mocks + setupMocks(); + //Execute Flow + executeFlow(gMsoFalloutHandlerWithNotificationurl()); + //Verify Error + String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode"); + Assert.assertEquals("200", FH_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator")); + } + + public String gMsoFalloutHandlerWithNotificationurl() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " uCPE1020_STUW105_5002" + + " Layer3ServiceActivateRequest" + + " CANCEL" + + " OMX" + + " http://localhost:28090/CCD/StatusNotification" + + " 10205000" + + " 1" + + " " + + " " + + " Some Error Message - Fallout Handler" + + " Some Error Code - Fallout Handler" + + " Some Source System Error Code- Fallout Handler" + + " " + + ""; + + return xml; + + } + + + + + @Test + @Deployment(resources = {"subprocess/FalloutHandler.bpmn"}) + public void msoFalloutHandlerWithNoNotificationurl() throws Exception{ + String method = getClass().getSimpleName() + "." + new Object() { + }.getClass().getEnclosingMethod().getName(); + System.out.println("STARTED TEST: " + method); + //Setup Mocks + setupMocks(); + //Execute Flow + executeFlow(gMsoFalloutHandlerWithNoNotificationurl()); + //Verify Error + String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode"); + Assert.assertEquals("200", FH_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator")); + } + + public String gMsoFalloutHandlerWithNoNotificationurl() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " uCPE1020_STUW105_5002" + + " Layer3ServiceActivateRequest" + + " CANCEL" + + " OMX" + + " " + + " 10205000" + + " 1" + + " " + + " " + + " Some Error Message - Fallout Handler" + + " Some Error Code - Fallout Handler" + + " Some Source System Error Code- Fallout Handler" + + " " + + ""; + + return xml; + } + + @Test + @Deployment(resources = {"subprocess/FalloutHandler.bpmn"}) + public void msoFalloutHandlerWithNotificationurlNoRequestId() throws Exception{ + String method = getClass().getSimpleName() + "." + new Object() { + }.getClass().getEnclosingMethod().getName(); + System.out.println("STARTED TEST: " + method); + //Setup Mocks + setupMocks(); + //Execute Flow + executeFlow(gMsoFalloutHandlerWithNotificationurlNoRequestId()); + //Verify Error + String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode"); + Assert.assertEquals("200", FH_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator")); + } + + public String gMsoFalloutHandlerWithNotificationurlNoRequestId() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " " + + " Layer3ServiceActivateRequest" + + " CANCEL" + + " OMX" + + " www.att.com" + + " 10205000" + + " 1" + + " " + + " " + + " Some Error Message - Fallout Handler" + + " Some Error Code - Fallout Handler" + + " Some Source System Error Code- Fallout Handler" + + " " + + ""; + + return xml; + } + + @Test + @Deployment(resources = {"subprocess/FalloutHandler.bpmn"}) + public void msoFalloutHandlerWithNoNotificationurlNoRequestId() throws Exception{ + String method = getClass().getSimpleName() + "." + new Object() { + }.getClass().getEnclosingMethod().getName(); + System.out.println("STARTED TEST: " + method); + //Setup Mocks + setupMocks(); + //Execute Flow + executeFlow(gMsoFalloutHandlerWithNoNotificationurlNoRequestId()); + //Verify Error + String FH_ResponseCode = BPMNUtil.getVariable(processEngineRule, "FalloutHandler", "FH_ResponseCode"); + Assert.assertEquals("200", FH_ResponseCode); + Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngineRule, "FalloutHandler", "FH_SuccessIndicator")); + } + + public String gMsoFalloutHandlerWithNoNotificationurlNoRequestId() { + //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS + String xml = "" + + "" + + " " + + " " + + " Layer3ServiceActivateRequest" + + " CANCEL" + + " OMX" + + " " + + " 10205000" + + " 1" + + " " + + " " + + " Some Error Message - Fallout Handler" + + " Some Error Code - Fallout Handler" + + " Some Source System Error Code- Fallout Handler" + + " " + + ""; + + return xml; + } + +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java new file mode 100644 index 0000000000..e83a644914 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteServiceTest.java @@ -0,0 +1,279 @@ +/* + * © 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.common; + +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.MockDeleteServiceInstance; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceSubscription; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + + + +/** + * Please describe the GenericDeleteServiceTest.java class + * + */ +public class GenericDeleteServiceTest extends WorkflowTest { + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_success_serviceInstance() throws Exception{ + MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "1234"); + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234"); + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + assertEquals("true", foundIndicator); + assertEquals("true", successIndicator); + assertEquals("true", resourceVersionProvidedFlag); + assertEquals(null, workflowException); + } + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_success_serviceSubscription() throws Exception{ + + MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", 204); + + Map variables = new HashMap(); + setVariablesSubscription(variables, "", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + assertEquals("true", foundIndicator); + assertEquals("true", successIndicator); + assertEquals("true", resourceVersionProvidedFlag); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_success_instanceNoResourceVersion() throws Exception { + MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceSubscription.xml"); + MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "1234"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + assertEquals("true", foundIndicator); + assertEquals("true", successIndicator); + assertEquals("false", resourceVersionProvidedFlag); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_success_subscriptionNoResourceVersion() throws Exception{ + MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml"); + MockDeleteServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", 204); + + Map variables = new HashMap(); + setVariablesSubscription(variables, null, "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + assertEquals("true", foundIndicator); + assertEquals("true", successIndicator); + assertEquals("false", resourceVersionProvidedFlag); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_success_get404Response() throws Exception{ + + MockGetServiceInstance_404("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + assertEquals("false", foundIndicator); + assertEquals("true", successIndicator); + assertEquals("false", resourceVersionProvidedFlag); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_success_subscriptionGetEmpty200() throws Exception{ + MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234", 200); + + Map variables = new HashMap(); + setVariablesSubscription(variables, "", "1604-MVM-26", "SDN-ETHERNET-INTERNET", ""); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + assertEquals("false", foundIndicator); + assertEquals("true", successIndicator); + assertEquals("false", resourceVersionProvidedFlag); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_success_delete404Response() throws Exception{ + + MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "GENDSI_getServiceInstanceResponse.xml"); + MockDeleteServiceInstance_404("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "1234"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "1234"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + assertEquals("false", foundIndicator); + assertEquals("true", successIndicator); + assertEquals("true", resourceVersionProvidedFlag); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_error_invalidVariables() throws Exception{ + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "1234"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + String expectedResponse = "WorkflowException[processKey=GenericDeleteService,errorCode=500,errorMessage=Incoming Required Variable is Missing or Null!]"; + + assertEquals("false", foundIndicator); + assertEquals("false", successIndicator); + assertEquals("true", resourceVersionProvidedFlag); + assertEquals(expectedResponse, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteService.bpmn"}) + public void testGenericDeleteService_error_getBadAAIResponse() throws Exception{ + + MockGetServiceInstance_500("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", "aaiFault.xml"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_SuccessIndicator"); + String foundIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_FoundIndicator"); + String resourceVersionProvidedFlag = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "GENDS_resourceVersionProvidedFlag"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteService", "WorkflowException"); + + String expectedResponse = "WorkflowException[processKey=GenericDeleteService,errorCode=500,errorMessage=SVC3002Error writing output performing %1 on %2 (msg=%3) (ec=%4)PUTcustomerSubName01Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id]ERR.5.4.5105" + "\n" + + "]"; + + assertEquals("false", foundIndicator); + assertEquals("false", successIndicator); + assertEquals("false", resourceVersionProvidedFlag); + assertEquals(expectedResponse, workflowException); + } + + + private void setVariablesInstance(Map variables, String siId, String globalCustId, String serviceType, String reVersion) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENDS_serviceInstanceId", siId); + variables.put("GENDS_globalCustomerId",globalCustId); + variables.put("GENDS_serviceType", serviceType); + variables.put("GENDS_resourceVersion", reVersion); + variables.put("GENDS_type", "service-instance"); + } + + private void setVariablesSubscription(Map variables, String siId, String globalCustId, String serviceType, String reVersion) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENDS_serviceInstanceId", siId); + variables.put("GENDS_globalCustomerId",globalCustId); + variables.put("GENDS_serviceType", serviceType); + variables.put("GENDS_resourceVersion", reVersion); + variables.put("GENDS_type", "service-subscription"); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java new file mode 100644 index 0000000000..dd3fd73afe --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericDeleteVnfTest.java @@ -0,0 +1,221 @@ +/* + * © 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.common; + +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.MockDeleteGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteGenericVnf_500; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockDeleteVce; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVceById; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +/** + * Please describe the GenericDeleteVnfTest.java class + * + */ +public class GenericDeleteVnfTest extends WorkflowTest { + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_success_genericVnf() throws Exception{ + MockDeleteGenericVnf("testVnfId123", "testReVer123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("true", "true", "true", null); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_success_vce() throws Exception{ + MockDeleteVce("testVnfId123", "testReVer123", 204); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "vce", "testReVer123"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("true", "true", "true", null); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_success_genericVnfNoResourceVersion() throws Exception{ + + MockGetGenericVnfById("/testVnfId123", "GenericFlows/getGenericVnfByNameResponse.xml", 200); + MockDeleteGenericVnf("testVnfId123", "testReVer123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "generic-vnf", ""); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("true", "true", "false", null); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_success_vceNoResourceVersion() throws Exception{ + MockDeleteVce("testVnfId123", "testReVer123", 204); + MockGetVceById("testVnfId123", "GenericFlows/getVceResponse.xml"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "vce", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("true", "true", "false", null); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_success_genericVnf404() throws Exception{ + MockDeleteGenericVnf("testVnfId123", "testReVer123", 404); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("true", "false", "true", null); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_success_vce404() throws Exception{ + MockDeleteVce("testVnfId123", "testReVer123", 404); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "vce", "testReVer123"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("true", "false", "true", null); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_success_genericVnfNoResourceVersion404() throws Exception{ + MockGetGenericVnfById_404("testVnfId123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "generic-vnf", ""); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("true", "false", "false", null); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_error_missingVariables() throws Exception{ + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "", "testReVer123"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=500,errorMessage=Incoming Required Variable is Missing or Null!]"); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_error_genericVnf500() throws Exception{ + + MockDeleteGenericVnf_500("testVnfId123", "testReVer123"); + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=500,errorMessage=Received a bad response from AAI]"); + + } + + @Test + @Deployment(resources = {"subprocess/GenericDeleteVnf.bpmn"}) + public void testGenericDeleteVnf_error_genericVnf412() throws Exception{ + MockDeleteGenericVnf("testVnfId123", "testReVer123", 412); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "generic-vnf", "testReVer123"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericDeleteVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + assertVariables("false", "false", "true", "WorkflowException[processKey=GenericDeleteVnf,errorCode=412,errorMessage=Delete Vnf Received a resource-version Mismatch Error Response from AAI]"); + + } + + private void assertVariables(String exSuccessIndicator, String exFound, String exRVProvided, String exWorkflowException) { + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "GENDV_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "GENDV_FoundIndicator"); + String rvProvided = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "GENDV_resourceVersionProvided"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericDeleteVnf", "WorkflowException"); + + assertEquals(exSuccessIndicator, successIndicator); + assertEquals(exFound, found); + assertEquals(exRVProvided, rvProvided); + assertEquals(exWorkflowException, workflowException); + } + + private void setVariables(Map variables, String vnfId, String type, String resourceVer) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENDV_vnfId", vnfId); + variables.put("GENDV_type", type); + variables.put("GENDV_resourceVersion", resourceVer); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java new file mode 100644 index 0000000000..2af42db574 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetServiceTest.java @@ -0,0 +1,505 @@ +/* + * © 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.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +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.MockGetServiceInstance; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetServiceSubscription; +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.MockNodeQueryServiceInstanceById_500; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_500; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + + +/** + * Unit Test for the GenericGetService Sub Flow + */ +public class GenericGetServiceTest extends WorkflowTest { + + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstance() throws Exception{ + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789"); + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertNotNull(response); + assertEquals(null, workflowException); + } + + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceSubscription() throws Exception{ + + MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml"); + + Map variables = new HashMap(); + setVariablesSubscription(variables, "", null , "1604-MVM-26", "SDN-ETHERNET-INTERNET"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertNotNull(response); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstance_byName() throws Exception{ + + MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByName.xml"); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + + Map variables = new HashMap(); + setVariablesInstance(variables, null, "1604-MVM-26", null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("true", obtainUrl); + assertEquals("true", byName); + assertNotNull(response); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstance_byId() throws Exception{ + + MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml"); + MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("true", obtainUrl); + assertEquals("false", byName); + assertNotNull(response); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstance_404Response() throws Exception{ + + MockGetServiceInstance_404("SDN-ETHERNET-INTERNET", "123456789", "MIS%2F1604%2F0026%2FSW_INTERNET"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceSubscription404() throws Exception{ + MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", 404); + + Map variables = new HashMap(); + setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", "1604-MVM-26"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertNotNull(response); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstanceByName404() throws Exception{ + + MockNodeQueryServiceInstanceByName_404("1604-MVM-26"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "", "1604-MVM-26", null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("true", byName); + assertEquals("404", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstanceById404() throws Exception{ + + MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("false", byName); + assertEquals("404", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstanceEmptyResponse() throws Exception{ + + MockGetServiceInstance("1604-MVM-26", "SDN-ETHERNET-INTERNET", "MIS%252F1604%252F0026%252FSW_INTERNET", " "); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstanceByNameEmpty() throws Exception{ + MockNodeQueryServiceInstanceByName("1604-MVM-26", ""); + + Map variables = new HashMap(); + setVariablesInstance(variables, "", "1604-MVM-26", null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("true", byName); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceInstanceByIdEmpty() throws Exception{ + + MockNodeQueryServiceInstanceById("MIS[%]2F1604[%]2F0026[%]2FSW_INTERNET", ""); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + assertEquals("true", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("false", byName); + assertEquals("200", siUrlResponseCode); + assertEquals(null, workflowException); + } + + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_error_serviceInstanceInvalidVariables() throws Exception{ + + Map variables = new HashMap(); + setVariablesInstance(variables, null, null, "SDN-ETHERNET-INTERNET", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.]"; + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertEquals(expectedWorkflowException, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_success_serviceSubscriptionInvalidVariables() throws Exception{ + + Map variables = new HashMap(); + setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.]"; + + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertEquals(expectedWorkflowException, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_error_serviceInstance_getSIBadResponse() throws Exception{ + + MockGetServiceInstance_500("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "123456789"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]"; + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("false", obtainUrl); + assertEquals("false", byName); + assertEquals(expectedWorkflowException, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_error_serviceInstance_getUrlByIdBadResponse() throws Exception{ + + MockNodeQueryServiceInstanceById_500("MIS%2F1604%2F0026%2FSW_INTERNET"); + + Map variables = new HashMap(); + setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]"; + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("false", byName); + assertEquals("500", siUrlResponseCode); + assertEquals(expectedWorkflowException, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericGetService.bpmn"}) + public void testGenericGetService_error_serviceInstance_getUrlByNameBadResponse() throws Exception{ + + MockNodeQueryServiceInstanceByName_500("1604-MVM-26"); + + Map variables = new HashMap(); + setVariablesInstance(variables, null, "1604-MVM-26", null, null); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetService", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_FoundIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "WorkflowException"); + String obtainUrl = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrl"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName"); + String siUrlResponseCode = BPMNUtil.getVariable(processEngineRule, "GenericGetService", "GENGS_obtainSIUrlResponseCode"); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI]"; + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("true", obtainUrl); + assertEquals("true", byName); + assertEquals("500", siUrlResponseCode); + assertEquals(expectedWorkflowException, workflowException); + } + + + private void setVariablesInstance(Map variables, String siId, String siName, String globalCustId, String serviceType) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENGS_serviceInstanceId", siId); + variables.put("GENGS_serviceInstanceName", siName); + variables.put("GENGS_globalCustomerId",globalCustId); + variables.put("GENGS_serviceType", serviceType); + variables.put("GENGS_type", "service-instance"); + } + + private void setVariablesSubscription(Map variables, String siId, String siName, String globalCustId, String serviceType) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENGS_serviceInstanceId", siId); + variables.put("GENGS_serviceInstanceName", siName); + variables.put("GENGS_globalCustomerId",globalCustId); + variables.put("GENGS_serviceType", serviceType); + variables.put("GENGS_type", "service-subscription"); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java new file mode 100644 index 0000000000..80105bbb99 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericGetVnfTest.java @@ -0,0 +1,191 @@ +/* + * © 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.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +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.MockGetGenericVnfByIdWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_500; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByNameWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVceByNameWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetVceById; + +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.workflow.service.WorkflowResponse; + +/** + * Please describe the GenericGetVnfTest.java class + * + */ +public class GenericGetVnfTest extends WorkflowTest { + + @Test + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"}) + public void testGenericGetVnf_success_genericVnf() throws Exception{ + MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfByNameResponse.xml"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "testVnfName123", "generic-vnf"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); + String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("false", byName); + assertNotNull(response); + assertNotNull(vnf); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"}) + public void testGenericGetVnf_success_vce() throws Exception{ + MockGetVceById("testVnfId123[?]depth=1", "GenericFlows/getVceResponse.xml"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "testVnfName123", "vce"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); + String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("false", byName); + assertNotNull(response); + assertNotNull(vnf); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"}) + public void testGenericGetVnf_success_genericVnfByName() throws Exception{ + MockGetGenericVnfByNameWithDepth("testVnfName123", 1, "GenericFlows/getGenericVnfResponse.xml"); + + Map variables = new HashMap(); + setVariables(variables, "", "testVnfName123", "generic-vnf"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); + String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("true", byName); + assertNotNull(response); + assertNotNull(vnf); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"}) + public void testGenericGetVnf_success_vceByName() throws Exception{ + MockGetGenericVceByNameWithDepth("testVnfName123", 1, "GenericFlows/getVceByNameResponse.xml"); + + Map variables = new HashMap(); + setVariables(variables, null, "testVnfName123", "vce"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); + String vnf = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_vnf"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName"); + String response = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowResponse"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals("true", found); + assertEquals("true", byName); + assertNotNull(response); + assertNotNull(vnf); + assertEquals(null, workflowException); + + } + + @Test + @Ignore // BROKEN TEST (previously ignored) + @Deployment(resources = {"subprocess/GenericGetVnf.bpmn"}) + public void testGenericGetVnf_error_genericVnf500() throws Exception{ + + MockGetGenericVnfById_500("testVnfId123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", "testVnfName123", "generic-vnf"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericGetVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_SuccessIndicator"); + String found = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_FoundIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "WorkflowException"); + String byName = BPMNUtil.getVariable(processEngineRule, "GenericGetVnf", "GENGV_getVnfByName"); + + String expectedWorkflowException = "WorkflowException[processKey=GenericGetVnf,errorCode=500,errorMessage=Incoming VnfId and VnfName are null. VnfId or VnfName is required!]"; + + assertEquals("false", successIndicator); + assertEquals("false", found); + assertEquals("false", byName); + + assertEquals(expectedWorkflowException, workflowException); + } + + private void setVariables(Map variables, String vnfId, String vnfName, String type) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENGV_vnfId", vnfId); + variables.put("GENGV_vnfName",vnfName); + variables.put("GENGV_type", type); + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java new file mode 100644 index 0000000000..248cb978dc --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/GenericPutVnfTest.java @@ -0,0 +1,182 @@ +/* + * © 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.common; + +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.MockPutGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutVce; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +/** + * Please describe the GenericPutVnf.java class + * + */ +public class GenericPutVnfTest extends WorkflowTest { + + private String genericVnfPayload = "testId"; + private String vcePayload = "testId"; + + @Test + @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) + public void testGenericPutVnf_success_genericVnf() throws Exception{ + + MockPutGenericVnf("testVnfId123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) + public void testGenericPutVnf_success_vce() throws Exception{ + + MockPutVce("testVnfId123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", vcePayload, "vce"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); + + assertEquals("true", successIndicator); + assertEquals(null, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) + public void testGenericPutVnf_error_missingType() throws Exception{ + + MockPutGenericVnf("testVnfId123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", genericVnfPayload, ""); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); + + String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=500,errorMessage=Incoming Vnf Payload and/or Type is null. These Variables are required!]"; + + assertEquals("false", successIndicator); + assertEquals(expectedWFEX, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) + public void testGenericPutVnf_error_missingPayload() throws Exception{ + + MockPutGenericVnf("testVnfId123"); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", genericVnfPayload, ""); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); + + String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=500,errorMessage=Incoming Vnf Payload and/or Type is null. These Variables are required!]"; + + assertEquals("false", successIndicator); + assertEquals(expectedWFEX, workflowException); + + } + + @Test + @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) + public void testGenericPutVnf_error_404() throws Exception{ + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); + + String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=404,errorMessage=Received a bad response from AAI]"; + + assertEquals("false", successIndicator); + assertEquals(expectedWFEX, workflowException); + } + + @Test + @Deployment(resources = {"subprocess/GenericPutVnf.bpmn"}) + public void testGenericPutVnf_error_400() throws Exception{ + + MockPutGenericVnf("/testVnfId123", 400); + + Map variables = new HashMap(); + setVariables(variables, "testVnfId123", genericVnfPayload, "generic-vnf"); + + WorkflowResponse workflowResponse = executeWorkFlow(processEngineRule, "GenericPutVnf", variables); + waitForWorkflowToFinish(processEngineRule, workflowResponse.getProcessInstanceID()); + + String successIndicator = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "GENPV_SuccessIndicator"); + String workflowException = BPMNUtil.getVariable(processEngineRule, "GenericPutVnf", "WorkflowException"); + + String expectedWFEX = "WorkflowException[processKey=GenericPutVnf,errorCode=400,errorMessage=Received a bad response from AAI]"; + + assertEquals("false", successIndicator); + assertEquals(expectedWFEX, workflowException); + + + } + + private void setVariables(Map variables, String vnfId, String payload, String type) { + variables.put("isDebugLogEnabled", "true"); + variables.put("GENPV_vnfId", vnfId); + variables.put("GENPV_vnfPayload",payload); + variables.put("GENPV_type", type); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java new file mode 100644 index 0000000000..cb5f722a42 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/PrepareUpdateAAIVfModuleTest.java @@ -0,0 +1,208 @@ +/*- + * ============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.common; + +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; + +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.core.WorkflowException; +import org.openecomp.mso.bpmn.mock.FileUtil; + +/** + * Unit tests for PrepareUpdateAAIVfModule.bpmn. + */ +public class PrepareUpdateAAIVfModuleTest extends WorkflowTest { + + /** + * Test the happy path through the flow. + */ + @Test + @Deployment(resources = { + "subprocess/PrepareUpdateAAIVfModule.bpmn" + }) + public void happyPath() throws IOException { + + logStart(); + + String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); + invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(200, responseCode.intValue()); + String heatStackId = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_heatStackId"); + System.out.println("Ouput heat-stack-id:" + heatStackId); + Assert.assertEquals("slowburn", heatStackId); + + logEnd(); + } + + /** + * Test the case where the GET to AAI returns a 404. + */ + @Test + @Deployment(resources = { + "subprocess/PrepareUpdateAAIVfModule.bpmn" + }) + public void badGet() throws IOException { + + logStart(); + + String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); + MockGetGenericVnfById_404("skask[?]depth=1"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); + invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponseCode"); + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + Assert.assertNotNull(workflowException); + System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + + logEnd(); + } + + /** + * Test the case where the validation of the VF Module fails. + */ + @Test + @Deployment(resources = { + "subprocess/PrepareUpdateAAIVfModule.bpmn" + }) + public void failValidation1() throws IOException { + + logStart(); + + String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "lukewarm"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); + invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); + + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + Assert.assertNotNull(workflowException); + System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: Orchestration")); + + logEnd(); + } + + /** + * Test the case where the validation of the VF Module fails. + */ + @Test + @Deployment(resources = { + "subprocess/PrepareUpdateAAIVfModule.bpmn" + }) + public void failValidation2() throws IOException { + + logStart(); + + String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "notsocool"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); + invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); + + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + Assert.assertNotNull(workflowException); + System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: VF Module")); + + logEnd(); + } + + /** + * Test the case where the GET to AAI is successful, but the subsequent PUT returns 404. + */ + @Test + @Deployment(resources = { + "subprocess/PrepareUpdateAAIVfModule.bpmn" + }) + public void badPut() throws IOException { + + logStart(); + + String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest); + invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode"); + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + Assert.assertNotNull(workflowException); + System.out.println("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + + logEnd(); + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java new file mode 100644 index 0000000000..f3c3b84d18 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterCallbackRule.java @@ -0,0 +1,64 @@ +package org.openecomp.mso.bpmn.common; + +import javax.xml.ws.Endpoint; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; +import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl; + +/** + * A JUnit rule that starts the SDNC Adapter Callback Service before + * every test, and tears it down after every test. Example: + *
    + *     @Rule
    + *     public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
    + *         new SDNCAdapterCallbackRule(processEngineRule);
    + * 
    + */ +public class SDNCAdapterCallbackRule implements TestRule { + public static final String DEFAULT_ENDPOINT_URL = + "http://localhost:28080/mso/SDNCAdapterCallbackService"; + + private final ProcessEngineServices processEngineServices; + private final String endpointUrl; + + public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices) { + this(processEngineServices, DEFAULT_ENDPOINT_URL); + } + + public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices, + String endpointUrl) { + this.processEngineServices = processEngineServices; + this.endpointUrl = endpointUrl; + } + + @Override + public Statement apply(final Statement baseStmt, Description description) { + return new Statement() { + @Override + public void evaluate() throws Throwable { + Endpoint endpoint = null; + + try { + SDNCAdapterCallbackServiceImpl sdncCallbackService = new SDNCAdapterCallbackServiceImpl(); + sdncCallbackService.setProcessEngineServices4junit(processEngineServices); + + System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true"); + System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true"); + + System.out.println("Publishing Endpoint - " + endpointUrl); + endpoint = Endpoint.publish(endpointUrl, sdncCallbackService); + + baseStmt.evaluate(); + } finally { + if (endpoint != null) { + System.out.println("Stopping Endpoint - " + endpointUrl); + endpoint.stop(); + } + } + } + }; + } +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java new file mode 100644 index 0000000000..b0e1dc9afc --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SDNCAdapterV1Test.java @@ -0,0 +1,389 @@ +/*- + * ============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.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +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 javax.ws.rs.core.Response; + +import org.camunda.bpm.engine.MismatchingMessageCorrelationException; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.camunda.bpm.engine.runtime.Job; +import org.camunda.bpm.engine.test.Deployment; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.junit.Assert; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.adapter.sdnc.CallbackHeader; +import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest; +import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse; +import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl; +import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl.SDNCAdapterExceptionResponse; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; +import org.openecomp.mso.bpmn.mock.FileUtil; + +/** + * Unit test cases for SDNCAdapterV1.bpmn + */ +public class SDNCAdapterV1Test extends WorkflowTest { + + private String sdncAdapterWorkflowRequest; + private String sdncAdapterWorkflowRequestAct; + private String sdncAdapterCallbackRequestData; + private String sdncAdapterCallbackRequestDataNonfinal; + + public SDNCAdapterV1Test() throws IOException { + sdncAdapterWorkflowRequest = FileUtil.readResourceFile("sdncadapterworkflowrequest.xml"); + sdncAdapterWorkflowRequestAct = FileUtil.readResourceFile("sdncadapterworkflowrequest-act.xml"); + sdncAdapterCallbackRequestData = FileUtil.readResourceFile("sdncadaptercallbackrequestdata.text"); + sdncAdapterCallbackRequestDataNonfinal = FileUtil.readResourceFile("sdncadaptercallbackrequestdata-nonfinal.text"); + } + + /** + * End-to-End flow - Unit test for SDNCAdapterV1.bpmn + * - String input & String response + */ + + private WorkflowResponse invokeFlow(String workflowRequest) { + + MapvalueMap = new HashMap(); + valueMap.put("value", workflowRequest); + Map variables = new HashMap(); + variables.put("sdncAdapterWorkflowRequest", valueMap); + + Map valueMap2 = new HashMap(); + valueMap2.put("value", "true"); + variables.put("isDebugLogEnabled", valueMap2); + + VariableMapImpl varMap = new VariableMapImpl(); + varMap.put("variables", variables); + + //System.out.println("Invoking the flow"); + + WorkflowResource workflowResource = new WorkflowResource(); + workflowResource.setProcessEngineServices4junit(processEngineRule); + + Response response = workflowResource.startProcessInstanceByKey("sdncAdapter", varMap); + WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity(); + + //String pid = workflowResponse.getProcessInstanceID(); + //System.out.println("Back from executing process instance with pid=" + pid); + return workflowResponse; + } + + @Test + @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn"}) + public void sunnyDay() throws InterruptedException { + + mockSDNCAdapter(200); + + //System.out.println("SDNCAdapter sunny day flow Started!"); + + ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest); + thread.start(); + waitForExecutionToStart("sdncAdapter", 3); + String pid = getPid(); + + assertProcessInstanceNotFinished(pid); + + System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); + String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId"); + CallbackHeader callbackHeader = new CallbackHeader(); + callbackHeader.setRequestId(generatedRequestId); + callbackHeader.setResponseCode("200"); + callbackHeader.setResponseMessage("OK"); + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); + sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); + sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData); + SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); + callbackService.setProcessEngineServices4junit(processEngineRule); + SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); + //System.out.println("Back from executing process again"); + + assertFalse(sdncAdapterResponse instanceof SDNCAdapterExceptionResponse); + assertProcessInstanceFinished(pid); + + //System.out.println("SDNCAdapter sunny day flow Completed!"); + } + + @Test + @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn"}) + public void nonFinalWithTimeout() throws InterruptedException { + + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBAdapter.xml"); + + //System.out.println("SDNCAdapter interim status processing flow Started!"); + + ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequestAct); + thread.start(); + waitForExecutionToStart("sdncAdapter", 3); + String pid = getPid(); + + assertProcessInstanceNotFinished(pid); + + //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); + String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId"); + CallbackHeader callbackHeader = new CallbackHeader(); + callbackHeader.setRequestId(generatedRequestId); + callbackHeader.setResponseCode("200"); + callbackHeader.setResponseMessage("OK"); + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); + sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); + sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestDataNonfinal); + SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); + callbackService.setProcessEngineServices4junit(processEngineRule); + SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); + //System.out.println("Back from executing process again"); + + assertFalse(sdncAdapterResponse instanceof SDNCAdapterExceptionResponse); + assertProcessInstanceNotFinished(pid); + + checkForTimeout(pid); + + assertEquals(true, (Boolean) (getVariable(pid, "continueListening"))); + + + //System.out.println("SDNCAdapter interim status processing flow Completed!"); + } + + @Test + @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn"}) + public void nonFinalThenFinal() throws InterruptedException { + + mockSDNCAdapter(200); + mockUpdateRequestDB(200, "Database/DBAdapter.xml"); + + //System.out.println("SDNCAdapter non-final then final processing flow Started!"); + + // Start the flow + ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequestAct); + thread.start(); + waitForExecutionToStart("sdncAdapter", 3); + String pid = getPid(); + + assertProcessInstanceNotFinished(pid); + + // Inject a "non-final" SDNC Adapter asynchronous callback message + //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); + String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId"); + CallbackHeader callbackHeader = new CallbackHeader(); + callbackHeader.setRequestId(generatedRequestId); + callbackHeader.setResponseCode("200"); + callbackHeader.setResponseMessage("OK"); + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); + sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); + sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestDataNonfinal); + SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); + callbackService.setProcessEngineServices4junit(processEngineRule); + SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); + //System.out.println("Back from executing process again"); + + assertFalse(sdncAdapterResponse instanceof SDNCAdapterExceptionResponse); + assertProcessInstanceNotFinished(pid); + assertEquals(true, (Boolean) (getVariable(pid, "continueListening"))); + + // Inject a "final" SDNC Adapter asynchronous callback message + sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData); + sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); + //System.out.println("Back from executing process again"); + + assertFalse(sdncAdapterResponse instanceof SDNCAdapterExceptionResponse); + assertProcessInstanceFinished(pid); + assertEquals(false, (Boolean) (getVariable(pid, "continueListening"))); + + //System.out.println("SDNCAdapter non-final then final processing flow Completed!"); + } + + + + private void waitForExecutionToStart(String processDefintion, int count) throws InterruptedException { + //System.out.println(processEngineRule.getRuntimeService().createExecutionQuery().processDefinitionKey(processDefintion).count()); + while (processEngineRule.getRuntimeService().createExecutionQuery().processDefinitionKey(processDefintion).count() != count) { + Thread.sleep(200); + } + } + + @Test + @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn"}) + public void badCorrelationIdTest() throws InterruptedException { + + mockSDNCAdapter(200); + + //System.out.println("SDNCAdapter bad RequestId test Started!"); + + ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest); + thread.start(); + waitForExecutionToStart("sdncAdapter", 3); + String pid = getPid(); + assertProcessInstanceNotFinished(pid); + + //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); + String badRequestId = "This is not the RequestId that was used"; + CallbackHeader callbackHeader = new CallbackHeader(); + callbackHeader.setRequestId(badRequestId); + callbackHeader.setResponseCode("200"); + callbackHeader.setResponseMessage("OK"); + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); + sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); + sdncAdapterCallbackRequest.setRequestData(sdncAdapterCallbackRequestData); + SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); + callbackService.setProcessEngineServices4junit(processEngineRule); + SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); + //System.out.println("Back from executing process again"); + + assertTrue(sdncAdapterResponse instanceof SDNCAdapterExceptionResponse); + assertTrue(((SDNCAdapterExceptionResponse) sdncAdapterResponse).getException() instanceof MismatchingMessageCorrelationException); + assertProcessInstanceNotFinished(pid); + + //System.out.println("SDNCAdapter bad RequestId test Completed!"); + } + + @Test + @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn"}) + public void badSynchronousResponse() throws IOException, InterruptedException { + + mockSDNCAdapter(404); + + //System.out.println("SDNCAdapter bad synchronous response flow Started!"); + + ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest); + thread.start(); + while (thread.isAlive()) { + Thread.sleep(200); + } + WorkflowResponse response = thread.workflowResponse; + Assert.assertNotNull(response); + Assert.assertEquals("404 error", response.getMessageCode(),7000); +// assertProcessInstanceFinished(response.getProcessInstanceID()); + //System.out.println("SDNCAdapter bad synchronous response flow Completed!"); + } + + @Test + @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn"}) + public void sdncNotFound() throws IOException, InterruptedException { + mockSDNCAdapter(200); + mockSDNCAdapter("/sdncAdapterMock/404", 400, "sdncCallbackErrorResponse.xml"); + + ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest); + thread.start(); + waitForExecutionToStart("sdncAdapter", 3); + String pid = getPid(); + + //System.out.println("Injecting SDNC Adapter asynchronous callback message to continue processing"); + String generatedRequestId = (String) processEngineRule.getRuntimeService().getVariable(pid, "SDNCA_requestId"); + CallbackHeader callbackHeader = new CallbackHeader(); + callbackHeader.setRequestId(generatedRequestId); + callbackHeader.setResponseCode("404"); + callbackHeader.setResponseMessage("Error processing request to SDNC. Not Found. https://sdncodl.it.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET. SDNC Returned-[error-type:application, error-tag:data-missing, error-message:Request could not be completed because the relevant data model content does not exist.]"); + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); + sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); + SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); + callbackService.setProcessEngineServices4junit(processEngineRule); + SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); + //System.out.println("Back from executing process again"); + + assertProcessInstanceFinished(pid); + assertNotNull(sdncAdapterResponse); + //TODO query history to see SDNCA_ResponseCode, SDNCA_ErrorResponse + //System.out.println("SDNCAdapter SDNC Notfound test Completed!"); + } + + @Test + @Deployment(resources = {"subprocess/SDNCAdapterV1.bpmn"}) + public void asynchronousMessageTimeout() throws IOException, InterruptedException { + mockSDNCAdapter(200); + //System.out.println("SDNCAdapter asynchronous message timeout flow Started!"); + ProcessExecutionThread thread = new ProcessExecutionThread(sdncAdapterWorkflowRequest); + thread.start(); + waitForExecutionToStart("sdncAdapter", 3); + checkForTimeout(getPid()); + } + + private void checkForTimeout(String pid) throws InterruptedException { + + assertProcessInstanceNotFinished(pid); + + ProcessEngineConfigurationImpl processEngineConfiguration = + (ProcessEngineConfigurationImpl) processEngineRule.getProcessEngine().getProcessEngineConfiguration(); + assertTrue(processEngineConfiguration.getJobExecutor().isActive()); + + Job timerJob = processEngineRule.getManagementService().createJobQuery().processInstanceId(pid).singleResult(); + assertNotNull(timerJob); + + processEngineRule.getManagementService().executeJob(timerJob.getId()); + + assertProcessInstanceFinished(pid); + + //System.out.println("SDNCAdapter asynchronous message timeout flow Completed!"); + } + + class ProcessExecutionThread extends Thread { + + private String workflowRequest; + private WorkflowResponse workflowResponse; + + public ProcessExecutionThread(String workflowRequest) { + this.workflowRequest = workflowRequest; + } + + public void run() { + workflowResponse = invokeFlow(workflowRequest); + workflowResponse.getProcessInstanceID(); + } + } + + private String getPid() { + return processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().list().get(0).getId(); + } + + private Object getVariable(String pid, String variableName) { + try { + return + processEngineRule + .getHistoryService() + .createHistoricVariableInstanceQuery() + .processInstanceId(pid).variableName(variableName) + .singleResult() + .getValue(); + } catch(Exception ex) { + return null; + } + } + + private void assertProcessInstanceFinished(String pid) { + assertEquals(1, processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count()); + } + + private void assertProcessInstanceNotFinished(String pid) { + assertEquals(0, processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count()); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java new file mode 100644 index 0000000000..4ae76206cc --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIGenericVnfTest.java @@ -0,0 +1,171 @@ +/*- + * ============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.common; + +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf_Bad; + +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.core.WorkflowException; +import org.openecomp.mso.bpmn.mock.FileUtil; + +/** + * Unit tests for UpdateAAIGenericVnf bpmn. + */ +public class UpdateAAIGenericVnfTest extends WorkflowTest { + + /** + * Test the happy path through the flow. + */ + @Test + @Deployment(resources = { + "subprocess/UpdateAAIGenericVnf.bpmn" + }) + public void happyPath() throws IOException { + logStart(); + + String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockPutGenericVnf("/skask", 200); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); + invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(200, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the happy path through the flow. + */ + @Test + @Deployment(resources = { + "subprocess/UpdateAAIGenericVnf.bpmn" + }) + public void personaMismatch() throws IOException { + + logStart(); + + String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); + updateAAIGenericVnfRequest = updateAAIGenericVnfRequest.replaceFirst("introvert", "extrovert"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); + invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + System.out.println("Workflow Exception: " + workflowException); + Assert.assertNotNull(workflowException); + + logEnd(); + } + + /** + * Test the case where the GET to AAI returns a 404. + */ + @Test + @Deployment(resources = { + "subprocess/UpdateAAIGenericVnf.bpmn" + }) + public void badGet() throws IOException { + + logStart(); + + String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); + + MockGetGenericVnfById_404("skask[?]depth=1"); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); + invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404. + */ + @Test + @Deployment(resources = { + "subprocess/UpdateAAIGenericVnf.bpmn" + }) + public void badPut() throws IOException { + + logStart(); + + String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml"); + + MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml"); + MockPutGenericVnf_Bad("skask", 404); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest); + invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java new file mode 100644 index 0000000000..8691ae8e61 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/UpdateAAIVfModuleTest.java @@ -0,0 +1,137 @@ +/*- + * ============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.common; + +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404; +import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPutGenericVnf; + +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.mock.FileUtil; + +/** + * Unit tests for UpdateAAIVfModuleTest.bpmn. + */ +public class UpdateAAIVfModuleTest extends WorkflowTest { + + /** + * Test the happy path through the flow. + */ + @Test + @Deployment(resources = { + "subprocess/UpdateAAIVfModule.bpmn" + }) + public void happyPath() throws IOException { + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); + MockGetGenericVnfByIdWithPriority("/skask/vf-modules/vf-module/supercool", 200, "VfModularity/VfModule-supercool.xml"); + MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest); + invokeSubProcess("UpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(200, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the case where the GET to AAI returns a 404. + */ + @Test + @Deployment(resources = { + "subprocess/UpdateAAIVfModule.bpmn" + }) + public void badGet() throws IOException { + + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); + MockGetGenericVnfById("/skask/vf-modules/vf-module/.*", "VfModularity/VfModule-supercool.xml", 404); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest); + invokeSubProcess("UpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } + + /** + * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404. + */ + @Test + @Deployment(resources = { + "subprocess/UpdateAAIVfModule.bpmn" + }) + public void badPut() throws IOException { + + logStart(); + + String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml"); + MockGetGenericVnfById_404("/skask/vf-modules/vf-module/supercool"); + MockGetGenericVnfById("/skask/vf-modules/vf-module/supercool", "VfModularity/VfModule-supercool.xml", 200); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", "999-99-9999"); + variables.put("isDebugLogEnabled","true"); + variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest); + invokeSubProcess("UpdateAAIVfModule", businessKey, variables); + + Assert.assertTrue(isProcessEnded(businessKey)); + String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse"); + Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode"); + System.out.println("Subflow response code: " + responseCode); + System.out.println("Subflow response: " + response); + Assert.assertEquals(404, responseCode.intValue()); + + logEnd(); + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java new file mode 100644 index 0000000000..d2b0e274e9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java @@ -0,0 +1,389 @@ +/*- + * ============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.common; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPost; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFPut; +import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFRollbackDelete; + +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.core.WorkflowException; + +/** + * Unit tests for VnfAdapterRestV1. + */ +public class VnfAdapterRestV1Test extends WorkflowTest { + + private static final String EOL = "\n"; + + private final CallbackSet callbacks = new CallbackSet(); + + private final String CREATE_VF_MODULE_REQUEST = + "" + EOL + + " cloudSiteId" + EOL + + " tenantId" + EOL + + " vnfId" + EOL + + " vfModuleName" + EOL + + " vfModuleId" + EOL + + " vnfType" + EOL + + " vnfVersion" + EOL + + " vfModuleType" + EOL + + " volumeGroupId" + EOL + + " volumeGroupStackId" + EOL + + " baseVfModuleId" + EOL + + " baseVfModuleStackId" + EOL + + " true" + EOL + + " false" + EOL + + " true" + EOL + + " " + EOL + + " " + EOL + + " key1" + EOL + + " value1" + EOL + + " " + EOL + + " " + EOL + + " key2" + EOL + + " value2" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " requestId" + EOL + + " serviceInstanceId" + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + " http://localhost:28080/mso/WorkflowMessage" + EOL + + "" + EOL; + + private final String UPDATE_VF_MODULE_REQUEST = + "" + EOL + + " cloudSiteId" + EOL + + " tenantId" + EOL + + " vnfId" + EOL + + " vfModuleName" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " vnfType" + EOL + + " vnfVersion" + EOL + + " vfModuleType" + EOL + + " volumeGroupId" + EOL + + " volumeGroupStackId" + EOL + + " baseVfModuleId" + EOL + + " baseVfModuleStackId" + EOL + + " true" + EOL + + " false" + EOL + + " true" + EOL + + " " + EOL + + " " + EOL + + " key1" + EOL + + " value1" + EOL + + " " + EOL + + " " + EOL + + " key2" + EOL + + " value2" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " requestId" + EOL + + " serviceInstanceId" + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + " http://localhost:28080/mso/WorkflowMessage" + EOL + + "" + EOL; + + private final String DELETE_VF_MODULE_REQUEST = + "" + EOL + + " cloudSiteId" + EOL + + " tenantId" + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " true" + EOL + + " " + EOL + + " requestId" + EOL + + " serviceInstanceId" + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + " http://localhost:28080/mso/WorkflowMessage" + EOL + + "" + EOL; + + private final String ROLLBACK_VF_MODULE_REQUEST = + "" + EOL + + " {{MESSAGE-ID}}" + EOL + + " http://localhost:28080/mso/WorkflowMessage" + EOL + + " true" + EOL + + " " + EOL + + " cloudSiteId" + EOL + + " tenantId" + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " " + EOL + + " requestId" + EOL + + " serviceInstanceId" + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + " true" + EOL + + " " + EOL + + "" + EOL; + + public VnfAdapterRestV1Test() throws IOException { + callbacks.put("createVfModule", + "" + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " true" + EOL + + " " + EOL + + " " + EOL + + " key1" + EOL + + " value1" + EOL + + " " + EOL + + " " + EOL + + " key2" + EOL + + " value2" + EOL + + " " + EOL + + " " + EOL + + " " + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " true" + EOL + + " tenantId" + EOL + + " cloudSiteId" + EOL + + " " + EOL + + " requestId" + EOL + + " serviceInstanceId" + EOL + + " " + EOL + + " messageId" + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL); + + callbacks.put("updateVfModule", + "" + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " vfModuleStackId" + EOL + + " " + EOL + + " " + EOL + + " key1" + EOL + + " value1" + EOL + + " " + EOL + + " " + EOL + + " key2" + EOL + + " value2" + EOL + + " " + EOL + + " " + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL); + + callbacks.put("deleteVfModule", + "" + EOL + + " vnfId" + EOL + + " vfModuleId" + EOL + + " true" + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL); + + callbacks.put("rollbackVfModule", + "" + EOL + + " {{MESSAGE-ID}}" + EOL + + " true" + EOL + + "" + EOL); + + callbacks.put("vfModuleException", + "" + EOL + + " message" + EOL + + " category" + EOL + + " false" + EOL + + " {{MESSAGE-ID}}" + EOL + + "" + EOL); + } + + @Test + @Deployment(resources = { + "subprocess/VnfAdapterRestV1.bpmn" + }) + public void testCreateVfModuleSuccess() throws Exception { + logStart(); + + mockVNFPost("", 202, "vnfId"); + + String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; + String messageId = requestId + "-" + System.currentTimeMillis(); + String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", requestId); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfAdapterRestV1Request", request); + + invokeSubProcess("vnfAdapterRestV1", businessKey, variables); + injectVNFRestCallbacks(callbacks, "createVfModule"); + waitForProcessEnd(businessKey, 10000); + + String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); + System.out.println("Response:\n" + response); + assertTrue(response.contains("")); + assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); + + logEnd(); + } + + @Test + @Deployment(resources = { + "subprocess/VnfAdapterRestV1.bpmn" + }) + public void testUpdateVfModuleSuccess() throws Exception { + logStart(); + + mockVNFPut("/vfModuleId", 202); + + String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; + String messageId = requestId + "-" + System.currentTimeMillis(); + String request = UPDATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", requestId); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfAdapterRestV1Request", request); + + invokeSubProcess("vnfAdapterRestV1", businessKey, variables); + injectVNFRestCallbacks(callbacks, "updateVfModule"); + waitForProcessEnd(businessKey, 10000); + + String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); + System.out.println("Response:\n" + response); + assertTrue(response.contains("")); + assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); + + logEnd(); + } + + @Test + @Deployment(resources = { + "subprocess/VnfAdapterRestV1.bpmn" + }) + public void testDeleteVfModuleSuccess() throws Exception { + logStart(); + + mockVNFDelete("vnfId", "/vfModuleId", 202); + + String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; + String messageId = requestId + "-" + System.currentTimeMillis(); + String request = DELETE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", requestId); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfAdapterRestV1Request", request); + + invokeSubProcess("vnfAdapterRestV1", businessKey, variables); + injectVNFRestCallbacks(callbacks, "deleteVfModule"); + waitForProcessEnd(businessKey, 10000); + + String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); + System.out.println("Response:\n" + response); + assertTrue(response.contains("")); + assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); + + logEnd(); + } + + @Test + @Deployment(resources = { + "subprocess/VnfAdapterRestV1.bpmn" + }) + public void testRollbackVfModuleSuccess() throws Exception { + logStart(); + + mockVNFRollbackDelete("/vfModuleId", 202); + + String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; + String messageId = requestId + "-" + System.currentTimeMillis(); + String request = ROLLBACK_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", requestId); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfAdapterRestV1Request", request); + + invokeSubProcess("vnfAdapterRestV1", businessKey, variables); + injectVNFRestCallbacks(callbacks, "rollbackVfModule"); + waitForProcessEnd(businessKey, 10000); + + String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); + System.out.println("Response:\n" + response); + assertTrue(response.contains("")); + assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); + + logEnd(); + } + + @Test + @Deployment(resources = { + "subprocess/VnfAdapterRestV1.bpmn" + }) + public void testCreateVfModuleException() throws Exception { + logStart(); + + mockVNFPost("", 202, "vnfId"); + + String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312"; + String messageId = requestId + "-" + System.currentTimeMillis(); + String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId); + + String businessKey = UUID.randomUUID().toString(); + Map variables = new HashMap(); + variables.put("mso-request-id", requestId); + variables.put("isDebugLogEnabled", "true"); + variables.put("vnfAdapterRestV1Request", request); + + invokeSubProcess("vnfAdapterRestV1", businessKey, variables); + injectVNFRestCallbacks(callbacks, "vfModuleException"); + waitForProcessEnd(businessKey, 10000); + + WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + assertNotNull(wfe); + System.out.println(wfe.toString()); + + String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse"); + System.out.println("Response:\n" + response); + assertTrue(response.contains("")); + assertFalse((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); + + logEnd(); + } +} + diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java new file mode 100644 index 0000000000..4ac885fd9d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowAsyncResourceTest.java @@ -0,0 +1,96 @@ +/*- + * ============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.common; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.test.Deployment; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.jboss.resteasy.spi.AsynchronousResponse; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncCommonResource; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +public class WorkflowAsyncResourceTest extends WorkflowTest { + + @Test + @Deployment(resources = { "testAsyncResource.bpmn" }) + public void asyncRequestSuccess() throws InterruptedException { + //it can be any request which asynchronously processed by the workflow + String request = " SDN-ETHERNET-INTERNET HI/VLXM/950604//SW_INTERNET SubName01 "; + + Map variables = new HashMap(); + variables.put("testAsyncRequestMsg", request); + variables.put("mso-request-id", UUID.randomUUID().toString()); + variables.put("mso-service-request-timeout", "5"); + + WorkflowResponse workflowResponse = BPMNUtil.executeAsyncWorkflow(processEngineRule, "testAsyncProcess", variables); + assertEquals("Received the request, the process is getting executed, request message SDN-ETHERNET-INTERNET HI/VLXM/950604//SW_INTERNET SubName01 ", workflowResponse.getResponse()); + assertEquals(200, workflowResponse.getMessageCode()); + } + + private void executeWorkflow(String request, String requestId, AsynchronousResponse asyncResponse, String processKey) { + WorkflowAsyncCommonResource workflowResource = new WorkflowAsyncCommonResource(); + VariableMapImpl variableMap = new VariableMapImpl(); + + Map variableValueType = new HashMap(); + + Map requestMsg = new HashMap(); + requestMsg.put("value", request); + requestMsg.put("type", "String"); + + Map msorequestId = new HashMap(); + msorequestId.put("type", "String"); + msorequestId.put("value",requestId); + + Map timeout = new HashMap(); + timeout.put("type", "String"); + timeout.put("value","5"); + + variableValueType.put("testAsyncRequestMsg", requestMsg); + variableValueType.put("mso-request-id", msorequestId); + variableValueType.put("mso-service-request-timeout", timeout); + + variableMap.put("variables", variableValueType); + + workflowResource.setProcessEngineServices4junit(processEngineRule); + workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMap); + } + + class ProcessThread extends Thread { + + public WorkflowResponse workflowResponse; + public String requestId; + public String processKey; + public AsynchronousResponse asyncResponse = mock(AsynchronousResponse.class); + public String request; + public boolean started; + public void run() { + started = true; + executeWorkflow(request, requestId, asyncResponse, processKey); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java new file mode 100644 index 0000000000..bff193ffdd --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowContextHolderTest.java @@ -0,0 +1,97 @@ +/*- + * ============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.common; + +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import java.util.UUID; + +import javax.ws.rs.core.Response; + +import org.jboss.resteasy.spi.AsynchronousResponse; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowCallbackResponse; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowContext; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowContextHolder; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; + +public class WorkflowContextHolderTest { + + private WorkflowContext createContext(AsynchronousResponse asyncResponse) { + WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); + String requestId = UUID.randomUUID().toString(); + WorkflowContext workflowContext = new WorkflowContext("testAsyncProcess", + requestId, asyncResponse, 1000L); + contextHolder.put(workflowContext); + return workflowContext; + } + + @Test + @Ignore // BROKEN TEST (previously ignored) + public void testContextExpiry() throws InterruptedException { + + WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); + AsynchronousResponse asyncResponse = mock(AsynchronousResponse.class); + WorkflowContext workflowContext = createContext(asyncResponse); + String requestId = workflowContext.getRequestId(); + WorkflowContext context1 = contextHolder.getWorkflowContext(requestId); + + Assert.assertNotNull(context1); + Assert.assertEquals(requestId, context1.getRequestId()); + Assert.assertEquals(workflowContext.getProcessKey(), context1.getProcessKey()); + Assert.assertEquals(workflowContext.getStartTime(), context1.getStartTime()); + + Thread.sleep(1000); + //context should not be available after a second + WorkflowContext context2 = contextHolder.getWorkflowContext(requestId); + Assert.assertNull(context2); + } + + @Test + public void testProcessCallback() { + WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance(); + AsynchronousResponse asyncResponse = mock(AsynchronousResponse.class); + WorkflowContext workflowContext = createContext(asyncResponse); + + WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse(); + callbackResponse.setMessage("Success"); + callbackResponse.setResponse("Successfully processed request"); + callbackResponse.setStatusCode(200); + + Response response = contextHolder.processCallback("testAsyncProcess", + "process-instance-id", workflowContext.getRequestId(), + callbackResponse); + WorkflowResponse response1 = (WorkflowResponse) response.getEntity(); + Assert.assertNotNull(response1.getMessage()); + Assert.assertEquals(200,response1.getMessageCode()); + Assert.assertEquals("Success", response1.getMessage()); + Assert.assertEquals("Successfully processed request", response1.getResponse()); + verify(asyncResponse).setResponse(any(Response.class)); + + WorkflowContext context1 = contextHolder.getWorkflowContext(workflowContext.getRequestId()); + Assert.assertNull(context1); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java new file mode 100644 index 0000000000..c47521384b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java @@ -0,0 +1,1796 @@ +/*- + * ============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.common; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.ws.rs.core.Response; +import javax.xml.bind.JAXBException; +import javax.xml.namespace.NamespaceContext; +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpression; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; + +import org.camunda.bpm.engine.RuntimeService; +import org.camunda.bpm.engine.history.HistoricProcessInstance; +import org.camunda.bpm.engine.history.HistoricVariableInstance; +import org.camunda.bpm.engine.runtime.ProcessInstance; +import org.camunda.bpm.engine.test.ProcessEngineRule; +import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.custommonkey.xmlunit.DetailedDiff; +import org.custommonkey.xmlunit.XMLUnit; +import org.jboss.resteasy.spi.AsynchronousResponse; +import org.junit.Before; +import org.junit.Rule; +import org.openecomp.mso.bpmn.common.adapter.sdnc.CallbackHeader; +import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest; +import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse; +import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification; +import org.openecomp.mso.bpmn.common.adapter.vnf.DeleteVnfNotification; +import org.openecomp.mso.bpmn.common.adapter.vnf.MsoExceptionCategory; +import org.openecomp.mso.bpmn.common.adapter.vnf.MsoRequest; +import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification; +import org.openecomp.mso.bpmn.common.adapter.vnf.VnfRollback; +import org.openecomp.mso.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl; +import org.openecomp.mso.bpmn.common.workflow.service.VnfAdapterNotifyServiceImpl; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncCommonResource; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowMessageResource; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse; +import org.openecomp.mso.bpmn.core.CamundaDBSetup; +import org.openecomp.mso.bpmn.core.PropertyConfigurationSetup; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.junit.WireMockRule; + + + +/** + * A base class for Workflow tests. + *

    + * WireMock response transformers may be specified by declaring public + * static fields with the @WorkflowTestTransformer annotation. For example: + *

    + *     @WorkflowTestTransformer
    + *     public static final ResponseTransformer sdncAdapterMockTransformer =
    + *         new SDNCAdapterMockTransformer();
    + * 
    + */ +public class WorkflowTest { + @Rule + public final ProcessEngineRule processEngineRule = new ProcessEngineRule(); + + @Rule + public final WireMockRule wireMockRule; + + /** + * Constructor. + */ + public WorkflowTest() throws RuntimeException { + // Process WorkflowTestTransformer annotations + List transformerList = new ArrayList(); + + for (Field field : getClass().getFields()) { + WorkflowTestTransformer annotation = (WorkflowTestTransformer) + field.getAnnotation(WorkflowTestTransformer.class); + + if (annotation == null) { + continue; + } + + if (!Modifier.isStatic(field.getModifiers())) { + throw new RuntimeException(field.getDeclaringClass().getName() + + "#" + field.getName() + " has a @WorkflowTestTransformer " + + " annotation but it is not declared static"); + } + + ResponseTransformer transformer; + + try { + transformer = (ResponseTransformer) field.get(null); + } catch (IllegalAccessException e) { + throw new RuntimeException(field.getDeclaringClass().getName() + + "#" + field.getName() + " is not accessible", e); + } catch (ClassCastException e) { + throw new RuntimeException(field.getDeclaringClass().getName() + + "#" + field.getName() + " is not a ResponseTransformer", e); + } + + if (transformer == null) { + continue; + } + + transformerList.add(transformer); + } + + ResponseTransformer[] transformerArray = + transformerList.toArray(new ResponseTransformer[transformerList.size()]); + + wireMockRule = new WireMockRule(WireMockConfiguration.wireMockConfig() + .port(28090).extensions(transformerArray)); + } + + @Before + public void testSetup() throws Exception { + CamundaDBSetup.configure(); + PropertyConfigurationSetup.init(); + } + + /** + * The current request ID. Normally set when an "invoke" method is called. + */ + protected volatile String msoRequestId = null; + + /** + * The current service instance ID. Normally set when an "invoke" method + * is called. + */ + protected volatile String msoServiceInstanceId = null; + + /** + * Logs a test start method. + */ + protected void logStart() { + StackTraceElement[] st = Thread.currentThread().getStackTrace(); + String method = st[2].getMethodName(); + System.out.println("STARTED TEST: " + method); + } + + /** + * Logs a test end method. + */ + protected void logEnd() { + StackTraceElement[] st = Thread.currentThread().getStackTrace(); + String method = st[2].getMethodName(); + System.out.println("ENDED TEST: " + method); + } + + /** + * Invokes a subprocess. + * @param processKey the process key + * @param businessKey a unique key that will identify the process instance + * @param injectedVariables variables to inject into the process + */ + protected void invokeSubProcess(String processKey, String businessKey, + Map injectedVariables) { + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + List arguments = runtimeMxBean.getInputArguments(); + System.out.println("JVM args = " + arguments); + + msoRequestId = (String) injectedVariables.get("mso-request-id"); + + if (msoRequestId == null) { + String msg = "mso-request-id variable was not provided"; + System.out.println(msg); + fail(msg); + } + + // Note: some scenarios don't have a service-instance-id, may be null + msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id"); + + RuntimeService runtimeService = processEngineRule.getRuntimeService(); + runtimeService.startProcessInstanceByKey(processKey, businessKey, injectedVariables); + } + + /** + * Invokes an asynchronous process. + * Errors are handled with junit assertions and will cause the test to fail. + * @param processKey the process key + * @param schemaVersion the API schema version, e.g. "v1" + * @param businessKey a unique key that will identify the process instance + * @param request the request + * @return a TestAsyncResponse object associated with the test + */ + protected TestAsyncResponse invokeAsyncProcess(String processKey, + String schemaVersion, String businessKey, String request) { + return invokeAsyncProcess(processKey, schemaVersion, businessKey, request, null); + } + + /** + * Invokes an asynchronous process. + * Errors are handled with junit assertions and will cause the test to fail. + * @param processKey the process key + * @param schemaVersion the API schema version, e.g. "v1" + * @param businessKey a unique key that will identify the process instance + * @param request the request + * @param injectedVariables optional variables to inject into the process + * @return a TestAsyncResponse object associated with the test + */ + public TestAsyncResponse invokeAsyncProcess(String processKey, + String schemaVersion, String businessKey, String request, + Map injectedVariables) { + + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + List arguments = runtimeMxBean.getInputArguments(); + System.out.println("JVM args = " + arguments); + + Map variables = createVariables(schemaVersion, businessKey, + request, injectedVariables, false); + VariableMapImpl variableMapImpl = createVariableMapImpl(variables); + + System.out.println("Sending " + request + " to " + processKey + " process"); + WorkflowAsyncCommonResource workflowResource = new WorkflowAsyncCommonResource(); + workflowResource.setProcessEngineServices4junit(processEngineRule); + + TestAsyncResponse asyncResponse = new TestAsyncResponse(); + workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMapImpl); + return asyncResponse; + } + + /** + * Invokes an asynchronous process. + * Errors are handled with junit assertions and will cause the test to fail. + * @param processKey the process key + * @param schemaVersion the API schema version, e.g. "v1" + * @param businessKey a unique key that will identify the process instance + * @param request the request + * @param injectedVariables optional variables to inject into the process + * @param serviceInstantiationModel indicates whether this method is being + * invoked for a flow that is designed using the service instantiation model + * @return a TestAsyncResponse object associated with the test + */ + protected TestAsyncResponse invokeAsyncProcess(String processKey, + String schemaVersion, String businessKey, String request, + Map injectedVariables, boolean serviceInstantiationModel) { + + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + List arguments = runtimeMxBean.getInputArguments(); + System.out.println("JVM args = " + arguments); + + Map variables = createVariables(schemaVersion, businessKey, + request, injectedVariables, serviceInstantiationModel); + VariableMapImpl variableMapImpl = createVariableMapImpl(variables); + + System.out.println("Sending " + request + " to " + processKey + " process"); + WorkflowAsyncCommonResource workflowResource = new WorkflowAsyncCommonResource(); + workflowResource.setProcessEngineServices4junit(processEngineRule); + + TestAsyncResponse asyncResponse = new TestAsyncResponse(); + workflowResource.startProcessInstanceByKey(asyncResponse, processKey, variableMapImpl); + return asyncResponse; + } + + /** + * Private helper method that creates a variable map for a request. + * Errors are handled with junit assertions and will cause the test to fail. + * @param schemaVersion the API schema version, e.g. "v1" + * @param businessKey a unique key that will identify the process instance + * @param request the request + * @param injectedVariables optional variables to inject into the process + * @param serviceInstantiationModel indicates whether this method is being + * invoked for a flow that is designed using the service instantiation model + * @return a variable map + */ + private Map createVariables(String schemaVersion, + String businessKey, String request, Map injectedVariables, + boolean serviceInstantiationModel) { + + Map variables = new HashMap(); + + // These variables may be overridded by injected variables. + variables.put("mso-service-request-timeout", "180"); + variables.put("isDebugLogEnabled", "true"); + + // These variables may not be overridded by injected variables. + String[] notAllowed = new String[] { + "mso-schema-version", + "mso-business-key", + "bpmnRequest", + "mso-request-id", + "mso-service-instance-id" + }; + + if (injectedVariables != null) { + for (String key : injectedVariables.keySet()) { + for (String var : notAllowed) { + if (var.equals(key)) { + String msg = "Cannot specify " + var + " in injected variables"; + System.out.println(msg); + fail(msg); + } + } + + variables.put(key, injectedVariables.get(key)); + } + } + + variables.put("mso-schema-version", schemaVersion); + variables.put("mso-business-key", businessKey); + variables.put("bpmnRequest", request); + + if (serviceInstantiationModel) { + + /* + * The request ID and the service instance ID are generated for flows + * that follow the service instantiation model unless "requestId" and + * "serviceInstanceId" are injected variables. + */ + + try { + msoRequestId = (String) injectedVariables.get("requestId"); + variables.put("mso-request-id", msoRequestId); + msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId"); + variables.put("mso-service-instance-id", msoServiceInstanceId); + } + catch(Exception e) { + } + if (msoRequestId == null || msoRequestId.trim().equals("")) { + System.out.println("No requestId element in injectedVariables"); + variables.put("mso-request-id", UUID.randomUUID().toString()); + } + if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) { + System.out.println("No seviceInstanceId element in injectedVariables"); + variables.put("mso-service-instance-id", UUID.randomUUID().toString()); + } + + } else { + msoRequestId = getXMLTextElement(request, "request-id"); + + if (msoRequestId == null) { + //check in injected variables + try { + msoRequestId = (String) injectedVariables.get("requestId"); + } + catch(Exception e) { + } + if (msoRequestId == null || msoRequestId.trim().equals("")) { + String msg = "No request-id element in " + request; + System.out.println(msg); + fail(msg); + } + } + + variables.put("mso-request-id", msoRequestId); + + // Note: some request types don't have a service-instance-id + msoServiceInstanceId = getXMLTextElement(request, "service-instance-id"); + + if (msoServiceInstanceId != null) { + variables.put("mso-service-instance-id", msoServiceInstanceId); + } + } + + return variables; + } + + /** + * Private helper method that creates a camunda VariableMapImpl from a simple + * variable map. + * @param variables the simple variable map + * @return a VariableMap + */ + private VariableMapImpl createVariableMapImpl(Map variables) { + Map wrappedVariables = new HashMap(); + + for (String key : variables.keySet()) { + Object value = variables.get(key); + wrappedVariables.put(key, wrapVariableValue(value)); + } + + VariableMapImpl variableMapImpl = new VariableMapImpl(); + variableMapImpl.put("variables", wrappedVariables); + return variableMapImpl; + } + + /** + * Private helper method that wraps a variable value for inclusion in a + * camunda VariableMapImpl. + * @param value the variable value + * @return the wrapped variable + */ + private Map wrapVariableValue(Object value) { + HashMap valueMap = new HashMap(); + valueMap.put("value", value); + return valueMap; + } + + /** + * Receives a response from an asynchronous process. + * Errors are handled with junit assertions and will cause the test to fail. + * @param businessKey the process business key + * @param asyncResponse the TestAsyncResponse object associated with the test + * @param timeout the timeout in milliseconds + * @return the WorkflowResponse + */ + public WorkflowResponse receiveResponse(String businessKey, + TestAsyncResponse asyncResponse, long timeout) { + System.out.println("Waiting " + timeout + "ms for process with business key " + businessKey + + " to send a response"); + + long now = System.currentTimeMillis() + timeout; + long endTime = now + timeout; + + while (now <= endTime) { + Response response = asyncResponse.getResponse(); + + if (response != null) { + System.out.println("Received a response from process with business key " + businessKey); + + Object entity = response.getEntity(); + + if (!(entity instanceof WorkflowResponse)) { + String msg = "Response entity is " + + (entity == null ? "null" : entity.getClass().getName()) + + ", expected WorkflowResponse"; + System.out.println(msg); + fail(msg); + return null; // unreachable + } + + return (WorkflowResponse) entity; + } + + try { + Thread.sleep(200); + } catch (InterruptedException e) { + String msg = "Interrupted waiting for a response from process with business key " + + businessKey; + System.out.println(msg); + fail(msg); + return null; // unreachable + } + + now = System.currentTimeMillis(); + } + + String msg = "No response received from process with business key " + businessKey + + " within " + timeout + "ms"; + System.out.println(msg); + fail("Process with business key " + businessKey + " did not end within 10000ms"); + return null; // unreachable + } + + /** + * Runs a program to inject SDNC callback data into the test environment. + * A program is essentially just a list of keys that identify callback data + * to be injected, in sequence. An example program: + *
    +	 *     reserve, assign, delete:ERR
    +	 * 
    + * Errors are handled with junit assertions and will cause the test to fail. + * @param callbacks an object containing callback data for the program + * @param program the program to execute + */ + protected void injectSDNCRestCallbacks(CallbackSet callbacks, String program) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String content = null; + + if ("STD".equals(modifier)) { + content = callbacks.get(action); + + if (content == null) { + String msg = "No callback defined for '" + action + "' SDNC request"; + System.out.println(msg); + fail(msg); + } + } else if ("ERR".equals(modifier)) { + content = "{\"SDNCServiceError\":{\"sdncRequestId\":\"((REQUEST-ID))\",\"responseCode\":\"500\",\"responseMessage\":\"SIMULATED ERROR FROM SDNC ADAPTER\",\"ackFinalIndicator\":\"Y\"}}"; + } else { + String msg = "Invalid SDNC program modifier: '" + modifier + "'"; + System.out.println(msg); + fail(msg); + } + + if (!injectSDNCRestCallback(content, 10000)) { + fail("Failed to inject SDNC '" + action + "' callback"); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of SDNC '" + action + "' callback"); + } + } + } + + /** + * Runs a program to inject SDNC events into the test environment. + * A program is essentially just a list of keys that identify event data + * to be injected, in sequence. An example program: + *
    +	 *     event1, event2
    +	 * 
    + * Errors are handled with junit assertions and will cause the test to fail. + * Defaults the Event Type to "SDNCAEvent" for backward compatibility. + * @param callbacks an object containing event data for the program + * @param program the program to execute + */ + protected void injectSDNCEvents(CallbackSet callbacks, String program) { + injectSDNCEvents(callbacks, program, "SDNCAEvent"); + } + + /** + * Runs a program to inject SDNC events into the test environment. + * A program is essentially just a list of keys that identify event data + * to be injected, in sequence. An example program: + *
    +	 *     event1, event2
    +	 * 
    + * Errors are handled with junit assertions and will cause the test to fail. + * @param callbacks an object containing event data for the program + * @param program the program to execute + * @param eventType (i.e. "SDNCAEvent", "SNIROResponse", etc.) + */ + protected void injectSDNCEvents(CallbackSet callbacks, String program, String eventType) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String content = null; + + if ("STD".equals(modifier)) { + content = callbacks.get(action); + + if (content == null) { + String msg = "No SDNC event callback defined for '" + action + "'"; + System.out.println(msg); + fail(msg); + } + } else { + String msg = "Invalid SDNC program modifier: '" + modifier + "'"; + System.out.println(msg); + fail(msg); + } + + if (!injectWorkflowMessage(eventType, content, 10000)) { + fail("Failed to inject SDNC '" + action + "' event"); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of SDNC '" + action + "' event"); + } + } + } + + /** + * Runs a program to inject SDNC callback data into the test environment. + * A program is essentially just a list of keys that identify callback data + * to be injected, in sequence. An example program: + *
    +	 *     reserve, assign, delete:ERR
    +	 * 
    + * Errors are handled with junit assertions and will cause the test to fail. + * @param callbacks an object containing callback data for the program + * @param program the program to execute + */ + public void injectSDNCCallbacks(CallbackSet callbacks, String program) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String content = null; + int respCode = 200; + String respMsg = "OK"; + + if ("STD".equals(modifier)) { + content = callbacks.get(action); + + if (content == null) { + String msg = "No callback defined for '" + action + "' SDNC request"; + System.out.println(msg); + fail(msg); + } + + respCode = 200; + respMsg = "OK"; + } else if ("ERR".equals(modifier)) { + content = "((REQUEST-ID))500SIMULATED ERROR FROM SDNC ADAPTER"; + respCode = 500; + respMsg = "SERVER ERROR"; + } else { + String msg = "Invalid SDNC program modifier: '" + modifier + "'"; + System.out.println(msg); + fail(msg); + } + + if (!injectSDNCCallback(respCode, respMsg, content, 10000)) { + fail("Failed to inject SDNC '" + action + "' callback"); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of SDNC '" + action + "' callback"); + } + } + } + + /** + * Runs a program to inject VNF adapter REST callback data into the test environment. + * A program is essentially just a list of keys that identify callback data + * to be injected, in sequence. An example program: + *
    +	 *     create, rollback
    +	 * 
    + * Errors are handled with junit assertions and will cause the test to fail. + * @param callbacks an object containing callback data for the program + * @param program the program to execute + */ + public void injectVNFRestCallbacks(CallbackSet callbacks, String program) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String content = null; + + if ("STD".equals(modifier)) { + content = callbacks.get(action); + + if (content == null) { + String msg = "No callback defined for '" + action + "' VNF REST request"; + System.out.println(msg); + fail(msg); + } + } else if ("ERR".equals(modifier)) { + content = "SIMULATED ERROR FROM VNF ADAPTER"; + } else { + String msg = "Invalid VNF REST program modifier: '" + modifier + "'"; + System.out.println(msg); + fail(msg); + } + + if (!injectVnfAdapterRestCallback(content, 10000)) { + fail("Failed to inject VNF REST '" + action + "' callback"); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of VNF REST '" + action + "' callback"); + } + } + } + + /** + * Runs a program to inject VNF callback data into the test environment. + * A program is essentially just a list of keys that identify callback data + * to be injected, in sequence. An example program: + *
    +	 *     createVnf, deleteVnf
    +	 * 
    + * Errors are handled with junit assertions and will cause the test to fail. + * @param callbacks an object containing callback data for the program + * @param program the program to execute + */ + protected void injectVNFCallbacks(CallbackSet callbacks, String program) { + + String[] cmds = program.replaceAll("\\s+", "").split(","); + + for (String cmd : cmds) { + String action = cmd; + String modifier = "STD"; + + if (cmd.contains(":")) { + String[] parts = cmd.split(":"); + action = parts[0]; + modifier = parts[1]; + } + + String content = null; + + if ("STD".equals(modifier)) { + content = callbacks.get(action); + + if (content == null) { + String msg = "No callback defined for '" + action + "' VNF request"; + System.out.println(msg); + fail(msg); + } + + } else if ("ERR".equals(modifier)) { + String msg = "Currently unsupported VNF program modifier: '" + modifier + "'"; + System.out.println(msg); + fail(msg); + } else { + String msg = "Invalid VNF program modifier: '" + modifier + "'"; + System.out.println(msg); + fail(msg); + } + + boolean injected = false; + + if (content.contains("createVnfNotification")) { + injected = injectCreateVNFCallback(content, 10000); + } else if (content.contains("deleteVnfNotification")) { + injected = injectDeleteVNFCallback(content, 10000); + } else if (content.contains("updateVnfNotification")) { + injected = injectUpdateVNFCallback(content, 10000); + } + + if (!injected) { + String msg = "Failed to inject VNF '" + action + "' callback"; + System.out.println(msg); + fail(msg); + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + fail("Interrupted after injection of VNF '" + action + "' callback"); + } + } + } + + /** + * Waits for the number of running processes with the specified process + * definition key to equal a particular count. + * @param processKey the process definition key + * @param count the desired count + * @param timeout the timeout in milliseconds + */ + public void waitForRunningProcessCount(String processKey, int count, long timeout) { + System.out.println("Waiting " + timeout + "ms for there to be " + count + " " + + processKey + " instances"); + + long now = System.currentTimeMillis() + timeout; + long endTime = now + timeout; + int last = -1; + + while (now <= endTime) { + int actual = processEngineRule.getRuntimeService() + .createProcessInstanceQuery() + .processDefinitionKey(processKey) + .list().size(); + + if (actual != last) { + System.out.println("There are now " + actual + " " + + processKey + " instances"); + last = actual; + } + + if (actual == count) { + return; + } + + try { + Thread.sleep(200); + } catch (InterruptedException e) { + String msg = "Interrupted waiting for there to be " + count + " " + + processKey + " instances"; + System.out.println(msg); + fail(msg); + } + + now = System.currentTimeMillis(); + } + + String msg = "Timed out waiting for there to be " + count + " " + + processKey + " instances"; + System.out.println(msg); + fail(msg); + } + + /** + * Waits for the specified process variable to be set. + * @param processKey the process definition key + * @param variable the variable name + * @param timeout the timeout in milliseconds + * @return the variable value, or null if it cannot be obtained + * in the specified time + */ + protected Object getProcessVariable(String processKey, String variable, + long timeout) { + + System.out.println("Waiting " + timeout + "ms for " + + processKey + "." + variable + " to be set"); + + long now = System.currentTimeMillis() + timeout; + long endTime = now + timeout; + + ProcessInstance processInstance = null; + Object value = null; + + while (value == null) { + if (now > endTime) { + if (processInstance == null) { + System.out.println("Timed out waiting for " + + processKey + " to start"); + } else { + System.out.println("Timed out waiting for " + + processKey + "[" + processInstance.getId() + + "]." + variable + " to be set"); + } + + return null; + } + + if (processInstance == null) { + processInstance = processEngineRule.getRuntimeService() + .createProcessInstanceQuery() + .processDefinitionKey(processKey) + .singleResult(); + } + + if (processInstance != null) { + value = processEngineRule.getRuntimeService() + .getVariable(processInstance.getId(), variable); + } + + try { + Thread.sleep(200); + } catch (InterruptedException e) { + System.out.println("Interrupted waiting for " + + processKey + "." + variable + " to be set"); + return null; + } + + now = System.currentTimeMillis(); + } + + System.out.println(processKey + "[" + + processInstance.getId() + "]." + variable + "=" + + value); + + return value; + } + + /** + * Injects a single SDNC adapter callback request. The specified callback data + * may contain the placeholder string ((REQUEST-ID)) which is replaced with + * the actual SDNC request ID. Note: this is not the requestId in the original + * MSO request. + * @param content the content of the callback + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + */ + protected boolean injectSDNCRestCallback(String content, long timeout) { + String sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV1", + "SDNCAResponse_CORRELATOR", timeout); + + if (sdncRequestId == null) { + return false; + } + + content = content.replace("((REQUEST-ID))", sdncRequestId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{REQUEST-ID}}", sdncRequestId); + + System.out.println("Injecting SDNC adapter callback"); + WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource(); + workflowMessageResource.setProcessEngineServices4junit(processEngineRule); + Response response = workflowMessageResource.deliver("SDNCAResponse", sdncRequestId, content); + System.out.println("Workflow response to SDNC adapter callback: " + response); + return true; + } + + /** + * Injects a single SDNC adapter callback request. The specified callback data + * may contain the placeholder string ((REQUEST-ID)) which is replaced with + * the actual SDNC request ID. Note: this is not the requestId in the original + * MSO request. + * @param content the content of the callback + * @param respCode the response code (normally 200) + * @param respMsg the response message (normally "OK") + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + */ + protected boolean injectSDNCCallback(int respCode, String respMsg, + String content, long timeout) { + + String sdncRequestId = (String) getProcessVariable("sdncAdapter", + "SDNCA_requestId", timeout); + + if (sdncRequestId == null) { + return false; + } + + content = content.replace("((REQUEST-ID))", sdncRequestId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{REQUEST-ID}}", sdncRequestId); + + System.out.println("Injecting SDNC adapter callback"); + CallbackHeader callbackHeader = new CallbackHeader(); + callbackHeader.setRequestId(sdncRequestId); + callbackHeader.setResponseCode(String.valueOf(respCode)); + callbackHeader.setResponseMessage(respMsg); + SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest(); + sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); + sdncAdapterCallbackRequest.setRequestData(content); + SDNCAdapterCallbackServiceImpl callbackService = new SDNCAdapterCallbackServiceImpl(); + callbackService.setProcessEngineServices4junit(processEngineRule); + SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); + System.out.println("Workflow response to SDNC adapter callback: " + sdncAdapterResponse); + + return true; + } + + /** + * Injects a single VNF adapter callback request. The specified callback data + * may contain the placeholder string ((MESSAGE-ID)) which is replaced with + * the actual message ID. Note: this is not the requestId in the original + * MSO request. + * @param content the content of the callback + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + */ + protected boolean injectVnfAdapterRestCallback(String content, long timeout) { + String messageId = (String) getProcessVariable("vnfAdapterRestV1", + "VNFAResponse_CORRELATOR", timeout); + + if (messageId == null) { + return false; + } + + content = content.replace("((MESSAGE-ID))", messageId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{MESSAGE-ID}}", messageId); + + System.out.println("Injecting VNF adapter callback"); + WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource(); + workflowMessageResource.setProcessEngineServices4junit(processEngineRule); + Response response = workflowMessageResource.deliver("VNFAResponse", messageId, content); + System.out.println("Workflow response to VNF adapter callback: " + response); + return true; + } + + /** + * Injects a Create VNF adapter callback request. The specified callback data + * may contain the placeholder string ((MESSAGE-ID)) which is replaced with + * the actual message ID. It may also contain the placeholder string + * ((REQUEST-ID)) which is replaced request ID of the original MSO request. + * @param content the content of the callback + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + * @throws JAXBException if the content does not adhere to the schema + */ + protected boolean injectCreateVNFCallback(String content, long timeout) { + + String messageId = (String) getProcessVariable("vnfAdapterCreateV1", + "VNFC_messageId", timeout); + + if (messageId == null) { + return false; + } + + content = content.replace("((MESSAGE-ID))", messageId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{MESSAGE-ID}}", messageId); + + if(content.contains("((REQUEST-ID))")){ + content = content.replace("((REQUEST-ID))", msoRequestId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{REQUEST-ID}}", msoRequestId); + } + + System.out.println("Injecting VNF adapter callback"); + + // Is it possible to unmarshal this with JAXB? I couldn't. + + CreateVnfNotification createVnfNotification = new CreateVnfNotification(); + XPathTool xpathTool = new VnfNotifyXPathTool(); + xpathTool.setXML(content); + + try { + String completed = xpathTool.evaluate( + "/tns:createVnfNotification/tns:completed/text()"); + createVnfNotification.setCompleted("true".equals(completed)); + + String vnfId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:vnfId/text()"); + createVnfNotification.setVnfId(vnfId); + + NodeList entries = (NodeList) xpathTool.evaluate( + "/tns:createVnfNotification/tns:outputs/tns:entry", + XPathConstants.NODESET); + + CreateVnfNotificationOutputs outputs = new CreateVnfNotificationOutputs(); + + for (int i = 0; i < entries.getLength(); i++) { + Node node = entries.item(i); + + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element entry = (Element) node; + String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent(); + String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent(); + outputs.add(key, value); + } + } + + createVnfNotification.setOutputs(outputs); + + VnfRollback rollback = new VnfRollback(); + + String cloudSiteId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:cloudSiteId/text()"); + rollback.setCloudSiteId(cloudSiteId); + + String requestId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()"); + String serviceInstanceId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()"); + + if (requestId != null || serviceInstanceId != null) { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestId); + msoRequest.setServiceInstanceId(serviceInstanceId); + rollback.setMsoRequest(msoRequest); + } + + String tenantCreated = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:tenantCreated/text()"); + rollback.setTenantCreated("true".equals(tenantCreated)); + + String tenantId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:tenantId/text()"); + rollback.setTenantId(tenantId); + + String vnfCreated = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:vnfCreated/text()"); + rollback.setVnfCreated("true".equals(vnfCreated)); + + String rollbackVnfId = xpathTool.evaluate( + "/tns:createVnfNotification/tns:rollback/tns:vnfId/text()"); + rollback.setVnfId(rollbackVnfId); + + createVnfNotification.setRollback(rollback); + + } catch (Exception e) { + System.out.println("Failed to unmarshal VNF callback content:"); + System.out.println(content); + return false; + } + + VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl(); + notifyService.setProcessEngineServices4junit(processEngineRule); + + notifyService.createVnfNotification( + messageId, + createVnfNotification.isCompleted(), + createVnfNotification.getException(), + createVnfNotification.getErrorMessage(), + createVnfNotification.getVnfId(), + createVnfNotification.getOutputs(), + createVnfNotification.getRollback()); + + return true; + } + + /** + * Injects a Delete VNF adapter callback request. The specified callback data + * may contain the placeholder string ((MESSAGE-ID)) which is replaced with + * the actual message ID. It may also contain the placeholder string + * ((REQUEST-ID)) which is replaced request ID of the original MSO request. + * @param content the content of the callback + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + * @throws JAXBException if the content does not adhere to the schema + */ + protected boolean injectDeleteVNFCallback(String content, long timeout) { + + String messageId = (String) getProcessVariable("vnfAdapterDeleteV1", + "VNFDEL_uuid", timeout); + + if (messageId == null) { + return false; + } + + content = content.replace("((MESSAGE-ID))", messageId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{MESSAGE-ID}}", messageId); + + System.out.println("Injecting VNF adapter delete callback"); + + // Is it possible to unmarshal this with JAXB? I couldn't. + + DeleteVnfNotification deleteVnfNotification = new DeleteVnfNotification(); + XPathTool xpathTool = new VnfNotifyXPathTool(); + xpathTool.setXML(content); + + try { + String completed = xpathTool.evaluate( + "/tns:deleteVnfNotification/tns:completed/text()"); + deleteVnfNotification.setCompleted("true".equals(completed)); + // if notification failure, set the exception and error message + if (deleteVnfNotification.isCompleted() == false) { + deleteVnfNotification.setException(MsoExceptionCategory.INTERNAL); + deleteVnfNotification.setErrorMessage(xpathTool.evaluate( + "/tns:deleteVnfNotification/tns:errorMessage/text()")) ; + } + + } catch (Exception e) { + System.out.println("Failed to unmarshal VNF Delete callback content:"); + System.out.println(content); + return false; + } + + VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl(); + notifyService.setProcessEngineServices4junit(processEngineRule); + + notifyService.deleteVnfNotification( + messageId, + deleteVnfNotification.isCompleted(), + deleteVnfNotification.getException(), + deleteVnfNotification.getErrorMessage()); + + return true; + } + + /** + * Injects a Update VNF adapter callback request. The specified callback data + * may contain the placeholder string ((MESSAGE-ID)) which is replaced with + * the actual message ID. It may also contain the placeholder string + * ((REQUEST-ID)) which is replaced request ID of the original MSO request. + * @param content the content of the callback + * @param timeout the timeout in milliseconds + * @return true if the callback could be injected, false otherwise + * @throws JAXBException if the content does not adhere to the schema + */ + protected boolean injectUpdateVNFCallback(String content, long timeout) { + + String messageId = (String) getProcessVariable("vnfAdapterUpdate", + "VNFU_messageId", timeout); + + if (messageId == null) { + return false; + } + + content = content.replace("((MESSAGE-ID))", messageId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{MESSAGE-ID}}", messageId); + + content = content.replace("((REQUEST-ID))", msoRequestId); + // Deprecated usage. All test code should switch to the (( ... )) syntax. + content = content.replace("{{REQUEST-ID}}", msoRequestId); + + System.out.println("Injecting VNF adapter callback"); + + // Is it possible to unmarshal this with JAXB? I couldn't. + + UpdateVnfNotification updateVnfNotification = new UpdateVnfNotification(); + XPathTool xpathTool = new VnfNotifyXPathTool(); + xpathTool.setXML(content); + + try { + String completed = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:completed/text()"); + updateVnfNotification.setCompleted("true".equals(completed)); + + NodeList entries = (NodeList) xpathTool.evaluate( + "/tns:updateVnfNotification/tns:outputs/tns:entry", + XPathConstants.NODESET); + + UpdateVnfNotificationOutputs outputs = new UpdateVnfNotificationOutputs(); + + for (int i = 0; i < entries.getLength(); i++) { + Node node = entries.item(i); + + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element entry = (Element) node; + String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent(); + String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent(); + outputs.add(key, value); + } + } + + updateVnfNotification.setOutputs(outputs); + + VnfRollback rollback = new VnfRollback(); + + String cloudSiteId = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()"); + rollback.setCloudSiteId(cloudSiteId); + + String requestId = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()"); + String serviceInstanceId = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()"); + + if (requestId != null || serviceInstanceId != null) { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestId); + msoRequest.setServiceInstanceId(serviceInstanceId); + rollback.setMsoRequest(msoRequest); + } + + String tenantCreated = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:tenantCreated/text()"); + rollback.setTenantCreated("true".equals(tenantCreated)); + + String tenantId = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:tenantId/text()"); + rollback.setTenantId(tenantId); + + String vnfCreated = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:vnfCreated/text()"); + rollback.setVnfCreated("true".equals(vnfCreated)); + + String rollbackVnfId = xpathTool.evaluate( + "/tns:updateVnfNotification/tns:rollback/tns:vnfId/text()"); + rollback.setVnfId(rollbackVnfId); + + updateVnfNotification.setRollback(rollback); + + } catch (Exception e) { + System.out.println("Failed to unmarshal VNF callback content:"); + System.out.println(content); + return false; + } + + VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl(); + notifyService.setProcessEngineServices4junit(processEngineRule); + + notifyService.updateVnfNotification( + messageId, + updateVnfNotification.isCompleted(), + updateVnfNotification.getException(), + updateVnfNotification.getErrorMessage(), + updateVnfNotification.getOutputs(), + updateVnfNotification.getRollback()); + + return true; + } + + /** + * Injects a workflow message. The specified callback data may contain the + * placeholder string ((CORRELATOR)) which is replaced with the actual + * correlator value. + * @param content the message type + * @param content the message content + * @param timeout the timeout in milliseconds + * @return true if the event could be injected, false otherwise + */ + protected boolean injectWorkflowMessage(String messageType, String content, long timeout) { + String correlator = (String) getProcessVariable("ReceiveWorkflowMessage", + messageType + "_CORRELATOR", timeout); + + if (correlator == null) { + return false; + } + + content = content.replace("((CORRELATOR))", correlator); + + System.out.println("Injecting " + messageType + " message"); + WorkflowMessageResource workflowMessageResource = new WorkflowMessageResource(); + workflowMessageResource.setProcessEngineServices4junit(processEngineRule); + Response response = workflowMessageResource.deliver(messageType, correlator, content); + System.out.println("Workflow response to " + messageType + " message: " + response); + return true; + } + + /** + * Wait for the process to end. + * @param businessKey the process business key + * @param timeout the amount of time to wait, in milliseconds + */ + public void waitForProcessEnd(String businessKey, long timeout) { + System.out.println("Waiting " + timeout + "ms for process with business key " + + businessKey + " to end"); + + long now = System.currentTimeMillis() + timeout; + long endTime = now + timeout; + + while (now <= endTime) { + if (isProcessEnded(businessKey)) { + System.out.println("Process with business key " + businessKey + " has ended"); + return; + } + + try { + Thread.sleep(200); + } catch (InterruptedException e) { + String msg = "Interrupted waiting for process with business key " + + businessKey + " to end"; + System.out.println(msg); + fail(msg); + } + + now = System.currentTimeMillis(); + } + + String msg = "Process with business key " + businessKey + + " did not end within " + timeout + "ms"; + System.out.println(msg); + fail(msg); + } + + /** + * Verifies that the specified historic process variable has the specified value. + * If the variable does not have the specified value, the test is failed. + * @param businessKey the process business key + * @param variable the variable name + * @param value the expected variable value + */ + public void checkVariable(String businessKey, String variable, Object value) { + if (!isProcessEnded(businessKey)) { + fail("Cannot get historic variable " + variable + " because process with business key " + + businessKey + " has not ended"); + } + + Object variableValue = getVariableFromHistory(businessKey, variable); + assertEquals(value, variableValue); + } + + /** + * Checks to see if the specified process is ended. + * @param businessKey the process business Key + * @return true if the process is ended + */ + protected boolean isProcessEnded(String businessKey) { + HistoricProcessInstance processInstance = processEngineRule.getHistoryService() + .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult(); + return processInstance != null && processInstance.getEndTime() != null; + } + + /** + * Gets a variable value from a historical process instance. + * @param businessKey the process business key + * @param variableName the variable name + * @return the variable value, or null if the variable could not be + * obtained + */ + public Object getVariableFromHistory(String businessKey, String variableName) { + try { + HistoricProcessInstance processInstance = processEngineRule.getHistoryService() + .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult(); + + if (processInstance == null) { + return null; + } + + HistoricVariableInstance v = processEngineRule.getHistoryService() + .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()) + .variableName(variableName).singleResult(); + return v == null ? null : v.getValue(); + } catch (Exception e) { + System.out.println("Error retrieving variable " + variableName + + " from historical process with business key " + businessKey + ": " + e); + return null; + } + } + + /** + * Gets the value of a subflow variable from the specified subflow's + * historical process instance. + * + * @param subflowName - the name of the subflow that contains the variable + * @param variableName the variable name + * + * @return the variable value, or null if the variable could not be obtained + * + */ + protected Object getVariableFromSubflowHistory(String subflowName, String variableName) { + try { + List processInstanceList = processEngineRule.getHistoryService() + .createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list(); + + Collections.sort(processInstanceList, new Comparator() { + public int compare(HistoricProcessInstance m1, HistoricProcessInstance m2) { + return m1.getStartTime().compareTo(m2.getStartTime()); + } + }); + + HistoricProcessInstance processInstance = processInstanceList.get(0); + + if (processInstanceList == null) { + return null; + } + + HistoricVariableInstance v = processEngineRule.getHistoryService() + .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()) + .variableName(variableName).singleResult(); + return v == null ? null : v.getValue(); + } catch (Exception e) { + System.out.println("Error retrieving variable " + variableName + + " from sub flow: " + subflowName + ", Exception is: " + e); + return null; + } + } + + /** + * Gets the value of a subflow variable from the subflow's + * historical process x instance. + * + * @param subflowName - the name of the subflow that contains the variable + * @param variableName the variable name + * @param subflowInstanceIndex - the instance of the subflow (use when same subflow is called more than once from mainflow) + * + * @return the variable value, or null if the variable could not be obtained + */ + protected Object getVariableFromSubflowHistory(int subflowInstanceIndex, String subflowName, String variableName) { + try { + List processInstanceList = processEngineRule.getHistoryService() + .createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list(); + + Collections.sort(processInstanceList, new Comparator() { + public int compare(HistoricProcessInstance m1, HistoricProcessInstance m2) { + return m1.getStartTime().compareTo(m2.getStartTime()); + } + }); + + HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex); + + if (processInstanceList == null) { + return null; + } + + HistoricVariableInstance v = processEngineRule.getHistoryService() + .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()) + .variableName(variableName).singleResult(); + return v == null ? null : v.getValue(); + } catch (Exception e) { + System.out.println("Error retrieving variable " + variableName + + " from " + subflowInstanceIndex + " instance index of sub flow: " + subflowName + ", Exception is: " + e); + return null; + } + } + + + /** + * Extracts text from an XML element. This method is not namespace aware + * (namespaces are ignored). The first matching element is selected. + * @param xml the XML document or fragment + * @param tag the desired element, e.g. "" + * @return the element text, or null if the element was not found + */ + protected String getXMLTextElement(String xml, String tag) { + xml = removeXMLNamespaces(xml); + + if (!tag.startsWith("<")) { + tag = "<" + tag + ">"; + } + + int start = xml.indexOf(tag); + + if (start == -1) { + return null; + } + + int end = xml.indexOf('<', start + tag.length()); + + if (end == -1) { + return null; + } + + return xml.substring(start + tag.length(), end); + } + + /** + * Removes namespace definitions and prefixes from XML, if any. + */ + private String removeXMLNamespaces(String xml) { + // remove xmlns declaration + xml = xml.replaceAll("xmlns.*?(\"|\').*?(\"|\')", ""); + + // remove opening tag prefix + xml = xml.replaceAll("(<)(\\w+:)(.*?>)", "$1$3"); + + // remove closing tags prefix + xml = xml.replaceAll("()", "$1$3"); + + // remove extra spaces left when xmlns declarations are removed + xml = xml.replaceAll("\\s+>", ">"); + + return xml; + } + + /** + * Asserts that two XML documents are semantically equivalent. Differences + * in whitespace or in namespace usage do not affect the comparison. + * @param expected the expected XML + * @param actual the XML to test + * @throws SAXException + * @throws IOException + */ + public static void assertXMLEquals(String expected, String actual) + throws SAXException, IOException { + XMLUnit.setIgnoreWhitespace(true); + XMLUnit.setIgnoreAttributeOrder(true); + DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expected, actual)); + List allDifferences = diff.getAllDifferences(); + assertEquals("Differences found: " + diff.toString(), 0, allDifferences.size()); + } + + /** + * A test implementation of AsynchronousResponse. + */ + public class TestAsyncResponse implements AsynchronousResponse { + Response response = null; + + /** + * {@inheritDoc} + */ + @Override + public synchronized void setResponse(Response response) { + this.response = response; + } + + /** + * Gets the response. + * @return the response, or null if none has been produced yet + */ + public synchronized Response getResponse() { + return response; + } + } + + /** + * An object that contains callback data for a "program". + */ + public class CallbackSet { + private final Map map = new HashMap(); + + /** + * Add callback data to the set. + * @param action the action with which the data is associated + * @param content the callback data + */ + public void put(String action, String content) { + map.put(action, content); + } + + /** + * Retrieve callback data from the set. + * @param action the action with which the data is associated + * @return the callback data, or null if there is none for the specified operation + */ + public String get(String action) { + return map.get(action); + } + } + + /** + * A tool for evaluating XPath expressions. + */ + protected class XPathTool { + private final DocumentBuilderFactory factory; + private final SimpleNamespaceContext context = new SimpleNamespaceContext(); + private final XPath xpath = XPathFactory.newInstance().newXPath(); + private String xml = null; + private Document doc = null; + + /** + * Constructor. + */ + public XPathTool() { + factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + xpath.setNamespaceContext(context); + } + + /** + * Adds a namespace. + * @param prefix the namespace prefix + * @param uri the namespace uri + */ + public synchronized void addNamespace(String prefix, String uri) { + context.add(prefix, uri); + } + + /** + * Sets the XML content to be operated on. + * @param xml the XML content + */ + public synchronized void setXML(String xml) { + this.xml = xml; + this.doc = null; + } + + /** + * Returns the document object. + * @return the document object, or null if XML has not been set + * @throws SAXException + * @throws IOException + * @throws ParserConfigurationException + */ + public synchronized Document getDocument() + throws ParserConfigurationException, IOException, SAXException { + if (xml == null) { + return null; + } + + buildDocument(); + return doc; + } + + /** + * Evaluates the specified XPath expression and returns a string result. + * This method throws exceptions on error. + * @param expression the expression + * @return the result object + * @throws ParserConfigurationException + * @throws IOException + * @throws SAXException + * @throws XPathExpressionException on error + */ + public synchronized String evaluate(String expression) + throws ParserConfigurationException, SAXException, + IOException, XPathExpressionException { + return (String) evaluate(expression, XPathConstants.STRING); + } + + /** + * Evaluates the specified XPath expression. + * This method throws exceptions on error. + * @param expression the expression + * @param returnType the return type + * @return the result object + * @throws ParserConfigurationException + * @throws IOException + * @throws SAXException + * @throws XPathExpressionException on error + */ + public synchronized Object evaluate(String expression, QName returnType) + throws ParserConfigurationException, SAXException, + IOException, XPathExpressionException { + + buildDocument(); + XPathExpression expr = xpath.compile(expression); + return expr.evaluate(doc, returnType); + } + + /** + * Private helper method that builds the document object. + * Assumes the calling method is synchronized. + * @throws ParserConfigurationException + * @throws IOException + * @throws SAXException + */ + private void buildDocument() throws ParserConfigurationException, + IOException, SAXException { + if (doc == null) { + if (xml == null) { + throw new IOException("XML input is null"); + } + + DocumentBuilder builder = factory.newDocumentBuilder(); + InputSource source = new InputSource(new StringReader(xml)); + doc = builder.parse(source); + } + } + } + + /** + * A NamespaceContext class based on a Map. + */ + private class SimpleNamespaceContext implements NamespaceContext { + private Map prefixMap = new HashMap(); + private Map uriMap = new HashMap(); + + public synchronized void add(String prefix, String uri) { + prefixMap.put(prefix, uri); + uriMap.put(uri, prefix); + } + + @Override + public synchronized String getNamespaceURI(String prefix) { + return prefixMap.get(prefix); + } + + @Override + public Iterator getPrefixes(String uri) { + List list = new ArrayList(); + String prefix = uriMap.get(uri); + if (prefix != null) { + list.add(prefix); + } + return list.iterator(); + } + + @Override + public String getPrefix(String uri) { + return uriMap.get(uri); + } + } + + /** + * A VnfNotify XPathTool. + */ + protected class VnfNotifyXPathTool extends XPathTool { + public VnfNotifyXPathTool() { + addNamespace("tns", "http://org.openecomp.mso/vnfNotify"); + } + } + + /** + * Helper class to make it easier to create this type. + */ + private static class CreateVnfNotificationOutputs + extends org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs { + public void add(String key, String value) { + Entry entry = new Entry(); + entry.setKey(key); + entry.setValue(value); + getEntry().add(entry); + } + } + + /** + * Helper class to make it easier to create this type. + */ + private static class UpdateVnfNotificationOutputs + extends org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs { + public void add(String key, String value) { + Entry entry = new Entry(); + entry.setKey(key); + entry.setValue(value); + getEntry().add(entry); + } + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTestTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTestTransformer.java new file mode 100644 index 0000000000..4aa6fbe0bb --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTestTransformer.java @@ -0,0 +1,21 @@ +package org.openecomp.mso.bpmn.common; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Allows a subclass of WorkflowTest to specify one or more WireMock + * response transformers. A transformer must be declared as a public + * static field in the subclass. For example: + *
    + *     @WorkflowTestTransformer
    + *     public static final ResponseTransformer sdncAdapterMockTransformer =
    + *         new SDNCAdapterMockTransformer();
    + * 
    + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface WorkflowTestTransformer { +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml new file mode 100644 index 0000000000..2cf94b2ef2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySim500Response.xml @@ -0,0 +1,25 @@ + + + + + + + + testRequestId + 200 + OK + + <output + xmlns="com:att:sdnctl:vnf"><response-code>500</response-code><response-message>'Error + retrieving l3-network with network-id=' + + $network-topology-operation-input.network-request-information.network-id + + 'from + AnAI'</response-message><ack-final-indicator>Y</ack-final-indicator><svc-request-id>006927ca-f5a3-47fd-880c-dfcbcd81a093</svc-request-id></output> + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml new file mode 100644 index 0000000000..57dc2d6f30 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse_noExtraTag.xml @@ -0,0 +1,17 @@ + + + + + + + testRequestId + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</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>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml new file mode 100644 index 0000000000..52d2b01201 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume.xml @@ -0,0 +1,22 @@ + + a8399879-31b3-4973-be26-0a0cbe776b58 + MoG_CinderVolumes_2 + MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845 + VmogSvc/moge2e2 + Active + 1458839419 + + + tenant + https://aai-app-e2e.test.att.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + tenant.tenant-name + MOG-25208-D-01 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml new file mode 100644 index 0000000000..79e7d84ed8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml @@ -0,0 +1,22 @@ + + a8399879-31b3-4973-be26-0a0cbe776b58 + MoG_CinderVolumes_2 + MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845 + VmogSvc/moge2e2 + Active + 1458839419 + + + tenant + https://aai-app-e2e.test.att.com:8443/aai/v6/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 83464847234ee8937416c65507d267 + + + tenant.tenant-name + MOG-25208-D-01 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ARCHIVE_CAMUNDA_HISTORY-Default Store Procedure.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ARCHIVE_CAMUNDA_HISTORY-Default Store Procedure.sql new file mode 100644 index 0000000000..67c139ed31 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ARCHIVE_CAMUNDA_HISTORY-Default Store Procedure.sql @@ -0,0 +1,140 @@ +/* +Camunda Version: 7.5.4-ee; MariaDB tested +Date: 11.30.2016 +Balaji Mudipalli, AJSC Camunda Team + +DOC.: +-------------------------------------------------------------------------------------- +Create ARCHIVE_CAMUNDA_HISTORY StoreProcedure -function for archiving of history camunda tables. +*/ + +/* uncomment below statement and run for your db, e.g. : use camundabpmn; + */ +-- use ; +use camundabpmn; +DROP PROCEDURE IF EXISTS ARCHIVE_CAMUNDA_HISTORY; + +DELIMITER // + +CREATE PROCEDURE ARCHIVE_CAMUNDA_HISTORY(IN IN_periodInDays INT, IN IN_maxProcessInstances INT) +MODIFIES SQL DATA + +BEGIN + DECLARE P_hiTableCount INT; + DECLARE P_executionId BIGINT; + DECLARE P_piProcessed DOUBLE; + DECLARE P_baProcessed DOUBLE; + DECLARE P_startDate DATE; + DECLARE P_executionDuration double; + + DECLARE not_found INT DEFAULT 0; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET not_found = 1; + + /* START TRANSACTION */ + set P_startDate = sysdate(); + set P_executionId = NextVal('STAT_EXECUTION_SEQ'); + + INSERT INTO TMPLOGTABLE SELECT CONCAT('P_executionId value is ',P_executionId); + + DELETE FROM TMP_ARCHIVING_PROCINST; + DELETE FROM TMP_ARCHIVING_BYTEARRAY; + -- temp table -- + DELETE FROM TMPLOGTABLE; + + + /* 1. Set Default Value for Max Pi's */ + IF IN_maxProcessInstances = 0 THEN SET IN_maxProcessInstances = 1000; END IF; + IF IN_maxProcessInstances > 1000 THEN SET IN_maxProcessInstances = 1000; END IF; + + INSERT INTO TMPLOGTABLE SELECT CONCAT('IN_maxProcessInstances value is: ',IN_maxProcessInstances); + + /* 2. Fill TMP_ARCHIVING_PROCINST with candidates: */ + IF IN_maxProcessInstances = 0 THEN /* all */ + INSERT INTO TMP_ARCHIVING_PROCINST + SELECT hi.PROC_INST_ID_, hi.END_TIME_ + FROM ACT_HI_PROCINST hi + WHERE hi.END_TIME_ IS NOT NULL + AND hi.END_TIME_ <= ( DATE_SUB(SYSDATE(), INTERVAL IN_periodInDays DAY)); + + ELSE /* limit: IN_maxProcessInstances */ + INSERT INTO TMP_ARCHIVING_PROCINST + (PROC_INST_ID_, END_TIME_) ( + SELECT hi2.PROC_INST_ID_, hi2.END_TIME_ + FROM ACT_HI_PROCINST hi2 + WHERE hi2.END_TIME_ IS NOT NULL + AND hi2.END_TIME_ <= ( DATE_SUB(SYSDATE(), INTERVAL IN_periodInDays DAY)) + ) LIMIT IN_maxProcessInstances; + END IF; + + /* 3. Check PI's im TEMP if any found, ready for ACHIVING */ + select count(*) INTO P_piProcessed FROM TMP_ARCHIVING_PROCINST; + + IF P_piProcessed = 0 THEN + INSERT INTO TMPLOGTABLE SELECT CONCAT('P_piProcessed value is: ',P_piProcessed); + ROLLBACK; + /* 4. Move data from history to archive (insert to archive and delete in history) */ + ELSE + SELECT COUNT(*)+1 INTO P_hiTableCount FROM camunda_hi_tables; + INSERT INTO TMPLOGTABLE SELECT CONCAT('P_hiTableCount value is ',P_hiTableCount); + SET @i = 1; + WHILE @i < P_hiTableCount + DO + SELECT TableName_ INTO @P_tableName FROM camunda_hi_tables WHERE id_ = @i; + INSERT INTO TMPLOGTABLE SELECT CONCAT('P_tableName: ', @P_tableName); + + Set @P_archiveTableName = Concat('ARCHIVE_',IFNULL(@P_tableName, '')); + INSERT INTO TMPLOGTABLE SELECT CONCAT('@P_archiveTableName: ', @P_archiveTableName); + + SET @query1 = CONCAT('INSERT INTO ', @P_archiveTableName , + ' SELECT hi3.*, ',P_executionId, ', NOW() FROM ', @P_tableName,' hi3 + WHERE hi3.PROC_INST_ID_ in ( SELECT PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST)'); + INSERT INTO TMPLOGTABLE SELECT CONCAT('@query1: ', @query1); + + PREPARE stmt1 FROM @query1; + EXECUTE stmt1; + DEALLOCATE PREPARE stmt1; + + SET @query2 = CONCAT ('DELETE ACT FROM ',@P_tableName,' ACT INNER JOIN TMP_ARCHIVING_PROCINST TMP ON ACT.PROC_INST_ID_ = TMP.PROC_INST_ID_'); + INSERT INTO TMPLOGTABLE SELECT CONCAT('@query2: ', @query2); + + PREPARE stmt2 FROM @query2; + EXECUTE stmt2; + DEALLOCATE PREPARE stmt2; + + SET @i = @i+1; + END WHILE; + /* select bytearray_ids */ + INSERT INTO TMP_ARCHIVING_BYTEARRAY + SELECT BYTEARRAY_ID_, PROC_INST_ID_ FROM ARCHIVE_ACT_HI_VARINST archvar + where archvar.PROC_INST_ID_ in (SELECT PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST) + AND archvar.BYTEARRAY_ID_ is not null; + + INSERT INTO TMP_ARCHIVING_BYTEARRAY + SELECT BYTEARRAY_ID_, PROC_INST_ID_ FROM ARCHIVE_ACT_HI_DETAIL archvar + where archvar.PROC_INST_ID_ in (SELECT PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST) + AND archvar.BYTEARRAY_ID_ is not null; + + /* 5. Check Bytearrays im TEMP if any found, ready for ACHIVING */ + select count(*) INTO P_baProcessed FROM TMP_ARCHIVING_BYTEARRAY; + + /* INSERT */ + INSERT INTO ARCHIVE_ACT_GE_BYTEARRAY + SELECT hi4.*, P_executionId, NOW() FROM ACT_GE_BYTEARRAY hi4 + WHERE hi4.ID_ in ( SELECT BYTEARRAY_ID_ FROM TMP_ARCHIVING_BYTEARRAY); + + /* DELETE */ + DELETE FROM ACT_GE_BYTEARRAY WHERE ID_ in (select BYTEARRAY_ID_ FROM TMP_ARCHIVING_BYTEARRAY); + + /* COMMIT TRANSACTION */ + COMMIT; + INSERT INTO TMPLOGTABLE SELECT CONCAT('P_executionId is ', P_executionId); + + set P_executionDuration = DATEDIFF(sysdate(), P_startDate); + + INSERT INTO TMPLOGTABLE SELECT CONCAT('SP success and P_executionDuration is ', ifnull((round(P_executionDuration*24*60*60, 1)), ''), ' sec.'); + END IF; + + END; +// + +DELIMITER ; \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ROLLB_ARCHIVE_CAMUNDA_HISTORY-StoreProcedure.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ROLLB_ARCHIVE_CAMUNDA_HISTORY-StoreProcedure.sql new file mode 100644 index 0000000000..f3ba294dba --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/ROLLB_ARCHIVE_CAMUNDA_HISTORY-StoreProcedure.sql @@ -0,0 +1,210 @@ +/* +Camunda Version: 7.5.4-ee; MariaDB tested +Date: 11.30.2016 +Balaji Mudipalli, AJSC Camunda Team + +DOC.: +-------------------------------------------------------------------------------------- +Create ROLLB_ARCHIVE_CAMUNDA_HISTORY StoreProcedure for ROLLBACK (RESTORE) +of archived Camunda history tables. +*/ + +/* uncomment below statement and run for your db, e.g. : use camundabpmn; + */ +-- use ; +use camundabpmn; + +DROP PROCEDURE IF EXISTS ROLLB_ARCHIVE_CAMUNDA_HISTORY; + +DELIMITER // +CREATE PROCEDURE ROLLB_ARCHIVE_CAMUNDA_HISTORY(IN IN_executionId_from INT, + IN IN_executionId_til INT, + IN IN_maxProcessInstances INT) +MODIFIES SQL DATA + +BEGIN + DECLARE P_hiTableCount INT; + DECLARE P_piProcessed DOUBLE; + DECLARE P_baProcessed DOUBLE; + DECLARE P_query VARCHAR(600); + DECLARE P_startDate DATETIME; + DECLARE P_executionDuration DOUBLE; + DECLARE P_result NVARCHAR(400); +DECLARE not_found INT DEFAULT 0; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET not_found = 1; + + + /* START TRANSACTION */ + SET P_startDate = sysdate(); + DELETE FROM TMPLOGTABLE; + + INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: START EXECUTION: ' , ifnull(date_format(current_timestamp, '%d.%m.%Y %H:%i:%s ..FF3'), '') , + '; PARAMS: IN_executionId_from: ' , IFNULL(IN_executionId_from, '') , + '; IN_executionId_til: ' , IFNULL(IN_executionId_til, '') , + '; IN_maxProcessInstances: ' , IFNULL(IN_maxProcessInstances, '')); + + /* 1. Truncate TMP_ARCHIVING_PROCINST */ + + DELETE FROM TMP_ARCHIVING_PROCINST; + DELETE FROM TMP_ARCHIVING_BYTEARRAY; + + /* 2. Fill TMP_ARCHIVING_PROCINST with candidates: */ + IF IN_executionId_til = -1 THEN /* IN_executionId_from only */ + SET P_query= CONCAT(' WHERE STAT_EXECUTION_ID = ' , IFNULL(IN_executionId_from, '')); + + ELSEIF IN_executionId_til = 0 THEN /* all from IN_executionId_from */ + SET P_query= CONCAT(' WHERE STAT_EXECUTION_ID >= ' , IFNULL(IN_executionId_from, '')); + + ELSE /* between IN_executionId_from AND IN_executionId_til */ + SET P_query= CONCAT(' WHERE STAT_EXECUTION_ID between ', IFNULL(IN_executionId_from, '') , ' AND ' , IFNULL(IN_executionId_til, '')); + END IF; + + IF IN_maxProcessInstances = 0 THEN /* all */ + + SET @P_query1 = CONCAT('INSERT INTO TMP_ARCHIVING_PROCINST ', ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' SELECT PROC_INST_ID_, END_TIME_ FROM ARCHIVE_ACT_HI_PROCINST ', ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' ', Ifnull(P_query, '')); + + ELSE /* limit: IN_maxProcessInstances */ + SET @P_query1 = CONCAT('INSERT INTO TMP_ARCHIVING_PROCINST ' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' (PROC_INST_ID_, END_TIME_ ) ( ' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' SELECT PROC_INST_ID_, END_TIME_ FROM ARCHIVE_ACT_HI_PROCINST ' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' ', Ifnull(P_query, '') , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ') LIMIT ', IFNULL(IN_maxProcessInstances, '')); + END IF; + + INSERT INTO TMPLOGTABLE SELECT CONCAT('QUERY (before execute): /fill temp table with PI candidates/ ' , Ifnull(P_query, '')); + + PREPARE stmt1 FROM @P_query1; + EXECUTE stmt1; + DEALLOCATE PREPARE stmt1; + + INSERT INTO TMPLOGTABLE SELECT CONCAT('.... rows inserted into TMP_ARCHIVING_PROCINST: ' , IFNULL((ROW_COUNT()), '')); + + /* 3. Fill TMP_ARCHIVING_BYTEARRAYS with candidates: */ + INSERT INTO TMP_ARCHIVING_BYTEARRAY + SELECT BYTEARRAY_ID_, PROC_INST_ID_ FROM ARCHIVE_ACT_HI_VARINST archvar + where archvar.PROC_INST_ID_ in (SELECT PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST) + AND archvar.BYTEARRAY_ID_ is not null; + + INSERT INTO TMP_ARCHIVING_BYTEARRAY + SELECT BYTEARRAY_ID_, PROC_INST_ID_ FROM ARCHIVE_ACT_HI_DETAIL archvar + where archvar.PROC_INST_ID_ in (SELECT PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST) + AND archvar.BYTEARRAY_ID_ is not null; + + select count(*) INTO P_baProcessed FROM TMP_ARCHIVING_BYTEARRAY; + INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: ', IFNULL(P_baProcessed, '') ,' ByteArray candidates for rollback found!' , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '')); + + + /* 4. Check PI's im TEMP ready for ROLLBACK */ + select count(*) INTO P_piProcessed FROM TMP_ARCHIVING_PROCINST; + + IF P_piProcessed = 0 THEN /* no candidates found */ + INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: NO ProcessInstance-Candidates for archive-Rollback found! '); + INSERT INTO TMPLOGTABLE SELECT CONCAT('Try TA-ROLLBACK ...'); + ROLLBACK; /*-- TMP_ARCHIVING_PROCINST un-Delete */ + INSERT INTO TMPLOGTABLE SELECT CONCAT('TA-ROLLBACK DONE! ...' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '')); + + SET P_result = CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: NO ProcessInstance candidates for archive-Rollback found!', ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ifnull(date_format(current_timestamp, '%d.%m.%Y %H:%i:%s ..FF3'), '') , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' Used PARAMS: IN_executionId_from: ' , IFNULL(IN_executionId_from, '') , + '; IN_executionId_til: ' , IFNULL(IN_executionId_til, '') , + '; IN_maxProcessInstances: ' , IFNULL(IN_maxProcessInstances, '')); + + INSERT INTO TMPLOGTABLE SELECT CONCAT(P_result); + + ELSE + INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: ', IFNULL(P_piProcessed, '') ,' ProcessInstance candidates for Rollback found!'); + + /* LOOP over tables */ + SELECT COUNT(*)+1 INTO P_hiTableCount FROM camunda_hi_tables; + + INSERT INTO TMPLOGTABLE SELECT CONCAT('P_hiTableCount value is ',P_hiTableCount); + + SET @i = 1; + + WHILE @i < P_hiTableCount + DO + SELECT TableName_ INTO @P_tableName FROM camunda_hi_tables WHERE id_ = @i; + + INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: ####### Start restore from: ARCHIVE_' , IFNULL(@P_tableName, '') ,' ...'); + + SET @P_tableFields = CONCAT(''); + + select GROUP_CONCAT(column_name order by ordinal_position) + INTO @P_tableFields + from information_schema.columns + where table_schema = (select DATABASE()) AND TABLE_NAME = @P_tableName; + + /* INSERT */ + SET @P_query2 = CONCAT('INSERT INTO ', IFNULL(@P_tableName, '') , + ' SELECT ' , @P_tableFields, + ' FROM ARCHIVE_' , IFNULL(@P_tableName, '') , + ' WHERE PROC_INST_ID_ in ( SELECT tmp.PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST tmp)'); + + INSERT INTO TMPLOGTABLE SELECT CONCAT('QUERY (before execute): /copy back to history table/ ' , Ifnull(@P_query2, '')); + + PREPARE stmt2 FROM @P_query2; + EXECUTE stmt2; + DEALLOCATE PREPARE stmt2; + + INSERT INTO TMPLOGTABLE SELECT Concat('.... rows inserted: ' , IFNULL((ROW_COUNT()), '')); + + /* DELETE */ + INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: Delete in Archive: ARCHIVE_' , IFNULL(@P_tableName, '') ,' ...'); + /* SET @P_query3 = CONCAT(' DELETE FROM ARCHIVE_' , IFNULL(@P_tableName, '') , ' WHERE PROC_INST_ID_ in (select PROC_INST_ID_ FROM TMP_ARCHIVING_PROCINST)'); */ + SET @P_query3 = CONCAT('DELETE ARCH FROM ARCHIVE_' , IFNULL(@P_tableName, '') , + ' ARCH INNER JOIN TMP_ARCHIVING_PROCINST TMP ON ARCH.PROC_INST_ID_ = TMP.PROC_INST_ID_'); + INSERT INTO TMPLOGTABLE SELECT CONCAT('QUERY (before execute): ' , Ifnull(@P_query3, '')); + PREPARE stmt3 FROM @P_query3; + EXECUTE stmt3; + DEALLOCATE PREPARE stmt3; + + INSERT INTO TMPLOGTABLE SELECT Concat('.... rows deleted: ' , IFNULL((ROW_COUNT()), '') , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '')); + + SET @i = @i+1; + END WHILE; + + /* INSERT */ + SET @P_tableFields2 = CONCAT(''); /* reset, becouse had some problems with double columns */ + /* fetch table column names into P_tableFields : */ + select GROUP_CONCAT(COLUMN_NAME order by ordinal_position) + INTO @P_tableFields2 + from information_schema.columns + where table_schema = (select DATABASE()) AND TABLE_NAME = 'ACT_GE_BYTEARRAY'; + + SET @P_query4 = CONCAT('INSERT INTO ACT_GE_BYTEARRAY ' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' SELECT ' , IFNULL(@P_tableFields2, '') ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' FROM ARCHIVE_ACT_GE_BYTEARRAY' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' WHERE ID_ in ( SELECT tmp.BYTEARRAY_ID_ FROM TMP_ARCHIVING_BYTEARRAY tmp)'); + INSERT INTO TMPLOGTABLE SELECT CONCAT('QUERY (before execute): /copy back to history table/ ' , Ifnull(@P_query4, '')); + PREPARE stmt4 FROM @P_query4; + EXECUTE stmt4; + DEALLOCATE PREPARE stmt4; + INSERT INTO TMPLOGTABLE SELECT Concat('.... rows inserted: ' , IFNULL((ROW_COUNT()), '')); + + /* DELETE */ + /* DELETE FROM ARCHIVE_ACT_GE_BYTEARRAY WHERE ID_ in (select BYTEARRAY_ID_ FROM TMP_ARCHIVING_BYTEARRAY); */ + DELETE AAGB FROM ARCHIVE_ACT_GE_BYTEARRAY AAGB INNER JOIN TMP_ARCHIVING_BYTEARRAY TMP_B ON AAGB.ID_ = TMP_B.BYTEARRAY_ID_; + INSERT INTO TMPLOGTABLE SELECT Concat('.... rows deleted: ' , IFNULL((ROW_COUNT()), '') , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '')); + + /* COMMIT TRANSACTION */ + INSERT INTO TMPLOGTABLE SELECT CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: PIs processed: ' , IFNULL(P_piProcessed, '')) ; + COMMIT; + INSERT INTO TMPLOGTABLE SELECT CONCAT('TA-COMMIT DONE!' ,ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '')); + + SET P_executionDuration = DATEDIFF(sysdate(), P_startDate); + + SET P_result = CONCAT('[ROLLB_ARCHIVE_CAMUNDA_HISTORY]: EXECUTED (commited) successfully! ' , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ifnull(date_format(current_timestamp, '%d.%m.%Y %H:%i:%s ..FF3'), '') , '; Duration: ' , ifnull((round(P_executionDuration*24*60*60, 1)), ''), ' sec.' , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), '') , + ' PIs processed: ' , IFNULL(P_piProcessed, '') , ifnull(char(13 using ascii), ''),ifnull(char(10 using ascii), ''), + ' Used PARAMS: IN_executionId_from: ' , IFNULL(IN_executionId_from, '') , + '; IN_executionId_til: ' , IFNULL(IN_executionId_til, '') , + '; IN_maxProcessInstances: ' , IFNULL(IN_maxProcessInstances, '')); + + INSERT INTO TMPLOGTABLE SELECT CONCAT(P_result); + END IF; + END; +// + +DELIMITER ; diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql new file mode 100644 index 0000000000..10e9930720 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/drop_mariadb_engine_7.5.6.sql @@ -0,0 +1,76 @@ +-- Fix for https://itrack.web.att.com/browse/AJSCCMDA-90 -- +use camundabpmn; +/* +Drop a archive tables +*/ +/*-- TMP_ARCHIVING_PROCINST */ +DROP TABLE IF EXISTS TMP_ARCHIVING_PROCINST; + +/*-- TMP_ARCHIVING_BYTEARRAY */ +DROP TABLE IF EXISTS TMP_ARCHIVING_BYTEARRAY; + +/*-- TMP LOG TABLE */ +DROP TABLE IF EXISTS TMPLOGTABLE; + +/* -- Camunda Hi Tables --*/ +DROP TABLE IF EXISTS Camunda_Hi_Tables; + +/* drop own extentions columns: +alter table ARCHIVE_ACT_HI_PROCINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_ACTINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_TASKINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_VARINST DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_DETAIL DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_COMMENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_ATTACHMENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_OP_LOG DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +alter table ARCHIVE_ACT_HI_INCIDENT DROP (STAT_EXECUTION_ID, STAT_EXECUTION_TS); +*/ + +/*--#1 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_PROCINST; +/*--#2 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_ACTINST; +/*--#3 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_TASKINST; +/*--#4 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_VARINST; +/*--#5 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_DETAIL; +/*--#6 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_COMMENT; +/*--#7 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_ATTACHMENT; +/*--#8 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_OP_LOG; +/*--#9 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_HI_INCIDENT; +/*--#10 */ +DROP TABLE IF EXISTS ARCHIVE_ACT_GE_BYTEARRAY; + +/* drop PL SQL procedures: */ +DROP PROCEDURE IF EXISTS ARCHIVE_CAMUNDA_HISTORY; +DROP PROCEDURE IF EXISTS ROLLB_ARCHIVE_CAMUNDA_HISTORY; + +/*-- Sequence */ +-- as sequence drop doesn't work automatically in MariaDB, use this procedure to drop sequence + DROP PROCEDURE IF EXISTS DropSequence; + + DELIMITER // + + CREATE PROCEDURE DropSequence (vname VARCHAR(30)) + BEGIN + -- Drop the sequence + DELETE FROM _sequences WHERE name = vname; + END + // + DELIMITER ; + +-- use the above procedure to drop sequence +CALL DropSequence('STAT_EXECUTION_SEQ'); + +/*-- To Drop the MariaDB specific user defined procedures and functions */ +DROP FUNCTION IF EXISTS NextVal; +DROP PROCEDURE IF EXISTS CreateSequence; +DROP PROCEDURE IF EXISTS DropSequence; +DROP TABLE IF EXISTS _sequences; \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql new file mode 100644 index 0000000000..8c7faa0792 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Archive/mariadb_engine_7.5_patch_7.5.6.sql @@ -0,0 +1,222 @@ +-- Fix for https://itrack.web.att.com/browse/AJSCCMDA-90 -- +use camundabpmn; +/* + 1. Add some Camunda Indexes to history schema part (for Archiving) +*/ +create INDEX IF NOT EXISTS IDX_ACT_HI_TASKINST_PIID ON ACT_HI_TASKINST (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_COMMENT_PIID ON ACT_HI_COMMENT (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_ATTACHMENT_PIID ON ACT_HI_ATTACHMENT (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_OP_LOG_PIID ON ACT_HI_OP_LOG (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_INCIDENT_PIID ON ACT_HI_INCIDENT (PROC_INST_ID_); +create INDEX IF NOT EXISTS IDX_ACT_HI_ACTINST_PIID ON ACT_HI_ACTINST(PROC_INST_ID_); + + +/* + 2. Create Archiving Tables in current schema +*/ + +/*-- TMP_ARCHIVING_PROCINST */ +CREATE TABLE TMP_ARCHIVING_PROCINST +( PROC_INST_ID_ varchar(64) not null, + END_TIME_ datetime(3) +); +CREATE INDEX AI_TMP_ARCH_PROCINST_PI_ID ON TMP_ARCHIVING_PROCINST(PROC_INST_ID_); + +/*-- TMP_ARCHIVING_BYTEARRAY */ +CREATE TABLE TMP_ARCHIVING_BYTEARRAY +( BYTEARRAY_ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) +); +CREATE INDEX AI_TMP_ARCH_BYTEARRAY_BAID ON TMP_ARCHIVING_BYTEARRAY(BYTEARRAY_ID_); + + +/*--#1 ARCHIVE_ACT_HI_PROCINST; */ +create TABLE ARCHIVE_ACT_HI_PROCINST +AS ( select * from ACT_HI_PROCINST where 1=0); + +create index AI_HI_PROCINST_END_TIME on ARCHIVE_ACT_HI_PROCINST(END_TIME_); +ALTER TABLE ARCHIVE_ACT_HI_PROCINST ADD CONSTRAINT ARCHIVE_ACT_HI_PROCINST_UQ UNIQUE ( PROC_INST_ID_); + +/*--#2 ARCHIVE_ACT_HI_ACTINST; */ +create TABLE ARCHIVE_ACT_HI_ACTINST +AS ( select * from ACT_HI_ACTINST where 1=0); + +create index AI_HI_ACTINST_PROC_INST_ID on ARCHIVE_ACT_HI_ACTINST(PROC_INST_ID_); +create index AI_HI_ACTINST_END_TIME on ARCHIVE_ACT_HI_ACTINST(END_TIME_); + +/*--#3 ARCHIVE_ACT_HI_TASKINST; */ +create TABLE ARCHIVE_ACT_HI_TASKINST +AS ( select * from ACT_HI_TASKINST where 1=0); + +create index AI_HI_TASKINST_PROC_INST_ID on ARCHIVE_ACT_HI_TASKINST(PROC_INST_ID_); +create index AI_HI_TASKINST_END_TIME on ARCHIVE_ACT_HI_TASKINST(END_TIME_); + +/*--#4 ARCHIVE_ACT_HI_VARINST; */ +create TABLE ARCHIVE_ACT_HI_VARINST +AS ( select * from ACT_HI_VARINST where 1=0); + +create index AI_HI_VARINST_PROC_INST_ID on ARCHIVE_ACT_HI_VARINST(PROC_INST_ID_); + +/*--#5 ARCHIVE_ACT_HI_DETAIL; */ +create TABLE ARCHIVE_ACT_HI_DETAIL +AS ( select * from ACT_HI_DETAIL where 1=0); + +create index AI_HI_DETAIL_PROC_INST_ID on ARCHIVE_ACT_HI_DETAIL(PROC_INST_ID_); +create index AI_HI_DETAIL_TIME on ARCHIVE_ACT_HI_DETAIL(TIME_); + +/*--#6 ARCHIVE_ACT_HI_COMMENT; */ +create TABLE ARCHIVE_ACT_HI_COMMENT +AS ( select * from ACT_HI_COMMENT where 1=0); + +create index AI_HI_COMMENT_PROC_INST_ID on ARCHIVE_ACT_HI_COMMENT(PROC_INST_ID_); +create index AI_HI_COMMENT_TIME on ARCHIVE_ACT_HI_COMMENT(TIME_); + +/*--#7 ARCHIVE_ACT_HI_ATTACHMENT; */ +create TABLE ARCHIVE_ACT_HI_ATTACHMENT +AS ( select * from ACT_HI_ATTACHMENT where 1=0); + +create index AI_HI_ATTACHMENT_PROC_INST_ID on ARCHIVE_ACT_HI_ATTACHMENT(PROC_INST_ID_); + +/*--#8 ARCHIVE_ACT_HI_OP_LOG; */ +create TABLE ARCHIVE_ACT_HI_OP_LOG +AS ( select * from ACT_HI_OP_LOG where 1=0); + +create index AI_HI_OP_LOG_PROC_INST_ID on ARCHIVE_ACT_HI_OP_LOG(PROC_INST_ID_); +create index AI_HI_OP_LOG_TIMESTAMP on ARCHIVE_ACT_HI_OP_LOG(TIMESTAMP_); + +/*--#9 ARCHIVE_ACT_HI_INCIDENT; */ +create TABLE ARCHIVE_ACT_HI_INCIDENT +AS ( select * from ACT_HI_INCIDENT where 1=0); + +create index AI_HI_INCIDENT_PROC_INST_ID on ARCHIVE_ACT_HI_INCIDENT(PROC_INST_ID_); + +/*--#10 ARCHIVE_ACT_GE_BYTEARRAY; */ +create TABLE ARCHIVE_ACT_GE_BYTEARRAY +AS ( select * from ACT_GE_BYTEARRAY where 1=0); + +create index AI_GE_BYTEARRAY_ID_ on ARCHIVE_ACT_GE_BYTEARRAY(ID_); + +/* ----------------------------------------------------------------------------- +Extend a ARCHIVE: Table by two attributes: STAT_EXECUTION_ID, STAT_EXECUTION_TS +*/ + +/* +--TEMPLATE: +alter table ARCHIVE_%TableName% + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_%TableName%_EXE_ID ON ARCHIVE_%TableName%(STAT_EXECUTION_ID); +*/ + + +/*--#1 ACT_HI_PROCINST */ +alter table ARCHIVE_ACT_HI_PROCINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_PROCINST_EXE_ID ON ARCHIVE_ACT_HI_PROCINST(STAT_EXECUTION_ID); + +/*--#2 ACT_HI_ACTINST */ +alter table ARCHIVE_ACT_HI_ACTINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_ACTINST_EXE_ID ON ARCHIVE_ACT_HI_ACTINST(STAT_EXECUTION_ID); + +/*--#3 ACT_HI_TASKINST */ +alter table ARCHIVE_ACT_HI_TASKINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_TASKINST_EXE_ID ON ARCHIVE_ACT_HI_TASKINST(STAT_EXECUTION_ID); + +/*--#4 ACT_HI_VARINST */ +alter table ARCHIVE_ACT_HI_VARINST + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_VARINST_EXE_ID ON ARCHIVE_ACT_HI_VARINST(STAT_EXECUTION_ID); + +/*--#5 ACT_HI_DETAIL */ +alter table ARCHIVE_ACT_HI_DETAIL + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_DETAIL_EXE_ID ON ARCHIVE_ACT_HI_DETAIL(STAT_EXECUTION_ID); + +/*--#6 ACT_HI_COMMENT */ +alter table ARCHIVE_ACT_HI_COMMENT + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_COMMENT_EXE_ID ON ARCHIVE_ACT_HI_COMMENT(STAT_EXECUTION_ID); + +/*--#7 ACT_HI_ATTACHMENT */ +alter table ARCHIVE_ACT_HI_ATTACHMENT + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_ATTACHMENT_EXE_ID ON ARCHIVE_ACT_HI_ATTACHMENT(STAT_EXECUTION_ID); + +/*--#8 ACT_HI_OP_LOG */ +alter table ARCHIVE_ACT_HI_OP_LOG + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_OP_LOG_EXE_ID ON ARCHIVE_ACT_HI_OP_LOG(STAT_EXECUTION_ID); + +/*--#9 ACT_HI_INCIDENT */ +alter table ARCHIVE_ACT_HI_INCIDENT + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_HI_INCIDENT_EXE_ID ON ARCHIVE_ACT_HI_INCIDENT(STAT_EXECUTION_ID); + +/*--#10 ACT_GE_BYTEARRAY */ +alter table ARCHIVE_ACT_GE_BYTEARRAY + add (STAT_EXECUTION_ID bigint, STAT_EXECUTION_TS timestamp(0) DEFAULT CURRENT_TIMESTAMP ); +CREATE INDEX AI_ACT_GE_BYTEARRAY_EXE_ID ON ARCHIVE_ACT_GE_BYTEARRAY(STAT_EXECUTION_ID); + + +/* -- Next Val as a user defined function needed only in MariaDB--*/ +DROP FUNCTION IF EXISTS NextVal; + DELIMITER // + CREATE FUNCTION NextVal (vname VARCHAR(30)) + RETURNS INT + BEGIN + -- Retrieve and update in single statement + UPDATE _sequences + SET next = next + 1 + WHERE name = vname; + + RETURN (SELECT next FROM _sequences LIMIT 1); + END + // + DELIMITER ; + +/* -- History tables for use in archive procedure, there is no array type in MariaDB --*/ +Create Table Camunda_Hi_Tables (id_ MEDIUMINT NOT NULL AUTO_INCREMENT, + TableName_ varchar(80) NOT NULL, + PRIMARY KEY (id_)); + +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_PROCINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_ACTINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_TASKINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_VARINST'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_DETAIL'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_COMMENT'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_ATTACHMENT'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_OP_LOG'); +Insert Into Camunda_Hi_Tables(TableName_) Values ('ACT_HI_INCIDENT'); + +/*-- log table --*/ +CREATE TABLE TMPLOGTABLE (LogMessage Varchar(700)); + + +/* -- Below user defined functions and procedures needed only in MariaDB, they are in-built in Oracle --*/ +/*-- Create a sequence SP */ +DROP PROCEDURE IF EXISTS CreateSequence; + DELIMITER // + CREATE PROCEDURE CreateSequence (name VARCHAR(30), start INT, inc INT) + BEGIN + -- Create a table to store sequences + CREATE TABLE IF NOT EXISTS _sequences + ( + name VARCHAR(70) NOT NULL UNIQUE, + next INT NOT NULL, + inc INT NOT NULL + ); + + -- Add the new sequence + INSERT INTO _sequences VALUES (name, start, inc); + END + // + DELIMITER ; + +/*-------------------------------------------------------------------------------------------------- + Add Meta to Archive + -------------------------------------------------------------------------------------------------- */ + +/* Create STAT_EXECUTION_SEQ: each Archive Entry has a same Execution ID during one Archiving Run */ +CALL CreateSequence('STAT_EXECUTION_SEQ', 1, 1); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql new file mode 100644 index 0000000000..bf866b4878 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Cleanup/create_mariadb_camunda7.5.6_ee.sql @@ -0,0 +1,1127 @@ + +# Start of Statements added for MSO +DROP DATABASE IF EXISTS `camundabpmn`; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `camundabpmn` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `camundabpmn`; + +# DROP USER IF EXISTS 'camunda'; +#delete from mysql.user where User='camunda'; +#CREATE USER 'camunda'; +#GRANT ALL on camundabpmn.* to 'camunda' identified by 'camunda123' with GRANT OPTION; +FLUSH PRIVILEGES; +# End of Statements added for MSO + + +create table ACT_GE_PROPERTY ( + NAME_ varchar(64), + VALUE_ varchar(300), + REV_ integer, + primary key (NAME_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +insert into ACT_GE_PROPERTY +values ('schema.version', 'fox', 1); + +insert into ACT_GE_PROPERTY +values ('schema.history', 'create(fox)', 1); + +insert into ACT_GE_PROPERTY +values ('next.dbid', '1', 1); + +insert into ACT_GE_PROPERTY +values ('deployment.lock', '0', 1); + +create table ACT_GE_BYTEARRAY ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + BYTES_ LONGBLOB, + GENERATED_ TINYINT, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RE_DEPLOYMENT ( + ID_ varchar(64), + NAME_ varchar(255), + DEPLOY_TIME_ timestamp(3), + SOURCE_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EXECUTION ( + ID_ varchar(64), + REV_ integer, + PROC_INST_ID_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + SUPER_EXEC_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + IS_ACTIVE_ TINYINT, + IS_CONCURRENT_ TINYINT, + IS_SCOPE_ TINYINT, + IS_EVENT_SCOPE_ TINYINT, + SUSPENSION_STATE_ integer, + CACHED_ENT_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_JOB ( + ID_ varchar(64) NOT NULL, + REV_ integer, + TYPE_ varchar(255) NOT NULL, + LOCK_EXP_TIME_ timestamp(3) NULL, + LOCK_OWNER_ varchar(255), + EXCLUSIVE_ boolean, + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + RETRIES_ integer, + EXCEPTION_STACK_ID_ varchar(64), + EXCEPTION_MSG_ varchar(4000), + DUEDATE_ timestamp(3) NULL, + REPEAT_ varchar(255), + HANDLER_TYPE_ varchar(255), + HANDLER_CFG_ varchar(4000), + DEPLOYMENT_ID_ varchar(64), + SUSPENSION_STATE_ integer NOT NULL DEFAULT 1, + JOB_DEF_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_JOBDEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + JOB_TYPE_ varchar(255) NOT NULL, + JOB_CONFIGURATION_ varchar(255), + SUSPENSION_STATE_ integer, + JOB_PRIORITY_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RE_PROCDEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + HAS_START_FORM_KEY_ TINYINT, + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + VERSION_TAG_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_TASK ( + ID_ varchar(64), + REV_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + TASK_DEF_KEY_ varchar(255), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + DELEGATION_ varchar(64), + PRIORITY_ integer, + CREATE_TIME_ timestamp(3), + DUE_DATE_ datetime(3), + FOLLOW_UP_DATE_ datetime(3), + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_IDENTITYLINK ( + ID_ varchar(64), + REV_ integer, + GROUP_ID_ varchar(255), + TYPE_ varchar(255), + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_VARIABLE ( + ID_ varchar(64) not null, + REV_ integer, + TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + TASK_ID_ varchar(64), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + VAR_SCOPE_ varchar(64) not null, + SEQUENCE_COUNTER_ bigint, + IS_CONCURRENT_LOCAL_ TINYINT, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EVENT_SUBSCR ( + ID_ varchar(64) not null, + REV_ integer, + EVENT_TYPE_ varchar(255) not null, + EVENT_NAME_ varchar(255), + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTIVITY_ID_ varchar(64), + CONFIGURATION_ varchar(255), + CREATED_ timestamp(3) not null, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_INCIDENT ( + ID_ varchar(64) not null, + REV_ integer not null, + INCIDENT_TIMESTAMP_ timestamp(3) not null, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + ACTIVITY_ID_ varchar(255), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_AUTHORIZATION ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ integer not null, + GROUP_ID_ varchar(255), + USER_ID_ varchar(255), + RESOURCE_TYPE_ integer not null, + RESOURCE_ID_ varchar(64), + PERMS_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_FILTER ( + ID_ varchar(64) not null, + REV_ integer not null, + RESOURCE_TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + OWNER_ varchar(255), + QUERY_ LONGTEXT not null, + PROPERTIES_ LONGTEXT, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_METER_LOG ( + ID_ varchar(64) not null, + NAME_ varchar(64) not null, + REPORTER_ varchar(255), + VALUE_ bigint, + TIMESTAMP_ timestamp(3) not null, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EXT_TASK ( + ID_ varchar(64) not null, + REV_ integer not null, + WORKER_ID_ varchar(255), + TOPIC_NAME_ varchar(255), + RETRIES_ integer, + ERROR_MSG_ varchar(4000), + LOCK_EXP_TIME_ timestamp(3) NULL, + SUSPENSION_STATE_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + TENANT_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_BATCH ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_CREATED_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + SUSPENSION_STATE_ integer, + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_); +create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_); +create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_); +create index ACT_IDX_TASK_ASSIGNEE on ACT_RU_TASK(ASSIGNEE_); +create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_); +create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_); +create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_); +create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_); +create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_); +create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_); +create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); +create index ACT_IDX_INC_CONFIGURATION on ACT_RU_INCIDENT(CONFIGURATION_); +create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_); +create index ACT_IDX_JOB_PROCINST on ACT_RU_JOB(PROCESS_INSTANCE_ID_); +create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_); +create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_); +create index ACT_IDX_METER_LOG on ACT_RU_METER_LOG(NAME_,TIMESTAMP_); +create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_); +create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_); +create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_); +create index ACT_IDX_AUTH_GROUP_ID ON ACT_RU_AUTHORIZATION(GROUP_ID_); +create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_); + +alter table ACT_GE_BYTEARRAY + add constraint ACT_FK_BYTEARR_DEPL + foreign key (DEPLOYMENT_ID_) + references ACT_RE_DEPLOYMENT (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade; + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_SUPER + foreign key (SUPER_EXEC_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_TSKASS_TASK + foreign key (TASK_ID_) + references ACT_RU_TASK (ID_); + +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_ATHRZ_PROCEDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF(ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION(ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_BYTEARRAY + foreign key (BYTEARRAY_ID_) + references ACT_GE_BYTEARRAY (ID_); + +alter table ACT_RU_JOB + add constraint ACT_FK_JOB_EXCEPTION + foreign key (EXCEPTION_STACK_ID_) + references ACT_GE_BYTEARRAY (ID_); + +alter table ACT_RU_EVENT_SUBSCR + add constraint ACT_FK_EVENT_EXEC + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION(ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_CAUSE + foreign key (CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_RCAUSE + foreign key (ROOT_CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; + +create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_); +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_JOB_DEF + foreign key (JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_USER + unique (USER_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_GROUP + unique (GROUP_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_UNIQ_VARIABLE + unique (VAR_SCOPE_, NAME_); + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_SEED_JOB_DEF + foreign key (SEED_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_MONITOR_JOB_DEF + foreign key (MONITOR_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_JOB_DEF + foreign key (BATCH_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +-- indexes for deadlock problems - https://app.camunda.com/jira/browse/CAM-2567 -- +create index ACT_IDX_INC_CAUSEINCID on ACT_RU_INCIDENT(CAUSE_INCIDENT_ID_); +create index ACT_IDX_INC_EXID on ACT_RU_INCIDENT(EXECUTION_ID_); +create index ACT_IDX_INC_PROCDEFID on ACT_RU_INCIDENT(PROC_DEF_ID_); +create index ACT_IDX_INC_PROCINSTID on ACT_RU_INCIDENT(PROC_INST_ID_); +create index ACT_IDX_INC_ROOTCAUSEINCID on ACT_RU_INCIDENT(ROOT_CAUSE_INCIDENT_ID_); +-- index for deadlock problem - https://app.camunda.com/jira/browse/CAM-4440 -- +create index ACT_IDX_AUTH_RESOURCE_ID on ACT_RU_AUTHORIZATION(RESOURCE_ID_); +-- index to prevent deadlock on fk constraint - https://app.camunda.com/jira/browse/CAM-5440 -- +create index ACT_IDX_EXT_TASK_EXEC on ACT_RU_EXT_TASK(EXECUTION_ID_); + +-- indexes to improve deployment +create index ACT_IDX_BYTEARRAY_NAME on ACT_GE_BYTEARRAY(NAME_); +create index ACT_IDX_DEPLOYMENT_NAME on ACT_RE_DEPLOYMENT(NAME_); +create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_); +create index ACT_IDX_JOBDEF_PROC_DEF_ID ON ACT_RU_JOBDEF(PROC_DEF_ID_); +create index ACT_IDX_JOB_HANDLER_TYPE ON ACT_RU_JOB(HANDLER_TYPE_); +create index ACT_IDX_EVENT_SUBSCR_EVT_NAME ON ACT_RU_EVENT_SUBSCR(EVENT_NAME_); +create index ACT_IDX_PROCDEF_DEPLOYMENT_ID ON ACT_RE_PROCDEF(DEPLOYMENT_ID_); +create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_); +create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); +-- create case definition table -- +create table ACT_RE_CASE_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create case execution table -- +create table ACT_RU_CASE_EXECUTION ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + SUPER_EXEC_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + ACT_ID_ varchar(255), + PREV_STATE_ integer, + CURRENT_STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create case sentry part table -- + +create table ACT_RU_CASE_SENTRY_PART ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + CASE_EXEC_ID_ varchar(64), + SENTRY_ID_ varchar(255), + TYPE_ varchar(255), + SOURCE_CASE_EXEC_ID_ varchar(64), + STANDARD_EVENT_ varchar(255), + SOURCE_ varchar(255), + SATISFIED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create index on business key -- +create index ACT_IDX_CASE_EXEC_BUSKEY on ACT_RU_CASE_EXECUTION(BUSINESS_KEY_); + +-- create foreign key constraints on ACT_RU_CASE_EXECUTION -- +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_) on delete cascade on update cascade; + +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_VARIABLE -- +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +-- create foreign key constraints on ACT_RU_TASK -- +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_CASE_SENTRY_PART -- +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_EXEC + foreign key (CASE_EXEC_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_); +create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_); +-- create decision definition table -- +create table ACT_RE_DECISION_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_); + +create table ACT_HI_PROCINST ( + ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + START_USER_ID_ varchar(255), + START_ACT_ID_ varchar(255), + END_ACT_ID_ varchar(255), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + SUPER_CASE_INSTANCE_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + DELETE_REASON_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_), + unique (PROC_INST_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_ACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + EXECUTION_ID_ varchar(64) not null, + ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + ACT_NAME_ varchar(255), + ACT_TYPE_ varchar(255) not null, + ASSIGNEE_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + ACT_INST_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_TASKINST ( + ID_ varchar(64) not null, + TASK_DEF_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + DELETE_REASON_ varchar(4000), + PRIORITY_ integer, + DUE_DATE_ datetime(3), + FOLLOW_UP_DATE_ datetime(3), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_VARINST ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(100), + REV_ integer, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_DETAIL ( + ID_ varchar(64) not null, + TYPE_ varchar(255) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + VAR_INST_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(255), + REV_ integer, + TIME_ datetime(3) not null, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_IDENTITYLINK ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + TYPE_ varchar(255), + USER_ID_ varchar(255), + GROUP_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + OPERATION_TYPE_ varchar(64), + ASSIGNER_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_COMMENT ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TIME_ datetime(3) not null, + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTION_ varchar(255), + MESSAGE_ varchar(4000), + FULL_MSG_ LONGBLOB, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_ATTACHMENT ( + ID_ varchar(64) not null, + REV_ integer, + USER_ID_ varchar(255), + NAME_ varchar(255), + DESCRIPTION_ varchar(4000), + TYPE_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + URL_ varchar(4000), + CONTENT_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_OP_LOG ( + ID_ varchar(64) not null, + DEPLOYMENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + JOB_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + BATCH_ID_ varchar(64), + USER_ID_ varchar(255), + TIMESTAMP_ timestamp(3) not null, + OPERATION_TYPE_ varchar(64), + OPERATION_ID_ varchar(64), + ENTITY_TYPE_ varchar(30), + PROPERTY_ varchar(64), + ORG_VALUE_ varchar(4000), + NEW_VALUE_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_INCIDENT ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CREATE_TIME_ timestamp(3) not null, + END_TIME_ timestamp(3) null, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + ACTIVITY_ID_ varchar(255), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + INCIDENT_STATE_ integer, + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_JOB_LOG ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + JOB_ID_ varchar(64) not null, + JOB_DUEDATE_ timestamp(3) NULL, + JOB_RETRIES_ integer, + JOB_PRIORITY_ bigint NOT NULL DEFAULT 0, + JOB_EXCEPTION_MSG_ varchar(4000), + JOB_EXCEPTION_STACK_ID_ varchar(64), + JOB_STATE_ integer, + JOB_DEF_ID_ varchar(64), + JOB_DEF_TYPE_ varchar(255), + JOB_DEF_CONFIGURATION_ varchar(255), + ACT_ID_ varchar(255), + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_BATCH ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_); +create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_); +create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_); + +create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_); +create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_); +create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_); +create index ACT_IDX_HI_ACT_INST_COMP on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_ACT_INST_STATS on ACT_HI_ACTINST(PROC_DEF_ID_, ACT_ID_, END_TIME_, ACT_INST_STATE_); +create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_); + +create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_); + +create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_); +create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_INST on ACT_HI_DETAIL(CASE_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_EXEC on ACT_HI_DETAIL(CASE_EXECUTION_ID_); +create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_); +create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_); +create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_); +create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_); +create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); +create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_); +create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_); +create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_); +create index ACT_IDX_HI_CASEVAR_CASE_INST on ACT_HI_VARINST(CASE_INST_ID_); +create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_); + +create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_); + +create index ACT_IDX_HI_JOB_LOG_PROCINST on ACT_HI_JOB_LOG(PROCESS_INSTANCE_ID_); +create index ACT_IDX_HI_JOB_LOG_PROCDEF on ACT_HI_JOB_LOG(PROCESS_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_); +create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_); + +create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_); +create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_); +create table ACT_HI_CASEINST ( + ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64) not null, + CREATE_TIME_ datetime(3) not null, + CLOSE_TIME_ datetime(3), + DURATION_ bigint, + STATE_ integer, + CREATE_USER_ID_ varchar(255), + SUPER_CASE_INSTANCE_ID_ varchar(64), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_), + unique (CASE_INST_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_CASEACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + CASE_ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + CASE_ACT_NAME_ varchar(255), + CASE_ACT_TYPE_ varchar(255), + CREATE_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_CAS_I_CLOSE on ACT_HI_CASEINST(CLOSE_TIME_); +create index ACT_IDX_HI_CAS_I_BUSKEY on ACT_HI_CASEINST(BUSINESS_KEY_); +create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_); +create index ACT_IDX_HI_CAS_A_I_CREATE on ACT_HI_CASEACTINST(CREATE_TIME_); +create index ACT_IDX_HI_CAS_A_I_END on ACT_HI_CASEACTINST(END_TIME_); +create index ACT_IDX_HI_CAS_A_I_COMP on ACT_HI_CASEACTINST(CASE_ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_CAS_A_I_CASEINST on ACT_HI_CASEACTINST(CASE_INST_ID_, CASE_ACT_ID_); +create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_); +-- create history decision instance table -- +create table ACT_HI_DECINST ( + ID_ varchar(64) NOT NULL, + DEC_DEF_ID_ varchar(64) NOT NULL, + DEC_DEF_KEY_ varchar(255) NOT NULL, + DEC_DEF_NAME_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + EVAL_TIME_ datetime(3) not null, + COLLECT_VALUE_ double, + USER_ID_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision input table -- +create table ACT_HI_DEC_IN ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64) NOT NULL, + CLAUSE_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision output table -- +create table ACT_HI_DEC_OUT ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64) NOT NULL, + CLAUSE_NAME_ varchar(255), + RULE_ID_ varchar(64) NOT NULL, + RULE_ORDER_ integer, + VAR_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + + +create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_); +create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_); +create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_); +create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_); +create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_); +create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_); +create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_); + +create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_); + +create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_); + +-- identity file entries + +create table ACT_ID_GROUP ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + TYPE_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_MEMBERSHIP ( + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (USER_ID_, GROUP_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_USER ( + ID_ varchar(64), + REV_ integer, + FIRST_ varchar(255), + LAST_ varchar(255), + EMAIL_ varchar(255), + PWD_ varchar(255), + PICTURE_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_INFO ( + ID_ varchar(64), + REV_ integer, + USER_ID_ varchar(64), + TYPE_ varchar(64), + KEY_ varchar(255), + VALUE_ varchar(255), + PASSWORD_ LONGBLOB, + PARENT_ID_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT_MEMBER ( + ID_ varchar(64) not null, + TENANT_ID_ varchar(64) not null, + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_USER + unique (TENANT_ID_, USER_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_GROUP + unique (TENANT_ID_, GROUP_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB + foreign key (TENANT_ID_) + references ACT_ID_TENANT (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + +CREATE TABLE `mso_urn_mapping` ( +`NAME_` VARCHAR(64) NOT NULL COLLATE 'utf8_bin', +`VALUE_` VARCHAR(300) NULL DEFAULT NULL COLLATE 'utf8_bin', +`REV_` INT(11) NULL DEFAULT NULL +) +COLLATE='latin1_swedish_ci' +ENGINE=InnoDB +; + +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:rollback', 'true', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('aai:endpoint', 'http://localhost:28090', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:adapters:tenant:endpoint', 'http://localhost:28090/tenantAdapterMock', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:adapters:sdnc:endpoint', 'http://localhost:28090/sdncAdapterMock', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:workflow:sdncadapter:callback', 'http://localhost:28080/mso/SDNCAdapterCallbackService', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:timeout', 'PT5M', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:firewall:yang:model', 'http://com/att/svc/mis/firewall-lite-gui', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:firewall:yang:model:version', '2015-05-15', 1); +INSERT INTO `mso_urn_mapping` (`NAME_`, `VALUE_`, `REV_`) VALUES ('mso:sdnc:timeout:firewall:minutes', '20', 1); + + +-- add indexes on PROC_DEF_KEY_ columns in history tables CAM-6679 +create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_); +create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_); +create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_); +create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_); +create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_); \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Upgrade/upgrade_mariadb_camunda7.3.7_to_7.5.6_ee.sql b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Upgrade/upgrade_mariadb_camunda7.3.7_to_7.5.6_ee.sql new file mode 100644 index 0000000000..8e118eb638 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CamundaDBScripts/Upgrade/upgrade_mariadb_camunda7.3.7_to_7.5.6_ee.sql @@ -0,0 +1,602 @@ +-- mariadb_engine_7.3.7_to_7.5.5 upgrade -- + +-- mysql_engine_7.3_to_7.4 +-- metrics -- +USE `camundabpmn`; + +ALTER TABLE ACT_RU_METER_LOG + ADD REPORTER_ varchar(255); + +-- job prioritization -- + +ALTER TABLE ACT_RU_JOB + ADD PRIORITY_ bigint NOT NULL + DEFAULT 0; + +ALTER TABLE ACT_RU_JOBDEF + ADD JOB_PRIORITY_ bigint; + +ALTER TABLE ACT_HI_JOB_LOG + ADD JOB_PRIORITY_ bigint NOT NULL + DEFAULT 0; + +-- create decision definition table -- +create table ACT_RE_DECISION_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create unique constraint on ACT_RE_DECISION_DEF -- +alter table ACT_RE_DECISION_DEF + add constraint ACT_UNIQ_DECISION_DEF + unique (KEY_,VERSION_); + +-- case sentry part source -- + +ALTER TABLE ACT_RU_CASE_SENTRY_PART + ADD SOURCE_ varchar(255); + +-- create history decision instance table -- +create table ACT_HI_DECINST ( + ID_ varchar(64) NOT NULL, + DEC_DEF_ID_ varchar(64) NOT NULL, + DEC_DEF_KEY_ varchar(255) NOT NULL, + DEC_DEF_NAME_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + EVAL_TIME_ datetime not null, + COLLECT_VALUE_ double, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision input table -- +create table ACT_HI_DEC_IN ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64) NOT NULL, + CLAUSE_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision output table -- +create table ACT_HI_DEC_OUT ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64) NOT NULL, + CLAUSE_NAME_ varchar(255), + RULE_ID_ varchar(64) NOT NULL, + RULE_ORDER_ integer, + VAR_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create indexes for historic decision tables +create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_); +create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_); +create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_); +create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_); +create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_); +create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_); + +create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_); + +create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_); + +-- add grant authorization for group camunda-admin: +INSERT INTO + ACT_RU_AUTHORIZATION (ID_, TYPE_, GROUP_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_, REV_) +VALUES + ('camunda-admin-grant-decision-definition', 1, 'camunda-admin', 10, '*', 2147483647, 1); + +-- external tasks -- + +create table ACT_RU_EXT_TASK ( + ID_ varchar(64) not null, + REV_ integer not null, + WORKER_ID_ varchar(255), + TOPIC_NAME_ varchar(255), + RETRIES_ integer, + ERROR_MSG_ varchar(4000), + LOCK_EXP_TIME_ timestamp NULL, + SUSPENSION_STATE_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_); + +-- deployment -- + +ALTER TABLE ACT_RE_DEPLOYMENT + ADD SOURCE_ varchar(255); + +ALTER TABLE ACT_HI_OP_LOG + ADD DEPLOYMENT_ID_ varchar(64); + +-- job suspension state + +ALTER TABLE ACT_RU_JOB + MODIFY COLUMN SUSPENSION_STATE_ integer + DEFAULT 1; + + -- relevant for jobs created in Camunda 7.0 +UPDATE ACT_RU_JOB + SET SUSPENSION_STATE_ = 1 + WHERE SUSPENSION_STATE_ IS NULL; + +ALTER TABLE ACT_RU_JOB + MODIFY COLUMN SUSPENSION_STATE_ integer + NOT NULL DEFAULT 1; + + +-- mariadb_engine_7.4_patch_7.4.5_to_7.4.6 +-- INCREASE process def key column size https://app.camunda.com/jira/browse/CAM-4328 -- +alter table ACT_RU_JOB + MODIFY COLUMN PROCESS_DEF_KEY_ varchar(255); + +-- mariadb_engine_7.4_to_7.5 +-- set datetime precision -- + +ALTER TABLE ACT_HI_CASEINST + MODIFY COLUMN CREATE_TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_CASEINST + MODIFY COLUMN CLOSE_TIME_ datetime(3); + +ALTER TABLE ACT_HI_CASEACTINST + MODIFY COLUMN CREATE_TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_CASEACTINST + MODIFY COLUMN END_TIME_ datetime(3); + +ALTER TABLE ACT_HI_DECINST + MODIFY COLUMN EVAL_TIME_ datetime(3) not null; + +ALTER TABLE ACT_RU_TASK + MODIFY COLUMN DUE_DATE_ datetime(3); + +ALTER TABLE ACT_RU_TASK + MODIFY COLUMN FOLLOW_UP_DATE_ datetime(3); + +ALTER TABLE ACT_HI_PROCINST + MODIFY COLUMN START_TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_PROCINST + MODIFY COLUMN END_TIME_ datetime(3); + +ALTER TABLE ACT_HI_ACTINST + MODIFY COLUMN START_TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_ACTINST + MODIFY COLUMN END_TIME_ datetime(3); + +ALTER TABLE ACT_HI_TASKINST + MODIFY COLUMN START_TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_TASKINST + MODIFY COLUMN END_TIME_ datetime(3); + +ALTER TABLE ACT_HI_TASKINST + MODIFY COLUMN DUE_DATE_ datetime(3); + +ALTER TABLE ACT_HI_TASKINST + MODIFY COLUMN FOLLOW_UP_DATE_ datetime(3); + +ALTER TABLE ACT_HI_DETAIL + MODIFY COLUMN TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_COMMENT + MODIFY COLUMN TIME_ datetime(3) not null; + +-- set timestamp precision -- + +ALTER TABLE ACT_RE_DEPLOYMENT + MODIFY COLUMN DEPLOY_TIME_ timestamp(3); + +ALTER TABLE ACT_RU_JOB + MODIFY COLUMN LOCK_EXP_TIME_ timestamp(3) NULL; + +ALTER TABLE ACT_RU_JOB + MODIFY COLUMN DUEDATE_ timestamp(3) NULL; + +ALTER TABLE ACT_RU_TASK + MODIFY COLUMN CREATE_TIME_ timestamp(3); + +ALTER TABLE ACT_RU_EVENT_SUBSCR + MODIFY COLUMN CREATED_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_RU_INCIDENT + MODIFY COLUMN INCIDENT_TIMESTAMP_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_RU_METER_LOG + MODIFY COLUMN TIMESTAMP_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_RU_EXT_TASK + MODIFY COLUMN LOCK_EXP_TIME_ timestamp(3) NULL; + +ALTER TABLE ACT_HI_OP_LOG + MODIFY COLUMN TIMESTAMP_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_HI_INCIDENT + MODIFY COLUMN CREATE_TIME_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_HI_INCIDENT + MODIFY COLUMN END_TIME_ timestamp(3) NULL; + +ALTER TABLE ACT_HI_JOB_LOG + MODIFY COLUMN TIMESTAMP_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_HI_JOB_LOG + MODIFY COLUMN JOB_DUEDATE_ timestamp(3) NULL; + +-- semantic version -- + +ALTER TABLE ACT_RE_PROCDEF + ADD VERSION_TAG_ varchar(64); + +create index ACT_IDX_PROCDEF_VER_TAG on ACT_RE_PROCDEF(VERSION_TAG_); + +-- tenant id -- + +ALTER TABLE ACT_RE_DEPLOYMENT + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_); + +ALTER TABLE ACT_RE_PROCDEF + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_RE_PROCDEF + DROP INDEX ACT_UNIQ_PROCDEF; + +create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_); + +ALTER TABLE ACT_RU_EXECUTION + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_); + +ALTER TABLE ACT_RU_TASK + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_); + +ALTER TABLE ACT_RU_VARIABLE + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_); + +ALTER TABLE ACT_RU_EVENT_SUBSCR + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_); + +ALTER TABLE ACT_RU_JOB + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_); + +ALTER TABLE ACT_RU_JOBDEF + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_); + +ALTER TABLE ACT_RU_INCIDENT + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_RU_IDENTITYLINK + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_); + +ALTER TABLE ACT_RU_EXT_TASK + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_); + +ALTER TABLE ACT_RE_DECISION_DEF + DROP INDEX ACT_UNIQ_DECISION_DEF; + +ALTER TABLE ACT_RE_DECISION_DEF + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_); + +ALTER TABLE ACT_RE_CASE_DEF + DROP INDEX ACT_UNIQ_CASE_DEF; + +ALTER TABLE ACT_RE_CASE_DEF + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_); + +ALTER TABLE ACT_GE_BYTEARRAY + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_RU_CASE_EXECUTION + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_); + +ALTER TABLE ACT_RU_CASE_SENTRY_PART + ADD TENANT_ID_ varchar(64); + +-- user on historic decision instance -- + +ALTER TABLE ACT_HI_DECINST + ADD USER_ID_ varchar(255); + +-- tenant id on history -- + +ALTER TABLE ACT_HI_PROCINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_); + +ALTER TABLE ACT_HI_ACTINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_); + +ALTER TABLE ACT_HI_TASKINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_); + +ALTER TABLE ACT_HI_VARINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_); + +ALTER TABLE ACT_HI_DETAIL + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_); + +ALTER TABLE ACT_HI_INCIDENT + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_); + +ALTER TABLE ACT_HI_JOB_LOG + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_); + +ALTER TABLE ACT_HI_COMMENT + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_HI_ATTACHMENT + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_HI_OP_LOG + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_HI_DEC_IN + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_HI_DEC_OUT + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_HI_DECINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_); + +ALTER TABLE ACT_HI_CASEINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_); + +ALTER TABLE ACT_HI_CASEACTINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_); + +-- AUTHORIZATION -- + +-- add grant authorizations for group camunda-admin: +INSERT INTO + ACT_RU_AUTHORIZATION (ID_, TYPE_, GROUP_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_, REV_) +VALUES + ('camunda-admin-grant-tenant', 1, 'camunda-admin', 11, '*', 2147483647, 1), + ('camunda-admin-grant-tenant-membership', 1, 'camunda-admin', 12, '*', 2147483647, 1), + ('camunda-admin-grant-batch', 1, 'camunda-admin', 13, '*', 2147483647, 1); + +-- tenant table + +create table ACT_ID_TENANT ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT_MEMBER ( + ID_ varchar(64) not null, + TENANT_ID_ varchar(64) not null, + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_USER + unique (TENANT_ID_, USER_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_GROUP + unique (TENANT_ID_, GROUP_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB + foreign key (TENANT_ID_) + references ACT_ID_TENANT (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + +-- BATCH -- + +-- remove not null from job definition table -- +alter table ACT_RU_JOBDEF + modify PROC_DEF_ID_ varchar(64), + modify PROC_DEF_KEY_ varchar(255), + modify ACT_ID_ varchar(255); + +create table ACT_RU_BATCH ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_CREATED_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + SUSPENSION_STATE_ integer, + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_BATCH ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_IDENTITYLINK ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + TYPE_ varchar(255), + USER_ID_ varchar(255), + GROUP_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + OPERATION_TYPE_ varchar(64), + ASSIGNER_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); +create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_); + +create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_); + +create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_SEED_JOB_DEF + foreign key (SEED_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_MONITOR_JOB_DEF + foreign key (MONITOR_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_JOB_DEF + foreign key (BATCH_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +-- TASK PRIORITY -- + +ALTER TABLE ACT_RU_EXT_TASK + ADD PRIORITY_ bigint NOT NULL DEFAULT 0; + +create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_); + +-- HI OP PROC INDECIES -- + +create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_); +create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_); + +-- JOB_DEF_ID_ on INCIDENTS -- +ALTER TABLE ACT_RU_INCIDENT + ADD JOB_DEF_ID_ varchar(64); + +create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_); +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_JOB_DEF + foreign key (JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +ALTER TABLE ACT_HI_INCIDENT + ADD JOB_DEF_ID_ varchar(64); + +-- BATCH_ID_ on ACT_HI_OP_LOG -- +ALTER TABLE ACT_HI_OP_LOG + ADD BATCH_ID_ varchar(64); + + -- add indexes on PROC_DEF_KEY_ columns in history tables CAM-6679 +create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_); +create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_); +create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_); +create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_); +create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_); diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml new file mode 100644 index 0000000000..40bb93bda0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateNetworkV2mock/sdncCreateNetworkTopologySimResponse.xml @@ -0,0 +1,19 @@ + + + + + + + + testRequestId + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</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>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml new file mode 100644 index 0000000000..742ec13a04 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_200.xml @@ -0,0 +1,13 @@ + + + + f70e927b-6087-4974-9ef8-c5e4d5847ca4 + gg0e927b-6087-5574-9ef8-c5e4d5847db5 + V1.0 + vMOG-AKRON-1234 + 1462561835 + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_Fault.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_Fault.xml new file mode 100644 index 0000000000..f33255b8a7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateServiceInstance/createServiceInstance_genericQueryByInstanceName_AAIResponse_Fault.xml @@ -0,0 +1,15 @@ + + + + + SVC3000 + Invalid input performing %1 on %2 (msg=%3) (ec=%4) + + PUT customer + global-customer-id=global_subscriber_id + Uniqueness constraint violated:Conflicting Key and Alternate-Key values passed for add of nodeType = customer + ERR.5.4.6117 + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModuleVolumeGroup_VID_request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModuleVolumeGroup_VID_request.json new file mode 100644 index 0000000000..c3064fe07c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModuleVolumeGroup_VID_request.json @@ -0,0 +1,74 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "PCRF::module-0-2", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", +"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", +"modelInfo": { +"modelType": "volumeGroup", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12..base..module-0", +"modelVersion": "1" +} +} +}, +{ +"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" +} +} +}, +{ +"relatedInstance": { +"instanceId": "78987", +"modelInfo": { +"modelType": "volumeGroup", +"modelInvariantId": "skask", +"modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12", +"modelVersion": "1.0" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModule_VID_request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModule_VID_request.json new file mode 100644 index 0000000000..a18ce576b5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/CreateVfModule_VID_request.json @@ -0,0 +1,64 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1", +"modelCustomizationId": "ee6478e5-ea33-3346-ac12-ab121484a3fe" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceName": "PCRF::module-0-2", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c", +"instanceName": "MSOTESTVOL103a-vSAMP12_base_module-0_vol", +"modelInfo": { +"modelType": "volumeGroup", +"modelInvariantId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", +"modelName": "vSAMP12..base..module-0", +"modelVersion": "1" +} +} +}, +{ +"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", +"instanceName": "skask-test", +"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/MSOCommonBPMN/src/test/resources/__files/Database/DBAdapter.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBAdapter.xml new file mode 100644 index 0000000000..5a36d741d0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBAdapter.xml @@ -0,0 +1 @@ +Notified \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml new file mode 100644 index 0000000000..7c30f75497 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/Database/DBUpdateResponse.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml new file mode 100644 index 0000000000..cb5d0001f7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteNetworkV2mock/sdncDeleteNetworkTopologySimResponse.xml @@ -0,0 +1,19 @@ + + + + + + + + 19174929-3809-49ca-89eb-17f84a035389 + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id><response-code>200</response-code><ack-final-indicator>Y</ack-final-indicator><network-information><network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id></network-information><service-information><service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type><service-instance-id>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteVfModule_VID_request.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteVfModule_VID_request.json new file mode 100644 index 0000000000..c75c32d498 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/DeleteVfModule_VID_request.json @@ -0,0 +1,50 @@ +{ +"requestDetails": { +"modelInfo": { +"modelType": "vfModule", +"modelInvariantId": "973ed047-d251-4fb9-bf1a-65b8949e0a73", +"modelNameVersionId": "973ed047-d251-4fb9-bf1a-65b8949e0a73", +"modelName": "STMTN5MMSC21-MMSC::model-1-0", +"modelVersion": "1" +}, +"cloudConfiguration": { +"lcpCloudRegionId": "MDTWNJ21", +"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" +}, +"requestInfo": { +"instanceId": "973ed047-d251-4fb9-bf1a-65b8949e0a73", +"source": "VID", +"suppressRollback": true +}, +"relatedInstanceList": [ +{ +"relatedInstance": { +"instanceId": "00000000-0000-0000-0000-000000000000", +"modelInfo": { +"modelType": "service", +"modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", +"modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", +"modelName": "SERVICE_MODEL_NAME", +"modelVersion": "1.0" +} +} +}, +{ +"relatedInstance": { +"instanceId": "a27ce5a9-29c4-4c22-a017-6615ac73c721", +"modelInfo": { +"modelType": "vnf", +"modelInvariantId": "skask", +"modelNameVersionId": "a27ce5a9-29c4-4c22-a017-6615ac73c721", +"modelName": "vSAMP12", +"modelVersion": "1.0", +"modelCustomizationName": "vSAMP12 1" +} +} +} +], +"requestParameters": { +"userParams": {} +} +} +} \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml new file mode 100644 index 0000000000..4aeac5ccb8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GENDSI_getServiceInstanceResponse.xml @@ -0,0 +1,35 @@ + + SDN-ETHERNET-INTERNET + 1234 + + + MIS/1604/0026/SW_INTERNET + + + cvlan-tag + https://aai-ext1.test.att.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.att.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/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfByNameResponse.xml new file mode 100644 index 0000000000..a397e5bcba --- /dev/null +++ b/bpmn/MSOCommonBPMN/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.att.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/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse.xml new file mode 100644 index 0000000000..3227a038af --- /dev/null +++ b/bpmn/MSOCommonBPMN/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.att.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.att.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.att.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.att.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.att.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.att.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.att.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.att.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/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getGenericVnfResponse_hasRelationships.xml new file mode 100644 index 0000000000..3227a038af --- /dev/null +++ b/bpmn/MSOCommonBPMN/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.att.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.att.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.att.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.att.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.att.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.att.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.att.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.att.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/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml new file mode 100644 index 0000000000..28ce8ef1b7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlById.xml @@ -0,0 +1,6 @@ + + + service-instance + https://aai-ext1.test.att.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/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml new file mode 100644 index 0000000000..28ce8ef1b7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getSIUrlByName.xml @@ -0,0 +1,6 @@ + + + service-instance + https://aai-ext1.test.att.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/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml new file mode 100644 index 0000000000..5ffdda268f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceInstance.xml @@ -0,0 +1,30 @@ + + MIS/1604/0026/SW_INTERNET + 123456789 + + + cvlan-tag + https://aai-ext1.test.att.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.att.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/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml new file mode 100644 index 0000000000..41815d46e6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getServiceSubscription.xml @@ -0,0 +1,34 @@ + + SDN-ETHERNET-INTERNET + 1234 + + MIS/1604/0026/SW_INTERNET + 123456789 + + + cvlan-tag + https://aai-ext1.test.att.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.att.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/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml new file mode 100644 index 0000000000..a83e06ee6f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceByNameResponse.xml @@ -0,0 +1,97 @@ + + 1936628a-d22f-4943-8587-a57bab2ece7a + testVnfName123 + US0112SLCP1VBRT076 + esx-vce + NVTPROV + created + 0000020 + slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d + + VPESAT-mtanjrsv126 + 135.21.249.160 + + + slcp1476vbc.vpe + e7568706-a2a9-45f8-aef8-95a0e2910953 + dvspg-VCE_VPE-slcp1476vbc + Internet + dvspg-VCE_VPE-slcp1476vbc + 0000020 + dvs-slcp1-01 + created + dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196 + + + + 3012 + 0000020 + + + + + slcp1476vbc.ipag + 3477ddb6-b925-4971-ab62-c84b69634c49 + dvspg-IPAG_VCE-slcp1476vbc + Customer + dvspg-IPAG_VCE-slcp1476vbc + dvs-slcp1-01 + 0000020 + created + dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7 + + + + 2003 + 0000020 + + + + + + + service-instance + https://aai-ext1.test.att.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/ + + service-instance.service-instance-id + SDNC/VLXM/0112001//SW_INTERNET + + + service-subscription.service-type + SDN-ETHERNET-INTERNET + + + customer.global-customer-id + 011216-1602-SDNC001 + + + + vserver + https://aai-ext1.test.att.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/ + + vserver.vserver-id + ecab47d5-3450-4507-ada9-2b3c58485c51 + + + tenant.tenant-id + 3d5f3fe23821416fac2b69af65248c74 + + + + complex + https://aai-ext1.test.att.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/ + + complex.physical-location-id + MDTWNJ21A4 + + + + availability-zone + https://aai-ext1.test.att.com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/ + + availability-zone.availability-zone-name + slcp1-esx-az01 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml new file mode 100644 index 0000000000..a83e06ee6f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericFlows/getVceResponse.xml @@ -0,0 +1,97 @@ + + 1936628a-d22f-4943-8587-a57bab2ece7a + testVnfName123 + US0112SLCP1VBRT076 + esx-vce + NVTPROV + created + 0000020 + slcp1476vbc/94a3c72b-94d5-444b-9a1f-647a36c2181d + + VPESAT-mtanjrsv126 + 135.21.249.160 + + + slcp1476vbc.vpe + e7568706-a2a9-45f8-aef8-95a0e2910953 + dvspg-VCE_VPE-slcp1476vbc + Internet + dvspg-VCE_VPE-slcp1476vbc + 0000020 + dvs-slcp1-01 + created + dvspg-VCE_VPE-slcp1476vbc/c1299f74-da35-4228-b1e0-d2fd07176196 + + + + 3012 + 0000020 + + + + + slcp1476vbc.ipag + 3477ddb6-b925-4971-ab62-c84b69634c49 + dvspg-IPAG_VCE-slcp1476vbc + Customer + dvspg-IPAG_VCE-slcp1476vbc + dvs-slcp1-01 + 0000020 + created + dvspg-IPAG_VCE-slcp1476vbc/1e9c033a-2eef-47f5-9d48-98e0b59538e7 + + + + 2003 + 0000020 + + + + + + + service-instance + https://aai-ext1.test.att.com:8443/aai/v2/business/customers/customer/011216-1602-SDNC001/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/SDNC%2FVLXM%2F0112001%2F%2FSW_INTERNET/ + + service-instance.service-instance-id + SDNC/VLXM/0112001//SW_INTERNET + + + service-subscription.service-type + SDN-ETHERNET-INTERNET + + + customer.global-customer-id + 011216-1602-SDNC001 + + + + vserver + https://aai-ext1.test.att.com:8443/aai/servers/v2/3d5f3fe23821416fac2b69af65248c74/vservers/ecab47d5-3450-4507-ada9-2b3c58485c51/ + + vserver.vserver-id + ecab47d5-3450-4507-ada9-2b3c58485c51 + + + tenant.tenant-id + 3d5f3fe23821416fac2b69af65248c74 + + + + complex + https://aai-ext1.test.att.com:8443/aai/v2/cloud-infrastructure/complexes/complex/MDTWNJ21A4/ + + complex.physical-location-id + MDTWNJ21A4 + + + + availability-zone + https://aai-ext1.test.att.com:8443/aai/v2/cloud-infrastructure/availability-zones/availability-zone/slcp1-esx-az01/ + + availability-zone.availability-zone-name + slcp1-esx-az01 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml new file mode 100644 index 0000000000..eedbda9343 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/aaiFault.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/aaiFault.xml new file mode 100644 index 0000000000..66ed8f5758 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/GenericPutServiceInstance/aaiFault.xml @@ -0,0 +1,15 @@ + + + + +SVC3002 +Error writing output performing %1 on %2 (msg=%3) (ec=%4) + +PUTcustomer +SubName01 +Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id] +ERR.5.4.5105 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml new file mode 100644 index 0000000000..f71f529593 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1/sdncadapterworkflowrequest.xml @@ -0,0 +1,32 @@ + + + + + + + 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 + query + services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET + http://127.0.0.1:28080/camunda/services/SDNCAdapterCallback + + + + + + 12570a36-7388-4c0a-bec4-189ce3kg9956 + GetLayer3ServiceDetailsRequest + OMX + + + SDN-ETHERNET-INTERNET + PD/VLXM/003717//SW_INTERNET + + + + + 1 + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml new file mode 100644 index 0000000000..b72004778b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SDN-ETHERNET-INTERNET/SDNCAdapterV1mock/sdncadaptercallbackrequest.xml @@ -0,0 +1,350 @@ + + + + + + + testRequestId + 200 + OK + + <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <vr-lan xmlns="com:att:sdnctl:l3api"> + <vr-lan-interface> + <static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + </static-routes> + <dhcp> + <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> + <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> + <use-v6-default-pool>N</use-v6-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.8</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.5</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:5</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:6</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + </dhcp> + <firewall-lite> + <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> + <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> + <v4-firewall-prefix-length>1</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>1</port-number> + </udp-ports> + <tcp-ports> + <port-number>1</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> + <v4-firewall-prefix-length>2</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>2</port-number> + </udp-ports> + <tcp-ports> + <port-number>2</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>0</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>3</port-number> + </udp-ports> + <tcp-ports> + <port-number>3</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>1</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>4</port-number> + </udp-ports> + <tcp-ports> + <port-number>4</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + </firewall-lite> + <pat> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> + </v4-pat-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <v4-pat-enabled>N</v4-pat-enabled> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> + </v4-pat-pools> + </pat> + <nat> + <v4-nat-enabled>Y</v4-nat-enabled> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.0</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.0</v4-nat-external> + </v4-nat-mapping-entries> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.1</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.1</v4-nat-external> + </v4-nat-mapping-entries> + </nat> + <vr-designation>primary</vr-designation> + <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> + <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> + <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> + <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> + <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> + <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> + <v4-public-lan-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.2</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.72</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.68</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + </v4-public-lan-prefixes> + <v6-public-lan-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </v6-public-lan-prefixes> + </vr-lan-interface> + <routing-protocol>none</routing-protocol> + </vr-lan> +<ucpe-vms-service-information> + <transport-service-information> + <transport-service-type>AVPN</transport-service-type> + <access-circuit-info> + <access-circuit-id>1</access-circuit-id> + <dual-mode>Active</dual-mode> + </access-circuit-info> + <access-circuit-info> + <access-circuit-id>2</access-circuit-id> + <dual-mode>Standby</dual-mode> + </access-circuit-info> + </transport-service-information> + <ucpe-information> + <ucpe-host-name>hostname</ucpe-host-name> + <ucpe-activation-code>activecode</ucpe-activation-code> + <out-of-band-management-modem>OOB</out-of-band-management-modem> + </ucpe-information> + <vnf-list> + <vnf-information> + <vnf-instance-id>1</vnf-instance-id> + <vnf-sequence-number>1</vnf-sequence-number> + <vnf-type>ZZ</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL1</vnf-model> + <vnf-id>1</vnf-id> + <prov-status>1</prov-status> + <operational-state>1</operational-state> + <orchestration-status>1</orchestration-status> + <equipment-role>1</equipment-role> + </vnf-information> + <vnf-information> + <vnf-instance-id>2</vnf-instance-id> + <vnf-sequence-number>2</vnf-sequence-number> + <vnf-type>HY</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL2</vnf-model> + <vnf-id>2</vnf-id> + <prov-status>2</prov-status> + <operational-state>2</operational-state> + <orchestration-status>2</orchestration-status> + <equipment-role>2</equipment-role> + </vnf-information> + </vnf-list> + </ucpe-vms-service-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <notification-url>https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.att.com:8443/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + <internet-service-change-details> + <internet-evc-speed-value>10</internet-evc-speed-value> + <internet-evc-speed-units>Kbps</internet-evc-speed-units> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>2</request-index> + <v4-next-hop-address>192.168.1.16</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </internet-service-change-details> + </service-data> + </layer3-service-list> + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_400.xml new file mode 100644 index 0000000000..a5640b2b26 --- /dev/null +++ b/bpmn/MSOCommonBPMN/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/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_500.xml new file mode 100644 index 0000000000..c67e980c63 --- /dev/null +++ b/bpmn/MSOCommonBPMN/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/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetworkResponse_Success.xml new file mode 100644 index 0000000000..7a00744103 --- /dev/null +++ b/bpmn/MSOCommonBPMN/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/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml new file mode 100644 index 0000000000..a7ac309507 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryInstance_Success.xml @@ -0,0 +1,4 @@ + + service-instance + https://aai-conexus-e2e.test.att.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/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_NoPayload_Success.xml new file mode 100644 index 0000000000..d8d10db65e --- /dev/null +++ b/bpmn/MSOCommonBPMN/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.att.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.att.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.att.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/ + + tenant.tenant-id + 7dd5365547234ee8937416c65507d266 + + + + network-policy + https://aai-app-e2e.test.att.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/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml new file mode 100644 index 0000000000..292b5e8420 --- /dev/null +++ b/bpmn/MSOCommonBPMN/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/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml new file mode 100644 index 0000000000..910f7014e4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/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/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml new file mode 100644 index 0000000000..2cf94b2ef2 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySim500Response.xml @@ -0,0 +1,25 @@ + + + + + + + + testRequestId + 200 + OK + + <output + xmlns="com:att:sdnctl:vnf"><response-code>500</response-code><response-message>'Error + retrieving l3-network with network-id=' + + $network-topology-operation-input.network-request-information.network-id + + 'from + AnAI'</response-message><ack-final-indicator>Y</ack-final-indicator><svc-request-id>006927ca-f5a3-47fd-880c-dfcbcd81a093</svc-request-id></output> + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml new file mode 100644 index 0000000000..40bb93bda0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UpdateNetworkV2mock/sdncUpdateNetworkTopologySimResponse.xml @@ -0,0 +1,19 @@ + + + + + + + + testRequestId + 200 + OK + + <?xml version="1.0" encoding="UTF-8"?><output xmlns="com:att:sdnctl:vnf"><svc-request-id>19174929-3809-49ca-89eb-17f84a035389</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>HSL_direct_net_2</service-instance-id><subscriber-name>notsurewecare</subscriber-name></service-information></output> + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..d968bcc1fe --- /dev/null +++ b/bpmn/MSOCommonBPMN/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/MSOCommonBPMN/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml new file mode 100644 index 0000000000..2126ae7464 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml @@ -0,0 +1,6 @@ + + skask + lukewarm + pdk1 + 78987 + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml new file mode 100644 index 0000000000..d041565ac7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml @@ -0,0 +1,29 @@ + + + DEV-VF-0011 + UPDATE_VF_MODULE + PORTAL + + + skask + supercool + pcrf-capacity + PCRF::module-0 + + serviceIdUUID + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + 78987 + introvert + 3.14 + myhost.appl.edu + introvert + 3.14 + + + VLAN-OAM-1323 + slcp34246vbc246ceb + 970cd2b9-7f09-4a12-af47-182ea38ba1f0 + 545cc2c3-1930-4100-b534-5d82d0e12bb6 + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/GenericVnf.xml new file mode 100644 index 0000000000..60f3d01cb7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/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/MSOCommonBPMN/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml new file mode 100644 index 0000000000..65f235cf4b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml @@ -0,0 +1,5 @@ + + skask + supercool + pending-delete + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..0442afca90 --- /dev/null +++ b/bpmn/MSOCommonBPMN/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/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml new file mode 100644 index 0000000000..4cab6c6615 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml new file mode 100644 index 0000000000..7d3d0e54d1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml new file mode 100644 index 0000000000..7d3d0e54d1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml @@ -0,0 +1,13 @@ + + + skask + + 200 + {{REQUEST-ID}} + Y + + dontcare + 0 + SDN-MOBILITY + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml new file mode 100644 index 0000000000..b143e3b17a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml @@ -0,0 +1,315 @@ + + + bd1b3789-6474-4935-94b2-90b656e035d0 + + bd1b3789-6474-4935-94b2-90b656e035d0 + + 9ddf628a-9eca-430e-8974-22d520a31be1 + assign + https://msojra.infra.aic.att.net:8443/adapters/rest/SDNCNotify + + + notsurewecare + bd1b3789-6474-4935-94b2-90b656e035d0 + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + + PendingCreate + + + VNN1CA52LCP + ZVNNMOGX01_base + afd0f02a-1ddb-43bb-aded-5113e46e82ae + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + 33d209df14ac4c08ad60747185d2f3e0 + bd1b3789-6474-4935-94b2-90b656e035d0 + ZVNN1MOGX01 - VF AUG 1::module-0 + + + + + mog_exn + 03dbd833-785c-40c0-bf32-37594b5334bc + MNS-25180-P-VNNYCA01_exn_protected_net_1 + + + 6f82d234-41a4-48e9-a9e8-415667a72929 + + filter1 + + + filter2 + + + + mog_oam + 3f181cde-9380-4c20-9d3a-e1a4ee74f994 + MNS-25180-P-VNNYCA01_oam_protected_net_1 + + + 713b6770-13fa-4949-8dbb-a1288c5e5932 + + + mog_cor_B + 821a550a-3f50-4725-995b-f212d5caec7c + MNS-25180-P-VNNYCA01_cor_direct_net_1 + + + 18926e56-12b6-4a4d-98b6-37e0c05626ee + + + mog_cor_A + 3dabf5c0-cffb-420c-8960-8499c74eb25f + MNS-25180-P-VNNYCA01_cor_direct_net_2 + + + 35530b29-a4de-48ff-a014-111110ccc652 + + + mog_gn + 3ce97321-6e7f-49af-bd12-f833e377c310 + MNS-25180-P-VNNYCA01_gn_direct_net_1 + + + 32bfdd2c-28e1-4895-87a6-373bf12c3129 + + + mog_dmz + d43ca910-02a5-47dc-8510-100a68a3c9e0 + MNS-25180-P-VNNYCA01_dmz_protected_net_1 + + + cb9500fb-943f-412e-aea6-458711564a75 + + + nova + + + ps + + ZVNN1MOGX01MPS001 + + + ZVNN1MOGX01MPS002 + + + ZVNN1MOGX01MPS003 + + + ZVNN1MOGX01MPS004 + + 4 + + mog_cor_B + + 107.224.36.251 + + + 107.224.36.252 + + + 107.224.36.253 + + + 107.224.36.254 + + N + + + + cm + + ZVNN1MOGX01MCM001 + + + ZVNN1MOGX01OAM002 + + 1 + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + N + + + mog_oam + + 107.239.167.250 + + + 107.239.167.251 + + N + + + + oam + + ZVNN1MOGX01OAM001 + + + ZVNN1MOGX01OAM002 + + 2 + + mog_oam + + 107.239.167.252 + + + 107.239.167.251 + + N + + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + N + + + + pd + + ZVNN1MOGX01MPD001 + + + ZVNN1MOGX01MPD002 + + 2 + + mog_dmz + + 107.225.25.253 + + + 107.225.25.254 + + N + 107.225.254.253 + + + mog_oam + + 107.239.167.254 + + + 107.239.167.253 + + N + 107.239.167.249 + + + mog_exn + + 107.224.46.253 + + + 107.224.46.254 + + N + 107.224.46.252 + + + mog_cor_B + + 107.224.36.247 + + + 107.224.36.248 + + N + 107.224.41.252 + + + mog_gn + + 107.224.41.253 + + + 107.224.41.254 + + N + 107.224.41.252 + + + mog_cor_A + + 107.224.38.253 + + + 107.224.38.254 + + N + + + + sm + + ZVNN1MOGX01MSM001 + + + ZVNN1MOGX01MSM002 + + + ZVNN1MOGX01MSM003 + + + ZVNN1MOGX01MSM004 + + 4 + + mog_cor_B + + 107.224.36.243 + + + 107.224.36.244 + + + 107.224.36.245 + + + 107.224.36.246 + + N + + + + + ZVNNMOGX01_base + SDN-MOBILITY + ZVNN1MOGX01 - VF AUG 1::module-0 + ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1 + ZVNN1MOGX01 + + + + 9ddf628a-9eca-430e-8974-22d520a31be1 + + PORTAL + VNFActivateRequest + + + + 200 + Y + synccomplete + 2016-08-05T16:15:19.398Z + vnf-topology-operation + VNFActivateRequest + assign + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml new file mode 100644 index 0000000000..c9f9cf3262 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml @@ -0,0 +1,141 @@ + + + 28455973-1ee5-4ad1-8d35-c4732679743a + + 200 + Y + synccomplete + 2016-06-08T19:44:59.138Z + vnf-topology-operation + VNFActivateRequest + assign + + + 28455973-1ee5-4ad1-8d35-c4732679743 + + notsurewecare + 28455973-1ee5-4ad1-8d35-c4732679743a + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb + + + 5e168556-a5c6-4813-bff3-cc03007afbbc + http://mtanjv9moja01-eth1-0.aic.cip.att.com:28080/adapters/rest/SDNCNotify + assign + + + AAIAIC25 + MSOTEST06-vSAMP3::base::module-0 + 91ad7ab0-9ffd-471d-971c-3eb913a2cc75 + Test/vSAMP3 1 + MSOTEST06 + 4ae1d3446a4c48b2bec44b6cfba06d68 + 28455973-1ee5-4ad1-8d35-c4732679743a + vSAMP3::base::module-0 + + + PendingCreate + + + + image + Ubuntu_Perf + + + flavor + m1.small + + + + int_imbl + 680b7453-0ec4-4d96-b355-280d981d418f + Nimbus-25193-T-Willows2_int_imbl_net_1 + default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_int_imbl_net_1 + + 775607fb-e16a-45ef-94a7-82fba0d16eec + 640d07fb-e16a-45ef-94a7-82fba0d169bf + + filter1 + + + filter2 + + + + sgi_protected + f9039ce9-e3cf-4716-b2d1-ec7912178ea4 + Nimbus-25193-T-Willows2_sgi_protected_net_1 + default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_sgi_protected_net_1 + b9999ce9-e3cf-4716-b2d1-ec791217678c + + bf11bba8-b971-4ab5-8281-215b3fedcd3c + + + cm + + ZVNN1MOGX01MCM001 + + + ZVNN1MOGX01OAM002 + + 1 + + mog_cor_B + + 107.224.36.249 + + + 107.224.36.250 + + + 2606:ae00:2e01:800::67 + + N + 107.224.41.252 + 2001:1890:1001:2B32::29:C + + + mog_oam + + 107.239.167.250 + + + 107.239.167.251 + + + aa::aa::aa::aa::aa::aa + + + bb::bb::bb::bb::bb::bb + + + 1.2.3.4/26 + + + 2002::/64 + + N + 1111:1890:1001:2B32::29:D + + + + nova + + + + MSOTEST06-vSAMP3::base::module-0 + SDN-MOBILITY + vSAMP3::base::module-0 + Test/vSAMP3 1 + MSOTEST06 + + + + 5e168556-a5c6-4813-bff3-cc03007afbbc + + SoapUI-bns-vf-base-vSAMP3-9001 + VNFActivateRequest + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml new file mode 100644 index 0000000000..919ff2c36b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml new file mode 100644 index 0000000000..3e7c6503f4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml @@ -0,0 +1,5 @@ + + skask + introvert + 3.14 + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml new file mode 100644 index 0000000000..8a690403c4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml @@ -0,0 +1,10 @@ + + skask + supercool + slowburn + complete + 78987 + introvert + 3.14 + myhost.appl.com + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml new file mode 100644 index 0000000000..966ca50b16 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml @@ -0,0 +1,35 @@ + + + DEV-VF-0011 + UPDATE_VF_MODULE + PORTAL + + + skask + supercool + pcrf-capacity + PCRF::module-0 + + serviceIdUUID + MDTWNJ21 + fba1bd1e195a404cacb9ce17a9b2b421 + 78987 + introvert + 3.14 + myhost.appl.edu + introvert + 3.14 + + + VLAN-OAM-1323 + slcp34246vbc246ceb + 970cd2b9-7f09-4a12-af47-182ea38ba1f0 + 545cc2c3-1930-4100-b534-5d82d0e12bb6 + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml new file mode 100644 index 0000000000..49ecd0bf3f --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml @@ -0,0 +1,55 @@ + + skask + supercool + slowburn + true + + + key1 + value1 + + + key2 + value2 + + +server1_private_ip +192.168.28.3 + + +contrail-service-instance-fqdn +default-domain:MSOTest:MsoNW-RA + + +policyKey1_contrail_network_policy_fqdn +MSOTest:DefaultPolicyFQDN1 + + +policyKey2_contrail_network_policy_fqdn +MSOTest:DefaultPolicyFQDN2 + + +oam_management_v6_address +2000:abc:bce:1111 + + +oam_management_v4_address +127.0.0.1 + + + + skask + supercool + slowburn + true + tenantId + cloudSiteId + + requestId + serviceInstanceId + + {{MESSAGE-ID}} + + {{MESSAGE-ID}} + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml new file mode 100644 index 0000000000..c602dd9667 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml @@ -0,0 +1,16 @@ + + skask + supercool + slowburn + + + key1 + value1 + + + key2 + value2 + + + {{MESSAGE-ID}} + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml new file mode 100644 index 0000000000..830d2e2237 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml @@ -0,0 +1,15 @@ + + 78987 + slowburn + + + key1 + value1 + + + key2 + value2 + + + {{MESSAGE-ID}} + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml new file mode 100644 index 0000000000..ad3c3591ed --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml @@ -0,0 +1,10 @@ + + lukewarm + PCRF::module-1 + slowburn + pending-create + true + 330-90 + introvert + 2.0 + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-new.xml new file mode 100644 index 0000000000..eba91a7a84 --- /dev/null +++ b/bpmn/MSOCommonBPMN/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/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VfModule-supercool.xml new file mode 100644 index 0000000000..6d365f7d51 --- /dev/null +++ b/bpmn/MSOCommonBPMN/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/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/VfModularity/VolumeGroup.xml new file mode 100644 index 0000000000..241e5e3e3f --- /dev/null +++ b/bpmn/MSOCommonBPMN/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/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml new file mode 100644 index 0000000000..37c5155c48 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/aai-volume-group-id-info.xml @@ -0,0 +1,28 @@ + + + VOLUME_GROUP_ID_1 + VOLUME_GROUP_ID_1_NAME + heat-stack-id + vnf-type + OK + 1 + + + tenant + + cloud-region.cloud-owner + att-aic + + + cloud-region.cloud-region-id + pdk1 + + + tenant.tenant-id + cee6d136-e378-4678-a024-2cd15f0ee0cg + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/aaiFault.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/aaiFault.xml new file mode 100644 index 0000000000..66ed8f5758 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/aaiFault.xml @@ -0,0 +1,15 @@ + + + + +SVC3002 +Error writing output performing %1 on %2 (msg=%3) (ec=%4) + +PUTcustomer +SubName01 +Unexpected error reading/updating database:Adding this property for key [service-instance-id] and value [USSTU2CFCNC0101UJZZ01] violates a uniqueness constraint [service-instance-id] +ERR.5.4.5105 + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml new file mode 100644 index 0000000000..7b5d22a1de --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfCreateSimResponse.xml @@ -0,0 +1,29 @@ + + + + + + edab9ec7-6cf8-47cf-b58c-9ba4ef5d3f70 + true + slcp34248vbc/020a112b-a0c8-4143-87a3-698680ba2efe + + + server_ip + 135.21.249.178 + + + + MTSNJA4LCP1 + + 1512_1120-BB11-1 + BB11/VLXM/003717//SW_INTERNET + + false + e25ac2f1e73d46428de81a6130a6fdad + true + slcp34248vbc/020a112b-a0c8-4143-87a3-698680ba2efe + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml new file mode 100644 index 0000000000..a4b0becee4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfDeleteSimResponse.xml @@ -0,0 +1,11 @@ + + + + + + f5e42814-72c0-4422-b840-e14e757a709b + true + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml new file mode 100644 index 0000000000..3b99363ea8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfQuerySimResponse.xml @@ -0,0 +1,20 @@ + + + + + + b1a82ce6-7f5c-45fd-9273-acaf88fc2222 + true + true + slcp34248vbc/020a112b-a0c8-4143-87a3-698680ba2efe + ACTIVE + + + server_ip + 135.21.249.144 + + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml new file mode 100644 index 0000000000..4fd0b62610 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/vnfAdapterMocks/vnfRollbackSimResponse.xml @@ -0,0 +1,11 @@ + + + + + + b1a82ce6-7f5c-45fd-9273-acaf88fc2137 + true + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/camunda.cfg.xml b/bpmn/MSOCommonBPMN/src/test/resources/camunda.cfg.xml new file mode 100644 index 0000000000..c94e32e686 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/camunda.cfg.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/logging.properties b/bpmn/MSOCommonBPMN/src/test/resources/logging.properties new file mode 100644 index 0000000000..4941c55971 --- /dev/null +++ b/bpmn/MSOCommonBPMN/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/MSOCommonBPMN/src/test/resources/mso.bpmn.properties b/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.properties new file mode 100644 index 0000000000..f800d00245 --- /dev/null +++ b/bpmn/MSOCommonBPMN/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/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties b/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties new file mode 100644 index 0000000000..f1a82225ff --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties @@ -0,0 +1,86 @@ +# 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.callbackRetryAttempts=5 +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 diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml new file mode 100644 index 0000000000..df3a4c42e5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncCallbackErrorResponse.xml @@ -0,0 +1 @@ +1a152f97-566e-4f22-b17b-761f807bfedc404Error processing request to SDNC. Not Found. https://sdncodl.it.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET. SDNC Returned-[error-type:application, error-tag:data-missing, error-message:Request could not be completed because the relevant data model content does not exist.] \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml new file mode 100644 index 0000000000..d656d04187 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncDeleteResponse.xml @@ -0,0 +1,212 @@ + + + + + + Y + SK-2016-10-22-001 + + + SUCCESS + ERROR + + + 15001417 + + ALPRTR2 + 1.1.1.2 + + 1255.ae81 + VDBE + VIRTUAL + + ALPVDBE1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + ALPASBG1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + ALPBGF2 + 3.1.2.0/22 + + 3:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + ALPBGF1 + 3.1.2.0/22 + + 3:1:2::0/22 + + 2 + + + ALPRTR1 + 1.1.1.1 + + 1255.ae81 + VDBE + VIRTUAL + + ALPVDBE1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + ALPASBG1 + 3.1.1.0/22 + ae81 + 3:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + ALPBGF2 + 3.1.2.0/22 + + 3:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + ALPBGF1 + 3.1.2.0/22 + + 3:1:2::0/22 + + 1 + + + + 15001418 + + SANRTR1 + 2.1.1.1 + + 1255.ae81 + VDBE + VIRTUAL + + SANVDBE1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + SANASBG1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + SANBGF2 + 4.1.2.0/22 + + 4:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + SANBGF1 + 4.1.2.0/22 + + 4:1:2::0/22 + + 1 + + + SANRTR2 + 2.1.1.2 + + 1255.ae81 + VDBE + VIRTUAL + + SANVDBE1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 1995.ae81 + ASBG + VIRTUAL + + SANASBG1 + 4.1.1.0/22 + ae81 + 4:1:1::0/22 + + + 85.xe-10/0/2 + BGF2 + PHYSICAL + xe-10/0/2 + SANBGF2 + 4.1.2.0/22 + + 4:1:2::0/22 + + + 85.xe-10/0/1 + BGF1 + PHYSICAL + xe-10/0/1 + SANBGF1 + 4.1.2.0/22 + + 4:1:2::0/22 + + 2 + + + ATT-COLLABORATE + DISABLE + custid-888 + SII-2016-10-22-001 + CUSTOMER + 100668 + + + + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml new file mode 100644 index 0000000000..89e4fef705 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest.xml @@ -0,0 +1,342 @@ + + + 2f7d1b38-2b78-4ef2-8ad6-1552d88620fa + 200 + OK + + <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <vr-lan xmlns="com:att:sdnctl:l3api"> + <vr-lan-interface> + <static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.1</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v6-static-routes> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-static-route-prefix>2001:1890:12e3:2da::</v6-static-route-prefix> + <v6-static-route-prefix-length>28</v6-static-route-prefix-length> + </v6-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.2</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + <v4-static-routes> + <v4-static-route-prefix>255.255.252.3</v4-static-route-prefix> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-static-route-prefix-length>28</v4-static-route-prefix-length> + </v4-static-routes> + </static-routes> + <dhcp> + <v6-dhcp-server-enabled>N</v6-dhcp-server-enabled> + <v4-dhcp-server-enabled>Y</v4-dhcp-server-enabled> + <use-v6-default-pool>N</use-v6-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-dhcp-addresses-from-default-pool> + <excluded-v4-address>192.168.1.8</excluded-v4-address> + </excluded-v4-dhcp-addresses-from-default-pool> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.1</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.5</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.1</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.3</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <v4-dhcp-pools> + <v4-dhcp-relay-next-hop-address>1.1.1.2</v4-dhcp-relay-next-hop-address> + <v4-dhcp-pool-prefix-length>28</v4-dhcp-pool-prefix-length> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.6</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-relay-gateway-address>2.2.2.2</v4-dhcp-relay-gateway-address> + <excluded-v4-addresses> + <excluded-v4-address>192.168.1.7</excluded-v4-address> + </excluded-v4-addresses> + <v4-dhcp-pool-prefix>192.155.2.4</v4-dhcp-pool-prefix> + </v4-dhcp-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:5</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-dhcp-addresses-from-default-pool> + <excluded-v6-address>1:6</excluded-v6-address> + </excluded-v6-dhcp-addresses-from-default-pool> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + <v6-dhcp-pools> + <v6-dhcp-relay-next-hop-address>4:4</v6-dhcp-relay-next-hop-address> + <v6-dhcp-pool-prefix-length>28</v6-dhcp-pool-prefix-length> + <excluded-v6-addresses> + <excluded-v6-address>1:1</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-relay-gateway-address>3:3</v6-dhcp-relay-gateway-address> + <excluded-v6-addresses> + <excluded-v6-address>2:2</excluded-v6-address> + </excluded-v6-addresses> + <v6-dhcp-pool-prefix>0:0</v6-dhcp-pool-prefix> + </v6-dhcp-pools> + </dhcp> + <firewall-lite> + <stateful-firewall-lite-v6-enabled>N</stateful-firewall-lite-v6-enabled> + <stateful-firewall-lite-v4-enabled>Y</stateful-firewall-lite-v4-enabled> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.1</v4-firewall-prefix> + <v4-firewall-prefix-length>1</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>1</port-number> + </udp-ports> + <tcp-ports> + <port-number>1</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v4-firewall-packet-filters> + <v4-firewall-prefix>0.0.0.2</v4-firewall-prefix> + <v4-firewall-prefix-length>2</v4-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>2</port-number> + </udp-ports> + <tcp-ports> + <port-number>2</port-number> + </tcp-ports> + </v4-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>0</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>3</port-number> + </udp-ports> + <tcp-ports> + <port-number>3</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + <v6-firewall-packet-filters> + <v6-firewall-prefix>:</v6-firewall-prefix> + <v6-firewall-prefix-length>1</v6-firewall-prefix-length> + <allow-icmp-ping>Y</allow-icmp-ping> + <udp-ports> + <port-number>4</port-number> + </udp-ports> + <tcp-ports> + <port-number>4</port-number> + </tcp-ports> + </v6-firewall-packet-filters> + </firewall-lite> + <pat> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.44</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.5</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>0</v4-pat-pool-prefix-length> + </v4-pat-pools> + <use-v4-default-pool>Y</use-v4-default-pool> + <v4-pat-enabled>N</v4-pat-enabled> + <v4-pat-pools> + <v4-pat-pool-prefix>192.168.1.45</v4-pat-pool-prefix> + <v4-pat-pool-next-hop-address>192.168.1.6</v4-pat-pool-next-hop-address> + <v4-pat-pool-prefix-length>28</v4-pat-pool-prefix-length> + </v4-pat-pools> + </pat> + <nat> + <v4-nat-enabled>Y</v4-nat-enabled> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.0</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.0</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.0</v4-nat-external> + </v4-nat-mapping-entries> + <v4-nat-mapping-entries> + <v4-nat-internal>0.0.0.1</v4-nat-internal> + <v4-nat-next-hop-address>0.0.0.1</v4-nat-next-hop-address> + <v4-nat-external>0.0.0.1</v4-nat-external> + </v4-nat-mapping-entries> + </nat> + <vr-designation>primary</vr-designation> + <v4-vce-loopback-address>162.200.3.144</v4-vce-loopback-address> + <v6-vr-lan-prefix-length>64</v6-vr-lan-prefix-length> + <v6-vce-wan-address>2001:1890:12e3:2da::</v6-vce-wan-address> + <v6-vr-lan-prefix>2620:0:10d0:f:ffff:ffff:ffff:fffe</v6-vr-lan-prefix> + <v4-vr-lan-prefix-length>24</v4-vr-lan-prefix-length> + <v4-vr-lan-prefix>10.192.27.254</v4-vr-lan-prefix> + <v4-public-lan-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.2</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.1</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.72</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.71</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.68</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.67</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + </v4-public-lan-prefixes> + <v6-public-lan-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:3da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:4da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </v6-public-lan-prefixes> + </vr-lan-interface> + <routing-protocol>none</routing-protocol> + </vr-lan> +<ucpe-vms-service-information> + <transport-service-information> + <transport-service-type>AVPN</transport-service-type> + <access-circuit-info> + <access-circuit-id>1</access-circuit-id> + <dual-mode>Active</dual-mode> + </access-circuit-info> + <access-circuit-info> + <access-circuit-id>2</access-circuit-id> + <dual-mode>Standby</dual-mode> + </access-circuit-info> + </transport-service-information> + <ucpe-information> + <ucpe-host-name>hostname</ucpe-host-name> + <ucpe-activation-code>activecode</ucpe-activation-code> + <out-of-band-management-modem>OOB</out-of-band-management-modem> + </ucpe-information> + <vnf-list> + <vnf-information> + <vnf-instance-id>1</vnf-instance-id> + <vnf-sequence-number>1</vnf-sequence-number> + <vnf-type>ZZ</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL1</vnf-model> + <vnf-id>1</vnf-id> + <prov-status>1</prov-status> + <operational-state>1</operational-state> + <orchestration-status>1</orchestration-status> + <equipment-role>1</equipment-role> + </vnf-information> + <vnf-information> + <vnf-instance-id>2</vnf-instance-id> + <vnf-sequence-number>2</vnf-sequence-number> + <vnf-type>HY</vnf-type> + <vnf-vendor>JUNIPER</vnf-vendor> + <vnf-model>MODEL2</vnf-model> + <vnf-id>2</vnf-id> + <prov-status>2</prov-status> + <operational-state>2</operational-state> + <orchestration-status>2</orchestration-status> + <equipment-role>2</equipment-role> + </vnf-information> + </vnf-list> + </ucpe-vms-service-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <notification-url>https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</notification-url> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://msojra.mtsnjdcp1.aic.cip.att.com:8443/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>MTSNJA4LCP1</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>FOUR SEASONS HEATING & COOLING_8310006378683</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + <internet-service-change-details> + <internet-evc-speed-value>10</internet-evc-speed-value> + <internet-evc-speed-units>Kbps</internet-evc-speed-units> + <t-provided-v4-lan-public-prefixes> + <request-index>1</request-index> + <v4-next-hop-address>192.168.1.15</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.15</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v4-lan-public-prefixes> + <request-index>2</request-index> + <v4-next-hop-address>192.168.1.16</v4-next-hop-address> + <v4-lan-public-prefix>192.168.1.16</v4-lan-public-prefix> + <v4-lan-public-prefix-length>28</v4-lan-public-prefix-length> + </t-provided-v4-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + <t-provided-v6-lan-public-prefixes> + <request-index>1</request-index> + <v6-next-hop-address>2001:1890:12e3:2da::</v6-next-hop-address> + <v6-lan-public-prefix>2001:1890:12e3:2da::</v6-lan-public-prefix> + <v6-lan-public-prefix-length>28</v6-lan-public-prefix-length> + </t-provided-v6-lan-public-prefixes> + </internet-service-change-details> + </service-data> + </layer3-service-list> + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml new file mode 100644 index 0000000000..5808444d12 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequest_404CallBack.xml @@ -0,0 +1,13 @@ + + + + 39542e39-ccc3-4d1a-8b79-04ce88526613 + 404 + Error processing request to SDNC. Not Found. + https://sdncodl.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/MVM%2FVLXP%2F000855%2F%2FShakeout. + SDNC Returned-[error-type:application, error-tag:data-missing, + error-message:Request could not be completed because the relevant + data model content does not exist.] + + \ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata-nonfinal.text b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata-nonfinal.text new file mode 100644 index 0000000000..fa90fa3510 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata-nonfinal.text @@ -0,0 +1,42 @@ + <output xmlns="com:att:sdnctl:l3api"><ack-final-indicator>N</ack-final-indicator></output> + <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <source>mysrc</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>http://localhost:28080/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>clli</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>ST E2E Test42855_1300004281555</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + </service-data> + </layer3-service-list> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata.text b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata.text new file mode 100644 index 0000000000..816bef97eb --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadaptercallbackrequestdata.text @@ -0,0 +1,42 @@ + <output xmlns="com:att:sdnctl:l3api"><ack-final-indicator>Y</ack-final-indicator></output> + <layer3-service-list xmlns="com:att:sdnctl:l3api"> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <service-status> + <rpc-name>service-configuration-operation</rpc-name> + <rpc-action>activate</rpc-action> + <request-status>synccomplete</request-status> + <final-indicator>N</final-indicator> + <l3sdn-action>Layer3ServiceActivateRequest</l3sdn-action> + <l3sdn-subaction>SUPP</l3sdn-subaction> + <response-timestamp>2015-04-28T21:32:11.386Z</response-timestamp> + </service-status> + <service-data> + <internet-evc-access-information> + <ip-version>ds</ip-version> + <internet-evc-speed-value>8</internet-evc-speed-value> + <internet-evc-speed-units>Mbps</internet-evc-speed-units> + </internet-evc-access-information> + <request-information> + <request-action>Layer3ServiceActivateRequest</request-action> + <order-number>4281555</order-number> + <request-id>155415ab-b4a7-4382-b4c6-d17d9sm42855</request-id> + <source>OMX</source> + <order-version>1</order-version> + </request-information> + <sdnc-request-header> + <svc-action>activate</svc-action> + <svc-notification-url>https://localhost:28080/adapters/rest/SDNCNotify</svc-notification-url> + <svc-request-id>5b1f3c5d-cdf9-488d-8a4b-d3f1229d7760</svc-request-id> + </sdnc-request-header> + <l2-homing-information> + <topology>MultiPoint</topology> + <preferred-aic-clli>clli</preferred-aic-clli> + <evc-name>AS/VLXM/003717//SW</evc-name> + </l2-homing-information> + <service-information> + <service-instance-id>FK/VLXM/003717//SW_INTERNET</service-instance-id> + <subscriber-name>test HEATING & COOLING_8310006378683</subscriber-name> + <service-type>SDN-ETHERNET-INTERNET</service-type> + </service-information> + </service-data> + </layer3-service-list> diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml new file mode 100644 index 0000000000..231898adfa --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest-act.xml @@ -0,0 +1,33 @@ + + + + + + + 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 + activate + service-configuration-operation + http://127.0.0.1:28080/camunda/services/SDNCAdapterCallback + + + + + + 12570a36-7388-4c0a-bec4-189ce3kg9956 + Layer3ServiceActivate + OMX + + + mysvctype + PD/VLXM/003717//SW_INTERNET + + + + + 1 + 2 + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml new file mode 100644 index 0000000000..f71f529593 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/sdncadapterworkflowrequest.xml @@ -0,0 +1,32 @@ + + + + + + + 745b1b50-e39e-4685-9cc8-c71f0bde8bf0 + query + services/layer3-service-list/AS%2FVLXM%2F000199%2F%2FSB_INTERNET + http://127.0.0.1:28080/camunda/services/SDNCAdapterCallback + + + + + + 12570a36-7388-4c0a-bec4-189ce3kg9956 + GetLayer3ServiceDetailsRequest + OMX + + + SDN-ETHERNET-INTERNET + PD/VLXM/003717//SW_INTERNET + + + + + 1 + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn b/bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn new file mode 100644 index 0000000000..e5498e4d2b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/testAsyncResource.bpmn @@ -0,0 +1,81 @@ + + + + + SequenceFlow_1 + + + + + SequenceFlow_1 + SequenceFlow_9 + + + + SequenceFlow_9 + SequenceFlow_11 + + + + + SequenceFlow_11 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOCommonBPMN/src/test/resources/vnfAdapter/vnfUpdateSimResponse.xml b/bpmn/MSOCommonBPMN/src/test/resources/vnfAdapter/vnfUpdateSimResponse.xml new file mode 100644 index 0000000000..4e7c4ee687 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/vnfAdapter/vnfUpdateSimResponse.xml @@ -0,0 +1,22 @@ + + + + + + testRequestId + true + + MTSNJA4LCP1 + + 1512_1120-BB11-1 + BB11/VLXM/003717//SW_INTERNET + + false + e25ac2f1e73d46428de81a6130a6fdad + true + slcp34248vbc/020a112b-a0c8-4143-87a3-698680ba2efe + + + + \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/pom.xml b/bpmn/MSOCoreBPMN/pom.xml index 9decd590e3..bdc26713e9 100644 --- a/bpmn/MSOCoreBPMN/pom.xml +++ b/bpmn/MSOCoreBPMN/pom.xml @@ -1,181 +1,177 @@ - - org.openecomp.mso - bpmn - 1.1.0-SNAPSHOT - - 4.0.0 - org.openecomp.mso - MSOCoreBPMN - jar + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + org.openecomp.mso + bpmn + 1.1.0-SNAPSHOT + + 4.0.0 + org.openecomp.mso + MSOCoreBPMN + jar - - - - - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 2.6 - - - - - default-jar - package - - jar - - - - org/openecomp/mso/bpmn/test/** - - - - - - - test-utilities - package - - jar - - - test - - org/openecomp/mso/bpmn/test/** - - - - - + + + + org.apache.maven.plugins + maven-compiler-plugin + + + test-compile + compile + + testCompile + + + false + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.0.2 + + + tests-jar + package + + test-jar + + + false + + + + + + - - + - - - org.camunda.bpm - camunda-engine - provided - - - org.camunda.bpm - camunda-engine-rest - classes - - - - commons-fileupload - commons-fileupload - - - - - - commons-fileupload - commons-fileupload - 1.3.2 - - - javax.servlet - javax.servlet-api - 3.0.1 - provided - - - junit - junit - test - - - org.mockito - mockito-all - 1.10.19 - test - - - - org.camunda.connect - camunda-connect-connectors-all - compile - - - org.camunda.template-engines - camunda-template-engines-freemarker - - - org.camunda.bpm - camunda-engine-plugin-spin - - - - org.camunda.spin - camunda-spin-dataformat-json-jackson - - - org.camunda.spin - camunda-spin-dataformat-xml-dom - - - org.camunda.bpm - camunda-engine-plugin-connect - - - org.codehaus.groovy - groovy-all - compile - - - com.h2database - h2 - provided - - - net.sf.saxon - Saxon-HE - - - org.openecomp.mso - common - ${project.version} - - - org.jboss.resteasy - resteasy-jaxrs - 3.0.19.Final - provided - - - org.slf4j - slf4j-api - - - org.slf4j - slf4j-simple - - - org.apache.httpcomponents - httpclient - - - - - org.json - json - 20160212 - - - xmlunit - xmlunit - 1.6 - - - + + + org.evosuite + evosuite-standalone-runtime + ${evosuiteVersion} + test + + + org.camunda.bpm + camunda-engine + provided + + + org.camunda.bpm + camunda-engine-rest + classes + + + + commons-fileupload + commons-fileupload + + + + + + commons-fileupload + commons-fileupload + 1.3.2 + + + javax.servlet + javax.servlet-api + 3.0.1 + provided + + + + org.mockito + mockito-all + 1.10.19 + test + + + + org.camunda.connect + camunda-connect-connectors-all + compile + + + org.camunda.template-engines + camunda-template-engines-freemarker + + + org.camunda.bpm + camunda-engine-plugin-spin + + + + + org.camunda.spin + camunda-spin-dataformat-all + + + org.camunda.bpm + camunda-engine-plugin-connect + + + org.codehaus.groovy + groovy-all + compile + + + com.h2database + h2 + test + + + net.sf.saxon + Saxon-HE + + + org.openecomp.mso + common + ${project.version} + + + org.jboss.resteasy + resteasy-jaxrs + 3.0.19.Final + provided + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + + + org.apache.httpcomponents + httpclient + + + + + org.json + json + 20160212 + + + xmlunit + xmlunit + 1.6 + + + org.openecomp.mso + status-control + ${project.version} + + + \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/test/CamundaDBSetup.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java similarity index 57% rename from bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/test/CamundaDBSetup.java rename to bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java index 13eed2d530..aba43eb522 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/test/CamundaDBSetup.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/CamundaDBSetup.java @@ -1,24 +1,4 @@ -/*- - * ============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.test; +package org.openecomp.mso.bpmn.core; import java.sql.Connection; import java.sql.DriverManager; @@ -55,10 +35,10 @@ public class CamundaDBSetup { stmt.close(); stmt = null; - stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column NAME_ clob"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; +// stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column NAME_ clob"); +// stmt.executeUpdate(); +// stmt.close(); +// stmt = null; stmt = connection.prepareStatement("delete from ACT_HI_DETAIL"); stmt.executeUpdate(); @@ -70,10 +50,10 @@ public class CamundaDBSetup { stmt.close(); stmt = null; - stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column NAME_ clob"); - stmt.executeUpdate(); - stmt.close(); - stmt = null; +// stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column NAME_ clob"); +// stmt.executeUpdate(); +// stmt.close(); +// stmt = null; stmt = connection.prepareStatement("ALTER TABLE ACT_RU_VARIABLE alter column TEXT_ clob"); stmt.executeUpdate(); @@ -105,4 +85,4 @@ public class CamundaDBSetup { } } } -} +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java index df6213284c..2edbc99a77 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/HealthCheckHandler.java @@ -7,9 +7,9 @@ * 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. @@ -30,12 +30,18 @@ import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import java.io.BufferedReader; +import java.io.InputStream; import java.io.InputStreamReader; +import java.util.Base64; import java.util.Map; +import java.util.Properties; import java.util.UUID; import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.utils.UUIDChecker; +import org.openecomp.mso.HealthCheckUtils; import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.utils.CryptoUtils; import javax.ws.rs.GET; import javax.ws.rs.HEAD; import javax.ws.rs.Path; @@ -48,10 +54,14 @@ import org.camunda.bpm.engine.ProcessEngines; @Path("/") public class HealthCheckHandler { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); private static final String SITENAME = "mso.sitename"; private static final String ADPTER_ENDPOINT = "mso.adapters.db.endpoint"; private static final String CONFIG = "mso.bpmn.urn.properties"; + private static final String PENGINE_PROPERTY = "processengine.properties"; + private static final String PENGINE_PARAM = "processEngineName"; + private static final String CREDENTIAL = "mso.adapters.db.auth"; + private static final String MSOKEY = "mso.msoKey"; private static final String CHECK_HTML = "Health CheckApplication ready"; private static final String NOT_FOUND = "Application Not StartedApplication not started. Properties file missing or invalid or database Connection failed"; @@ -66,6 +76,59 @@ public class HealthCheckHandler { .entity (NOT_FOUND) .build (); + @HEAD + @GET + @Path("/nodehealthcheck") + @Produces("text/html") + public Response nodeHealthcheck () { + MsoLogger.setServiceName ("NodeHealthcheck"); + // Generate a Request Id + String requestId = UUIDChecker.generateUUID(msoLogger); + + PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance(); + Map props = propertyConfiguration.getProperties(CONFIG); + + if (props == null) { + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.AvailabilityError, "Unable to load " + CONFIG); + + return NOT_STARTED_RESPONSE; + } + + String siteName = props.get(SITENAME); + String endpoint = props.get(ADPTER_ENDPOINT); + + if (null == siteName || siteName.length () == 0 || null == endpoint || endpoint.length () == 0) { + + msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, "Unable to load key attributes (" + SITENAME + " or " + ADPTER_ENDPOINT + ") from the config file:" + CONFIG); + + return NOT_STARTED_RESPONSE; + } + + try { + if (!this.getSiteStatus (endpoint, siteName, props.get(CREDENTIAL), props.get(MSOKEY))) { + msoLogger.debug("This site is currently disabled for maintenance."); + return HEALTH_CHECK_NOK_RESPONSE; + } + } catch (Exception e) { + + msoLogger.error(MessageEnum.GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception while getting SiteStatus", e); + + msoLogger.debug("Exception while getting SiteStatus"); + return NOT_STARTED_RESPONSE; + } + + + HealthCheckUtils healthCheck = new HealthCheckUtils (); + if (healthCheck.verifyNodeHealthCheck(HealthCheckUtils.NodeType.BPMN, requestId)) { + msoLogger.debug("nodeHealthcheck - Successful"); + return HealthCheckUtils.HEALTH_CHECK_RESPONSE; + } else { + msoLogger.debug("nodeHealthcheck - At leaset one of the sub-modules is not available."); + return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; + } + } + @HEAD @GET @Path("/healthcheck") @@ -95,7 +158,7 @@ public class HealthCheckHandler { } try { - if (!this.getSiteStatus (endpoint, siteName)) { + if (!this.getSiteStatus (endpoint, siteName, props.get(CREDENTIAL), props.get(MSOKEY))) { msoLogger.debug("This site is currently disabled for maintenance."); return HEALTH_CHECK_NOK_RESPONSE; } @@ -108,7 +171,13 @@ public class HealthCheckHandler { } try { - ProcessEngines.getDefaultProcessEngine().getIdentityService().createGroupQuery().list(); + InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(PENGINE_PROPERTY); + Properties prop = new Properties(); + prop.load(stream); + String [] engineNames = prop.getProperty(PENGINE_PARAM).split(","); + for (String engine : engineNames) { + ProcessEngines.getProcessEngine(engine).getIdentityService().createGroupQuery().list(); + } } catch (final Exception e) { msoLogger.error(MessageEnum.GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception while verifying Camunda engine", e); @@ -144,8 +213,18 @@ public class HealthCheckHandler { } } - private boolean getSiteStatus (String url, String site) throws Exception { - HttpResponse response; + private String decrypt(String encryptedString, String key){ + try { + if (encryptedString != null || !encryptedString.isEmpty() && key != null && !key.isEmpty()) { + return CryptoUtils.decrypt(encryptedString, key); + } + } catch (Exception e) { + msoLogger.error(MessageEnum.GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Failed to decrypt credentials", e); + } + return null; + } + + private boolean getSiteStatus (String url, String site, String credential, String key) throws Exception { // set the connection timeout value to 30 seconds (30000 milliseconds) RequestConfig.Builder requestBuilder = RequestConfig.custom(); requestBuilder = requestBuilder.setConnectTimeout(30000); @@ -154,12 +233,17 @@ public class HealthCheckHandler { builder.setDefaultRequestConfig (requestBuilder.build ()); HttpPost post = new HttpPost(url); + + String cred = decrypt(credential, key); + if (cred != null && !cred.isEmpty()) { + post.setHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(cred.getBytes())); + } msoLogger.debug("Post url is: " + url); //now create a soap request message as follows: final StringBuffer payload = new StringBuffer(); payload.append("\n"); - payload.append("\n"); + payload.append("\n"); payload.append("\n"); payload.append("\n"); payload.append("\n"); @@ -173,31 +257,31 @@ public class HealthCheckHandler { HttpEntity entity = new StringEntity(payload.toString(),"UTF-8"); post.setEntity(entity); - try (CloseableHttpClient client = builder.build()) { - response = client.execute(post); - msoLogger.debug("Response received is:" + response); - - int statusCode = response.getStatusLine().getStatusCode(); - if (statusCode != 200) { + CloseableHttpClient client = builder.build (); + HttpResponse response = client.execute(post); + msoLogger.debug("Response received is:" + response); - msoLogger.error(MessageEnum.GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, - "Communication with DB Adapter failed, The response received from DB Adapter is with failed status code:" + statusCode); + int statusCode = response.getStatusLine().getStatusCode(); + if (statusCode != 200) { - Exception e = new Exception("Communication with DB Adapter failed"); - throw e; - } - BufferedReader rd = new BufferedReader( - new InputStreamReader(response.getEntity().getContent())); + msoLogger.error(MessageEnum.GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, + "Communication with DB Adapter failed, The response received from DB Adapter is with failed status code:" + statusCode); - StringBuffer result = new StringBuffer(); - String line = ""; - while ((line = rd.readLine()) != null) { - result.append(line); - } - msoLogger.debug("Content of the response is:" + result); - String status = result.substring(result.indexOf("") + 8, result.indexOf("")); + Exception e = new Exception("Communication with DB Adapter failed"); + throw e; + } + BufferedReader rd = new BufferedReader( + new InputStreamReader(response.getEntity().getContent())); - return Boolean.valueOf(status); + StringBuffer result = new StringBuffer(); + String line = ""; + while ((line = rd.readLine()) != null) { + result.append(line); } + msoLogger.debug("Content of the response is:" + result); + String status = result.substring(result.indexOf("") + 8, result.indexOf("")); + + client.close (); //shut down the connection + return Boolean.valueOf(status); } -} +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java index 90df1da7e5..d58d046598 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfiguration.java @@ -7,9 +7,9 @@ * 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. @@ -51,11 +51,11 @@ import org.openecomp.mso.logger.MsoLogger; /** * Loads the property configuration from file system and refreshes the * properties when the property gets changed. - * + * * WARNING: automatic refreshes might not work on network filesystems. */ public class PropertyConfiguration { - + /** * The base name of the MSO BPMN properties file (mso.bpmn.properties). */ @@ -65,7 +65,11 @@ public class PropertyConfiguration { * The base name of the MSO BPMN URN-Mappings properties file (mso.bpmn.urn.properties). */ public static final String MSO_BPMN_URN_PROPERTIES = "mso.bpmn.urn.properties"; - + + /** + * The base name of the MSO Topology properties file (topology.properties). + */ + public static final String MSO_TOPOLOGY_PROPERTIES = "topology.properties"; /** * The name of the meta-property holding the time the properties were loaded * from the file. @@ -75,7 +79,7 @@ public class PropertyConfiguration { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); private static final List SUPPORTED_FILES = - Arrays.asList(MSO_BPMN_PROPERTIES, MSO_BPMN_URN_PROPERTIES); + Arrays.asList(MSO_BPMN_PROPERTIES, MSO_BPMN_URN_PROPERTIES, MSO_TOPOLOGY_PROPERTIES); private volatile String msoConfigPath = null; @@ -87,7 +91,7 @@ public class PropertyConfiguration { // The key is the file name private Map timerTaskMap = new HashMap(); - + /** * Singleton holder pattern eliminates locking when accessing the instance * and still provides for lazy initialization. @@ -116,7 +120,7 @@ public class PropertyConfiguration { private PropertyConfiguration() { startUp(); } - + /** * May be called to restart the PropertyConfiguration if it was previously shut down. */ @@ -228,7 +232,7 @@ public class PropertyConfiguration { return Collections.unmodifiableMap(properties); } - + /** * Reads properties from the specified file, updates the property file cache, and * returns the properties in a map. @@ -270,7 +274,7 @@ public class PropertyConfiguration { return properties; } - + /** * File watcher thread which monitors a directory for file modification. */ diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/test/PropertyConfigurationSetup.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java similarity index 89% rename from bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/test/PropertyConfigurationSetup.java rename to bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java index 6f1cd7d8cc..f58efe79c8 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/test/PropertyConfigurationSetup.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/PropertyConfigurationSetup.java @@ -1,24 +1,4 @@ -/*- - * ============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.test; +package org.openecomp.mso.bpmn.core; import java.io.FileOutputStream; import java.io.FileReader; @@ -312,4 +292,4 @@ public class PropertyConfigurationSetup { } } } -} +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java index 8a7b20016b..926f2af9aa 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/XQueryScriptTask.java @@ -240,4 +240,4 @@ public class XQueryScriptTask extends BaseTask { } } } -} +} \ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java index 8329746347..462bda8077 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java @@ -21,8 +21,11 @@ package org.openecomp.mso.bpmn.core.json; import java.util.Iterator; +import java.util.Map; +import java.util.HashMap; import java.util.StringTokenizer; +import org.camunda.bpm.engine.runtime.Execution; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -79,7 +82,7 @@ public class JsonUtils { /** * Uses the JSONObject static method to convert a JSON doc to XML. - * Note: this method will not generate valid XML if the JSONObject + * Note: this method may not generate valid XML if the JSONObject * contains JSONArrays which are used to represent XML attributes * in the JSON doc. * @@ -92,9 +95,11 @@ public class JsonUtils { try { JSONObject jsonObj = new JSONObject(jsonStr); if (pretty) { - return XmlTool.normalize(XML.toString(jsonObj)); + // use the local class method which properly handles certain JSONArray content + return XmlTool.normalize(toXMLString(jsonObj, null)); } else { - return XML.toString(jsonObj); +// use the local class method which properly handles certain JSONArray content + return toXMLString(jsonObj, null); } } catch (Exception e){ msoLogger.debug("json2xml(): unable to parse json and convert to xml. Exception was: " + e.toString()); @@ -102,6 +107,154 @@ public class JsonUtils { } } + /** + * Uses a modified version of the org.json.XML toString() algorithm + * to convert a JSONObject to an XML Doc. The intent of this is to + * correctly generate XML from JSON including TAGs for JSONArrays + * + * @param jsonObj org.json.JSON object to be converted to XML + * @param tagName optional XML tagname supplied primarily during recursive calls + * @return String containing the XML translation + */ + public static String toXMLString(Object obj, String tagName) throws JSONException { + StringBuffer strBuf = new StringBuffer(); + int i; + JSONArray jsonArr; + JSONObject jsonObj; + String key; + Iterator keys; + int len; + String str; + Object curObj; + if (obj instanceof JSONObject) { + // msoLogger.debug("toXMLString(): is a JSONObject"); + // append "" to the XML output + if (tagName != null) { +// msoLogger.debug("toXMLString(): adding opening tagName: " + tagName); + strBuf.append("<"); + strBuf.append(tagName); + strBuf.append(">"); + } + // iterate thru the keys. + jsonObj = (JSONObject) obj; + keys = jsonObj.keys(); + while (keys.hasNext()) { + key = keys.next().toString(); + // msoLogger.debug("toXMLString(): key is " + k); + curObj = jsonObj.opt(key); + if (curObj == null) { + curObj = ""; + } + if (curObj instanceof String) { + str = (String) curObj; + } else { + str = null; + } + // append the content to the XML output + if (key.equals("content")) { + if (curObj instanceof JSONArray) { + jsonArr = (JSONArray) curObj; + len = jsonArr.length(); + for (i = 0; i < len; i += 1) { + if (i > 0) { + strBuf.append('\n'); + } + strBuf.append(XML.escape(jsonArr.get(i).toString())); + } + } else { + strBuf.append(XML.escape(curObj.toString())); + } + // append an array of similar keys to the XML output + } else if (curObj instanceof JSONArray) { + jsonArr = (JSONArray) curObj; + len = jsonArr.length(); +// msoLogger.debug("toXMLString(): found JSONArray: " + key + ", size: " + len); + for (i = 0; i < len; i += 1) { + curObj = jsonArr.get(i); + if (curObj instanceof JSONArray) { +// The XML tags for the nested array should be generated below when this method +// is called recursively and the JSONArray object is passed +// strBuf.append("<"); +// strBuf.append(key); +// strBuf.append(">"); + strBuf.append(toXMLString(curObj, null)); +// strBuf.append(""); + } else { +// msoLogger.debug("toXMLString(): recursive call toXML() with tagName null"); + // append the opening tag for the array (before 1st element) + if (i == 0) { + strBuf.append("<"); + strBuf.append(key); + strBuf.append(">"); + } + // append the opening tag for the array + strBuf.append(toXMLString(curObj, null)); + // append the closing tag for the array (after last element) + if (i == (len - 1)) { + strBuf.append(""); + } + } + } + } else if (curObj.equals("")) { + // append a closing tag "" to the XML output + strBuf.append("<"); + strBuf.append(key); + strBuf.append("/>"); + } else { +// msoLogger.debug("toXMLString(): recursive call toXMLString() with tagName: " + key); + strBuf.append(toXMLString(curObj, key)); + } + // msoLogger.debug("toXML(): partial XML: " + strBuf.toString()); + } + if (tagName != null) { + // append the closing tag "" to the XML output +// msoLogger.debug("toXMLString(): adding closing tagName: " + tagName); + strBuf.append(""); + } + return strBuf.toString(); + // XML does not have good support for arrays. If an array appears in a place + // where XML is lacking, synthesize an < array > element. + } else if (obj instanceof JSONArray) { + jsonArr = (JSONArray) obj; + len = jsonArr.length(); + for (i = 0; i < len; ++i) { + curObj = jsonArr.opt(i); + strBuf.append(toXMLString(curObj, (tagName == null) ? "array" + : tagName)); + } + return strBuf.toString(); + } else { +// msoLogger.debug("toXML(): in else block with tagName: " + tagName); + str = (obj == null) ? "null" : XML.escape(obj.toString()); + return (tagName == null) ? "\"" + str + "\"" + : (str.length() == 0) ? "<" + tagName + "/>" : "<" + + tagName + ">" + str + ""; + } + } + + /** + * Formats the JSON String using the value of MSOJsonIndentFactor. + * + * @param jsonStr String containing the JSON doc + * @return String containing the formatted JSON doc + */ + public static String prettyJson(String jsonStr) { +// String isDebugLogEnabled = "true"; + try { + JSONObject jsonObj = new JSONObject(jsonStr); + return jsonObj.toString(MSOJsonIndentFactor); + } catch (Exception e){ + msoLogger.debug("prettyJson(): unable to parse/format json input. Exception was: " + e.toString()); + return null; + } + } + /** * Invokes json2xml(String, Boolean) defaulting to 'pretty' output. * @@ -111,23 +264,43 @@ public class JsonUtils { public static String json2xml(String jsonStr) { return json2xml(jsonStr, true); } - + /** - * Uses the JSONObject static method to convert a JSON doc to XML. + * Returns an Iterator over the JSON keys in the specified JSON doc. * * @param jsonStr String containing the JSON doc * @return Iterator over the JSON keys + * @throws JSONException if the doc cannot be parsed */ - public static Iterator getJsonIterator(String jsonStr) { -// String isDebugLogEnabled = "true"; - try { - JSONObject json = new JSONObject(jsonStr); - return json.keys(); - - } catch (Exception e){ - msoLogger.debug("getJsonIterator(): unable to parse json to retrieve the keys iterator. Exception was: " + e.toString()); - return null; + public static Iterator getJsonIterator(String jsonStr) throws JSONException { + return new JSONObject(jsonStr).keys(); + } + + /** + * Returns the name of the "root" property in the specified JSON doc. The + * "root" property is the single top-level property in the JSON doc. An + * exception is thrown if the doc is empty or if it contains more than one + * top-level property. + * + * @param jsonStr String containing the JSON doc + * @return the name of the "root" property + * @throws JSONException if the doc cannot be parsed, or if it is empty, or if + * it contains more than one top-level property + */ + public static String getJsonRootProperty(String jsonStr) throws JSONException { + Iterator iter = getJsonIterator(jsonStr); + + if (!iter.hasNext()) { + throw new JSONException("Empty JSON object"); } + + String rootPropertyName = iter.next(); + + if (iter.hasNext()) { + throw new JSONException("JSON object has more than one root property"); + } + + return rootPropertyName; } /** @@ -161,11 +334,73 @@ public class JsonUtils { } return null; } + + + /** + * Invokes the getJsonRawValue() method with the wrap flag set to true + * and returns the String equivalent of the json node object returned. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @return String field value associated with keys + */ + public static String getJsonNodeValue(String jsonStr, String keys) { +// String isDebugLogEnabled = "true"; + try { + Object rawValue = getJsonRawValue(jsonStr, keys, true); + if (rawValue == null) { + return null; + } else { + if (rawValue instanceof String) { + msoLogger.debug("getJsonNodeValue(): the raw value is a String Object=" + ((String) rawValue).toString()); + return (String) rawValue; + } else { + msoLogger.debug("getJsonNodeValue(): the raw value is NOT a String Object=" + rawValue.toString()); + return rawValue.toString(); + } + } + } catch (Exception e) { + msoLogger.debug("getJsonNodeValue(): unable to parse json to retrieve node for field=" + keys + ". Exception was: " + e.toString()); + } + return null; + } /** - * Invokes the getJsonRawValue() method to obtain the JSONArray associated with - * the specified keys. The JSONArray is then walked to retrieve the content value of - * the specified field name. + * Invokes the getJsonRawValue() method and returns the String equivalent of + * the object returned. + * + * TBD: May need separate methods for boolean, float, and integer fields if the + * String representation is not sufficient to meet client needs. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @return String field value associated with keys + */ + public static int getJsonIntValue(String jsonStr, String keys) { +// String isDebugLogEnabled = "true"; + try { + Object rawValue = getJsonRawValue(jsonStr, keys); + if (rawValue == null) { + return 0; + } else { + if (rawValue instanceof Integer) { + msoLogger.debug("getJsonValue(): the raw value is an Integer Object=" + ((String) rawValue).toString()); + return (Integer) rawValue; + } else { + msoLogger.debug("getJsonValue(): the raw value is NOT an Integer Object=" + rawValue.toString()); + return 0; + } + } + } catch (Exception e) { + msoLogger.debug("getJsonValue(): unable to parse json to retrieve value for field=" + keys + ". Exception was: " + e.toString()); + } + return 0; + } + + /** + * Invokes the getJsonParamValue() method to obtain the JSONArray associated with + * the specified keys. The JSONArray is then walked to retrieve the first array + * value associated with the specified field name (index=0). * * @param jsonStr String containing the JSON doc * @param keys full key path to the target value in the format of "key1.key2.key3..." @@ -173,6 +408,21 @@ public class JsonUtils { * @return String param value associated with field name */ public static String getJsonParamValue(String jsonStr, String keys, String name) { + return getJsonParamValue(jsonStr, keys, name, 0); + } + + /** + * Invokes the getJsonRawValue() method to obtain the JSONArray associated with + * the specified keys. The JSONArray is then walked to retrieve the nth array + * value associated with the specified field name and index + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @param name field name for the param to be retrieved + * @param index the nth param associated with name starting at 0 + * @return String param value associated with field name + */ + public static String getJsonParamValue(String jsonStr, String keys, String name, int index) { // String isDebugLogEnabled = "true"; try { Object rawValue = getJsonRawValue(jsonStr, keys); @@ -181,14 +431,28 @@ public class JsonUtils { } else { if (rawValue instanceof JSONArray) { msoLogger.debug("getJsonParamValue(): keys=" + keys + " points to JSONArray: " + ((JSONArray) rawValue).toString()); - for (int i = 0; i < ((JSONArray) rawValue).length(); i++) { + int arrayLen = ((JSONArray) rawValue).length(); + if (index < 0 || arrayLen < index+1) { + msoLogger.debug("getJsonParamValue(): index: " + index + " is out of bounds for array size of " + arrayLen); + return null; + } + int foundCnt = 0; + for (int i = 0; i < arrayLen; i++) { msoLogger.debug("getJsonParamValue(): index: " + i + ", value: " + ((JSONArray) rawValue).get(i).toString()); if (((JSONArray) rawValue).get(i) instanceof JSONObject) { msoLogger.debug("getJsonParamValue(): index: " + i + " is a JSONObject"); JSONObject jsonObj = (JSONObject)((JSONArray) rawValue).get(i); - if (jsonObj.get("name").equals(name)) { - msoLogger.debug("getJsonParamValue(): found value: " + (String) jsonObj.get("content") + " for name: " + name); - return (String) jsonObj.get("content"); + String parmValue = jsonObj.get(name).toString(); + if (parmValue != null) { + msoLogger.debug("getJsonParamValue(): found value: " + parmValue + " for name: " + name + " and index: " + i); + if (foundCnt == index) { + return parmValue; + } else { + foundCnt++; + continue; + } + } else { + continue; } } else { msoLogger.debug("getJsonParamValue(): the JSONArray element is NOT a JSONObject=" + rawValue.toString()); @@ -275,6 +539,49 @@ public class JsonUtils { return keyValue; } + /** + * Walks the JSONObject (and sub-objects recursively), searching for the first value associated with the + * single key/field name specified. Returns the associated value if found or null if the key is not found + * + * @param jsonObj JSONObject representation of the the JSON doc + * @param key key to the target value + * @return String field value associated with key + */ + public static Integer getJsonIntValueForKey(JSONObject jsonObj, String key) { +// String isDebugLogEnabled = "true"; + Integer keyValue = 0; + try { + if (jsonObj.has(key)) { + msoLogger.debug("getJsonValueForKey(): found value for key=" + key); + return ((Integer) jsonObj.get(key)); + } else { + msoLogger.debug("getJsonValueForKey(): iterating over the keys"); + Iterator itr = jsonObj.keys(); + while (itr.hasNext()) { + String nextKey = (String) itr.next(); + Object obj = jsonObj.get(nextKey); + if (obj instanceof JSONObject) { + msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", points to JSONObject, recursive call"); + keyValue = getJsonIntValueForKey((JSONObject) obj, key); + if (keyValue != null) { + msoLogger.debug("getJsonValueForKey(): found value=" + keyValue + ", for key=" + key); + break; + } + } else { + msoLogger.debug("getJsonValueForKey(): key=" + nextKey + ", does not point to a JSONObject, next key"); + } + } + } + } catch (JSONException je) { + // JSONObject::get() throws this exception if one of the specified keys is not found + msoLogger.debug("getJsonValueForKey(): caught JSONException attempting to retrieve value for key=" + key); + keyValue = null; + } catch (Exception e) { + msoLogger.debug("getJsonValueForKey(): unable to parse json to retrieve value for field=" + key + ". Exception was: " + e.toString()); + } + return keyValue; + } + /** * Boolean method to determine if a key path is valid for the JSON doc. Invokes * getJsonValue(). @@ -365,6 +672,22 @@ public class JsonUtils { * @return Object field value associated with keys */ private static Object getJsonRawValue(String jsonStr, String keys) { + return getJsonRawValue(jsonStr, keys, false); + } + + /** + * Walks the JSON doc using the full key path to retrieve the associated + * value. All but the last key points to the 'parent' object name(s) in order + * in the JSON hierarchy with the last key pointing to the target value. + * The value returned is a Java object. + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * * @param wrap Boolean which determines if returned JSONObjects sould be "wrapped" + * Note: wrap does not apply to returned scalar values + * @return Object field value associated with keys + */ + private static Object getJsonRawValue(String jsonStr, String keys, Boolean wrap) { // String isDebugLogEnabled = "true"; String keyStr = ""; try { @@ -383,11 +706,19 @@ public class JsonUtils { return keyValue; } } - // we should not hit this point: either the key points to a valid value and - // we return it above or the key is invalid and we handle the JSONException - // below and return null - return null; - + // return the json 'node' that the key points to + // note: since this is a json object and not a scalar value, + // use the wrap flag to determine if the object should + // be wrapped with a root node value + // (the last key in the keys String) + if (wrap) { + JSONObject wrappedJsonObj = new JSONObject(); + wrappedJsonObj.put(keyStr, jsonObj); + return wrappedJsonObj.toString(); + } else { + return jsonObj.toString(); + } + } catch (JSONException je) { // JSONObject::get() throws this exception if one of the specified keys is not found msoLogger.debug("getJsonRawValue(): caught JSONException attempting to retrieve raw value for key=" + keyStr); @@ -439,5 +770,61 @@ public class JsonUtils { } return null; } + + /** + * This json util method converts a json "Key" and "Value" + * entry Array to a Java map. + * + * @param execution + * @param entryArray - the json value of the entry Array + * + * @return map - a Map containing the entries + * + */ + public Map entryArrayToMap(Execution execution, String entryArray) { + msoLogger.debug("Started Entry Array To Map Util Method"); + + Map map = new HashMap(); + + //Populate Map + String entryListJson = "{ \"entry\":" + entryArray + "}"; + JSONObject obj = new JSONObject(entryListJson); + JSONArray arr = obj.getJSONArray("entry"); + for (int i = 0; i < arr.length(); i++){ + JSONObject jo = arr.getJSONObject(i); + String key = jo.getString("key"); + String value =jo.getString("value"); + map.put(key, value); + } + msoLogger.debug("Outgoing Map is: " + map); + msoLogger.debug("Completed Entry Array To Map Util Method"); + return map; + } + + + /** + * Invokes the getJsonRawValue() method to determine if the + * json element/variable exist. Returns true if the + * json element exist + * + * @param jsonStr String containing the JSON doc + * @param keys full key path to the target value in the format of "key1.key2.key3..." + * @return boolean field value associated with keys + */ + public static boolean jsonElementExist(String jsonStr, String keys) { + + try { + Object rawValue = getJsonRawValue(jsonStr, keys); + if (rawValue == null) { + return false; + } else { + return true; + } + } catch (Exception e) { + msoLogger.debug("jsonElementExist(): unable to determine if json element exist. Exception is: " + e.toString()); + } + return true; + } + } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java index 8e3f254def..2453700bce 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/plugins/LoggingAndURNMappingPlugin.java @@ -399,8 +399,8 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { MsoLogger.setServiceName("MSO." + prefix.substring(0,prefix.length()-1)); } - String requestId = (String) execution.getVariable("att-mso-request-id"); - String svcid = (String) execution.getVariable("att-mso-service-instance-id"); + String requestId = (String) execution.getVariable("mso-request-id"); + String svcid = (String) execution.getVariable("mso-service-instance-id"); MsoLogger.setLogContext(requestId, svcid); long startTime = startTimes.remove(id); diff --git a/bpmn/MSOCoreBPMN/src/main/resources/urnMapping.xml b/bpmn/MSOCoreBPMN/src/main/resources/urnMapping.xml index fd5d586278..274c859dd9 100644 --- a/bpmn/MSOCoreBPMN/src/main/resources/urnMapping.xml +++ b/bpmn/MSOCoreBPMN/src/main/resources/urnMapping.xml @@ -32,12 +32,12 @@ diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTest.java deleted file mode 100644 index 71b9e089c3..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Mon Nov 14 11:35:04 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core; - -import org.junit.Test; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.junit.runner.RunWith; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class BPMNLoggerESTest extends BPMNLoggerESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - BPMNLogger.debug("true", "<,A1M\"[ K3\\u"); - } - - @Test(timeout = 4000) - public void test1() throws Throwable { - BPMNLogger.debug("trud", (String) null); - } - - @Test(timeout = 4000) - public void test2() throws Throwable { - BPMNLogger bPMNLogger0 = new BPMNLogger(); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTest.java deleted file mode 100644 index 113c819f8c..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BadInjectedFieldExceptionESTest.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Mon Nov 14 11:35:23 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core; - -import org.junit.Test; -import static org.junit.Assert.*; - -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.junit.runner.RunWith; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class BadInjectedFieldExceptionESTest extends BadInjectedFieldExceptionESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - BadInjectedFieldException badInjectedFieldException0 = new BadInjectedFieldException("", "", ""); - BadInjectedFieldException badInjectedFieldException1 = new BadInjectedFieldException("y#,,", "4tX0!<", (Object) badInjectedFieldException0, (Throwable) badInjectedFieldException0); - assertFalse(badInjectedFieldException1.equals((Object)badInjectedFieldException0)); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java index 6176029075..8a2b0a5578 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/JsonUtilsTest.java @@ -18,6 +18,26 @@ * ============LICENSE_END========================================================= */ +/*- + * ============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.core; import java.io.BufferedReader; @@ -25,11 +45,11 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; +import java.nio.CharBuffer; import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.xml.sax.SAXException; import org.custommonkey.xmlunit.Diff; @@ -42,214 +62,311 @@ import org.openecomp.mso.bpmn.core.xml.XmlTool; */ public class JsonUtilsTest { - private static final String EOL = "\n"; - private String xmlReq = - "" + EOL + - " " + EOL + - " DEV-VF-0021" + EOL + - " CREATE_VF_MODULE" + EOL + - " PORTAL" + EOL + - " " + EOL + - " " + EOL + - " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + - " STMTN5MMSC21" + EOL + - " asc_heat-int" + EOL + - " STMTN5MMSC21-MMSC::module-0-0" + EOL + - " STMTN5MMSC21-MMSC::model-1-0" + EOL + - " true" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " 1.0" + EOL + - " 999999999-0000-0000-0000-000000000000" + EOL + - " 1.5" + EOL + - " 00000000-0000-0000-0000-000000000000" + EOL + - " SDN-ETHERNET-INTERNET" + EOL + - " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + - " pending-delete" + EOL + - " RDM2WAGPLCP" + EOL + - " 1" + EOL + - " " + EOL + - " " + EOL + - " network1111" + EOL + - " server1111" + EOL + - " " + EOL + - "" + EOL; - - private String xmlReqNoAttrs = - "" + 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; - - // JSON request w/ embedded XML will be read from a file - private String jsonReq = null; - - @Before - public void initialize() { - File file = new File("src/test/resources/request.json"); - FileInputStream fis = null; - - try { - fis = new FileInputStream(file); - BufferedReader br = new BufferedReader(new InputStreamReader(fis)); - jsonReq = br.readLine(); - if (jsonReq != null) { - System.out.println("initialize(): json request: " + jsonReq); - } else { - System.out.println("initialize(): failed to read json request from src/test/resources/request.json"); - } - } catch (IOException e) { - e.printStackTrace(); - } finally { - try { - if (fis != null) - fis.close(); - } catch (IOException ex) { - ex.printStackTrace(); - } - } - } - - @After - public void cleanup(){ - } - - @Test - public void testConversion() { - // Note: the current version of the JsonUtils.json2xml() method - // does not support converting the JSONObject representation - // of XML attributes (JSONArray) back to XML. So this test will - // only succeed if the original XML does not contain attributes - - // save a copy of the xml with the namespaces removed - String xmlIn = XmlTool.removeNamespaces(xmlReqNoAttrs); - // strip all the whitespace - xmlIn = xmlIn.replaceAll("\\s+",""); - String json = JsonUtils.xml2json(xmlReqNoAttrs); - System.out.println("testConversion(): xml request to json: " + json); - String xmlOut = JsonUtils.json2xml(json); - System.out.println("testConversion(): json request back to xml: " + xmlOut); - - // strip all the whitespace - xmlOut = xmlOut.replaceAll("\\s+",""); -// System.out.println("testConversion(): xml in: " + xmlIn); -// System.out.println("testConversion(): xml out: " + xmlOut); - - Diff diffXml; - try { - diffXml = new Diff(xmlIn, xmlOut); - Assert.assertTrue(diffXml.similar()); -// Assert.assertTrue(diffXml.identical()); - } catch (SAXException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - @Test - public void testRetrieval() { - String json = JsonUtils.xml2json(xmlReq); - System.out.println("testRetrieval(): xml request to json: " + json); - // full JSON path - String value = JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.vnf-name"); - Assert.assertEquals(value, "STMTN5MMSC21"); - value = JsonUtils.getJsonValue(json, "vnf-request.request-info.action"); - Assert.assertEquals(value, "CREATE_VF_MODULE"); - // retrieving an integer - value = JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.persona-model-version"); - Assert.assertEquals(value, "1"); - // retrieving a float - value = JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.vnf-persona-model-version"); - Assert.assertEquals(value, "1.5"); - // retrieving a boolean - value = JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.is-base-module"); - Assert.assertEquals(value, "true"); - // attempt to retrieve a value for a non-existent field - value = JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.bad"); - Assert.assertEquals(value, null); - // retrieving a parameter value (originally a XML attribute) - value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "server"); -// Assert.assertEquals(value, "[{\"content\":\"network1111\",\"name\":\"network\"},{\"content\":\"server1111\",\"name\":\"server\"}]"); - Assert.assertEquals(value, "server1111"); - value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "badParam"); - Assert.assertEquals(value, null); - // by field name/key - value = JsonUtils.getJsonValueForKey(json, "source"); - Assert.assertEquals(value, "PORTAL"); - value = JsonUtils.getJsonValueForKey(json, "vnf-module"); - Assert.assertEquals(value, null); - } - - @Test - public void testUpdate() { - String json = JsonUtils.xml2json(xmlReq); - System.out.println("testUpdate(): xml request to json: " + json); - // the add should be successful - String jsonUpd = JsonUtils.addJsonValue(json, "vnf-request.request-info.comment", "Some comment"); -// System.out.println("testUpdate(): post add json request: " + jsonUpd); - String value = JsonUtils.getJsonValue(jsonUpd, "vnf-request.request-info.comment"); - Assert.assertEquals(value, "Some comment"); - // the add should be ignored as the field already exists - jsonUpd = JsonUtils.addJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-name", "STMTN5MMSC22"); - value = JsonUtils.getJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-name"); - Assert.assertEquals(value, "STMTN5MMSC21"); - // the update should be successful - jsonUpd = JsonUtils.updJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-name", "STMTN5MMSC22"); -// System.out.println("testUpdate(): post update json request: " + jsonUpd); - value = JsonUtils.getJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-name"); - Assert.assertEquals(value, "STMTN5MMSC22"); - // the delete should be successful - jsonUpd = JsonUtils.delJsonValue(jsonUpd, "vnf-request.request-info.comment"); -// System.out.println("testUpdate(): post delete json request: " + jsonUpd); - value = JsonUtils.getJsonValue(jsonUpd, "vnf-request.request-info.comment"); - Assert.assertEquals(value, null); - // the delete should fail as field 'vnf-model' does not exist - String jsonCur = jsonUpd; - jsonUpd = JsonUtils.delJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-module"); - Assert.assertEquals(jsonCur, jsonUpd); - } - - @Test - public void testEmbededXmlRetrievalConversion() { - try { - // extract the embedded XML from the request - String value = JsonUtils.getJsonValue(jsonReq, "variables.bpmnRequest.value"); - String xmlReq = XmlTool.removeNamespaces(XmlTool.normalize(value)); - System.out.println("testEmbededXmlRetrievalConversion(): xml payload: " + xmlReq); - // strip all the whitespace -// xmlIn = xmlIn.replaceAll("\\s+",""); - String json = JsonUtils.xml2json(xmlReq); - System.out.println("testEmbededXmlRetrievalConversion(): xml request to json: " + json); - String xmlOut = JsonUtils.json2xml(json); - System.out.println("testEmbededXmlRetrievalConversion(): json request back to xml: " + xmlOut); - Diff diffXml; - try { - // compare the XML before and after - diffXml = new Diff(xmlReq, xmlOut); - Assert.assertTrue(diffXml.similar()); - } catch (SAXException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - - } catch (Exception e) { - e.printStackTrace(); - } - } + private static final String EOL = "\n"; + private String xmlReq = + "" + EOL + + " " + EOL + + " DEV-VF-0021" + EOL + + " CREATE_VF_MODULE" + EOL + + " PORTAL" + EOL + + " " + EOL + + " " + EOL + + " a27ce5a9-29c4-4c22-a017-6615ac73c721" + EOL + + " STMTN5MMSC21" + EOL + + " asc_heat-int" + EOL + + " STMTN5MMSC21-MMSC::module-0-0" + EOL + + " STMTN5MMSC21-MMSC::model-1-0" + EOL + + " true" + EOL + + " 00000000-0000-0000-0000-000000000000" + EOL + + " 1.0" + EOL + + " 999999999-0000-0000-0000-000000000000" + EOL + + " 1.5" + EOL + + " 00000000-0000-0000-0000-000000000000" + EOL + + " SDN-ETHERNET-INTERNET" + EOL + + " fba1bd1e195a404cacb9ce17a9b2b421" + EOL + + " pending-delete" + EOL + + " RDM2WAGPLCP" + EOL + + " 1" + EOL + + " " + EOL + + " " + EOL + + " network1111" + EOL + + " server1111" + EOL + + " " + EOL + + "" + EOL; + + private String xmlReqNoAttrs = + "" + 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; + + private String xmlArrayReq = + "" + EOL + + " BROADBAND" + EOL + + " IVLAN" + EOL + + " SHELLUCPE31" + EOL + + " " + EOL + + " " + EOL + + " AVPN" + EOL + + " 1000BASE-T" + EOL + + " ATT" + EOL + + " BT/SLIR/70911" + EOL + + " Active" + EOL + + " WAN1" + EOL + + " ATT" + EOL + + " 100" + EOL + + " ELECTRICAL" + EOL + + " " + EOL + + " " + EOL + + " AVPN" + EOL + + " 10/100/1000BASE-T" + EOL + + " ATT" + EOL + + " AS/KRFN/34611" + EOL + + " Active" + EOL + + " WAN2" + EOL + + " ATT" + EOL + + " 10000" + EOL + + " MMF" + EOL + + " " + EOL + + " " + EOL + + " ASD-987-M31" + EOL + + " USOSTCDALTX0101UJZZ31" + EOL + + " FG-VM00*" + EOL + + ""; + + // JSON request w/ embedded XML will be read from a file + private String jsonReq = null; + private String jsonReqArray = null; + + @Before + public void initialize() { + File file = new File("src/test/resources/request.json"); + File file2 = new File("src/test/resources/requestArray.json"); + FileInputStream fis = null; + + try { + fis = new FileInputStream(file); + BufferedReader br = new BufferedReader(new InputStreamReader(fis)); +// jsonReq = br.readLine(); + CharBuffer cbuf = CharBuffer.allocate((int)file.length()+1); + br.read(cbuf); + cbuf.flip(); + jsonReq = cbuf.toString(); + if (jsonReq != null) { + System.out.println("initialize(): json request: " + jsonReq); + } else { + System.out.println("initialize(): failed to read json request from src/test/resources/request.json"); + } + fis.close(); + fis = new FileInputStream(file2); + br = new BufferedReader(new InputStreamReader(fis)); +// jsonReqArray = br.readLine(); + cbuf = CharBuffer.allocate((int)file.length()+1); + br.read(cbuf); + cbuf.flip(); + jsonReqArray = cbuf.toString(); + if (jsonReq != null) { + System.out.println("initialize(): json request w/ array: " + jsonReqArray); + } else { + System.out.println("initialize(): failed to read json request from src/test/resources/request2.json"); + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (fis != null) + fis.close(); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } + + @After + public void cleanup(){ + } + + @Test +// @Ignore + public void testConversion() { + // Note: the current version of the JsonUtils.json2xml() method + // does not support converting the JSONObject representation + // of XML attributes (JSONArray) back to XML. So this test will + // only succeed if the original XML does not contain attributes + + // save a copy of the xml with the namespaces removed + String xmlIn = XmlTool.removeNamespaces(xmlReqNoAttrs); + // strip all the non-data whitespace + xmlIn = xmlIn.replaceAll(">\\s*<", "><"); + String json = JsonUtils.xml2json(xmlReqNoAttrs); + System.out.println("testConversion(): xml request to json: " + json); + String xmlOut = JsonUtils.json2xml(json); + System.out.println("testConversion(): json request back to xml: " + xmlOut); + + // strip all the non-data whitespace + xmlOut = xmlOut.replaceAll(">\\s*<", "><"); +// System.out.println("testConversion(): xml in: " + xmlIn); +// System.out.println("testConversion(): xml out: " + xmlOut); + + Diff diffXml; + try { + diffXml = new Diff(xmlIn, xmlOut); + Assert.assertTrue(diffXml.similar()); +// Assert.assertTrue(diffXml.identical()); + } catch (SAXException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Test +// @Ignore + public void testRetrieval() { + String json = JsonUtils.xml2json(xmlReq); + System.out.println("testRetrieval(): xml request to json: " + json); + // full JSON path + String value = JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.vnf-name"); + Assert.assertEquals(value, "STMTN5MMSC21"); + value = JsonUtils.getJsonValue(json, "vnf-request.request-info.action"); + Assert.assertEquals(value, "CREATE_VF_MODULE"); + // retrieving an integer + value = JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.persona-model-version"); + Assert.assertEquals(value, "1"); + // retrieving a float + value = JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.vnf-persona-model-version"); + Assert.assertEquals(value, "1.5"); + // retrieving a boolean + value = JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.is-base-module"); + Assert.assertEquals(value, "true"); + // attempt to retrieve a value for a non-existent field + value = JsonUtils.getJsonValue(json, "vnf-request.vnf-inputs.bad"); + Assert.assertEquals(value, null); + // retrieving a parameter/array value (originally a XML attribute) + value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name"); +// Assert.assertEquals(value, "[{\"content\":\"network1111\",\"name\":\"network\"},{\"content\":\"server1111\",\"name\":\"server\"}]"); + Assert.assertEquals(value, "network"); + value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "content"); + Assert.assertEquals(value, "network1111"); + // retrieving a parameter/array value by index + value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "content", 1); + Assert.assertEquals(value, "server1111"); + value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name", 1); + Assert.assertEquals(value, "server"); + // failure due to invalid parameter name + value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "badParam"); + Assert.assertEquals(value, null); + // failure due to array index out of bounds + value = JsonUtils.getJsonParamValue(json, "vnf-request.vnf-params.param", "name", 2); + Assert.assertEquals(value, null); + // by field name/key + value = JsonUtils.getJsonValueForKey(json, "source"); + Assert.assertEquals(value, "PORTAL"); + value = JsonUtils.getJsonValueForKey(json, "vnf-module"); + Assert.assertEquals(value, null); + } + + @Test +// @Ignore + public void testUpdate() { + String json = JsonUtils.xml2json(xmlReq); + System.out.println("testUpdate(): xml request to json: " + json); + // the add should be successful + String jsonUpd = JsonUtils.addJsonValue(json, "vnf-request.request-info.comment", "Some comment"); +// System.out.println("testUpdate(): post add json request: " + jsonUpd); + String value = JsonUtils.getJsonValue(jsonUpd, "vnf-request.request-info.comment"); + Assert.assertEquals(value, "Some comment"); + // the add should be ignored as the field already exists + jsonUpd = JsonUtils.addJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-name", "STMTN5MMSC22"); + value = JsonUtils.getJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-name"); + Assert.assertEquals(value, "STMTN5MMSC21"); + // the update should be successful + jsonUpd = JsonUtils.updJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-name", "STMTN5MMSC22"); +// System.out.println("testUpdate(): post update json request: " + jsonUpd); + value = JsonUtils.getJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-name"); + Assert.assertEquals(value, "STMTN5MMSC22"); + // the delete should be successful + jsonUpd = JsonUtils.delJsonValue(jsonUpd, "vnf-request.request-info.comment"); +// System.out.println("testUpdate(): post delete json request: " + jsonUpd); + value = JsonUtils.getJsonValue(jsonUpd, "vnf-request.request-info.comment"); + Assert.assertEquals(value, null); + // the delete should fail as field 'vnf-model' does not exist + String jsonCur = jsonUpd; + jsonUpd = JsonUtils.delJsonValue(jsonUpd, "vnf-request.vnf-inputs.vnf-module"); + Assert.assertEquals(jsonCur, jsonUpd); + } + + @Test +// @Ignore + public void testEmbededXmlRetrievalConversion() { + try { + // extract the embedded XML from the request + String value = JsonUtils.getJsonValue(jsonReq, "variables.bpmnRequest.value"); + String xmlReq = XmlTool.removeNamespaces(XmlTool.normalize(value)); + System.out.println("testEmbededXmlRetrievalConversion(): xml payload: " + xmlReq); + String json = JsonUtils.xml2json(xmlReq); + System.out.println("testEmbededXmlRetrievalConversion(): xml request to json: " + json); + String xmlOut = JsonUtils.json2xml(json); + System.out.println("testEmbededXmlRetrievalConversion(): json request back to xml: " + xmlOut); + Diff diffXml; + try { + // compare the XML before and after + diffXml = new Diff(xmlReq, xmlOut); + Assert.assertTrue(diffXml.similar()); + } catch (SAXException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Test +// @Ignore + // Tests the conversion of a JSON Doc containing a JSON Array to XML + public void testConversionArray() { + try { + String jsonParm = JsonUtils.getJsonNodeValue(jsonReqArray, "requestDetails.requestParameters.ucpeInfo"); + System.out.println("testConversionArray(): json value: " + JsonUtils.prettyJson(jsonParm)); + String xmlOut = JsonUtils.json2xml(jsonParm); + System.out.println("testConversionArray(): json parameters to xml: " + xmlOut); + // strip all the non-data whitespace + xmlOut = xmlOut.replaceAll(">\\s*<", "><"); + System.out.println("testConversionArray(): XML after removing whitespace:" + xmlOut); + String xmlTest = xmlArrayReq.replaceAll(">\\s*<", "><"); +// System.out.println("testConversion(): xml test: " + xmlTest); +// System.out.println("testConversion(): xml out: " + xmlOut); + + Diff diffXml; + try { + diffXml = new Diff(xmlTest, xmlOut); + Assert.assertTrue(diffXml.similar()); +// Assert.assertTrue(diffXml.identical()); + } catch (SAXException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTest.java deleted file mode 100644 index 70e505095e..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Mon Nov 14 11:29:34 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core; - -import org.junit.Test; -import static org.junit.Assert.*; - -import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.junit.runner.RunWith; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class LogTaskESTest extends LogTaskESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - LogTask logTask0 = null; - try { - logTask0 = new LogTask(); - fail("Expecting exception: NoClassDefFoundError"); - - } catch(NoClassDefFoundError e) { - } - } - - @Test(timeout = 4000) - public void test1() throws Throwable { - ExecutionImpl executionImpl0 = new ExecutionImpl(); - LogTask logTask0 = null; - try { - logTask0 = new LogTask(); - fail("Expecting exception: NoClassDefFoundError"); - - } catch(NoClassDefFoundError e) { - } - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTestscaffolding.java deleted file mode 100644 index ab7ee56884..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/LogTaskESTestscaffolding.java +++ /dev/null @@ -1,342 +0,0 @@ -/** - * Scaffolding file used to store all the setups needed to run - * tests automatically generated by EvoSuite - * Mon Nov 14 11:29:34 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core; - -import org.evosuite.runtime.annotation.EvoSuiteClassExclude; -import org.junit.BeforeClass; -import org.junit.Before; -import org.junit.After; -import org.junit.AfterClass; -import org.evosuite.runtime.sandbox.Sandbox; - -@EvoSuiteClassExclude -public class LogTaskESTestscaffolding { - - @org.junit.Rule - public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); - - private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.bpmn.core.LogTask"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); - initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } - - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } - - @Before - public void initTestCase(){ - threadStopper.storeCurrentThreads(); - threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } - - @After - public void doneWithTestCase(){ - threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } - - - private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(LogTaskESTestscaffolding.class.getClassLoader() , - "org.camunda.bpm.engine.impl.persistence.entity.IdentityLinkEntity", - "org.camunda.bpm.engine.impl.pvm.process.TransitionImpl", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution", - "org.camunda.bpm.engine.impl.context.CaseExecutionContext", - "org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransformFactory", - "org.camunda.bpm.engine.impl.pvm.PvmScope", - "org.camunda.bpm.engine.delegate.JavaDelegate", - "org.camunda.bpm.engine.runtime.ProcessInstance", - "org.camunda.bpm.engine.impl.tree.TreeWalker$WalkCondition", - "org.camunda.bpm.application.ProcessApplicationReference", - "org.camunda.bpm.engine.delegate.BpmnModelExecutionContext", - "org.camunda.bpm.engine.impl.jobexecutor.FailedJobCommandFactory", - "org.camunda.bpm.engine.delegate.DelegateExecution", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnIfPartDeclaration", - "org.camunda.bpm.engine.delegate.CmmnModelExecutionContext", - "org.camunda.bpm.engine.impl.persistence.entity.util.FormPropertyStartContext", - "com.att.eelf.i18n.EELFMsgs", - "org.camunda.bpm.engine.impl.javax.el.ELContext", - "org.camunda.bpm.engine.impl.core.variable.event.VariableEventDispatcher", - "org.camunda.bpm.engine.variable.type.ValueType", - "org.camunda.bpm.engine.impl.interceptor.CommandContextListener", - "org.camunda.bpm.engine.impl.core.variable.mapping.IoMapping", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnCaseInstance", - "org.camunda.bpm.engine.repository.CaseDefinition", - "org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity", - "org.camunda.bpm.engine.impl.db.HasDbRevision", - "org.camunda.bpm.model.bpmn.instance.FlowElement", - "org.camunda.bpm.engine.delegate.Expression", - "org.camunda.bpm.engine.variable.type.SerializableValueType", - "org.camunda.bpm.engine.impl.pvm.PvmActivity", - "org.camunda.bpm.engine.impl.cfg.BpmnParseFactory", - "org.camunda.bpm.model.bpmn.instance.BpmnModelElementInstance", - "org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance", - "org.camunda.bpm.engine.impl.pvm.PvmException", - "org.camunda.bpm.engine.task.DelegationState", - "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", - "org.camunda.bpm.application.ProcessApplicationUnavailableException", - "org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition", - "org.camunda.bpm.engine.delegate.DelegateCaseExecution", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnOnPartDeclaration", - "org.camunda.bpm.engine.runtime.CaseExecution", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition", - "org.camunda.bpm.engine.impl.core.variable.scope.SimpleVariableStore", - "org.camunda.bpm.engine.repository.ProcessDefinition", - "org.camunda.bpm.engine.impl.pvm.process.ScopeImpl", - "org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl", - "org.camunda.bpm.engine.impl.pvm.runtime.AtomicOperation", - "org.openecomp.mso.logger.MsoLogger$ErrorCode", - "org.camunda.bpm.engine.task.IdentityLink", - "org.camunda.bpm.engine.impl.interceptor.SessionFactory", - "org.camunda.bpm.engine.delegate.DelegateTask", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation", - "org.camunda.bpm.engine.impl.pvm.process.ActivityStartBehavior", - "org.camunda.bpm.engine.impl.core.model.CoreActivity", - "org.camunda.bpm.model.bpmn.BpmnModelInstance", - "org.camunda.bpm.engine.delegate.VariableScope", - "org.camunda.bpm.engine.ProcessEngine", - "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionImpl", - "org.camunda.bpm.engine.impl.interceptor.CommandContext", - "org.camunda.bpm.engine.impl.variable.listener.CaseVariableListenerInvocation", - "org.camunda.bpm.engine.impl.cfg.auth.ResourceAuthorizationProvider", - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.camunda.bpm.engine.BadUserRequestException", - "org.camunda.bpm.engine.impl.persistence.entity.AuthorizationEntity", - "org.camunda.bpm.engine.impl.context.ExecutionContext", - "org.camunda.bpm.engine.impl.persistence.entity.TaskEntity", - "org.camunda.bpm.engine.impl.context.Context", - "org.camunda.bpm.engine.authorization.Authorization", - "org.camunda.bpm.engine.ProcessEngineServices", - "org.camunda.bpm.engine.runtime.Execution", - "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", - "org.camunda.bpm.engine.impl.pvm.process.Lane", - "org.camunda.bpm.engine.impl.pvm.process.ParticipantProcess", - "org.camunda.bpm.engine.impl.interceptor.CommandExecutor", - "org.camunda.bpm.engine.delegate.ProcessEngineServicesAware", - "org.camunda.bpm.engine.ProcessEngineConfiguration", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity", - "org.camunda.bpm.engine.impl.util.BitMaskUtil", - "org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition", - "org.camunda.bpm.engine.impl.cmmn.behavior.CmmnActivityBehavior", - "org.camunda.bpm.engine.impl.core.variable.event.VariableEvent", - "org.camunda.bpm.engine.delegate.BaseDelegateExecution", - "org.camunda.bpm.engine.impl.pvm.PvmExecution", - "org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity", - "org.camunda.bpm.engine.runtime.VariableInstance", - "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableStore", - "org.camunda.bpm.engine.runtime.Job", - "org.camunda.bpm.engine.runtime.Incident", - "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState$CaseExecutionStateImpl", - "org.camunda.bpm.model.xml.ModelInstance", - "org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl", - "org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity", - "org.openecomp.mso.entity.MsoRequest", - "org.camunda.bpm.engine.impl.core.variable.value.NullValueImpl", - "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", - "org.camunda.bpm.model.bpmn.instance.UserTask", - "org.openecomp.mso.bpmn.core.BadInjectedFieldException", - "org.camunda.bpm.engine.impl.variable.serializer.ValueFields", - "org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation", - "org.camunda.bpm.engine.impl.task.TaskDecorator", - "org.camunda.bpm.engine.impl.jobexecutor.JobExecutorContext", - "org.camunda.bpm.engine.impl.task.delegate.TaskListenerInvocation", - "org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity", - "org.camunda.bpm.model.xml.instance.ModelElementInstance", - "org.camunda.bpm.engine.ProcessEngineException", - "org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration", - "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState$SuspensionStateImpl", - "org.camunda.bpm.engine.impl.db.DbEntity", - "org.camunda.bpm.model.bpmn.instance.InteractionNode", - "org.camunda.bpm.engine.impl.task.TaskDefinition", - "org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution", - "org.camunda.bpm.engine.runtime.EventSubscription", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionDestroyScope", - "org.camunda.bpm.engine.impl.core.variable.value.UntypedValueImpl", - "org.camunda.bpm.model.bpmn.instance.Activity", - "org.camunda.bpm.engine.management.JobDefinition", - "com.att.eelf.i18n.EELFResolvableErrorEnum", - "com.att.eelf.configuration.EELFLogger$Level", - "org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior", - "org.camunda.bpm.engine.impl.core.variable.scope.MapBasedVariableStore", - "org.camunda.bpm.engine.impl.javax.el.ValueReference", - "org.camunda.bpm.engine.impl.persistence.entity.JobEntity", - "org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity", - "org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext", - "org.camunda.bpm.engine.delegate.DelegateCaseVariableInstance", - "org.camunda.bpm.engine.impl.pvm.PvmProcessElement", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "org.camunda.bpm.engine.impl.delegate.DelegateInvocation", - "org.camunda.bpm.engine.impl.javax.el.ValueExpression", - "com.att.eelf.configuration.EELFLogger", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationFireProcessStart", - "org.camunda.bpm.engine.runtime.CaseInstance", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope", - "org.camunda.bpm.engine.impl.db.DbEntityLifecycleAware", - "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl", - "org.camunda.bpm.engine.impl.core.model.CoreModelElement", - "org.camunda.bpm.engine.impl.interceptor.CommandInterceptor", - "org.camunda.bpm.engine.impl.pvm.PvmProcessInstance", - "org.camunda.bpm.engine.impl.cmmn.execution.CaseSentryPartImpl", - "org.camunda.bpm.engine.variable.value.TypedValue", - "org.openecomp.mso.logger.MsoAlarmLogger", - "org.apache.ibatis.transaction.TransactionFactory", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnSentryPart", - "org.camunda.bpm.engine.impl.pvm.process.LaneSet", - "org.camunda.bpm.engine.delegate.DelegateListener", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution", - "org.camunda.bpm.engine.impl.persistence.entity.TaskEntityVariableStore", - "org.camunda.bpm.engine.delegate.ExecutionListener", - "org.camunda.bpm.engine.exception.NotAllowedException", - "org.camunda.bpm.engine.impl.history.event.HistoryEventType", - "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", - "org.openecomp.mso.bpmn.core.LogTask", - "org.camunda.bpm.engine.impl.pvm.process.HasDIBounds", - "com.att.eelf.configuration.SLF4jWrapper", - "org.camunda.bpm.engine.task.Task", - "org.camunda.bpm.engine.impl.javax.el.Expression", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.AbstractPvmEventAtomicOperation", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceEnd", - "org.camunda.bpm.engine.impl.context.CoreExecutionContext", - "org.camunda.bpm.engine.delegate.DelegateVariableInstance", - "org.camunda.bpm.model.bpmn.instance.FlowNode", - "org.openecomp.mso.logger.MsoLogger", - "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", - "org.camunda.bpm.model.cmmn.CmmnModelInstance", - "org.camunda.bpm.model.bpmn.instance.Task", - "org.camunda.bpm.engine.variable.VariableMap", - "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState$ActivityInstanceStateImpl", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessEnd", - "org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl", - "org.camunda.bpm.model.bpmn.instance.BaseElement", - "org.camunda.bpm.engine.exception.NullValueException", - "org.camunda.bpm.engine.impl.core.variable.scope.CoreVariableStore", - "org.camunda.bpm.engine.impl.context.BpmnExecutionContext", - "org.openecomp.mso.bpmn.core.BaseTask", - "org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", - "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState", - "org.apache.ibatis.session.SqlSessionFactory", - "org.camunda.bpm.engine.impl.variable.AbstractPersistentVariableStore", - "org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext", - "com.att.eelf.i18n.EELFResourceManager", - "org.camunda.bpm.engine.impl.el.FixedValue", - "org.camunda.bpm.engine.impl.core.delegate.CoreActivityBehavior", - "org.openecomp.mso.logger.MessageEnum", - "org.openecomp.mso.logger.MsoLogger$ResponseCode", - "org.camunda.bpm.engine.SuspendedEntityInteractionException", - "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", - "org.openecomp.mso.logger.MsoLogger$StatusCode", - "org.camunda.bpm.engine.impl.db.HasDbReferences", - "org.camunda.bpm.engine.impl.tree.Collector", - "com.att.eelf.configuration.EELFManager", - "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext", - "org.camunda.bpm.engine.impl.core.operation.CoreAtomicOperation", - "org.camunda.bpm.engine.impl.el.Expression", - "org.camunda.bpm.engine.impl.pvm.PvmTransition", - "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", - "org.camunda.bpm.model.cmmn.instance.CmmnElement", - "org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration", - "org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessStart", - "org.camunda.bpm.engine.impl.jobexecutor.JobHandler", - "com.att.eelf.i18n.EELFResourceManager$1", - "org.camunda.bpm.engine.impl.core.instance.CoreExecution", - "org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance", - "org.camunda.bpm.engine.variable.type.PrimitiveValueType", - "org.camunda.bpm.engine.delegate.VariableListener", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration", - "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl$1" - ); - } - - private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(LogTaskESTestscaffolding.class.getClassLoader()); - - org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", - "org.camunda.bpm.engine.impl.core.instance.CoreExecution", - "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", - "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", - "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", - "org.camunda.bpm.engine.impl.context.Context", - "org.camunda.bpm.engine.impl.javax.el.Expression", - "org.camunda.bpm.engine.impl.javax.el.ValueExpression", - "org.camunda.bpm.engine.ProcessEngineException", - "org.openecomp.mso.bpmn.core.BadInjectedFieldException", - "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", - "org.camunda.bpm.engine.impl.core.model.CoreModelElement", - "org.camunda.bpm.engine.impl.core.model.CoreActivity", - "org.camunda.bpm.engine.impl.pvm.process.ScopeImpl", - "org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl", - "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", - "org.camunda.bpm.engine.impl.pvm.PvmException", - "org.camunda.bpm.engine.exception.NullValueException", - "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", - "org.camunda.bpm.engine.impl.persistence.entity.TaskEntity", - "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl", - "org.camunda.bpm.engine.impl.pvm.process.ActivityStartBehavior", - "org.camunda.bpm.engine.impl.util.BitMaskUtil", - "org.camunda.bpm.engine.impl.core.variable.value.NullValueImpl", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceEnd", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessEnd", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionDestroyScope", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation", - "org.camunda.bpm.engine.impl.core.variable.value.UntypedValueImpl", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition", - "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl$1", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution", - "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionImpl", - "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState", - "org.camunda.bpm.engine.impl.persistence.entity.JobEntity", - "org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity", - "org.openecomp.mso.logger.MsoLogger", - "com.att.eelf.i18n.EELFResourceManager", - "com.att.eelf.i18n.EELFMsgs", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "com.att.eelf.configuration.EELFLogger$Level", - "com.att.eelf.configuration.EELFManager", - "org.openecomp.mso.logger.MessageEnum", - "org.openecomp.mso.logger.MsoAlarmLogger", - "org.openecomp.mso.bpmn.core.LogTask" - ); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTest.java deleted file mode 100644 index f62d6afaf0..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTest.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Mon Nov 14 11:35:52 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core; - -import org.junit.Test; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.junit.runner.RunWith; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class MissingInjectedFieldExceptionESTest extends MissingInjectedFieldExceptionESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - MissingInjectedFieldException missingInjectedFieldException0 = new MissingInjectedFieldException("", ""); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java index ff92355b8a..fa0f8d8dd8 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/PropertyConfigurationTest.java @@ -18,6 +18,26 @@ * ============LICENSE_END========================================================= */ +/*- + * ============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.core; import java.io.IOException; @@ -31,7 +51,6 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.openecomp.mso.bpmn.test.PropertyConfigurationSetup; public class PropertyConfigurationTest { @Before diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTest.java deleted file mode 100644 index 6422685f92..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Mon Nov 14 11:29:36 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core; - -import org.junit.Test; -import static org.junit.Assert.*; -import static org.evosuite.shaded.org.mockito.Mockito.*; -import static org.evosuite.runtime.EvoAssertions.*; - -import org.camunda.bpm.engine.delegate.Expression; -import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.evosuite.runtime.PrivateAccess; -import org.evosuite.runtime.ViolatedAssumptionAnswer; -import org.junit.runner.RunWith; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class ReadConfigTaskESTest extends ReadConfigTaskESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - ReadConfigTask readConfigTask0 = new ReadConfigTask(); - ExecutionImpl executionImpl0 = new ExecutionImpl(); - Expression expression0 = mock(Expression.class, new ViolatedAssumptionAnswer()); - doReturn((Object) null).when(expression0).getValue(any(org.camunda.bpm.engine.delegate.VariableScope.class)); - PrivateAccess.setVariable((Class) ReadConfigTask.class, readConfigTask0, "propertiesFile", (Object) expression0); - try { - readConfigTask0.execute(executionImpl0); - fail("Expecting exception: RuntimeException"); - - } catch(RuntimeException e) { - // - // ReadConfigTask injected field 'propertiesFile' is bad: required field has null value - // - verifyException("org.openecomp.mso.bpmn.core.BaseTask", e); - } - } - - @Test(timeout = 4000) - public void test1() throws Throwable { - ReadConfigTask readConfigTask0 = new ReadConfigTask(); - ExecutionImpl executionImpl0 = new ExecutionImpl(); - try { - readConfigTask0.execute(executionImpl0); - fail("Expecting exception: RuntimeException"); - - } catch(RuntimeException e) { - // - // ReadConfigTask injected field 'propertiesFile' is bad: missing required field - // - verifyException("org.openecomp.mso.bpmn.core.BaseTask", e); - } - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTestscaffolding.java deleted file mode 100644 index c134c9cca9..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadConfigTaskESTestscaffolding.java +++ /dev/null @@ -1,331 +0,0 @@ -/** - * Scaffolding file used to store all the setups needed to run - * tests automatically generated by EvoSuite - * Mon Nov 14 11:29:36 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core; - -import org.evosuite.runtime.annotation.EvoSuiteClassExclude; -import org.junit.BeforeClass; -import org.junit.Before; -import org.junit.After; -import org.junit.AfterClass; -import org.evosuite.runtime.sandbox.Sandbox; - -@EvoSuiteClassExclude -public class ReadConfigTaskESTestscaffolding { - - @org.junit.Rule - public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); - - private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.bpmn.core.ReadConfigTask"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); - initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } - - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } - - @Before - public void initTestCase(){ - threadStopper.storeCurrentThreads(); - threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } - - @After - public void doneWithTestCase(){ - threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } - - - private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ReadConfigTaskESTestscaffolding.class.getClassLoader() , - "org.camunda.bpm.engine.impl.pvm.process.TransitionImpl", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution", - "org.camunda.bpm.engine.impl.context.CaseExecutionContext", - "org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransformFactory", - "org.camunda.bpm.engine.impl.pvm.PvmScope", - "org.camunda.bpm.engine.delegate.JavaDelegate", - "org.camunda.bpm.engine.impl.tree.TreeWalker$WalkCondition", - "org.camunda.bpm.engine.runtime.ProcessInstance", - "org.camunda.bpm.application.ProcessApplicationReference", - "org.camunda.bpm.engine.delegate.BpmnModelExecutionContext", - "org.camunda.bpm.engine.impl.jobexecutor.FailedJobCommandFactory", - "org.camunda.bpm.engine.delegate.DelegateExecution", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnIfPartDeclaration", - "org.camunda.bpm.engine.delegate.CmmnModelExecutionContext", - "org.camunda.bpm.engine.impl.persistence.entity.util.FormPropertyStartContext", - "com.att.eelf.i18n.EELFMsgs", - "org.camunda.bpm.engine.impl.javax.el.ELContext", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceStart", - "org.camunda.bpm.engine.impl.core.variable.event.VariableEventDispatcher", - "org.camunda.bpm.engine.variable.type.ValueType", - "org.camunda.bpm.engine.impl.interceptor.CommandContextListener", - "org.camunda.bpm.engine.impl.core.variable.mapping.IoMapping", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationInterruptScope", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnCaseInstance", - "org.camunda.bpm.engine.repository.CaseDefinition", - "org.camunda.bpm.engine.impl.db.HasDbRevision", - "org.camunda.bpm.model.bpmn.instance.FlowElement", - "org.camunda.bpm.engine.delegate.Expression", - "org.camunda.bpm.engine.variable.type.SerializableValueType", - "org.camunda.bpm.engine.impl.pvm.PvmActivity", - "org.camunda.bpm.engine.impl.cfg.BpmnParseFactory", - "org.camunda.bpm.model.bpmn.instance.BpmnModelElementInstance", - "org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance", - "org.camunda.bpm.engine.impl.pvm.PvmException", - "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", - "org.camunda.bpm.application.ProcessApplicationUnavailableException", - "org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition", - "org.camunda.bpm.engine.delegate.DelegateCaseExecution", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerTake", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityNotifyListenerEnd", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnOnPartDeclaration", - "org.camunda.bpm.engine.runtime.CaseExecution", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition", - "org.camunda.bpm.engine.impl.core.variable.scope.SimpleVariableStore", - "org.camunda.bpm.engine.repository.ProcessDefinition", - "org.camunda.bpm.engine.impl.pvm.process.ScopeImpl", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerStart", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartConcurrent", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.AbstractPvmAtomicOperationTransitionNotifyListenerTake", - "org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl", - "org.openecomp.mso.logger.MsoLogger$ErrorCode", - "org.camunda.bpm.engine.impl.pvm.runtime.AtomicOperation", - "org.camunda.bpm.engine.impl.interceptor.SessionFactory", - "org.camunda.bpm.engine.delegate.DelegateTask", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation", - "org.camunda.bpm.engine.impl.pvm.process.ActivityStartBehavior", - "org.camunda.bpm.engine.impl.core.model.CoreActivity", - "org.camunda.bpm.model.bpmn.BpmnModelInstance", - "org.camunda.bpm.engine.delegate.VariableScope", - "org.camunda.bpm.engine.ProcessEngine", - "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionImpl", - "org.camunda.bpm.engine.impl.interceptor.CommandContext", - "org.camunda.bpm.engine.impl.variable.listener.CaseVariableListenerInvocation", - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.camunda.bpm.engine.BadUserRequestException", - "org.camunda.bpm.engine.impl.context.ExecutionContext", - "org.camunda.bpm.engine.impl.persistence.entity.TaskEntity", - "org.camunda.bpm.engine.impl.context.Context", - "org.camunda.bpm.engine.ProcessEngineServices", - "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", - "org.camunda.bpm.engine.runtime.Execution", - "org.camunda.bpm.engine.impl.pvm.process.Lane", - "org.camunda.bpm.engine.impl.pvm.process.ParticipantProcess", - "org.camunda.bpm.engine.impl.interceptor.CommandExecutor", - "org.camunda.bpm.engine.delegate.ProcessEngineServicesAware", - "org.camunda.bpm.engine.ProcessEngineConfiguration", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity", - "org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition", - "org.camunda.bpm.engine.impl.cmmn.behavior.CmmnActivityBehavior", - "org.camunda.bpm.engine.impl.core.variable.event.VariableEvent", - "org.camunda.bpm.engine.delegate.BaseDelegateExecution", - "org.camunda.bpm.engine.impl.pvm.PvmExecution", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartCreateScope", - "org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity", - "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableStore", - "org.camunda.bpm.engine.runtime.VariableInstance", - "org.camunda.bpm.engine.runtime.Job", - "org.camunda.bpm.engine.runtime.Incident", - "org.camunda.bpm.model.xml.ModelInstance", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStart", - "org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl", - "org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity", - "org.openecomp.mso.entity.MsoRequest", - "org.camunda.bpm.engine.impl.core.variable.value.NullValueImpl", - "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", - "org.openecomp.mso.bpmn.core.BadInjectedFieldException", - "org.camunda.bpm.engine.impl.variable.serializer.ValueFields", - "org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation", - "org.camunda.bpm.engine.impl.task.TaskDecorator", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInitStackNotifyListenerStart", - "org.camunda.bpm.engine.impl.jobexecutor.JobExecutorContext", - "org.camunda.bpm.engine.impl.task.delegate.TaskListenerInvocation", - "org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationsTransitionInterruptFlowScope", - "org.camunda.bpm.model.xml.instance.ModelElementInstance", - "org.camunda.bpm.engine.ProcessEngineException", - "org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration", - "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState$SuspensionStateImpl", - "org.camunda.bpm.engine.impl.db.DbEntity", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerEnd", - "org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationFireActivityEnd", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationStartTransitionNotifyListenerTake", - "org.camunda.bpm.engine.runtime.EventSubscription", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionDestroyScope", - "org.camunda.bpm.engine.impl.core.variable.value.UntypedValueImpl", - "org.camunda.bpm.engine.management.JobDefinition", - "com.att.eelf.i18n.EELFResolvableErrorEnum", - "com.att.eelf.configuration.EELFLogger$Level", - "org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior", - "org.camunda.bpm.engine.impl.core.variable.scope.MapBasedVariableStore", - "org.camunda.bpm.engine.impl.persistence.entity.JobEntity", - "org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext", - "org.camunda.bpm.engine.delegate.DelegateCaseVariableInstance", - "org.camunda.bpm.engine.impl.pvm.PvmProcessElement", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "org.camunda.bpm.engine.impl.delegate.DelegateInvocation", - "com.att.eelf.configuration.EELFLogger", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationFireProcessStart", - "org.camunda.bpm.engine.runtime.CaseInstance", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope", - "org.camunda.bpm.engine.impl.db.DbEntityLifecycleAware", - "org.openecomp.mso.bpmn.core.ReadConfigTask", - "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl", - "org.camunda.bpm.engine.impl.core.model.CoreModelElement", - "org.camunda.bpm.engine.impl.interceptor.CommandInterceptor", - "org.camunda.bpm.engine.impl.pvm.PvmProcessInstance", - "org.camunda.bpm.engine.variable.value.TypedValue", - "org.apache.ibatis.transaction.TransactionFactory", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnSentryPart", - "org.camunda.bpm.engine.impl.pvm.process.LaneSet", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInitStack", - "org.camunda.bpm.engine.delegate.DelegateListener", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution", - "org.camunda.bpm.engine.delegate.ExecutionListener", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationDeleteCascadeFireActivityEnd", - "org.camunda.bpm.engine.exception.NotAllowedException", - "org.camunda.bpm.engine.impl.history.event.HistoryEventType", - "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", - "org.camunda.bpm.engine.impl.pvm.process.HasDIBounds", - "com.att.eelf.configuration.SLF4jWrapper", - "org.camunda.bpm.engine.task.Task", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityEnd", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.AbstractPvmEventAtomicOperation", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceEnd", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationDeleteCascade", - "org.camunda.bpm.engine.impl.context.CoreExecutionContext", - "org.camunda.bpm.engine.delegate.DelegateVariableInstance", - "org.openecomp.mso.logger.MsoLogger", - "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", - "org.camunda.bpm.engine.variable.VariableMap", - "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState$ActivityInstanceStateImpl", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessEnd", - "org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl", - "org.camunda.bpm.model.bpmn.instance.BaseElement", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateConcurrentExecution", - "org.camunda.bpm.engine.exception.NullValueException", - "org.camunda.bpm.engine.impl.core.variable.scope.CoreVariableStore", - "org.camunda.bpm.engine.impl.context.BpmnExecutionContext", - "org.openecomp.mso.bpmn.core.BaseTask", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartInterruptEventScope", - "org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", - "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartCancelScope", - "org.apache.ibatis.session.SqlSessionFactory", - "org.camunda.bpm.engine.impl.variable.AbstractPersistentVariableStore", - "org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext", - "com.att.eelf.i18n.EELFResourceManager", - "org.camunda.bpm.engine.impl.core.delegate.CoreActivityBehavior", - "org.openecomp.mso.logger.MessageEnum", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionCreateScope", - "org.openecomp.mso.logger.MsoLogger$ResponseCode", - "org.camunda.bpm.engine.SuspendedEntityInteractionException", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCancelActivity", - "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", - "org.openecomp.mso.logger.MsoLogger$StatusCode", - "org.camunda.bpm.engine.impl.db.HasDbReferences", - "org.camunda.bpm.engine.impl.tree.Collector", - "com.att.eelf.configuration.EELFManager", - "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext", - "org.camunda.bpm.engine.impl.core.operation.CoreAtomicOperation", - "org.camunda.bpm.engine.impl.pvm.PvmTransition", - "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", - "org.camunda.bpm.model.cmmn.instance.CmmnElement", - "org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration", - "org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity", - "com.att.eelf.i18n.EELFResourceManager$1", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessStart", - "org.camunda.bpm.engine.impl.core.instance.CoreExecution", - "org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance", - "org.camunda.bpm.engine.variable.type.PrimitiveValueType", - "org.camunda.bpm.engine.delegate.VariableListener", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration", - "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl$1" - ); - } - - private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ReadConfigTaskESTestscaffolding.class.getClassLoader()); - - org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.openecomp.mso.logger.MsoLogger", - "com.att.eelf.i18n.EELFResourceManager", - "com.att.eelf.i18n.EELFMsgs", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "com.att.eelf.configuration.EELFLogger$Level", - "com.att.eelf.configuration.EELFManager", - "org.openecomp.mso.logger.MessageEnum", - "org.openecomp.mso.bpmn.core.ReadConfigTask", - "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", - "org.camunda.bpm.engine.impl.core.instance.CoreExecution", - "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", - "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", - "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", - "org.camunda.bpm.engine.impl.context.Context", - "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", - "org.openecomp.mso.bpmn.core.BadInjectedFieldException", - "org.camunda.bpm.engine.ProcessEngineException", - "org.camunda.bpm.engine.exception.NullValueException", - "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceEnd", - "org.camunda.bpm.engine.impl.core.variable.value.UntypedValueImpl", - "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessEnd", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionDestroyScope", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation", - "org.camunda.bpm.engine.impl.pvm.PvmException", - "org.camunda.bpm.engine.impl.core.model.CoreModelElement", - "org.camunda.bpm.engine.impl.core.model.CoreActivity", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition", - "org.camunda.bpm.engine.impl.core.variable.value.NullValueImpl", - "org.camunda.bpm.engine.impl.pvm.process.ScopeImpl", - "org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl", - "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl", - "org.camunda.bpm.engine.impl.pvm.process.ActivityStartBehavior", - "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl$1", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution", - "org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity" - ); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTest.java deleted file mode 100644 index 741872af7a..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Mon Nov 14 11:30:51 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core; - -import org.junit.Test; -import static org.junit.Assert.*; -import static org.evosuite.shaded.org.mockito.Mockito.*; -import static org.evosuite.runtime.EvoAssertions.*; - -import org.camunda.bpm.engine.delegate.Expression; -import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.evosuite.runtime.PrivateAccess; -import org.evosuite.runtime.ViolatedAssumptionAnswer; -import org.junit.runner.RunWith; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class ReadFileTaskESTest extends ReadFileTaskESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - ReadFileTask readFileTask0 = new ReadFileTask(); - ExecutionImpl executionImpl0 = new ExecutionImpl(); - Expression expression0 = mock(Expression.class, new ViolatedAssumptionAnswer()); - doReturn((Object) null).when(expression0).getValue(any(org.camunda.bpm.engine.delegate.VariableScope.class)); - PrivateAccess.setVariable((Class) ReadFileTask.class, readFileTask0, "inputVariable", (Object) expression0); - try { - readFileTask0.execute(executionImpl0); - fail("Expecting exception: RuntimeException"); - - } catch(RuntimeException e) { - // - // ReadFileTask injected field 'inputVariable' is bad: required field has null value - // - verifyException("org.openecomp.mso.bpmn.core.BaseTask", e); - } - } - - @Test(timeout = 4000) - public void test1() throws Throwable { - ReadFileTask readFileTask0 = new ReadFileTask(); - ExecutionImpl executionImpl0 = new ExecutionImpl(); - try { - readFileTask0.execute(executionImpl0); - fail("Expecting exception: RuntimeException"); - - } catch(RuntimeException e) { - // - // ReadFileTask injected field 'inputVariable' is bad: missing required field - // - verifyException("org.openecomp.mso.bpmn.core.BaseTask", e); - } - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTestscaffolding.java deleted file mode 100644 index 4b11c761cc..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/ReadFileTaskESTestscaffolding.java +++ /dev/null @@ -1,339 +0,0 @@ -/** - * Scaffolding file used to store all the setups needed to run - * tests automatically generated by EvoSuite - * Mon Nov 14 11:30:51 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core; - -import org.evosuite.runtime.annotation.EvoSuiteClassExclude; -import org.junit.BeforeClass; -import org.junit.Before; -import org.junit.After; -import org.junit.AfterClass; -import org.evosuite.runtime.sandbox.Sandbox; - -@EvoSuiteClassExclude -public class ReadFileTaskESTestscaffolding { - - @org.junit.Rule - public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); - - private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.bpmn.core.ReadFileTask"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); - initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } - - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } - - @Before - public void initTestCase(){ - threadStopper.storeCurrentThreads(); - threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } - - @After - public void doneWithTestCase(){ - threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } - - - private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ReadFileTaskESTestscaffolding.class.getClassLoader() , - "org.camunda.bpm.engine.impl.pvm.process.TransitionImpl", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution", - "org.camunda.bpm.engine.impl.context.CaseExecutionContext", - "org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransformFactory", - "org.camunda.bpm.engine.impl.pvm.PvmScope", - "org.camunda.bpm.engine.delegate.JavaDelegate", - "org.camunda.bpm.engine.impl.tree.TreeWalker$WalkCondition", - "org.camunda.bpm.engine.runtime.ProcessInstance", - "org.camunda.bpm.application.ProcessApplicationReference", - "org.camunda.bpm.engine.delegate.BpmnModelExecutionContext", - "org.camunda.bpm.engine.impl.jobexecutor.FailedJobCommandFactory", - "org.openecomp.mso.bpmn.core.ReadFileTask", - "org.camunda.bpm.engine.delegate.DelegateExecution", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnIfPartDeclaration", - "org.camunda.bpm.engine.delegate.CmmnModelExecutionContext", - "org.camunda.bpm.engine.impl.persistence.entity.util.FormPropertyStartContext", - "com.att.eelf.i18n.EELFMsgs", - "org.camunda.bpm.engine.impl.javax.el.ELContext", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceStart", - "org.camunda.bpm.engine.impl.core.variable.event.VariableEventDispatcher", - "org.camunda.bpm.engine.variable.type.ValueType", - "org.camunda.bpm.engine.impl.interceptor.CommandContextListener", - "org.camunda.bpm.engine.impl.core.variable.mapping.IoMapping", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationInterruptScope", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnCaseInstance", - "org.camunda.bpm.engine.impl.db.HasDbRevision", - "org.camunda.bpm.model.bpmn.instance.FlowElement", - "org.camunda.bpm.engine.delegate.Expression", - "org.camunda.bpm.engine.variable.type.SerializableValueType", - "org.camunda.bpm.engine.impl.pvm.PvmActivity", - "org.camunda.bpm.engine.impl.cfg.BpmnParseFactory", - "org.camunda.bpm.model.bpmn.instance.BpmnModelElementInstance", - "org.camunda.bpm.model.cmmn.instance.CmmnModelElementInstance", - "org.camunda.bpm.engine.impl.pvm.PvmException", - "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", - "org.camunda.bpm.application.ProcessApplicationUnavailableException", - "org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition", - "org.camunda.bpm.engine.delegate.DelegateCaseExecution", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerTake", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityNotifyListenerEnd", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnOnPartDeclaration", - "org.camunda.bpm.engine.runtime.CaseExecution", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition", - "org.camunda.bpm.engine.impl.core.variable.scope.SimpleVariableStore", - "org.camunda.bpm.engine.repository.ProcessDefinition", - "org.camunda.bpm.engine.impl.pvm.process.ScopeImpl", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerStart", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartConcurrent", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.AbstractPvmAtomicOperationTransitionNotifyListenerTake", - "org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl", - "org.openecomp.mso.logger.MsoLogger$ErrorCode", - "org.camunda.bpm.engine.impl.pvm.runtime.AtomicOperation", - "org.camunda.bpm.engine.impl.interceptor.SessionFactory", - "org.camunda.bpm.engine.delegate.DelegateTask", - "org.camunda.bpm.engine.impl.pvm.process.ActivityStartBehavior", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation", - "org.camunda.bpm.engine.impl.core.model.CoreActivity", - "org.camunda.bpm.model.bpmn.BpmnModelInstance", - "org.camunda.bpm.engine.delegate.VariableScope", - "org.camunda.bpm.engine.ProcessEngine", - "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionImpl", - "org.camunda.bpm.engine.impl.interceptor.CommandContext", - "org.camunda.bpm.engine.impl.variable.listener.CaseVariableListenerInvocation", - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.camunda.bpm.engine.BadUserRequestException", - "org.camunda.bpm.engine.impl.context.ExecutionContext", - "org.camunda.bpm.engine.impl.persistence.entity.TaskEntity", - "org.camunda.bpm.engine.impl.context.Context", - "org.camunda.bpm.engine.ProcessEngineServices", - "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", - "org.camunda.bpm.engine.runtime.Execution", - "org.camunda.bpm.engine.impl.pvm.process.Lane", - "org.camunda.bpm.engine.impl.pvm.process.ParticipantProcess", - "org.camunda.bpm.engine.impl.interceptor.CommandExecutor", - "org.camunda.bpm.engine.delegate.ProcessEngineServicesAware", - "org.camunda.bpm.engine.ProcessEngineConfiguration", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity", - "org.camunda.bpm.engine.impl.util.BitMaskUtil", - "org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition", - "org.camunda.bpm.engine.impl.cmmn.behavior.CmmnActivityBehavior", - "org.camunda.bpm.engine.impl.core.variable.event.VariableEvent", - "org.camunda.bpm.engine.delegate.BaseDelegateExecution", - "org.camunda.bpm.engine.impl.pvm.PvmExecution", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartCreateScope", - "org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity", - "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableStore", - "org.camunda.bpm.engine.runtime.VariableInstance", - "org.camunda.bpm.engine.runtime.Job", - "org.camunda.bpm.engine.runtime.Incident", - "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState$CaseExecutionStateImpl", - "org.camunda.bpm.model.xml.ModelInstance", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStart", - "org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl", - "org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity", - "org.openecomp.mso.entity.MsoRequest", - "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", - "org.openecomp.mso.bpmn.core.BadInjectedFieldException", - "org.camunda.bpm.engine.impl.variable.serializer.ValueFields", - "org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation", - "org.camunda.bpm.engine.impl.task.TaskDecorator", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInitStackNotifyListenerStart", - "org.camunda.bpm.engine.impl.jobexecutor.JobExecutorContext", - "org.camunda.bpm.engine.impl.task.delegate.TaskListenerInvocation", - "org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationsTransitionInterruptFlowScope", - "org.camunda.bpm.model.xml.instance.ModelElementInstance", - "org.camunda.bpm.engine.ProcessEngineException", - "org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration", - "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState$SuspensionStateImpl", - "org.camunda.bpm.engine.impl.db.DbEntity", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerEnd", - "org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationFireActivityEnd", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationStartTransitionNotifyListenerTake", - "org.camunda.bpm.engine.runtime.EventSubscription", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionDestroyScope", - "org.camunda.bpm.engine.impl.core.variable.value.UntypedValueImpl", - "org.camunda.bpm.engine.management.JobDefinition", - "com.att.eelf.i18n.EELFResolvableErrorEnum", - "com.att.eelf.configuration.EELFLogger$Level", - "org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior", - "org.camunda.bpm.engine.impl.core.variable.scope.MapBasedVariableStore", - "org.camunda.bpm.engine.impl.javax.el.ValueReference", - "org.camunda.bpm.engine.impl.persistence.entity.JobEntity", - "org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext", - "org.camunda.bpm.engine.delegate.DelegateCaseVariableInstance", - "org.camunda.bpm.engine.impl.pvm.PvmProcessElement", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "org.camunda.bpm.engine.impl.delegate.DelegateInvocation", - "org.camunda.bpm.engine.impl.javax.el.ValueExpression", - "com.att.eelf.configuration.EELFLogger", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationFireProcessStart", - "org.camunda.bpm.engine.runtime.CaseInstance", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope", - "org.camunda.bpm.engine.impl.db.DbEntityLifecycleAware", - "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl", - "org.camunda.bpm.engine.impl.core.model.CoreModelElement", - "org.camunda.bpm.engine.impl.interceptor.CommandInterceptor", - "org.camunda.bpm.engine.impl.pvm.PvmProcessInstance", - "org.camunda.bpm.engine.impl.cmmn.execution.CaseSentryPartImpl", - "org.camunda.bpm.engine.variable.value.TypedValue", - "org.apache.ibatis.transaction.TransactionFactory", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnSentryPart", - "org.camunda.bpm.engine.impl.pvm.process.LaneSet", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInitStack", - "org.camunda.bpm.engine.delegate.DelegateListener", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution", - "org.camunda.bpm.engine.delegate.ExecutionListener", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationDeleteCascadeFireActivityEnd", - "org.camunda.bpm.engine.exception.NotAllowedException", - "org.camunda.bpm.engine.impl.history.event.HistoryEventType", - "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", - "org.camunda.bpm.engine.impl.pvm.process.HasDIBounds", - "com.att.eelf.configuration.SLF4jWrapper", - "org.camunda.bpm.engine.task.Task", - "org.camunda.bpm.engine.impl.javax.el.Expression", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityEnd", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.AbstractPvmEventAtomicOperation", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceEnd", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationDeleteCascade", - "org.camunda.bpm.engine.impl.context.CoreExecutionContext", - "org.camunda.bpm.engine.delegate.DelegateVariableInstance", - "org.openecomp.mso.logger.MsoLogger", - "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", - "org.camunda.bpm.model.cmmn.CmmnModelInstance", - "org.camunda.bpm.engine.variable.VariableMap", - "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState$ActivityInstanceStateImpl", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessEnd", - "org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl", - "org.camunda.bpm.model.bpmn.instance.BaseElement", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateConcurrentExecution", - "org.camunda.bpm.engine.exception.NullValueException", - "org.camunda.bpm.engine.impl.core.variable.scope.CoreVariableStore", - "org.camunda.bpm.engine.impl.context.BpmnExecutionContext", - "org.openecomp.mso.bpmn.core.BaseTask", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartInterruptEventScope", - "org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", - "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityStartCancelScope", - "org.apache.ibatis.session.SqlSessionFactory", - "org.camunda.bpm.engine.impl.variable.AbstractPersistentVariableStore", - "org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext", - "com.att.eelf.i18n.EELFResourceManager", - "org.camunda.bpm.engine.impl.core.delegate.CoreActivityBehavior", - "org.openecomp.mso.logger.MessageEnum", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionCreateScope", - "org.openecomp.mso.logger.MsoLogger$ResponseCode", - "org.camunda.bpm.engine.SuspendedEntityInteractionException", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCancelActivity", - "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", - "org.openecomp.mso.logger.MsoLogger$StatusCode", - "org.camunda.bpm.engine.impl.db.HasDbReferences", - "org.camunda.bpm.engine.impl.tree.Collector", - "com.att.eelf.configuration.EELFManager", - "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext", - "org.camunda.bpm.engine.impl.core.operation.CoreAtomicOperation", - "org.camunda.bpm.engine.impl.pvm.PvmTransition", - "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", - "org.camunda.bpm.model.cmmn.instance.CmmnElement", - "org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration", - "org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity", - "com.att.eelf.i18n.EELFResourceManager$1", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessStart", - "org.camunda.bpm.engine.impl.core.instance.CoreExecution", - "org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance", - "org.camunda.bpm.engine.variable.type.PrimitiveValueType", - "org.camunda.bpm.engine.delegate.VariableListener", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnSentryDeclaration", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute", - "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl$1" - ); - } - - private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ReadFileTaskESTestscaffolding.class.getClassLoader()); - - org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.openecomp.mso.logger.MsoLogger", - "com.att.eelf.i18n.EELFResourceManager", - "com.att.eelf.i18n.EELFMsgs", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "com.att.eelf.configuration.EELFLogger$Level", - "com.att.eelf.configuration.EELFManager", - "org.openecomp.mso.logger.MessageEnum", - "org.openecomp.mso.bpmn.core.ReadFileTask", - "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", - "org.camunda.bpm.engine.impl.core.instance.CoreExecution", - "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", - "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", - "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", - "org.camunda.bpm.engine.impl.javax.el.Expression", - "org.camunda.bpm.engine.impl.javax.el.ValueExpression", - "org.camunda.bpm.engine.impl.context.Context", - "org.camunda.bpm.engine.ProcessEngineException", - "org.openecomp.mso.bpmn.core.BadInjectedFieldException", - "org.camunda.bpm.engine.exception.NullValueException", - "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", - "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", - "org.camunda.bpm.engine.impl.core.model.CoreModelElement", - "org.camunda.bpm.engine.impl.core.model.CoreActivity", - "org.camunda.bpm.engine.impl.pvm.process.ScopeImpl", - "org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition", - "org.camunda.bpm.engine.impl.pvm.PvmException", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution", - "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionImpl", - "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionState", - "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", - "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityInstanceEnd", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationProcessEnd", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionDestroyScope", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation", - "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl$1", - "org.camunda.bpm.engine.impl.util.BitMaskUtil", - "org.camunda.bpm.engine.impl.pvm.process.TransitionImpl", - "org.camunda.bpm.engine.impl.core.variable.value.UntypedValueImpl" - ); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTest.java deleted file mode 100644 index e26f5a9a46..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/RollbackDataESTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Mon Nov 14 11:33:44 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core; - -import org.junit.Test; -import static org.junit.Assert.*; -import static org.evosuite.runtime.EvoAssertions.*; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.evosuite.runtime.PrivateAccess; -import org.junit.runner.RunWith; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class RollbackDataESTest extends RollbackDataESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - RollbackData rollbackData0 = new RollbackData(); - rollbackData0.put("", "", ""); - String string0 = (String)rollbackData0.get("", "0-0|Ox?"); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test1() throws Throwable { - RollbackData rollbackData0 = new RollbackData(); - Serializable serializable0 = rollbackData0.get("", "0-0|Ox?"); - assertNull(serializable0); - } - - @Test(timeout = 4000) - public void test2() throws Throwable { - RollbackData rollbackData0 = new RollbackData(); - rollbackData0.put("", "", ""); - String string0 = (String)rollbackData0.get("", ""); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test3() throws Throwable { - RollbackData rollbackData0 = new RollbackData(); - HashMap hashMap0 = new HashMap(); - HashMap hashMap1 = new HashMap(); - hashMap0.put("/0H\"wnR=^l|l$+qQDi", hashMap1); - PrivateAccess.setVariable((Class) RollbackData.class, rollbackData0, "dictionary", (Object) hashMap0); - Map map0 = rollbackData0.get("/0H\"wnR=^l|l$+qQDi"); - assertEquals(0, map0.size()); - } - - @Test(timeout = 4000) - public void test4() throws Throwable { - RollbackData rollbackData0 = new RollbackData(); - rollbackData0.put("RollbackData[]", "$", "RollbackData[]"); - Map map0 = rollbackData0.get("RollbackData[]"); - assertFalse(map0.isEmpty()); - } - - @Test(timeout = 4000) - public void test5() throws Throwable { - RollbackData rollbackData0 = new RollbackData(); - rollbackData0.put("org.openecomp.mso.bpmn.core.RollbackData", "org.openecomp.mso.bpmn.core.RollbackData", "!{=|?cluq? yk])."); - rollbackData0.get(""); - PrivateAccess.setVariable((Class) RollbackData.class, rollbackData0, "dictionary", (Object) null); - // Undeclared exception! - try { - rollbackData0.get("org.openecomp.mso.bpmn.core.RollbackData"); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.bpmn.core.RollbackData", e); - } - } - - @Test(timeout = 4000) - public void test6() throws Throwable { - RollbackData rollbackData0 = new RollbackData(); - rollbackData0.put("$", "$", "RollbackData[]"); - rollbackData0.put("RollbackData[]", "$", "RollbackData[]"); - String string0 = rollbackData0.toString(); - assertEquals("RollbackData[${$=RollbackData[]},RollbackData[]{$=RollbackData[]}]", string0); - } - - @Test(timeout = 4000) - public void test7() throws Throwable { - RollbackData rollbackData0 = new RollbackData(); - rollbackData0.put("$", "$", "RollbackData[]"); - rollbackData0.put("$", "RollbackData[]", "RollbackData[]"); - } - - @Test(timeout = 4000) - public void test8() throws Throwable { - RollbackData rollbackData0 = new RollbackData(); - HashMap hashMap0 = new HashMap(); - HashMap hashMap1 = new HashMap(); - hashMap0.put("/0H\"wnR=^l|l$+qQDi", hashMap1); - PrivateAccess.setVariable((Class) RollbackData.class, rollbackData0, "dictionary", (Object) hashMap0); - boolean boolean0 = rollbackData0.hasType("/0H\"wnR=^l|l$+qQDi"); - assertTrue(boolean0); - } - - @Test(timeout = 4000) - public void test9() throws Throwable { - RollbackData rollbackData0 = new RollbackData(); - boolean boolean0 = rollbackData0.hasType("RollbackData[]"); - assertFalse(boolean0); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java index 3f2f74d2f7..a45f1fdba2 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/TestBaseTask.java @@ -20,6 +20,8 @@ package org.openecomp.mso.bpmn.core; +import static org.junit.Assert.assertNotNull; + import java.util.HashMap; import java.util.Map; @@ -33,8 +35,6 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import org.openecomp.mso.bpmn.test.CamundaDBSetup; -import org.openecomp.mso.bpmn.test.PropertyConfigurationSetup; import org.openecomp.mso.logger.MsoLogger; /** @@ -61,6 +61,7 @@ public class TestBaseTask { variables.put("lastVisit", (Long)1438270117000L); RuntimeService runtimeService = processEngineRule.getRuntimeService(); + assertNotNull(runtimeService); processEngineRule.getTaskService(); runtimeService.startProcessInstanceByKey("BaseTaskTest", variables); } diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTest.java deleted file mode 100644 index 64220f016d..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTest.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Mon Nov 14 11:35:51 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core; - -import org.junit.Test; - -import static org.evosuite.shaded.org.mockito.Mockito.*; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.evosuite.runtime.ViolatedAssumptionAnswer; -import org.junit.runner.RunWith; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class URNMappingsTaskESTest extends URNMappingsTaskESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - URNMappingsTask uRNMappingsTask0 = new URNMappingsTask(); - DelegateExecution delegateExecution0 = mock(DelegateExecution.class, new ViolatedAssumptionAnswer()); - uRNMappingsTask0.execute(delegateExecution0); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTestscaffolding.java deleted file mode 100644 index 93151d3271..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/URNMappingsTaskESTestscaffolding.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Scaffolding file used to store all the setups needed to run - * tests automatically generated by EvoSuite - * Mon Nov 14 11:35:51 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core; - -import org.evosuite.runtime.annotation.EvoSuiteClassExclude; -import org.junit.BeforeClass; -import org.junit.Before; -import org.junit.After; -import org.junit.AfterClass; -import org.evosuite.runtime.sandbox.Sandbox; - -@EvoSuiteClassExclude -public class URNMappingsTaskESTestscaffolding { - - @org.junit.Rule - public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); - - private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.bpmn.core.URNMappingsTask"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); - initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } - - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } - - @Before - public void initTestCase(){ - threadStopper.storeCurrentThreads(); - threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } - - @After - public void doneWithTestCase(){ - threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } - - - private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(URNMappingsTaskESTestscaffolding.class.getClassLoader() , - "org.camunda.bpm.engine.delegate.BpmnModelExecutionContext", - "org.camunda.bpm.model.xml.instance.ModelElementInstance", - "org.camunda.bpm.engine.delegate.VariableScope", - "org.camunda.bpm.engine.delegate.ProcessEngineServicesAware", - "org.camunda.bpm.engine.variable.value.TypedValue", - "org.camunda.bpm.engine.delegate.DelegateExecution", - "org.camunda.bpm.engine.delegate.Expression", - "org.openecomp.mso.bpmn.core.BadInjectedFieldException", - "org.camunda.bpm.model.bpmn.instance.BpmnModelElementInstance", - "org.openecomp.mso.bpmn.core.URNMappingsTask", - "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", - "org.openecomp.mso.bpmn.core.BaseTask", - "org.camunda.bpm.engine.delegate.BaseDelegateExecution", - "org.camunda.bpm.engine.variable.VariableMap", - "org.camunda.bpm.engine.delegate.JavaDelegate", - "org.camunda.bpm.engine.ProcessEngineServices", - "org.camunda.bpm.model.bpmn.BpmnModelInstance", - "org.camunda.bpm.model.bpmn.instance.BaseElement", - "org.camunda.bpm.model.xml.ModelInstance", - "org.camunda.bpm.model.bpmn.instance.FlowElement" - ); - } - - private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(URNMappingsTaskESTestscaffolding.class.getClassLoader()); - - org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "org.openecomp.mso.bpmn.core.BadInjectedFieldException", - "org.openecomp.mso.bpmn.core.MissingInjectedFieldException" - ); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTest.java deleted file mode 100644 index 1891c8d478..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Mon Nov 14 11:35:37 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core; - -import org.junit.Test; -import static org.junit.Assert.*; - -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.junit.runner.RunWith; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class WorkflowExceptionESTest extends WorkflowExceptionESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - WorkflowException workflowException0 = new WorkflowException("(YdK~.N3;c2C", 336, "(YdK~.N3;c2C"); - workflowException0.getProcessKey(); - assertEquals(336, workflowException0.getErrorCode()); - } - - @Test(timeout = 4000) - public void test1() throws Throwable { - WorkflowException workflowException0 = new WorkflowException("", 0, ""); - workflowException0.getProcessKey(); - assertEquals(0, workflowException0.getErrorCode()); - } - - @Test(timeout = 4000) - public void test2() throws Throwable { - WorkflowException workflowException0 = new WorkflowException((String) null, 0, "^Y:"); - String string0 = workflowException0.getErrorMessage(); - assertEquals(0, workflowException0.getErrorCode()); - assertNotNull(string0); - } - - @Test(timeout = 4000) - public void test3() throws Throwable { - WorkflowException workflowException0 = new WorkflowException("", 1216, ""); - workflowException0.getErrorMessage(); - assertEquals(1216, workflowException0.getErrorCode()); - } - - @Test(timeout = 4000) - public void test4() throws Throwable { - WorkflowException workflowException0 = new WorkflowException("", 0, ""); - int int0 = workflowException0.getErrorCode(); - assertEquals(0, int0); - } - - @Test(timeout = 4000) - public void test5() throws Throwable { - WorkflowException workflowException0 = new WorkflowException((String) null, (-1911), (String) null); - int int0 = workflowException0.getErrorCode(); - assertEquals((-1911), int0); - } - - @Test(timeout = 4000) - public void test6() throws Throwable { - WorkflowException workflowException0 = new WorkflowException((String) null, 336, (String) null); - workflowException0.getErrorMessage(); - assertEquals(336, workflowException0.getErrorCode()); - } - - @Test(timeout = 4000) - public void test7() throws Throwable { - WorkflowException workflowException0 = new WorkflowException((String) null, 336, (String) null); - int int0 = workflowException0.getErrorCode(); - assertEquals(336, int0); - } - - @Test(timeout = 4000) - public void test8() throws Throwable { - WorkflowException workflowException0 = new WorkflowException((String) null, 336, (String) null); - workflowException0.getProcessKey(); - assertEquals(336, workflowException0.getErrorCode()); - } - - @Test(timeout = 4000) - public void test9() throws Throwable { - WorkflowException workflowException0 = new WorkflowException((String) null, 336, (String) null); - String string0 = workflowException0.toString(); - assertEquals("WorkflowException[processKey=null,errorCode=336,errorMessage=null]", string0); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTest.java deleted file mode 100644 index a14934193e..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Mon Nov 14 11:28:14 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core; - -import org.junit.Test; -import static org.junit.Assert.*; -import static org.evosuite.shaded.org.mockito.Mockito.*; -import static org.evosuite.runtime.EvoAssertions.*; - -import java.io.IOException; -import net.sf.saxon.s9api.XQueryCompiler; -import net.sf.saxon.s9api.XQueryExecutable; -import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.evosuite.runtime.PrivateAccess; -import org.evosuite.runtime.ViolatedAssumptionAnswer; -import org.junit.runner.RunWith; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class XQueryScriptTaskESTest extends XQueryScriptTaskESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - XQueryScriptTask xQueryScriptTask0 = new XQueryScriptTask(); - XQueryCompiler xQueryCompiler0 = mock(XQueryCompiler.class, new ViolatedAssumptionAnswer()); - doReturn((XQueryExecutable) null).when(xQueryCompiler0).compile(any(java.io.InputStream.class)); - Object object0 = PrivateAccess.callMethod((Class) XQueryScriptTask.class, xQueryScriptTask0, "compile", (Object) xQueryCompiler0, (Class) XQueryCompiler.class, (Object) "", (Class) String.class); - assertNull(object0); - } - - @Test(timeout = 4000) - public void test1() throws Throwable { - XQueryScriptTask xQueryScriptTask0 = new XQueryScriptTask(); - XQueryCompiler xQueryCompiler0 = mock(XQueryCompiler.class, new ViolatedAssumptionAnswer()); - try { - PrivateAccess.callMethod((Class) XQueryScriptTask.class, xQueryScriptTask0, "compile", (Object) xQueryCompiler0, (Class) XQueryCompiler.class, (Object) "Sk##N$V^.", (Class) String.class); - fail("Expecting exception: IOException"); - - } catch(IOException e) { - // - // Resource not found: Sk##N$V^. - // - verifyException("org.openecomp.mso.bpmn.core.XQueryScriptTask", e); - } - } - - @Test(timeout = 4000) - public void test2() throws Throwable { - XQueryScriptTask xQueryScriptTask0 = new XQueryScriptTask(); - try { - PrivateAccess.callMethod((Class) XQueryScriptTask.class, xQueryScriptTask0, "compile", (Object) null, (Class) XQueryCompiler.class, (Object) "", (Class) String.class); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.bpmn.core.XQueryScriptTask", e); - } - } - - @Test(timeout = 4000) - public void test3() throws Throwable { - XQueryScriptTask xQueryScriptTask0 = new XQueryScriptTask(); - ExecutionImpl executionImpl0 = new ExecutionImpl(); - try { - xQueryScriptTask0.execute(executionImpl0); - fail("Expecting exception: RuntimeException"); - - } catch(RuntimeException e) { - // - // XQueryScriptTask injected field 'scriptFile' is bad: missing required field - // - verifyException("org.openecomp.mso.bpmn.core.BaseTask", e); - } - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTestscaffolding.java deleted file mode 100644 index b0c1585e59..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/XQueryScriptTaskESTestscaffolding.java +++ /dev/null @@ -1,533 +0,0 @@ -/** - * Scaffolding file used to store all the setups needed to run - * tests automatically generated by EvoSuite - * Mon Nov 14 11:28:14 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core; - -import org.evosuite.runtime.annotation.EvoSuiteClassExclude; -import org.junit.BeforeClass; -import org.junit.Before; -import org.junit.After; -import org.junit.AfterClass; -import org.evosuite.runtime.sandbox.Sandbox; - -@EvoSuiteClassExclude -public class XQueryScriptTaskESTestscaffolding { - - @org.junit.Rule - public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); - - private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.bpmn.core.XQueryScriptTask"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); - initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } - - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } - - @Before - public void initTestCase(){ - threadStopper.storeCurrentThreads(); - threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } - - @After - public void doneWithTestCase(){ - threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } - - - private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(XQueryScriptTaskESTestscaffolding.class.getClassLoader() , - "net.sf.saxon.pattern.PatternFinder", - "net.sf.saxon.pattern.AnyNodeTest", - "net.sf.saxon.tree.linked.TextImpl", - "net.sf.saxon.tree.linked.ElementImpl", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnExecution", - "org.camunda.bpm.engine.impl.context.CaseExecutionContext", - "org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransformFactory", - "org.camunda.bpm.engine.impl.pvm.PvmScope", - "net.sf.saxon.type.TypeHierarchy", - "net.sf.saxon.trans.Mode", - "org.camunda.bpm.engine.impl.tree.TreeWalker$WalkCondition", - "org.camunda.bpm.engine.runtime.ProcessInstance", - "net.sf.saxon.trans.CompilerInfo", - "net.sf.saxon.type.ConversionResult", - "net.sf.saxon.type.ItemType", - "net.sf.saxon.om.NamePool", - "net.sf.saxon.value.NumericValue", - "org.camunda.bpm.engine.impl.jobexecutor.FailedJobCommandFactory", - "net.sf.saxon.s9api.Processor", - "net.sf.saxon.om.NameChecker", - "org.camunda.bpm.engine.impl.persistence.entity.util.FormPropertyStartContext", - "net.sf.saxon.expr.sort.SimpleCollation", - "net.sf.saxon.z.IntIterator", - "net.sf.saxon.expr.PendingUpdateList", - "net.sf.saxon.om.NamespaceBinding", - "net.sf.saxon.lib.StaticQueryContextFactory", - "net.sf.saxon.serialize.charcode.CharacterSet", - "net.sf.saxon.event.Receiver", - "org.camunda.bpm.model.bpmn.instance.FlowElement", - "net.sf.saxon.om.AbstractItem", - "net.sf.saxon.lib.ExternalObjectModel", - "net.sf.saxon.event.LocationProvider", - "org.camunda.bpm.engine.delegate.Expression", - "net.sf.saxon.value.QualifiedNameValue", - "net.sf.saxon.om.MutableDocumentInfo", - "org.camunda.bpm.engine.impl.pvm.PvmActivity", - "org.camunda.bpm.engine.impl.cfg.BpmnParseFactory", - "org.camunda.bpm.model.bpmn.instance.BpmnModelElementInstance", - "net.sf.saxon.pattern.NodeTest", - "net.sf.saxon.om.NamespaceException", - "net.sf.saxon.lib.EnvironmentVariableResolver", - "org.camunda.bpm.application.ProcessApplicationUnavailableException", - "net.sf.saxon.expr.instruct.Procedure", - "net.sf.saxon.om.Sequence", - "org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition", - "net.sf.saxon.type.ValidationFailure", - "org.camunda.bpm.engine.delegate.DelegateCaseExecution", - "net.sf.saxon.tree.iter.UnfailingIterator", - "net.sf.saxon.type.AnySimpleType", - "org.camunda.bpm.engine.runtime.CaseExecution", - "net.sf.saxon.event.ProxyReceiver", - "net.sf.saxon.lib.ConversionRules", - "net.sf.saxon.lib.OutputURIResolver", - "net.sf.saxon.expr.instruct.ValidatingInstruction", - "net.sf.saxon.om.FunctionItem", - "net.sf.saxon.om.MutableNodeInfo", - "org.camunda.bpm.engine.impl.pvm.process.ScopeImpl", - "net.sf.saxon.pattern.PatternWithPredicate", - "net.sf.saxon.expr.ErrorExpression", - "net.sf.saxon.om.Name10Checker", - "net.sf.saxon.event.ComplexContentOutputter", - "org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl", - "org.openecomp.mso.logger.MsoLogger$ErrorCode", - "org.camunda.bpm.engine.impl.pvm.runtime.AtomicOperation", - "org.camunda.bpm.engine.delegate.DelegateTask", - "net.sf.saxon.style.LiteralResultElement", - "org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperation", - "org.camunda.bpm.engine.impl.core.model.CoreActivity", - "net.sf.saxon.tree.iter.LookaheadIterator", - "net.sf.saxon.om.AtomicSequence", - "net.sf.saxon.s9api.XQueryCompiler", - "net.sf.saxon.pattern.LocalNameTest", - "net.sf.saxon.pattern.PatternParser", - "net.sf.saxon.expr.instruct.SlotManager", - "net.sf.saxon.PreparedStylesheet", - "org.camunda.bpm.engine.impl.interceptor.CommandContext", - "org.openecomp.mso.logger.MsoLogger$Catalog", - "net.sf.saxon.lib.ParseOptions", - "net.sf.saxon.expr.ItemMappingIterator", - "net.sf.saxon.tree.iter.EmptyIterator", - "org.camunda.bpm.engine.impl.persistence.entity.TaskEntity", - "org.camunda.bpm.engine.impl.context.Context", - "net.sf.saxon.lib.LocalizerFactory", - "org.camunda.bpm.engine.ProcessEngineServices", - "org.camunda.bpm.engine.runtime.Execution", - "org.camunda.bpm.engine.impl.interceptor.CommandExecutor", - "net.sf.saxon.s9api.ItemType$1", - "org.camunda.bpm.engine.delegate.ProcessEngineServicesAware", - "org.camunda.bpm.engine.ProcessEngineConfiguration", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity", - "net.sf.saxon.s9api.ItemType$2", - "net.sf.saxon.s9api.ItemType$3", - "org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition", - "net.sf.saxon.pattern.NodeKindTest", - "org.camunda.bpm.engine.impl.core.variable.event.VariableEvent", - "net.sf.saxon.expr.LetExpression", - "org.camunda.bpm.engine.delegate.BaseDelegateExecution", - "net.sf.saxon.s9api.XdmItem", - "net.sf.saxon.expr.Binding", - "net.sf.saxon.expr.instruct.ParentNodeConstructor", - "org.camunda.bpm.engine.runtime.VariableInstance", - "org.camunda.bpm.engine.runtime.Incident", - "net.sf.saxon.om.NamespaceResolver", - "net.sf.saxon.expr.instruct.AnalyzeString", - "net.sf.saxon.z.IntHashMap", - "org.camunda.bpm.engine.impl.cmmn.entity.runtime.CaseExecutionEntity", - "net.sf.saxon.expr.instruct.ResultDocument", - "org.openecomp.mso.bpmn.core.BadInjectedFieldException", - "org.camunda.bpm.engine.impl.variable.serializer.ValueFields", - "net.sf.saxon.type.StringToDouble", - "net.sf.saxon.value.SequenceType", - "net.sf.saxon.type.ComplexType", - "org.camunda.bpm.engine.impl.jobexecutor.JobExecutorContext", - "net.sf.saxon.type.AnyType", - "org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity", - "net.sf.saxon.expr.StaticContext", - "org.camunda.bpm.engine.ProcessEngineException", - "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState$SuspensionStateImpl", - "net.sf.saxon.lib.SerializerFactory", - "net.sf.saxon.tree.util.SteppingNode", - "net.sf.saxon.functions.IntegratedFunctionLibrary", - "net.sf.saxon.evpull.PullEvent", - "net.sf.saxon.expr.XPathContextMinor", - "org.camunda.bpm.engine.management.JobDefinition", - "com.att.eelf.i18n.EELFResolvableErrorEnum", - "net.sf.saxon.om.DocumentInfo", - "net.sf.saxon.om.QNameException", - "org.camunda.bpm.engine.impl.javax.el.ValueReference", - "org.camunda.bpm.engine.impl.persistence.entity.JobEntity", - "net.sf.saxon.type.SchemaComponentVisitor", - "net.sf.saxon.z.AbstractIntSet", - "net.sf.saxon.tree.iter.AxisIterator", - "net.sf.saxon.s9api.XdmValue", - "net.sf.saxon.lib.CollationURIResolver", - "org.openecomp.mso.bpmn.core.XQueryScriptTask", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "org.camunda.bpm.engine.impl.delegate.DelegateInvocation", - "net.sf.saxon.tree.tiny.AppendableCharSequence", - "net.sf.saxon.om.GroundedValue", - "net.sf.saxon.tree.linked.NodeFactory", - "net.sf.saxon.type.SchemaDeclaration", - "net.sf.saxon.tree.linked.CommentImpl", - "org.camunda.bpm.engine.impl.interceptor.CommandInterceptor", - "org.camunda.bpm.engine.variable.value.TypedValue", - "net.sf.saxon.trans.BuiltInRuleSet", - "org.apache.ibatis.transaction.TransactionFactory", - "net.sf.saxon.value.AtomicValue", - "net.sf.saxon.trans.NonDelegatingURIResolver", - "net.sf.saxon.functions.VendorFunctionLibrary", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnActivityExecution", - "net.sf.saxon.pattern.PatternParser20", - "net.sf.saxon.expr.instruct.TraceExpression", - "org.camunda.bpm.engine.exception.NotAllowedException", - "net.sf.saxon.Configuration", - "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", - "net.sf.saxon.tree.util.FastStringBuffer", - "net.sf.saxon.tree.linked.NodeImpl", - "com.att.eelf.configuration.SLF4jWrapper", - "org.camunda.bpm.engine.task.Task", - "org.camunda.bpm.engine.impl.javax.el.Expression", - "net.sf.saxon.type.Type", - "net.sf.saxon.s9api.XdmNode", - "net.sf.saxon.value.QNameValue", - "org.camunda.bpm.engine.impl.context.CoreExecutionContext", - "org.openecomp.mso.logger.MsoLogger", - "net.sf.saxon.type.SchemaType", - "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", - "net.sf.saxon.java.JavaPlatform$1", - "net.sf.saxon.expr.instruct.ElementCreator", - "net.sf.saxon.om.Item", - "org.camunda.bpm.engine.variable.VariableMap", - "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState$ActivityInstanceStateImpl", - "net.sf.saxon.lib.SchemaURIResolver", - "org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl", - "org.camunda.bpm.engine.impl.core.variable.scope.CoreVariableStore", - "net.sf.saxon.lib.ModuleURIResolver", - "org.camunda.bpm.engine.impl.context.BpmnExecutionContext", - "net.sf.saxon.expr.parser.ExpressionVisitor", - "net.sf.saxon.om.SequenceIterator", - "net.sf.saxon.z.IntHashSet", - "net.sf.saxon.type.BuiltInType", - "org.apache.ibatis.session.SqlSessionFactory", - "net.sf.saxon.expr.instruct.Executable", - "net.sf.saxon.om.DocumentPool", - "net.sf.saxon.expr.LastPositionFinder", - "net.sf.saxon.expr.instruct.TailCallReturner", - "org.openecomp.mso.logger.MsoLogger$ResponseCode", - "net.sf.saxon.type.BuiltInAtomicType", - "org.camunda.bpm.engine.SuspendedEntityInteractionException", - "org.openecomp.mso.logger.MsoLogger$StatusCode", - "com.att.eelf.configuration.EELFManager", - "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext", - "org.camunda.bpm.engine.impl.core.operation.CoreAtomicOperation", - "org.camunda.bpm.engine.impl.pvm.PvmTransition", - "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", - "org.camunda.bpm.engine.impl.persistence.entity.IncidentEntity", - "org.camunda.bpm.engine.impl.core.variable.CoreVariableInstance", - "net.sf.saxon.pattern.ContentTypeTest", - "net.sf.saxon.query.QueryParser", - "net.sf.saxon.om.NodeName", - "net.sf.saxon.value.Closure", - "net.sf.saxon.expr.instruct.FixedElement", - "org.camunda.bpm.engine.impl.pvm.process.TransitionImpl", - "net.sf.saxon.s9api.ConstructedItemType", - "net.sf.saxon.lib.Numberer", - "org.camunda.bpm.engine.delegate.JavaDelegate", - "net.sf.saxon.om.IdentityComparable", - "net.sf.saxon.z.IntSet", - "org.camunda.bpm.application.ProcessApplicationReference", - "net.sf.saxon.pattern.QNameTest", - "org.camunda.bpm.engine.delegate.BpmnModelExecutionContext", - "net.sf.saxon.expr.sort.SortKeyDefinition", - "net.sf.saxon.style.XSLAnalyzeString", - "org.camunda.bpm.engine.delegate.DelegateExecution", - "org.camunda.bpm.engine.delegate.CmmnModelExecutionContext", - "net.sf.saxon.expr.instruct.ValueOf", - "net.sf.saxon.type.AnyItemType", - "com.att.eelf.i18n.EELFMsgs", - "org.camunda.bpm.engine.impl.javax.el.ELContext", - "net.sf.saxon.expr.instruct.WithParam", - "org.camunda.bpm.engine.impl.core.variable.event.VariableEventDispatcher", - "net.sf.saxon.expr.Assignation", - "net.sf.saxon.value.StringToDouble11", - "org.camunda.bpm.engine.variable.type.ValueType", - "net.sf.saxon.style.StylesheetModule", - "net.sf.saxon.value.EmptySequence", - "org.camunda.bpm.engine.impl.interceptor.CommandContextListener", - "org.camunda.bpm.engine.impl.cmmn.execution.CmmnCaseInstance", - "net.sf.saxon.style.PrincipalStylesheetModule", - "net.sf.saxon.type.PlainType", - "org.camunda.bpm.engine.repository.CaseDefinition", - "org.camunda.bpm.engine.impl.db.HasDbRevision", - "net.sf.saxon.query.StaticQueryContext", - "net.sf.saxon.expr.instruct.SimpleNodeConstructor", - "net.sf.saxon.trans.DynamicLoader", - "net.sf.saxon.s9api.ItemType$BuiltInAtomicItemType", - "org.camunda.bpm.engine.variable.type.SerializableValueType", - "net.sf.saxon.event.SaxonLocator", - "net.sf.saxon.expr.parser.Optimizer", - "org.camunda.bpm.engine.impl.pvm.PvmException", - "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", - "net.sf.saxon.expr.sort.Sortable", - "net.sf.saxon.type.ExternalObjectType", - "net.sf.saxon.expr.Literal", - "net.sf.saxon.style.StyleElement", - "org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition", - "org.camunda.bpm.engine.impl.core.variable.scope.SimpleVariableStore", - "net.sf.saxon.type.ValidationException", - "org.camunda.bpm.engine.repository.ProcessDefinition", - "net.sf.saxon.style.AbsentExtensionElement", - "net.sf.saxon.style.XSLStylesheet", - "net.sf.saxon.query.XQueryFunctionBinder", - "net.sf.saxon.Platform", - "net.sf.saxon.om.AbsolutePath", - "net.sf.saxon.style.SourceBinding", - "org.camunda.bpm.engine.impl.interceptor.SessionFactory", - "net.sf.saxon.trace.InstructionInfo", - "net.sf.saxon.pattern.NameTest", - "net.sf.saxon.trans.XPathException", - "net.sf.saxon.pattern.ItemTypePattern", - "org.camunda.bpm.model.bpmn.BpmnModelInstance", - "net.sf.saxon.type.SimpleType", - "net.sf.saxon.tree.linked.ProcInstImpl", - "net.sf.saxon.expr.instruct.UserFunction", - "net.sf.saxon.event.SequenceReceiver", - "org.camunda.bpm.engine.delegate.VariableScope", - "net.sf.saxon.event.FilterFactory", - "org.camunda.bpm.engine.ProcessEngine", - "org.camunda.bpm.engine.impl.cmmn.execution.CaseExecutionImpl", - "org.camunda.bpm.engine.impl.variable.listener.CaseVariableListenerInvocation", - "org.camunda.bpm.engine.BadUserRequestException", - "net.sf.saxon.expr.Callable", - "org.camunda.bpm.engine.impl.context.ExecutionContext", - "net.sf.saxon.tree.tiny.TinyTree", - "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", - "net.sf.saxon.tree.iter.EmptyAxisIterator", - "net.sf.saxon.om.NotationSet", - "net.sf.saxon.expr.CollationMap", - "net.sf.saxon.tree.util.AttributeCollectionImpl", - "net.sf.saxon.type.UnionType", - "net.sf.saxon.expr.instruct.GeneralVariable", - "net.sf.saxon.trans.LicenseException", - "org.camunda.bpm.engine.impl.pvm.PvmExecution", - "net.sf.saxon.functions.FunctionLibrary", - "net.sf.saxon.lib.StandardURIResolver", - "org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity", - "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableStore", - "net.sf.saxon.type.TypeHierarchy$2", - "net.sf.saxon.trans.Mode$RuleAction", - "org.camunda.bpm.engine.runtime.Job", - "net.sf.saxon.type.TypeHierarchy$1", - "org.camunda.bpm.model.xml.ModelInstance", - "net.sf.saxon.om.FingerprintedNode", - "org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl", - "net.sf.saxon.tree.linked.ParentNodeImpl", - "net.sf.saxon.type.ErrorType", - "org.openecomp.mso.entity.MsoRequest", - "net.sf.saxon.value.NotationValue", - "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", - "net.sf.saxon.s9api.ItemType", - "net.sf.saxon.type.Untyped", - "net.sf.saxon.expr.parser.PathMap$PathMapRoot", - "net.sf.saxon.expr.instruct.AttributeCreator", - "org.camunda.bpm.engine.impl.task.delegate.TaskListenerInvocation", - "net.sf.saxon.expr.instruct.AttributeSet", - "net.sf.saxon.trans.Mode$RuleFilter", - "net.sf.saxon.s9api.XdmAtomicValue", - "net.sf.saxon.om.AttributeCollection", - "org.camunda.bpm.model.xml.instance.ModelElementInstance", - "net.sf.saxon.expr.sort.RuleBasedSubstringMatcher", - "org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration", - "org.camunda.bpm.engine.impl.db.DbEntity", - "net.sf.saxon.java.JavaPlatform", - "org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution", - "org.camunda.bpm.engine.runtime.EventSubscription", - "net.sf.saxon.lib.URIChecker", - "net.sf.saxon.tree.linked.DocumentImpl", - "net.sf.saxon.s9api.XQueryExecutable", - "net.sf.saxon.expr.instruct.FixedAttribute", - "net.sf.saxon.expr.XPathContextMajor", - "net.sf.saxon.type.AtomicType", - "net.sf.saxon.expr.instruct.DocumentInstr", - "net.sf.saxon.expr.Expression", - "net.sf.saxon.serialize.charcode.CharacterSetFactory", - "com.att.eelf.configuration.EELFLogger$Level", - "org.camunda.bpm.engine.impl.core.variable.scope.MapBasedVariableStore", - "net.sf.saxon.tree.util.Navigator", - "net.sf.saxon.pattern.NamespaceTest", - "org.camunda.bpm.engine.impl.pvm.runtime.ProcessInstanceStartContext", - "org.camunda.bpm.engine.delegate.DelegateCaseVariableInstance", - "org.camunda.bpm.engine.impl.pvm.PvmProcessElement", - "org.camunda.bpm.engine.impl.javax.el.ValueExpression", - "net.sf.saxon.tree.iter.ReversibleIterator", - "com.att.eelf.configuration.EELFLogger", - "net.sf.saxon.event.Builder", - "org.camunda.bpm.engine.runtime.CaseInstance", - "net.sf.saxon.s9api.SaxonApiException", - "org.camunda.bpm.engine.impl.db.DbEntityLifecycleAware", - "net.sf.saxon.om.StructuredQName", - "org.camunda.bpm.engine.impl.pvm.process.ActivityImpl", - "org.camunda.bpm.engine.impl.core.model.CoreModelElement", - "org.camunda.bpm.engine.impl.pvm.PvmProcessInstance", - "net.sf.saxon.style.StyleNodeFactory", - "net.sf.saxon.expr.instruct.Instruction", - "net.sf.saxon.functions.FunctionLibraryList", - "org.camunda.bpm.engine.delegate.DelegateListener", - "net.sf.saxon.event.TeeOutputter", - "net.sf.saxon.lib.CollectionURIResolver", - "net.sf.saxon.type.SchemaException", - "net.sf.saxon.serialize.CDATAFilter", - "net.sf.saxon.lib.StringCollator", - "net.sf.saxon.expr.XPathContext", - "net.sf.saxon.lib.SourceResolver", - "net.sf.saxon.expr.MappingFunction", - "net.sf.saxon.expr.Container", - "net.sf.saxon.type.SchemaComponent", - "net.sf.saxon.om.Name11Checker", - "net.sf.saxon.expr.parser.ExpressionParser", - "org.camunda.bpm.engine.impl.history.event.HistoryEventType", - "net.sf.saxon.event.PipelineConfiguration", - "net.sf.saxon.tree.wrapper.SiblingCountingNode", - "org.camunda.bpm.engine.impl.pvm.process.HasDIBounds", - "net.sf.saxon.value.MemoClosure", - "net.sf.saxon.value.DecimalValue", - "org.camunda.bpm.engine.delegate.DelegateVariableInstance", - "net.sf.saxon.TypeCheckerEnvironment", - "net.sf.saxon.serialize.AttributeSorter", - "net.sf.saxon.regex.RegularExpression", - "net.sf.saxon.style.DataElement", - "net.sf.saxon.lib.ExtensionFunctionDefinition", - "net.sf.saxon.lib.SubstringMatcher", - "net.sf.saxon.lib.TraceListener", - "org.camunda.bpm.model.bpmn.instance.BaseElement", - "net.sf.saxon.style.Declaration", - "net.sf.saxon.value.BooleanValue", - "net.sf.saxon.expr.parser.CodeInjector", - "net.sf.saxon.tree.util.DocumentNumberAllocator", - "net.sf.saxon.pattern.PatternThatSetsCurrent", - "net.sf.saxon.expr.instruct.Debugger", - "org.openecomp.mso.bpmn.core.BaseTask", - "net.sf.saxon.pattern.Pattern", - "net.sf.saxon.expr.parser.PathMap$PathMapNode", - "org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity", - "net.sf.saxon.expr.instruct.SavedNamespaceContext", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", - "org.camunda.bpm.engine.impl.variable.AbstractPersistentVariableStore", - "org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext", - "com.att.eelf.i18n.EELFResourceManager", - "org.camunda.bpm.engine.impl.core.delegate.CoreActivityBehavior", - "net.sf.saxon.om.NodeInfo", - "net.sf.saxon.event.NamespaceReducer", - "org.openecomp.mso.logger.MessageEnum", - "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", - "org.camunda.bpm.engine.impl.db.HasDbReferences", - "org.camunda.bpm.engine.impl.tree.Collector", - "net.sf.saxon.expr.StringLiteral", - "org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration", - "net.sf.saxon.expr.ItemMappingFunction", - "net.sf.saxon.expr.instruct.UseAttributeSets", - "com.att.eelf.i18n.EELFResourceManager$1", - "org.camunda.bpm.engine.impl.core.instance.CoreExecution", - "net.sf.saxon.tree.iter.GroundedIterator", - "org.camunda.bpm.engine.variable.type.PrimitiveValueType" - ); - } - - private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(XQueryScriptTaskESTestscaffolding.class.getClassLoader()); - - org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "com.att.eelf.i18n.EELFResourceManager", - "org.openecomp.mso.logger.MessageEnum", - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.openecomp.mso.logger.MsoLogger", - "com.att.eelf.i18n.EELFMsgs", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "com.att.eelf.configuration.EELFLogger$Level", - "com.att.eelf.configuration.EELFManager", - "org.openecomp.mso.bpmn.core.XQueryScriptTask", - "org.openecomp.mso.logger.MsoLogger$ErrorCode", - "org.camunda.bpm.engine.impl.javax.el.Expression", - "org.camunda.bpm.engine.impl.javax.el.ValueExpression", - "org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope", - "org.camunda.bpm.engine.impl.core.instance.CoreExecution", - "org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity", - "org.camunda.bpm.engine.impl.pvm.runtime.ActivityInstanceState", - "org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntityVariableStore", - "org.camunda.bpm.engine.impl.persistence.entity.SuspensionState", - "org.camunda.bpm.engine.impl.context.Context", - "org.camunda.bpm.engine.ProcessEngineException", - "org.openecomp.mso.bpmn.core.BadInjectedFieldException", - "org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl", - "org.openecomp.mso.bpmn.core.MissingInjectedFieldException", - "net.sf.saxon.java.JavaPlatform", - "net.sf.saxon.Configuration", - "net.sf.saxon.tree.linked.NodeImpl", - "net.sf.saxon.style.StyleElement", - "net.sf.saxon.style.LiteralResultElement", - "net.sf.saxon.style.AbsentExtensionElement", - "org.camunda.bpm.engine.impl.core.variable.VariableMapImpl", - "net.sf.saxon.tree.iter.EmptyIterator", - "net.sf.saxon.tree.iter.EmptyAxisIterator", - "net.sf.saxon.style.XSLAnalyzeString", - "net.sf.saxon.tree.util.Navigator", - "net.sf.saxon.om.NamespaceBinding", - "net.sf.saxon.type.AnySimpleType", - "net.sf.saxon.pattern.NodeTest", - "net.sf.saxon.pattern.AnyNodeTest", - "net.sf.saxon.type.AnyItemType", - "net.sf.saxon.type.Type", - "net.sf.saxon.z.IntHashMap", - "net.sf.saxon.type.AnyType", - "net.sf.saxon.type.Untyped", - "net.sf.saxon.type.ErrorType", - "net.sf.saxon.type.BuiltInType", - "net.sf.saxon.type.BuiltInAtomicType", - "net.sf.saxon.value.BooleanValue" - ); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTest.java deleted file mode 100644 index fec405ef96..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTest.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Mon Nov 14 11:28:11 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core.json; - -import org.junit.Test; -import static org.junit.Assert.*; - -import java.util.Iterator; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.json.JSONObject; -import org.junit.runner.RunWith; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class JsonUtilsESTest extends JsonUtilsESTestscaffolding { - - @Test(timeout = 4000) - public void test00() throws Throwable { - String string0 = JsonUtils.updJsonValue((String) null, "#", "#"); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test01() throws Throwable { - String string0 = JsonUtils.getJsonValueForKey((JSONObject) null, "LPZc4`q5w]IQMS.^'3"); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test02() throws Throwable { - String string0 = JsonUtils.getJsonParamValue("", ":bnv,&jl3bK", ""); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test03() throws Throwable { - String string0 = JsonUtils.getJsonParamValue("", "", "tuw[9j$Sz"); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test04() throws Throwable { - String string0 = JsonUtils.getJsonValue((String) null, ""); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test05() throws Throwable { - String string0 = JsonUtils.addJsonValue((String) null, (String) null, (String) null); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test06() throws Throwable { - String string0 = JsonUtils.xml2json("", (Boolean) null); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test07() throws Throwable { - String string0 = JsonUtils.xml2json((String) null); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test08() throws Throwable { - String string0 = JsonUtils.updJsonValue("tV a^wGCAwX", "tV a^wGCAwX", "tV a^wGCAwX"); - assertEquals("tV a^wGCAwX", string0); - } - - @Test(timeout = 4000) - public void test09() throws Throwable { - String string0 = JsonUtils.updJsonValue("", "", ""); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test10() throws Throwable { - Boolean boolean0 = Boolean.TRUE; - String string0 = JsonUtils.json2xml("", boolean0); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test11() throws Throwable { - String string0 = JsonUtils.getJsonValueForKey("java.io.StringWriter@0000000003", "#"); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test12() throws Throwable { - Iterator iterator0 = JsonUtils.getJsonIterator((String) null); - assertNull(iterator0); - } - - @Test(timeout = 4000) - public void test13() throws Throwable { - String string0 = JsonUtils.delJsonValue("java.io.StringWriter@0000000003", "java.io.StringWriter@0000000003"); - assertNotNull(string0); - } - - @Test(timeout = 4000) - public void test14() throws Throwable { - String string0 = JsonUtils.delJsonValue("", (String) null); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test15() throws Throwable { - Boolean boolean0 = new Boolean(true); - String string0 = JsonUtils.xml2json("Y~N~%]", boolean0); - assertNotNull(string0); - } - - @Test(timeout = 4000) - public void test16() throws Throwable { - String string0 = JsonUtils.delJsonValue((String) null, "/Y"); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test17() throws Throwable { - String string0 = JsonUtils.updJsonValue((String) null, (String) null, "/Y"); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test18() throws Throwable { - String string0 = JsonUtils.addJsonValue("java.io.StringWriter@0000000006", "/Y", (String) null); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test19() throws Throwable { - Boolean boolean0 = JsonUtils.jsonValueExists("getJsonValueForKey(): found value=", "/Y"); - String string0 = JsonUtils.xml2json("getJsonValueForKey(): found value=", boolean0); - assertNotNull(string0); - } - - @Test(timeout = 4000) - public void test20() throws Throwable { - String string0 = JsonUtils.json2xml(")?Fx+Bu:)1&$EZEmzoV"); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test21() throws Throwable { - String string0 = JsonUtils.xml2json("java.io.StringWriter@0000000006"); - assertNotNull(string0); - } - - @Test(timeout = 4000) - public void test22() throws Throwable { - Iterator iterator0 = JsonUtils.getJsonIterator("{+%2:*}4"); - assertNotNull(iterator0); - } - - @Test(timeout = 4000) - public void test23() throws Throwable { - JsonUtils jsonUtils0 = new JsonUtils(); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTestscaffolding.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTestscaffolding.java deleted file mode 100644 index 6d05db0b80..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/json/JsonUtilsESTestscaffolding.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Scaffolding file used to store all the setups needed to run - * tests automatically generated by EvoSuite - * Mon Nov 14 11:28:11 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core.json; - -import org.evosuite.runtime.annotation.EvoSuiteClassExclude; -import org.junit.BeforeClass; -import org.junit.Before; -import org.junit.After; -import org.junit.AfterClass; -import org.evosuite.runtime.sandbox.Sandbox; - -@EvoSuiteClassExclude -public class JsonUtilsESTestscaffolding { - - @org.junit.Rule - public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); - - private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.bpmn.core.json.JsonUtils"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); - initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } - - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } - - @Before - public void initTestCase(){ - threadStopper.storeCurrentThreads(); - threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } - - @After - public void doneWithTestCase(){ - threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } - - - private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(JsonUtilsESTestscaffolding.class.getClassLoader() , - "org.json.JSONObject$Null", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "org.openecomp.mso.logger.MsoLogger$ErrorCode", - "com.att.eelf.configuration.EELFLogger", - "org.json.JSONException", - "org.openecomp.mso.bpmn.core.xml.XmlTool", - "org.json.JSONObject", - "org.json.XML", - "com.att.eelf.configuration.SLF4jWrapper", - "com.att.eelf.i18n.EELFResourceManager", - "org.openecomp.mso.logger.MsoLogger", - "org.openecomp.mso.logger.MessageEnum", - "com.att.eelf.i18n.EELFResolvableErrorEnum", - "org.openecomp.mso.logger.MsoLogger$ResponseCode", - "org.openecomp.mso.entity.MsoRequest", - "org.openecomp.mso.logger.MsoLogger$StatusCode", - "org.json.JSONTokener", - "org.openecomp.mso.bpmn.core.json.JsonUtils", - "com.att.eelf.configuration.EELFManager", - "com.att.eelf.i18n.EELFMsgs", - "com.att.eelf.configuration.EELFLogger$Level", - "org.openecomp.mso.logger.MsoLogger$Catalog", - "com.att.eelf.i18n.EELFResourceManager$1", - "org.json.JSONArray", - "org.json.XMLTokener" - ); - } - - private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(JsonUtilsESTestscaffolding.class.getClassLoader()); - - org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "org.openecomp.mso.bpmn.core.xml.XmlTool", - "org.openecomp.mso.logger.MsoLogger$Catalog", - "org.json.JSONObject", - "org.json.XML", - "org.openecomp.mso.logger.MsoLogger", - "com.att.eelf.i18n.EELFResourceManager", - "com.att.eelf.i18n.EELFMsgs", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "com.att.eelf.configuration.EELFLogger$Level", - "com.att.eelf.configuration.EELFManager", - "org.openecomp.mso.logger.MessageEnum", - "org.openecomp.mso.bpmn.core.json.JsonUtils", - "org.json.JSONException", - "org.json.XMLTokener" - ); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTest.java deleted file mode 100644 index 9c17caeaf4..0000000000 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/mybatis/URNMappingESTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Mon Nov 14 11:33:04 GMT 2016 - */ - -package org.openecomp.mso.bpmn.core.mybatis; - -import org.junit.Test; -import static org.junit.Assert.*; -import static org.evosuite.runtime.EvoAssertions.*; - -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.junit.runner.RunWith; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class URNMappingESTest extends URNMappingESTestscaffolding { - - @Test(timeout = 4000) - public void test00() throws Throwable { - String string0 = URNMapping.createIdentifierFromURN("!`OYz|WztoeK|A&=&M"); - assertEquals("URN_OYz_WztoeK_A_M", string0); - } - - @Test(timeout = 4000) - public void test01() throws Throwable { - URNMapping uRNMapping0 = new URNMapping(); - uRNMapping0.setValue("=F'A%"); - String string0 = uRNMapping0.getValue(); - assertEquals("=F'A%", string0); - } - - @Test(timeout = 4000) - public void test02() throws Throwable { - URNMapping uRNMapping0 = new URNMapping(); - uRNMapping0.setValue(""); - String string0 = uRNMapping0.getValue(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test03() throws Throwable { - URNMapping uRNMapping0 = new URNMapping(); - uRNMapping0.setRev(""); - String string0 = uRNMapping0.getRev(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test04() throws Throwable { - URNMapping uRNMapping0 = new URNMapping(); - uRNMapping0.setName(""); - String string0 = uRNMapping0.getName(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test05() throws Throwable { - // Undeclared exception! - try { - URNMapping.createIdentifierFromURN((String) null); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.bpmn.core.mybatis.URNMapping", e); - } - } - - @Test(timeout = 4000) - public void test06() throws Throwable { - String string0 = URNMapping.createIdentifierFromURN("mfJ\"%euO;@S_Xm"); - assertEquals("URN_mfJ_euO_S_Xm", string0); - } - - @Test(timeout = 4000) - public void test07() throws Throwable { - URNMapping uRNMapping0 = new URNMapping(); - uRNMapping0.setRev(":pMWjfl,zq_IA"); - String string0 = uRNMapping0.getRev(); - assertEquals(":pMWjfl,zq_IA", string0); - } - - @Test(timeout = 4000) - public void test08() throws Throwable { - URNMapping uRNMapping0 = new URNMapping(); - String string0 = uRNMapping0.getName(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test09() throws Throwable { - URNMapping uRNMapping0 = new URNMapping(); - String string0 = uRNMapping0.getRev(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test10() throws Throwable { - URNMapping uRNMapping0 = new URNMapping(); - String string0 = uRNMapping0.getValue(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test11() throws Throwable { - URNMapping uRNMapping0 = new URNMapping(); - uRNMapping0.setName("c<"); - String string0 = uRNMapping0.getName(); - assertEquals("c<", string0); - } -} diff --git a/bpmn/MSOCoreBPMN/src/test/resources/BaseTaskTest.bpmn b/bpmn/MSOCoreBPMN/src/test/resources/BaseTaskTest.bpmn index d94a0c5b21..bb15ce2e5e 100644 --- a/bpmn/MSOCoreBPMN/src/test/resources/BaseTaskTest.bpmn +++ b/bpmn/MSOCoreBPMN/src/test/resources/BaseTaskTest.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1 diff --git a/bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml b/bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml index 4858ea0c0e..3fa222988c 100644 --- a/bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml +++ b/bpmn/MSOCoreBPMN/src/test/resources/camunda.cfg.xml @@ -1,28 +1,8 @@ - - - + - + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> diff --git a/bpmn/MSOCoreBPMN/src/test/resources/request.json b/bpmn/MSOCoreBPMN/src/test/resources/request.json index bdca336a0b..8fa195b839 100644 --- a/bpmn/MSOCoreBPMN/src/test/resources/request.json +++ b/bpmn/MSOCoreBPMN/src/test/resources/request.json @@ -1,26 +1,26 @@ { "variables": { "bpmnRequest": { - "value": "\n \n d00eb185-b1d7-429e-aca3-42a61b459535\n Layer3ServiceActivateRequest\n OMX\n http://localhost:8080/simulada/CSI/SendManagedNetworkStatusNotification\n 19630501\n 1\n \n \n SDN-ETHERNET-INTERNET\n AA01|VLXM|003717||SW_INTERNET\n TEST_4306301\n \n \n \n \n 10\n Mbps\n ds\n \n \n none\n \n primary\n \n \n 1\n 32.10.30.116\n 32\n \n \n \n \n 1\n 2507:0CB4:85A5:0030:0000:0000:0000:0010\n 48\n \n \n \n Y\n Y\n Y\n Y\n \n \n Y\n N\n \n \n Y\n Y\n \n \n \n \n \n\n", + "value": "\n \n d00eb185-b1d7-429e-aca3-42a61b459535\n Layer3ServiceActivateRequest\n OMX\n http://localhost:28080/simulada/CSI/SendManagedNetworkStatusNotification\n 19630501\n 1\n \n \n SDN-ETHERNET-INTERNET\n AA01|VLXM|003717||SW_INTERNET\n TEST_4306301\n \n \n \n 01|VLXM|121601/PT\n PointToPoint\n MTSNJA4LX01\n \n \n \n 10\n Mbps\n ds\n \n \n none\n \n primary\n \n \n 1\n 32.10.30.116\n 32\n \n \n \n \n 1\n 2507:0CB4:85A5:0030:0000:0000:0000:0010\n 48\n \n \n \n Y\n Y\n Y\n Y\n \n \n Y\n N\n \n \n Y\n Y\n \n \n \n \n \n\n", "type": "String" }, "host": { "value": "localhost", "type": "String" }, - "att-mso-schema-version": { + "mso-schema-version": { "value": "v1", "type": "String" }, - "att-mso-request-id": { + "mso-request-id": { "value": "d00eb185-b1d7-429e-aca3-42a61b459535", "type": "String" }, - "att-mso-service-instance-id": { + "mso-service-instance-id": { "value": "AA01|VLXM|003717||SW_INTERNET", "type": "String" }, - "att-mso-service-request-timeout": { + "mso-service-request-timeout": { "value": "180", "type": "String" } diff --git a/bpmn/MSOCoreBPMN/src/test/resources/requestArray.json b/bpmn/MSOCoreBPMN/src/test/resources/requestArray.json new file mode 100644 index 0000000000..238128865b --- /dev/null +++ b/bpmn/MSOCoreBPMN/src/test/resources/requestArray.json @@ -0,0 +1,54 @@ +{ + "requestDetails": { + "requestInfo": { + "callbackUrl": "http://localhost:28080/simulada/CCD/AsyncRequestStatus", + "source": "CCD", + "instanceName": "USOSTCDALTX0101VFHN31" + }, + "modelInfo": { + "modelType": "service", + "modelId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", + "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", + "modelName": "UCPE", + "modelVersion": 1 + }, + "subscriberInfo": { + "globalSubscriberId": "83031", + "subscriberName": "Fern Hill Real Estate LLC 31" + }, + "requestParameters": { + "ucpeInfo": { + "ucpeHostName": "USOSTCDALTX0101UJZZ31", + "ucpeAliasHostName": "SHELLUCPE31", + "ucpeActivationCode": "ASD-987-M31", + "ucpePartNumber": "FG-VM00*", + "outOfBandManagementModem": "BROADBAND", + "internetTopology": "IVLAN", + "wanList": [ + { "wanInfo": { + "wanPortNumber": "WAN1", + "wanType": "AVPN", + "circuitId": "BT/SLIR/70911", + "dualMode": "Active", + "transportManagementOption": "ATT", + "transportProviderName": "ATT", + "mediaType": "ELECTRICAL", + "interfaceType": "1000BASE-T", + "transportVendorTotalBandwidth": "100" + }}, + { "wanInfo": { + "wanPortNumber": "WAN2", + "wanType": "AVPN", + "circuitId": "AS/KRFN/34611", + "dualMode": "Active", + "transportManagementOption": "ATT", + "transportProviderName": "ATT", + "mediaType": "MMF", + "interfaceType": "10/100/1000BASE-T", + "transportVendorTotalBandwidth": "10000" + }} + ] + } + } + } +} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateNetworkInstanceInfra.groovy b/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateNetworkInstanceInfra.groovy deleted file mode 100644 index bfd86480ad..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateNetworkInstanceInfra.groovy +++ /dev/null @@ -1,1780 +0,0 @@ -/*- - * ============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 com.att.bpm.scripts; - -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils - -/** - * This groovy class supports the CreateNetworkInstanceInfra.bpmn process. - * - */ -public class CreateNetworkInstanceInfra extends AbstractServiceTaskProcessor { - String Prefix="CRENWKI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - NetworkUtils networkUtils = new NetworkUtils() - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - - /** - * This method is executed during the preProcessRequest task of the CreateNetworkInstanceInfra.bpmn process. - * @param execution - */ - public InitializeProcessVariables(Execution execution){ - /* Initialize all the process variables in this block */ - - execution.setVariable("CRENWKI_messageId", "") - execution.setVariable("BasicAuthHeaderValuePO", "") - execution.setVariable("BasicAuthHeaderValueSDNC", "") - execution.setVariable("CRENWKI_CreateNetworkInstanceInfraJsonRequest", "") - execution.setVariable("CRENWKI_networkRequest", "") - execution.setVariable("CRENWKI_networkInputs", "") - execution.setVariable("CRENWKI_networkOutputs", "") - execution.setVariable("CRENWKI_requestId", "") - execution.setVariable("CRENWKI_source", "") - - execution.setVariable("CRENWKI_CompleteMsoProcessRequest", "") - execution.setVariable("CRENWKI_FalloutHandlerRequest", "") - execution.setVariable("CRENWKI_isSilentSuccess", false) - execution.setVariable("CRENWKI_isPONR", false) // Point-of-no-return, means, rollback is not needed - - // query Service Instance - execution.setVariable("CRENWKI_serviceInstanceId","") - - // AAI query Name - execution.setVariable("CRENWKI_queryNameAAIRequest","") - execution.setVariable("CRENWKI_queryNameAAIResponse", "") - execution.setVariable("CRENWKI_aaiNameReturnCode", "") - execution.setVariable("CRENWKI_isAAIqueryNameGood", false) - - // AAI query Cloud Region - execution.setVariable("CRENWKI_queryCloudRegionRequest","") - execution.setVariable("CRENWKI_queryCloudRegionReturnCode","") - execution.setVariable("CRENWKI_queryCloudRegionResponse","") - execution.setVariable("CRENWKI_cloudRegionPo","") - execution.setVariable("CRENWKI_cloudRegionSdnc","") - execution.setVariable("CRENWKI_isCloudRegionGood", false) - - // AAI query Id - execution.setVariable("CRENWKI_queryIdAAIRequest","") - execution.setVariable("CRENWKI_queryIdAAIResponse", "") - execution.setVariable("CRENWKI_aaiIdReturnCode", "") - - // AAI query vpn binding - execution.setVariable("CRENWKI_queryVpnBindingAAIRequest","") - execution.setVariable("CRENWKI_queryVpnBindingAAIResponse", "") - execution.setVariable("CRENWKI_aaiQqueryVpnBindingReturnCode", "") - execution.setVariable("CRENWKI_vpnBindings", null) - execution.setVariable("CRENWKI_vpnCount", 0) - execution.setVariable("CRENWKI_routeCollection", "") - - // AAI query network policy - execution.setVariable("CRENWKI_queryNetworkPolicyAAIRequest","") - execution.setVariable("CRENWKI_queryNetworkPolicyAAIResponse", "") - execution.setVariable("CRENWKI_aaiQqueryNetworkPolicyReturnCode", "") - execution.setVariable("CRENWKI_networkPolicyUriList", null) - execution.setVariable("CRENWKI_networkPolicyCount", 0) - execution.setVariable("CRENWKI_networkCollection", "") - - // AAI query route table reference - execution.setVariable("CRENWKI_queryNetworkTableRefAAIRequest","") - execution.setVariable("CRENWKI_queryNetworkTableRefAAIResponse", "") - execution.setVariable("CRENWKI_aaiQqueryNetworkTableRefReturnCode", "") - execution.setVariable("CRENWKI_networkTableRefUriList", null) - execution.setVariable("CRENWKI_networkTableRefCount", 0) - execution.setVariable("CRENWKI_tableRefCollection", "") - - // AAI requery Id - execution.setVariable("CRENWKI_requeryIdAAIRequest","") - execution.setVariable("CRENWKI_requeryIdAAIResponse", "") - execution.setVariable("CRENWKI_aaiRequeryIdReturnCode", "") - - // AAI update contrail - execution.setVariable("CRENWKI_updateContrailAAIUrlRequest","") - execution.setVariable("CRENWKI_updateContrailAAIPayloadRequest","") - execution.setVariable("CRENWKI_updateContrailAAIResponse", "") - execution.setVariable("CRENWKI_aaiUpdateContrailReturnCode", "") - - execution.setVariable("CRENWKI_createNetworkRequest", "") - execution.setVariable("CRENWKI_createNetworkResponse", "") - execution.setVariable("CRENWKI_rollbackNetworkRequest", "") - execution.setVariable("CRENWKI_rollbackNetworkResponse", "") - execution.setVariable("CRENWKI_networkReturnCode", "") - execution.setVariable("CRENWKI_rollbackNetworkReturnCode", "") - execution.setVariable("CRENWKI_isNetworkRollbackNeeded", false) - - execution.setVariable("CRENWKI_assignSDNCRequest", "") - execution.setVariable("CRENWKI_assignSDNCResponse", "") - execution.setVariable("CRENWKI_rollbackSDNCRequest", "") - execution.setVariable("CRENWKI_rollbackSDNCResponse", "") - execution.setVariable("CRENWKI_sdncReturnCode", "") - execution.setVariable("CRENWKI_rollbackSDNCReturnCode", "") - execution.setVariable("CRENWKI_isSdncRollbackNeeded", false) - execution.setVariable("CRENWKI_sdncResponseSuccess", false) - - execution.setVariable("CRENWKI_createDBRequest", "") - execution.setVariable("CRENWKI_createDBResponse", "") - execution.setVariable("CRENWKI_dbReturnCode", "") - - execution.setVariable("CRENWKI_orchestrationStatus", "") - execution.setVariable("CRENWKI_isVnfBindingPresent", false) - execution.setVariable("CRENWKI_Success", false) - execution.setVariable("GENGS_type", "service-instance") // Setting for Generic Sub Flow use - - - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - /** - * This method is executed during the preProcessRequest task of the CreateNetworkInstanceInfra.bpmn process. - * @param execution - */ - public void preProcessRequest (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest CreateNetworkInstanceInfra Request ***** ", isDebugEnabled) - - // initialize flow variables - InitializeProcessVariables(execution) - - // get Incoming request & validate json format - String createNetworkJsonIncoming = execution.getVariable("bpmnRequest") - utils.logAudit(createNetworkJsonIncoming) - try { - def prettyJson = JsonOutput.prettyPrint(createNetworkJsonIncoming.toString()) - utils.log("DEBUG", " Incoming message formatted . . . : " + '\n' + prettyJson, isDebugEnabled) - - } catch (Exception ex) { - String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - // PO Authorization Info / headers Authorization= - String basicAuthValuePO = execution.getVariable("URN_mso_adapters_po_auth") - utils.log("DEBUG", " Obtained BasicAuth userid password for PO/SDNC adapter: " + basicAuthValuePO, isDebugEnabled) - try { - def encodedString = utils.getBasicAuth(basicAuthValuePO, execution.getVariable("URN_mso_msoKey")) - execution.setVariable("BasicAuthHeaderValuePO",encodedString) - execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) - - } catch (IOException ex) { - String dataErrorMessage = " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - try { - - execution.setVariable("CRENWKI_CreateNetworkInstanceInfraJsonRequest", createNetworkJsonIncoming) - - // input should be empty, use generated 'network-id' from SDNC/AAI - execution.setVariable("networkId", "") - - // recreate the xml network-request - String networkRequest = vidUtils.createXmlNetworkRequestInfra(execution, createNetworkJsonIncoming) - execution.setVariable("CRENWKI_networkRequest", networkRequest) - utils.log("DEBUG", " network-request - " + '\n' + networkRequest, isDebugEnabled) - - String networkInputs = utils.getNodeXml(networkRequest, "network-inputs", false).replace("tag0:","").replace(":tag0","") - execution.setVariable("CRENWKI_networkInputs", networkInputs) - utils.log("DEBUG", " networkInputs - " + '\n' + networkInputs, isDebugEnabled) - - String netId = utils.getNodeText1(networkRequest, "network-id") - String netName = utils.getNodeText1(networkRequest, "network-name") - String networkOutputs = - """ - ${netId} - ${netName} - """ - execution.setVariable("CRENWKI_networkOutputs", networkOutputs) - utils.log("DEBUG", " networkOutputs - " + '\n' + networkOutputs, isDebugEnabled) - - String requestId = execution.getVariable("att-mso-request-id") - if (requestId == null || requestId == "") { - requestId = execution.getVariable("requestId") - } - execution.setVariable("CRENWKI_requestId", requestId) - execution.setVariable("CRENWKI_source", utils.getNodeText1(networkRequest, "source")) - - // prepare messageId - String messageId = execution.getVariable("CRENWKI_messageId") // for testing - if (messageId == null || messageId == "") { - messageId = UUID.randomUUID() - utils.log("DEBUG", " CRENWKI_messageId, random generated: " + messageId, isDebugEnabled) - } else { - utils.log("DEBUG", " CRENWKI_messageId, pre-assigned: " + messageId, isDebugEnabled) - } - execution.setVariable("CRENWKI_messageId", messageId) - - // validate 'backout-on-failure' to override 'URN_mso_rollback' - boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, networkRequest) - execution.setVariable("CRENWKI_rollbackEnabled", rollbackEnabled) - - String instanceName = "" - if (utils.nodeExists(networkRequest, "network-name")) { - instanceName = utils.getNodeText1(networkRequest, "network-name") - if (instanceName == 'null' || instanceName == "") { - sendSyncError(execution) - // missing value of network-name - String dataErrorMessage = "requestDetails has missing 'network-name' value/element." - utils.log("DEBUG", " Invalid Request - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - - String lcpCloudRegion = "" - if (utils.nodeExists(networkRequest, "aic-cloud-region")) { - lcpCloudRegion = utils.getNodeText1(networkRequest, "aic-cloud-region") - if ((lcpCloudRegion == 'null') || (lcpCloudRegion == "")) { - sendSyncError(execution) - String dataErrorMessage = "requestDetails has missing 'aic-cloud-region' value/element." - utils.log("DEBUG", " Invalid Request - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - } - - String serviceInstanceId = "" - if (utils.nodeExists(networkRequest, "service-instance-id")) { - serviceInstanceId = utils.getNodeText1(networkRequest, "service-instance-id") - if ((serviceInstanceId == 'null') || (lcpCloudRegion == "")) { - sendSyncError(execution) - String dataErrorMessage = "Variable 'serviceInstanceId' value/element is missing." - utils.log("DEBUG", " Invalid Request - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - } - - execution.setVariable("CRENWKI_serviceInstanceId", serviceInstanceId) - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex){ - sendSyncError(execution) - // caught exception - String exceptionMessage = "Exception Encountered in CreateNetworkInstanceInfra, PreProcessRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - } - - public void sendSyncResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateNetworkInstanceInfra ***** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("att-mso-request-id") - - // RESTResponse (for API Handler (APIH) Reply Task) - String createNetworkRestRequest = """{"requestReferences":{"instanceId":"","requestId":"${requestId}"}}""".trim() - - utils.log("DEBUG", " sendSyncResponse to APIH - " + "\n" + createNetworkRestRequest, isDebugEnabled) - sendWorkflowResponse(execution, 202, createNetworkRestRequest) - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in CreateNetworkInstanceInfra flow. sendSyncResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - } - - - public void callRESTQueryAAINetworkName (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkName of CreateNetworkInstanceInfra ***** " , isDebugEnabled) - - // get variables - String networkInputs = execution.getVariable("CRENWKI_networkInputs") - String networkName = utils.getNodeText1(networkInputs, "network-name") - networkName = UriUtils.encode(networkName,"UTF-8") - String messageId = execution.getVariable("CRENWKI_messageId") - - // Prepare AA&I url with network-name - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String queryAAINameRequest = "${aai_endpoint}${aai_uri}" + "?network-name=" + networkName - utils.logAudit(queryAAINameRequest) - execution.setVariable("CRENWKI_queryNameAAIRequest", queryAAINameRequest) - utils.log("DEBUG", " CRENWKI_queryNameAAIRequest - " + "\n" + queryAAINameRequest, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - RESTConfig config = new RESTConfig(queryAAINameRequest); - - try { - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.get() - String returnCode = response.getStatusCode() - execution.setVariable("CRENWKI_aaiNameReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI Query Name Response Code : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - utils.log("DEBUG", " ***** AAI Query Name Response : " +'\n'+ aaiResponseAsString, isDebugEnabled) - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable("CRENWKI_queryNameAAIResponse", aaiResponseAsString) - execution.setVariable("CRENWKI_isAAIqueryNameGood", true) - String orchestrationStatus = "" - try { - // response is NOT empty - orchestrationStatus = utils.getNodeText1(aaiResponseAsString, "orchestration-status") - execution.setVariable("CRENWKI_orchestrationStatus", orchestrationStatus.toUpperCase()) - utils.log("DEBUG", " CRENWKI_orchestrationStatus - " + orchestrationStatus.toUpperCase(), isDebugEnabled) - } catch (Exception ex) { - // response is empty - execution.setVariable("CRENWKI_orchestrationStatus", orchestrationStatus) - utils.log("DEBUG", " CRENWKI_orchestrationStatus - " + orchestrationStatus, isDebugEnabled) - } - - } else { - if (returnCode=='404') { - utils.log("DEBUG", " QueryAAINetworkName return code = '404' (Not Found). Proceed with the Create !!! ", isDebugEnabled) - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Error Response from QueryAAINetworkName - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 2500, dataErrorMessage) - - } - - } - - utils.log("DEBUG", " AAI call, CRENWKI_isAAIqueryNameGood? : " + execution.getVariable("CRENWKI_isAAIqueryNameGood"), isDebugEnabled) - - - } catch (Exception ex) { - // try error - String exceptionMessage = "Bpmn error encountered in CreateNetworkInstanceInfra flow - callRESTQueryAAINetworkName() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAICloudRegion (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAICloudRegion of CreateNetworkInstanceInfra ***** " , isDebugEnabled) - - try { - String networkInputs = execution.getVariable("CRENWKI_networkInputs") - String cloudRegion = utils.getNodeText1(networkInputs, "aic-cloud-region") - cloudRegion = UriUtils.encode(cloudRegion,"UTF-8") - - // Prepare AA&I url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUtil = new AaiUtil(this) - String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) - String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion - utils.logAudit(queryCloudRegionRequest) - execution.setVariable("CRENWKI_queryCloudRegionRequest", queryCloudRegionRequest) - utils.log("DEBUG", " CRENWKI_queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest, isDebugEnabled) - - String cloudRegionPo = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) - String cloudRegionSdnc = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "SDNC", cloudRegion) - - if ((cloudRegionPo != "ERROR") && (cloudRegionSdnc != "ERROR")) { - execution.setVariable("CRENWKI_cloudRegionPo", cloudRegionPo) - execution.setVariable("CRENWKI_cloudRegionSdnc", cloudRegionSdnc) - execution.setVariable("CRENWKI_isCloudRegionGood", true) - - } else { - String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable("CRENWKI_queryCloudRegionReturnCode") - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - - utils.log("DEBUG", " is Cloud Region Good: " + execution.getVariable("CRENWKI_isCloudRegionGood"), isDebugEnabled) - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - // try error - String exceptionMessage = "Bpmn error encountered in CreateNetworkInstanceInfra flow - callRESTQueryAAICloudRegion() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAINetworkId(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkId of CreateNetworkInstanceInfra ***** " , isDebugEnabled) - - try { - // get variables - String assignSDNCResponse = execution.getVariable("CRENWKI_assignSDNCResponse") - String networkId = utils.getNodeText1(assignSDNCResponse, "network-id") - networkId = UriUtils.encode(networkId,"UTF-8") - String messageId = execution.getVariable("CRENWKI_messageId") - - // Prepare AA&I url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId - utils.logAudit(queryIdAAIRequest) - execution.setVariable("CRENWKI_queryIdAAIRequest", queryIdAAIRequest) - utils.log("DEBUG", " CRENWKI_queryIdAAIRequest - " + "\n" + queryIdAAIRequest, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(queryIdAAIRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.get() - String returnCode = response.getStatusCode() - execution.setVariable("CRENWKI_aaiIdReturnCode", returnCode) - - utils.log("DEBUG", " ***** AAI Response Code : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable("CRENWKI_queryIdAAIResponse", aaiResponseAsString) - utils.log("DEBUG", " QueryAAINetworkId Success REST Response - " + "\n" + aaiResponseAsString, isDebugEnabled) - - } else { - if (returnCode=='404') { - String dataErrorMessage = "Response Error from QueryAAINetworkId is 404 (Not Found)." - utils.log("DEBUG", " AAI Query Failed. " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from QueryAAINetworkId - " + returnCode - utils.log("DEBUG", "Unexpected Response from QueryAAINetworkId - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in CreateNetworkInstanceInfra flow. callRESTQueryAAINetworkId() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTReQueryAAINetworkId(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTReQueryAAINetworkId of CreateNetworkInstanceInfra ***** " , isDebugEnabled) - - try { - // get variables - String networkId = utils.getNodeText1(execution.getVariable("CRENWKI_assignSDNCResponse"), "network-id") - networkId = UriUtils.encode(networkId,"UTF-8") - String messageId = execution.getVariable("CRENWKI_messageId") - - // Prepare AA&I url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId - utils.logAudit(requeryIdAAIRequest) - execution.setVariable("CRENWKI_requeryIdAAIRequest", requeryIdAAIRequest) - utils.log("DEBUG", " CRENWKI_requeryIdAAIRequest - " + "\n" + requeryIdAAIRequest, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(requeryIdAAIRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.get() - String returnCode = response.getStatusCode() - execution.setVariable("CRENWKI_aaiRequeryIdReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI ReQuery Response Code : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable("CRENWKI_requeryIdAAIResponse", aaiResponseAsString) - utils.log("DEBUG", " ReQueryAAINetworkId Success REST Response - " + "\n" + aaiResponseAsString, isDebugEnabled) - - String netId = utils.getNodeText1(aaiResponseAsString, "network-id") - String netName = utils.getNodeText1(aaiResponseAsString, "network-name") - String networkOutputs = - """ - ${netId} - ${netName} - """ - execution.setVariable("CRENWKI_networkOutputs", networkOutputs) - utils.log("DEBUG", " networkOutputs - " + '\n' + networkOutputs, isDebugEnabled) - - } else { - if (returnCode=='404') { - String dataErrorMessage = "Response Error from ReQueryAAINetworkId is 404 (Not Found)." - utils.log("DEBUG", " AAI ReQuery Failed. - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from ReQueryAAINetworkId - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in CreateNetworkInstanceInfra flow. callRESTReQueryAAINetworkId() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAINetworkVpnBinding(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkVpnBinding of CreateNetworkInstanceInfra ***** " , isDebugEnabled) - - try { - - // get variables - String messageId = execution.getVariable("CRENWKI_messageId") - String queryIdAAIResponse = execution.getVariable("CRENWKI_queryIdAAIResponse").replace('', "") - String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") - utils.log("DEBUG", " relationship - " + relationship, isDebugEnabled) - - // Check if Vnf Binding is present, then build a List of vnfBinding - List vpnBindingUri = networkUtils.getVnfBindingObject(relationship) - int vpnCount = vpnBindingUri.size() - execution.setVariable("CRENWKI_vpnCount", vpnCount) - utils.log("DEBUG", " CRENWKI_vpnCount - " + vpnCount, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - - if (vpnCount > 0) { - execution.setVariable("CRENWKI_vpnBindings", vpnBindingUri) - utils.log("DEBUG", " vpnBindingUri List - " + vpnBindingUri, isDebugEnabled) - - String routeTargets = "" - // AII loop call using list vpnBindings - for (i in 0..vpnBindingUri.size()-1) { - - int counting = i+1 - - // prepare url using vpnBinding - String queryVpnBindingAAIRequest = "" - String aai_uri = aaiUriUtil.getNetworkVpnBindingUri(execution) - - // Note: By default, the vpnBinding url is found in 'related-link' of the response, - // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. - if (aai_uri == null || aai_uri == "") { - // using value of 'related-link' from response - if (vpnBindingUri[i].charAt(vpnBindingUri[i].length()-1) == '/') { - queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i].substring(0, vpnBindingUri[i].length()-1) - } else { - queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i] - } - - } else { - // using uri value in URN mapping - String vpnBindingId = vpnBindingUri[i].substring(vpnBindingUri[i].indexOf("/vpn-binding/")+13, vpnBindingUri[i].length()) - if (vpnBindingId.charAt(vpnBindingId.length()-1) == '/') { - vpnBindingId = vpnBindingId.substring(0, vpnBindingId.length()-1) - } - queryVpnBindingAAIRequest = "${aai_endpoint}${aai_uri}/" + vpnBindingId - } - - utils.logAudit(queryVpnBindingAAIRequest) - execution.setVariable("CRENWKI_queryVpnBindingAAIRequest", queryVpnBindingAAIRequest) - utils.log("DEBUG", " CRENWKI_queryVpnBindingAAIRequest, , vpnBinding #" + counting + " : " + "\n" + queryVpnBindingAAIRequest, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(queryVpnBindingAAIRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.get() - String returnCode = response.getStatusCode() - execution.setVariable("CRENWKI_aaiQqueryVpnBindingReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI query vpn binding Response Code, vpnBinding #" + counting + " : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable("CRENWKI_queryVpnBindingAAIResponse", aaiResponseAsString) - utils.log("DEBUG", " AAI Query Vpn Binding Success REST Response, , vpnBinding #" + counting + " : " + "\n" + aaiResponseAsString, isDebugEnabled) - - String routeTarget = "" - if (utils.nodeExists(aaiResponseAsString, "global-route-target")) { - routeTarget = utils.getNodeText1(aaiResponseAsString, "global-route-target") - routeTargets += "" + routeTarget + "" + '\n' - } - - } else { - if (returnCode=='404') { - String dataErrorMessage = "Response Error from AAINetworkVpnBinding is 404 (Not Found)." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = " Unexpected Response from AAINetworkVpnBinding - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } // end loop - - execution.setVariable("CRENWKI_routeCollection", routeTargets) - utils.log("DEBUG", " CRENWKI_routeCollection - " + '\n' + routeTargets, isDebugEnabled) - - } else { - // reset return code to success - execution.setVariable("CRENWKI_aaiQqueryVpnBindingReturnCode", "200") - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String schemaVersion = aaiUriUtil.getNamespaceFromUri(aai_uri) - String aaiStubResponse = - """ - - - - """ - String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) - execution.setVariable("CRENWKI_queryVpnBindingAAIResponse", aaiStubResponseAsXml) - execution.setVariable("CRENWKI_routeCollection", "") - utils.log("DEBUG", " No vpnBinding, using this stub as response - " + '\n' + aaiStubResponseAsXml, isDebugEnabled) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in CreateNetworkInstanceInfra flow. callRESTQueryAAINetworkVpnBinding() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAINetworkPolicy(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkPolicy of CreateNetworkInstanceInfra ***** " , isDebugEnabled) - - try { - // get variables - String messageId = execution.getVariable("CRENWKI_messageId") - String queryIdAAIResponse = execution.getVariable("CRENWKI_queryIdAAIResponse").replace('', "") - String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") - utils.log("DEBUG", " relationship - " + relationship, isDebugEnabled) - - // Check if Network Policy is present, then build a List of network policy - List networkPolicyUriList = networkUtils.getNetworkPolicyObject(relationship) - int networkPolicyCount = networkPolicyUriList.size() - execution.setVariable("CRENWKI_networkPolicyCount", networkPolicyCount) - utils.log("DEBUG", " CRENWKI_networkPolicyCount - " + networkPolicyCount, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - - if (networkPolicyCount > 0) { - execution.setVariable("CRENWKI_networkPolicyUriList", networkPolicyUriList) - utils.log("DEBUG", " networkPolicyUri List - " + networkPolicyUriList, isDebugEnabled) - - String networkPolicies = "" - // AII loop call using list vpnBindings - for (i in 0..networkPolicyUriList.size()-1) { - - int counting = i+1 - - // prepare url using vpnBinding - String queryNetworkPolicyAAIRequest = "" - - String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) - - // Note: By default, the network policy url is found in 'related-link' of the response, - // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. - if (aai_uri == null || aai_uri == "") { - // using value of 'related-link' from response - if (networkPolicyUriList[i].charAt(networkPolicyUriList[i].length()-1) == '/') { - queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i].substring(0, networkPolicyUriList[i].length()-1) - } else { - queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i] - } - } else { - // using uri value in URN mapping - String networkPolicyId = networkPolicyUriList[i].substring(networkPolicyUriList[i].indexOf("/network-policy/")+16, networkPolicyUriList[i].length()) - println " networkPolicyId - " + networkPolicyId - if (networkPolicyId.charAt(networkPolicyId.length()-1) == '/') { - networkPolicyId = networkPolicyId.substring(0, networkPolicyId.length()-1) - } - queryNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + networkPolicyId - - } - - - utils.logAudit(queryNetworkPolicyAAIRequest) - execution.setVariable("CRENWKI_queryNetworkPolicyAAIRequest", queryNetworkPolicyAAIRequest) - utils.log("DEBUG", " CRENWKI_queryNetworkPolicyAAIRequest, , NetworkPolicy #" + counting + " : " + "\n" + queryNetworkPolicyAAIRequest, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(queryNetworkPolicyAAIRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.get() - String returnCode = response.getStatusCode() - execution.setVariable("CRENWKI_aaiQqueryNetworkPolicyReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable("CRENWKI_queryNetworkPolicyAAIResponse", aaiResponseAsString) - utils.log("DEBUG", " QueryAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString, isDebugEnabled) - - String networkPolicy = "" - if (utils.nodeExists(aaiResponseAsString, "network-policy-fqdn")) { - networkPolicy = utils.getNodeText1(aaiResponseAsString, "network-policy-fqdn") - networkPolicies += "" + networkPolicy + "" + '\n' - } - - } else { - if (returnCode=='404') { - String dataErrorMessage = "Response Error from QueryAAINetworkPolicy is 404 (Not Found)." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from QueryAAINetworkPolicy - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } // end loop - - execution.setVariable("CRENWKI_networkCollection", networkPolicies) - utils.log("DEBUG", " CRENWKI_networkCollection - " + '\n' + networkPolicies, isDebugEnabled) - - } else { - // reset return code to success - execution.setVariable("CRENWKI_aaiQqueryNetworkPolicyReturnCode", "200") - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String schemaVersion = aaiUriUtil.getNamespaceFromUri(aai_uri) - String aaiStubResponse = - """ - - - - """ - String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) - execution.setVariable("CRENWKI_queryNetworkPolicyAAIResponse", aaiStubResponseAsXml) - execution.setVariable("CRENWKI_networkCollection", "") - utils.log("DEBUG", " No net policies, using this stub as response - " + '\n' + aaiStubResponseAsXml, isDebugEnabled) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in CreateNetworkInstanceInfra flow. callRESTQueryAAINetworkPolicy() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAINetworkTableRef(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkTableRef of CreateNetworkInstanceInfra ***** " , isDebugEnabled) - - try { - // get variables - String messageId = execution.getVariable("CRENWKI_messageId") - String queryIdAAIResponse = execution.getVariable("CRENWKI_queryIdAAIResponse").replace('', "") - String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") - utils.log("DEBUG", " relationship - " + relationship, isDebugEnabled) - - // Check if Network TableREf is present, then build a List of network policy - List networkTableRefUriList = networkUtils.getNetworkTableRefObject(relationship) - int networkTableRefCount = networkTableRefUriList.size() - execution.setVariable("CRENWKI_networkTableRefCount", networkTableRefCount) - utils.log("DEBUG", " CRENWKI_networkTableRefCount - " + networkTableRefCount, isDebugEnabled) - - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - - if (networkTableRefCount > 0) { - execution.setVariable("CRENWKI_networkTableRefUriList", networkTableRefUriList) - utils.log("DEBUG", " networkTableRefUri List - " + networkTableRefUriList, isDebugEnabled) - - // AII loop call using list vpnBindings - String networkTableRefs = "" - for (i in 0..networkTableRefUriList.size()-1) { - - int counting = i+1 - - // prepare url using tableRef - String queryNetworkTableRefAAIRequest = "" - - String aai_uri = aaiUriUtil.getNetworkTableReferencesUri(execution) - - // Note: By default, the network policy url is found in 'related-link' of the response, - // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. - if (aai_uri == null || aai_uri == "") { - // using value of 'related-link' from response - if (networkTableRefUriList[i].charAt(networkTableRefUriList[i].length()-1) == '/') { - queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i].substring(0, networkTableRefUriList[i].length()-1) - } else { - queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i] - } - } else { - // using uri value in URN mapping - String networkTableRefId = networkTableRefUriList[i].substring(networkTableRefUriList[i].indexOf("/route-table-reference/")+23, networkTableRefUriList[i].length()) - - if (networkTableRefId.charAt(networkTableRefId.length()-1) == '/') { - networkTableRefId = networkTableRefId.substring(0, networkTableRefId.length()-1) - } - queryNetworkTableRefAAIRequest = "${aai_endpoint}${aai_uri}/" + networkTableRefId - - } - - - utils.logAudit(queryNetworkTableRefAAIRequest) - execution.setVariable("CRENWKI_queryNetworkTableRefAAIRequest", queryNetworkTableRefAAIRequest) - utils.log("DEBUG", " CRENWKI_queryNetworkTableRefAAIRequest, , NetworkTableRef #" + counting + " : " + "\n" + queryNetworkTableRefAAIRequest, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(queryNetworkTableRefAAIRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.get() - String returnCode = response.getStatusCode() - execution.setVariable("CRENWKI_aaiQqueryNetworkTableRefReturnCode", returnCode) - utils.log("DEBUG", " ***** AAI query network Table Reference Response Code, NetworkTableRef #" + counting + " : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable("CRENWKI_queryNetworkTableRefAAIResponse", aaiResponseAsString) - utils.log("DEBUG", " QueryAAINetworkTableRef Success REST Response, , NetworkTableRef #" + counting + " : " + "\n" + aaiResponseAsString, isDebugEnabled) - - String networkTableRef = "" - if (utils.nodeExists(aaiResponseAsString, "route-table-reference-fqdn")) { - networkTableRef = utils.getNodeText1(aaiResponseAsString, "route-table-reference-fqdn") - networkTableRefs += "" + networkTableRef + "" + '\n' - } - - } else { - if (returnCode=='404') { - String dataErrorMessage = "Response Error from QueryAAINetworkTableRef is 404 (Not Found)." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Response from QueryAAINetworkTableRef - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - } // end loop - - execution.setVariable("CRENWKI_tableRefCollection", networkTableRefs) - utils.log("DEBUG", " CRENWKI_tableRefCollection - " + '\n' + networkTableRefs, isDebugEnabled) - - } else { - // reset return code to success - execution.setVariable("CRENWKI_aaiQqueryNetworkTableRefReturnCode", "200") - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String schemaVersion = aaiUriUtil.getNamespaceFromUri(aai_uri) - String aaiStubResponse = - """ - - - - """ - String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) - execution.setVariable("CRENWKI_queryNetworkTableRefAAIResponse", aaiStubResponseAsXml) - execution.setVariable("CRENWKI_tableRefCollection", "") - utils.log("DEBUG", " No net table references, using this stub as response - " + '\n' + aaiStubResponseAsXml, isDebugEnabled) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in CreateNetworkInstanceInfra flow. callRESTQueryAAINetworkTableRef() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - public void callRESTUpdateContrailAAINetwork(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTUpdateContrailAAINetwork of CreateNetworkInstanceInfra ***** " , isDebugEnabled) - - try { - // get variables - String networkId = utils.getNodeText1(execution.getVariable("CRENWKI_assignSDNCResponse"), "network-id") - networkId = UriUtils.encode(networkId,"UTF-8") - String requeryIdAAIResponse = execution.getVariable("CRENWKI_requeryIdAAIResponse") - String createNetworkResponse = execution.getVariable("CRENWKI_createNetworkResponse") - String messageId = execution.getVariable("CRENWKI_messageId") - - // Prepare url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId - - utils.logAudit(updateContrailAAIUrlRequest) - execution.setVariable("CRENWKI_updateContrailAAIUrlRequest", updateContrailAAIUrlRequest) - utils.log("DEBUG", " CRENWKI_updateContrailAAIUrlRequest - " + "\n" + updateContrailAAIUrlRequest, isDebugEnabled) - - //Prepare payload (PUT) - String schemaVersion = aaiUriUtil.getNamespaceFromUri(aai_uri) - String payload = networkUtils.ContrailNetworkCreatedUpdate(requeryIdAAIResponse, createNetworkResponse, schemaVersion) - String payloadXml = utils.formatXml(payload) - utils.logAudit(payloadXml) - execution.setVariable("CRENWKI_updateContrailAAIPayloadRequest", payloadXml) - utils.log("DEBUG", " 'payload' to Update Contrail - " + "\n" + payloadXml, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(updateContrailAAIUrlRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.httpPut(payload) - String returnCode = response.getStatusCode() - execution.setVariable("CRENWKI_aaiUpdateContrailReturnCode", returnCode) - - utils.log("DEBUG", " ***** AAI Update Contrail Response Code : " + returnCode, isDebugEnabled) - - String aaiUpdateContrailResponseAsString = response.getResponseBodyAsString() - - if (returnCode=='200') { - utils.logAudit(aaiUpdateContrailResponseAsString) - execution.setVariable("CRENWKI_updateContrailAAIResponse", aaiUpdateContrailResponseAsString) - utils.log("DEBUG", " AAI Update Contrail Success REST Response - " + "\n" + aaiUpdateContrailResponseAsString, isDebugEnabled) - // Point-of-no-return is set to false, rollback not needed. - execution.setVariable("CRENWKI_isPONR", true) - - } else { - if (returnCode=='404') { - String dataErrorMessage = " Response Error from UpdateContrailAAINetwork is 404 (Not Found)." - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiUpdateContrailResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiUpdateContrailResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String errorMessage = "Unexpected Response from UpdateContrailAAINetwork - " + returnCode - utils.log("DEBUG", errorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, "2500", errorMessage) - } - } - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in CreateNetworkInstanceInfra flow. callRESTUpdateContrailAAINetwork() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareCreateNetworkRequest (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside prepareCreateNetworkRequest of CreateNetworkInstanceInfra ***** ", isDebugEnabled) - - try { - - // get variables - String requestId = execution.getVariable("CRENWKI_requestId") - String messageId = execution.getVariable("CRENWKI_messageId") - String source = execution.getVariable("CRENWKI_source") - - String requestInput = execution.getVariable("CRENWKI_networkRequest") - String queryIdResponse = execution.getVariable("CRENWKI_queryIdAAIResponse") - String cloudRegionId = execution.getVariable("CRENWKI_cloudRegionPo") - String backoutOnFailure = execution.getVariable("CRENWKI_rollbackEnabled") - - // Prepare Network request - String routeCollection = execution.getVariable("CRENWKI_routeCollection") - String policyCollection = execution.getVariable("CRENWKI_networkCollection") - String tableCollection = execution.getVariable("CRENWKI_tableRefCollection") - String createNetworkRequest = networkUtils.CreateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyCollection, tableCollection, cloudRegionId, backoutOnFailure, source ) - // Format Response - String buildDeleteNetworkRequestAsString = utils.formatXml(createNetworkRequest) - buildDeleteNetworkRequestAsString = buildDeleteNetworkRequestAsString.replace(":w1aac13n0", "").replace("w1aac13n0:", "") - utils.logAudit(buildDeleteNetworkRequestAsString) - - execution.setVariable("CRENWKI_createNetworkRequest", buildDeleteNetworkRequestAsString) - utils.log("DEBUG", " CRENWKI_createNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString, isDebugEnabled) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in CreateNetworkInstanceInfra flow. prepareCreateNetworkRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareSDNCRequest (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside prepareSDNCRequest of CreateNetworkInstanceInfra ***** ", isDebugEnabled) - - try { - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String createNetworkInput = execution.getVariable("CRENWKI_networkRequest") - String cloudRegionId = execution.getVariable("CRENWKI_cloudRegionSdnc") - - String networkId = "" - if (utils.nodeExists(createNetworkInput, "network-id")) { - networkId = utils.getNodeText1(createNetworkInput, "network-id") - } - if (networkId == null) {networkId = ""} - - String serviceInstanceId = utils.getNodeText1(createNetworkInput, "service-instance-id") - - // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, createNetworkInput, serviceInstanceId, sdncCallback, "assign", "NetworkActivateRequest", cloudRegionId, networkId, null) - - String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) - utils.logAudit(sndcTopologyCreateRequesAsString) - execution.setVariable("CRENWKI_assignSDNCRequest", sndcTopologyCreateRequesAsString) - utils.log("DEBUG", " CRENWKI_assignSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString, isDebugEnabled) - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in CreateNetworkInstanceInfra flow. prepareSDNCRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareDBRequest (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - try { - utils.log("DEBUG", " ***** Inside prepareDBRequest of CreateNetworkInstanceInfra ***** ", isDebugEnabled) - - String networkOutputs = execution.getVariable("CRENWKI_networkOutputs") - String networkName = "" - try { - networkName = utils.getNodeText1(networkOutputs, "network-name") - if (networkName == null) {networkName = ""} - } catch (Exception ex) { - networkName = "" - utils.log("DEBUG", " No 'network-name' found in '' ! ", isDebugEnabled) - } - String networkId = "" - try { - networkId = utils.getNodeText1(networkOutputs, "network-id") - if (networkId == null) {networkId = ""} - } catch (Exception) { - networkId = "" - utils.log("DEBUG", " No 'network-id' found in '' ! ", isDebugEnabled) - } - String requestId = execution.getVariable("CRENWKI_requestId") - - String statusMessage = "" - if (execution.getVariable("CRENWKI_orchestrationStatus") == "ACTIVE") { - // SILENT SUCCESS - statusMessage = "Network " + networkName + " already exists. Silent success." - } else { - statusMessage = "Network successfully created." - } - - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - COMPLETED - 100 - <network-id>${networkId}</network-id><network-name>${networkName}</network-names> - ${networkId} - - - """ - - String buildDeleteDBRequestAsString = utils.formatXml(dbRequest) - execution.setVariable("CRENWKI_createDBRequest", buildDeleteDBRequestAsString) - utils.log("DEBUG", " DB Adapter Request - " + "\n" + buildDeleteDBRequestAsString, isDebugEnabled) - utils.logAudit(buildDeleteDBRequestAsString) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in CreateNetworkInstanceInfra flow. prepareDBRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareDBRequestError (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - try { - utils.log("DEBUG", " ***** Inside prepareDBRequestError of CreateNetworkInstanceInfra ***** ", isDebugEnabled) - - String statusMessage = "" - WorkflowException wfe = null - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - wfe = execution.getVariable("WorkflowException") - statusMessage = wfe.getErrorMessage() - } else { - String workflowException = execution.getVariable("WorkflowException") - try { - statusMessage = utils.getNodeText1(workflowException, "ErrorMessage") - } catch (Exception ex) { - statusMessage = "Encountered Error during DB Update. " + ex.getMessage() - } - } - String networkOutputs = execution.getVariable("CRENWKI_networkOutputs") - String requestId = execution.getVariable("CRENWKI_requestId") - String networkId = "" - try { - networkId = utils.getNodeText1(networkOutputs, "network-id") - if (networkId == null) {networkId = ""} - } catch (Exception) { - networkId = "" - utils.log("DEBUG", " No 'network-id' found in '' ! ", isDebugEnabled) - } - String networkName = "" - try { - networkName = utils.getNodeText1(networkOutputs, "network-name") - if (networkName == null) {networkName = ""} - } catch (Exception ex) { - networkName = "" - utils.log("DEBUG", " No 'network-name' found in '' ! ", isDebugEnabled) - } - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - FAILED - <network-id>${networkId}</network-id><network-name>${networkName}</network-names> - - - """ - - execution.setVariable("CRENWKI_createDBRequest", dbRequest) - utils.log("DEBUG", " DB Adapter Request - " + "\n" + dbRequest, isDebugEnabled) - utils.logAudit(dbRequest) - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in CreateNetworkInstanceInfra flow. prepareDBRequestError() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - // ************************************************** - // Post or Validate Response Section - // ************************************************** - - public void validateCreateNetworkResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside validateNetworkResponse of CreateNetworkInstanceInfra *****", isDebugEnabled) - - try { - String returnCode = execution.getVariable("CRENWKI_networkReturnCode") - String networkResponse = execution.getVariable("CRENWKI_createNetworkResponse") - if (networkResponse==null) { - networkResponse="" // reset - } - - utils.log("DEBUG", " Network Adapter create responseCode: " + returnCode, isDebugEnabled) - - String errorMessage = "" - if (returnCode == "200") { - execution.setVariable("CRENWKI_isNetworkRollbackNeeded", true) - utils.logAudit(networkResponse) - execution.setVariable("CRENWKI_createNetworkResponse", networkResponse) - utils.log("DEBUG", " Network Adapter create Success Response - " + "\n" + networkResponse, isDebugEnabled) - - // prepare rollback data - String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","") - String rollbackNetwork = - """ - ${rollbackData} - """ - String rollbackNetworkXml = utils.formatXml(rollbackNetwork) - execution.setVariable("CRENWKI_rollbackNetworkRequest", rollbackNetworkXml) - utils.log("DEBUG", " Network Adapter rollback data - " + "\n" + rollbackNetworkXml, isDebugEnabled) - - } else { // network error - if (returnCode.toInteger() > 399 && returnCode.toInteger() < 600) { //4xx, 5xx - if (networkResponse.contains("createNetworkError")) { - networkResponse = networkResponse.replace('', '') - errorMessage = utils.getNodeText1(networkResponse, "message") - errorMessage = "Received error from Network Adapter: " + errorMessage - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - - } else { // CatchAll exception - if (returnCode == "500") { - errorMessage = "JBWEB000065: HTTP Status 500." - } else { - errorMessage = "Return code is " + returnCode - } - errorMessage = "Received error from Network Adapter: " + errorMessage - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - - } - - } else { // CatchAll exception - String dataErrorMessage = "Received error from Network Adapter. Return code is: " + returnCode - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in CreateNetworkInstanceInfra flow. validateCreateNetworkResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - - } - - public void validateSDNCResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside validateSDNCResponse of CreateNetworkInstanceInfra ***** ", isDebugEnabled) - - String response = execution.getVariable("CRENWKI_assignSDNCResponse") - WorkflowException workflowException = null - try { - workflowException = execution.getVariable("CRENWKI_WorkflowException") - //execution.setVariable("WorkflowException", workflowException) - } catch (Exception ex) { - utils.log("DEBUG", " Sdnc 'WorkflowException' object is empty or null. ", isDebugEnabled) - } - - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - // reset variable - String assignSDNCResponseDecodeXml = sdncAdapterUtils.decodeXML(execution.getVariable("CRENWKI_assignSDNCResponse")) - assignSDNCResponseDecodeXml = assignSDNCResponseDecodeXml.replace("&", "&").replace('', "") - execution.setVariable("CRENWKI_assignSDNCResponse", assignSDNCResponseDecodeXml) - - if (execution.getVariable("CRENWKI_sdncResponseSuccess") == true) { // from sdnc util, prefix+'sdncResponseSuccess' - execution.setVariable("CRENWKI_isSdncRollbackNeeded", true) - utils.log("DEBUG", "Successfully Validated SDNC Response", isDebugEnabled) - - } else { - utils.log("DEBUG", "Did NOT Successfully Validated SDNC Response", isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - - } - - - public void postProcessResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside postProcessResponse of CreateNetworkInstanceInfra ***** ", isDebugEnabled) - - try { - // Display DB response: CRENWKI_createDBResponse / CRENWKI_dbReturnCode - String dbReturnCode = execution.getVariable("CRENWKI_dbReturnCode") - utils.log("DEBUG", " ***** DB Update Response Code : " + dbReturnCode, isDebugEnabled) - String createDBResponse = execution.getVariable("CRENWKI_createDBResponse") - utils.log("DEBUG", " ***** DB Update Response String: " + '\n' + createDBResponse, isDebugEnabled) - utils.logAudit(createDBResponse) - - String source = execution.getVariable("CRENWKI_source") - String requestId = execution.getVariable("CRENWKI_requestId") - - String msoCompletionRequest = - """ - - ${requestId} - CREATE - ${source} - - Network has been created successfully. - BPMN Network action: CREATE - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - if (execution.getVariable("CRENWKI_orchestrationStatus") != "ACTIVE") { - // normal path - if (dbReturnCode == "200") { - utils.logAudit(createDBResponse) - utils.logAudit(xmlMsoCompletionRequest) - execution.setVariable("CRENWKI_Success", true) - execution.setVariable("CRENWKI_CompleteMsoProcessRequest", xmlMsoCompletionRequest) - utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - } else { - String errorMessage = " DB Update failed, code: " + dbReturnCode - utils.log("DEBUG", errorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - - } - - } else { - // silent Success path - utils.logAudit(createDBResponse) - utils.logAudit(xmlMsoCompletionRequest) - execution.setVariable("CRENWKI_Success", true) - execution.setVariable("CRENWKI_CompleteMsoProcessRequest", xmlMsoCompletionRequest) - utils.log("DEBUG", " Silent SUCCESS going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in CreateNetworkInstanceInfra flow. postProcessResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - - } - - public void prepareSDNCRollbackRequest (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside prepareSDNCRollbackRequest of CreateNetworkInstanceInfra ***** ", isDebugEnabled) - - try { - // for some reason the WorkflowException object is null after the sdnc rollback call task, need to save WorkflowException. - execution.setVariable("CRENWKI_WorkflowException", execution.getVariable("WorkflowException")) - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String createNetworkInput = execution.getVariable("CRENWKI_networkRequest") - String cloudRegionId = execution.getVariable("CRENWKI_cloudRegionSdnc") - String assignSDNCResponse = execution.getVariable("CRENWKI_assignSDNCResponse") - String networkId = utils.getNodeText1(assignSDNCResponse, "network-id") - - String serviceInstanceId = utils.getNodeText1(createNetworkInput, "service-instance-id") - - // 2. prepare rollback topology via SDNC Adapter SUBFLOW call - String sndcTopologyRollbackRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, createNetworkInput, serviceInstanceId, sdncCallback, "rollback", "NetworkActivateRequest", cloudRegionId, networkId, null) - String sndcTopologyRollbackRequestAsString = utils.formatXml(sndcTopologyRollbackRequest) - execution.setVariable("CRENWKI_rollbackSDNCRequest", sndcTopologyRollbackRequestAsString) - utils.log("DEBUG", " Preparing request for SDNC Topology assign's rollback/compensation . . . - " + "\n" + sndcTopologyRollbackRequestAsString, isDebugEnabled) - - - } catch (Exception ex) { - String exceptionMessage = " Bpmn error encountered in CreateNetworkInstanceInfra flow. prepareSDNCRollbackRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void validateRollbackResponses (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - try { - // validate PO network rollback response - String rollbackNetworkErrorMessages = "" - Boolean isNetworkRollbackNeeded = execution.getVariable("CRENWKI_isNetworkRollbackNeeded") - if (isNetworkRollbackNeeded == true) { - utils.log("DEBUG", " NetworkRollback Code - " + execution.getVariable("CRENWKI_rollbackNetworkReturnCode"), isDebugEnabled) - utils.log("DEBUG", " NetworkRollback Response - " + execution.getVariable("CRENWKI_rollbackNetworkResponse"), isDebugEnabled) - - String rollbackNetworkReturnCode = execution.getVariable("CRENWKI_rollbackNetworkReturnCode") - String rollbackNetworkResponse = execution.getVariable("CRENWKI_rollbackNetworkResponse") - if (rollbackNetworkReturnCode != "200") { - rollbackNetworkErrorMessages = " + PO Network rollback failed. " - } else { - rollbackNetworkErrorMessages = " + PO Network rollback completed." - } - - } - - // validate SDNC rollback response - String rollbackSdncErrorMessages = "" - Boolean isSdncRollbackNeeded = execution.getVariable("CRENWKI_isSdncRollbackNeeded") - if (isSdncRollbackNeeded == true) { - String rollbackSDNCReturnCode = execution.getVariable("CRENWKI_rollbackSDNCReturnCode") - String rollbackSDNCReturnInnerCode = "" - String rollbackSDNCResponse = execution.getVariable("CRENWKI_rollbackSDNCResponse") - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - rollbackSDNCResponse = sdncAdapterUtils.decodeXML(rollbackSDNCResponse) - rollbackSDNCResponse = rollbackSDNCResponse.replace("&", "&").replace('$', '').replace('', "") - - if (rollbackSDNCReturnCode == "200") { - if (utils.nodeExists(rollbackSDNCResponse, "response-code")) { - rollbackSDNCReturnInnerCode = utils.getNodeText1(rollbackSDNCResponse, "response-code") - if (rollbackSDNCReturnInnerCode == "200" || rollbackSDNCReturnInnerCode == "" || rollbackSDNCReturnInnerCode == "0") { - rollbackSdncErrorMessages = " + SNDC rollback completed." - } else { - rollbackSdncErrorMessages = " + SDNC rollback failed. " - } - } else { - rollbackSdncErrorMessages = " + SNDC rollback completed." - } - } else { - rollbackSdncErrorMessages = " + SDNC rollback failed. " - } - - utils.log("DEBUG", " SDNC rollback Code - " + rollbackSDNCReturnCode, isDebugEnabled) - utils.log("DEBUG", " SDNC rollback Response - " + rollbackSDNCResponse, isDebugEnabled) - - } - - //WorkflowException wfe = execution.getVariable("WorkflowException") - //String statusMessage = wfe.getErrorMessage() - //int errorCode = wfe.getErrorCode() - - String statusMessage = "" - int errorCode = 0 - WorkflowException wfe = execution.getVariable("WorkflowException") - if (wfe instanceof WorkflowException) { - statusMessage = wfe.getErrorMessage() - errorCode = wfe.getErrorCode() - } else { - if (execution.getVariable("CRENWKI_WorkflowException") instanceof WorkflowException) { - // get saved WorkflowException - WorkflowException swfe = execution.getVariable("CRENWKI_WorkflowException") - statusMessage = swfe.getErrorMessage() - errorCode = swfe.getErrorCode() - } else { - statusMessage = "Encountered Error, please see previous tasks/activities/steps for error messages." - errorCode = 7000 - } - } - - // recreate WorkflowException to include the rollback Message - statusMessage = statusMessage + rollbackNetworkErrorMessages + rollbackSdncErrorMessages - exceptionUtil.buildWorkflowException(execution, errorCode, statusMessage) - - } catch (Exception ex) { - execution.setVariable("WorkflowException", null) - String exceptionMessage = " Bpmn error encountered in CreateNetworkInstanceInfra flow. validateRollbackResponses() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - - - } - - // ******************************* - // Build Error Section - // ******************************* - - // Prepare for FalloutHandler - public void buildErrorResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler. *****", isDebugEnabled) - - String dbReturnCode = execution.getVariable("CRENWKI_dbReturnCode") - utils.log("DEBUG", " ***** DB Update Response Code : " + dbReturnCode, isDebugEnabled) - String createDBResponse = execution.getVariable("CRENWKI_createDBResponse") - utils.log("DEBUG", " ***** DB Update Response String: " + '\n' + createDBResponse, isDebugEnabled) - utils.logAudit(createDBResponse) - - String falloutHandlerRequest = "" - String requestId = execution.getVariable("CRENWKI_requestId") - String source = execution.getVariable("CRENWKI_source") - try { - execution.setVariable("CRENWKI_Success", false) - WorkflowException wfe = execution.getVariable("WorkflowException") - String errorCode = String.valueOf(wfe.getErrorCode()) - String errorMessage = wfe.getErrorMessage() - falloutHandlerRequest = - """ - - ${requestId} - CREATE - ${source} - - - ${errorMessage} - ${errorCode} - - """ - - utils.logAudit(falloutHandlerRequest) - execution.setVariable("CRENWKI_FalloutHandlerRequest", falloutHandlerRequest) - utils.log("DEBUG", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) - - } catch (Exception ex) { - String errorException = " Bpmn error encountered in CreateNetworkInstanceInfra flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() - utils.log("DEBUG", errorException, isDebugEnabled) - falloutHandlerRequest = - """ - - ${requestId} - CREATE - ${source} - - - ${errorException} - 7000 - - """ - - execution.setVariable("CRENWKI_FalloutHandlerRequest", falloutHandlerRequest) - utils.log("DEBUG", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) - - } - - } - - - public void sendSyncError (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - try { - - String requestId = execution.getVariable("att-mso-request-id") - - // REST Error (for API Handler (APIH) Reply Task) - String syncError = """{"requestReferences":{"instanceId":"","requestId":"${requestId}"}}""".trim() - - sendWorkflowResponse(execution, 500, syncError) - - } catch (Exception ex) { - utils.log("DEBUG", " Bpmn error encountered in CreateNetworkInstanceInfra flow. sendSyncError() - " + ex.getMessage(), isDebugEnabled) - } - - } - - - public void processJavaException(Execution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - try{ - utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable("UnexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") - }catch(BpmnError b){ - utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") - } - utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) - } - -} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateServiceInstanceInfra.groovy b/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateServiceInstanceInfra.groovy deleted file mode 100644 index 3c3bb81e51..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateServiceInstanceInfra.groovy +++ /dev/null @@ -1,776 +0,0 @@ -/*- - * ============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 com.att.bpm.scripts; - -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution -import org.json.JSONObject; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; - -import org.springframework.web.util.UriUtils; - -/** - * This groovy class supports the CreateServiceInstance.bpmn process. - * - */ -public class CreateServiceInstanceInfra extends AbstractServiceTaskProcessor { - - String Prefix="CRESI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils() - - /** - * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. - * @param execution - */ - public InitializeProcessVariables(Execution execution){ - /* Initialize all the process variables in this block */ - - execution.setVariable("CRESI_CreateServiceInstanceJasonRequest", "") - execution.setVariable("CRESI_globalSubscriberId", "") - execution.setVariable("CRESI_serviceInstanceName", "") - execution.setVariable("CRESI_newServiceInstanceId", "") - execution.setVariable("CRESI_messageId", "") - execution.setVariable("CRESI_requestId", "") - - execution.setVariable("CRESI_queryAAIGlobalCustomerIdUrlRequest", "") - execution.setVariable("CRESI_queryAAIGlobalCustomerIdResponse", "") - execution.setVariable("CRESI_queryAAIGlobalCustomerIdCode", "") - - execution.setVariable("CRESI_queryAAISINameUrlRequest", "") - execution.setVariable("CRESI_queryAAISINamePayloadRequest", "") - execution.setVariable("CRESI_queryAAISINameResponse", "") - execution.setVariable("CRESI_queryAAISINameCode", "") - - execution.setVariable("CRESI_createSIinAAIUrlRequest", "") - execution.setVariable("CRESI_createSIinAAIPayloadRequest", "") - execution.setVariable("CRESI_createSIinAAIResponse", "") - execution.setVariable("CRESI_createSIinAAICode", "") - - execution.setVariable("CRESI_createDBRequest", "") - execution.setVariable("CRESI_createDBResponse", "") - execution.setVariable("CRESI_createDBCode", "") - - execution.setVariable("CRESI_createDBInfraErrorRequest", "") - execution.setVariable("CRESI_errorDBInfraErrorResponse", "") - execution.setVariable("CRESI_errorDBInfraErrorErrorCode", "") - - execution.setVariable("CRESI_CompleteMsoProcessRequest", "") - execution.setVariable("CRESI_FalloutHandlerRequest", "") - execution.setVariable("CRESI_Success", false) - execution.setVariable("CRESI_unexpectedError", "") - - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - /** - * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. - * @param execution - */ - public void preProcessRequest (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest CreateServiceInstanceInfra Request ***** ", isDebugEnabled) - - try { - // initialize flow variables - InitializeProcessVariables(execution) - - // check for incoming json message/input - String createServiceInstanceIncoming = execution.getVariable("bpmnRequest") - utils.logAudit(createServiceInstanceIncoming) - execution.setVariable("CRESI_CreateServiceInstanceJasonRequest", createServiceInstanceIncoming); - println 'createServiceInstanceIncoming - ' + createServiceInstanceIncoming - - // extract requestId - String requestId = execution.getVariable("att-mso-request-id") - execution.setVariable("CRESI_requestId", requestId) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - execution.setVariable("serviceInstanceId", serviceInstanceId) - - String requestAction = execution.getVariable("requestAction") - execution.setVariable("requestAction", requestAction) - - String source = jsonUtil.getJsonValue(createServiceInstanceIncoming, "requestDetails.requestInfo.source") - execution.setVariable("CRESI_source", source) - - // extract globalSubscriberId - String globalSubscriberId = jsonUtil.getJsonValue(createServiceInstanceIncoming, "requestDetails.subscriberInfo.globalSubscriberId") - - // prepare messageId - String messageId = execution.getVariable("CRESI_messageId") // for testing - if (messageId == null || messageId == "") { - messageId = UUID.randomUUID() - utils.log("DEBUG", " CRESI_messageId, random generated: " + messageId, isDebugEnabled) - } else { - utils.log("DEBUG", " CRESI_messageId, pre-assigned: " + messageId, isDebugEnabled) - } - execution.setVariable("CRESI_messageId", messageId) - - // verify element global-customer-id is sent from JSON input, throw exception if missing - if ((globalSubscriberId == null) || (globalSubscriberId.isEmpty())) { - String dataErrorMessage = " Element 'globalSubscriberId' is missing. " - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - execution.setVariable("CRESI_globalSubscriberId", globalSubscriberId) - - } - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - String aaiNamespace = aaiUriUtil.getNamespaceFromUri(aai_uri) - logDebug('AAI namespace is: ' + aaiNamespace, isDebugEnabled) - execution.setVariable("CRESI_aaiNamespace","${aaiNamespace}") - - String newServiceInstanceId = execution.getVariable("CRESI_testServiceInstanceId") // for testing variable - if ((newServiceInstanceId) == null || (newServiceInstanceId.isEmpty())) { - newServiceInstanceId = UUID.randomUUID().toString() - utils.log("DEBUG", " Generated new Service Instance: " + newServiceInstanceId , isDebugEnabled) // generated - } else { - utils.log("DEBUG", " Assigned new Service Instance: " + newServiceInstanceId , isDebugEnabled) - } - newServiceInstanceId = UriUtils.encode(newServiceInstanceId,"UTF-8") - execution.setVariable("CRESI_newServiceInstanceId", newServiceInstanceId) - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex){ - String exceptionMessage = "Bpmn error encountered in CreateServiceInstanceInfra flow. Unexpected from method preProcessRequest() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - } - - public void sendSyncResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateServiceInstanceInfra ***** ", isDebugEnabled) - - try { - String newServiceInstanceId = execution.getVariable("CRESI_newServiceInstanceId") - String requestId = execution.getVariable("att-mso-request-id") - - // RESTResponse (for API Handler (APIH) Reply Task) - String syncResponse ="""{"requestReferences":{"instanceId":"${newServiceInstanceId}","requestId":"${requestId}"}}""".trim() - - utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) - sendWorkflowResponse(execution, 202, syncResponse) - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in CreateServiceInstanceInfra flow. Unexpected from method sendSyncResponse() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - } - - public void callRESTQueryAAIGlobalSubscriberId (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAICustomer of CreateServiceInstanceInfra ***** " , isDebugEnabled) - - try { - // get variables - String messageId = execution.getVariable("CRESI_requestId") - String globalSubscriberId = execution.getVariable("CRESI_globalSubscriberId") - globalSubscriberId = UriUtils.encode(globalSubscriberId,"UTF-8") - - // Prepare AA&I url with globalCustomerId - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - String queryAAISubscriberIdUrlRequest = "${aai_endpoint}${aai_uri}/${globalSubscriberId}" - utils.logAudit(queryAAISubscriberIdUrlRequest) - utils.log("DEBUG", " ***** AAI Query Subscriber Id Url: " + queryAAISubscriberIdUrlRequest, isDebugEnabled) - execution.setVariable("CRESI_queryAAIGlobalCustomerIdUrlRequest", queryAAISubscriberIdUrlRequest) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(queryAAISubscriberIdUrlRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.get() - String returnCode = response.getStatusCode() - execution.setVariable("CRESI_queryAAIGlobalCustomerIdCode", returnCode) - utils.log("DEBUG", " ***** AAI Query Customer Subscriber Id Response Code : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - execution.setVariable("CRESI_queryAAIGlobalCustomerIdResponse", aaiResponseAsString) - utils.logAudit(aaiResponseAsString) - - if (returnCode=='200') { - // Customer found by ID. FLow to proceed. - utils.log("DEBUG", " CRESI_queryAAIGlobalCustomerIdResponse : " + aaiResponseAsString, isDebugEnabled) - - //TODO - //we might verify that service-subscription with matching name exists - //and throw error if not. If not checked, we will get exception in subsequent step on Create call - //in 1610 we assume both customer & service subscription were pre-created - - } else { - if (returnCode=='404') { - String errorMessage = " Customer Global Id not found (404) in AAI, Global Subscriber id: " + globalSubscriberId - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - // build WorkflowException & throw new BpmnError("MSOWorkflowException") - WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", workflowException) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String errorMessage = " Unexpected Error Response from AAI during callRESTQueryAAICustomerSubcriberId() - " + returnCode - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - } - - } - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateServiceInstanceInfra flow. Unexpected Error during method callRESTQueryAAICustomerSubcriberId() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - } - - - public void callRESTQueryAAISIName (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAISIName of CreateServiceInstanceInfra ***** " , isDebugEnabled) - - try { - // get variables - String messageId = execution.getVariable("CRESI_requestId") - String globalSubscriberId = execution.getVariable("CRESI_globalSubscriberId") - globalSubscriberId = UriUtils.encode(globalSubscriberId,"UTF-8") - - // extract serviceType - String createServiceInstanceIncoming = execution.getVariable("CRESI_CreateServiceInstanceJasonRequest"); - String serviceInstanceName = jsonUtil.getJsonValue(createServiceInstanceIncoming, "requestDetails.requestInfo.instanceName") - serviceInstanceName = UriUtils.encode(serviceInstanceName,'UTF-8') - String serviceType = jsonUtil.getJsonValue(createServiceInstanceIncoming, "requestDetails.modelInfo.modelName") - serviceType = UriUtils.encode(serviceType,'UTF-8') - - // Prepare AA&I url - //String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution) - - // seach by service instance name - - // Currently not designed, but this would search for service-instance-name within realm of customer: - // https://{serverURL}/aai/{version}/business/customers/customer/{globalCustID}/service-subscriptions/service-subscription/{serviceType}/service-instances?service-instance-name={serviceInstanceName} - //search for service-instance-name globally: - String queryAAISINameUrlRequest = "${aai_uri}?search-node-type=service-instance&filter=service-instance-name:EQUALS:${serviceInstanceName}" - utils.log("DEBUG", " ***** AAI Query Service Name Url: " + queryAAISINameUrlRequest, isDebugEnabled) - - utils.logAudit(queryAAISINameUrlRequest) - execution.setVariable("CRESI_queryAAISINameUrlRequest", queryAAISINameUrlRequest) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(queryAAISINameUrlRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.get() - String returnCode = response.getStatusCode() - execution.setVariable("CRESI_queryAAISINameCode", returnCode) - utils.log("DEBUG", " ***** AAI Query Service Instance Name Response Code : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - utils.log("DEBUG", " ***** AAI Query Service Instance Name Response : " +'\n'+ aaiResponseAsString, isDebugEnabled) - - if (returnCode=='200') { - utils.logAudit(aaiResponseAsString) - execution.setVariable("CRESI_queryAAISINameResponse", aaiResponseAsString) - - if ( (aaiResponseAsString != null) && (aaiResponseAsString.contains("service-instance")) ) { - // SI with same name was found - serviceInstanceName = UriUtils.decode(serviceInstanceName,'UTF-8') - String errorMessage = " Stopped creating Service Instance, already exists in AAI. Service instance name: " + serviceInstanceName - utils.log("DEBUG", errorMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 2500, errorMessage) - } else { - utils.log("DEBUG", "AAI return code 200, but no content found matching ServiceInstance name", isDebugEnabled) - //Actual meaning is 404 Not Found - execution.setVariable("CRESI_queryAAISINameCode", '404') - } - - } else { - if (returnCode=='404') { - utils.log("DEBUG", " AAI Query return code = '404'. Proceed with the Create Service Instance !!! ", isDebugEnabled) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - // build WorkflowException - WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", workflowException) - - } else { - // aai all errors - String errorMessage = " Unexpected Error Response from AAI during callRESTQueryAAISIName() - " + returnCode - exceptionUtil.buildWorkflowException(execution, 2500, errorMessage) - } - } - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception excp) { - // try error for method block - String exceptionMessage = "Bpmn error encountered in CreateServiceInstanceInfra flow in method callRESTQueryAAISIName(). Error was - " + excp.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTCreateServiceInstanceInAAI(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTCreateServiceInstanceInAAI of CreateServiceInstanceInfra ***** " , isDebugEnabled) - - try { - - // get variables - String messageId = execution.getVariable("CRESI_messageId") - String newServiceInstanceId = execution.getVariable("CRESI_newServiceInstanceId") - - String globalSubcriberId = execution.getVariable("CRESI_globalSubscriberId") - globalSubcriberId = UriUtils.encode(globalSubcriberId,"UTF-8") - - // get variable within incoming json - String createServiceInstanceIncoming = execution.getVariable("CRESI_CreateServiceInstanceJasonRequest"); - String serviceType = jsonUtil.getJsonValue(createServiceInstanceIncoming, "requestDetails.requestParameters.subscriptionServiceType") - if (serviceType != null || serviceType != "") { - serviceType = UriUtils.encode(serviceType,"UTF-8") - } - - String personaModelId = jsonUtil.getJsonValue(createServiceInstanceIncoming, "requestDetails.modelInfo.modelInvariantId") - String personaModelVersion = jsonUtil.getJsonValue(createServiceInstanceIncoming, "requestDetails.modelInfo.modelVersion") - String workloadContext = jsonUtil.getJsonValue(createServiceInstanceIncoming, "requestDetails.modelInfo.workload-context") - - String serviceInstanceName = jsonUtil.getJsonValue(createServiceInstanceIncoming, "requestDetails.requestInfo.instanceName") - - // Prepare url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - String createServiceInstanceAAIUrlRequest = "${aai_endpoint}${aai_uri}/${globalSubcriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${newServiceInstanceId}" - utils.log("DEBUG", " ***** AAI Create Service Instance Url: " + createServiceInstanceAAIUrlRequest, isDebugEnabled) - - utils.logAudit(createServiceInstanceAAIUrlRequest) - execution.setVariable("CRESI_createSIinAAIUrlRequest", createServiceInstanceAAIUrlRequest) - - //Prepare payload (PUT) - String schemaVersion = aaiUriUtil.getNamespaceFromUri(aai_uri) - - String createServiceInstancePayload = - """ - ${serviceInstanceName} - ${personaModelId} - ${personaModelVersion} - - """.trim() - - utils.logAudit(createServiceInstancePayload) - execution.setVariable("CRESI_createSIinAAIPayloadRequest", createServiceInstancePayload) - utils.log("DEBUG", " 'payload' to create Service Instance in AAI - " + "\n" + createServiceInstancePayload, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(createServiceInstanceAAIUrlRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.httpPut(createServiceInstancePayload) - String returnCode = response.getStatusCode() - execution.setVariable("CRESI_createSIinAAICode", returnCode) - utils.log("DEBUG", " ***** AAI Create Service Instance Response Code : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - utils.logAudit(aaiResponseAsString) - - if (returnCode.toInteger() > 199 && returnCode.toInteger() < 203) { - //200 OK 201 CREATED 202 ACCEPTED - utils.log("DEBUG", " AAI Create Service Instance Success REST Response.", isDebugEnabled) - - } else { - if (returnCode=='404') { - String dataErrorMessage = " AAI Create Service Instance Failed, Error 404. Proposed new Create Instance Id was: " + newServiceInstanceId - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - // build WorkflowException & throw new BpmnError("MSOWorkflowException") - WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", workflowException) - throw new BpmnError("MSOWorkflowException") - - } else { - // aai all errors - String dataErrorMessage = "Bpmn error encountered in CreateServiceInstanceInfra flow. Unexpected Error during create call in AAI - " + returnCode - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - } - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception excep) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateServiceInstanceInfra flow. Unexpected Error from method callRESTCreateServiceInstanceInAAI() - " + excep.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - // ******************************* - // Build DB request Section - // ******************************* - public void prepareDBRequest (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - try { - utils.log("DEBUG", " ***** Inside prepareDBRequest of CreateServiceInstanceInfra ***** ", isDebugEnabled) - - String requestId = execution.getVariable("CRESI_requestId") - String statusMessage = "Service Instance successfully created." - String serviceInstanceId = execution.getVariable("CRESI_newServiceInstanceId") - - //TODO - verify the format for Service Instance Create, - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - COMPLETED - 100 - - ${serviceInstanceId} - - - """ - - String buildDeleteDBRequestAsString = utils.formatXml(dbRequest) - execution.setVariable("CRESI_createDBRequest", buildDeleteDBRequestAsString) - utils.logAudit(buildDeleteDBRequestAsString) - - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateServiceInstanceInfra flow. Unexpected Error from method prepareDBRequest() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - // ***************************************** - // Prepare Completion request Section - // ***************************************** - public void postProcessResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside postProcessResponse of CreateNetworkInstanceInfra ***** ", isDebugEnabled) - - try { - // Display Success scenario for DB update Response: - String dbReturnCode = execution.getVariable("CRESI_createDBCode") - utils.log("DEBUG", " ***** Success DB Update Response Code : " + dbReturnCode, isDebugEnabled) - utils.log("DEBUG", " ***** Success DB Update Response String: " + '\n' + execution.getVariable("CRESI_createDBResponse"), isDebugEnabled) - - if (dbReturnCode == "200") { - String source = execution.getVariable("CRESI_source") - String requestId = execution.getVariable("CRESI_requestId") - - String msoCompletionRequest = - """ - - ${requestId} - CREATE - ${source} - - Service Instance has been created successfully. - BPMN Service Instance action: CREATE - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - utils.logAudit(xmlMsoCompletionRequest) - execution.setVariable("CRESI_Success", true) - execution.setVariable("CRESI_CompleteMsoProcessRequest", xmlMsoCompletionRequest) - utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - - } else { - String exceptionMessage = "Bpmn error encountered in CreateServiceInstanceInfra flow. Unexpected Error from DB adapter, return code: " + dbReturnCode - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, exceptionMessage) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateServiceInstance flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - // ******************************* - // Build Error Section - // ******************************* - public void prepareDBRequestError (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside prepareDBRequestError of CreateServiceInstanceInfra ***** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("CRESI_requestId") - String statusMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - statusMessage = wfe.getErrorMessage() - - } else { - statusMessage = "Encountered Error during CreateServiceInstance proccessing. " - } - - //TODO - verify the format for Service Instance Create, - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - FAILED - - - - """ - - String buildDBRequestAsString = utils.formatXml(dbRequest) - execution.setVariable("CRESI_createDBInfraErrorRequest", buildDBRequestAsString) - utils.logAudit(buildDBRequestAsString) - - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateServiceInstanceInfra flow. Unexpected Error from method prepareDBRequestError() - " + ex.getMessage() - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - // Prepare for FalloutHandler - public void buildErrorResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("ERROR", " ***** Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler. *****", isDebugEnabled) - - String falloutHandlerRequest = "" - try { - // Display Success scenario for DB update Response: - String dbReturnCode = execution.getVariable("CRESI_errorDBInfraErrorErrorCode") - utils.log("DEBUG", " ***** Error DB Update Response Code : " + dbReturnCode, isDebugEnabled) - utils.log("DEBUG", " ***** Error DB Update Response String: " + '\n' + execution.getVariable("CRESI_errorDBInfraErrorResponse"), isDebugEnabled) - - String requestId = execution.getVariable("CRESI_requestId") - String source = execution.getVariable("CRESI_source") - - execution.setVariable("CRESI_Success", false) - String errorMessage = "" - String errorCode = "" - - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - errorCode = wfe.getErrorCode().toString() - - } else { - errorMessage = "Bpmn error encountered in CreateServiceInstance flow." - errorCode = "2500" - - } - - falloutHandlerRequest = - """ - - ${requestId} - CREATE - ${source} - - - ${errorMessage} - ${errorCode} - - """ - - utils.logAudit(falloutHandlerRequest) - execution.setVariable("CRESI_FalloutHandlerRequest", falloutHandlerRequest) - utils.log("ERROR", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) - - } catch (Exception ex) { - // rebuild workflow exception - String requestId = execution.getVariable("CRESI_requestId") - String source = execution.getVariable("CRESI_source") - String errorException = " Build Error Response exception encountered during method buildErrorResponse(), preparing request for FalloutHandler: - " + ex.getMessage() - utils.log("DEBUG", errorException, isDebugEnabled) - falloutHandlerRequest = - """ - - ${requestId} - CREATE - ${source} - - - ${errorException} - 7000 - - """ - execution.setVariable("CRESI_FalloutHandlerRequest", falloutHandlerRequest) - utils.log("ERROR", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) - - } - - } - - public void sendSyncError (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside sendSyncError() of CreateServiceInstanceInfra ***** ", isDebugEnabled) - - try { - String errorMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """ - ${errorMessage} - 7000 - """ - - utils.logAudit(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - - - } catch (Exception ex) { - utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) - } - - } - - public void processJavaException(Execution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - try{ - utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable("CRESI_unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") - }catch(BpmnError b){ - utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable("CRESI_unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") - } - utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) - } - - -} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteNetworkInstanceInfra.groovy b/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteNetworkInstanceInfra.groovy deleted file mode 100644 index 9cc756294c..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteNetworkInstanceInfra.groovy +++ /dev/null @@ -1,873 +0,0 @@ -/*- - * ============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 com.att.bpm.scripts; - -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils; -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils - -import groovy.xml.XmlUtil -import groovy.json.* - -public class DeleteNetworkInstanceInfra extends AbstractServiceTaskProcessor { - String Prefix="DELNWKI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - - public InitializeProcessVariables(Execution execution){ - /* Initialize all the process variables in this block */ - - execution.setVariable("DELNWKI_DeleteNetworkInstanceInfraJsonRequest", "") - execution.setVariable("DELNWKI_networkRequest", "") - execution.setVariable("DELNWKI_networkRESTRequest", "") - execution.setVariable("DELNWKI_CompleteMsoProcessRequest", "") - execution.setVariable("DELNWKI_FalloutHandlerRequest", "") - execution.setVariable("DELNWKI_isSilentSuccess", false) - execution.setVariable("DELNWKI_Success", false) - execution.setVariable("DELNWKI_isPONR", false) // Point-of-no-return, means, rollback is not needed - - execution.setVariable("DELNWKI_requestId", "") - execution.setVariable("DELNWKI_source", "") - execution.setVariable("DELNWKI_networkInputs", "") - - execution.setVariable("DELNWKI_queryAAIRequest","") - execution.setVariable("DELNWKI_queryAAIResponse", "") - execution.setVariable("DELNWKI_aaiReturnCode", "") - execution.setVariable("DELNWKI_isAAIGood", false) - execution.setVariable("DELNWKI_isVfRelationshipExist", false) - - // AAI query Cloud Region - execution.setVariable("DELNWKI_queryCloudRegionRequest","") - execution.setVariable("DELNWKI_queryCloudRegionReturnCode","") - execution.setVariable("DELNWKI_queryCloudRegionResponse","") - execution.setVariable("DELNWKI_cloudRegionPo","") - execution.setVariable("DELNWKI_cloudRegionSdnc","") - - execution.setVariable("DELNWKI_deleteNetworkRequest", "") - execution.setVariable("DELNWKI_deleteNetworkResponse", "") - execution.setVariable("DELNWKI_networkReturnCode", "") - - execution.setVariable("DELNWKI_deleteSDNCRequest", "") - execution.setVariable("DELNWKI_deleteSDNCResponse", "") - execution.setVariable("DELNWKI_rollbackSDNCRequest", "") - execution.setVariable("DELNWKI_rollbackSDNCResponse", "") - execution.setVariable("DELNWKI_sdncReturnCode", "") - execution.setVariable("DELNWKI_rollbackSDNCReturnCode", "") - execution.setVariable("DELNWKI_isSdncRollbackNeeded", false) - execution.setVariable("DELNWKI_sdncResponseSuccess", false) - - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - - public void preProcessRequest (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest() DeleteNetworkV2 Request ***** ", isDebugEnabled) - - // initialize flow variables - InitializeProcessVariables(execution) - - // get incoming message/input - String deleteNetworkJsonIncoming = execution.getVariable("bpmnRequest") - utils.logAudit(deleteNetworkJsonIncoming) - - try { - def prettyJson = JsonOutput.prettyPrint(deleteNetworkJsonIncoming.toString()) - utils.log("DEBUG", " Incoming message formatted . . . : " + '\n' + prettyJson, isDebugEnabled) - - } catch (Exception ex) { - String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - // prepare messageId - String messageId = execution.getVariable("DELNWKI_messageId") // test scenario - if (messageId == null || messageId == "") { - messageId = UUID.randomUUID() - utils.log("DEBUG", " DELNWKI_messageId, random generated: " + messageId, isDebugEnabled) - } else { - utils.log("DEBUG", " DELNWKI_messageId, pre-assigned: " + messageId, isDebugEnabled) - } - execution.setVariable("DELNWKI_messageId", messageId) - - // PO Authorization Info / headers Authorization= - String basicAuthValuePO = execution.getVariable("URN_mso_adapters_po_auth") - utils.log("DEBUG", " Obtained BasicAuth userid password for PO/SDNC adapter: " + basicAuthValuePO, isDebugEnabled) - try { - def encodedString = utils.getBasicAuth(basicAuthValuePO, execution.getVariable("URN_mso_msoKey")) - execution.setVariable("BasicAuthHeaderValuePO",encodedString) - execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) - - } catch (IOException ex) { - String dataErrorMessage = " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - - try { - - execution.setVariable("DELNWKI_DeleteNetworkInstanceInfraJsonRequest", deleteNetworkJsonIncoming) - - // recreate the xml network-request - String networkRequest = vidUtils.createXmlNetworkRequestInfra(execution, deleteNetworkJsonIncoming) - execution.setVariable("DELNWKI_networkRequest", networkRequest) - utils.log("DEBUG", " network-request - " + '\n' + networkRequest, isDebugEnabled) - - String networkInputs = utils.getNodeXml(networkRequest, "network-inputs", false).replace("tag0:","").replace(":tag0","") - execution.setVariable("DELNWKI_networkInputs", networkInputs) - - String requestId = execution.getVariable("att-mso-request-id") - if (requestId == null || requestId == "") { - requestId = utils.getNodeText(networkRequest, "request-id") - } - execution.setVariable("DELNWKI_requestId", requestId) - execution.setVariable("DELNWKI_source", utils.getNodeText(networkRequest, "source")) - - String networkId = "" - if (utils.nodeExists(networkInputs, "network-id")) { - networkId = utils.getNodeText1(networkInputs, "network-id") - if (networkId == 'null' || networkId == "") { - sendSyncError(execution) - // missing value of network-name - String dataErrorMessage = "network-request has missing 'network-id' element/value." - utils.log("DEBUG", " Invalid Request - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - } - - String lcpCloudRegion = "" - if (utils.nodeExists(networkInputs, "aic-cloud-region")) { - lcpCloudRegion = utils.getNodeText1(networkInputs, "aic-cloud-region") - if ((lcpCloudRegion == 'null') || (lcpCloudRegion == "")) { - sendSyncError(execution) - String dataErrorMessage = "network-request has missing 'aic-cloud-region' element/value." - utils.log("DEBUG", " Invalid Request - " + dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - } - } - - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex){ - // caught exception - String exceptionMessage = "Exception Encountered in DeleteNetworkInstanceInfra, PreProcessRequest() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void sendSyncResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside sendSyncResponse() of DeleteNetworkV2 ***** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("att-mso-request-id") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - // RESTResponse (for API Handler (APIH) Reply Task) - String deleteNetworkRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - - utils.log("DEBUG", " sendSyncResponse to APIH - " + "\n" + deleteNetworkRestRequest, isDebugEnabled) - - sendWorkflowResponse(execution, 202, deleteNetworkRestRequest) - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Exception Encountered in DeleteNetworkInstanceInfra, sendSyncResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAI (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAI() of DeleteNetworkV2 ***** " , isDebugEnabled) - - // get variables - String networkInputs = execution.getVariable("DELNWKI_networkInputs") - String networkId = utils.getNodeText(networkInputs, "network-id") - networkId = UriUtils.encode(networkId,"UTF-8") - String messageId = execution.getVariable("DELNWKI_messageId") - - // Prepare AA&I url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String queryAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId - utils.logAudit(queryAAIRequest) - execution.setVariable("DELNWKI_queryAAIRequest", queryAAIRequest) - utils.log("DEBUG", " DELNWKI_AAIRequest - " + "\n" + queryAAIRequest, isDebugEnabled) - - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(queryAAIRequest); - - ExceptionUtil exceptionUtil = new ExceptionUtil() - Boolean isVfRelationshipExist = false - try { - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - APIResponse response = client.get() - String returnCode = response.getStatusCode() - execution.setVariable("DELNWKI_aaiReturnCode", returnCode) - - utils.log("DEBUG", " ***** AAI Response Code : " + returnCode, isDebugEnabled) - - String aaiResponseAsString = response.getResponseBodyAsString() - aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) - execution.setVariable("DELNWKI_queryAAIResponse", aaiResponseAsString) - - if (returnCode=='200' || returnCode=='204') { - utils.logAudit(aaiResponseAsString) - execution.setVariable("DELNWKI_isAAIGood", true) - utils.log("DEBUG", " AAI Query Success REST Response - " + "\n" + aaiResponseAsString, isDebugEnabled) - // verify if vf or vnf relationship exist - if (utils.nodeExists(aaiResponseAsString, "relationship")) { - NetworkUtils networkUtils = new NetworkUtils() - isVfRelationshipExist = networkUtils.isVfRelationshipExist(aaiResponseAsString) - execution.setVariable("DELNWKI_isVfRelationshipExist", isVfRelationshipExist) - if (isVfRelationshipExist == true) { - String relationshipMessage = "AAI Query Success Response but 'vf-module' relationship exist, not allowed to delete: network Id: " + networkId - exceptionUtil.buildWorkflowException(execution, 2500, relationshipMessage) - - } - } - utils.log("DEBUG", " DELNWKI_isVfRelationshipExist - " + isVfRelationshipExist, isDebugEnabled) - - } else { - execution.setVariable("DELNWKI_isAAIGood", false) - if (returnCode=='404' || aaiResponseAsString == "" || aaiResponseAsString == null) { - // not found // empty aai response - execution.setVariable("DELNWKI_isSilentSuccess", true) - utils.log("DEBUG", " AAI Query is Silent Success", isDebugEnabled) - - } else { - if (aaiResponseAsString.contains("RESTFault")) { - WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) - execution.setVariable("WorkflowException", exceptionObject) - - } else { - // aai all errors - String dataErrorMessage = "Unexpected Error Response from callRESTQueryAAI() - " + returnCode - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 2500, dataErrorMessage) - - } - } - } - - utils.log("DEBUG", " AAI Query call, isAAIGood? : " + execution.getVariable("DELNWKI_isAAIGood"), isDebugEnabled) - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Exception Encountered in DeleteNetworkInstanceInfra, callRESTQueryAAI() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void callRESTQueryAAICloudRegion (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside callRESTQueryAAICloudRegion of DeleteNetworkV2 ***** " , isDebugEnabled) - - try { - String networkInputs = execution.getVariable("DELNWKI_networkInputs") - String cloudRegion = utils.getNodeText(networkInputs, "aic-cloud-region") - cloudRegion = UriUtils.encode(cloudRegion,"UTF-8") - // Prepare AA&I url - String aai_endpoint = execution.getVariable("URN_aai_endpoint") - AaiUtil aaiUtil = new AaiUtil(this) - String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) - String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion - utils.logAudit(queryCloudRegionRequest) - execution.setVariable("DELNWKI_queryCloudRegionRequest", queryCloudRegionRequest) - utils.log("DEBUG", " DELNWKI_queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest, isDebugEnabled) - - String cloudRegionPo = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) - String cloudRegionSdnc = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "SDNC", cloudRegion) - - if ((cloudRegionPo != "ERROR") && (cloudRegionSdnc != "ERROR")) { - execution.setVariable("DELNWKI_cloudRegionPo", cloudRegionPo) - execution.setVariable("DELNWKI_cloudRegionSdnc", cloudRegionSdnc) - - } else { - String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable("DELNWKI_queryCloudRegionReturnCode") - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstanceInfra, callRESTQueryAAICloudRegion(). Unexpected Response from AAI - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareNetworkRequest (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside prepareNetworkRequest of DeleteNetworkV2 ***** ", isDebugEnabled) - ExceptionUtil exceptionUtil = new ExceptionUtil() - try { - // get variables - String cloudSiteId = execution.getVariable("DELNWKI_cloudRegionPo") - String networkInputs = execution.getVariable("DELNWKI_networkInputs") - String tenantId = utils.getNodeText(networkInputs, "tenant-id") - String networkType = utils.getNodeText(networkInputs, "network-type") - String networkId = utils.getNodeText(networkInputs, "network-id") - - String networkStackId = "" - networkStackId = utils.getNodeText1(execution.getVariable("DELNWKI_queryAAIResponse"), "heat-stack-id") - if (networkStackId == 'null' || networkStackId == "") { - networkStackId = "force_delete" - } - - String requestId = execution.getVariable("DELNWKI_requestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - // Added new Elements - String messageId = execution.getVariable("DELNWKI_messageId") - String notificationUrl = "" //TODO - is this coming from URN? What variable/value to use? - //String notificationUrl = execution.getVariable("URN_?????") //TODO - is this coming from URN? What variable/value to use? - - String deleteNetworkRequest = """ - - ${cloudSiteId} - ${tenantId} - ${networkId} - ${networkStackId} - ${networkType} - true - - ${requestId} - ${serviceInstanceId} - - ${messageId} - ${notificationUrl} - - """.trim() - - utils.log("DEBUG", " DELNWKI_deleteNetworkRequest - " + "\n" + deleteNetworkRequest, isDebugEnabled) - // Format Response - String buildDeleteNetworkRequestAsString = utils.formatXml(deleteNetworkRequest) - utils.logAudit(buildDeleteNetworkRequestAsString) - utils.log("DEBUG", " DELNWKI_deleteNetworkRequestAsString - " + "\n" + buildDeleteNetworkRequestAsString, isDebugEnabled) - - String restURL = execution.getVariable("URN_mso_adapters_network_rest_endpoint") - execution.setVariable("URN_mso_adapters_network_rest_endpoint", restURL + "/" + networkId) - utils.log("DEBUG", "URN_mso_adapters_network_rest_endpoint - " + "\n" + restURL + "/" + networkId, isDebugEnabled) - - execution.setVariable("DELNWKI_deleteNetworkRequest", buildDeleteNetworkRequestAsString) - utils.log("DEBUG", " DELNWKI_deleteNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString, isDebugEnabled) - } - catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstanceInfra, prepareNetworkRequest(). Unexpected Response from AAI - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - } - - /** - * This method is used instead of an HTTP Connector task because the - * connector does not allow DELETE with a body. - */ - public void sendRequestToVnfAdapter(Execution execution) { - def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' + - 'execution=' + execution.getId() + - ')' - def isDebugEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugEnabled) - - try { - - String vnfAdapterUrl = execution.getVariable("URN_mso_adapters_network_rest_endpoint") - String vnfAdapterRequest = execution.getVariable("DELNWKI_deleteNetworkRequest") - - RESTConfig config = new RESTConfig(vnfAdapterUrl) - RESTClient client = new RESTClient(config). - addHeader("Content-Type", "application/xml"). - addAuthorizationHeader(execution.getVariable("BasicAuthHeaderValuePO")); - - APIResponse response; - - response = client.httpDelete(vnfAdapterRequest) - - execution.setVariable("DELNWKI_networkReturnCode", response.getStatusCode()) - execution.setVariable("DELNWKI_deleteNetworkResponse", response.getResponseBodyAsString()) - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstanceInfra, sendRequestToVnfAdapter() - " + ex.getMessage() - logError(exceptionMessage) - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - } - - - public void prepareSDNCRequest (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside prepareSDNCRequest of DeleteNetworkV2 ***** ", isDebugEnabled) - - try { - // get variables - String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - String deleteNetworkInput = execution.getVariable("DELNWKI_networkRequest") - - String networkId = "" - if (utils.nodeExists(deleteNetworkInput, "network-id")) { - networkId = utils.getNodeText1(deleteNetworkInput, "network-id") - } - if (networkId == 'null') {networkId = ""} - - String serviceInstanceId = utils.getNodeText1(deleteNetworkInput, "service-instance-id") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - String cloudRegionId = execution.getVariable("DELNWKI_cloudRegionSdnc") - // 1. prepare delete topology via SDNC Adapter SUBFLOW call - String sndcTopologyDeleteRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "delete", "DisconnectNetworkRequest", cloudRegionId, networkId, null) - String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) - utils.logAudit(sndcTopologyDeleteRequesAsString) - execution.setVariable("DELNWKI_deleteSDNCRequest", sndcTopologyDeleteRequesAsString) - utils.log("DEBUG", " DELNWKI_deleteSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) - - // 2. prepare rollback topology via SDNC Adapter SUBFLOW call - String sndcTopologyRollbackRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "rollback", "DisconnectNetworkRequest", cloudRegionId, networkId, null) - String sndcTopologyRollbackRequestAsString = utils.formatXml(sndcTopologyRollbackRequest) - execution.setVariable("DELNWKI_rollbackSDNCRequest", sndcTopologyRollbackRequestAsString) - utils.log("DEBUG", " DELNWKI_rollbackSDNCRequest (prepared if NEEDED later for SDNC Topology delete's rollback/compensation . . . - " + "\n" + sndcTopologyRollbackRequestAsString, isDebugEnabled) - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstanceInfra, prepareSDNCRequest() - " + ex.getMessage() - logError(exceptionMessage) - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareDBRequest (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - try { - utils.log("DEBUG", " ***** Inside prepareDBRequest of DeleteNetworkV2 ***** ", isDebugEnabled) - - String aaiReturnCode = execution.getVariable("DELNWKI_aaiReturnCode") - String requestId = execution.getVariable("DELNWKI_requestId") - - String statusMessage = "" - if (aaiReturnCode == '404' || execution.getVariable("DELNWKI_isSilentSuccess") == true) { - // SILENT SUCCESS - statusMessage = "Network Id to be deleted NOT found. Silent success." - } else { - statusMessage = "Network successfully deleted." - } - - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - COMPLETED - 100 - <network-outputs xmlns="http://ecomp.att.com/mso/infra/vnf-request/v1" xmlns:aetgt="http://ecomp.att.com/mso/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"/> - - - """ - - String buildDeleteDBRequestAsString = utils.formatXml(dbRequest) - utils.logAudit(buildDeleteDBRequestAsString) - execution.setVariable("DELNWKI_deleteDBRequest", buildDeleteDBRequestAsString) - utils.log("DEBUG", " DB Adapter Request - " + "\n" + buildDeleteDBRequestAsString, isDebugEnabled) - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstanceInfra, prepareDBRequest() - " + ex.getMessage() - logError(exceptionMessage) - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void prepareDBRequestError (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - try { - utils.log("DEBUG", " ***** Inside prepareDBRequestError of DeleteNetworkV2 ***** ", isDebugEnabled) - - WorkflowException wfe = execution.getVariable("WorkflowException") - String statusMessage = wfe.getErrorMessage() - String requestId = execution.getVariable("DELNWKI_requestId") - - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - FAILED - - <network-outputs xmlns="http://ecomp.att.com/mso/infra/vnf-request/v1" xmlns:aetgt="http://ecomp.att.com/mso/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"/> - - - """ - - execution.setVariable("DELNWKI_deleteDBRequest", dbRequest) - utils.log("DEBUG", " DB Adapter Request - " + "\n" + dbRequest, isDebugEnabled) - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstanceInfra, prepareDBRequestError() - " + ex.getMessage() - logError(exceptionMessage) - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - // ************************************************** - // Post or Validate Response Section - // ************************************************** - - public void validateNetworkResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside validateNetworkResponse of DeleteNetworkV2 *****", isDebugEnabled) - - try { - String returnCode = execution.getVariable("DELNWKI_networkReturnCode") - String networkResponse = execution.getVariable("DELNWKI_deleteNetworkResponse") - - utils.log("DEBUG", " Network Adapter responseCode: " + returnCode, isDebugEnabled) - utils.log("DEBUG", "Network Adapter Error Response - " + "\n" + networkResponse, isDebugEnabled) - - String errorMessage = "" - if (returnCode == "200") { - utils.logAudit(networkResponse) - execution.setVariable("DELNWKI_deleteNetworkResponse", networkResponse) - utils.log("DEBUG", " Network Adapter Success Response - " + "\n" + networkResponse, isDebugEnabled) - - } else { // network error - if (returnCode.toInteger() > 399 && returnCode.toInteger() < 600) { //4xx, 5xx - if (networkResponse.contains("deleteNetworkError") ) { - networkResponse = networkResponse.replace('', '') - errorMessage = utils.getNodeText1(networkResponse, "message") - errorMessage = "Received error from Network Adapter: " + errorMessage - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - - } else { // CatchAll exception - if (returnCode == "500") { - errorMessage = "JBWEB000065: HTTP Status 500." - } else { - errorMessage = "Return code is " + returnCode - } - errorMessage = "Received error from Network Adapter: " + errorMessage - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - - } - - } else { // CatchAll exception - String dataErrorMessage = "Received error from Network Adapter. Return code is: " + returnCode - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstanceInfra, validateNetworkResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - public void validateSDNCResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside validateSDNCResponse of DeleteNetworkV2 ***** ", isDebugEnabled) - - String response = execution.getVariable("DELNWKI_deleteSDNCResponse") - WorkflowException workflowException = execution.getVariable("WorkflowException") - - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - // reset variable - String deleteSDNCResponseDecodeXml = sdncAdapterUtils.decodeXML(execution.getVariable("DELNWKI_deleteSDNCResponse")) - deleteSDNCResponseDecodeXml = deleteSDNCResponseDecodeXml.replace("&", "&").replace('', "") - execution.setVariable("DELNWKI_deleteSDNCResponse", deleteSDNCResponseDecodeXml) - - if (execution.getVariable("DELNWKI_sdncResponseSuccess") == true) { // from sdnc util, prefix+'sdncResponseSuccess' - execution.setVariable("DELNWKI_isSdncRollbackNeeded", true) // - execution.setVariable("DELNWKI_isPONR", true) - utils.log("DEBUG", "Successfully Validated SDNC Response", isDebugEnabled) - } else { - utils.log("DEBUG", "Did NOT Successfully Validated SDNC Response", isDebugEnabled) - throw new BpmnError("MSOWorkflowException") - } - - } - - - public void postProcessResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside postProcessResponse of DeleteNetworkV2 ***** ", isDebugEnabled) - - try { - // Display DB response: DELNWKI_deleteDBResponse / DELNWKI_dbReturnCode - String dbReturnCode = execution.getVariable("DELNWKI_dbReturnCode") - utils.log("DEBUG", " ***** DB Update Response Code : " + dbReturnCode, isDebugEnabled) - utils.log("DEBUG", " ***** DB Update Response String: " + '\n' + execution.getVariable("DELNWKI_deleteDBResponse"), isDebugEnabled) - - if (dbReturnCode == '200') { - - String source = execution.getVariable("DELNWKI_source") - String requestId = execution.getVariable("DELNWKI_requestId") - - String msoCompletionRequest = - """ - - ${requestId} - DELETE - ${source} - - Network has been deleted successfully. - BPMN Network action: DELETE - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - utils.logAudit(xmlMsoCompletionRequest) - execution.setVariable("DELNWKI_CompleteMsoProcessRequest", xmlMsoCompletionRequest) - execution.setVariable("DELNWKI_Success", true) - if (execution.getVariable("DELNWKI_isSilentSuccess") == false) { - utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - } else { - utils.log("DEBUG", " Silent SUCCESS going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - } - - } else { - // caught exception - String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstanceInfra, DB Update Failed: " + dbReturnCode - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, exceptionMessage) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstanceInfra, postProcessResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - // ******************************* - // Build Error Section - // ******************************* - - // Prepare for FalloutHandler - public void buildErrorResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler. *****", isDebugEnabled) - - String dbReturnCode = execution.getVariable("DELNWKI_dbReturnCode") - utils.log("DEBUG", " ***** DB Update Response Code : " + dbReturnCode, isDebugEnabled) - utils.log("DEBUG", " ***** DB Update Response String: " + '\n' + execution.getVariable("DELNWKI_deleteDBResponse"), isDebugEnabled) - - String falloutHandlerRequest = "" - String workflowException = "" - String requestId = execution.getVariable("DELNWKI_requestId") - String source = execution.getVariable("DELNWKI_source") - execution.setVariable("DELNWKI_Success", false) - try { - WorkflowException wfe = execution.getVariable("WorkflowException") - String errorCode = String.valueOf(wfe.getErrorCode()) - String errorMessage = wfe.getErrorMessage() - - falloutHandlerRequest = - """ - - ${requestId} - DELETE - ${source} - - - ${errorMessage} - ${errorCode} - - """ - - utils.logAudit(falloutHandlerRequest) - execution.setVariable("DELNWKI_FalloutHandlerRequest", falloutHandlerRequest) - utils.log("ERROR", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) - - } catch (Exception ex) { - // caught exception - String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstanceInfra, buildErrorResponse() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - falloutHandlerRequest = - """ - - ${requestId} - CREATE - ${source} - - - ${exceptionMessage} - 9999 - - """ - execution.setVariable("DELNWKI_FalloutHandlerRequest", falloutHandlerRequest) - utils.log("DEBUG", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) - } - } - - - public void sendSyncError (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - try { - String requestId = execution.getVariable("att-mso-request-id") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - // RESTResponse (for API Handler (APIH) Reply Task) - String deleteNetworkRestError = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - - utils.log("DEBUG", " sendSyncResponse to APIH - " + "\n" + deleteNetworkRestError, isDebugEnabled) - - sendWorkflowResponse(execution, 500, deleteNetworkRestError) - - } catch (Exception ex) { - utils.log("DEBUG", " Sending Sync Error Activity Failed - DeleteNetworkInstanceInfra, sendSyncError(): " + "\n" + ex.getMessage(), isDebugEnabled) - } - } - - public void processJavaException(Execution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - try{ - utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable("UnexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") - }catch(BpmnError b){ - utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") - } - utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) - } - -} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteServiceInstanceInfra.groovy b/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteServiceInstanceInfra.groovy deleted file mode 100644 index 7004004c25..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteServiceInstanceInfra.groovy +++ /dev/null @@ -1,549 +0,0 @@ -/*- - * ============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 com.att.bpm.scripts; - -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.UUID; -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution -import org.json.JSONObject; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource -import static org.apache.commons.lang3.StringUtils.*; - -import org.springframework.web.util.UriUtils; - -/** - * This groovy class supports the CreateServiceInstance.bpmn process. - */ -public class DeleteServiceInstanceInfra extends AbstractServiceTaskProcessor { - - String Prefix="DELSI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils() - - /** - * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. - * @param execution - */ - public InitializeProcessVariables(Execution execution){ - /* Initialize all the process variables in this block */ - - execution.setVariable("DELSI_DeleteServiceInstanceJasonRequest", "") - execution.setVariable("DELSI_requestDetails", "") - execution.setVariable("DELSI_globalSubscriberId", "") - execution.setVariable("DELSI_serviceInstanceName", "") - execution.setVariable("DELSI_serviceInstanceId", "") - execution.setVariable("DELSI_serviceInstance", "") - execution.setVariable("DELSI_messageId", "") - execution.setVariable("DELSI_serviceType", "") - - execution.setVariable("DELSI_queryAAISINameResponse", "") - execution.setVariable("DELSI_queryAAISINameCode", "") - - execution.setVariable("DELSI_createDBRequest", "") - execution.setVariable("DELSI_dbResponse", "") - execution.setVariable("DELSI_dbReturnCode", "") - - execution.setVariable("DELSI_createDBInfraErrorRequest", "") - execution.setVariable("DELSI_errorDBInfraErrorResponse", "") - execution.setVariable("DELSI_errorDBInfraErrorErrorCode", "") - - execution.setVariable("DELSI_CompleteMsoProcessRequest", "") - execution.setVariable("DELSI_FalloutHandlerRequest", "") - execution.setVariable("DELSI_Success", false) - execution.setVariable("DELSI_unexpectedError", "") - execution.setVariable("DELSI_siInUse", false) - - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - /** - * This method is executed during the preProcessRequest task of the DeleteServiceInstance.bpmn process. - * @param execution - */ - public void preProcessRequest (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest DeleteServiceInstance Request ***** ", isDebugEnabled) - - try { - // initialize flow variables - InitializeProcessVariables(execution) - - // check for incoming json message/input - String deleteServiceInstanceIncoming = execution.getVariable("bpmnRequest") - utils.logAudit(deleteServiceInstanceIncoming) - execution.setVariable("DELSI_DeleteServiceInstanceJasonRequest", deleteServiceInstanceIncoming); - - // extract requestId - String requestId = execution.getVariable("att-mso-request-id") - execution.setVariable("DELSI_requestId", requestId) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - execution.setVariable("DELSI_serviceInstanceId", serviceInstanceId) - - String requestAction = execution.getVariable("requestAction") - execution.setVariable("requestAction", requestAction) - - String source = jsonUtil.getJsonValue(deleteServiceInstanceIncoming, "requestDetails.requestInfo.source") - execution.setVariable("DELSI_source", source) - - // get variables - // extract requestDetails - String xmlRequestDetails = vidUtils.getJsonRequestDetailstoXml(deleteServiceInstanceIncoming) - execution.setVariable("DELSI_requestDetails", xmlRequestDetails) - - utils.log("DEBUG", "xmlRequestDetails: " + xmlRequestDetails , isDebugEnabled) - - String xmlParameters = utils.getNodeXml(xmlRequestDetails, "requestParameters", false) - utils.log("DEBUG","xmlParameters: " + xmlParameters , isDebugEnabled) - - String serviceType = jsonUtil.getJsonValue(deleteServiceInstanceIncoming, "requestDetails.requestParameters.subscriptionServiceType") - execution.setVariable("DELSI_serviceType", serviceType) - - // extract globalSubscriberId - //String globalSubscriberId = jsonUtil.getJsonValue(deleteServiceInstanceIncoming, "requestDetails.subscriberInfo.globalSubscriberId") - - // prepare messageId - String messageId = execution.getVariable("DELSI_messageId") // for testing - if (messageId == null || messageId == "") { - messageId = UUID.randomUUID() - utils.log("DEBUG", " DELSI_messageId, random generated: " + messageId, isDebugEnabled) - } else { - utils.log("DEBUG", " DELSI_messageId, pre-assigned: " + messageId, isDebugEnabled) - } - execution.setVariable("DELSI_messageId", messageId) - - AaiUtil aaiUriUtil = new AaiUtil(this) - String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) - String aaiNamespace = aaiUriUtil.getNamespaceFromUri(aai_uri) - logDebug('AAI namespace is: ' + aaiNamespace, isDebugEnabled) - execution.setVariable("DELSI_aaiNamespace","${aaiNamespace}") - - //Setting for Generic Sub Flows - execution.setVariable("GENGS_type", "service-instance") - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex){ - String exceptionMessage = "Bpmn error encountered in DeleteServiceInstance flow. Unexpected from method preProcessRequest() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - - } - - public void sendSyncResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside sendSyncResponse of DeleteServiceInstance ***** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("att-mso-request-id") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - // RESTResponse (for API Handler (APIH) Reply Task) - String syncResponse = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - - utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) - sendWorkflowResponse(execution, 202, syncResponse) - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DeleteServiceInstance flow. Unexpected from method sendSyncResponse() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - - public void processGetServiceInstanceResponse(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside processGetServiceInstanceResponse of DeleteServiceInstance ***** " , isDebugEnabled) - - try { - - //Extract Global Sub Id - String messageId = execution.getVariable("DELSI_requestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String siRelatedLink = execution.getVariable("GENGSI_siResourceLink") - - int custStart = siRelatedLink.indexOf("customer/") - int custEnd = siRelatedLink.indexOf("/service-subscriptions") - String globalCustId = siRelatedLink.substring(custStart + 9, custEnd) - - execution.setVariable("DELSI_globalSubscriberId",globalCustId) - - //Extract Service Type if not provided on request - String serviceType = execution.getVariable("DELSI_serviceType") - if(isBlank(serviceType)){ - int serviceStart = siRelatedLink.indexOf("service-subscription/") - int serviceEnd = siRelatedLink.indexOf("/service-instances/") - String serviceTypeEncoded = siRelatedLink.substring(serviceStart + 21, serviceEnd) - - serviceType = UriUtils.decode(serviceTypeEncoded, "UTF-8") - } - execution.setVariable("serviceType", serviceType) - - String serviceInstanceData = execution.getVariable("DELSI_serviceInstance"); - utils.log("DEBUG", " DELSI_serviceInstance: " + serviceInstanceData, isDebugEnabled) - - //Confirm there are no related service instances (vnf/network or volume) - if (utils.nodeExists(serviceInstanceData, "relationship-list")) { - - InputSource source = new InputSource(new StringReader(serviceInstanceData)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document serviceXml = docBuilder.parse(source) - - NodeList nodeList = serviceXml.getElementsByTagName("relationship") - for (int x = 0; x < nodeList.getLength(); x++) { - Node node = nodeList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() - if(e.equals("generic-vnf") || e.equals("l3-network")){ - utils.log("DEBUG", "ServiceInstance still has relationship(s) to OpenStack.", isDebugEnabled) - execution.setVariable("DELSI_siInUse", true) - //there are relationship dependencies to this Service Instance - String errorMessage = " Stopped deleting Service Instance, it has dependencies. Service instance id: " + serviceInstanceId - utils.log("DEBUG", errorMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) - }else{ - utils.log("DEBUG", "Relationship NOT related to OpenStack", isDebugEnabled) - } - } - } - } - - } catch (BpmnError e) { - throw e; - } catch (Exception excp) { - // try error for method block - String exceptionMessage = "Bpmn error encountered in DeleteServiceInstance flow in method processGetServiceInstanceResponse. Error was - " + excp.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - utils.log("DEBUG", " ***** Completed processGetServiceInstanceResponse of DeleteServiceInstance ***** " , isDebugEnabled) - } - - // ******************************* - // Build DB request Section - // ******************************* - public void prepareDBRequest (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - try { - utils.log("DEBUG", " ***** Inside prepareDBRequest of DeleteServiceInstance ***** ", isDebugEnabled) - - String requestId = execution.getVariable("DELSI_requestId") - String statusMessage = "Service Instance successfully deleted." - - //TODO - verify the format for Service Instance Delete, - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - COMPLETED - 100 - - - - """ - - String buildDeleteDBRequestAsString = utils.formatXml(dbRequest) - execution.setVariable("DELSI_createDBRequest", buildDeleteDBRequestAsString) - utils.logAudit(buildDeleteDBRequestAsString) - - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in DeleteServiceInstance flow. Unexpected Error from method prepareDBRequest() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - // ***************************************** - // Prepare Completion request Section - // ***************************************** - public void postProcessResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside postProcessResponse of DeleteServiceInstanceInfra ***** ", isDebugEnabled) - - try { - // Display Success scenario for DB update Response: - String dbReturnCode = execution.getVariable("DELSI_dbReturnCode") - utils.log("DEBUG", " ***** Success DB Update Response Code : " + dbReturnCode, isDebugEnabled) - utils.log("DEBUG", " ***** Success DB Update Response String: " + '\n' + execution.getVariable("DELSI_dbResponse"), isDebugEnabled) - - if (dbReturnCode == "200") { - String source = execution.getVariable("DELSI_source") - String requestId = execution.getVariable("DELSI_requestId") - - String msoCompletionRequest = - """ - - ${requestId} - DELETE - ${source} - - Service Instance has been deleted successfully. - BPMN Service Instance action: DELETE - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - utils.logAudit(xmlMsoCompletionRequest) - execution.setVariable("DELSI_Success", true) - execution.setVariable("DELSI_CompleteMsoProcessRequest", xmlMsoCompletionRequest) - utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - - } else { - String exceptionMessage = "Bpmn error encountered in DeleteServiceInstanceInfra flow. Unexpected Error from DB adapter, return code: " + dbReturnCode - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, exceptionMessage) - - } - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in DeleteServiceInstanceInfra flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - - // ******************************* - // Build Error Section - // ******************************* - public void prepareDBRequestError (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside prepareDBRequestError of DeleteServiceInstanceInfra ***** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("DELSI_requestId") - String statusMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - statusMessage = wfe.getErrorMessage() - - } else { - statusMessage = "Encountered Error during DeleteServiceInstanceInfra proccessing. " - } - - //TODO - verify the format for Service Instance Create, - String dbRequest = - """ - - - - ${requestId} - BPMN - ${statusMessage} - - FAILED - - - - """ - - String buildDBRequestAsString = utils.formatXml(dbRequest) - execution.setVariable("DELSI_createDBInfraErrorRequest", buildDBRequestAsString) - utils.logAudit(buildDBRequestAsString) - - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in DeleteServiceInstanceInfra flow. Unexpected Error from method prepareDBRequestError() - " + ex.getMessage() - exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) - - } - - } - - // Prepare for FalloutHandler - public void buildErrorResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("ERROR", " ***** Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler. *****", isDebugEnabled) - - String falloutHandlerRequest = "" - try { - // Display Success scenario for DB update Response: - String dbReturnCode = execution.getVariable("DELSI_errorDBInfraErrorErrorCode") - utils.log("DEBUG", " ***** Error DB Update Response Code : " + dbReturnCode, isDebugEnabled) - utils.log("DEBUG", " ***** Error DB Update Response String: " + '\n' + execution.getVariable("DELSI_errorDBInfraErrorResponse"), isDebugEnabled) - - String requestId = execution.getVariable("DELSI_requestId") - String source = execution.getVariable("DELSI_source") - - execution.setVariable("DELSI_Success", false) - String errorMessage = "" - String errorCode = "" - - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - errorCode = wfe.getErrorCode().toString() - - } else { - errorMessage = "Bpmn error encountered in DeleteServiceInstanceInfra flow." - errorCode = "2500" - - } - - falloutHandlerRequest = - """ - - ${requestId} - DELETE - ${source} - - - ${errorMessage} - ${errorCode} - - """ - - utils.logAudit(falloutHandlerRequest) - execution.setVariable("DELSI_FalloutHandlerRequest", falloutHandlerRequest) - utils.log("ERROR", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) - - } catch (Exception ex) { - // rebuild workflow exception - String requestId = execution.getVariable("DELSI_requestId") - String source = execution.getVariable("DELSI_source") - String errorException = " Build Error Response exception encountered during method buildErrorResponse(), preparing request for FalloutHandler: - " + ex.getMessage() - utils.log("DEBUG", errorException, isDebugEnabled) - falloutHandlerRequest = - """ - - ${requestId} - DELETE - ${source} - - - ${errorException} - 7000 - - """ - execution.setVariable("DELSI_FalloutHandlerRequest", falloutHandlerRequest) - utils.log("ERROR", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) - - } - - } - - public void sendSyncError (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside sendSyncError() of DeleteServiceInstanceInfra ***** ", isDebugEnabled) - - try { - String errorMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """ - ${errorMessage} - 7000 - """ - - utils.logAudit(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - - - } catch (Exception ex) { - utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) - } - - } - - public void processJavaException(Execution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - try{ - utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable("DELSI_unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") - }catch(BpmnError b){ - utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable("DELSI_unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") - } - utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) - } - -} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoCreateVfModuleRollback.groovy b/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoCreateVfModuleRollback.groovy deleted file mode 100644 index 76347d55a6..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoCreateVfModuleRollback.groovy +++ /dev/null @@ -1,284 +0,0 @@ -/*- - * ============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 com.att.bpm.scripts -import java.io.Serializable; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution - -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException - - - -public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ - - def Prefix="DCVFMR_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - - public void initProcessVariables(Execution execution) { - execution.setVariable("prefix",Prefix) - } - - // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids - // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest - public void preProcessRequest(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - - initProcessVariables(execution) - - def rollbackData = execution.getVariable("RollbackData") - String vnfId = rollbackData.get("VFMODULE", "vnfid") - execution.setVariable("DCVFMR_vnfId", vnfId) - String vfModuleId = rollbackData.get("VFMODULE", "vfmoduleid") - execution.setVariable("DCVFMR_vfModuleId", vfModuleId) - String source = rollbackData.get("VFMODULE", "source") - execution.setVariable("DCVFMR_source", source) - String serviceInstanceId = rollbackData.get("VFMODULE", "serviceInstanceId") - execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId) - String serviceId = rollbackData.get("VFMODULE", "service-id") - execution.setVariable("DCVFMR_serviceId", serviceId) - String vnfType = rollbackData.get("VFMODULE", "vnftype") - execution.setVariable("DCVFMR_vnfType", vnfType) - String vnfName = rollbackData.get("VFMODULE", "vnfname") - execution.setVariable("DCVFMR_vnfName", vnfName) - String tenantId = rollbackData.get("VFMODULE", "tenantid") - execution.setVariable("DCVFMR_tenantId", tenantId) - String vfModuleName = rollbackData.get("VFMODULE", "vfmodulename") - execution.setVariable("DCVFMR_vfModuleName", vfModuleName) - String vfModuleModelName = rollbackData.get("VFMODULE", "vfmodulemodelname") - execution.setVariable("DCVFMR_vfModuleModelName", vfModuleModelName) - String cloudSiteId = rollbackData.get("VFMODULE", "aiccloudregion") - execution.setVariable("DCVFMR_cloudSiteId", cloudSiteId) - String heatStackId = rollbackData.get("VFMODULE", "heatstackid") - execution.setVariable("DCVFMR_heatStackId", heatStackId) - String requestId = rollbackData.get("VFMODULE", "attmsorequestid") - execution.setVariable("DCVFMR_requestId", requestId) - //String serviceInstanceId = rollbackData.get("VFMODULE", "attmsoserviceinstanceid") - //execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId) - execution.setVariable("DCVFMR_rollbackPrepareUpdateVfModule", rollbackData.get("VFMODULE", "rollbackPrepareUpdateVfModule")) - execution.setVariable("DCVFMR_rollbackUpdateAAIVfModule", rollbackData.get("VFMODULE", "rollbackUpdateAAIVfModule")) - execution.setVariable("DCVFMR_rollbackVnfAdapterCreate", rollbackData.get("VFMODULE", "rollbackVnfAdapterCreate")) - execution.setVariable("DCVFMR_rollbackSDNCRequestAssign", rollbackData.get("VFMODULE", "rollbackSDNCRequestAssign")) - execution.setVariable("DCVFMR_rollbackSDNCRequestActivate", rollbackData.get("VFMODULE", "rollbackSDNCRequestActivate")) - execution.setVariable("DCVFMR_rollbackCreateAAIVfModule", rollbackData.get("VFMODULE", "rollbackCreateAAIVfModule")) - - // formulate the request for PrepareUpdateAAIVfModule - String request = """ - ${vnfId} - ${vfModuleId} - pending-delete - """ as String - utils.log("DEBUG", "PrepareUpdateAAIVfModuleRequest :" + request, isDebugEnabled) - execution.setVariable("PrepareUpdateAAIVfModuleRequest", request) - } - - // build a SDNC vnf-topology-operation request for the specified action - // (note: the action passed is expected to be 'changedelete' or 'delete') - public void prepSDNCAdapterRequest(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId") - - def callbackUrl = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - - String source = execution.getVariable("DCVFMR_source") - String serviceId = execution.getVariable("DCVFMR_serviceId") - String vnfId = execution.getVariable("DCVFMR_vnfId") - String vnfType = execution.getVariable("DCVFMR_vnfType") - String vnfName = execution.getVariable("DCVFMR_vnfName") - String tenantId = execution.getVariable("DCVFMR_tenantId") - String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - String vfModuleName = execution.getVariable("DCVFMR_vfModuleName") - String vfModuleModelName = execution.getVariable("DCVFMR_vfModuleModelName") - String cloudSiteId = execution.getVariable("DCVFMR_cloudSiteId") - String requestId = execution.getVariable("DCVFMR_requestId") - - String serviceInstanceIdToSdnc = "" - if (srvInstId != null && !srvInstId.isEmpty()) { - serviceInstanceIdToSdnc = srvInstId - } else { - serviceInstandIdToSdnc = vfModuleId - } - - def doSDNCActivateRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestActivate") - def doSDNCAssignRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestAssign") - - def action = "" - def requestAction = "" - - if (doSDNCActivateRollback.equals("true")) { - action = "delete" - requestAction = "DisconnectVNFRequest" - } - else if (doSDNCAssignRollback.equals("true")) { - action = "rollback" - requestAction = "VNFActivateRequest" - } - else - return - - - String request = """ - - ${requestId} - ${vfModuleId} - ${action} - vnf-topology-operation - ${callbackUrl} - - - - ${requestId} - ${requestAction} - ${source} - - - - - - ${serviceId} - ${serviceId} - ${serviceInstanceIdToSdnc} - notsurewecare - - - ${vfModuleId} - ${vfModuleModelName} - ${vfModuleName} - ${vnfId} - ${vnfName} - ${vnfType} - ${cloudSiteId} - ${tenantId} - - - """ - - utils.log("DEBUG", "sdncAdapterWorkflowRequest: " + request, isDebugEnabled) - execution.setVariable("sdncAdapterWorkflowRequest", request) - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing VnfAdapterDeleteV1 request - public void prepVNFAdapterRequest(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String requestId = UUID.randomUUID().toString() - String origRequestId = execution.getVariable("DCVFMR_requestId") - String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId") - String aicCloudRegion = execution.getVariable("DCVFMR_cloudSiteId") - String vnfId = execution.getVariable("DCVFMR_vnfId") - String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - String vfModuleStackId = execution.getVariable("DCVFMR_heatStackId") - String tenantId = execution.getVariable("DCVFMR_tenantId") - def messageId = execution.getVariable('att-mso-request-id') + '-' + - System.currentTimeMillis() - def notificationUrl = execution.getVariable("URN_mso_workflow_vnfadapter_rest_callback") - def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") - if ('true'.equals(useQualifiedHostName)) { - notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) - } - - String request = """ - - ${aicCloudRegion} - ${tenantId} - ${vnfId} - ${vfModuleId} - ${vfModuleStackId} - true - - ${origRequestId} - ${srvInstId} - - ${messageId} - ${notificationUrl} - - """ as String - - utils.log("DEBUG", "vnfAdapterRestV1Request: " + request, isDebugEnabled) - execution.setVariable("vnfAdapterRestV1Request", request) - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing UpdateAAIVfModuleRequest request - public void prepUpdateAAIVfModule(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String vnfId = execution.getVariable("DCVFMR_vnfId") - String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - // formulate the request for UpdateAAIVfModule - String request = """ - ${vnfId} - ${vfModuleId} - DELETE - deleted - """ as String - utils.log("DEBUG", "UpdateAAIVfModuleRequest :" + request, isDebugEnabled) - execution.setVariable("UpdateAAIVfModuleRequest", request) - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing DeleteAAIVfModuleRequest request - public void prepDeleteAAIVfModule(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - String vnfId = execution.getVariable("DCVFMR_vnfId") - String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") - // formulate the request for UpdateAAIVfModule - String request = """ - ${vnfId} - ${vfModuleId} - """ as String - utils.log("DEBUG", "DeleteAAIVfModuleRequest :" + request, isDebugEnabled) - execution.setVariable("DeleteAAIVfModuleRequest", request) - } - - // generates a WorkflowException if - // - - public void handleDoDeleteVfModuleFailure(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("ERROR", "AAI error occurred deleting the Generic Vnf: " - + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), isDebugEnabled) - String processKey = getProcessKey(execution); - exceptionUtil.buildWorkflowException(execution, 5000, "Failure in DoDeleteVfModule") - - } - - public void sdncValidateResponse(Execution execution, String response){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - utils.log("DEBUG", "Successfully Validated SDNC Response", isDebugEnabled) - }else{ - throw new BpmnError("MSOWorkflowException") - } - } -} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoDeleteVfModule.groovy b/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoDeleteVfModule.groovy deleted file mode 100644 index 5b726a0835..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoDeleteVfModule.groovy +++ /dev/null @@ -1,264 +0,0 @@ -/*- - * ============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 com.att.bpm.scripts -import java.io.Serializable; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution - -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.core.RollbackData -import org.openecomp.mso.bpmn.core.WorkflowException - - - -public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ - - def Prefix="DoDVfMod_" - - public void initProcessVariables(Execution execution) { - execution.setVariable("prefix",Prefix) - } - - // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids - // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest - public void preProcessRequest(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def xml = execution.getVariable("DoDeleteVfModuleRequest") - utils.logAudit("DoDeleteVfModule Request: " + xml) - - utils.log("DEBUG", "input request xml: " + xml, isDebugEnabled) - initProcessVariables(execution) - def vnfId = utils.getNodeText1(xml,"vnf-id") - def vfModuleId = utils.getNodeText1(xml,"vf-module-id") -// execution.setVariable("DoDVfMod_vnfId", vnfId) -// execution.setVariable("DoDVfMod_vfModuleId", vfModuleId) - // formulate the request for PrepareUpdateAAIVfModule - String request = """ - ${vnfId} - ${vfModuleId} - pending-delete - """ as String - utils.log("DEBUG", "PrepareUpdateAAIVfModuleRequest :" + request, isDebugEnabled) - utils.logAudit("UpdateAAIVfModule Request: " + request) - execution.setVariable("PrepareUpdateAAIVfModuleRequest", request) - execution.setVariable("DoDVfMod_vfModuleFromAAI", null) - } - - // build a SDNC vnf-topology-operation request for the specified action - // (note: the action passed is expected to be 'changedelete' or 'delete') - public void prepSDNCAdapterRequest(Execution execution, String action) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def xml = execution.getVariable("DoDeleteVfModuleRequest") - utils.logAudit("DoDeleteVfModule Request: " + xml) - - def srvInstId = execution.getVariable("att-mso-service-instance-id") - def callbackUrl = execution.getVariable("URN_mso_workflow_sdncadapter_callback") - utils.log("DEBUG", "input request xml: " + xml, isDebugEnabled) - - String requestId = "" - try { - requestId = execution.getVariable("att-mso-request-id") - } catch (Exception ex) { - requestId = utils.getNodeText1(xml, "request-id") - } - - String source = utils.getNodeText1(xml, "source") - String serviceId = utils.getNodeText1(xml, "service-id") - String vnfId = utils.getNodeText1(xml, "vnf-id") - String vnfType = utils.getNodeText1(xml, "vnf-type") - String vnfName = utils.getNodeText1(xml, "vnf-name") - String tenantId = utils.getNodeText1(xml, "tenant-id") - String vfModuleId = utils.getNodeText1(xml, "vf-module-id") - String serviceInstanceIdToSdnc = "" - if (xml.contains("service-instance-id")) { - serviceInstanceIdToSdnc = utils.getNodeText1(xml, "service-instance-id") - } else { - serviceInstanceIdToSdnc = vfModuleId - } - String vfModuleName = utils.getNodeText1(xml, "vf-module-name") - // Get vfModuleName from AAI response if it was not specified on the request - if (vfModuleName == null || vfModuleName.isEmpty()) { - if (execution.getVariable("DoDVfMod_vfModuleFromAAI") != null) { - VfModule vfModuleFromAAI = execution.getVariable("DoDVfMod_vfModuleFromAAI") - vfModuleName = vfModuleFromAAI.getElementText("vf-module-name") - } - } - String vfModuleModelName = utils.getNodeText1(xml, "vf-module-model-name") - String cloudSiteId = utils.getNodeText1(xml, "aic-cloud-region") - String request = """ - - ${requestId} - ${vfModuleId} - ${action} - vnf-topology-operation - ${callbackUrl} - - - - ${requestId} - DisconnectVNFRequest - ${source} - - - - - - ${serviceId} - ${serviceId} - ${serviceInstanceIdToSdnc} - notsurewecare - - - ${vfModuleId} - ${vfModuleModelName} - ${vfModuleName} - ${vnfId} - ${vnfName} - ${vnfType} - ${cloudSiteId} - ${tenantId} - - - """ - - utils.log("DEBUG", "sdncAdapterWorkflowRequest: " + request, isDebugEnabled) - utils.logAudit("DoDeleteVfModule - SDNCAdapterWorkflowRequest: " + request) - execution.setVariable("sdncAdapterWorkflowRequest", request) - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing VnfAdapterDeleteV1 request - public void prepVNFAdapterRequest(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def xml = execution.getVariable("DoDeleteVfModuleRequest") - def requestId = UUID.randomUUID().toString() - def origRequestId = execution.getVariable('att-mso-request-id') - def srvInstId = execution.getVariable('att-mso-service-instance-id') - def aicCloudRegion = utils.getNodeText1(xml, "aic-cloud-region") - def vnfId = utils.getNodeText1(xml, "vnf-id") - def vnfName = utils.getNodeText1(xml, "vnf-name") - def vfModuleId = utils.getNodeText1(xml, "vf-module-id") - def vfModuleStackId = execution.getVariable('DoDVfMod_heatStackId') - def tenantId = utils.getNodeText1(xml, "tenant-id") - def messageId = execution.getVariable('att-mso-request-id') + '-' + - System.currentTimeMillis() - def notificationUrl = execution.getVariable("URN_mso_workflow_vnfadapter_rest_callback") - def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") - if ('true'.equals(useQualifiedHostName)) { - notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) - } - - String request = """ - - ${aicCloudRegion} - ${tenantId} - ${vnfId} - ${vfModuleId} - ${vfModuleStackId} - true - - ${origRequestId} - ${srvInstId} - - ${messageId} - ${notificationUrl} - - """ as String - - utils.log("DEBUG", "vnfAdapterRestV1Request: " + request, isDebugEnabled) - utils.logAudit("deleteVfModuleRequest: " + request) - execution.setVariable("vnfAdapterRestV1Request", request) - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing UpdateAAIVfModuleRequest request - public void prepUpdateAAIVfModule(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def xml = execution.getVariable("DoDeleteVfModuleRequest") - utils.log("DEBUG", "input request xml: " + xml, isDebugEnabled) - initProcessVariables(execution) - def vnfId = utils.getNodeText1(xml,"vnf-id") - def vfModuleId = utils.getNodeText1(xml,"vf-module-id") - // formulate the request for UpdateAAIVfModule - String request = """ - ${vnfId} - ${vfModuleId} - DELETE - deleted - """ as String - utils.log("DEBUG", "UpdateAAIVfModuleRequest :" + request, isDebugEnabled) - utils.logAudit("UpdateAAIVfModuleRequest: " + request) - execution.setVariable("UpdateAAIVfModuleRequest", request) - } - - // parse the incoming DELETE_VF_MODULE request - // and formulate the outgoing DeleteAAIVfModuleRequest request - public void prepDeleteAAIVfModule(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - def xml = execution.getVariable("DoDeleteVfModuleRequest") - utils.log("DEBUG", "input request xml: " + xml, isDebugEnabled) - initProcessVariables(execution) - def vnfId = utils.getNodeText1(xml,"vnf-id") - def vfModuleId = utils.getNodeText1(xml,"vf-module-id") - // formulate the request for UpdateAAIVfModule - String request = """ - ${vnfId} - ${vfModuleId} - """ as String - utils.log("DEBUG", "DeleteAAIVfModuleRequest :" + request, isDebugEnabled) - utils.logAudit("DeleteAAIVfModuleRequest: " + request) - execution.setVariable("DeleteAAIVfModuleRequest", request) - } - - // generates a WorkflowException if - // - - public void handleDoDeleteVfModuleFailure(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("ERROR", "AAI error occurred deleting the Generic Vnf: " - + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), isDebugEnabled) - String processKey = getProcessKey(execution); - WorkflowException exception = new WorkflowException(processKey, 5000, - execution.getVariable("DoDVfMod_deleteGenericVnfResponse")) - execution.setVariable("WorkflowException", exception) - } - - public void sdncValidateResponse(Execution execution, String response){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - - WorkflowException workflowException = execution.getVariable("WorkflowException") - boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) - sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) - - if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - utils.log("DEBUG", "Successfully Validated SDNC Response", isDebugEnabled) - }else{ - throw new BpmnError("MSOWorkflowException") - } - } -} diff --git a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/VnfAdapterRestNotifyResource.java b/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/VnfAdapterRestNotifyResource.java deleted file mode 100644 index 5199322931..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/java/org/openecomp/mso/bpmn/gamma/workflow/service/VnfAdapterRestNotifyResource.java +++ /dev/null @@ -1,206 +0,0 @@ -/*- - * ============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.gamma.workflow.service; - -import java.io.StringReader; -import java.util.HashMap; -import java.util.Map; - -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.camunda.bpm.BpmPlatform; -import org.camunda.bpm.engine.MismatchingMessageCorrelationException; -import org.camunda.bpm.engine.ProcessEngineServices; -import org.camunda.bpm.engine.RuntimeService; -import org.slf4j.MDC; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; - -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * Listens for REST notifications from the VNF Adapter and injects each one - * into a waiting BPMN processes. - */ -@Path("/vnfAdapterRestNotify") -public class VnfAdapterRestNotifyResource { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); - private static final String LOGMARKER = "[VNF-REST-NOTIFY]"; - - private ProcessEngineServices pes4junit = null; - - @POST - @Path("/") - @Consumes(MediaType.APPLICATION_XML) - @Produces(MediaType.TEXT_PLAIN) - public Response notify(String content) { - LOGGER.debug(LOGMARKER + " Received VNF Adapter REST Notification:" - + System.lineSeparator() + content); - - String messageId = null; - long startTime = System.currentTimeMillis(); - - try { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); - DocumentBuilder builder = factory.newDocumentBuilder(); - InputSource source = new InputSource(new StringReader(content)); - Document doc = builder.parse(source); - doc.normalize(); - - Element rootElement = doc.getDocumentElement(); - NodeList childList = rootElement.getChildNodes(); - - for (int i = 0; i < childList.getLength(); i++) { - Node childNode = childList.item(i); - if (childNode.getNodeType() == Node.ELEMENT_NODE) { - Element childElement = (Element) childNode; - - String childElementName = childElement.getLocalName(); - if (childElementName == null) { - childElementName = childElement.getNodeName(); - } - - if ("messageId".equals(childElementName)) { - messageId = childElement.getTextContent(); - } - } - } - } catch (Exception e) { - String msg = "Failed to parse VNF Adapter REST Notification: " + e; - LOGGER.debug(LOGMARKER + " " + msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg, e); - - return Response.status(400).entity(e).build(); - } - - if (messageId == null || messageId.isEmpty()) { - String msg = "No messageId in VNF Adapter REST Notification"; - LOGGER.debug(LOGMARKER + " " + msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg); - - return Response.status(400).entity(msg).build(); - } - - MsoLogger.setServiceName("MSO." + "vnfAdapterRestNotify"); - MsoLogger.setLogContext(messageId, "N/A"); - - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Call to MSO vnfAdapterRestNotify "); - - try { - ProcessEngineServices pes = getProcessEngineServices(); - RuntimeService runtimeService = pes.getRuntimeService(); - - if (!isReadyforCorrelation(runtimeService, "VNFREST_messageId", messageId, "vnfAdapterRestCallbackMessage")) { - String msg = "No process is waiting to receive vnfAdapterRestCallbackMessage with VNFREST_messageId='" + messageId + "'"; - LOGGER.debug(LOGMARKER + " " + msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, LOGMARKER + ":" + msg); - - LOGGER.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - LOGMARKER + "Call to MSO vnfAdapterRestNotify ", "BPMN", MsoLogger.getServiceName(), "vnfAdapterRestNotify"); - - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Call to MSO VnfAdapterNotifyService "); - - - return Response.status(500).entity(msg).build(); - } - - Map variables = new HashMap(); - variables.put("VNFREST_messageId", messageId); - variables.put("VNFREST_callback", content); - - runtimeService.createMessageCorrelation("vnfAdapterRestCallbackMessage").setVariables(variables) - .processInstanceVariableEquals("VNFREST_messageId", messageId).correlate(); - - LOGGER.debug(LOGMARKER + " Completed processing of VNF Adapter REST Notification"); - } catch (MismatchingMessageCorrelationException e) { - LOGGER.debug(LOGMARKER + "[CORM] correlation id mismatch"); - String msg = "vnfAdapterRestNotify received a notification with messageId='" - + messageId + "' but it could not be correlated to any active process - ignoring the request"; - LOGGER.debug(msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, LOGMARKER, e); - - LOGGER.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.InternalError, - LOGMARKER + "Completed vnfAdapterRestNotify with error ", "BPMN", MsoLogger.getServiceName(), "vnfAdapterRestNotify"); - - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.InternalError, "Completed vnfAdapterRestNotify with error "); - - return Response.status(500).entity(msg).build(); - } - LOGGER.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - LOGMARKER + "Completed vnfAdapterRestNotify", "BPMN", MsoLogger.getServiceName(), "vnfAdapterRestNotify"); - - LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Completed vnfAdapterRestNotify"); - - return Response.status(204).build(); - } - - private boolean isReadyforCorrelation(RuntimeService runtimeService, - String correlationVariable, String correlationValue, String messageName) { - long waitingInstances = runtimeService.createExecutionQuery() - .messageEventSubscriptionName(messageName) - .processVariableValueEquals(correlationVariable, correlationValue) - .count(); - - int retries = 50; - while (waitingInstances == 0 && retries > 0) { - try { - Thread.sleep(100); - } catch (InterruptedException e) { - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, LOGMARKER, e); - - return false; - } - - waitingInstances = runtimeService.createExecutionQuery() - .messageEventSubscriptionName(messageName) - .processVariableValueEquals(correlationVariable, correlationValue) - .count(); - - retries--; - } - - return waitingInstances != 0; - } - - private ProcessEngineServices getProcessEngineServices() { - if (pes4junit == null) { - return BpmPlatform.getDefaultProcessEngine(); - } else { - return pes4junit; - } - } - - public void setProcessEngineServices4junit(ProcessEngineServices pes) { - pes4junit = pes; - } -} diff --git a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateNetworkInstanceInfra.bpmn b/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateNetworkInstanceInfra.bpmn deleted file mode 100644 index 8ce38e4dc2..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateNetworkInstanceInfra.bpmn +++ /dev/null @@ -1,1297 +0,0 @@ - - - - - SequenceFlow_1 - - - - isReturnCode404_No_SequenceFlow - - - - isNetworkActiveNo_SequenceFlow - isReturnCode404_Yes_SequenceFlow - SequenceFlow_21 - - - - SequenceFlow_21 - SequenceFlow_32 - - - - - SequenceFlow_32 - SequenceFlow_11 - - - - - SequenceFlow_12 - SequenceFlow_5 - - - - SequenceFlow_5 - sdncTopoNo_SequenceFlow - sdncTopoYes_SequenceFlow - - - - - - - - SequenceFlow_34 - - - - - sdncTopoNo_SequenceFlow - SequenceFlow_34 - - - - sdncTopoYes_SequenceFlow - SequenceFlow_16 - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_11 - SequenceFlow_12 - - - - SequenceFlow_27 - SequenceFlow_29 - - - - - - - http-connector - - ${CRENWKI_rollbackNetworkRequest} - ${URN_mso_adapters_network_rest_endpoint} - - - #{BasicAuthHeaderValuePO} - application/xml - - - POST - ${statusCode} - ${response} - - - - - - SequenceFlow_59 - SequenceFlow_13 - - - - isAAIQueryNameYes_SequenceFlow - isNetworkActiveYes_SequenceFlow - isNetworkActiveNo_SequenceFlow - - - - - - - isNetworkActiveYes_SequenceFlow - SequenceFlow_9 - - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${CRENWKI_createDBRequest} - - - application/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_9 - SequenceFlow_40 - - - - SequenceFlow_40 - SequenceFlow_41 - - - - - - - - - - - - - - - SequenceFlow_41 - SequenceFlow_2 - - - - SequenceFlow_2 - - - SequenceFlow_6 - isAAIQueryNameNo_SequenceFlow - isAAIQueryNameYes_SequenceFlow - - - - - - - isAAIQueryNameNo_SequenceFlow - isReturnCode404_No_SequenceFlow - isReturnCode404_Yes_SequenceFlow - - - - - - - - SequenceFlow_23 - isRollbackOn_YesNetwork_SequenceFlow - isRollbackOn_NoNetwork_SequenceFlow - - - - - - - SequenceFlow_23 - - - - - isRollbackOn_YesNetwork_SequenceFlow - isPONR_Yes_SequenceFlow - isPONR_No_SequenceFlow - - - - - - - isPONR_No_SequenceFlow - isNetworkOk_No_SequenceFlow - isNetworkOk_Yes_SequenceFlow - - - - - - - isNetworkOk_No_SequenceFlow - SequenceFlow_8 - sdncOk_Yeso_ExclusiveGateway - sdncOk_No_ExclusiveGateway - - - - - - - isNetworkOk_Yes_SequenceFlow - SequenceFlow_8 - - - - - sdncOk_Yeso_ExclusiveGateway - SequenceFlow_53 - - - - - SequenceFlow_53 - SequenceFlow_55 - - - - - SequenceFlow_47 - SequenceFlow_22 - - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${CRENWKI_createDBRequest} - - - application/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_22 - SequenceFlow_19 - - - - - - - - - - - - - - SequenceFlow_25 - SequenceFlow_18 - - - - SequenceFlow_18 - - - SequenceFlow_55 - sdncOk_No_ExclusiveGateway - SequenceFlow_4 - - - - - isRollbackOn_NoNetwork_SequenceFlow - isPONR_Yes_SequenceFlow - SequenceFlow_4 - SequenceFlow_47 - - - - SequenceFlow_19 - SequenceFlow_25 - - - - - - - - - - - http-connector - - ${CRENWKI_createNetworkRequest} - ${URN_mso_adapters_network_rest_endpoint} - - - #{BasicAuthHeaderValuePO} - application/xml - - - POST - ${statusCode} - ${response} - - - - SequenceFlow_61 - SequenceFlow_59 - - - - - SequenceFlow_13 - SequenceFlow_35 - - - - - SequenceFlow_35 - SequenceFlow_46 - - - - - SequenceFlow_46 - SequenceFlow_37 - - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${CRENWKI_createDBRequest} - - - application/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_37 - SequenceFlow_27 - - - - - - - - - - - - - - SequenceFlow_29 - SequenceFlow_17 - - - - SequenceFlow_17 - - - - SequenceFlow_10 - SequenceFlow_14 - - - - - SequenceFlow_10 - - - - - SequenceFlow_14 - - - - SequenceFlow_1 - SequenceFlow_7 - - - - - SequenceFlow_7 - link - - - - - - - - - - - - - - link - SequenceFlow_3 - - - siFoundYes - SequenceFlow_6 - - - - - - SequenceFlow_3 - siFoundYes - siFoundNo - - - - - - - siFoundNo - SequenceFlow_30 - - - - - SequenceFlow_30 - - - - SequenceFlow_16 - SequenceFlow_15 - - - - - SequenceFlow_15 - SequenceFlow_38 - - - - - SequenceFlow_20 - SequenceFlow_61 - - - - - SequenceFlow_38 - SequenceFlow_20 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateServiceInstanceInfra.bpmn b/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateServiceInstanceInfra.bpmn deleted file mode 100644 index 46faf80702..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateServiceInstanceInfra.bpmn +++ /dev/null @@ -1,466 +0,0 @@ - - - - - isReturnCode404_Yes_SequenceFlow - SequenceFlow_46 - - - - - - SequenceFlow_47 - SequenceFlow_22 - - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${CRESI_createDBInfraErrorRequest} - - - application/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_22 - SequenceFlow_19 - - - - SequenceFlow_19 - SequenceFlow_25 - - - - - SequenceFlow_25 - SequenceFlow_33 - - - - - - - - - - - - - - - SequenceFlow_33 - SequenceFlow_18 - - - - SequenceFlow_18 - - - SequenceFlow_47 - - - - - - SequenceFlow_46 - SequenceFlow_4 - - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${CRESI_createDBRequest} - - - application/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_4 - SequenceFlow_27 - - - - SequenceFlow_27 - SequenceFlow_29 - - - - - - - - - - - - - - - SequenceFlow_29 - SequenceFlow_8 - - - - SequenceFlow_8 - - - SequenceFlow_1 - SequenceFlow_7 - - - - - SequenceFlow_9 - isReturnCode404_No_SequenceFlow - isReturnCode404_Yes_SequenceFlow - - - - - - - SequenceFlow_6 - SequenceFlow_9 - - - - - SequenceFlow_24 - SequenceFlow_6 - - - - - isReturnCode404_No_SequenceFlow - - - - SequenceFlow_7 - SequenceFlow_24 - - - - - - SequenceFlow_2 - - - - SequenceFlow_5 - - - - SequenceFlow_2 - SequenceFlow_5 - - - - - - SequenceFlow_1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateVnfInfra.bpmn b/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateVnfInfra.bpmn deleted file mode 100644 index 79d39cae7d..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateVnfInfra.bpmn +++ /dev/null @@ -1,463 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_1 - SequenceFlow_2 - - - - - SequenceFlow_2 - SequenceFlow_3 - - - - - notFound - SequenceFlow_6 - - - - - - - - - - - - - - - SequenceFlow_3 - SequenceFlow_4 - - - - SequenceFlow_4 - notFound - found - - - - - - - SequenceFlow_7 - vnfExistYes - vnfExistNo - - - - - - - - - - - - - - - - found - SequenceFlow_7 - - - - vnfExistYes - SequenceFlow_10 - - - - - SequenceFlow_6 - - - - SequenceFlow_10 - - - - vnfExistNo - SequenceFlow_11 - - - - - - - - - - - - - SequenceFlow_11 - SequenceFlow_5 - - - - - SequenceFlow_8 - SequenceFlow_9 - - - - - SequenceFlow_9 - - - SequenceFlow_8 - - - - - - - - - - - - SequenceFlow_13 - SequenceFlow_14 - - - - SequenceFlow_15 - SequenceFlow_13 - - - - - SequenceFlow_14 - - - - SequenceFlow_12 - SequenceFlow_15 - - - - - SequenceFlow_12 - - - - - - SequenceFlow_5 - SequenceFlow_16 - - - - - SequenceFlow_17 - - - - - - - - - - SequenceFlow_16 - SequenceFlow_17 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteNetworkInstanceInfra.bpmn b/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteNetworkInstanceInfra.bpmn deleted file mode 100644 index fc6d7f5cb1..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteNetworkInstanceInfra.bpmn +++ /dev/null @@ -1,1007 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_14 - SequenceFlow_6 - - - - - - - - - - - - - - SequenceFlow_11 - SequenceFlow_12 - - - - - - - sdncTopoDeleteYes_SequenceFlow - SequenceFlow_18 - - - - SequenceFlow_12 - SequenceFlow_5 - - - - - SequenceFlow_8 - - - - - SequenceFlow_5 - sdncTopoDeleteNo_SequenceFlow - sdncTopoDeleteYes_SequenceFlow - - - SequenceFlow_8 - sdncTopoDeleteNo_SequenceFlow - - - - - - - - - - - - - - - - - - - - SequenceFlow_23 - - - - - SequenceFlow_23 - isRollbackOnNo_SequenceFlow - isRollbackOnYes_SequenceFlow - - - - - - - isRollbackOnYes_SequenceFlow - isPONR_No_SequenceFlow - isPONR_Yes_SequenceFlow - - - - - - - SequenceFlow_10 - SequenceFlow_25 - - - - - - - - - - - - - - - SequenceFlow_25 - SequenceFlow_26 - - - - SequenceFlow_26 - - - isPONR_No_SequenceFlow - isSdncOk_Yes_SequenceFlow - isSdncOk_No_SequenceFlow - - - - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${DELNWKI_deleteDBRequest} - - - application/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_4 - SequenceFlow_10 - - - - SequenceFlow_21 - SequenceFlow_4 - - - - - isRollbackOnNo_SequenceFlow - SequenceFlow_38 - SequenceFlow_21 - - - - isPONR_Yes_SequenceFlow - isSdncOk_No_SequenceFlow - SequenceFlow_19 - SequenceFlow_38 - - - - isSdncOk_Yes_SequenceFlow - SequenceFlow_19 - - - - - - isRelationshipExistNo_SequenceFlow - querySuccessYes_SequenceFlow - querySuccessNo_SequenceFlow - - - - - - - querySuccessNo_SequenceFlow - isReturnCode404_No_SequenceFlow - isReturnCode404_Yes_SequenceFlow - - - - - - - isReturnCode404_No_SequenceFlow - - - - querySuccessYes_SequenceFlow - isResponseEmptyNo_SequenceFlow - isResponseEmptyYes_SequenceFlow - - - - - - - isReturnCode404_Yes_SequenceFlow - isResponseEmptyYes_SequenceFlow - silentSuccess_SequenceFlow - - - - silentSuccess_SequenceFlow - SequenceFlow_9 - - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${DELNWKI_deleteDBRequest} - - - application/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_9 - SequenceFlow_40 - - - - SequenceFlow_40 - SequenceFlow_41 - - - - - - - - - - - - - - - SequenceFlow_41 - SequenceFlow_24 - - - - SequenceFlow_24 - - - isResponseEmptyNo_SequenceFlow - SequenceFlow_30 - - - - - SequenceFlow_6 - isRelationshipExistNo_SequenceFlow - isRelationshipExistYes_SequenceFlow - - - - - - - isRelationshipExistYes_SequenceFlow - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${DELNWKI_deleteDBRequest} - - - application/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_18 - SequenceFlow_27 - - - - SequenceFlow_27 - SequenceFlow_29 - - - - - - - - - - - - - - - SequenceFlow_29 - SequenceFlow_35 - - - - SequenceFlow_35 - - - SequenceFlow_20 - SequenceFlow_11 - - - - - SequenceFlow_2 - SequenceFlow_20 - - - - - SequenceFlow_30 - SequenceFlow_15 - - - - - SequenceFlow_15 - SequenceFlow_2 - - - - - - SequenceFlow_13 - - - - SequenceFlow_17 - - - SequenceFlow_13 - SequenceFlow_17 - - - - - - - SequenceFlow_1 - SequenceFlow_7 - - - - - SequenceFlow_7 - SequenceFlow_14 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteServiceInstanceInfra.bpmn b/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteServiceInstanceInfra.bpmn deleted file mode 100644 index 7a5c30a170..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteServiceInstanceInfra.bpmn +++ /dev/null @@ -1,554 +0,0 @@ - - - - - - SequenceFlow_47 - SequenceFlow_22 - - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${DELSI_createDBInfraErrorRequest} - - - application/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_22 - SequenceFlow_19 - - - - SequenceFlow_19 - SequenceFlow_25 - - - - - SequenceFlow_25 - SequenceFlow_33 - - - - - - - - - - - - - - - SequenceFlow_33 - SequenceFlow_18 - - - - SequenceFlow_18 - - - SequenceFlow_47 - - - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${DELSI_createDBRequest} - - - application/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_4 - SequenceFlow_27 - - - - SequenceFlow_27 - SequenceFlow_29 - - - - - - - - - - - - - - - SequenceFlow_29 - SequenceFlow_8 - - - - SequenceFlow_8 - - - SequenceFlow_1 - SequenceFlow_7 - - - - - SequenceFlow_7 - SequenceFlow_24 - - - - - - SequenceFlow_2 - - - - SequenceFlow_5 - - - - SequenceFlow_2 - SequenceFlow_5 - - - - - - SequenceFlow_6 - isReturnCode404_No_SequenceFlow - isReturnCode404_Yes_SequenceFlow - - - - - - isReturnCode404_Yes_SequenceFlow - SequenceFlow_10 - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${DELSI_createDBRequest} - - - application/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_10 - SequenceFlow_11 - - - SequenceFlow_11 - SequenceFlow_12 - - - - SequenceFlow_13 - - - - - - - - - - - SequenceFlow_12 - SequenceFlow_13 - - - - - - - SequenceFlow_1 - - - - - - - - - - - - - - - SequenceFlow_24 - SequenceFlow_6 - - - SequenceFlow_46 - SequenceFlow_4 - - - - - - - - - - - SequenceFlow_14 - SequenceFlow_46 - - - - isReturnCode404_No_SequenceFlow - SequenceFlow_14 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteVnfInfra.bpmn b/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteVnfInfra.bpmn deleted file mode 100644 index 28d005c144..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteVnfInfra.bpmn +++ /dev/null @@ -1,458 +0,0 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_2 - SequenceFlow_3 - - - - SequenceFlow_1 - SequenceFlow_2 - - - - - - - - - - - - - - - SequenceFlow_3 - SequenceFlow_5 - - - - SequenceFlow_5 - vnfFound - notFound - - - - - - - vnfFound - SequenceFlow_4 - - - - - notFound - - - - SequenceFlow_4 - inUse - notInUse - - - - - - - inUse - SequenceFlow_8 - - - - - - - - - - - - - notInUse - SequenceFlow_9 - - - SequenceFlow_8 - - - - - - SequenceFlow_15 - SequenceFlow_16 - - - - - - - - - - SequenceFlow_16 - SequenceFlow_17 - - - - SequenceFlow_17 - - - - SequenceFlow_14 - - - - - SequenceFlow_14 - SequenceFlow_15 - - - - - - - SequenceFlow_19 - - - SequenceFlow_18 - - - - - SequenceFlow_18 - SequenceFlow_19 - - - - - - SequenceFlow_9 - SequenceFlow_12 - SequenceFlow_10 - - - - SequenceFlow_12 - - - - - SequenceFlow_10 - SequenceFlow_6 - - - - - - - - - - - SequenceFlow_6 - SequenceFlow_7 - - - - SequenceFlow_7 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn b/bpmn/MSOGammaBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn deleted file mode 100644 index 158c4b7766..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn +++ /dev/null @@ -1,1024 +0,0 @@ - - - - - SequenceFlow_18 - SequenceFlow_2 - - - - - SequenceFlow_18 - - - - - SequenceFlow_2 - SequenceFlow_45 - SequenceFlow_46 - - - - - SequenceFlow_45 - if_notifcationURLExists - SequenceFlow_40 - - - - - - - if_notifcationURLExists - SequenceFlow_87 - SequenceFlow_73 - - - - - - - - - ${CMSO_updateRequestResponse} - - - - SequenceFlow_19 - - - - SequenceFlow_19 - - - - - - SequenceFlow_58 - SequenceFlow_59 - Build Error Message @@@@" -import com.att.bpm.scripts.* -def buildDataErrorMessage = new CompleteMsoProcess() -buildDataErrorMessage.buildDataError(execution, "Complete --updateFinal NotifyAck Status Success-- Failed")]]> - - - - - - soap-http-connector - - ${URN_mso_adapters_db_endpoint} - - - - application/soap+xml - - - POST - - ${statusCode} - - - - SequenceFlow_11 - SequenceFlow_53 - - - - SequenceFlow_44 - - - SequenceFlow_53 - SequenceFlow_54 - SequenceFlow_58 - - - - - - - SequenceFlow_44 - - - - - SequenceFlow_63 - SequenceFlow_15 - SequenceFlow_70 - - - - SequenceFlow_70 - SequenceFlow_11 - - - - - SequenceFlow_59 - - - - SequenceFlow_60 - SequenceFlow_61 - SequenceFlow_63 - - - - - - - SequenceFlow_61 - SequenceFlow_62 - Build Error Message @@@@" -import com.att.bpm.scripts.* -def buildDataErrorMessage = new CompleteMsoProcess() -buildDataErrorMessage.buildDataError(execution, "Complete -- Update Final Notify Ack Status -- Failed")]]> - - - - SequenceFlow_62 - - - - SequenceFlow_29 - SequenceFlow_92 - SequenceFlow_15 - - - - SequenceFlow_20 - SequenceFlow_29 - - - - - - - http-connector - - - - - text/xml - - - - - NOTIFY CCD Payload @@@@" -import com.att.bpm.scripts.* -def notifyCCDSuccess = new CompleteMsoProcess() -return notifyCCDSuccess.notifyCCDSuccessPayload(execution)]]> - - POST - - ${statusCode} - - - - SequenceFlow_16 - SequenceFlow_20 - - - - - - soap-http-connector - - ${URN_csi_networkstatus_endpoint} - POST - - - application/soap+xml - - - - - - ${response} - ${statusCode} - - - - - - - SequenceFlow_12 - SequenceFlow_65 - - - - SequenceFlow_73 - SequenceFlow_12 - SequenceFlow_16 - - - - - - - SequenceFlow_65 - SequenceFlow_92 - - - - - SequenceFlow_4 - - - - - - - soap-http-connector - - ${URN_mso_adapters_db_endpoint} - - UpdateFinalNotifyAckStatus" -import com.att.bpm.scripts.* -def updateFinalNotifyAckStatus= new CompleteMsoProcess() -return updateFinalNotifyAckStatus.updateFinalNotifyAckStatusPayload(execution)]]> - - - - application/soap+xml - - - POST - - ${statusCode} - - - - SequenceFlow_87 - SequenceFlow_60 - - - - SequenceFlow_4 - - - SequenceFlow_21 - - - SequenceFlow_7 - SequenceFlow_24 - SequenceFlow_39 - - - - SequenceFlow_9 - - - - SequenceFlow_72 - SequenceFlow_10 - - - - - SequenceFlow_13 - - - - SequenceFlow_46 - SequenceFlow_72 - SequenceFlow_81 - - - - - - - SequenceFlow_25 - SequenceFlow_13 - Build Error Message @@@@" -import com.att.bpm.scripts.* -def buildDataErrorMessage = new CompleteMsoProcess() -buildDataErrorMessage.buildDataError(execution, "Complete --Update DB status to SUCCESS-- Failed")]]> - - - - SequenceFlow_81 - SequenceFlow_49 - - - - - - - soap-http-connector - - ${URN_mso_adapters_db_endpoint} - - - - application/soap+xml - - - POST - - ${statusCode} - - - - SequenceFlow_10 - SequenceFlow_6 - - - - SequenceFlow_14 - - - - - SequenceFlow_1 - SequenceFlow_9 - Build Error Message @@@@" -//println "CMSO_updateRequestResponse IS --> " + execution.getVariable("CMSO_updateRequestResponse") -import com.att.bpm.scripts.* -def buildDataErrorMessage = new CompleteMsoProcess() -buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB status to SUCCESS -- Failed")]]> - - - - SequenceFlow_23 - SequenceFlow_24 - SequenceFlow_25 - - - - - - - SequenceFlow_6 - SequenceFlow_7 - SequenceFlow_1 - - - - - - - - - soap-http-connector - - ${URN_mso_adapters_db_endpoint} - - - - application/soap+xml - - - POST - - ${statusCode} - - - - SequenceFlow_49 - SequenceFlow_23 - - - - SequenceFlow_14 - - - SequenceFlow_21 - - - - - SequenceFlow_40 - SequenceFlow_54 - SequenceFlow_32 - - - - SequenceFlow_32 - SequenceFlow_39 - SequenceFlow_33 - - - - SequenceFlow_33 - SequenceFlow_17 - Complete MSO Process Done SUCCESSFULLY" -import com.att.bpm.scripts.* -def postProcessResponseData = new CompleteMsoProcess() -postProcessResponseData.postProcessResponse(execution) -println "CompleteMsoProcess Response -->" + "\n" + execution.getVariable("CompletionHandlerResponse")]]> - - - - SequenceFlow_17 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/FalloutHandler.bpmn b/bpmn/MSOGammaBPMN/src/main/resources/subprocess/FalloutHandler.bpmn deleted file mode 100644 index e5856bb14c..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/FalloutHandler.bpmn +++ /dev/null @@ -1,1102 +0,0 @@ - - - - - SequenceFlow_12 - SequenceFlow_2 - SequenceFlow_24 - - - - - SequenceFlow_54 - SequenceFlow_55 - SequenceFlow_56 - - - - - - - SequenceFlow_40 - SequenceFlow_41 - SequenceFlow_42 - - - - - - - - - soap-http-connector - - ${URN_csi_networkstatus_endpoint} - POST - - - application/soap+xml - - - - - - ${response} - ${statusCode} - - - - SequenceFlow_55 - SequenceFlow_40 - - - - SequenceFlow_3 - SequenceFlow_4 - SequenceFlow_54 - - - - - SequenceFlow_41 - SequenceFlow_45 - SequenceFlow_62 - - - - SequenceFlow_62 - SequenceFlow_39 - SequenceFlow_63 - - - - SequenceFlow_42 - SequenceFlow_50 - SequenceFlow_45 - - - - - SequenceFlow_50 - - - - - - - http-connector - - - - - text/xml - - - - POST - - NOTIFY CCD" -import com.att.bpm.scripts.* -def notifyCCD = new FalloutHandler() -return notifyCCD.notifyCCDFailurePayload(execution)]]> - - - ${statusCode} - - - - SequenceFlow_56 - SequenceFlow_52 - - - - SequenceFlow_75 - SequenceFlow_48 - SequenceFlow_39 - - - - SequenceFlow_52 - SequenceFlow_75 - SequenceFlow_47 - - - - - - - SequenceFlow_47 - SequenceFlow_51 - SequenceFlow_48 - - - - - SequenceFlow_51 - - - - - SequenceFlow_2 - SequenceFlow_3 - SequenceFlow_23 - - - - - - - SequenceFlow_10 - SequenceFlow_12 - - - - - SequenceFlow_10 - - - - SequenceFlow_63 - SequenceFlow_13 - SequenceFlow_18 - - - - - - soap-http-connector - - ${URN_mso_adapters_db_endpoint} - POST - - - application/soap+xml - - - - update Request" -import com.att.bpm.scripts.* -def updateRequest= new FalloutHandler() -return updateRequest.updateRequestPayload(execution)]]> - - - ${statusCode} - - - - SequenceFlow_18 - SequenceFlow_19 - - - - SequenceFlow_74 - - - - SequenceFlow_37 - SequenceFlow_38 - SequenceFlow_8 - - - - SequenceFlow_8 - SequenceFlow_9 - - - - - SequenceFlow_23 - SequenceFlow_22 - SequenceFlow_38 - - - - SequenceFlow_24 - SequenceFlow_25 - SequenceFlow_26 - - - - - - - - - soap-http-connector - - ${URN_mso_adapters_db_endpoint} - POST - - - application/soap+xml - - - - update Request Gamma" -import com.att.bpm.scripts.* -def updateRequestGamma= new FalloutHandler() -return updateRequestGamma.updateRequestGammaPayload(execution)]]> - - - ${statusCode} - - - - SequenceFlow_25 - SequenceFlow_29 - - - - SequenceFlow_72 - - - - SequenceFlow_35 - SequenceFlow_36 - SequenceFlow_37 - - - - SequenceFlow_9 - - - SequenceFlow_71 - - - - - - - soap-http-connector - - ${URN_mso_adapters_db_endpoint} - POST - - - application/soap+xml - - - - update Response Status to pending ..." -import com.att.bpm.scripts.* -def updateResponseStatus= new FalloutHandler() -return updateResponseStatus.updateResponseStatusPayload(execution)]]> - - - ${statusCode} - - - - SequenceFlow_4 - SequenceFlow_43 - - - - - - SequenceFlow_19 - SequenceFlow_22 - SequenceFlow_68 - - - - - - - SequenceFlow_68 - SequenceFlow_74 - SequenceFlow_77 - - - - - SequenceFlow_77 - - - - SequenceFlow_78 - - - - SequenceFlow_71 - SequenceFlow_6 - SequenceFlow_78 - - - - SequenceFlow_43 - SequenceFlow_6 - SequenceFlow_13 - - - - - - - - SequenceFlow_72 - SequenceFlow_31 - SequenceFlow_79 - - - - - SequenceFlow_79 - - - - SequenceFlow_29 - SequenceFlow_31 - SequenceFlow_35 - - - - - - - SequenceFlow_32 - SequenceFlow_80 - SequenceFlow_73 - - - - - - - soap-http-connector - - ${URN_mso_adapters_db_endpoint} - POST - - - application/soap+xml - - - - update Request Infra" -import com.att.bpm.scripts.* -def updateRequestInfra= new FalloutHandler() -return updateRequestInfra.updateRequestInfraPayload(execution)]]> - - - ${statusCode} - - - - SequenceFlow_26 - SequenceFlow_30 - - - - SequenceFlow_30 - SequenceFlow_32 - SequenceFlow_36 - - - - - - - SequenceFlow_80 - - - - - SequenceFlow_73 - - - - - SequenceFlow_15 - SequenceFlow_14 - - - - - SequenceFlow_14 - - - SequenceFlow_15 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn b/bpmn/MSOGammaBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn deleted file mode 100644 index fc9f0a114c..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn +++ /dev/null @@ -1,810 +0,0 @@ - - - - - SequenceFlow_15 - badSynchronousResponse - goodSynchronousResponse - - - - - - - badSynchronousResponse - Exception - - - - - - - soap-http-connector - - ${URN_mso_adapters_sdnc_endpoint} - POST - - - application/soap+xml - #{BasicAuthHeaderValue} - - - ${sdncAdapterRequest} - ${response} - ${statusCode} - - - - SequenceFlow_8 - SequenceFlow_15 - - - - Exception - - - - SequenceFlow_1 - - - - - - - - - massageSDNCRequestScript - - - - - - SequenceFlow_1 - SequenceFlow_8 - - - - - SequenceFlow_9 - timeOut - SequenceFlow_29 - - - SequenceFlow_29 - SequenceFlow_14 - - - - - SequenceFlow_14 - noTimeoutError - SequenceFlow_19 - - - - - - - SequenceFlow_2 - SequenceFlow_9 - - SequenceFlow_16 - - - - SequenceFlow_18 - - - - SequenceFlow_18 - SequenceFlow_16 - - - - - - - timeOut - - ${sdncTimeoutValue} - - - - - SequenceFlow_19 - Error - - - - - Error - - - - goodSynchronousResponse - SequenceFlow_26 - SequenceFlow_2 - - - - - noTimeoutError - Done - SequenceFlow_30 - - - - - - - Done - SequenceFlow_17 - - - - - - - - ${sdncAdapterWorkflowResponse} - - - - SequenceFlow_17 - - - - SequenceFlow_30 - SequenceFlow_21 - SequenceFlow_26 - - - - - - SequenceFlow_22 - - - - - SequenceFlow_22 - SequenceFlow_27 - - - - - SequenceFlow_27 - - - - SequenceFlow_11 - SequenceFlow_5 - SequenceFlow_7 - - - - #{execution.getVariable('source').equals('CCD')} - - - SequenceFlow_33 - - - SequenceFlow_7 - SequenceFlow_10 - - - - - SequenceFlow_5 - SequenceFlow_3 - - - - - SequenceFlow_12 - SequenceFlow_20 - - - - - SequenceFlow_24 - - - SequenceFlow_13 - - - - - soap-http-connector - - ${URN_mso_adapters_db_endpoint} - POST - - - application/soap+xml - - - ${dbUpdateInterimStageCompletion} - - ${statusCode} - - - - SequenceFlow_20 - SequenceFlow_33 - - - - - http-connector - - - - - text/xml - - - - - POST - - ${statusCode} - - - - SequenceFlow_10 - SequenceFlow_13 - - - - - - soap-http-connector - - ${URN_csi_networkstatus_endpoint} - POST - - - application/soap+xml - - - ${csiSendManagedNetworkNotificationRequest} - ${response} - ${statusCode} - - - - SequenceFlow_3 - SequenceFlow_24 - - - - SequenceFlow_4 - SequenceFlow_11 - SequenceFlow_12 - - - - - SequenceFlow_21 - SequenceFlow_31 - - - - - SequenceFlow_31 - SequenceFlow_4 - SequenceFlow_23 - - - - - - - SequenceFlow_23 - - - SequenceFlow_28 - - - - SequenceFlow_28 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/DoDeleteVfModule.bpmn b/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/DoDeleteVfModule.bpmn deleted file mode 100644 index 06aeafb926..0000000000 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/DoDeleteVfModule.bpmn +++ /dev/null @@ -1,287 +0,0 @@ - - - - - SequenceFlow_25 - SequenceFlow_28 - - - - - - - - - - SequenceFlow_28 - SequenceFlow_31 - - - - - - - - - - - SequenceFlow_42 - SequenceFlow_4 - - - - - - - - - - - - - SequenceFlow_32 - SequenceFlow_33 - - - - SequenceFlow_4 - SequenceFlow_16 - - - - - SequenceFlow_31 - SequenceFlow_32 - - - - - - - - - - - - - SequenceFlow_16 - SequenceFlow_25 - - - - SequenceFlow_35 - - - - - - - - - SequenceFlow_34 - SequenceFlow_35 - - - - SequenceFlow_2 - SequenceFlow_34 - - - - - SequenceFlow_33 - SequenceFlow_2 - - - - - SequenceFlow_1 - SequenceFlow_12 - - - - - SequenceFlow_12 - SequenceFlow_42 - - - - - SequenceFlow_1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/META-INF/MANIFEST.MF b/bpmn/MSOInfrastructureBPMN/WebContent/META-INF/MANIFEST.MF similarity index 100% rename from bpmn/MSOGammaBPMN/META-INF/MANIFEST.MF rename to bpmn/MSOInfrastructureBPMN/WebContent/META-INF/MANIFEST.MF diff --git a/bpmn/MSOGammaBPMN/pom.xml b/bpmn/MSOInfrastructureBPMN/pom.xml similarity index 76% rename from bpmn/MSOGammaBPMN/pom.xml rename to bpmn/MSOInfrastructureBPMN/pom.xml index 26ea278c53..21eb490f6e 100644 --- a/bpmn/MSOGammaBPMN/pom.xml +++ b/bpmn/MSOInfrastructureBPMN/pom.xml @@ -6,8 +6,7 @@ 1.1.0-SNAPSHOT 4.0.0 - org.openecomp.mso - MSOGammaBPMN + MSOInfrastructureBPMN war @@ -17,20 +16,50 @@ maven-war-plugin 2.3 - 1.7 - 1.7 false - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - - + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + default-jar + package + + jar + + + + org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.class + META-INF/ + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 + + + + attach-artifact + + package + + + + ${project.build.directory}/${project.artifactId}-${project.version}.jar + jar + + + + + + org.apache.cxf cxf-codegen-plugin @@ -94,7 +123,24 @@ - + + + org.apache.maven.plugins + maven-dependency-plugin + + + maven-failsafe-plugin + 2.6 + + + + integration-test + verify + + + + + @@ -246,12 +286,24 @@ MSOCoreBPMN ${project.version} + + org.openecomp.mso + MSOCommonBPMN + ${project.version} + + + org.openecomp.mso + MSOCommonBPMN + ${project.version} + tests + test + org.openecomp.mso MSOCoreBPMN ${project.version} - test + tests test @@ -265,18 +317,24 @@ spring-web 4.3.2.RELEASE - + + org.openecomp.mso + MSOMockServer + ${project.version} + test + classes + org.openecomp.mso MSORESTClient ${project.version} - com.github.tomakehurst wiremock 1.56 + test standalone @@ -321,5 +379,11 @@ + + javax.servlet + javax.servlet-api + 3.0.1 + provided + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericMacroServiceNetworkVnf.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericMacroServiceNetworkVnf.groovy new file mode 100644 index 0000000000..b48e07f158 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericMacroServiceNetworkVnf.groovy @@ -0,0 +1,749 @@ +/*- + * ============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 groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.json.JSONObject; +import org.json.JSONArray; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; + +/** + * This groovy class supports the CreateGenericMacroServiceNetworkVnf.bpmn process. + * + */ +public class CreateGenericMacroServiceNetworkVnf extends AbstractServiceTaskProcessor { + + String Prefix="CREVAS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtils() + + /** + * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. + * @param execution + */ + public InitializeProcessVariables(Execution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable("createGenericMacroServiceNetworkVnfRequest", "") + execution.setVariable("globalSubscriberId", "") + execution.setVariable("serviceInstanceName", "") + execution.setVariable("msoRequestId", "") + execution.setVariable("CREVAS_NetworksCreatedCount", 0) + execution.setVariable("CREVAS_VnfsCreatedCount", 0) + execution.setVariable("productFamilyId", "") + + + //TODO + execution.setVariable("sdncVersion", "1702") + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. + * @param execution + */ + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside preProcessRequest CreateGenericMacroServiceNetworkVnf Request ***** ", isDebugEnabled) + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + // check for incoming json message/input + String createGenericMacroServiceNetworkVnfRequest = execution.getVariable("bpmnRequest") + utils.logAudit(createGenericMacroServiceNetworkVnfRequest) + execution.setVariable("createGenericMacroServiceNetworkVnfRequest", createGenericMacroServiceNetworkVnfRequest); + println 'createGenericMacroServiceNetworkVnfRequest - ' + createGenericMacroServiceNetworkVnfRequest + + // extract requestId + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { + serviceInstanceId = UUID.randomUUID().toString() + utils.log("DEBUG", " Generated new Service Instance: " + serviceInstanceId , isDebugEnabled) + } else { + utils.log("DEBUG", "Using provided Service Instance ID: " + serviceInstanceId , isDebugEnabled) + } + + serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + String requestAction = execution.getVariable("requestAction") + execution.setVariable("requestAction", requestAction) + + String source = jsonUtil.getJsonValue(createGenericMacroServiceNetworkVnfRequest, "requestDetails.requestInfo.source") + if ((source == null) || (source.isEmpty())) { + execution.setVariable("source", "VID") + } else { + execution.setVariable("source", source) + } + + // extract globalSubscriberId + String globalSubscriberId = jsonUtil.getJsonValue(createGenericMacroServiceNetworkVnfRequest, "requestDetails.subscriberInfo.globalSubscriberId") + + // verify element global-customer-id is sent from JSON input, throw exception if missing + if ((globalSubscriberId == null) || (globalSubscriberId.isEmpty())) { + String dataErrorMessage = " Element 'globalSubscriberId' is missing. " + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + execution.setVariable("globalCustomerId", globalSubscriberId) + } + + // extract subscriptionServiceType + String subscriptionServiceType = jsonUtil.getJsonValue(createGenericMacroServiceNetworkVnfRequest, "requestDetails.requestParameters.subscriptionServiceType") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled) + + String suppressRollback = jsonUtil.getJsonValue(createGenericMacroServiceNetworkVnfRequest, "requestDetails.requestInfo.suppressRollback") + execution.setVariable("disableRollback", suppressRollback) + utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled) + + String productFamilyId = jsonUtil.getJsonValue(createGenericMacroServiceNetworkVnfRequest, "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${requestId} + CREATE + ${source} + """ + + execution.setVariable("CREVAS_requestInfo", requestInfo) + + utils.log("DEBUG", " ***** Completed preProcessRequest CreateGenericMacroServiceNetworkVnf Request ***** ", isDebugEnabled) + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex){ + String exceptionMessage = "Bpmn error encountered in CreateGenericMacroServiceNetworkVnf flow. Unexpected from method preProcessRequest() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void sendSyncResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String requestId = execution.getVariable("mso-request-id") + + // RESTResponse (for API Handler (APIH) Reply Task) + String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + + utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in CreateGenericMacroServiceNetworkVnf flow. Unexpected from method sendSyncResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareCreateServiceInstance(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside prepareCreateServiceInstance of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) + + String createGenericMacroServiceNetworkVnfRequest = execution.getVariable("createGenericMacroServiceNetworkVnfRequest") + String serviceModelInfo = jsonUtil.getJsonValue(createGenericMacroServiceNetworkVnfRequest, "requestDetails.modelInfo") + execution.setVariable("serviceModelInfo", serviceModelInfo) + + String serviceInputParams = jsonUtil.getJsonValue(createGenericMacroServiceNetworkVnfRequest, "requestDetails.requestParameters") + execution.setVariable("serviceInputParams", serviceInputParams) + + String serviceInstanceName = jsonUtil.getJsonValue(createGenericMacroServiceNetworkVnfRequest, "requestDetails.requestInfo.instanceName") + execution.setVariable("serviceInstanceName", serviceInstanceName) + + utils.log("DEBUG", " ***** Completed prepareCreateServiceInstance of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericMacroServiceNetworkVnf flow. Unexpected Error from method prepareCreateService() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + public void postProcessServiceInstanceCreate (Execution execution){ + def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' +'execution=' + execution.getId() +')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + String source = execution.getVariable("source") + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + + try { + + String payload = """ + + + + + ${requestId} + BPEL + ${serviceInstanceId} + ${serviceInstanceName} + + + + """ + execution.setVariable("CREVAS_setUpdateDbInstancePayload", payload) + utils.logAudit("CREVAS_setUpdateDbInstancePayload: " + payload) + logDebug('Exited ' + method, isDebugLogEnabled) + //println("CMSO_updateDBStatusToSuccessPayload --> " + execution.getVariable("CMSO_updateDBStatusToSuccessPayload")) + + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + } + } + + + public void callDBCatalog (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + utils.log("DEBUG", " ***** Inside callDBCatalog() of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) + + try { + + // get variable within incoming json + String createGenericMacroServiceNetworkVnfRequest = execution.getVariable("createGenericMacroServiceNetworkVnfRequest"); + + String catalog_db_endpoint = execution.getVariable("URN_mso_catalog_db_endpoint") + utils.log("DEBUG", "catalog_db_endpoint: "+catalog_db_endpoint, isDebugEnabled) + + String serviceModelInvariantId = jsonUtil.getJsonValue(createGenericMacroServiceNetworkVnfRequest, "requestDetails.modelInfo.modelInvariantId") + String serviceModelVersion = jsonUtil.getJsonValue(createGenericMacroServiceNetworkVnfRequest, "requestDetails.modelInfo.modelVersion") + utils.log("DEBUG", "getting network list ", isDebugEnabled) + + JSONArray networkList = catalogDbUtils.getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(catalog_db_endpoint, serviceModelInvariantId, serviceModelVersion) + + //utils.log("DEBUG", "got network list: "+ networkList.toString(), isDebugEnabled) + execution.setVariable("networkList", networkList) + execution.setVariable("networkListString", networkList.toString()) + + if (networkList != null && networkList.length() > 0) { + + execution.setVariable("CREVAS_NetworksCount", networkList.length()) + utils.log("DEBUG", "networks to create: "+ networkList.length(), isDebugEnabled) + } else { + execution.setVariable("CREVAS_NetworksCount", 0) + utils.log("DEBUG", "no networks to create based upon Catalog DB response", isDebugEnabled) + } + + // VNFs + JSONArray vnfList = catalogDbUtils.getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(catalog_db_endpoint, serviceModelInvariantId, serviceModelVersion) + execution.setVariable("vnfList", vnfList) + + String vnfModelInfoString = "" + if (vnfList != null && vnfList.length() > 0) { + execution.setVariable("CREVAS_VNFsCount", vnfList.length()) + utils.log("DEBUG", "vnfs to create: "+ vnfList.length(), isDebugEnabled) + JSONObject vnfModelInfo = vnfList.getJSONObject(0).getJSONObject("modelInfo") + vnfModelInfoString = vnfModelInfo.toString() + } else { + execution.setVariable("CREVAS_VNFsCount", 0) + utils.log("DEBUG", "no vnfs to create based upon Catalog DB response", isDebugEnabled) + } + + execution.setVariable("vnfModelInfo", vnfModelInfoString) + //utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed callDBCatalog() of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in CreateGenericMacroServiceNetworkVnf flow. callDBCatalog() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Generate Network request Section + // ******************************* + public void prepareNetworkCreate (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside preparenNetworkCreate of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) + +// String disableRollback = execution.getVariable("disableRollback") +// def backoutOnFailure = "" +// if(disableRollback != null){ +// if ( disableRollback == true) { +// backoutOnFailure = "false" +// } else if ( disableRollback == false) { +// backoutOnFailure = "true" +// } +// } + //failIfExists - optional + + String createGenericMacroServiceNetworkVnfRequest = execution.getVariable("createGenericMacroServiceNetworkVnfRequest") + + JSONArray networkList = execution.getVariable("networkList") + utils.log("DEBUG", "array networkList: "+ networkList, isDebugEnabled) + + if (networkList == null || networkList.length() < 1){ + networkList = new JSONArray(execution.getVariable("networkListString")) + utils.log("DEBUG", "array from string networkList: "+ networkList, isDebugEnabled) + } + + Integer networksCreatedCount = execution.getVariable("CREVAS_NetworksCreatedCount") + String networkModelInfoString = "" + + if (networkList != null) { + utils.log("DEBUG", " getting model info for network # :" + networksCreatedCount, isDebugEnabled) + JSONObject networkModelInfo = networkList.getJSONObject(networksCreatedCount.intValue()).getJSONObject("modelInfo") + networkModelInfoString = networkModelInfo.toString() + } else { + String exceptionMessage = "Bpmn error encountered in CreateGenericMacroServiceNetworkVnf flow. Unexpected number of networks to create - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + execution.setVariable("networkModelInfo", networkModelInfoString) + utils.log("DEBUG", " networkModelInfoString :" + networkModelInfoString, isDebugEnabled) + +// String networkModelInfo = execution.getVariable("networkModelInfo") + // extract cloud configuration + String lcpCloudRegionId = jsonUtil.getJsonValue(createGenericMacroServiceNetworkVnfRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") + execution.setVariable("lcpCloudRegionId", lcpCloudRegionId) + utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled) + String tenantId = jsonUtil.getJsonValue(createGenericMacroServiceNetworkVnfRequest, "requestDetails.cloudConfiguration.tenantId") + execution.setVariable("tenantId", tenantId) + utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled) + + String sdncVersion = execution.getVariable("sdncVersion") + utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled) + + JSONArray vnfList = execution.getVariable("vnfList") + utils.log("DEBUG", "vnfList: "+ vnfList, isDebugEnabled) + + String vnfModelInfo = execution.getVariable("vnfModelInfo") + utils.log("DEBUG", "vnfModelInfo: "+ vnfModelInfo, isDebugEnabled) + + networkList = execution.getVariable("networkList") + utils.log("DEBUG", "networkList: "+ networkList, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed preparenNetworkCreate of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericMacroServiceNetworkVnf flow. Unexpected Error from method prepareNetworkCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Network request Section -> increment count + // ******************************* + public void validateNetworkCreate (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside validateNetworkCreate of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) + + Integer networksCreatedCount = execution.getVariable("CREVAS_NetworksCreatedCount") + networksCreatedCount++ + + execution.setVariable("CREVAS_NetworksCreatedCount", networksCreatedCount) + + execution.setVariable("DCRENI_rollbackData"+networksCreatedCount, execution.getVariable("DCRENI_rollbackData")) + + utils.log("DEBUG", "networksCreatedCount: "+ networksCreatedCount, isDebugEnabled) + utils.log("DEBUG", "DCRENI_rollbackData N : "+ execution.getVariable("DCRENI_rollbackData"+networksCreatedCount), isDebugEnabled) + + JSONArray vnfList = execution.getVariable("vnfList") + utils.log("DEBUG", "vnfList: "+ vnfList, isDebugEnabled) + + String vnfModelInfo = execution.getVariable("vnfModelInfo") + utils.log("DEBUG", "vnfModelInfo: "+ vnfModelInfo, isDebugEnabled) + + JSONArray networkList = execution.getVariable("networkList") + utils.log("DEBUG", "networkList: "+ networkList, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed validateNetworkCreate of CreateGenericMacroServiceNetworkVnf ***** "+" network # "+networksCreatedCount, isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericMacroServiceNetworkVnf flow. Unexpected Error from method validateNetworkCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Generate Network request Section + // ******************************* + public void prepareVnfAndModulesCreate (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside prepareVnfAndModulesCreate of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) + + // String disableRollback = execution.getVariable("disableRollback") + // def backoutOnFailure = "" + // if(disableRollback != null){ + // if ( disableRollback == true) { + // backoutOnFailure = "false" + // } else if ( disableRollback == false) { + // backoutOnFailure = "true" + // } + // } + //failIfExists - optional + + String createGenericMacroServiceNetworkVnfRequest = execution.getVariable("createGenericMacroServiceNetworkVnfRequest") + String productFamilyId = jsonUtil.getJsonValue(createGenericMacroServiceNetworkVnfRequest, "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + utils.log("DEBUG","productFamilyId: "+ productFamilyId, isDebugEnabled) + + JSONArray vnfList = execution.getVariable("vnfList") + + Integer vnfsCreatedCount = execution.getVariable("CREVAS_VnfsCreatedCount") + String vnfModelInfoString = null; + + if (vnfList != null && vnfList.length() > 0 ) { + utils.log("DEBUG", "getting model info for vnf # " + vnfsCreatedCount, isDebugEnabled) + JSONObject vnfModelInfo1 = vnfList.getJSONObject(0).getJSONObject("modelInfo") + utils.log("DEBUG", "got 0 ", isDebugEnabled) + JSONObject vnfModelInfo = vnfList.getJSONObject(vnfsCreatedCount.intValue()).getJSONObject("modelInfo") + vnfModelInfoString = vnfModelInfo.toString() + } else { + //TODO: vnfList does not contain data. Need to investigate why ... . Fro VIPR use model stored + vnfModelInfoString = execution.getVariable("vnfModelInfo") + } + + utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) + + // extract cloud configuration + String lcpCloudRegionId = jsonUtil.getJsonValue(createGenericMacroServiceNetworkVnfRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") + execution.setVariable("lcpCloudRegionId", lcpCloudRegionId) + utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled) + String tenantId = jsonUtil.getJsonValue(createGenericMacroServiceNetworkVnfRequest, "requestDetails.cloudConfiguration.tenantId") + execution.setVariable("tenantId", tenantId) + utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled) + + String sdncVersion = execution.getVariable("sdncVersion") + utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed prepareVnfAndModulesCreate of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericMacroServiceNetworkVnf flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Vnf request Section -> increment count + // ******************************* + public void validateVnfCreate (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside validateVnfCreate of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) + + Integer vnfsCreatedCount = execution.getVariable("CREVAS_VnfsCreatedCount") + vnfsCreatedCount++ + + execution.setVariable("CREVAS_VnfsCreatedCount", vnfsCreatedCount) + + utils.log("DEBUG", " ***** Completed validateVnfCreate of CreateGenericMacroServiceNetworkVnf ***** "+" vnf # "+vnfsCreatedCount, isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericMacroServiceNetworkVnf flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Network request Section -> decrement count + // ******************************* + public void validateNetworkRollback (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside validateNetworkRollback of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) + + Integer networksCreatedCount = execution.getVariable("CREVAS_NetworksCreatedCount") + networksCreatedCount-- + + execution.setVariable("CREVAS_NetworksCreatedCount", networksCreatedCount) + + execution.setVariable("DCRENI_rollbackData", execution.getVariable("DCRENI_rollbackData"+networksCreatedCount)) + + utils.log("DEBUG", " ***** Completed validateNetworkRollback of CreateGenericMacroServiceNetworkVnf ***** "+" network # "+networksCreatedCount, isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericMacroServiceNetworkVnf flow. Unexpected Error from method validateNetworkRollback() - " + ex.getMessage() + //exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + execution.setVariable("CREVAS_NetworksCreatedCount", 0) + utils.log("ERROR", exceptionMessage, true) + } + } + // ******************************* + // Build DB request Section + // ******************************* +// public void prepareDBRequest (Execution execution) { +// def isDebugEnabled=execution.getVariable("isDebugLogEnabled") +// +// try { +// utils.log("DEBUG", " ***** Inside prepareDBRequest of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) +// +// String requestId = execution.getVariable("CREVAS_requestId") +// String statusMessage = "vIPR ATM Service Instance successfully created." +// String serviceInstanceId = execution.getVariable("CREVAS_serviceInstanceId") +// +// //TODO - verify the format for Service Instance Create, +// String dbRequest = +// """ +// +// +// +// ${requestId} +// BPMN +// ${statusMessage} +// +// COMPLETED +// 100 +// +// ${serviceInstanceId} +// +// +// """ +// +// String buildDeleteDBRequestAsString = utils.formatXml(dbRequest) +// execution.setVariable("CREVAS_createDBRequest", buildDeleteDBRequestAsString) +// utils.logAudit(buildDeleteDBRequestAsString) +// +// utils.log("DEBUG", " ***** Completed prepareDBRequest of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) +// } catch (Exception ex) { +// // try error in method block +// String exceptionMessage = "Bpmn error encountered in CreateGenericMacroServiceNetworkVnf flow. Unexpected Error from method prepareDBRequest() - " + ex.getMessage() +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) +// +// } +// +// } + + + // ***************************************** + // Prepare Completion request Section + // ***************************************** + public void postProcessResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + utils.log("DEBUG", " ***** Inside postProcessResponse of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) + + try { + String source = execution.getVariable("source") + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String msoCompletionRequest = + """ + + ${requestId} + CREATE + ${source} + + Service Instance has been created successfully via macro orchestration + ${serviceInstanceId} + BPMN macro create + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + utils.logAudit(xmlMsoCompletionRequest) + execution.setVariable("CREVAS_Success", true) + execution.setVariable("CREVAS_CompleteMsoProcessRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateServiceInstance flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void preProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** preProcessRollback of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit preProcessRollback of CreateGenericMacroServiceNetworkVnf *** ", isDebugEnabled) + } + + public void postProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessRollback of CreateGenericMacroServiceNetworkVnf ***** ", isDebugEnabled) + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) + execution.setVariable("WorkflowException", workflowException); + } + } catch (BpmnError b) { + utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit postProcessRollback of CreateGenericMacroServiceNetworkVnf *** ", isDebugEnabled) + } + + public void prepareFalloutRequest(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + utils.log("DEBUG", " *** STARTED CreateGenericMacroServiceNetworkVnf prepareFalloutRequest Process *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestInfo = execution.getVariable("CREVAS_requestInfo") + utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled) + + //TODO. hmmm. there is no way to UPDATE error message. +// String errorMessage = wfex.getErrorMessage() +// boolean successIndicator = execution.getVariable("DCRESI_rollbackSuccessful") +// if (successIndicator){ +// errorMessage = errorMessage + ". Rollback successful." +// } else { +// errorMessage = errorMessage + ". Rollback not completed." +// } + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + + execution.setVariable("CREVAS_falloutRequest", falloutRequest) + + } catch (Exception ex) { + utils.log("DEBUG", "Error Occured in CreateGenericMacroServiceNetworkVnf prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateGenericMacroServiceNetworkVnf prepareFalloutRequest Process") + } + utils.log("DEBUG", "*** COMPLETED CreateGenericMacroServiceNetworkVnf prepareFalloutRequest Process ***", isDebugEnabled) + } + + + public void sendSyncError (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside sendSyncError() of CreateServiceInstanceInfra ***** ", isDebugEnabled) + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${errorMessage} + 7000 + """ + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + } catch (Exception ex) { + utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + } + + public void processJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + try{ + utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) + execution.setVariable("CRESI_unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") + }catch(BpmnError b){ + utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + execution.setVariable("CRESI_unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") + } + utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) + } +} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy new file mode 100644 index 0000000000..b9b97c7d12 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy @@ -0,0 +1,453 @@ +/*- + * ============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 groovy.xml.XmlUtil +import groovy.json.* +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.rest.APIResponse + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils + +/** + * This groovy class supports the CreateNetworkInstance.bpmn process. + * + */ +public class CreateNetworkInstance extends AbstractServiceTaskProcessor { + String Prefix="CRENI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public InitializeProcessVariables(Execution execution){ + + execution.setVariable(Prefix + "source", "") + execution.setVariable(Prefix + "Success", false) + + execution.setVariable(Prefix + "CompleteMsoProcessRequest", "") + execution.setVariable(Prefix + "FalloutHandlerRequest", "") + execution.setVariable(Prefix + "isSilentSuccess", false) + + } + + + /** + * This method is executed during the preProcessRequest task of the CreateNetworkInstance.bpmn process. + * @param execution + */ + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the CreateNetworkInstance.bpmn process. + * @param execution + */ + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside preProcessRequest() of CreateNetworkInstance Request ***** ", isDebugEnabled) + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + String sdncVersion = execution.getVariable("sdncVersion") + if (sdncVersion == null || sdncVersion == '1610') { + // 'a-la-cart' default, sdncVersion = '1610' + execution.setVariable("sdncVersion", "1610") + String bpmnRequest = execution.getVariable("bpmnRequest") + // set 'disableRollback' + if (bpmnRequest != null) { + String disableRollback = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.requestInfo.suppressRollback") + if (disableRollback != null) { + execution.setVariable("disableRollback", disableRollback) + utils.log("DEBUG", "Received 'suppressRollback': " + disableRollback , isDebugEnabled) + } else { + execution.setVariable("disableRollback", false) + } + utils.log("DEBUG", " Set 'disableRollback' : " + execution.getVariable("disableRollback") , isDebugEnabled) + } else { + String dataErrorMessage = " Invalid 'bpmnRequest' request." + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + } else { + // 'macro' TEST ONLY, sdncVersion = '1702' + utils.log("DEBUG", " 'disableRollback' : " + execution.getVariable("disableRollback") , isDebugEnabled) + } + + // get/set 'msoRequestId' and 'mso-request-id' + String requestId = execution.getVariable("msoRequestId") + if (requestId != null) { + execution.setVariable("mso-request-id", requestId) + } else { + requestId = execution.getVariable("mso-request-id") + } + execution.setVariable(Prefix + "requestId", requestId) + + // get/set 'requestId' + if (execution.getVariable("requestId") == null) { + execution.setVariable("requestId", requestId) + } + + //Place holder for additional code. + + // TODO ??? + // userParams??? 1) pre-loads indicator, 2) 'auto-activation' + // Tag/Value parameters + // + // Map: 'networkInputParams': 'auto-activation'' + // Sample format? + // "requestParameters": { + // "userParams": [ + // { + // "name": "someUserParam1", + // "value": "someValue1" + // } + // ] + // } + // + // String userParams = //use json util to extract "userParams"// + // execution.setVariable("networkInputParams", userParams) + // else: execution.setVariable("networkInputParams", null) + // + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex){ + sendSyncError(execution) + // caught exception + String exceptionMessage = "Exception Encountered in CreateNetworkInstance, PreProcessRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + } + + public void sendSyncResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside sendSyncResponse() of CreateNetworkInstance ***** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("mso-request-id") + + // RESTResponse (for API Handler (APIH) Reply Task) + String createNetworkRestRequest = """{"requestReferences":{"instanceId":"","requestId":"${requestId}"}}""".trim() + + utils.log("DEBUG", " sendSyncResponse to APIH - " + "\n" + createNetworkRestRequest, isDebugEnabled) + sendWorkflowResponse(execution, 202, createNetworkRestRequest) + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in CreateNetworkInstance flow. sendSyncResponse() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + } + + + public void getNetworkModelInfo (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside getNetworkModelInfo() of CreateNetworkInstance ***** ", isDebugEnabled) + + try { + + // "networkModelInfo" is expected to be sent + String networkModelInfo = execution.getVariable("networkModelInfo") + utils.log("DEBUG", " networkModelInfo - " + networkModelInfo, isDebugEnabled) + + // "serviceModelInfo" is expected to be sent + String serviceModelInfo = execution.getVariable("serviceModelInfo") + utils.log("DEBUG", " serviceModelInfo - " + serviceModelInfo, isDebugEnabled) + + + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in CreateNetworkInstance flow. getNetworkModelInfo() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + public void sendSyncError (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside sendSyncError() of CreateNetworkInstance ***** ", isDebugEnabled) + + try { + + String requestId = execution.getVariable("mso-request-id") + + // REST Error (for API Handler (APIH) Reply Task) + String syncError = """{"requestReferences":{"instanceId":"","requestId":"${requestId}"}}""".trim() + + sendWorkflowResponse(execution, 500, syncError) + + } catch (Exception ex) { + utils.log("DEBUG", " Bpmn error encountered in CreateNetworkInstance flow. sendSyncError() - " + ex.getMessage(), isDebugEnabled) + } + + } + + public void prepareDBRequestError (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + try { + utils.log("DEBUG", " ***** Inside prepareDBRequestError() of CreateNetworkInstance ***** ", isDebugEnabled) + + String statusMessage = "" + WorkflowException wfe = null + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + wfe = execution.getVariable("WorkflowException") + statusMessage = wfe.getErrorMessage() + } + + String requestId = execution.getVariable(Prefix + "requestId") + String networkName = execution.getVariable("networkName") !=null ? execution.getVariable("networkName") : "" + String networkId = execution.getVariable("networkId") !=null ? execution.getVariable("networkId") : "" + String dbRequest = + """ + + + + ${requestId} + BPMN + ${statusMessage} + + FAILED + <network-id>${networkId}</network-id><network-name>${networkName}</network-names> + + + """ + + execution.setVariable(Prefix + "createDBRequest", dbRequest) + utils.log("DEBUG", " DB Adapter Request - " + "\n" + dbRequest, isDebugEnabled) + utils.logAudit(dbRequest) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. prepareDBRequestError() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareCompletion (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareCompletion() of CreateNetworkInstance ***** ", isDebugEnabled) + + try { + + String requestId = execution.getVariable("mso-request-id") + String source = execution.getVariable(Prefix + "source") + + String msoCompletionRequest = + """ + + ${requestId} + CREATE + VID + + Network has been created successfully. + BPMN Network action: CREATE + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + // normal path + execution.setVariable(Prefix + "Success", true) + execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. prepareCompletion() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + + } + + + + + // ************************************************** + // Post or Validate Response Section + // ************************************************** + + public void postProcessResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside postProcessResponse() of CreateNetworkInstance ***** ", isDebugEnabled) + + try { + + if (execution.getVariable("CMSO_ResponseCode") == "200") { + execution.setVariable(Prefix + "Success", true) + utils.log("DEBUG", " ***** CreateNetworkInstance Success ***** ", isDebugEnabled) + // Place holder for additional code. + + } else { + execution.setVariable(Prefix + "Success", false) + utils.log("DEBUG", " ***** CreateNetworkInstance Failed in CompletionMsoProces flow!. ***** ", isDebugEnabled) + + } + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + // ******************************* + // Build Error Section + // ******************************* + + public void processRollbackData (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside processRollbackData() of CreateNetworkInstance ***** ", isDebugEnabled) + + try { + //execution.getVariable("orchestrationStatus") + //execution.getVariable("networkId") + //execution.getVariable("networkName") + //networkOutputParams + //rollbackData + //rolledBack + + } catch (Exception ex) { + utils.log("DEBUG", " Bpmn error encountered in CreateNetworkInstance flow. callDBCatalog() - " + ex.getMessage(), isDebugEnabled) + } + + } + + // Prepare for FalloutHandler + public void buildErrorResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler. *****", isDebugEnabled) + + String falloutHandlerRequest = "" + String requestId = execution.getVariable("mso-request-id") + + try { + WorkflowException wfe = execution.getVariable("WorkflowException") + String errorCode = String.valueOf(wfe.getErrorCode()) + String errorMessage = wfe.getErrorMessage() + falloutHandlerRequest = + """ + + ${requestId} + CREATE + VID + + + ${errorMessage} + ${errorCode} + + """ + + utils.logAudit(falloutHandlerRequest) + execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) + utils.log("DEBUG", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) + + } catch (Exception ex) { + String errorException = " Bpmn error encountered in CreateNetworkInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + utils.log("DEBUG", errorException, isDebugEnabled) + falloutHandlerRequest = + """ + + ${requestId} + CREATE + VID + + + ${errorException} + 7000 + + """ + + execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) + utils.log("DEBUG", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) + + } + + } + + public void processJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + try{ + utils.log("DEBUG", "Caught a Java Exception in " + Prefix, isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) + } + utils.log("DEBUG", "Completed processJavaException Method in " + Prefix, isDebugEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateServiceInstance.groovy new file mode 100644 index 0000000000..202829d820 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateServiceInstance.groovy @@ -0,0 +1,262 @@ +/*- + * ============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.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.rest.APIResponse + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils + +/** + * This groovy class supports the CreateServiceInstance.bpmn process. + * AlaCarte flow for 1702 ServiceInstance Create + * + */ +public class CreateServiceInstance extends AbstractServiceTaskProcessor { + String Prefix="CRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled) + + try { + + String siRequest = execution.getVariable("bpmnRequest") + utils.logAudit(siRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + utils.log("DEBUG", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = UUID.randomUUID().toString() + } + utils.log("DEBUG", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled) + serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestInfo + execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) + execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) + execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) + String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" + utils.log("DEBUG", msg, isDebugEnabled) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("productFamilyId", productFamilyId) + } + + //modelInfo + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else + { + execution.setVariable("serviceModelInfo", serviceModelInfo) + } + + utils.log("DEBUG", "modelInfo" + serviceModelInfo, isDebugEnabled) + + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + + //TODO + //execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams")) + //execution.setVariable("failExists", true) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void sendSyncResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + // RESTResponse for API Handler (APIH) Reply Task + String createServiceRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createServiceRestRequest, isDebugEnabled) + sendWorkflowResponse(execution, 202, createServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } + + + public void sendSyncError (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncError *** ", isDebugEnabled) + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${errorMessage} + 7000 + """ + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + + } + + public void prepareCompletionRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + + String msoCompletionRequest = + """ + + ${requestId} + CREATE + ${source} + + Service Instance was created successfully. + ${serviceInstanceId} + CreateServiceInstance + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled) + } + + public void prepareFalloutRequest(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** prepareFalloutRequest *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("DEBUG", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """ + ${requestId} + CREATE + ${source} + """ + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + utils.log("DEBUG", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) + String errorException = " Bpmn error encountered in CreateServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """ + + ${requestId} + CREATE + VID + + + ${errorException} + 7000 + + """ + + execution.setVariable("falloutRequest", falloutRequest) + } + utils.log("DEBUG", "*** Exit prepareFalloutRequest ***", isDebugEnabled) + } +} \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateVfModuleInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy similarity index 84% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateVfModuleInfra.groovy rename to bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy index fa80c76e77..7f5bd6138b 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateVfModuleInfra.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy @@ -18,18 +18,23 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts; +package org.openecomp.mso.bpmn.infrastructure.scripts; import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution import org.apache.commons.lang3.* +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.bpmn.common.scripts.NetworkUtils; +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils; +import org.openecomp.mso.bpmn.common.scripts.VidUtils; import org.openecomp.mso.bpmn.core.RollbackData import org.openecomp.mso.bpmn.core.WorkflowException public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { - + /** * Validates the request message and sets up the workflow. * @param execution the execution @@ -46,44 +51,45 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { execution.setVariable('prefix', prefix) logDebug('Entered 2' + method, isDebugLogEnabled) execution.setVariable("isVidRequest", "false") - - logDebug("Set variables", isDebugLogEnabled) - + + logDebug("Set variables", isDebugLogEnabled) + def rollbackData = execution.getVariable("RollbackData") if (rollbackData == null) { rollbackData = new RollbackData() } execution.setVariable("RollbackData", rollbackData) - + logDebug("Set rollback data", isDebugLogEnabled) def incomingRequest = execution.getVariable('bpmnRequest') - + utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled) - + utils.logAudit("CreateVfModule Infra incoming Request: " + incomingRequest) + // check if request is xml or json try { def jsonSlurper = new JsonSlurper() Map reqMap = jsonSlurper.parseText(incomingRequest) utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled) - + def serviceInstanceId = execution.getVariable('serviceInstanceId') def vnfId = execution.getVariable('vnfId') - + def vidUtils = new VidUtils(this) - + String requestInXmlFormat = vidUtils.createXmlVfModuleRequest(execution, reqMap, 'CREATE_VF_MODULE', serviceInstanceId) - + utils.log("DEBUG", " Request in XML format: " + requestInXmlFormat, isDebugLogEnabled) - + execution.setVariable(prefix + 'Request', requestInXmlFormat) execution.setVariable(prefix+'vnfId', vnfId) - execution.setVariable("isVidRequest", "true") - + execution.setVariable("isVidRequest", "true") + } catch(groovy.json.JsonException je) { utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled) workflowException(execution, "Invalid request format", 400) - + } catch(Exception e) { String restFaultMessage = e.getMessage() @@ -95,18 +101,18 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { try { String request = validateInfraRequest(execution) - + execution.setVariable("CreateVfModuleInfraSuccessIndicator", false) execution.setVariable("RollbackCompleted", false) execution.setVariable("DoCreateVfModuleRequest", request) execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) - execution.setVariable("CVFMI_requestInfo",utils.getNodeXml(request,"request-info")) + execution.setVariable("CVFMI_requestInfo",utils.getNodeXml(request,"request-info")) execution.setVariable("CVFMI_requestId",utils.getNodeText1(request,"request-id")) execution.setVariable("CVFMI_source",utils.getNodeText1(request,"source")) - execution.setVariable("CVFMI_serviceInstanceId", utils.getNodeText1(request, "service-instance-id")) + execution.setVariable("CVFMI_serviceInstanceId", utils.getNodeText1(request, "service-instance-id")) execution.setVariable("CVFMI_vnfInputs",utils.getNodeXml(request,"vnf-inputs")) //backoutOnFailure - + NetworkUtils networkUtils = new NetworkUtils() execution.setVariable("CVFMI_rollbackEnabled", networkUtils.isRollbackEnabled(execution,request)) execution.setVariable("CVFMI_originalWorkflowException", null) @@ -115,22 +121,22 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { vnfParams = utils.getNodeXml(request,"vnf-params") } execution.setVariable("CVFMI_vnfParams", vnfParams) - + def newVfModuleId = UUID.randomUUID().toString() execution.setVariable("newVfModuleId", newVfModuleId) - + logDebug('RequestInfo: ' + execution.getVariable("CVFMI_requestInfo"), isDebugLogEnabled) logDebug('VnfInputs: ' + execution.getVariable("CVFMI_vnfInputs"), isDebugLogEnabled) logDebug('VnfParams: ' + execution.getVariable("CVFMI_vnfParams"), isDebugLogEnabled) logDebug('rollbackEnabled: ' + execution.getVariable("CVFMI_rollbackEnabled"), isDebugLogEnabled) - + logDebug('Exited ' + method, isDebugLogEnabled) } catch (BpmnError bpmnError) { buildErrorResponse(execution,bpmnError.getMessage(),"400") throw bpmnError } catch (Exception exception) { workflowException(execution, exception.getMessage(), 400) - } + } } /** @@ -169,14 +175,15 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { def startTime = getNodeTextForce(requestInfo, 'start-time') if (startTime.isEmpty()) { startTime = System.currentTimeMillis() - } - + } + // RESTResponse (for API Handler (APIH) Reply Task) def newVfModuleId = execution.getVariable("newVfModuleId") String synchResponse = """{"requestReferences":{"instanceId":"${newVfModuleId}","requestId":"${requestId}"}}""".trim() - + sendWorkflowResponse(execution, 200, synchResponse) - + + utils.logAudit("CreateVfModule Infra Response: " + synchResponse) logDebug('Exited ' + method, isDebugLogEnabled) } catch (BpmnError e) { throw e; @@ -187,26 +194,26 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } /** - * + * * @param execution the execution */ public void postProcessResponse(Execution execution){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - + utils.log("DEBUG", " ======== STARTED PostProcessResponse Process ======== ", isDebugEnabled) try{ def request = execution.getVariable("DoCreateVfModuleRequest") def requestInfo = utils.getNodeXml(request, 'request-info', false) def action = utils.getNodeText1(requestInfo, "action") - - utils.log("DEBUG", "requestInfo is: " + requestInfo, isDebugEnabled) + + utils.log("DEBUG", "requestInfo is: " + requestInfo, isDebugEnabled) utils.log("DEBUG", "action is: " + action, isDebugEnabled) String payload = - """ - + """ + ${requestInfo} Vf Module has been created successfully. @@ -216,6 +223,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { payload = utils.formatXml(payload) execution.setVariable("CVFMI_SuccessFlag", true) execution.setVariable("CVFMI_msoCompletionRequest", payload) + utils.logAudit("CreateVfModuleInfra completion request: " + payload) utils.log("DEBUG", "Outgoing MsoCompletionRequest: \n" + payload, isDebugEnabled) }catch(Exception e){ @@ -225,10 +233,10 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { utils.log("DEBUG", "======== COMPLETED PostProcessResponse Process ======== ", isDebugEnabled) } - - - - + + + + /** * Validates the request, request id and service instance id. If a problem is found, * a WorkflowException is generated and an MSOWorkflowException event is thrown. This @@ -255,11 +263,11 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { if (request == null) { request = execution.getVariable(processKey + 'Request') - + if (request == null) { request = execution.getVariable('bpmnRequest') } - + setVariable(execution, processKey + 'Request', null); setVariable(execution, 'bpmnRequest', null); setVariable(execution, prefix + 'Request', request); @@ -268,25 +276,26 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { if (request == null) { createWorkflowException(execution, 1002, processKey + " request is null") } - + /* - def requestId = execution.getVariable("att-mso-request-id") - + def requestId = execution.getVariable("mso-request-id") + if (requestId == null) { - createWorkflowException(execution, 1002, processKey + " request has no att-mso-request-id") + createWorkflowException(execution, 1002, processKey + " request has no mso-request-id") } - + setVariable(execution, prefix + 'requestId', requestId) - def serviceInstanceId = execution.getVariable("att-mso-service-instance-id") + def serviceInstanceId = execution.getVariable("mso-service-instance-id") if (serviceInstanceId == null) { - createWorkflowException(execution, 1002, processKey + " request message has no att-mso-service-instance-id") + createWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id") } utils.logContext(requestId, serviceInstanceId) */ + utils.logAudit("CreateVfModule incoming request: " + request) logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled) logDebug('Exited ' + method, isDebugLogEnabled) return request @@ -297,10 +306,11 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { createWorkflowException(execution, 1002, "Invalid Message") } } - + public void prepareUpdateInfraRequest(Execution execution){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - + ExceptionUtil exceptionUtil = new ExceptionUtil() + utils.log("DEBUG", " ======== STARTED prepareUpdateInfraRequest Process ======== ", isDebugEnabled) try{ @@ -315,40 +325,52 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_db_endpoint") execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - + + try { + String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth") + utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugEnabled) + + def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey")) + execution.setVariable("BasicAuthHeaderValueDB",encodedString) + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + String payload = """ + xmlns:ns="http://org.openecomp.mso/requestsdb"> - + ${requestId} BPMN VF Module successfully created COMPLETE 100 - <vnf-outputs xmlns="http://ecomp.att.com/mso/infra/vnf-request/v1" xmlns:aetgt="http://ecomp.att.com/mso/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"><vnf-id>${vnfId}</vnf-id><vf-module-id>${vfModuleId}</vf-module-id></vnf-outputs> + <vnf-outputs xmlns="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:aetgt="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"><vnf-id>${vnfId}</vnf-id><vf-module-id>${vfModuleId}</vf-module-id></vnf-outputs> ${vfModuleId} - + """ payload = utils.formatXml(payload) execution.setVariable("CVFMI_updateInfraRequest", payload) utils.log("DEBUG", "Outgoing UpdateInfraRequest: \n" + payload, isDebugEnabled) - - + utils.logAudit("CreateVfModuleInfra Outgoing UpdateInfra Request: " + payload) + }catch(Exception e){ utils.log("ERROR", "Exception Occured Processing prepareUpdateInfraRequest. Exception is:\n" + e, isDebugEnabled) execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareUpdateInfraRequest Method:\n" + e.getMessage()) } utils.log("DEBUG", "======== COMPLETED prepareUpdateInfraRequest Process ======== ", isDebugEnabled) } - + /** * Builds a "FalloutHandler" request and stores it in the specified execution variable. - * + * * @param execution the execution * @param resultVar the execution variable in which the result will be stored */ @@ -359,8 +381,8 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - - + + try { def WorkflowException workflowException = execution.getVariable("WorkflowException") def request = execution.getVariable("DoCreateVfModuleRequest") @@ -373,21 +395,22 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } String content = """ - - ${requestInformation} + + ${requestInformation} ${encErrorResponseMsg} ${errorResponseCode} - +
    """ - + logDebug("CONTENT before translation: " + content, isDebugLogEnabled) content = utils.formatXml(content) logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) + utils.logAudit("CreateVfModuleInfra FallOutHander Request: " + content) execution.setVariable(resultVar, content) logDebug('Exited ' + method, isDebugLogEnabled) @@ -398,31 +421,31 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { createWorkflowException(execution, 2000, 'Internal Error') } } - + public void logAndSaveOriginalException(Execution execution) { def method = getClass().getSimpleName() + '.validateRollbackResponse(' + 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - + logWorkflowException(execution, 'CreateVfModuleInfra caught an event') saveWorkflowException(execution, 'CVFMI_originalWorkflowException') } - + public void validateRollbackResponse(Execution execution) { def method = getClass().getSimpleName() + '.validateRollbackResponse(' + 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - + def originalException = execution.getVariable("CVFMI_originalWorkflowException") execution.setVariable("WorkflowException", originalException) - + execution.setVariable("RollbackCompleted", true) - + } - - + + } diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy similarity index 84% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateVfModuleVolumeInfraV1.groovy rename to bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy index 672bb34a78..385e9e9994 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateVfModuleVolumeInfraV1.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy @@ -18,11 +18,17 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.infrastructure.scripts +import org.openecomp.mso.bpmn.common.scripts.AaiUtil; +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.bpmn.common.scripts.VidUtils; import org.openecomp.mso.bpmn.core.WorkflowException import org.openecomp.mso.rest.APIResponse + import groovy.json.JsonSlurper + import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution; import org.apache.commons.lang3.* @@ -99,7 +105,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { public void sendSyncResponse (Execution execution, isDebugEnabled) { def volumeGroupId = execution.getVariable(prefix+'volumeGroupId') - def requestId = execution.getVariable("att-mso-request-id") + def requestId = execution.getVariable("mso-request-id") def serviceInstanceId = execution.getVariable("serviceInstanceId") String syncResponse = """{"requestReferences":{"instanceId":"${volumeGroupId}","requestId":"${requestId}"}}""".trim() @@ -132,12 +138,25 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { public void prepareDbInfraSuccessRequest(Execution execution, isDebugEnabled) { + ExceptionUtil exceptionUtil = new ExceptionUtil() def dbVnfOutputs = execution.getVariable(prefix+'volumeOutputs') - def requestId = execution.getVariable('att-mso-request-id') + def requestId = execution.getVariable('mso-request-id') def statusMessage = "VolumeGroup successfully created." def requestStatus = "COMPLETED" def progress = "100" + try { + String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth") + utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugEnabled) + + def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey")) + execution.setVariable("BasicAuthHeaderValueDB",encodedString) + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + /* from: $gVolumeGroup/aai:volume-group-id/text() to: vnfreq:volume-outputs/vnfreq:volume-group-id @@ -149,7 +168,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { """ - + ${requestId} BPMN ${statusMessage} @@ -180,13 +199,13 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { utils.logAudit('DB return code: ' + dbReturnCode) utils.logAudit('DB response: ' + createDBResponse) - def requestId = execution.getVariable("att-mso-request-id") + def requestId = execution.getVariable("mso-request-id") def source = execution.getVariable(prefix+'source') String msoCompletionRequest = - """ - + """ + ${requestId} CREATE ${source} @@ -211,14 +230,14 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { def errorCode = we?.getErrorCode() def errorMessage = we?.getErrorMessage() - def requestId = execution.getVariable("att-mso-request-id") + def requestId = execution.getVariable("mso-request-id") def source = execution.getVariable(prefix+'source') String falloutHandlerRequest = - """ - + """ + ${requestId} CREATE ${source} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateVnfInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVnfInfra.groovy similarity index 61% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateVnfInfra.groovy rename to bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVnfInfra.groovy index 05537ad71d..6168acde44 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/CreateVnfInfra.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVnfInfra.groovy @@ -18,14 +18,20 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.infrastructure.scripts import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution; + import static org.apache.commons.lang3.StringUtils.*; +import org.openecomp.mso.bpmn.common.scripts.AaiUtil; +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils; +import org.openecomp.mso.bpmn.common.scripts.VidUtils; import org.openecomp.mso.bpmn.core.WorkflowException import org.openecomp.mso.bpmn.core.json.JsonUtils; @@ -47,6 +53,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { * request. * * @param - execution + * */ public void preProcessRequest(Execution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") @@ -63,7 +70,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { if(createVnfRequest != null){ - String requestId = execution.getVariable("att-mso-request-id") + String requestId = execution.getVariable("mso-request-id") execution.setVariable("CREVI_requestId", requestId) utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled) @@ -90,6 +97,9 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { String suppressRollback = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.requestInfo.suppressRollback") execution.setVariable("CREVI_suppressRollback", suppressRollback) utils.log("DEBUG", "Incoming Suppress Rollback is: " + suppressRollback, isDebugEnabled) + + def vnfModelInfo = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo") + execution.setVariable("CREVI_vnfModelInfo", vnfModelInfo) String modelInvariantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelInvariantId") execution.setVariable("CREVI_modelInvariantId", modelInvariantId) @@ -98,10 +108,21 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { String modelVersion = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.modelInfo.modelVersion") execution.setVariable("CREVI_modelVersion", modelVersion) utils.log("DEBUG", "Incoming Model Version is: " + modelVersion, isDebugEnabled) + + def cloudConfiguration = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration") + execution.setVariable("CREVI_cloudConfiguration", cloudConfiguration) + + String cloudSiteId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") + execution.setVariable("CREVI_cloudSiteId", cloudSiteId) + utils.log("DEBUG", "Incoming Cloud Site Id is: " + cloudSiteId, isDebugEnabled) + + String tenantId = jsonUtil.getJsonValue(createVnfRequest, "requestDetails.cloudConfiguration.tenantId") + execution.setVariable("CREVI_tenantId", tenantId) + utils.log("DEBUG", "Incoming Tenant Id is: " + tenantId, isDebugEnabled) //For Completion Handler & Fallout Handler String requestInfo = - """ + """ ${requestId} CREATE ${source} @@ -127,6 +148,21 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { // Setting for Sub Flow Calls execution.setVariable("CREVI_type", "generic-vnf") execution.setVariable("GENGS_type", "service-instance") + + String sdncCallbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') + if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { + def msg = 'Required variable \'URN_mso_workflow_sdncadapter_callback\' is missing' + logError(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + execution.setVariable("CREVI_sdncCallbackUrl", sdncCallbackUrl) + + def vnfInputParameters = jsonUtil.getJsonValue(createVnfRequest, "requestParameters.userParams") + execution.setVariable("CREVI_vnfInputParameters", vnfInputParameters) + + + utils.logAudit("SDNC Callback URL: " + sdncCallbackUrl) + logDebug("SDNC Callback URL is: " + sdncCallbackUrl, isDebugEnabled) }else{ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Bpmn Request is Null.") @@ -239,6 +275,146 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { } utils.log("DEBUG", "*** COMPLETED CreateVnfInfra PrepareCreateGenericVnf Process ***", isDebugEnabled) } + + public void preProcessSDNCAssignRequest(Execution execution){ + def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + logDebug(" ======== STARTED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) + def vnfId = execution.getVariable("CREVI_vnfId") + def serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId") + logDebug("NEW VNF ID: " + vnfId, isDebugLogEnabled) + utils.logAudit("NEW VNF ID: " + vnfId) + + try{ + //Build SDNC Request + + String assignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "assign") + + assignSDNCRequest = utils.formatXml(assignSDNCRequest) + execution.setVariable("CREVI_assignSDNCRequest", assignSDNCRequest) + logDebug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest, isDebugLogEnabled) + utils.logAudit("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing preProcessSDNCAssignRequest. Exception is:\n" + e, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage()) + } + logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) + } + + public void preProcessSDNCActivateRequest(Execution execution) { + def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + execution.setVariable("prefix", Prefix) + logDebug(" ======== STARTED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled) + try{ + String vnfId = execution.getVariable("CREVI_vnfId") + String serviceInstanceId = execution.getVariable("CREVI_serviceInstanceId") + + String activateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "activate") + + execution.setVariable("CREVI_activateSDNCRequest", activateSDNCRequest) + logDebug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest, isDebugLogEnabled) + utils.logAudit("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) + + }catch(Exception e){ + log.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage()) + } + logDebug("======== COMPLETED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled) + } + + public String buildSDNCRequest(Execution execution, String svcInstId, String action){ + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + def callbackURL = execution.getVariable("CREVI_sdncCallbackUrl") + def requestId = execution.getVariable("CREVI_requestId") + def serviceId = execution.getVariable("CREVI_serviceId") + def vnfType = execution.getVariable("CREVI_vnfType") + def vnfName = execution.getVariable("CREVI_vnfName") + def tenantId = execution.getVariable("CREVI_tenantId") + def source = execution.getVariable("CREVI_source") + def vnfId = execution.getVariable("CREVI_vnfId") + def cloudSiteId = execution.getVariable("CREVI_cloudSiteId") + + String sdncVNFParamsXml = "" + + if(execution.getVariable("CREVI_vnfParamsExistFlag") == true){ + sdncVNFParamsXml = buildSDNCParamsXml(execution) + }else{ + sdncVNFParamsXml = "" + } + + String sdncRequest = + """ + + ${requestId} + ${svcInstId} + ${action} + vnf-topology-operation + ${callbackURL} + + + + ${requestId} + VNFActivateRequest + ${source} + + + + ${serviceId} + ${serviceId} + ${svcInstId} + notsurewecare + + + ${vnfId} + ${vnfName} + ${vnfType} + ${cloudSiteId} + ${tenantId} + ${sdncVNFParamsXml} + + + """ + + utils.logAudit("sdncRequest: " + sdncRequest) + return sdncRequest + } + + public void validateSDNCResponse(Execution execution, String response, String method){ + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled) + + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + utils.logAudit("workflowException: " + workflowException) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + utils.logAudit("SDNCResponse: " + response) + + String sdncResponse = response + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + logDebug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse, isDebugLogEnabled) + + }else{ + logDebug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) + throw new BpmnError("MSOWorkflowException") + } + logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled) + } public void prepareCompletionHandlerRequest(Execution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") @@ -252,8 +428,8 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { requestInfo = utils.removeXmlPreamble(requestInfo) String request = - """ + """ ${requestInfo} Vnf has been created successfully. ${vnfId} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DelServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DelServiceInstance.groovy new file mode 100644 index 0000000000..6e346d2ecb --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DelServiceInstance.groovy @@ -0,0 +1,353 @@ +/*- + * ============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 groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; + +import java.util.UUID; +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.json.JSONObject; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource +import static org.apache.commons.lang3.StringUtils.*; + +import org.springframework.web.util.UriUtils; + +/** + * This groovy class supports the DelServiceInstance.bpmn process. + * + */ +public class DelServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix="DELSI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + + utils.log("DEBUG", " *** preProcessRequest Request *** ", isDebugEnabled) + + try { + // check for incoming json message/input + String siRequest = execution.getVariable("bpmnRequest") + utils.logAudit(siRequest) + + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + utils.log("DEBUG", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "Input serviceInstanceId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + //String xmlRequestDetails = vidUtils.getJsonRequestDetailstoXml(siRequest) + //execution.setVariable("requestDetails", xmlRequestDetails) + + //modelInfo + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + utils.log("DEBUG", msg, isDebugEnabled) + } else + { + execution.setVariable("serviceModelInfo", serviceModelInfo) + //utils.log("DEBUG", "modelInfo" + serviceModelInfo, isDebugEnabled) + } + + //requestInfo + String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" + utils.log("DEBUG", msg, isDebugEnabled) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("productFamilyId", productFamilyId) + } + String source = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source") + execution.setVariable("source", source) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + utils.log("DEBUG", msg, isDebugEnabled) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + utils.log("DEBUG", msg, isDebugEnabled) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void sendSyncResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + // RESTResponse (for API Handler (APIH) Reply Task) + String syncResponse = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String msg = "Exception in sendSyncResponse: " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } + + public void sendSyncError (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncError *** ", isDebugEnabled) + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${errorMessage} + 7000 + """ + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + + } + + public void prepareCompletionRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String msoCompletionRequest = + """ + + ${requestId} + DELETE + ${source} + + Service Instance was deleted successfully. + DelServiceInstance + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled) + } + + public void prepareFalloutRequest(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** prepareFalloutRequest *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("DEBUG", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """ + ${requestId} + DELETE + ${source} + """ + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + utils.log("DEBUG", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) + String errorException = " Bpmn error encountered in CreateServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """ + + ${requestId} + DELETE + VID + + + ${errorException} + 7000 + + """ + + execution.setVariable("falloutRequest", falloutRequest) + } + utils.log("DEBUG", "*** Exit prepareFalloutRequest ***", isDebugEnabled) + } + + + // ******************************* + // Build DB request Section + // ******************************* + public void prepareDBRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + try { + utils.log("DEBUG", " ***** Inside prepareDBRequest of DeleteServiceInstance ***** ", isDebugEnabled) + + String requestId = execution.getVariable("DELSI_requestId") + String statusMessage = "Service Instance successfully deleted." + + //TODO - verify the format for Service Instance Delete, + String dbRequest = + """ + + + + ${requestId} + BPMN + ${statusMessage} + + COMPLETED + 100 + + + """ + + String buildDeleteDBRequestAsString = utils.formatXml(dbRequest) + execution.setVariable("DELSI_createDBRequest", buildDeleteDBRequestAsString) + utils.logAudit(buildDeleteDBRequestAsString) + + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteServiceInstance flow. Unexpected Error from method prepareDBRequest() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + // ******************************* + // Build Error Section + // ******************************* + public void prepareDBRequestError (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside prepareDBRequestError of DeleteServiceInstanceInfra ***** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("DELSI_requestId") + String statusMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + statusMessage = wfe.getErrorMessage() + + } else { + statusMessage = "Encountered Error during DeleteServiceInstanceInfra proccessing. " + } + + //TODO - verify the format for Service Instance Create, + String dbRequest = + """ + + + + ${requestId} + BPMN + ${statusMessage} + + FAILED + + + """ + + String buildDBRequestAsString = utils.formatXml(dbRequest) + execution.setVariable("DELSI_createDBInfraErrorRequest", buildDBRequestAsString) + utils.logAudit(buildDBRequestAsString) + + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteServiceInstanceInfra flow. Unexpected Error from method prepareDBRequestError() - " + ex.getMessage() + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericMacroServiceNetworkVnf.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericMacroServiceNetworkVnf.groovy new file mode 100644 index 0000000000..f1513c6b09 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericMacroServiceNetworkVnf.groovy @@ -0,0 +1,476 @@ +/*- + * ============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 groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.NetworkUtils +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; + + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.json.JSONObject; +import org.json.JSONArray; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; + +/** + * This groovy class supports the DeleteViprAtmService.bpmn process. + * + */ +public class DeleteGenericMacroServiceNetworkVnf extends AbstractServiceTaskProcessor { + + String Prefix="DELVAS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtils() + NetworkUtils networkUtils = new NetworkUtils() + + /** + * This method is executed during the preProcessRequest task of the DeleteViprAtmService.bpmn process. + * @param execution + */ + public InitializeProcessVariables(Execution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable("deleteViprAtmServiceRequest", "") + execution.setVariable("msoRequestId", "") + execution.setVariable("DELVAS_vnfsDeletedCount", 0) + execution.setVariable("DELVAS_vnfsCount", 0) + execution.setVariable("DELVAS_networksCount", 0) + execution.setVariable("DELVAS_networksDeletedCount", 0) + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. + * @param execution + */ + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside preProcessRequest DeleteViprAtmService Request ***** ", isDebugEnabled) + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + // check for incoming json message/input + String deleteViprAtmServiceRequest = execution.getVariable("bpmnRequest") + utils.logAudit(deleteViprAtmServiceRequest) + execution.setVariable("deleteViprAtmServiceRequest", deleteViprAtmServiceRequest); + println 'deleteViprAtmServiceRequest - ' + deleteViprAtmServiceRequest + + // extract requestId + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { + String dataErrorMessage = " Element 'serviceInstanceId' is missing. " + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + String requestAction = execution.getVariable("requestAction") + execution.setVariable("requestAction", requestAction) + + String source = jsonUtil.getJsonValue(deleteViprAtmServiceRequest, "requestDetails.requestInfo.source") + if ((source == null) || (source.isEmpty())) { + execution.setVariable("source", "VID") + } else { + execution.setVariable("source", source) + } + + // extract globalSubscriberId + String globalSubscriberId = jsonUtil.getJsonValue(deleteViprAtmServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId") + + // global-customer-id is optional on Delete + + execution.setVariable("globalSubscriberId", globalSubscriberId) + execution.setVariable("globalCustomerId", globalSubscriberId) + + String suppressRollback = jsonUtil.getJsonValue(deleteViprAtmServiceRequest, "requestDetails.requestInfo.suppressRollback") + execution.setVariable("disableRollback", suppressRollback) + utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled) + + String productFamilyId = jsonUtil.getJsonValue(deleteViprAtmServiceRequest, "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled) + + // extract subscriptionServiceType + String subscriptionServiceType = jsonUtil.getJsonValue(deleteViprAtmServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled) + + // extract cloud configuration + String lcpCloudRegionId = jsonUtil.getJsonValue(deleteViprAtmServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") + execution.setVariable("lcpCloudRegionId", lcpCloudRegionId) + utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled) + String tenantId = jsonUtil.getJsonValue(deleteViprAtmServiceRequest, "requestDetails.cloudConfiguration.tenantId") + execution.setVariable("tenantId", tenantId) + utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled) + + String sdncVersion = "1702" + execution.setVariable("sdncVersion", sdncVersion) + utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${requestId} + DELETE + ${source} + """ + + execution.setVariable("DELVAS_requestInfo", requestInfo) + + //Setting for Generic Sub Flows + execution.setVariable("GENGS_type", "service-instance") + + utils.log("DEBUG", " ***** Completed preProcessRequest DeleteViprAtmService Request ***** ", isDebugEnabled) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + String exceptionMessage = "Bpmn error encountered in DeleteViprAtmService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void sendSyncResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + utils.log("DEBUG", " ***** Inside sendSyncResponse of DeleteViprAtmService ***** ", isDebugEnabled) + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String requestId = execution.getVariable("mso-request-id") + + // RESTResponse (for API Handler (APIH) Reply Task) + String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + + utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) + sendWorkflowResponse(execution, 202, syncResponse) + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DeleteViprAtmService flow. Unexpected from method sendSyncResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void prepareServiceInstanceDelete (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ***** Inside prepareServiceInstanceDelete() of DeleteViprAtmService ***** ", isDebugEnabled) + + try { + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + // confirm if ServiceInstance was found + if ( !execution.getVariable("GENGS_FoundIndicator") ) + { + String exceptionMessage = "Bpmn error encountered in DeleteViprAtmService flow. Service Instance was not found in AAI by id: " + serviceInstanceId + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + // get variable within incoming json + String deleteViprAtmServiceRequest = execution.getVariable("deleteViprAtmServiceRequest"); + + // get SI extracted by GenericGetService + String serviceInstanceAaiRecord = execution.getVariable("GENGS_service"); + + utils.log("DEBUG", "serviceInstanceAaiRecord: "+serviceInstanceAaiRecord, isDebugEnabled) + + String relationship = "" + try { + relationship = networkUtils.getFirstNodeXml(serviceInstanceAaiRecord, "relationship-list") + } catch (Exception ex) { + //no relationships found + } + utils.log("DEBUG", " relationship string - " + relationship, isDebugEnabled) + + int vnfsCount = 0 + int networksCount = 0 + + if (relationship != null && relationship.length() > 0){ + relationship = relationship.trim().replace("tag0:","").replace(":tag0","") + + // Check if Network TableREf is present, then build a List of network policy + List relatedVnfIdList = networkUtils.getRelatedVnfIdList(relationship) + vnfsCount = relatedVnfIdList.size() + execution.setVariable("DELVAS_vnfsCount", vnfsCount) + utils.log("DEBUG", " DELVAS_vnfsCount : " + vnfsCount, isDebugEnabled) + execution.setVariable("DELVAS_relatedVnfIdList", relatedVnfIdList) + + // Check if Network TableREf is present, then build a List of network policy + List relatedNetworkIdList = networkUtils.getRelatedNetworkIdList(relationship) + networksCount = relatedNetworkIdList.size() + execution.setVariable("DELVAS_networksCount", networksCount) + utils.log("DEBUG", " DELVAS_networksCount : " + networksCount, isDebugEnabled) + execution.setVariable("DELVAS_relatedNetworkIdList", relatedNetworkIdList) + execution.setVariable("relatedNetworkIdListString", relatedNetworkIdList.toString()) + } else { + execution.setVariable("DELVAS_vnfsCount", 0) + utils.log("DEBUG", " DELVAS_vnfsCount : " + vnfsCount, isDebugEnabled) + execution.setVariable("DELVAS_networksCount", 0) + utils.log("DEBUG", " DELVAS_networksCount : " + networksCount, isDebugEnabled) + } + + utils.log("DEBUG", " ***** Completed prepareServiceInstanceDelete() of DeleteViprAtmService ***** ", isDebugEnabled) + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in DeleteViprAtmService flow. prepareServiceInstanceDelete() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + // ******************************* + // + // ******************************* + public void prepareVnfAndModulesDelete (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside prepareVnfAndModulesDelete of DeleteServiceInstanceMacro ***** ", isDebugEnabled) + + List vnfList = execution.getVariable("DELVAS_relatedVnfIdList") + Integer vnfsDeletedCount = execution.getVariable("DELVAS_vnfsDeletedCount") + String vnfModelInfoString = "" + String vnfId = "" + if (vnfList.size() > 0 ) { + vnfId = vnfList.get(vnfsDeletedCount.intValue()) + } + + execution.setVariable("vnfId", vnfId) + utils.log("DEBUG", "need to delete vnfId:" + vnfId, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed prepareVnfAndModulesDelete of DeleteServiceInstanceMacro ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteServiceInstanceMacro flow. Unexpected Error from method prepareVnfAndModulesDelete() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Vnf request Section -> increment count + // ******************************* + public void validateVnfDelete (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside validateVnfDelete of DeleteViprAtmService ***** ", isDebugEnabled) + + String vnfsDeletedCount = execution.getVariable("DELVAS_vnfsDeletedCount") + vnfsDeletedCount++ + + execution.setVariable("DELVAS_vnfsDeletedCount", vnfsDeletedCount) + + utils.log("DEBUG", " ***** Completed validateVnfDelete of DeleteViprAtmService ***** "+" vnf # "+vnfsDeletedCount, isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteViprAtmService flow. Unexpected Error from method validateVnfDelete() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Generate Network request Section + // ******************************* + public void prepareNetworkDelete (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside prepareNetworkDelete of DeleteViprAtmService ***** ", isDebugEnabled) + + List networkList = execution.getVariable("DELVAS_relatedNetworkIdList") + utils.log("DEBUG", "array networkList from execution: "+ networkList, isDebugEnabled) + + if (networkList == null || networkList.size() < 1){ + networkList = Arrays.asList(execution.getVariable("relatedNetworkIdListString")) + utils.log("DEBUG", "array from string networkList: "+ networkList, isDebugEnabled) + } + + Integer networksDeletedCount = execution.getVariable("DELVAS_networksDeletedCount") + + String networkId = "" + if (networkList.size() > 0) { + networkId = (String) networkList.get(networksDeletedCount.intValue()) + } + + execution.setVariable("networkId", networkId) + utils.log("DEBUG", "need to delete networkId:" + networkId, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed prepareNetworkDelete of DeleteViprAtmService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = q"Bpmn error encountered in DeleteViprAtmService flow. Unexpected Error from method prepareNetworkDelete() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Network request Section + // ******************************* + public void validateNetworkDelete (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside validateNetworkDelete of DeleteViprAtmService ***** ", isDebugEnabled) + + Integer networksDeletedCount = execution.getVariable("DELVAS_networksDeletedCount") + networksDeletedCount++ + + execution.setVariable("DELVAS_networksDeletedCount", networksDeletedCount) + + utils.log("DEBUG", " ***** Completed validateNetworkDelete of DeleteViprAtmService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteViprAtmService flow. Unexpected Error from method validateNetworkDelete() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + // ***************************************** + // Prepare Completion request Section + // ***************************************** + public void postProcessResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ***** Inside postProcessResponse of DeleteViprAtmService ***** ", isDebugEnabled) + + try { + String source = execution.getVariable("source") + String requestId = execution.getVariable("msoRequestId") + + String msoCompletionRequest = + """ + + ${requestId} + DELETE + ${source} + + vIPR ATM Service Instance has been deleted successfully. + BPMN Service Instance macro action: DELETE + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + utils.logAudit(xmlMsoCompletionRequest) + execution.setVariable("DELVAS_Success", true) + execution.setVariable("DELVAS_CompleteMsoProcessRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in DeleteServiceInstance flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void prepareFalloutRequest(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** STARTED DeleteViprAtmService prepareFalloutRequest Process *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestInfo = execution.getVariable("DELVAS_requestInfo") + utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled) + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + + execution.setVariable("DELVAS_falloutRequest", falloutRequest) + } catch (Exception ex) { + utils.log("DEBUG", "Error Occured in DeleteViprAtmService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteViprAtmService prepareFalloutRequest Process") + } + utils.log("DEBUG", "*** COMPLETED DeleteViprAtmService prepareFalloutRequest Process ***", isDebugEnabled) + } + + + public void sendSyncError (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ***** Inside sendSyncError() of DeleteServiceInstanceInfra ***** ", isDebugEnabled) + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${errorMessage} + 7000 + """ + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + } catch (Exception ex) { + utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + } + + public void processJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + try{ + utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) + execution.setVariable("DELVAS_unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") + }catch(BpmnError b){ + utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + execution.setVariable("DELVAS_unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") + } + utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) + } + + +} \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy new file mode 100644 index 0000000000..e18af172de --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy @@ -0,0 +1,417 @@ +/*- + * ============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 org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.NetworkUtils +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils; +import org.openecomp.mso.rest.APIResponse +import java.util.UUID; +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils +import groovy.xml.XmlUtil +import groovy.json.* + +public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { + String Prefix="DELNI_" + String groovyClassName = "DeleteNetworkInstance" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + NetworkUtils networkUtils = new NetworkUtils() + + + public InitializeProcessVariables(Execution execution){ + + execution.setVariable(Prefix + "Success", false) + + execution.setVariable(Prefix + "CompleteMsoProcessRequest", "") + execution.setVariable(Prefix + "FalloutHandlerRequest", "") + execution.setVariable(Prefix + "isSilentSuccess", false) + + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside preProcessRequest() of " + groovyClassName + " ***** ", isDebugEnabled) + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + String sdncVersion = execution.getVariable("sdncVersion") + if (sdncVersion == null || sdncVersion == '1610') { + // 'a-la-cart' default, sdncVersion = '1610' + execution.setVariable("sdncVersion", "1610") + String bpmnRequest = execution.getVariable("bpmnRequest") + // set 'disableRollback' + if (bpmnRequest != null) { + String disableRollback = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.requestInfo.suppressRollback") + if (disableRollback != null) { + execution.setVariable("disableRollback", disableRollback) + utils.log("DEBUG", "Received 'suppressRollback': " + disableRollback , isDebugEnabled) + } else { + execution.setVariable("disableRollback", false) + } + utils.log("DEBUG", " Set 'disableRollback' : " + execution.getVariable("disableRollback") , isDebugEnabled) + } else { + String dataErrorMessage = " Invalid 'bpmnRequest' request." + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + } else { + // 'macro' test ONLY, sdncVersion = '1702' + utils.log("DEBUG", " 'disableRollback' : " + execution.getVariable("disableRollback") , isDebugEnabled) + } + + // get/set 'msoRequestId' and 'mso-request-id' + String requestId = execution.getVariable("msoRequestId") + if (requestId != null) { + execution.setVariable("mso-request-id", requestId) + } else { + requestId = execution.getVariable("mso-request-id") + } + execution.setVariable(Prefix + "requestId", requestId) + + // get/set 'requestId' + if (execution.getVariable("requestId") == null) { + execution.setVariable("requestId", requestId) + } + + // set action to "DELETE" + execution.setVariable("action", "DELETE") + + //Place holder for additional code. + + // TODO ??? + // userParams??? 1) pre-loads indicator, 2) 'auto-activation' + // Tag/Value parameters + // + // Map: 'networkInputParams': 'auto-activation'' + // Sample format? + // "requestParameters": { + // "userParams": [ + // { + // "name": "someUserParam1", + // "value": "someValue1" + // } + // ] + // } + // + // String userParams = //use json util to extract "userParams"// + // execution.setVariable("networkInputParams", userParams) + // else: execution.setVariable("networkInputParams", null) + // + + + } catch (Exception ex){ + sendSyncError(execution) + String exceptionMessage = "Exception Encountered in " + groovyClassName + ", PreProcessRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void getNetworkModelInfo (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside getNetworkModelInfo() of DeleteNetworkInstance ***** ", isDebugEnabled) + + try { + + // "networkModelInfo" is expected to be sent + String networkModelInfo = execution.getVariable("networkModelInfo") + utils.log("DEBUG", " networkModelInfo - " + networkModelInfo, isDebugEnabled) + + + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstance flow. getNetworkModelInfo() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void sendSyncResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside sendSyncResponse() of DeleteNetworkInstance ***** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + // RESTResponse (for API Handler (APIH) Reply Task) + String deleteNetworkRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + + utils.log("DEBUG", " sendSyncResponse to APIH - " + "\n" + deleteNetworkRestRequest, isDebugEnabled) + + sendWorkflowResponse(execution, 202, deleteNetworkRestRequest) + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Exception Encountered in DeleteNetworkInstance, sendSyncResponse() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareCompletion (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareCompletion() of CreateNetworkInstance ***** ", isDebugEnabled) + + try { + + String requestId = execution.getVariable("mso-request-id") + String source = execution.getVariable(Prefix + "source") + + String msoCompletionRequest = + """ + + ${requestId} + DELETE + VID + + Network has been deleted successfully. + BPMN Network action: DELETE + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + // normal path + execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in CreateNetworkInstance flow. prepareCompletion() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + + } + + public void prepareDBRequestError (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + try { + utils.log("DEBUG", " ***** Inside prepareDBRequestError of DeleteNetworkInstance ***** ", isDebugEnabled) + + WorkflowException wfe = execution.getVariable("WorkflowException") + String statusMessage = wfe.getErrorMessage() + String requestId = execution.getVariable(Prefix +"requestId") + + String dbRequest = + """ + + + + ${requestId} + BPMN + ${statusMessage} + + FAILED + + <network-outputs xmlns="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:aetgt="http://org.openecomp/mso/infra/vnf-request/v1" xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"/> + + + """ + + execution.setVariable(Prefix + "deleteDBRequest", dbRequest) + utils.log("DEBUG", " DB Adapter Request - " + "\n" + dbRequest, isDebugEnabled) + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstance, prepareDBRequestError() - " + ex.getMessage() + logError(exceptionMessage) + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + // ************************************************** + // Post or Validate Response Section + // ************************************************** + + public void postProcessResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside postProcessResponse() of DeleteNetworkInstance ***** ", isDebugEnabled) + + try { + if (execution.getVariable("CMSO_ResponseCode") == "200") { + execution.setVariable(Prefix + "Success", true) + utils.log("DEBUG", " ***** DeleteNetworkInstance Success ***** ", isDebugEnabled) + // Place holder for additional code. + + } else { + execution.setVariable(Prefix + "Success", false) + utils.log("DEBUG", " ***** DeleteNetworkInstance Failed in CompletionMsoProces flow!. ***** ", isDebugEnabled) + + } + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DeleteNetworkInstance flow. postProcessResponse() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + // ******************************* + // Build Error Section + // ******************************* + + // Prepare for FalloutHandler + public void buildErrorResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Prepare for FalloutHandler. FAILURE - prepare request for sub-process FalloutHandler. *****", isDebugEnabled) + + String dbReturnCode = execution.getVariable(Prefix + "dbReturnCode") + utils.log("DEBUG", " ***** DB Update Response Code : " + dbReturnCode, isDebugEnabled) + utils.log("DEBUG", " ***** DB Update Response String: " + '\n' + execution.getVariable(Prefix + "deleteDBResponse"), isDebugEnabled) + + String falloutHandlerRequest = "" + String requestId = execution.getVariable("mso-request-id") + String source = execution.getVariable(Prefix + "source") + execution.setVariable(Prefix + "Success", false) + try { + WorkflowException wfe = execution.getVariable("WorkflowException") + String errorCode = String.valueOf(wfe.getErrorCode()) + String errorMessage = wfe.getErrorMessage() + + falloutHandlerRequest = + """ + + ${requestId} + DELETE + ${source} + + + ${errorMessage} + ${errorCode} + + """ + + utils.logAudit(falloutHandlerRequest) + execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) + utils.log("ERROR", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DeleteNetworkInstance, buildErrorResponse() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + falloutHandlerRequest = + """ + + ${requestId} + DELEtE + ${source} + + + ${exceptionMessage} + 9999 + + """ + execution.setVariable(Prefix + "FalloutHandlerRequest", falloutHandlerRequest) + utils.log("DEBUG", " Overall Error Response going to FalloutHandler: " + "\n" + falloutHandlerRequest, isDebugEnabled) + } + } + + + public void sendSyncError (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + try { + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + // RESTResponse (for API Handler (APIH) Reply Task) + String deleteNetworkRestError = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + + utils.log("DEBUG", " sendSyncResponse to APIH - " + "\n" + deleteNetworkRestError, isDebugEnabled) + + sendWorkflowResponse(execution, 500, deleteNetworkRestError) + + } catch (Exception ex) { + utils.log("DEBUG", " Sending Sync Error Activity Failed - DeleteNetworkInstance, sendSyncError(): " + "\n" + ex.getMessage(), isDebugEnabled) + } + } + + public void processJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + try{ + utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") + } + utils.log("DEBUG", "Completed processJavaException Method of " + Prefix, isDebugEnabled) + } + +} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteVfModuleInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy similarity index 74% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteVfModuleInfra.groovy rename to bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy index bf5e62d2cc..93890be2af 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteVfModuleInfra.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.infrastructure.scripts import groovy.util.Node import groovy.util.XmlParser; @@ -32,14 +32,18 @@ import org.camunda.bpm.engine.runtime.Execution import groovy.json.JsonSlurper import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.bpmn.common.scripts.VidUtils; import org.openecomp.mso.bpmn.core.RollbackData import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils; public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { - + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() /** * Initialize the flow's variables. * @@ -74,65 +78,90 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { logDebug('Entered ' + method, isDebugLogEnabled) execution.setVariable("isVidRequest", "false") initProcessVariables(execution) - + def prefix = execution.getVariable('prefix') - + def incomingRequest = execution.getVariable('bpmnRequest') - + utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled) - + utils.logAudit("DeleteVfModule Infra incoming Request: " + incomingRequest) + // check if request is xml or json try { def jsonSlurper = new JsonSlurper() Map reqMap = jsonSlurper.parseText(incomingRequest) utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled) - + def serviceInstanceId = execution.getVariable('serviceInstanceId') + utils.log("DEBUG", "serviceInstanceId is: " + serviceInstanceId, isDebugLogEnabled) def vnfId = execution.getVariable('vnfId') - + utils.log("DEBUG", "vnfId is: " + vnfId, isDebugLogEnabled) + def cloudConfiguration = jsonUtil.getJsonValue(incomingRequest, "requestDetails.cloudConfiguration") + execution.setVariable("cloudConfiguration", cloudConfiguration) + utils.log("DEBUG", "CloudConfiguration is: " + cloudConfiguration, isDebugLogEnabled) + def vfModuleModelInfo = jsonUtil.getJsonValue(incomingRequest, "requestDetails.modelInfo") + + execution.setVariable("vfModuleModelInfo", vfModuleModelInfo) + utils.log("DEBUG", "VfModuleModelInfo is: " + vfModuleModelInfo, isDebugLogEnabled) + def vidUtils = new VidUtils(this) - + String requestInXmlFormat = vidUtils.createXmlVfModuleRequest(execution, reqMap, 'DELETE_VF_MODULE', serviceInstanceId) - + utils.log("DEBUG", " Request in XML format: " + requestInXmlFormat, isDebugLogEnabled) - + + try { + // Catalog DB headers Authorization + String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth") + utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled) + + def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey")) + execution.setVariable("BasicAuthHeaderValueDB",encodedString) + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + execution.setVariable(prefix + 'Request', requestInXmlFormat) execution.setVariable(prefix+'vnfId', vnfId) execution.setVariable("isVidRequest", "true") - + } catch(groovy.json.JsonException je) { utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled) workflowException(execution, "Invalid request format", 400) - + } catch(Exception e) { String restFaultMessage = e.getMessage() utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled) workflowException(execution, restFaultMessage, 400) } - - + + try { - + String request = validateRequest(execution) execution.setVariable('DeleteVfModuleRequest', request) - + utils.logAudit("DeleteVfModuleInfra Request: " + request) + def requestInfo = getRequiredNodeXml(execution, request, 'request-info') execution.setVariable('DELVfModI_requestInfo', requestInfo) execution.setVariable('DELVfModI_requestId', getRequiredNodeText(execution, requestInfo, 'request-id')) execution.setVariable('DELVfModI_source', getNodeTextForce(requestInfo, 'source')) - + def vnfInputs = getRequiredNodeXml(execution, request, 'vnf-inputs') execution.setVariable('DELVfModI_vnfInputs', vnfInputs) execution.setVariable('DELVfModI_vnfId', getRequiredNodeText(execution, vnfInputs, 'vnf-id')) execution.setVariable('DELVfModI_vfModuleId', getRequiredNodeText(execution, vnfInputs, 'vf-module-id')) + execution.setVariable('DELVfModI_vfModuleName', getNodeTextForce(vnfInputs, 'vf-module-name')) execution.setVariable('DELVfModI_tenantId', getRequiredNodeText(execution, vnfInputs, 'tenant-id')) execution.setVariable('DELVfModI_volumeGroupId', getNodeTextForce(vnfInputs, 'volume-group-id')) - + def vnfParams = utils.getNodeXml(request, 'vnf-params') execution.setVariable('DELVfModI_vnfParams', vnfParams) - + logDebug('Exited ' + method, isDebugLogEnabled) } catch (BpmnError e) { throw e; @@ -153,7 +182,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - + try { def requestInfo = execution.getVariable('DELVfModI_requestInfo') def requestId = execution.getVariable('DELVfModI_requestId') @@ -166,11 +195,12 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { if (startTime.isEmpty()) { startTime = System.currentTimeMillis() } - + // RESTResponse (for API Handler (APIH) Reply Task) def vfModuleId = execution.getVariable('DELVfModI_vfModuleId') String synchResponse = """{"requestReferences":{"instanceId":"${vfModuleId}","requestId":"${requestId}"}}""".trim() - + + utils.logAudit("DeleteVfModuleInfra Synch Response: " + synchResponse) sendWorkflowResponse(execution, 200, synchResponse) logDebug('Exited ' + method, isDebugLogEnabled) @@ -181,7 +211,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { createWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) } } - + /** * Currently passing the entire DELETE_VF_MODULE vnf-request to DoDeleteVfModule. * 'DeleteVfModuleRequest' is now being set in preProcessRequest(). @@ -206,7 +236,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { createWorkflowException(execution, 1002, 'Error in prepDoDeleteVfModule(): ' + e.getMessage()) } } - + /** * Prepare the DB update to add an entry for the Vf Module request. * @@ -227,22 +257,23 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { def volumeGroupId = execution.getVariable('DELVfModI_volumeGroupId') String updateInfraRequest = """ - - - - - ${requestId} - BPMN - COMPLETED - 100 - - - - """ + + + + + ${requestId} + BPMN + COMPLETED + 100 + + + + """ updateInfraRequest = utils.formatXml(updateInfraRequest) execution.setVariable('DELVfModI_updateInfraRequest', updateInfraRequest) + utils.logAudit("DeleteAAIVfModuleInfra Update Request: " + updateInfraRequest) logDebug('Request for Update Infra Request:\n' + updateInfraRequest, isDebugLogEnabled) logDebug('Exited ' + method, isDebugLogEnabled) @@ -272,20 +303,21 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { def request = execution.getVariable("DeleteVfModuleRequest") def requestInfo = utils.getNodeXml(request, 'request-info', false) def action = utils.getNodeText1(requestInfo, "action") - + String content = - """ - - ${requestInfo} - - Vf Module has been deleted successfully. - BPMN - """ - + """ + + ${requestInfo} + + Vf Module has been deleted successfully. + BPMN + """ + content = utils.formatXml(content) logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) + utils.logAudit("DeleteVfModule Infra Completion Handler Request: " + content) execution.setVariable(resultVar, content) logDebug('Exited ' + method, isDebugLogEnabled) @@ -310,7 +342,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - + try { def prefix = execution.getVariable('prefix') def request = execution.getVariable("DeleteVfModuleRequest") @@ -324,18 +356,19 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { } String content = """ - - ${requestInfo} - - ${encErrorResponseMsg} - ${errorResponseCode} - - - """ + + ${requestInfo} + + ${encErrorResponseMsg} + ${errorResponseCode} + + + """ content = utils.formatXml(content) + utils.logAudit("DeleteVfModuleInfra Fallout Handler Request: " + content) logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) execution.setVariable(resultVar, content) @@ -347,4 +380,4 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { createWorkflowException(execution, 2000, 'Internal Error') } } -} +} \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy similarity index 93% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteVfModuleVolumeInfraV1.groovy rename to bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy index bfbaf680c6..0a3af33d49 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteVfModuleVolumeInfraV1.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy @@ -18,20 +18,22 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts; +package org.openecomp.mso.bpmn.infrastructure.scripts; import groovy.json.JsonSlurper + import java.util.concurrent.ExecutionException; -import org.springframework.web.util.UriUtils +import org.springframework.web.util.UriUtils import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution import org.apache.commons.lang3.* - +import org.openecomp.mso.bpmn.common.scripts.AaiUtil; +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.bpmn.common.scripts.VidUtils; import org.openecomp.mso.bpmn.core.WorkflowException import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig /** * This groovy class supports the DeleteVfModuleVolume.bpmn process. @@ -112,7 +114,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { def requestInfo = getRequiredNodeXml(execution, request, 'request-info') execution.setVariable('DELVfModVol_requestInfo', requestInfo) - String requestId = execution.getVariable("att-mso-request-id") + String requestId = execution.getVariable("mso-request-id") if (requestId == null || requestId == "") { requestId = getRequiredNodeText(execution, requestInfo, 'request-id') } @@ -130,6 +132,19 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { execution.setVariable('DELVfModVol_volumeParams', utils.getNodeXml(request, 'volume-params')) execution.setVariable('DELVfModVol_cloudRegion', utils.getNodeText1(request, 'aic-cloud-region')) + try { + // Catalog DB headers Authorization + String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth") + utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled) + + def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey")) + execution.setVariable("BasicAuthHeaderValueDB",encodedString) + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + logDebug('Request: ' + createVolumeIncoming, isDebugLogEnabled) } @@ -348,7 +363,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { def serviceId = execution.getVariable('DELVfModVol_serviceId') def messageId = execution.getVariable('DELVfModVol_messageId') - def notificationUrl = execution.getVariable("URN_mso_workflow_vnfadapter_rest_callback") + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") if ('true'.equals(useQualifiedHostName)) { notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) @@ -438,7 +453,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { String updateInfraRequest = """ + xmlns:req="http://org.openecomp.mso/requestsdb"> @@ -461,13 +476,13 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { public void prepareCompletionHandlerRequest (Execution execution, isDebugLogEnabled) { - def requestId = execution.getVariable("att-mso-request-id") + def requestId = execution.getVariable("mso-request-id") def source = execution.getVariable("DELVfModVol_source") String msoCompletionRequest = - """ - + """ + ${requestId} DELETE ${source} @@ -495,10 +510,10 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { def errorCode = workflowExceptionObj.getErrorCode() String falloutHandlerRequest = - """ - + """ + ${requestId} DELETE ${source} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteVnfInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy similarity index 76% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteVnfInfra.groovy rename to bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy index e53df32ef2..b97686e2d3 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DeleteVnfInfra.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.infrastructure.scripts import javax.xml.parsers.DocumentBuilder @@ -27,15 +27,16 @@ import javax.xml.parsers.DocumentBuilderFactory import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution - import org.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.Node import org.w3c.dom.NodeList - import org.xml.sax.InputSource +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.bpmn.common.scripts.VidUtils; import org.openecomp.mso.bpmn.core.WorkflowException import org.openecomp.mso.bpmn.core.json.JsonUtils; @@ -74,7 +75,7 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor { if(deleteVnfRequest != null){ - String requestId = execution.getVariable("att-mso-request-id") + String requestId = execution.getVariable("mso-request-id") execution.setVariable("DELVI_requestId", requestId) String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -88,10 +89,21 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor { String source = jsonUtil.getJsonValue(deleteVnfRequest, "requestDetails.requestInfo.source") execution.setVariable("DELVI_source", source) utils.log("DEBUG", "Incoming Source is: " + source, isDebugEnabled) + + def cloudConfiguration = jsonUtil.getJsonValue(deleteVnfRequest, "requestDetails.cloudConfiguration") + execution.setVariable("DELVI_cloudConfiguration", cloudConfiguration) + + boolean cascadeDelete = false + Boolean cascadeDeleteObj = jsonUtil.getJsonRawValue(deleteVnfRequest, "requestDetails.requestParameters.cascadeDelete") + if(cascadeDeleteObj!=null){ + cascadeDelete = cascadeDeleteObj.booleanValue() + } + execution.setVariable("DELVI_cascadeDelete", cascadeDelete) + utils.log("DEBUG", "Incoming cascadeDelete is: " + cascadeDelete, isDebugEnabled) //For Completion Handler & Fallout Handler String requestInfo = - """ + """ ${requestId} DELETE ${source} @@ -142,51 +154,6 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor { utils.log("DEBUG", "*** COMPLETED DeleteVnfInfra SendSyncResponse Process ***", isDebugEnabled) } - public void processGetVnfResponse(Execution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - utils.log("DEBUG", " *** STARTED DeleteVnfInfra processGetVnfResponse Process *** ", isDebugEnabled) - try { - String vnf = execution.getVariable("DELVI_genericVnf") - String resourceVersion = utils.getNodeText1(vnf, "resource-version") - execution.setVariable("DELVI_resourceVersion", resourceVersion) - - if(utils.nodeExists(vnf, "relationship")){ - InputSource source = new InputSource(new StringReader(vnf)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document vnfXml = docBuilder.parse(source) - - NodeList nodeList = vnfXml.getElementsByTagName("relationship") - for (int x = 0; x < nodeList.getLength(); x++) { - Node node = nodeList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() - if(e.equals("volume-group") || e.equals("l3-network") || e.equals("vserver")){ - utils.log("DEBUG", "Generic Vnf still has relationship to OpenStack.", isDebugEnabled) - execution.setVariable("DELVI_vnfInUse", true) - }else{ - utils.log("DEBUG", "Relationship NOT related to OpenStack", isDebugEnabled) - } - } - } - } - - if(utils.nodeExists(vnf, "vf-module")){ - execution.setVariable("DELVI_vnfInUse", true) - utils.log("DEBUG", "Generic Vnf still has vf-modules.", isDebugEnabled) - } - - - } catch (Exception ex) { - utils.log("DEBUG", "Error Occured in DeleteVnfInfra processGetVnfResponse Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVnfInfra processGetVnfResponse Process") - - } - utils.log("DEBUG", "*** COMPLETED DeleteVnfInfra processGetVnfResponse Process ***", isDebugEnabled) - } - public void prepareCompletionHandlerRequest(Execution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -199,8 +166,8 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor { String vnfId = execution.getVariable("DELVI_vnfId") String request = - """ + """ ${requestInfo} Vnf has been deleted successfully. ${vnfId} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy new file mode 100644 index 0000000000..ed65dbc79b --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy @@ -0,0 +1,1741 @@ +/*- + * ============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 groovy.xml.XmlUtil +import groovy.json.* +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.NetworkUtils +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils + +/** + * This groovy class supports the DoCreateNetworkInstance.bpmn process. + * + */ +public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { + String Prefix="CRENWKI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + NetworkUtils networkUtils = new NetworkUtils() + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + def className = getClass().getSimpleName() + + /** + * This method is executed during the preProcessRequest task of the DoCreateNetworkInstance.bpmn process. + * @param execution + */ + public InitializeProcessVariables(Execution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable(Prefix + "networkRequest", "") + execution.setVariable(Prefix + "rollbackEnabled", null) + execution.setVariable(Prefix + "networkInputs", "") + //execution.setVariable(Prefix + "requestId", "") + execution.setVariable(Prefix + "messageId", "") + execution.setVariable(Prefix + "source", "") + execution.setVariable("BasicAuthHeaderValuePO", "") + execution.setVariable("BasicAuthHeaderValueSDNC", "") + execution.setVariable(Prefix + "serviceInstanceId","") + execution.setVariable("GENGS_type", "") + execution.setVariable(Prefix + "rsrc_endpoint", null) + execution.setVariable(Prefix + "networkOutputs", "") + execution.setVariable(Prefix + "networkId","") + execution.setVariable(Prefix + "networkName","") + + // AAI query Name + execution.setVariable(Prefix + "queryNameAAIRequest","") + execution.setVariable(Prefix + "queryNameAAIResponse", "") + execution.setVariable(Prefix + "aaiNameReturnCode", "") + execution.setVariable(Prefix + "isAAIqueryNameGood", false) + + // AAI query Cloud Region + execution.setVariable(Prefix + "queryCloudRegionRequest","") + execution.setVariable(Prefix + "queryCloudRegionReturnCode","") + execution.setVariable(Prefix + "queryCloudRegionResponse","") + execution.setVariable(Prefix + "cloudRegionPo","") + execution.setVariable(Prefix + "cloudRegionSdnc","") + execution.setVariable(Prefix + "isCloudRegionGood", false) + + // AAI query Id + execution.setVariable(Prefix + "queryIdAAIRequest","") + execution.setVariable(Prefix + "queryIdAAIResponse", "") + execution.setVariable(Prefix + "aaiIdReturnCode", "") + + // AAI query vpn binding + execution.setVariable(Prefix + "queryVpnBindingAAIRequest","") + execution.setVariable(Prefix + "queryVpnBindingAAIResponse", "") + execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "") + execution.setVariable(Prefix + "vpnBindings", null) + execution.setVariable(Prefix + "vpnCount", 0) + execution.setVariable(Prefix + "routeCollection", "") + + // AAI query network policy + execution.setVariable(Prefix + "queryNetworkPolicyAAIRequest","") + execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", "") + execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "") + execution.setVariable(Prefix + "networkPolicyUriList", null) + execution.setVariable(Prefix + "networkPolicyCount", 0) + execution.setVariable(Prefix + "networkCollection", "") + + // AAI query route table reference + execution.setVariable(Prefix + "queryNetworkTableRefAAIRequest","") + execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", "") + execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "") + execution.setVariable(Prefix + "networkTableRefUriList", null) + execution.setVariable(Prefix + "networkTableRefCount", 0) + execution.setVariable(Prefix + "tableRefCollection", "") + + // AAI requery Id + execution.setVariable(Prefix + "requeryIdAAIRequest","") + execution.setVariable(Prefix + "requeryIdAAIResponse", "") + execution.setVariable(Prefix + "aaiRequeryIdReturnCode", "") + + // AAI update contrail + execution.setVariable(Prefix + "updateContrailAAIUrlRequest","") + execution.setVariable(Prefix + "updateContrailAAIPayloadRequest","") + execution.setVariable(Prefix + "updateContrailAAIResponse", "") + execution.setVariable(Prefix + "aaiUpdateContrailReturnCode", "") + + execution.setVariable(Prefix + "createNetworkRequest", "") + execution.setVariable(Prefix + "createNetworkResponse", "") + execution.setVariable(Prefix + "rollbackNetworkRequest", "") + //execution.setVariable(Prefix + "rollbackNetworkResponse", "") + execution.setVariable(Prefix + "networkReturnCode", "") + //execution.setVariable(Prefix + "rollbackNetworkReturnCode", "") + execution.setVariable(Prefix + "isNetworkRollbackNeeded", false) + + execution.setVariable(Prefix + "assignSDNCRequest", "") + execution.setVariable(Prefix + "assignSDNCResponse", "") + execution.setVariable(Prefix + "rollbackSDNCRequest", "") + //execution.setVariable(Prefix + "rollbackSDNCResponse", "") + execution.setVariable(Prefix + "sdncReturnCode", "") + //execution.setVariable(Prefix + "rollbackSDNCReturnCode", "") + execution.setVariable(Prefix + "isSdncRollbackNeeded", false) + execution.setVariable(Prefix + "sdncResponseSuccess", false) + + execution.setVariable(Prefix + "activateSDNCRequest", "") + execution.setVariable(Prefix + "activateSDNCResponse", "") + execution.setVariable(Prefix + "rollbackActivateSDNCRequest", "") + //execution.setVariable(Prefix + "rollbackActivateSDNCResponse", "") + execution.setVariable(Prefix + "sdncActivateReturnCode", "") + //execution.setVariable(Prefix + "rollbackActivateSDNCReturnCode", "") + execution.setVariable(Prefix + "isSdncActivateRollbackNeeded", false) + execution.setVariable(Prefix + "sdncActivateResponseSuccess", false) + + execution.setVariable(Prefix + "orchestrationStatus", "") + execution.setVariable(Prefix + "isVnfBindingPresent", false) + execution.setVariable(Prefix + "Success", false) + + execution.setVariable(Prefix + "isException", false) + + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the DoCreateNetworkInstance.bpmn process. + * @param execution + */ + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside preProcessRequest() of " + className + ".groovy ***** ", isDebugEnabled) + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + // GET Incoming request & validate 3 kinds of format. + execution.setVariable("action", "CREATE") + String networkRequest = execution.getVariable("bpmnRequest") + if (networkRequest != null) { + if (networkRequest.contains("requestDetails")) { + // JSON format request is sent, create xml + try { + def prettyJson = JsonOutput.prettyPrint(networkRequest.toString()) + utils.log("DEBUG", " Incoming message formatted . . . : " + '\n' + prettyJson, isDebugEnabled) + networkRequest = vidUtils.createXmlNetworkRequestInfra(execution, networkRequest) + + } catch (Exception ex) { + String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + } else { + // XML format request is sent + + } + } else { + // vIPR format request is sent, create xml from individual variables + networkRequest = vidUtils.createXmlNetworkRequestInstance(execution) + } + + networkRequest = utils.formatXml(networkRequest) + utils.logAudit(networkRequest) + execution.setVariable(Prefix + "networkRequest", networkRequest) + utils.log("DEBUG", Prefix + "networkRequest - " + '\n' + networkRequest, isDebugEnabled) + + // validate 'backout-on-failure' to override 'URN_mso_rollback' + boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, networkRequest) + execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled) + utils.log("DEBUG", Prefix + "rollbackEnabled - " + rollbackEnabled, isDebugEnabled) + + String networkInputs = utils.getNodeXml(networkRequest, "network-inputs", false).replace("tag0:","").replace(":tag0","") + execution.setVariable(Prefix + "networkInputs", networkInputs) + utils.log("DEBUG", Prefix + "networkInputs - " + '\n' + networkInputs, isDebugEnabled) + + + + // prepare messageId + String messageId = execution.getVariable("testMessageId") // for testing + if (messageId == null || messageId == "") { + messageId = UUID.randomUUID() + utils.log("DEBUG", Prefix + "messageId, random generated: " + messageId, isDebugEnabled) + } else { + utils.log("DEBUG", Prefix + "messageId, pre-assigned: " + messageId, isDebugEnabled) + } + execution.setVariable(Prefix + "messageId", messageId) + + String source = utils.getNodeText1(networkRequest, "source") + execution.setVariable(Prefix + "source", source) + utils.log("DEBUG", Prefix + "source - " + source, isDebugEnabled) + + // validate cloud region + String lcpCloudRegionId = utils.getNodeText1(networkRequest, "aic-cloud-region") + if ((lcpCloudRegionId == null) || (lcpCloudRegionId == "") || (lcpCloudRegionId == "null")) { + String dataErrorMessage = "Missing value/element: 'lcpCloudRegionId' or 'cloudConfiguration' or 'aic-cloud-region'." + utils.log("DEBUG", " Invalid Request - " + dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + // validate service instance id + String serviceInstanceId = utils.getNodeText1(networkRequest, "service-instance-id") + if ((serviceInstanceId == null) || (serviceInstanceId == "") || (serviceInstanceId == "null")) { + String dataErrorMessage = "Missing value/element: 'serviceInstanceId'." + utils.log("DEBUG", " Invalid Request - " + dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + // PO Authorization Info / headers Authorization= + String basicAuthValuePO = execution.getVariable("URN_mso_adapters_po_auth") + utils.log("DEBUG", " Obtained BasicAuth userid password for PO/SDNC adapter: " + basicAuthValuePO, isDebugEnabled) + try { + def encodedString = utils.getBasicAuth(basicAuthValuePO, execution.getVariable("URN_mso_msoKey")) + execution.setVariable("BasicAuthHeaderValuePO",encodedString) + execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) + + } catch (IOException ex) { + String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " + String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage, , isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + // Set variables for Generic Get Sub Flow use + execution.setVariable(Prefix + "serviceInstanceId", serviceInstanceId) + utils.log("DEBUG", Prefix + "serviceInstanceId - " + serviceInstanceId, isDebugEnabled) + + execution.setVariable("GENGS_type", "service-instance") + utils.log("DEBUG", "GENGS_type - " + "service-instance", isDebugEnabled) + utils.log("DEBUG", " Url for SDNC adapter: " + execution.getVariable("URN_mso_adapters_sdnc_endpoint"), isDebugEnabled) + + String sdncVersion = execution.getVariable("sdncVersion") + utils.log("DEBUG", "sdncVersion? : " + sdncVersion, isDebugEnabled) + + // build 'networkOutputs' + String networkId = utils.getNodeText1(networkRequest, "network-id") + if ((networkId == null) || (networkId == "null")) { + networkId = "" + } + String networkName = utils.getNodeText1(networkRequest, "network-name") + if ((networkName == null) || (networkName == "null")) { + networkName = "" + } + String networkOutputs = + """ + ${networkId} + ${networkName} + """ + execution.setVariable(Prefix + "networkOutputs", networkOutputs) + utils.log("DEBUG", Prefix + "networkOutputs - " + '\n' + networkOutputs, isDebugEnabled) + execution.setVariable(Prefix + "networkId", networkId) + execution.setVariable(Prefix + "networkName", networkName) + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + sendSyncError(execution) + // caught exception + String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAINetworkName (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkName() of DoCreateNetworkInstance ***** " , isDebugEnabled) + + // get variables + String networkInputs = execution.getVariable(Prefix + "networkInputs") + String networkName = utils.getNodeText1(networkInputs, "network-name") + networkName = UriUtils.encode(networkName,"UTF-8") + String messageId = execution.getVariable("messageId") + + // Prepare AA&I url with network-name + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String queryAAINameRequest = "${aai_endpoint}${aai_uri}" + "?network-name=" + networkName + utils.logAudit(queryAAINameRequest) + execution.setVariable(Prefix + "queryNameAAIRequest", queryAAINameRequest) + utils.log("DEBUG", Prefix + "queryNameAAIRequest - " + "\n" + queryAAINameRequest, isDebugEnabled) + + RESTConfig config = new RESTConfig(queryAAINameRequest); + + try { + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) + .addHeader("X-FromAppId", "MSO") + .addHeader("Content-Type", "application/xml") + .addHeader("Accept","application/xml"); + APIResponse response = client.get() + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiNameReturnCode", returnCode) + utils.log("DEBUG", " ***** AAI Query Name Response Code : " + returnCode, isDebugEnabled) + + String aaiResponseAsString = response.getResponseBodyAsString() + utils.log("DEBUG", " ***** AAI Query Name Response : " +'\n'+ aaiResponseAsString, isDebugEnabled) + + if (returnCode=='200') { + utils.logAudit(aaiResponseAsString) + execution.setVariable(Prefix + "queryNameAAIResponse", aaiResponseAsString) + execution.setVariable(Prefix + "isAAIqueryNameGood", true) + String orchestrationStatus = "" + try { + // response is NOT empty + orchestrationStatus = utils.getNodeText1(aaiResponseAsString, "orchestration-status") + execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus.toUpperCase()) + utils.log("DEBUG", Prefix + "orchestrationStatus - " + orchestrationStatus.toUpperCase(), isDebugEnabled) + execution.setVariable("orchestrationStatus", orchestrationStatus) + + } catch (Exception ex) { + // response is empty + execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus) + utils.log("DEBUG", Prefix + "orchestrationStatus - " + orchestrationStatus, isDebugEnabled) + } + + } else { + if (returnCode=='404') { + utils.log("DEBUG", " QueryAAINetworkName return code = '404' (Not Found). Proceed with the Create !!! ", isDebugEnabled) + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Error Response from QueryAAINetworkName - " + returnCode + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 2500, dataErrorMessage) + + } + + } + + utils.log("DEBUG", Prefix + "isAAIqueryNameGood? : " + execution.getVariable(Prefix + "isAAIqueryNameGood"), isDebugEnabled) + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + // try error + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow - callRESTQueryAAINetworkName() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAICloudRegion (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside callRESTQueryAAICloudRegion() of DoCreateNetworkInstance ***** " , isDebugEnabled) + + try { + String networkInputs = execution.getVariable(Prefix + "networkInputs") + String cloudRegion = utils.getNodeText1(networkInputs, "aic-cloud-region") + cloudRegion = UriUtils.encode(cloudRegion,"UTF-8") + + // Prepare AA&I url + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + AaiUtil aaiUtil = new AaiUtil(this) + String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) + String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion + utils.logAudit(queryCloudRegionRequest) + execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest) + utils.log("DEBUG", Prefix + "queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest, isDebugEnabled) + + String cloudRegionPo = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) + String cloudRegionSdnc = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "SDNC", cloudRegion) + + if ((cloudRegionPo != "ERROR") && (cloudRegionSdnc != "ERROR")) { + execution.setVariable(Prefix + "cloudRegionPo", cloudRegionPo) + execution.setVariable(Prefix + "cloudRegionSdnc", cloudRegionSdnc) + execution.setVariable(Prefix + "isCloudRegionGood", true) + + } else { + String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable(Prefix + "queryCloudRegionReturnCode") + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + + utils.log("DEBUG", " is Cloud Region Good: " + execution.getVariable(Prefix + "isCloudRegionGood"), isDebugEnabled) + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + // try error + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow - callRESTQueryAAICloudRegion() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAINetworkId(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkId() of DoCreateNetworkInstance ***** " , isDebugEnabled) + + try { + // get variables + String networkId = "" + String assignSDNCResponse = execution.getVariable(Prefix + "assignSDNCResponse") + if (execution.getVariable("sdncVersion") == "1702") { + String networkResponseInformation = "" + try { + networkResponseInformation = utils.getNodeXml(assignSDNCResponse, "network-response-information", false).replace("tag0:","").replace(":tag0","") + networkId = utils.getNodeText1(networkResponseInformation, "instance-id") + } catch (Exception ex) { + String dataErrorMessage = " SNDC Response network validation for 'instance-id' (network-id) failed: Empty " + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + } else { + networkId = utils.getNodeText1(assignSDNCResponse, "network-id") + } + if (networkId == null || networkId == "null") { + String dataErrorMessage = "SNDC Response did not contains 'instance-id' or 'network-id' element, or the value is null." + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } else { + utils.log("DEBUG", " SNDC Response network validation for 'instance-id' (network-id)' is good: " + networkId, isDebugEnabled) + } + + + execution.setVariable(Prefix + "networkId", networkId) + String networkName = utils.getNodeText1(assignSDNCResponse, "network-name") + execution.setVariable(Prefix + "networkName", networkName) + + networkId = UriUtils.encode(networkId,"UTF-8") + String messageId = execution.getVariable(Prefix + "messageId") + + // Prepare AA&I url + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + utils.logAudit(queryIdAAIRequest) + execution.setVariable(Prefix + "queryIdAAIRequest", queryIdAAIRequest) + utils.log("DEBUG", Prefix + "queryIdAAIRequest - " + "\n" + queryIdAAIRequest, isDebugEnabled) + + RESTConfig config = new RESTConfig(queryIdAAIRequest); + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) + .addHeader("X-FromAppId", "MSO") + .addHeader("Content-Type", "application/xml") + .addHeader("Accept","application/xml"); + APIResponse response = client.get() + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiIdReturnCode", returnCode) + + utils.log("DEBUG", " ***** AAI Response Code : " + returnCode, isDebugEnabled) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + utils.logAudit(aaiResponseAsString) + execution.setVariable(Prefix + "queryIdAAIResponse", aaiResponseAsString) + utils.log("DEBUG", " QueryAAINetworkId Success REST Response - " + "\n" + aaiResponseAsString, isDebugEnabled) + + String netId = utils.getNodeText1(aaiResponseAsString, "network-id") + execution.setVariable(Prefix + "networkId", netId) + String netName = utils.getNodeText1(aaiResponseAsString, "network-name") + execution.setVariable(Prefix + "networkName", netName) + + } else { + if (returnCode=='404') { + String dataErrorMessage = "Response Error from QueryAAINetworkId is 404 (Not Found)." + utils.log("DEBUG", " AAI Query Failed. " + dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from QueryAAINetworkId - " + returnCode + utils.log("DEBUG", "Unexpected Response from QueryAAINetworkId - " + dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkId() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTReQueryAAINetworkId(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside callRESTReQueryAAINetworkId() of DoCreateNetworkInstance ***** " , isDebugEnabled) + + try { + // get variables + String networkId = execution.getVariable(Prefix + "networkId") + String netId = networkId + networkId = UriUtils.encode(networkId,"UTF-8") + String messageId = execution.getVariable(Prefix + "messageId") + + // Prepare AA&I url + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + utils.logAudit(requeryIdAAIRequest) + execution.setVariable(Prefix + "requeryIdAAIRequest", requeryIdAAIRequest) + utils.log("DEBUG", Prefix + "requeryIdAAIRequest - " + "\n" + requeryIdAAIRequest, isDebugEnabled) + + RESTConfig config = new RESTConfig(requeryIdAAIRequest); + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) + .addHeader("X-FromAppId", "MSO") + .addHeader("Content-Type", "application/xml") + .addHeader("Accept","application/xml"); + APIResponse response = client.get() + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiRequeryIdReturnCode", returnCode) + utils.log("DEBUG", " ***** AAI ReQuery Response Code : " + returnCode, isDebugEnabled) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + utils.logAudit(aaiResponseAsString) + execution.setVariable(Prefix + "requeryIdAAIResponse", aaiResponseAsString) + utils.log("DEBUG", " ReQueryAAINetworkId Success REST Response - " + "\n" + aaiResponseAsString, isDebugEnabled) + + String netName = utils.getNodeText1(aaiResponseAsString, "network-name") + String networkOutputs = + """ + ${netId} + ${netName} + """ + execution.setVariable(Prefix + "networkOutputs", networkOutputs) + utils.log("DEBUG", " networkOutputs - " + '\n' + networkOutputs, isDebugEnabled) + + } else { + if (returnCode=='404') { + String dataErrorMessage = "Response Error from ReQueryAAINetworkId is 404 (Not Found)." + utils.log("DEBUG", " AAI ReQuery Failed. - " + dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from ReQueryAAINetworkId - " + returnCode + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTReQueryAAINetworkId() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAINetworkVpnBinding(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkVpnBinding() of DoCreateNetworkInstance ***** " , isDebugEnabled) + + try { + + // get variables + String messageId = execution.getVariable(Prefix + "messageId") + String queryIdAAIResponse = execution.getVariable(Prefix + "queryIdAAIResponse").replace('', "") + String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") + utils.log("DEBUG", " relationship - " + relationship, isDebugEnabled) + + // Check if Vnf Binding is present, then build a List of vnfBinding + List vpnBindingUri = networkUtils.getVnfBindingObject(relationship) + int vpnCount = vpnBindingUri.size() + execution.setVariable(Prefix + "vpnCount", vpnCount) + utils.log("DEBUG", Prefix + "vpnCount - " + vpnCount, isDebugEnabled) + + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + AaiUtil aaiUriUtil = new AaiUtil(this) + + if (vpnCount > 0) { + execution.setVariable(Prefix + "vpnBindings", vpnBindingUri) + utils.log("DEBUG", " vpnBindingUri List - " + vpnBindingUri, isDebugEnabled) + + String routeTargets = "" + // AII loop call using list vpnBindings + for (i in 0..vpnBindingUri.size()-1) { + + int counting = i+1 + + // prepare url using vpnBinding + String queryVpnBindingAAIRequest = "" + String aai_uri = aaiUriUtil.getNetworkVpnBindingUri(execution) + + // Note: By default, the vpnBinding url is found in 'related-link' of the response, + // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. + if (aai_uri == null || aai_uri == "") { + // using value of 'related-link' from response + if (vpnBindingUri[i].charAt(vpnBindingUri[i].length()-1) == '/') { + queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i].substring(0, vpnBindingUri[i].length()-1) + } else { + queryVpnBindingAAIRequest = "${aai_endpoint}" + vpnBindingUri[i] + } + + } else { + // using uri value in URN mapping + String vpnBindingId = vpnBindingUri[i].substring(vpnBindingUri[i].indexOf("/vpn-binding/")+13, vpnBindingUri[i].length()) + if (vpnBindingId.charAt(vpnBindingId.length()-1) == '/') { + vpnBindingId = vpnBindingId.substring(0, vpnBindingId.length()-1) + } + queryVpnBindingAAIRequest = "${aai_endpoint}${aai_uri}/" + vpnBindingId + } + + utils.logAudit(queryVpnBindingAAIRequest) + execution.setVariable(Prefix + "queryVpnBindingAAIRequest", queryVpnBindingAAIRequest) + utils.log("DEBUG", Prefix + "queryVpnBindingAAIRequest, , vpnBinding #" + counting + " : " + "\n" + queryVpnBindingAAIRequest, isDebugEnabled) + + RESTConfig config = new RESTConfig(queryVpnBindingAAIRequest); + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) + .addHeader("X-FromAppId", "MSO") + .addHeader("Content-Type", "application/xml") + .addHeader("Accept","application/xml"); + APIResponse response = client.get() + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", returnCode) + utils.log("DEBUG", " ***** AAI query vpn binding Response Code, vpnBinding #" + counting + " : " + returnCode, isDebugEnabled) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + utils.logAudit(aaiResponseAsString) + execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiResponseAsString) + utils.log("DEBUG", " AAI Query Vpn Binding Success REST Response, , vpnBinding #" + counting + " : " + "\n" + aaiResponseAsString, isDebugEnabled) + + String routeTarget = "" + if (utils.nodeExists(aaiResponseAsString, "global-route-target")) { + routeTarget = utils.getNodeText1(aaiResponseAsString, "global-route-target") + routeTargets += "" + routeTarget + "" + '\n' + } + + } else { + if (returnCode=='404') { + String dataErrorMessage = "Response Error from AAINetworkVpnBinding is 404 (Not Found)." + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = " Unexpected Response from AAINetworkVpnBinding - " + returnCode + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } // end loop + + execution.setVariable(Prefix + "routeCollection", routeTargets) + utils.log("DEBUG", Prefix + "routeCollection - " + '\n' + routeTargets, isDebugEnabled) + + } else { + // reset return code to success + execution.setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String schemaVersion = aaiUriUtil.getNamespaceFromUri(aai_uri) + String aaiStubResponse = + """ + + + + """ + String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) + execution.setVariable(Prefix + "queryVpnBindingAAIResponse", aaiStubResponseAsXml) + execution.setVariable(Prefix + "routeCollection", "") + utils.log("DEBUG", " No vpnBinding, using this stub as response - " + '\n' + aaiStubResponseAsXml, isDebugEnabled) + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkVpnBinding() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAINetworkPolicy(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkPolicy() of DoCreateNetworkInstance ***** " , isDebugEnabled) + + try { + // get variables + String messageId = execution.getVariable(Prefix + "messageId") + String queryIdAAIResponse = execution.getVariable(Prefix + "queryIdAAIResponse").replace('', "") + String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") + utils.log("DEBUG", " relationship - " + relationship, isDebugEnabled) + + // Check if Network Policy is present, then build a List of network policy + List networkPolicyUriList = networkUtils.getNetworkPolicyObject(relationship) + int networkPolicyCount = networkPolicyUriList.size() + execution.setVariable(Prefix + "networkPolicyCount", networkPolicyCount) + utils.log("DEBUG", Prefix + "networkPolicyCount - " + networkPolicyCount, isDebugEnabled) + + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + AaiUtil aaiUriUtil = new AaiUtil(this) + + if (networkPolicyCount > 0) { + execution.setVariable(Prefix + "networkPolicyUriList", networkPolicyUriList) + utils.log("DEBUG", " networkPolicyUri List - " + networkPolicyUriList, isDebugEnabled) + + String networkPolicies = "" + // AII loop call using list vpnBindings + for (i in 0..networkPolicyUriList.size()-1) { + + int counting = i+1 + + // prepare url using vpnBinding + String queryNetworkPolicyAAIRequest = "" + + String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) + + // Note: By default, the network policy url is found in 'related-link' of the response, + // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. + if (aai_uri == null || aai_uri == "") { + // using value of 'related-link' from response + if (networkPolicyUriList[i].charAt(networkPolicyUriList[i].length()-1) == '/') { + queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i].substring(0, networkPolicyUriList[i].length()-1) + } else { + queryNetworkPolicyAAIRequest = "${aai_endpoint}" + networkPolicyUriList[i] + } + } else { + // using uri value in URN mapping + String networkPolicyId = networkPolicyUriList[i].substring(networkPolicyUriList[i].indexOf("/network-policy/")+16, networkPolicyUriList[i].length()) + println " networkPolicyId - " + networkPolicyId + if (networkPolicyId.charAt(networkPolicyId.length()-1) == '/') { + networkPolicyId = networkPolicyId.substring(0, networkPolicyId.length()-1) + } + queryNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + networkPolicyId + + } + + + utils.logAudit(queryNetworkPolicyAAIRequest) + execution.setVariable(Prefix + "queryNetworkPolicyAAIRequest", queryNetworkPolicyAAIRequest) + utils.log("DEBUG", Prefix + "queryNetworkPolicyAAIRequest, , NetworkPolicy #" + counting + " : " + "\n" + queryNetworkPolicyAAIRequest, isDebugEnabled) + + RESTConfig config = new RESTConfig(queryNetworkPolicyAAIRequest); + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) + .addHeader("X-FromAppId", "MSO") + .addHeader("Content-Type", "application/xml") + .addHeader("Accept","application/xml"); + APIResponse response = client.get() + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", returnCode) + utils.log("DEBUG", " ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode, isDebugEnabled) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + utils.logAudit(aaiResponseAsString) + execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", aaiResponseAsString) + utils.log("DEBUG", " QueryAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString, isDebugEnabled) + + String networkPolicy = "" + if (utils.nodeExists(aaiResponseAsString, "network-policy-fqdn")) { + networkPolicy = utils.getNodeText1(aaiResponseAsString, "network-policy-fqdn") + networkPolicies += "" + networkPolicy + "" + '\n' + } + + } else { + if (returnCode=='404') { + String dataErrorMessage = "Response Error from QueryAAINetworkPolicy is 404 (Not Found)." + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from QueryAAINetworkPolicy - " + returnCode + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } // end loop + + execution.setVariable(Prefix + "networkCollection", networkPolicies) + utils.log("DEBUG", Prefix + "networkCollection - " + '\n' + networkPolicies, isDebugEnabled) + + } else { + // reset return code to success + execution.setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "200") + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String schemaVersion = aaiUriUtil.getNamespaceFromUri(aai_uri) + String aaiStubResponse = + """ + + + + """ + String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) + execution.setVariable(Prefix + "queryNetworkPolicyAAIResponse", aaiStubResponseAsXml) + execution.setVariable(Prefix + "networkCollection", "") + utils.log("DEBUG", " No net policies, using this stub as response - " + '\n' + aaiStubResponseAsXml, isDebugEnabled) + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkPolicy() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAINetworkTableRef(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside callRESTQueryAAINetworkTableRef() of DoCreateNetworkInstance ***** " , isDebugEnabled) + + try { + // get variables + String messageId = execution.getVariable(Prefix + "messageId") + String queryIdAAIResponse = execution.getVariable(Prefix + "queryIdAAIResponse").replace('', "") + String relationship = networkUtils.getFirstNodeXml(queryIdAAIResponse, "relationship-list").trim().replace("tag0:","").replace(":tag0","") + utils.log("DEBUG", " relationship - " + relationship, isDebugEnabled) + + // Check if Network TableREf is present, then build a List of network policy + List networkTableRefUriList = networkUtils.getNetworkTableRefObject(relationship) + int networkTableRefCount = networkTableRefUriList.size() + execution.setVariable(Prefix + "networkTableRefCount", networkTableRefCount) + utils.log("DEBUG", Prefix + "networkTableRefCount - " + networkTableRefCount, isDebugEnabled) + + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + AaiUtil aaiUriUtil = new AaiUtil(this) + + if (networkTableRefCount > 0) { + execution.setVariable(Prefix + "networkTableRefUriList", networkTableRefUriList) + utils.log("DEBUG", " networkTableRefUri List - " + networkTableRefUriList, isDebugEnabled) + + // AII loop call using list vpnBindings + String networkTableRefs = "" + for (i in 0..networkTableRefUriList.size()-1) { + + int counting = i+1 + + // prepare url using tableRef + String queryNetworkTableRefAAIRequest = "" + + String aai_uri = aaiUriUtil.getNetworkTableReferencesUri(execution) + + // Note: By default, the network policy url is found in 'related-link' of the response, + // so, the default in URN mappings for this is set to "" (ie, space), unless forced to use the URN mapping. + if (aai_uri == null || aai_uri == "") { + // using value of 'related-link' from response + if (networkTableRefUriList[i].charAt(networkTableRefUriList[i].length()-1) == '/') { + queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i].substring(0, networkTableRefUriList[i].length()-1) + } else { + queryNetworkTableRefAAIRequest = "${aai_endpoint}" + networkTableRefUriList[i] + } + } else { + // using uri value in URN mapping + String networkTableRefId = networkTableRefUriList[i].substring(networkTableRefUriList[i].indexOf("/route-table-reference/")+23, networkTableRefUriList[i].length()) + + if (networkTableRefId.charAt(networkTableRefId.length()-1) == '/') { + networkTableRefId = networkTableRefId.substring(0, networkTableRefId.length()-1) + } + queryNetworkTableRefAAIRequest = "${aai_endpoint}${aai_uri}/" + networkTableRefId + + } + + + utils.logAudit(queryNetworkTableRefAAIRequest) + execution.setVariable(Prefix + "queryNetworkTableRefAAIRequest", queryNetworkTableRefAAIRequest) + utils.log("DEBUG", Prefix + "queryNetworkTableRefAAIRequest, , NetworkTableRef #" + counting + " : " + "\n" + queryNetworkTableRefAAIRequest, isDebugEnabled) + + RESTConfig config = new RESTConfig(queryNetworkTableRefAAIRequest); + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) + .addHeader("X-FromAppId", "MSO") + .addHeader("Content-Type", "application/xml") + .addHeader("Accept","application/xml"); + APIResponse response = client.get() + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", returnCode) + utils.log("DEBUG", " ***** AAI query network Table Reference Response Code, NetworkTableRef #" + counting + " : " + returnCode, isDebugEnabled) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + utils.logAudit(aaiResponseAsString) + execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", aaiResponseAsString) + utils.log("DEBUG", " QueryAAINetworkTableRef Success REST Response, , NetworkTableRef #" + counting + " : " + "\n" + aaiResponseAsString, isDebugEnabled) + + String networkTableRef = "" + if (utils.nodeExists(aaiResponseAsString, "route-table-reference-fqdn")) { + networkTableRef = utils.getNodeText1(aaiResponseAsString, "route-table-reference-fqdn") + networkTableRefs += "" + networkTableRef + "" + '\n' + } + + } else { + if (returnCode=='404') { + String dataErrorMessage = "Response Error from QueryAAINetworkTableRef is 404 (Not Found)." + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from QueryAAINetworkTableRef - " + returnCode + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } // end loop + + execution.setVariable(Prefix + "tableRefCollection", networkTableRefs) + utils.log("DEBUG", Prefix + "tableRefCollection - " + '\n' + networkTableRefs, isDebugEnabled) + + } else { + // reset return code to success + execution.setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200") + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String schemaVersion = aaiUriUtil.getNamespaceFromUri(aai_uri) + String aaiStubResponse = + """ + + + + """ + String aaiStubResponseAsXml = utils.formatXml(aaiStubResponse) + execution.setVariable(Prefix + "queryNetworkTableRefAAIResponse", aaiStubResponseAsXml) + execution.setVariable(Prefix + "tableRefCollection", "") + utils.log("DEBUG", " No net table references, using this stub as response - " + '\n' + aaiStubResponseAsXml, isDebugEnabled) + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTQueryAAINetworkTableRef() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + public void callRESTUpdateContrailAAINetwork(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " , isDebugEnabled) + + try { + // get variables + String networkId = execution.getVariable(Prefix + "networkId") + networkId = UriUtils.encode(networkId,"UTF-8") + String requeryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") + String createNetworkResponse = execution.getVariable(Prefix + "createNetworkResponse") + String messageId = execution.getVariable(Prefix + "messageId") + + // Prepare url + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId + + utils.logAudit(updateContrailAAIUrlRequest) + execution.setVariable(Prefix + "updateContrailAAIUrlRequest", updateContrailAAIUrlRequest) + utils.log("DEBUG", Prefix + "updateContrailAAIUrlRequest - " + "\n" + updateContrailAAIUrlRequest, isDebugEnabled) + + //Prepare payload (PUT) + String schemaVersion = aaiUriUtil.getNamespaceFromUri(aai_uri) + String payload = networkUtils.ContrailNetworkCreatedUpdate(requeryIdAAIResponse, createNetworkResponse, schemaVersion) + String payloadXml = utils.formatXml(payload) + utils.logAudit(payloadXml) + execution.setVariable(Prefix + "updateContrailAAIPayloadRequest", payloadXml) + utils.log("DEBUG", " 'payload' to Update Contrail - " + "\n" + payloadXml, isDebugEnabled) + + RESTConfig config = new RESTConfig(updateContrailAAIUrlRequest); + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) + .addHeader("X-FromAppId", "MSO") + .addHeader("Content-Type", "application/xml") + .addHeader("Accept","application/xml"); + + APIResponse response = client.httpPut(payload) + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiUpdateContrailReturnCode", returnCode) + + utils.log("DEBUG", " ***** AAI Update Contrail Response Code : " + returnCode, isDebugEnabled) + + String aaiUpdateContrailResponseAsString = response.getResponseBodyAsString() + + if (returnCode=='200') { + utils.logAudit(aaiUpdateContrailResponseAsString) + execution.setVariable(Prefix + "updateContrailAAIResponse", aaiUpdateContrailResponseAsString) + utils.log("DEBUG", " AAI Update Contrail Success REST Response - " + "\n" + aaiUpdateContrailResponseAsString, isDebugEnabled) + // Point-of-no-return is set to false, rollback not needed. + String rollbackEnabled = execution.getVariable(Prefix + "rollbackEnabled") + if (rollbackEnabled == "true") { + execution.setVariable(Prefix + "isPONR", false) + } else { + execution.setVariable(Prefix + "isPONR", true) + } + + } else { + if (returnCode=='404') { + String dataErrorMessage = " Response Error from UpdateContrailAAINetwork is 404 (Not Found)." + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + if (aaiUpdateContrailResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiUpdateContrailResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String errorMessage = "Unexpected Response from UpdateContrailAAINetwork - " + returnCode + utils.log("DEBUG", errorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, "2500", errorMessage) + } + } + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. callRESTUpdateContrailAAINetwork() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareCreateNetworkRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareCreateNetworkRequest() of DoCreateNetworkInstance ***** ", isDebugEnabled) + + try { + + // get variables + String requestId = execution.getVariable("msoRequestId") + if (requestId == null) { + requestId = execution.getVariable("mso-request-id") + } + String messageId = execution.getVariable(Prefix + "messageId") + String source = execution.getVariable(Prefix + "source") + + String requestInput = execution.getVariable(Prefix + "networkRequest") + String queryIdResponse = execution.getVariable(Prefix + "queryIdAAIResponse") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionPo") + String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled") + + // Prepare Network request + String routeCollection = execution.getVariable(Prefix + "routeCollection") + String policyCollection = execution.getVariable(Prefix + "networkCollection") + String tableCollection = execution.getVariable(Prefix + "tableRefCollection") + String createNetworkRequest = networkUtils.CreateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyCollection, tableCollection, cloudRegionId, backoutOnFailure, source ) + // Format Response + String buildDeleteNetworkRequestAsString = utils.formatXml(createNetworkRequest) + buildDeleteNetworkRequestAsString = buildDeleteNetworkRequestAsString.replace(":w1aac13n0", "").replace("w1aac13n0:", "") + utils.logAudit(buildDeleteNetworkRequestAsString) + + execution.setVariable(Prefix + "createNetworkRequest", buildDeleteNetworkRequestAsString) + utils.log("DEBUG", Prefix + "createNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString, isDebugEnabled) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareCreateNetworkRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareSDNCRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareSDNCRequest() of DoCreateNetworkInstance ***** ", isDebugEnabled) + + try { + // get variables + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + + String networkId = execution.getVariable(Prefix + "networkId") + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + + // get/set 'msoRequestId' and 'mso-request-id' + String requestId = execution.getVariable("msoRequestId") + if (requestId != null) { + execution.setVariable("mso-request-id", requestId) + } else { + requestId = execution.getVariable("mso-request-id") + } + execution.setVariable(Prefix + "requestId", requestId) + + // 1. prepare assign topology via SDNC Adapter SUBFLOW call + String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, createNetworkInput, serviceInstanceId, sdncCallback, "assign", "NetworkActivateRequest", cloudRegionId, networkId, null, null) + + String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) + utils.logAudit(sndcTopologyCreateRequesAsString) + execution.setVariable(Prefix + "assignSDNCRequest", sndcTopologyCreateRequesAsString) + utils.log("DEBUG", Prefix + "assignSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString, isDebugEnabled) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSDNCRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRpcSDNCRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareRpcSDNCRequest() of DoCreateNetworkInstance ***** ", isDebugEnabled) + + try { + // get variables + + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + + String networkId = execution.getVariable(Prefix + "networkId") + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + + // 1. prepare assign topology via SDNC Adapter SUBFLOW call + String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "assign", "CreateNetworkInstance", cloudRegionId, networkId, null) + + String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) + utils.logAudit(sndcTopologyCreateRequesAsString) + execution.setVariable(Prefix + "assignSDNCRequest", sndcTopologyCreateRequesAsString) + utils.log("DEBUG", Prefix + "assignSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString, isDebugEnabled) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRpcSDNCActivateRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareRpcSDNCActivateRequest() of DoCreateNetworkInstance ***** ", isDebugEnabled) + + try { + // get variables + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + String networkId = execution.getVariable(Prefix + "networkId") + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + + // 1. prepare assign topology via SDNC Adapter SUBFLOW call + String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "activate", "ActivateNetworkInstance", cloudRegionId, networkId, null) + + String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) + utils.logAudit(sndcTopologyCreateRequesAsString) + execution.setVariable(Prefix + "activateSDNCRequest", sndcTopologyCreateRequesAsString) + utils.log("DEBUG", Prefix + "activateSDNCRequest - " + "\n" + sndcTopologyCreateRequesAsString, isDebugEnabled) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCActivateRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + + + // ************************************************** + // Post or Validate Response Section + // ************************************************** + + public void validateCreateNetworkResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside validateNetworkResponse() of DoCreateNetworkInstance *****", isDebugEnabled) + + try { + String returnCode = execution.getVariable(Prefix + "networkReturnCode") + String networkResponse = execution.getVariable(Prefix + "createNetworkResponse") + if (networkResponse==null) { + networkResponse="" // reset + } + + utils.log("DEBUG", " Network Adapter create responseCode: " + returnCode, isDebugEnabled) + + String errorMessage = "" + if (returnCode == "200") { + execution.setVariable(Prefix + "isNetworkRollbackNeeded", true) + utils.logAudit(networkResponse) + execution.setVariable(Prefix + "createNetworkResponse", networkResponse) + utils.log("DEBUG", " Network Adapter create Success Response - " + "\n" + networkResponse, isDebugEnabled) + + // prepare rollback data + String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","") + rollbackData = rollbackData.replace("rollback>", "networkRollback>") + String rollbackNetwork = + """ + ${rollbackData} + """ + String rollbackNetworkXml = utils.formatXml(rollbackNetwork) + execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkXml) + utils.log("DEBUG", " Network Adapter rollback data - " + "\n" + rollbackNetworkXml, isDebugEnabled) + + } else { // network error + if (returnCode.toInteger() > 399 && returnCode.toInteger() < 600) { //4xx, 5xx + if (networkResponse.contains("createNetworkError")) { + networkResponse = networkResponse.replace('', '') + errorMessage = utils.getNodeText1(networkResponse, "message") + errorMessage = "Received error from Network Adapter: " + errorMessage + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + + } else { // CatchAll exception + if (returnCode == "500") { + errorMessage = "JBWEB000065: HTTP Status 500." + } else { + errorMessage = "Return code is " + returnCode + } + errorMessage = "Received error from Network Adapter: " + errorMessage + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + + } + + } else { // CatchAll exception + String dataErrorMessage = "Received error from Network Adapter. Return code is: " + returnCode + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. validateCreateNetworkResponse() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + + } + + public void validateSDNCResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside validateSDNCResponse() of DoCreateNetworkInstance ***** ", isDebugEnabled) + + String response = execution.getVariable(Prefix + "assignSDNCResponse") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + WorkflowException workflowException = execution.getVariable("WorkflowException") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + // reset variable + String assignSDNCResponseDecodeXml = sdncAdapterUtils.decodeXML(execution.getVariable(Prefix + "assignSDNCResponse")) + assignSDNCResponseDecodeXml = assignSDNCResponseDecodeXml.replace("&", "&").replace('', "") + execution.setVariable(Prefix + "assignSDNCResponse", assignSDNCResponseDecodeXml) + + if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, Prefix+'sdncResponseSuccess' + execution.setVariable(Prefix + "isSdncRollbackNeeded", true) + utils.log("DEBUG", "Successfully Validated SDNC Response", isDebugEnabled) + + } else { + utils.log("DEBUG", "Did NOT Successfully Validated SDNC Response", isDebugEnabled) + throw new BpmnError("MSOWorkflowException") + } + + } + + public void validateRpcSDNCActivateResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside validateRpcSDNCActivateResponse() of DoCreateNetworkInstance ***** ", isDebugEnabled) + + String response = execution.getVariable(Prefix + "activateSDNCResponse") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + WorkflowException workflowException = execution.getVariable("WorkflowException") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + // reset variable + String assignSDNCResponseDecodeXml = sdncAdapterUtils.decodeXML(execution.getVariable(Prefix + "activateSDNCResponse")) + assignSDNCResponseDecodeXml = assignSDNCResponseDecodeXml.replace("&", "&").replace('', "") + execution.setVariable(Prefix + "activateSDNCResponse", assignSDNCResponseDecodeXml) + + if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, Prefix+'sdncResponseSuccess' + execution.setVariable(Prefix + "isSdncActivateRollbackNeeded", true) + utils.log("DEBUG", "Successfully Validated Rpc SDNC Activate Response", isDebugEnabled) + + } else { + utils.log("DEBUG", "Did NOT Successfully Validated Rpc SDNC Activate Response", isDebugEnabled) + throw new BpmnError("MSOWorkflowException") + } + + } + + + public void prepareSDNCRollbackRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareSDNCRollbackRequest() of DoCreateNetworkInstance ***** ", isDebugEnabled) + + try { + // get variables + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + String assignSDNCResponse = execution.getVariable(Prefix + "assignSDNCResponse") + String networkId = execution.getVariable(Prefix + "networkId") + if (networkId == 'null') {networkId = ""} + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + + // 2. prepare rollback topology via SDNC Adapter SUBFLOW call + String sndcTopologyRollbackRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, createNetworkInput, serviceInstanceId, sdncCallback, "rollback", "NetworkActivateRequest", cloudRegionId, networkId, null, null) + String sndcTopologyRollbackRequestAsString = utils.formatXml(sndcTopologyRollbackRequest) + execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyRollbackRequestAsString) + utils.log("DEBUG", " Preparing request for SDNC Topology 'rollback-NetworkActivateRequest' rollback . . . - " + "\n" + sndcTopologyRollbackRequestAsString, isDebugEnabled) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSDNCRollbackRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRpcSDNCRollbackRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareRpcSDNCRollbackRequest() of DoCreateNetworkInstance ***** ", isDebugEnabled) + + try { + // get variables + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + String assignSDNCResponse = execution.getVariable(Prefix + "assignSDNCResponse") + String networkId = execution.getVariable(Prefix + "networkId") + if (networkId == 'null') {networkId = ""} + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + + // 2. prepare rollback topology via SDNC Adapter SUBFLOW call + String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "unassign", "DeleteNetworkInstance", cloudRegionId, networkId, null) + String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) + execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyRollbackRpcRequestAsString) + utils.log("DEBUG", " Preparing request for SDNC Topology 'unassign-DeleteNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString, isDebugEnabled) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCRollbackRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRpcSDNCActivateRollback(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareRpcSDNCActivateRollback() of DoCreateNetworkInstance ***** ", isDebugEnabled) + + try { + + // get variables + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + String activateSDNCResponse = execution.getVariable(Prefix + "activateSDNCResponse") + String networkId = execution.getVariable(Prefix + "networkId") + if (networkId == 'null') {networkId = ""} + String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") + + // 2. prepare rollback topology via SDNC Adapter SUBFLOW call + String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, createNetworkInput, serviceInstanceId, sdncCallback, "deactivate", "DeleteNetworkInstance", cloudRegionId, networkId, null) + String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) + execution.setVariable(Prefix + "rollbackActivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString) + utils.log("DEBUG", " Preparing request for RPC SDNC Topology 'deactivate-DeleteNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString, isDebugEnabled) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRpcSDNCActivateRollback() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRollbackData(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareRollbackData() of DoCreateNetworkInstance ***** ", isDebugEnabled) + + try { + + Map rollbackData = new HashMap(); + String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") + if (rollbackSDNCRequest != null) { + if (rollbackSDNCRequest != "") { + rollbackData.put("rollbackSDNCRequest", execution.getVariable(Prefix + "rollbackSDNCRequest")) + } + } + String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") + if (rollbackNetworkRequest != null) { + if (rollbackNetworkRequest != "") { + rollbackData.put("rollbackNetworkRequest", execution.getVariable(Prefix + "rollbackNetworkRequest")) + } + } + String rollbackActivateSDNCRequest = execution.getVariable(Prefix + "rollbackActivateSDNCRequest") + if (rollbackActivateSDNCRequest != null) { + if (rollbackActivateSDNCRequest != "") { + rollbackData.put("rollbackActivateSDNCRequest", execution.getVariable(Prefix + "rollbackActivateSDNCRequest")) + } + } + execution.setVariable("rollbackData", rollbackData) + utils.log("DEBUG", "** rollbackData : " + rollbackData, isDebugEnabled) + + execution.setVariable("WorkflowException", execution.getVariable(Prefix + "WorkflowException")) + utils.log("DEBUG", "** WorkflowException : " + execution.getVariable("WorkflowException"), isDebugEnabled) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareRollbackData() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void postProcessResponse(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside postProcessResponse() of DoCreateNetworkInstance ***** ", isDebugEnabled) + + try { + + //Conditions: + // 1. Silent Success: execution.getVariable("CRENWKI_orchestrationStatus") == "ACTIVE" + // 2. Success: execution.getVariable("WorkflowException") == null (NULL) + // 3. WorkflowException: execution.getVariable("WorkflowException") != null (NOT NULL) + + utils.log("DEBUG", " ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException"), isDebugEnabled) + // successful flow + if (execution.getVariable(Prefix + "isException") == false) { + // set rollback data + execution.setVariable("orchestrationStatus", "") + execution.setVariable("networkId", execution.getVariable(Prefix + "networkId")) + execution.setVariable("networkName", execution.getVariable(Prefix + "networkName")) + prepareSuccessRollbackData(execution) // populate rollbackData + execution.setVariable("WorkflowException", null) + execution.setVariable(Prefix + "Success", true) + utils.log("DEBUG", " ***** postProcessResponse(), GOOD !!!", isDebugEnabled) + } else { + // inside sub-flow logic + execution.setVariable(Prefix + "Success", false) + execution.setVariable("rollbackData", null) + String exceptionMessage = " Exception encountered in MSO Bpmn. " + if (execution.getVariable("workflowException") != null) { // Output of Rollback flow. + utils.log("DEBUG", " ***** workflowException: " + execution.getVariable("workflowException"), isDebugEnabled) + WorkflowException wfex = execution.getVariable("workflowException") + exceptionMessage = wfex.getErrorMessage() + } else { + if (execution.getVariable(Prefix + "WorkflowException") != null) { + WorkflowException pwfex = execution.getVariable(Prefix + "WorkflowException") + exceptionMessage = pwfex.getErrorMessage() + } + } + // going to the Main flow: a-la-carte or macro + utils.log("DEBUG", " ***** postProcessResponse(), BAD !!!", isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + throw new BpmnError("MSOWorkflowException") + } + + } catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. postProcessResponse() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + throw new BpmnError("MSOWorkflowException") + + } + + + + } + + public void prepareSuccessRollbackData(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareSuccessRollbackData() of DoCreateNetworkInstance ***** ", isDebugEnabled) + + try { + + if (execution.getVariable("sdncVersion") == '1702') { + prepareRpcSDNCRollbackRequest(execution) + prepareRpcSDNCActivateRollback(execution) + } else { + prepareSDNCRollbackRequest(execution) + } + + Map rollbackData = new HashMap(); + String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") + if (rollbackSDNCRequest != null) { + if (rollbackSDNCRequest != "") { + rollbackData.put("rollbackSDNCRequest", rollbackSDNCRequest) + } + } + String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") + if (rollbackNetworkRequest != null) { + if (rollbackNetworkRequest != "") { + rollbackData.put("rollbackNetworkRequest", rollbackNetworkRequest) + } + } + String rollbackActivateSDNCRequest = execution.getVariable(Prefix + "rollbackActivateSDNCRequest") + if (rollbackActivateSDNCRequest != null) { + if (rollbackActivateSDNCRequest != "") { + rollbackData.put("rollbackActivateSDNCRequest", rollbackActivateSDNCRequest) + } + } + execution.setVariable("rollbackData", rollbackData) + + utils.log("DEBUG", "** 'rollbackData' for Full Rollback : " + rollbackData, isDebugEnabled) + execution.setVariable("WorkflowException", null) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void setExceptionFlag(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside setExceptionFlag() of DoCreateNetworkInstance ***** ", isDebugEnabled) + + try { + + execution.setVariable(Prefix + "isException", true) + + if (execution.getVariable("SavedWorkflowException1") != null) { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) + } else { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) + } + utils.log("DEBUG", Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException"), isDebugEnabled) + + } catch(Exception ex){ + String exceptionMessage = "Bpmn error encountered in DoCreateNetworkInstance flow. setExceptionFlag(): " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + } + + } + + + // ******************************* + // Build Error Section + // ******************************* + + + + public void processJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + try{ + utils.log("DEBUG", "Caught a Java Exception in " + Prefix, isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) + } + utils.log("DEBUG", "Completed processJavaException Method in " + Prefix, isDebugEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy new file mode 100644 index 0000000000..0ad42f9da4 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy @@ -0,0 +1,387 @@ +/*- + * ============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 groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.NetworkUtils +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils + +/** + * This groovy class supports the DoCreateNetworkInstance.bpmn process. + * + */ +public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcessor { + String Prefix="CRENWKIR_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + NetworkUtils networkUtils = new NetworkUtils() + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + def className = getClass().getSimpleName() + + /** + * This method is executed during the preProcessRequest task of the DoCreateNetworkInstanceRollback.bpmn process. + * @param execution + */ + public InitializeProcessVariables(Execution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable(Prefix + "rollbackNetworkRequest", null) + execution.setVariable(Prefix + "rollbackSDNCRequest", null) + execution.setVariable(Prefix + "rollbackActivateSDNCRequest", null) + execution.setVariable(Prefix + "WorkflowException", null) + + execution.setVariable(Prefix + "rollbackNetworkRequest", "") + execution.setVariable(Prefix + "rollbackNetworkResponse", "") + execution.setVariable(Prefix + "rollbackNetworkReturnCode", "") + + execution.setVariable(Prefix + "rollbackSDNCRequest", "") + execution.setVariable(Prefix + "rollbackSDNCResponse", "") + execution.setVariable(Prefix + "rollbackSDNCReturnCode", "") + + execution.setVariable(Prefix + "rollbackActivateSDNCRequest", "") + execution.setVariable(Prefix + "rollbackActivateSDNCResponse", "") + execution.setVariable(Prefix + "rollbackActivateSDNCReturnCode", "") + + execution.setVariable(Prefix + "Success", false) + execution.setVariable(Prefix + "fullRollback", false) + execution.setVariable(Prefix + "networkId", "") + execution.setVariable(Prefix + "urlRollbackPoNetwork", "") + + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the DoCreateNetworkInstanceRollback.bpmn process. + * @param execution + */ + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside preProcessRequest() of " + className + ".groovy ***** ", isDebugEnabled) + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + // GET Incoming request/variables + String rollbackNetworkRequest = null + String rollbackSDNCRequest = null + String rollbackActivateSDNCRequest = null + + // Partial Rollback + Map rollbackData = execution.getVariable("rollbackData") + if (rollbackData != null && rollbackData instanceof Map) { + + if(rollbackData.containsKey("rollbackSDNCRequest")) { + rollbackSDNCRequest = rollbackData["rollbackSDNCRequest"] + } + + if(rollbackData.containsKey("rollbackNetworkRequest")) { + rollbackNetworkRequest = rollbackData["rollbackNetworkRequest"] + } + + if(rollbackData.containsKey("rollbackActivateSDNCRequest")) { + rollbackActivateSDNCRequest = rollbackData["rollbackActivateSDNCRequest"] + } + + } + + execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkRequest) + execution.setVariable(Prefix + "rollbackSDNCRequest", rollbackSDNCRequest) + execution.setVariable(Prefix + "rollbackActivateSDNCRequest", rollbackActivateSDNCRequest) + utils.log("DEBUG", "'rollbackData': " + '\n' + execution.getVariable("rollbackData"), isDebugEnabled) + + String sdncVersion = execution.getVariable("sdncVersion") + utils.log("DEBUG", "sdncVersion? : " + sdncVersion, isDebugEnabled) + + // PO Authorization Info / headers Authorization= + String basicAuthValuePO = execution.getVariable("URN_mso_adapters_po_auth") + utils.log("DEBUG", " Obtained BasicAuth userid password for PO/SDNC adapter: " + basicAuthValuePO, isDebugEnabled) + try { + def encodedString = utils.getBasicAuth(basicAuthValuePO, execution.getVariable("URN_mso_msoKey")) + execution.setVariable("BasicAuthHeaderValuePO",encodedString) + execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) + + } catch (IOException ex) { + String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " + String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage , isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + if (execution.getVariable("SavedWorkflowException1") != null) { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) + } else { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) + } + utils.log("DEBUG", "*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException"), isDebugEnabled) + if(execution.getVariable(Prefix + "WorkflowException") != null) { + // called by: DoCreateNetworkInstance, partial rollback + execution.setVariable(Prefix + "fullRollback", false) + + } else { + // called by: Macro - Full Rollback, WorkflowException = null + execution.setVariable(Prefix + "fullRollback", true) + + } + utils.log("DEBUG", "*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"), isDebugEnabled) + + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callPONetworkAdapter (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside callPONetworkAdapter() of " + className + " ***** ", isDebugEnabled) + + try { + String poUrl = execution.getVariable("URN_mso_adapters_network_rest_endpoint") + String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") + String networkId = utils.getNodeText1(rollbackSDNCRequest, "network-id") + + String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") + + String urlRollbackPoNetwork = poUrl+ "/" + networkId + "/rollback" + utils.log("DEBUG", "'urlRollbackPoNetwork': " + urlRollbackPoNetwork, isDebugEnabled) + execution.setVariable(Prefix + "urlRollbackPoNetwork", urlRollbackPoNetwork) + + RESTConfig config = new RESTConfig(urlRollbackPoNetwork) + RESTClient client = new RESTClient(config). + addHeader("Content-Type", "application/xml"). + addAuthorizationHeader(execution.getVariable("BasicAuthHeaderValuePO")); + + APIResponse response = client.httpDelete(rollbackNetworkRequest) + String responseCode = response.getStatusCode() + String responseBody = response.getResponseBodyAsString() + + execution.setVariable(Prefix + "rollbackNetworkReturnCode", responseCode) + execution.setVariable(Prefix + "rollbackNetworkResponse", responseBody) + + utils.log("DEBUG", " Network Adapter rollback responseCode: " + responseCode, isDebugEnabled) + utils.log("DEBUG", " Network Adapter rollback responseBody: " + responseBody, isDebugEnabled) + + + } catch (Exception ex) { + String exceptionMessage = "Exception Encountered in callPONetworkAdapter() of DoCreateNetworkInstanceRollback flow - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + } + + + public void validateRollbackResponses (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside validateRollbackResponses() of DoCreateNetworkInstanceRollback ***** ", isDebugEnabled) + + try { + // validate PO network rollback response + String rollbackNetworkErrorMessages = "" + String rollbackNetworkReturnCode = "200" + if (execution.getVariable(Prefix + "rollbackNetworkRequest") != null) { + rollbackNetworkReturnCode = execution.getVariable(Prefix + "rollbackNetworkReturnCode") + String rollbackNetworkResponse = execution.getVariable(Prefix + "rollbackNetworkResponse") + utils.log("DEBUG", " NetworkRollback Code - " + rollbackNetworkReturnCode, isDebugEnabled) + utils.log("DEBUG", " NetworkRollback Response - " + rollbackNetworkResponse, isDebugEnabled) + if (rollbackNetworkReturnCode != "200") { + rollbackNetworkErrorMessages = " + PO Network rollback failed. " + } else { + rollbackNetworkErrorMessages = " + PO Network rollback completed." + } + } + + // validate SDNC rollback response + String rollbackSdncErrorMessages = "" + String rollbackSDNCReturnCode = "200" + if (execution.getVariable(Prefix + "rollbackSDNCRequest") != null) { + rollbackSDNCReturnCode = execution.getVariable(Prefix + "rollbackSDNCReturnCode") + String rollbackSDNCResponse = execution.getVariable(Prefix + "rollbackSDNCResponse") + String rollbackSDNCReturnInnerCode = "" + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + rollbackSDNCResponse = sdncAdapterUtils.decodeXML(rollbackSDNCResponse) + rollbackSDNCResponse = rollbackSDNCResponse.replace("&", "&").replace('$', '').replace('', "") + if (rollbackSDNCReturnCode == "200") { + if (utils.nodeExists(rollbackSDNCResponse, "response-code")) { + rollbackSDNCReturnInnerCode = utils.getNodeText1(rollbackSDNCResponse, "response-code") + if (rollbackSDNCReturnInnerCode == "200" || rollbackSDNCReturnInnerCode == "" || rollbackSDNCReturnInnerCode == "0") { + rollbackSdncErrorMessages = " + SNDC assign rollback completed." + } else { + rollbackSdncErrorMessages = " + SDNC assign rollback failed. " + } + } else { + rollbackSdncErrorMessages = " + SNDC assign rollback completed." + } + } else { + rollbackSdncErrorMessages = " + SDNC assign rollback failed. " + } + utils.log("DEBUG", " SDNC assign rollback Code - " + rollbackSDNCReturnCode, isDebugEnabled) + utils.log("DEBUG", " SDNC assign rollback Response - " + rollbackSDNCResponse, isDebugEnabled) + } + + // validate SDNC activate rollback response + String rollbackActivateSdncErrorMessages = "" + String rollbackActivateSDNCReturnCode = "200" + if (execution.getVariable(Prefix + "rollbackActivateSDNCRequest") != null) { + rollbackActivateSDNCReturnCode = execution.getVariable(Prefix + "rollbackActivateSDNCReturnCode") + String rollbackActivateSDNCResponse = execution.getVariable(Prefix + "rollbackActivateSDNCResponse") + String rollbackActivateSDNCReturnInnerCode = "" + rollbackActivateSDNCResponse = sdncAdapterUtils.decodeXML(rollbackActivateSDNCResponse) + rollbackActivateSDNCResponse = rollbackActivateSDNCResponse.replace("&", "&").replace('$', '').replace('', "") + if (rollbackActivateSDNCReturnCode == "200") { + if (utils.nodeExists(rollbackActivateSDNCResponse, "response-code")) { + rollbackActivateSDNCReturnInnerCode = utils.getNodeText1(rollbackActivateSDNCResponse, "response-code") + if (rollbackActivateSDNCReturnInnerCode == "200" || rollbackActivateSDNCReturnInnerCode == "" || rollbackActivateSDNCReturnInnerCode == "0") { + rollbackActivateSdncErrorMessages = " + SNDC activate rollback completed." + } else { + rollbackActivateSdncErrorMessages = " + SDNC activate rollback failed. " + } + } else { + rollbackActivateSdncErrorMessages = " + SNDC activate rollback completed." + } + } else { + rollbackActivateSdncErrorMessages = " + SDNC activate rollback failed. " + } + utils.log("DEBUG", " SDNC activate rollback Code - " + rollbackActivateSDNCReturnCode, isDebugEnabled) + utils.log("DEBUG", " SDNC activate rollback Response - " + rollbackActivateSDNCResponse, isDebugEnabled) + } + + + String statusMessage = "" + int errorCode = 7000 + utils.log("DEBUG", "*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"), isDebugEnabled) + if (execution.getVariable(Prefix + "fullRollback") == false) { + // original WorkflowException, + WorkflowException wfe = execution.getVariable(Prefix + "WorkflowException") + if (wfe != null) { + // rollback due to failure in DoCreate - Partial rollback + statusMessage = wfe.getErrorMessage() + errorCode = wfe.getErrorCode() + } else { + statusMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." + errorCode = '7000' + } + + // set if all rolledbacks are successful + if (rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200" && rollbackActivateSDNCReturnCode == "200") { + execution.setVariable("rolledBack", true) + execution.setVariable("wasDeleted", true) + + } else { + execution.setVariable("rolledBack", false) + execution.setVariable("wasDeleted", true) + } + + statusMessage = statusMessage + rollbackActivateSdncErrorMessages + rollbackNetworkErrorMessages + rollbackSdncErrorMessages + utils.log("DEBUG", "Final DoCreateNetworkInstanceRollback status message: " + statusMessage, isDebugEnabled) + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, errorCode, statusMessage); + execution.setVariable("workflowException", exception); + + } else { + // rollback due to failures in Main flow (Macro) - Full rollback + // WorkflowException = null + if (rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200" && rollbackActivateSDNCReturnCode == "200") { + execution.setVariable("rollbackSuccessful", true) + execution.setVariable("rollbackError", false) + } else { + String exceptionMessage = "Network Create Rollback was not Successful. " + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + execution.setVariable("rollbackSuccessful", false) + execution.setVariable("rollbackError", true) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + throw new BpmnError("MSOWorkflowException") + } + + } + + + } catch (Exception ex) { + String errorMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." + String exceptionMessage = " Bpmn error encountered in DoCreateNetworkInstanceRollback flow. validateRollbackResponses() - " + errorMessage + ": " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + // ******************************* + // Build Error Section + // ******************************* + + + + public void processJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + try{ + utils.log("DEBUG", "Caught a Java Exception in " + Prefix, isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) + } + utils.log("DEBUG", "Completed processJavaException Method in " + Prefix, isDebugEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy new file mode 100644 index 0000000000..be26247416 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy @@ -0,0 +1,506 @@ +/*- + * ============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.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.json.JSONObject; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; + +/** + * This groovy class supports the DoCreateServiceInstance.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId + * @param - subscriptionServiceType + * @param - serviceInstanceId + * @param - serviceInstanceName - O + * @param - serviceModelInfo + * @param - productFamilyId + * @param - disableRollback + * @param - failExists - TODO + * @param - serviceInputParams - Deferred/TODO + * @param - sdncVersion ("1610") + * + * Outputs: + * @param - rollbackData (localRB->null) + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * @param - WorkflowException + * @param - serviceInstanceName - TODO (GET from AAI if null in input) + * + */ +public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix="DCRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + + public void preProcessRequest (Execution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("prefix", Prefix) + + //Inputs + //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology + String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + + //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData & SDNC assignToplology + String serviceInstanceName = execution.getVariable("serviceInstanceName") + //Generated in parent for AAI PUT + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + //requestDetails.modelInfo. for AAI PUT servieInstanceData & SDNC assignTopology + String serviceModelInfo = execution.getVariable("serviceModelInfo") + + //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + //requestDetails.requestParameters. for SDNC assignTopology + String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId + + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(serviceInstanceId)){ + msg = "Input serviceInstanceId is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + if (productFamilyId == null) { + execution.setVariable("productFamilyId", "") + } + + String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') + if (isBlank(sdncCallbackUrl)) { + msg = "URN_mso_workflow_sdncadapter_callback is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) + + String personaModelId = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantId") + String personaModelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") + + if (personaModelId == null) { + personaModelId = "" + } + if (personaModelVersion == null) { + personaModelVersion = "" + } + if (serviceInstanceName == null) { + execution.setVariable("serviceInstanceName", "") + serviceInstanceName = "" + } + + //AAI PUT + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) + String serviceInstanceData = + """ + ${serviceInstanceName} + active + ${personaModelId} + ${personaModelVersion} + """.trim() + + execution.setVariable("serviceInstanceData", serviceInstanceData) + utils.logAudit(serviceInstanceData) + utils.log("DEBUG", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + //TODO: Will be able to replace with call to GenericGetService + public void getAAICustomerById (Execution execution) { + // https://{aaiEP}/aai/v8/business/customers/customer/{globalCustomerId} + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + try { + + String globalCustomerId = execution.getVariable("globalSubscriberId") //VID to AAI name map + utils.log("DEBUG"," ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId, isDebugEnabled) + + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + if (isBlank(aai_endpoint) || isBlank(aai_uri)) + { + msg = "AAI URL is invalid. Endpoint:" + aai_endpoint + aai_uri + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + String getAAICustomerUrl = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + + utils.logAudit(getAAICustomerUrl) + utils.log("DEBUG", "getAAICustomerById Url:" + getAAICustomerUrl, isDebugEnabled) + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getAAICustomerUrl) + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msg = "getAAICustomerById ResponseCode:" + returnCode + " ResponseString:" + aaiResponseAsString + utils.log("DEBUG",msg, isDebugEnabled) + utils.logAudit(msg) + + if (returnCode=='200') { + // Customer found by ID. FLow to proceed. + utils.log("DEBUG",msg, isDebugEnabled) + + //TODO Deferred + //we might verify that service-subscription with matching name exists + //and throw error if not. If not checked, we will get exception in subsequent step on Create call + //in 1610 we assume both customer & service subscription were pre-created + + } else { + if (returnCode=='404') { + msg = "GlobalCustomerId:" + globalCustomerId + " not found (404) in AAI" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + utils.log("ERROR", aaiResponseAsString) + WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", workflowException) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + msg = "Error in getAAICustomerById ResponseCode:" + returnCode + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in getAAICustomerById. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit getAAICustomerById *****", isDebugEnabled) + + } + + public void postProcessAAIGET(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessAAIGET ***** ", isDebugEnabled) + String msg = "" + + try { + String serviceInstanceName = execution.getVariable("serviceInstanceName") + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(succInAAI != true){ + utils.log("DEBUG","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled) + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + else + { + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + if(foundInAAI == true){ + utils.log("DEBUG","Found Service-instance in AAI", isDebugEnabled) + msg = "ServiceInstance already exists in AAI:" + serviceInstanceName + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *** Exit postProcessAAIGET *** ", isDebugEnabled) + } + + public void postProcessAAIPUT(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessAAIPUT ***** ", isDebugEnabled) + String msg = "" + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator") + if(succInAAI != true){ + utils.log("DEBUG","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled) + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + } + else + { + //start rollback set up + RollbackData rollbackData = new RollbackData() + def disableRollback = execution.getVariable("disableRollback") + rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) + rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") + rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId) + rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType")) + rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) + execution.setVariable("rollbackData", rollbackData) + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *** Exit postProcessAAIPUT *** ", isDebugEnabled) + } + + public void preProcessSDNCAssignRequest(Execution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessSDNCAssignRequest *****", isDebugEnabled) + + try { + def serviceInstanceId = execution.getVariable("serviceInstanceId") + def serviceInstanceName = execution.getVariable("serviceInstanceName") + def callbackURL = execution.getVariable("sdncCallbackUrl") + def requestId = execution.getVariable("msoRequestId") + def serviceId = execution.getVariable("productFamilyId") + def subscriptionServiceType = execution.getVariable("subscriptionServiceType") + def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + + String serviceModelInfo = execution.getVariable("serviceModelInfo") + def modelInvariantId = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantId") + def modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") + def modelUUId = jsonUtil.getJsonValue(serviceModelInfo, "modelVersionId") + def modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") + def sdncRequestId = UUID.randomUUID().toString() + + if (modelInvariantId == null) { + modelInvariantId = "" + } + if (modelVersion == null) { + modelVersion = "" + } + if (modelUUId == null) { + modelUUId = "" + } + if (modelName == null) { + modelName = "" + } + + String sdncAssignRequest = + """ + + ${sdncRequestId} + ${serviceInstanceId} + assign + service-topology-operation + ${callbackURL} + + + + ${requestId} + MSO + + + + CreateServiceInstance + + + ${serviceId} + ${subscriptionServiceType} + + ${modelInvariantId} + ${modelUUId} + ${modelVersion} + ${modelName} + + ${serviceInstanceId} + + ${globalSubscriberId} + + + ${serviceInstanceName} + + + """ + + utils.log("DEBUG","sdncAssignRequest:\n" + sdncAssignRequest, isDebugEnabled) + sdncAssignRequest = utils.formatXml(sdncAssignRequest) + execution.setVariable("sdncAssignRequest", sdncAssignRequest) + utils.logAudit("sdncAssignRequest: " + sdncAssignRequest) + + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncRollbackRequest = sdncAssignRequest.replace(">assign<", ">delete<").replace(">CreateServiceInstance<", ">DeleteServiceInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put("SERVICEINSTANCE", "sdncRollbackRequest", sdncRollbackRequest) + execution.setVariable("rollbackData", rollbackData) + + utils.log("DEBUG","sdncRollbackRequest:\n" + sdncRollbackRequest, isDebugEnabled) + utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCAssignRequest. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit preProcessSDNCAssignRequest *****", isDebugEnabled) + } + + public void postProcessSDNCAssign (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessSDNCAssign ***** ", isDebugEnabled) + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + String response = execution.getVariable("sdncAdapterResponse") + utils.logAudit("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + utils.log("DEBUG","Good response from SDNC Adapter for service-instance topology assign: \n" + response, isDebugEnabled) + + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true") + execution.setVariable("rollbackData", rollbackData) + + }else{ + utils.log("DEBUG","Bad Response from SDNC Adapter for service-instance assign", isDebugEnabled) + throw new BpmnError("MSOWorkflowException") + } + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in postProcessSDNCAssign. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *** Exit postProcessSDNCAssign *** ", isDebugEnabled) + } + + public void preProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled) + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled) + } + + public void postProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled) + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) + execution.setVariable("WorkflowException", workflowException); + } + execution.setVariable("rollbackData", null) + } catch (BpmnError b) { + utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy new file mode 100644 index 0000000000..bc34987cec --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy @@ -0,0 +1,231 @@ +/*- + * ============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.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.json.JSONObject; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; +/** + * This groovy class supports the DoCreateServiceInstanceRollback.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - rollbackData with + * globalCustomerId + * subscriptionServiceType + * serviceInstanceId + * disableRollback + * rollbackAAI + * rollbackSDNC + * sdncRollbackRequest + * + * + * Outputs: + * @param - rollbackError + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * + */ +public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcessor{ + + String Prefix="DCRESIRB_" + + public void preProcessRequest(Execution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) + execution.setVariable("rollbackAAI",false) + execution.setVariable("rollbackSDNC",false) + + try { + def rollbackData = execution.getVariable("rollbackData") + utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled) + + if (rollbackData != null) { + if (rollbackData.hasType("SERVICEINSTANCE")) { + + def serviceInstanceId = rollbackData.get("SERVICEINSTANCE", "serviceInstanceId") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + def subscriptionServiceType = rollbackData.get("SERVICEINSTANCE", "subscriptionServiceType") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + + def globalSubscriberId = rollbackData.get("SERVICEINSTANCE", "globalSubscriberId") + execution.setVariable("globalSubscriberId", globalSubscriberId) + + def rollbackAAI = rollbackData.get("SERVICEINSTANCE", "rollbackAAI") + if ("true".equals(rollbackAAI)) + { + execution.setVariable("rollbackAAI",true) + } + + def rollbackSDNC = rollbackData.get("SERVICEINSTANCE", "rollbackSDNC") + if ("true".equals(rollbackSDNC)) + { + execution.setVariable("rollbackSDNC", true) + } + + if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackSDNC") != true) + { + execution.setVariable("skipRollback", true) + } + + def sdncRollbackRequest = rollbackData.get("SERVICEINSTANCE", "sdncRollbackRequest") + execution.setVariable("sdncRollbackRequest", sdncRollbackRequest) + } + else { + execution.setVariable("skipRollback", true) + } + } + else { + execution.setVariable("skipRollback", true) + } + if (execution.getVariable("disableRollback").equals("true" )) + { + execution.setVariable("skipRollback", true) + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in Create ServiceInstance Rollback preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void validateSDNCResponse(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** validateSDNCResponse ***** ", isDebugEnabled) + String msg = "" + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + String response = execution.getVariable("sdncAdapterResponse") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + utils.log("DEBUG", "SDNC Adapter for service-instance delete for rollback successful. response", isDebugEnabled) + }else{ + execution.setVariable("rolledBack", false) + execution.setVariable("rollbackError", "Error Response from SDNC Adapter for service-instance delete for rollback") + utils.log("DEBUG","Error Response from SDNC Adapter for service-instance delete for rollback", isDebugEnabled) + throw new BpmnError("MSOWorkflowException") + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in Create ServiceInstance Rollback validateSDNCResponse " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit validateSDNCResponse ***** ", isDebugEnabled) + } + + public void postProcessRequest(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessRequest ***** ", isDebugEnabled) + String msg = "" + try { + execution.setVariable("rollbackData", null) + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean rollbackAAI = execution.getVariable("rollbackAAI") + boolean rollbackSDNC = execution.getVariable("rollbackSDNC") + if (rollbackAAI == true || rollbackSDNC == true) + { + execution.setVariable("rolledBack", true) + } + if (rollbackAAI == true) + { + boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator") + if(succInAAI != true){ + execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful + execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback") + utils.log("DEBUG","Error deleting service-instance in AAI for rollback", + serviceInstanceId, isDebugEnabled) + } + } + utils.log("DEBUG","*** Exit postProcessRequest ***", isDebugEnabled) + + } catch (BpmnError e) { + msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } catch (Exception ex) { + msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + + } + + public void processRollbackException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** processRollbackException ***** ", isDebugEnabled) + try{ + utils.log("DEBUG", "Caught an Exception in DoCreateServiceInstanceRollback", isDebugEnabled) + execution.setVariable("rollbackData", null) + execution.setVariable("rollbackError", "Caught exception in ServiceInstance Create Rollback") + execution.setVariable("WorkflowException", null) + + }catch(BpmnError b){ + utils.log("DEBUG", "BPMN Error during processRollbackExceptions Method: ", isDebugEnabled) + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processRollbackExceptions Method: " + e.getMessage(), isDebugEnabled) + } + + utils.log("DEBUG", " Exit processRollbackException", isDebugEnabled) + } + + public void processRollbackJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** processRollbackJavaException ***** ", isDebugEnabled) + try{ + execution.setVariable("rollbackData", null) + execution.setVariable("rollbackError", "Caught Java exception in ServiceInstance Create Rollback") + utils.log("DEBUG", "Caught Exception in processRollbackJavaException", isDebugEnabled) + + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception in processRollbackJavaException " + e.getMessage(), isDebugEnabled) + } + utils.log("DEBUG", "***** Exit processRollbackJavaException *****", isDebugEnabled) + } + +} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoCreateVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy similarity index 59% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoCreateVfModule.groovy rename to bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 8293bfa9e3..739a9dd027 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoCreateVfModule.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -18,29 +18,31 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution -import org.apache.commons.lang3.* +package org.openecomp.mso.bpmn.infrastructure.scripts; import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory -import org.apache.commons.codec.binary.Base64 -import org.springframework.web.util.UriUtils - +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.NetworkUtils +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.common.scripts.VfModuleBase import org.openecomp.mso.bpmn.core.RollbackData import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils import org.openecomp.mso.rest.APIResponse import org.openecomp.mso.rest.RESTClient import org.openecomp.mso.rest.RESTConfig - +import org.springframework.web.util.UriUtils import org.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.NamedNodeMap import org.w3c.dom.Node -import org.w3c.dom.NodeList; +import org.w3c.dom.NodeList import org.xml.sax.InputSource @@ -49,6 +51,7 @@ public class DoCreateVfModule extends VfModuleBase { String Prefix="DCVFM_" ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() /** * Validates the request message and sets up the workflow. @@ -62,213 +65,353 @@ public class DoCreateVfModule extends VfModuleBase { logDebug('Entered ' + method, isDebugLogEnabled) execution.setVariable('prefix', Prefix) -try{ - String request = execution.getVariable("DoCreateVfModuleRequest") - utils.logAudit("DoCreateVfModule request: " + request) - - def rollbackData = execution.getVariable("RollbackData") - if (rollbackData == null) { - rollbackData = new RollbackData() - } - - execution.setVariable ("CreateAAIVfModuleRequest", request) - execution.setVariable("DCVFM_vnfParamsExistFlag", false) - //tenantId - def tenantId = "" - if (utils.nodeExists(request, "tenant-id")) { - tenantId = utils.getNodeText(request, "tenant-id") - } - execution.setVariable("DCVFM_tenantId", tenantId) - rollbackData.put("VFMODULE", "tenantid", tenantId) - //volumeGroupId - def volumeGroupId = "" - if (utils.nodeExists(request, "volume-group-id")) { - volumeGroupId = utils.getNodeText(request, "volume-group-id") - } - execution.setVariable("DCVFM_volumeGroupId", volumeGroupId) - //volumeGroupId - def volumeGroupName = "" - if (utils.nodeExists(request, "volume-group-name")) { - volumeGroupName = utils.getNodeText(request, "volume-group-name") - } - execution.setVariable("DCVFM_volumeGroupName", volumeGroupName) - //cloudSiteId - def cloudSiteId = "" - if (utils.nodeExists(request, "aic-cloud-region")) { - cloudSiteId = utils.getNodeText(request, "aic-cloud-region") - } - execution.setVariable("DCVFM_cloudSiteId", cloudSiteId) - rollbackData.put("VFMODULE", "aiccloudregion", cloudSiteId) - logDebug("cloudSiteId: " + cloudSiteId, isDebugLogEnabled) - //vnfType - def vnfType = "" - if (utils.nodeExists(request, "vnf-type")) { - vnfType = utils.getNodeText(request, "vnf-type") - } - execution.setVariable("DCVFM_vnfType", vnfType) - rollbackData.put("VFMODULE", "vnftype", vnfType) - logDebug("vnfType: " + vnfType, isDebugLogEnabled) - //vnfName - def vnfName = "" - if (utils.nodeExists(request, "vnf-name")) { - vnfName = utils.getNodeText(request, "vnf-name") - } - execution.setVariable("DCVFM_vnfName", vnfName) - rollbackData.put("VFMODULE", "vnfname", vnfName) - logDebug("vnfName: " + vnfName, isDebugLogEnabled) - //vnfId - def vnfId = "" - if (utils.nodeExists(request, "vnf-id")) { - vnfId = utils.getNodeText(request, "vnf-id") - } - execution.setVariable("DCVFM_vnfId", vnfId) - rollbackData.put("VFMODULE", "vnfid", vnfId) - logDebug("vnfId: " + vnfId, isDebugLogEnabled) - //vfModuleName - def vfModuleName = "" - if (utils.nodeExists(request, "vf-module-name")) { - vfModuleName = utils.getNodeText(request, "vf-module-name") - } - execution.setVariable("DCVFM_vfModuleName", vfModuleName) - rollbackData.put("VFMODULE", "vfmodulename", vfModuleName) - logDebug("vfModuleName: " + vfModuleName, isDebugLogEnabled) - //vfModuleModelName - def vfModuleModelName = "" - if (utils.nodeExists(request, "vf-module-model-name")) { - vfModuleModelName = utils.getNodeText(request, "vf-module-model-name") - } - execution.setVariable("DCVFM_vfModuleModelName", vfModuleModelName) - rollbackData.put("VFMODULE", "vfmodulemodelname", vfModuleModelName) - logDebug("vfModuleModelName: " + vfModuleModelName, isDebugLogEnabled) - //vfModuleId - def vfModuleId = "" - if (utils.nodeExists(request, "vf-module-id")) { - vfModuleId = utils.getNodeText(request, "vf-module-id") - } - execution.setVariable("DCVFM_vfModuleId", vfModuleId) - logDebug("vfModuleId: " + vfModuleId, isDebugLogEnabled) - def requestId = "" - if (utils.nodeExists(request, "request-id")) { - requestId = utils.getNodeText(request, "request-id") - } - execution.setVariable("DCVFM_requestId", requestId) - logDebug("requestId: " + requestId, isDebugLogEnabled) - //serviceId - def serviceId = "" - if (utils.nodeExists(request, "service-id")) { - serviceId = utils.getNodeText(request, "service-id") - } - execution.setVariable("DCVFM_serviceId", serviceId) - logDebug("serviceId: " + serviceId, isDebugLogEnabled) - //serviceInstanceId - def serviceInstanceId = "" - if (utils.nodeExists(request, "service-instance-id")) { - serviceInstanceId = utils.getNodeText(request, "service-instance-id") - } - execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId) - rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId) - logDebug("serviceInstanceId: " + serviceInstanceId, isDebugLogEnabled) - //source - def source = "" - if (utils.nodeExists(request, "source")) { - source = utils.getNodeText(request, "source") - } - execution.setVariable("DCVFM_source", source) - rollbackData.put("VFMODULE", "source", source) - logDebug("source: " + source, isDebugLogEnabled) - //backoutOnFailure - NetworkUtils networkUtils = new NetworkUtils() - def backoutOnFailure = networkUtils.isRollbackEnabled(execution,request) - execution.setVariable("DCVFM_backoutOnFailure", backoutOnFailure) - logDebug("backoutOnFailure: " + backoutOnFailure, isDebugLogEnabled) - //isBaseVfModule - def isBaseVfModule = "false" - if (utils.nodeExists(request, "is-base-vf-module")) { - isBaseVfModule = utils.getNodeText(request, "is-base-vf-module") - } - execution.setVariable("DCVFM_isBaseVfModule", isBaseVfModule) - logDebug("isBaseVfModule: " + isBaseVfModule, isDebugLogEnabled) - - //asdcServiceModelVersion - def asdcServiceModelVersion = "" - if (utils.nodeExists(request, "asdc-service-model-version")) { - asdcServiceModelVersion = utils.getNodeText(request, "asdc-service-model-version") - } - execution.setVariable("DCVFM_asdcServiceModelVersion", asdcServiceModelVersion) - logDebug("asdcServiceModelVersion: " + asdcServiceModelVersion, isDebugLogEnabled) - - //Get or Generate UUID - String uuid = execution.getVariable("DCVFM_uuid") - if(uuid == null){ - uuid = UUID.randomUUID() - logDebug("Generated messageId (UUID) is: " + uuid, isDebugLogEnabled) - }else{ - logDebug("Found messageId (UUID) is: " + uuid, isDebugLogEnabled) - } - execution.setVariable("DCVFM_uuid", uuid) - execution.setVariable("DCVFM_baseVfModuleId", "") - execution.setVariable("DCVFM_baseVfModuleHeatStackId", "") - execution.setVariable("DCVFM_heatStackId", "") - execution.setVariable("DCVFM_contrailServiceInstanceFqdn", "") - execution.setVariable("DCVFM_volumeGroupStackId", "") - execution.setVariable("DCVFM_cloudRegionForVolume", "") - rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "false") - rollbackData.put("VFMODULE", "rollbackUpdateAAIVfModule", "false") - rollbackData.put("VFMODULE", "rollbackVnfAdapterCreate", "false") - rollbackData.put("VFMODULE", "rollbackSDNCRequestActivate", "false") - rollbackData.put("VFMODULE", "rollbackSDNCRequestAssign", "false") - rollbackData.put("VFMODULE", "rollbackCreateAAIVfModule", "false") - - String sdncCallbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') - if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { - def msg = 'Required variable \'URN_mso_workflow_sdncadapter_callback\' is missing' - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + try{ + def rollbackData = execution.getVariable("RollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData() } - execution.setVariable("DCVFM_sdncCallbackUrl", sdncCallbackUrl) - utils.logAudit("SDNC Callback URL: " + sdncCallbackUrl) - logDebug("SDNC Callback URL is: " + sdncCallbackUrl, isDebugLogEnabled) - String vnfCallbackUrl = (String) execution.getVariable('URN_mso_workflow_vnfadapter_rest_callback') - if (vnfCallbackUrl == null || vnfCallbackUrl.trim().isEmpty()) { - def msg = 'Required variable \'URN_mso_workflow_vnfadapter_rest_callback\' is missing' - logError(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + + execution.setVariable("DCVFM_vnfParamsExistFlag", false) + execution.setVariable("DCVFM_oamManagementV4Address", "") + execution.setVariable("DCVFM_oamManagementV6Address", "") + + String request = execution.getVariable("DoCreateVfModuleRequest") + + if (request == null || request.isEmpty()) { + // Building Block-type request + + String cloudConfiguration = execution.getVariable("cloudConfiguration") + String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") + + //tenantId + def tenantId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.tenantId") + execution.setVariable("DCVFM_tenantId", tenantId) + rollbackData.put("VFMODULE", "tenantid", tenantId) + //volumeGroupId + def volumeGroupId = execution.getVariable("volumeGroupId") + execution.setVariable("DCVFM_volumeGroupId", volumeGroupId) + //volumeGroupName + def volumeGroupName = execution.getVariable("volumeGroupName") + execution.setVariable("DCVFM_volumeGroupName", volumeGroupName) + //cloudSiteId + def cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.lcpCloudRegionId") + execution.setVariable("DCVFM_cloudSiteId", cloudSiteId) + rollbackData.put("VFMODULE", "aiccloudregion", cloudSiteId) + logDebug("cloudSiteId: " + cloudSiteId, isDebugLogEnabled) + //vnfType + def vnfType = execution.getVariable("vnfType") + execution.setVariable("DCVFM_vnfType", vnfType) + rollbackData.put("VFMODULE", "vnftype", vnfType) + logDebug("vnfType: " + vnfType, isDebugLogEnabled) + //vnfName + def vnfName = execution.getVariable("vnfName") + execution.setVariable("DCVFM_vnfName", vnfName) + rollbackData.put("VFMODULE", "vnfname", vnfName) + logDebug("vnfName: " + vnfName, isDebugLogEnabled) + //vnfId + def vnfId = execution.getVariable("vnfId") + execution.setVariable("DCVFM_vnfId", vnfId) + rollbackData.put("VFMODULE", "vnfid", vnfId) + logDebug("vnfId: " + vnfId, isDebugLogEnabled) + //vfModuleName + def vfModuleName = execution.getVariable("vfModuleName") + execution.setVariable("DCVFM_vfModuleName", vfModuleName) + rollbackData.put("VFMODULE", "vfmodulename", vfModuleName) + logDebug("vfModuleName: " + vfModuleName, isDebugLogEnabled) + //vfModuleModelName + def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelInfo.modelName") + execution.setVariable("DCVFM_vfModuleModelName", vfModuleModelName) + rollbackData.put("VFMODULE", "vfmodulemodelname", vfModuleModelName) + logDebug("vfModuleModelName: " + vfModuleModelName, isDebugLogEnabled) + //modelCustomizationUuid + def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelInfo.modelCustomizationId") + execution.setVariable("DCVFM_modelCustomizationUuid", modelCustomizationUuid) + rollbackData.put("VFMODULE", "modelcustomizationuuid", modelCustomizationUuid) + logDebug("modelCustomizationUuid: " + modelCustomizationUuid, isDebugLogEnabled) + //vfModuleId + def vfModuleId = execution.getVariable("vfModuleId") + execution.setVariable("DCVFM_vfModuleId", vfModuleId) + logDebug("vfModuleId: " + vfModuleId, isDebugLogEnabled) + def requestId = execution.getVariable("requestId") + execution.setVariable("DCVFM_requestId", requestId) + logDebug("requestId: " + requestId, isDebugLogEnabled) + // Set mso-request-id to request-id for VNF Adapter interface + execution.setVariable("mso-request-id", requestId) + //serviceId + def serviceId = execution.getVariable("serviceId") + execution.setVariable("DCVFM_serviceId", serviceId) + logDebug("serviceId: " + serviceId, isDebugLogEnabled) + //serviceInstanceId + def serviceInstanceId = execution.getVariable("serviceInstanceId") + execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId) + rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId) + logDebug("serviceInstanceId: " + serviceInstanceId, isDebugLogEnabled) + //source - HARDCODED + def source = "VID" + execution.setVariable("DCVFM_source", source) + rollbackData.put("VFMODULE", "source", source) + logDebug("source: " + source, isDebugLogEnabled) + //backoutOnFailure + def disableRollback = execution.getVariable("disableRollback") + def backoutOnFailure = true + if (disableRollback != null && disableRollback.equals("true")) { + backoutOnFailure = false + } + execution.setVariable("DCVFM_backoutOnFailure", backoutOnFailure) + logDebug("backoutOnFailure: " + backoutOnFailure, isDebugLogEnabled) + //isBaseVfModule + def isBaseVfModule = execution.getVariable("isBaseVfModule") + execution.setVariable("DCVFM_isBaseVfModule", isBaseVfModule) + logDebug("isBaseVfModule: " + isBaseVfModule, isDebugLogEnabled) + //asdcServiceModelVersion + def asdcServiceModelVersion = execution.getVariable("asdcServiceModelVersion") + execution.setVariable("DCVFM_asdcServiceModelVersion", asdcServiceModelVersion) + logDebug("asdcServiceModelVersion: " + asdcServiceModelVersion, isDebugLogEnabled) + //personaModelId + execution.setVariable("DCVFM_personaModelId", jsonUtil.getJsonValue(vfModuleModelInfo, "modelInfo.modelInvariantId")) + //personaModelVersion + execution.setVariable("DCVFM_personaModelVersion", jsonUtil.getJsonValue(vfModuleModelInfo, "modelInfo.modelVersion")) + //Get or Generate UUID + String uuid = execution.getVariable("DCVFM_uuid") + if(uuid == null){ + uuid = UUID.randomUUID() + logDebug("Generated messageId (UUID) is: " + uuid, isDebugLogEnabled) + }else{ + logDebug("Found messageId (UUID) is: " + uuid, isDebugLogEnabled) + } + //isVidRequest + String isVidRequest = execution.getVariable("isVidRequest") + // default to true + if (isVidRequest == null || isVidRequest.isEmpty()) { + execution.setVariable("isVidRequest", "true") + } + + String vnfParamsChildNodes = execution.getVariable("vfModuleInputParams") + } - - // Process the parameters - - String vnfParamsChildNodes = utils.getChildNodes(request, "vnf-params") - if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ - utils.log("DEBUG", "Request contains NO VNF Params", isDebugLogEnabled) - }else{ - utils.log("DEBUG", "Request does contain VNF Params", isDebugLogEnabled) - execution.setVariable("DCVFM_vnfParamsExistFlag", true) - - InputSource xmlSource = new InputSource(new StringReader(request)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document xml = docBuilder.parse(xmlSource) - //Get params, build map - Map paramsMap = new HashMap() - NodeList paramsList = xml.getElementsByTagNameNS("*", "param") - - for (int z = 0; z < paramsList.getLength(); z++) { - Node node = paramsList.item(z) - String paramValue = node.getTextContent() - NamedNodeMap e = node.getAttributes() - String paramName = e.getNamedItem("name").getTextContent() - paramsMap.put(paramName, paramValue) + else { + // The info is inside the request + utils.logAudit("DoCreateVfModule request: " + request) + + //tenantId + def tenantId = "" + if (utils.nodeExists(request, "tenant-id")) { + tenantId = utils.getNodeText(request, "tenant-id") + } + execution.setVariable("DCVFM_tenantId", tenantId) + rollbackData.put("VFMODULE", "tenantid", tenantId) + //volumeGroupId + def volumeGroupId = "" + if (utils.nodeExists(request, "volume-group-id")) { + volumeGroupId = utils.getNodeText(request, "volume-group-id") } - execution.setVariable("DCVFM_vnfParamsMap", paramsMap) + execution.setVariable("DCVFM_volumeGroupId", volumeGroupId) + //volumeGroupId + def volumeGroupName = "" + if (utils.nodeExists(request, "volume-group-name")) { + volumeGroupName = utils.getNodeText(request, "volume-group-name") + } + execution.setVariable("DCVFM_volumeGroupName", volumeGroupName) + //cloudSiteId + def cloudSiteId = "" + if (utils.nodeExists(request, "aic-cloud-region")) { + cloudSiteId = utils.getNodeText(request, "aic-cloud-region") + } + execution.setVariable("DCVFM_cloudSiteId", cloudSiteId) + rollbackData.put("VFMODULE", "aiccloudregion", cloudSiteId) + logDebug("cloudSiteId: " + cloudSiteId, isDebugLogEnabled) + //vnfType + def vnfType = "" + if (utils.nodeExists(request, "vnf-type")) { + vnfType = utils.getNodeText(request, "vnf-type") + } + execution.setVariable("DCVFM_vnfType", vnfType) + rollbackData.put("VFMODULE", "vnftype", vnfType) + logDebug("vnfType: " + vnfType, isDebugLogEnabled) + //vnfName + def vnfName = "" + if (utils.nodeExists(request, "vnf-name")) { + vnfName = utils.getNodeText(request, "vnf-name") + } + execution.setVariable("DCVFM_vnfName", vnfName) + rollbackData.put("VFMODULE", "vnfname", vnfName) + logDebug("vnfName: " + vnfName, isDebugLogEnabled) + //vnfId + def vnfId = "" + if (utils.nodeExists(request, "vnf-id")) { + vnfId = utils.getNodeText(request, "vnf-id") + } + execution.setVariable("DCVFM_vnfId", vnfId) + rollbackData.put("VFMODULE", "vnfid", vnfId) + logDebug("vnfId: " + vnfId, isDebugLogEnabled) + //vfModuleName + def vfModuleName = "" + if (utils.nodeExists(request, "vf-module-name")) { + vfModuleName = utils.getNodeText(request, "vf-module-name") + } + execution.setVariable("DCVFM_vfModuleName", vfModuleName) + rollbackData.put("VFMODULE", "vfmodulename", vfModuleName) + logDebug("vfModuleName: " + vfModuleName, isDebugLogEnabled) + //vfModuleModelName + def vfModuleModelName = "" + if (utils.nodeExists(request, "vf-module-model-name")) { + vfModuleModelName = utils.getNodeText(request, "vf-module-model-name") + } + execution.setVariable("DCVFM_vfModuleModelName", vfModuleModelName) + rollbackData.put("VFMODULE", "vfmodulemodelname", vfModuleModelName) + logDebug("vfModuleModelName: " + vfModuleModelName, isDebugLogEnabled) + //modelCustomizationUuid + def modelCustomizationUuid = "" + if (utils.nodeExists(request, "model-customization-id")) { + modelCustomizationUuid = utils.getNodeText(request, "model-customization-id") + } + execution.setVariable("DCVFM_modelCustomizationUuid", modelCustomizationUuid) + rollbackData.put("VFMODULE", "modelcustomizationuuid", modelCustomizationUuid) + logDebug("modelCustomizationUuid: " + modelCustomizationUuid, isDebugLogEnabled) + //vfModuleId + def vfModuleId = "" + if (utils.nodeExists(request, "vf-module-id")) { + vfModuleId = utils.getNodeText(request, "vf-module-id") + } + execution.setVariable("DCVFM_vfModuleId", vfModuleId) + logDebug("vfModuleId: " + vfModuleId, isDebugLogEnabled) + def requestId = "" + if (utils.nodeExists(request, "request-id")) { + requestId = utils.getNodeText(request, "request-id") + } + execution.setVariable("DCVFM_requestId", requestId) + logDebug("requestId: " + requestId, isDebugLogEnabled) + //serviceId + def serviceId = "" + if (utils.nodeExists(request, "service-id")) { + serviceId = utils.getNodeText(request, "service-id") + } + execution.setVariable("DCVFM_serviceId", serviceId) + logDebug("serviceId: " + serviceId, isDebugLogEnabled) + //serviceInstanceId + def serviceInstanceId = "" + if (utils.nodeExists(request, "service-instance-id")) { + serviceInstanceId = utils.getNodeText(request, "service-instance-id") + } + execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId) + rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId) + logDebug("serviceInstanceId: " + serviceInstanceId, isDebugLogEnabled) + //source + def source = "" + if (utils.nodeExists(request, "source")) { + source = utils.getNodeText(request, "source") + } + execution.setVariable("DCVFM_source", source) + rollbackData.put("VFMODULE", "source", source) + logDebug("source: " + source, isDebugLogEnabled) + //backoutOnFailure + NetworkUtils networkUtils = new NetworkUtils() + def backoutOnFailure = networkUtils.isRollbackEnabled(execution,request) + execution.setVariable("DCVFM_backoutOnFailure", backoutOnFailure) + logDebug("backoutOnFailure: " + backoutOnFailure, isDebugLogEnabled) + //isBaseVfModule + def isBaseVfModule = "false" + if (utils.nodeExists(request, "is-base-vf-module")) { + isBaseVfModule = utils.getNodeText(request, "is-base-vf-module") + } + execution.setVariable("DCVFM_isBaseVfModule", isBaseVfModule) + logDebug("isBaseVfModule: " + isBaseVfModule, isDebugLogEnabled) + + //asdcServiceModelVersion + def asdcServiceModelVersion = "" + if (utils.nodeExists(request, "asdc-service-model-version")) { + asdcServiceModelVersion = utils.getNodeText(request, "asdc-service-model-version") + } + execution.setVariable("DCVFM_asdcServiceModelVersion", asdcServiceModelVersion) + logDebug("asdcServiceModelVersion: " + asdcServiceModelVersion, isDebugLogEnabled) + + //personaModelId + def personaModelId = "" + if (utils.nodeExists(request, "persona-model-id")) { + personaModelId = utils.getNodeText(request, "persona-model-id") + } + execution.setVariable("DCVFM_personaModelId", personaModelId) + logDebug("personaModelId: " + personaModelId, isDebugLogEnabled) + + //personaModelVersion + def personaModelVersion = "" + if (utils.nodeExists(request, "persona-model-version")) { + personaModelVersion = utils.getNodeText(request, "persona-model-version") + } + execution.setVariable("DCVFM_personaModelVersion", personaModelVersion) + logDebug("personaModelVersion: " + personaModelVersion, isDebugLogEnabled) + + // Process the parameters + + String vnfParamsChildNodes = utils.getChildNodes(request, "vnf-params") + if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){ + utils.log("DEBUG", "Request contains NO VNF Params", isDebugLogEnabled) + }else{ + utils.log("DEBUG", "Request does contain VNF Params", isDebugLogEnabled) + execution.setVariable("DCVFM_vnfParamsExistFlag", true) + + InputSource xmlSource = new InputSource(new StringReader(request)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document xml = docBuilder.parse(xmlSource) + //Get params, build map + Map paramsMap = new HashMap() + NodeList paramsList = xml.getElementsByTagNameNS("*", "param") + + for (int z = 0; z < paramsList.getLength(); z++) { + Node node = paramsList.item(z) + String paramValue = node.getTextContent() + NamedNodeMap e = node.getAttributes() + String paramName = e.getNamedItem("name").getTextContent() + paramsMap.put(paramName, paramValue) + } + execution.setVariable("DCVFM_vnfParamsMap", paramsMap) + } } - - execution.setVariable("RollbackData", rollbackData) -}catch(BpmnError b){ + + //Get or Generate UUID + String uuid = execution.getVariable("DCVFM_uuid") + if(uuid == null){ + uuid = UUID.randomUUID() + logDebug("Generated messageId (UUID) is: " + uuid, isDebugLogEnabled) + }else{ + logDebug("Found messageId (UUID) is: " + uuid, isDebugLogEnabled) + } + execution.setVariable("DCVFM_uuid", uuid) + execution.setVariable("DCVFM_baseVfModuleId", "") + execution.setVariable("DCVFM_baseVfModuleHeatStackId", "") + execution.setVariable("DCVFM_heatStackId", "") + execution.setVariable("DCVFM_contrailServiceInstanceFqdn", "") + execution.setVariable("DCVFM_volumeGroupStackId", "") + execution.setVariable("DCVFM_cloudRegionForVolume", "") + execution.setVariable("DCVFM_contrailNetworkPolicyFqdnList", "") + rollbackData.put("VFMODULE", "rollbackPrepareUpdateVfModule", "false") + rollbackData.put("VFMODULE", "rollbackUpdateAAIVfModule", "false") + rollbackData.put("VFMODULE", "rollbackVnfAdapterCreate", "false") + rollbackData.put("VFMODULE", "rollbackSDNCRequestActivate", "false") + rollbackData.put("VFMODULE", "rollbackSDNCRequestAssign", "false") + rollbackData.put("VFMODULE", "rollbackCreateAAIVfModule", "false") + rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "false") + rollbackData.put("VFMODULE", "rollbackUpdateVnfAAI", "false") + + String sdncCallbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') + if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { + def msg = 'Required variable \'URN_mso_workflow_sdncadapter_callback\' is missing' + logError(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + execution.setVariable("DCVFM_sdncCallbackUrl", sdncCallbackUrl) + utils.logAudit("SDNC Callback URL: " + sdncCallbackUrl) + logDebug("SDNC Callback URL is: " + sdncCallbackUrl, isDebugLogEnabled) + + + execution.setVariable("RollbackData", rollbackData) + }catch(BpmnError b){ throw b -}catch(Exception e){ - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") -} + }catch(Exception e){ + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") + } logDebug('Exited ' + method, isDebugLogEnabled) } @@ -375,11 +518,9 @@ try{ String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" utils.logAudit("AAI endPoint: " + endPoint) - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - try { RESTConfig config = new RESTConfig(endPoint); def responseData = '' @@ -389,11 +530,6 @@ try{ addHeader('X-FromAppId', 'MSO'). addHeader('Content-Type', 'application/xml'). addHeader('Accept','application/xml'); - - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) APIResponse response = client.httpGet() utils.logAudit("createVfModule - invoking httpGet() to AAI") @@ -502,7 +638,7 @@ try{ String uuid = execution.getVariable('testReqId') // for junits if(uuid==null){ - uuid = execution.getVariable("att-mso-request-id") + "-" + System.currentTimeMillis() + uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() } String serviceOperation = "/VNF-API:vnfs/vnf-list/" + vfModuleId @@ -521,9 +657,9 @@ try{ sleep(5000) String SDNCGetRequest = - """ + """ ${uuid} ${svcInstId} @@ -592,11 +728,13 @@ try{ def asdcServiceModelVersion = execution.getVariable("DCVFM_asdcServiceModelVersion") //volumeGroupStackId def volumeGroupStackId = execution.getVariable("DCVFM_volumeGroupStackId") + //modelCustomizationUuid + def modelCustomizationUuid = execution.getVariable("DCVFM_modelCustomizationUuid") - def messageId = execution.getVariable('att-mso-request-id') + '-' + + def messageId = execution.getVariable('mso-request-id') + '-' + System.currentTimeMillis() - def notificationUrl = execution.getVariable("URN_mso_workflow_vnfadapter_rest_callback") + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") utils.logAudit("notificationUrl: " + notificationUrl) @@ -655,6 +793,7 @@ try{ ${vnfType} ${vfModuleModelName} ${asdcServiceModelVersion} + ${modelCustomizationUuid} ${volumeGroupId} ${volumeGroupStackId} @@ -722,16 +861,16 @@ try{ /* - def requestId = execution.getVariable("att-mso-request-id") + def requestId = execution.getVariable("mso-request-id") if (requestId == null) { - createWorkflowException(execution, 1002, processKey + " request has no att-mso-request-id") + createWorkflowException(execution, 1002, processKey + " request has no mso-request-id") } - def serviceInstanceId = execution.getVariable("att-mso-service-instance-id") + def serviceInstanceId = execution.getVariable("mso-service-instance-id") if (serviceInstanceId == null) { - createWorkflowException(execution, 1002, processKey + " request message has no att-mso-service-instance-id") + createWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id") } utils.logContext(requestId, serviceInstanceId) @@ -793,7 +932,7 @@ try{ String uuid = execution.getVariable('testReqId') // for junits if(uuid==null){ - uuid = execution.getVariable("att-mso-request-id") + "-" + System.currentTimeMillis() + uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() } def callbackURL = execution.getVariable("DCVFM_sdncCallbackUrl") def requestId = execution.getVariable("DCVFM_requestId") @@ -818,9 +957,9 @@ try{ } String sdncRequest = - """ + """ ${requestId} ${svcInstId} @@ -927,6 +1066,7 @@ try{ Document outputsXml = docBuilder.parse(source) NodeList entries = outputsXml.getElementsByTagNameNS("*", "entry") + List contrailNetworkPolicyFqdnList = [] for (int i = 0; i< entries.getLength(); i++) { Node node = entries.item(i) if (node.getNodeType() == Node.ELEMENT_NODE) { @@ -937,7 +1077,26 @@ try{ logDebug("Obtained contrailServiceInstanceFqdn: " + contrailServiceInstanceFqdn, isDebugLogEnabled) execution.setVariable("DCVFM_contrailServiceInstanceFqdn", contrailServiceInstanceFqdn) } - } + else if (key.endsWith("contrail_network_policy_fqdn")) { + String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + logDebug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn, isDebugLogEnabled) + contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn) + } + else if (key.equals("oam_management_v4_address")) { + String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + logDebug("Obtained oamManagementV4Address: " + oamManagementV4Address, isDebugLogEnabled) + execution.setVariable("DCVFM_oamManagementV4Address", oamManagementV4Address) + } + else if (key.equals("oam_management_v6_address")) { + String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + logDebug("Obtained oamManagementV6Address: " + oamManagementV6Address, isDebugLogEnabled) + execution.setVariable("DCVFM_oamManagementV6Address", oamManagementV6Address) + } + + } + } + if (!contrailNetworkPolicyFqdnList.isEmpty()) { + execution.setVariable("DCVFM_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList) } } }else{ @@ -1073,7 +1232,7 @@ try{ String uuid = execution.getVariable('testReqId') // for junits if(uuid==null){ - uuid = execution.getVariable("att-mso-request-id") + "-" + System.currentTimeMillis() + uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() } String serviceOperation = "/VNF-API:vnfs/vnf-list/" + vnfId @@ -1081,9 +1240,9 @@ try{ utils.logAudit("callbackUrl: " + callbackUrl) String SDNCGetRequest = - """ + """ ${uuid} query @@ -1216,6 +1375,7 @@ try{ } /** + * *This method occurs when an MSOWorkflowException is caught. It logs the *variables and ensures that the "WorkflowException" Variable is set. * @@ -1275,7 +1435,244 @@ try{ logDebug("======== COMPLETED prepareCreateAAIVfModuleVolumeGroupRequest ======== ", isDebugLogEnabled) } + + public void createNetworkPoliciesInAAI(Execution execution) { + def method = getClass().getSimpleName() + '.createNetworkPoliciesInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + execution.setVariable("prefix", Prefix) + logDebug(" ======== STARTED createNetworkPoliciesInAAI ======== ", isDebugLogEnabled) + + try { + // get variables + List fqdnList = execution.getVariable("DCVFM_contrailNetworkPolicyFqdnList") + int fqdnCount = fqdnList.size() + def rollbackData = execution.getVariable("RollbackData") + + execution.setVariable("DCVFM_networkPolicyFqdnCount", fqdnCount) + logDebug("DCVFM_networkPolicyFqdnCount - " + fqdnCount, isDebugLogEnabled) + + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) + + if (fqdnCount > 0) { + + // AII loop call over contrail network policy fqdn list + for (i in 0..fqdnCount-1) { + + int counting = i+1 + String fqdn = fqdnList[i] + + // Query AAI for this network policy FQDN + + String queryNetworkPolicyByFqdnAAIRequest = "${aai_endpoint}${aai_uri}?network-policy-fqdn=" + UriUtils.encode(fqdn, "UTF-8") + utils.logAudit("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest) + + def aaiRequestId = UUID.randomUUID().toString() + RESTConfig config = new RESTConfig(queryNetworkPolicyByFqdnAAIRequest); + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId) + .addHeader("X-FromAppId", "MSO") + .addHeader("Content-Type", "application/xml") + .addHeader("Accept","application/xml"); + APIResponse response = client.get() + int returnCode = response.getStatusCode() + execution.setVariable("DCVFM_aaiQqueryNetworkPolicyByFqdnReturnCode", returnCode) + logDebug(" ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode, isDebugLogEnabled) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (isOneOf(returnCode, 200, 201)) { + logDebug("The return code is: " + returnCode, isDebugLogEnabled) + // This network policy FQDN already exists in AAI + utils.logAudit(aaiResponseAsString) + execution.setVariable("DCVFM_queryNetworkPolicyByFqdnAAIResponse", aaiResponseAsString) + logDebug(" QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString, isDebugLogEnabled) + + } else { + if (returnCode == 404) { + // This network policy FQDN is not in AAI yet. Add it now + logDebug("The return code is: " + returnCode, isDebugLogEnabled) + logDebug("This network policy FQDN is not in AAI yet: " + fqdn, isDebugLogEnabled) + utils.logAudit("Network policy FQDN is not in AAI yet") + // Add the network policy with this FQDN to AAI + def networkPolicyId = UUID.randomUUID().toString() + logDebug("Adding network-policy with network-policy-id " + networkPolicyId, isDebugLogEnabled) + + String aaiNamespace = aaiUriUtil.getNamespaceFromUri(aai_uri) + logDebug('AAI namespace is: ' + aaiNamespace, isDebugLogEnabled) + String payload = """ + ${networkPolicyId} + ${fqdn} + ${execution.getVariable("DCVFM_heatStackId")} + """ as String + + execution.setVariable("DCVFM_addNetworkPolicyAAIRequestBody", payload) + + String addNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(networkPolicyId, "UTF-8") + utils.logAudit("AAI request endpoint: " + addNetworkPolicyAAIRequest) + logDebug("AAI request endpoint: " + addNetworkPolicyAAIRequest, isDebugLogEnabled) + + def aaiRequestIdPut = UUID.randomUUID().toString() + RESTConfig configPut = new RESTConfig(addNetworkPolicyAAIRequest); + RESTClient clientPut = new RESTClient(configPut).addHeader("X-TransactionId", aaiRequestIdPut) + .addHeader("X-FromAppId", "MSO") + .addHeader("Content-Type", "application/xml") + .addHeader("Accept","application/xml"); + logDebug("invoking PUT call to AAI with payload:"+System.lineSeparator()+payload, isDebugLogEnabled) + utils.logAudit("Sending PUT call to AAI with Endpoint /n" + addNetworkPolicyAAIRequest + " with payload /n" + payload) + APIResponse responsePut = clientPut.httpPut(payload) + int returnCodePut = responsePut.getStatusCode() + execution.setVariable("DCVFM_aaiAddNetworkPolicyReturnCode", returnCodePut) + logDebug(" ***** AAI add network policy Response Code, NetworkPolicy #" + counting + " : " + returnCodePut, isDebugLogEnabled) + + String aaiResponseAsStringPut = responsePut.getResponseBodyAsString() + if (isOneOf(returnCodePut, 200, 201)) { + logDebug("The return code from adding network policy is: " + returnCodePut, isDebugLogEnabled) + // This network policy was created in AAI successfully + utils.logAudit(aaiResponseAsStringPut) + execution.setVariable("DCVFM_addNetworkPolicyAAIResponse", aaiResponseAsStringPut) + logDebug(" AddAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsStringPut, isDebugLogEnabled) + rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "true") + rollbackData.put("VFMODULE", "contrailNetworkPolicyFqdn" + i, fqdn) + execution.setVariable("RollbackData", rollbackData) + + } else { + // aai all errors + String putErrorMessage = "Unable to add network-policy to AAI createNetworkPoliciesInAAI - " + returnCodePut + logDebug(putErrorMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, putErrorMessage) + } + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from createNetworkPoliciesInAAI - " + returnCode + logDebug(dataErrorMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + } // end loop + + + } else { + logDebug("No contrail network policies to query/create", isDebugLogEnabled) + } -} + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateVfModule flow. createNetworkPoliciesInAAI() - " + ex.getMessage() + logDebug(exceptionMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + } + + /** + * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. + * + * @param execution The flow's execution instance. + */ + public void prepUpdateAAIGenericVnf(Execution execution) { + def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def rollbackData = execution.getVariable("RollbackData") + def vnfId = execution.getVariable('DCVFM_vnfId') + def oamManagementV4Address = execution.getVariable("DCVFM_oamManagementV4Address") + def oamManagementV6Address = execution.getVariable("DCVFM_oamManagementV6Address") + def ipv4OamAddressElement = '' + def managementV6AddressElement = '' + + if (oamManagementV4Address != null && !oamManagementV4Address.isEmpty()) { + ipv4OamAddressElement = '' + oamManagementV4Address + '' + } + + if (oamManagementV6Address != null && !oamManagementV6Address.isEmpty()) { + managementV6AddressElement = '' + oamManagementV6Address + '' + } + + rollbackData.put("VFMODULE", "oamManagementV4Address", oamManagementV4Address) + + + String updateAAIGenericVnfRequest = """ + + ${vnfId} + ${ipv4OamAddressElement} + ${managementV6AddressElement} + + """ + updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) + execution.setVariable('DCVM_updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) + utils.logAudit("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) + logDebug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest, isDebugLogEnabled) + + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) + } + } + + /** + * Post process a result from invoking the UpdateAAIGenericVnf subflow. + * + * @param execution The flow's execution instance. + */ + public void postProcessUpdateAAIGenericVnf(Execution execution) { + def method = getClass().getSimpleName() + '.postProcessUpdateAAIGenericVnf(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def rollbackData = execution.getVariable("RollbackData") + + rollbackData.put("VFMODULE", "rollbackUpdateVnfAAI", "true") + + def vnfId = execution.getVariable('DCVFM_vnfId') + def oamManagementV4Address = execution.getVariable("DCVFM_oamManagementV4Address") + def oamManagementV6Address = execution.getVariable("DCVFM_oamManagementV6Address") + def ipv4OamAddressElement = '' + def managementV6AddressElement = '' + + if (oamManagementV4Address != null && !oamManagementV4Address.isEmpty()) { + rollbackData.put("VFMODULE", "oamManagementV4Address", oamManagementV4Address) + } + + if (oamManagementV6Address != null && !oamManagementV6Address.isEmpty()) { + rollbackData.put("VFMODULE", "oamManagementV6Address", oamManagementV6Address) + } + + execution.setVariable("RollbackData", rollbackData) + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 1002, 'Error in postProcessUpdateAAIGenericVnf(): ' + e.getMessage()) + } + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy new file mode 100644 index 0000000000..391b76a21a --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy @@ -0,0 +1,487 @@ +/*- + * ============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 org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse +import org.springframework.web.util.UriUtils + + + +public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ + + def Prefix="DCVFMR_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + public void initProcessVariables(Execution execution) { + execution.setVariable("prefix",Prefix) + } + + // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids + // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest + public void preProcessRequest(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + initProcessVariables(execution) + + def rollbackData = execution.getVariable("RollbackData") + String vnfId = rollbackData.get("VFMODULE", "vnfid") + execution.setVariable("DCVFMR_vnfId", vnfId) + String vfModuleId = rollbackData.get("VFMODULE", "vfmoduleid") + execution.setVariable("DCVFMR_vfModuleId", vfModuleId) + String source = rollbackData.get("VFMODULE", "source") + execution.setVariable("DCVFMR_source", source) + String serviceInstanceId = rollbackData.get("VFMODULE", "serviceInstanceId") + execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId) + String serviceId = rollbackData.get("VFMODULE", "service-id") + execution.setVariable("DCVFMR_serviceId", serviceId) + String vnfType = rollbackData.get("VFMODULE", "vnftype") + execution.setVariable("DCVFMR_vnfType", vnfType) + String vnfName = rollbackData.get("VFMODULE", "vnfname") + execution.setVariable("DCVFMR_vnfName", vnfName) + String tenantId = rollbackData.get("VFMODULE", "tenantid") + execution.setVariable("DCVFMR_tenantId", tenantId) + String vfModuleName = rollbackData.get("VFMODULE", "vfmodulename") + execution.setVariable("DCVFMR_vfModuleName", vfModuleName) + String vfModuleModelName = rollbackData.get("VFMODULE", "vfmodulemodelname") + execution.setVariable("DCVFMR_vfModuleModelName", vfModuleModelName) + String cloudSiteId = rollbackData.get("VFMODULE", "aiccloudregion") + execution.setVariable("DCVFMR_cloudSiteId", cloudSiteId) + String heatStackId = rollbackData.get("VFMODULE", "heatstackid") + execution.setVariable("DCVFMR_heatStackId", heatStackId) + String requestId = rollbackData.get("VFMODULE", "msorequestid") + execution.setVariable("DCVFMR_requestId", requestId) + List createdNetworkPolicyFqdnList = [] + int i = 0 + while (i < 100) { + String fqdn = rollbackData.get("VFMODULE", "contrailNetworkPolicyFqdn" + i) + if (fqdn == null) { + break + } + createdNetworkPolicyFqdnList.add(fqdn) + logDebug("got fqdn # " + i + ": " + fqdn, isDebugEnabled) + i = i + 1 + + } + + execution.setVariable("DCVFMR_createdNetworkPolicyFqdnList", createdNetworkPolicyFqdnList) + String oamManagementV4Address = rollbackData.get("VFMODULE", "oamManagementV4Address") + execution.setVariable("DCVFMR_oamManagementV4Address", oamManagementV4Address) + String oamManagementV6Address = rollbackData.get("VFMODULE", "oamManagementV6Address") + execution.setVariable("DCVFMR_oamManagementV6Address", oamManagementV6Address) + //String serviceInstanceId = rollbackData.get("VFMODULE", "msoserviceinstanceid") + //execution.setVariable("DCVFMR_serviceInstanceId", serviceInstanceId) + execution.setVariable("DCVFMR_rollbackPrepareUpdateVfModule", rollbackData.get("VFMODULE", "rollbackPrepareUpdateVfModule")) + execution.setVariable("DCVFMR_rollbackUpdateAAIVfModule", rollbackData.get("VFMODULE", "rollbackUpdateAAIVfModule")) + execution.setVariable("DCVFMR_rollbackVnfAdapterCreate", rollbackData.get("VFMODULE", "rollbackVnfAdapterCreate")) + execution.setVariable("DCVFMR_rollbackSDNCRequestAssign", rollbackData.get("VFMODULE", "rollbackSDNCRequestAssign")) + execution.setVariable("DCVFMR_rollbackSDNCRequestActivate", rollbackData.get("VFMODULE", "rollbackSDNCRequestActivate")) + execution.setVariable("DCVFMR_rollbackCreateAAIVfModule", rollbackData.get("VFMODULE", "rollbackCreateAAIVfModule")) + execution.setVariable("DCVFMR_rollbackCreateNetworkPoliciesAAI", rollbackData.get("VFMODULE", "rollbackCreateNetworkPoliciesAAI")) + execution.setVariable("DCVFMR_rollbackUpdateVnfAAI", rollbackData.get("VFMODULE", "rollbackUpdateVnfAAI")) + + // formulate the request for PrepareUpdateAAIVfModule + String request = """ + ${vnfId} + ${vfModuleId} + pending-delete + """ as String + utils.log("DEBUG", "PrepareUpdateAAIVfModuleRequest :" + request, isDebugEnabled) + utils.logAudit("DoCreateVfModuleRollback PrepareUpdateAAIVfModule Request: " + request) + execution.setVariable("PrepareUpdateAAIVfModuleRequest", request) + } + + // build a SDNC vnf-topology-operation request for the specified action + // (note: the action passed is expected to be 'changedelete' or 'delete') + public void prepSDNCAdapterRequest(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId") + + def callbackUrl = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + + String source = execution.getVariable("DCVFMR_source") + String serviceId = execution.getVariable("DCVFMR_serviceId") + String vnfId = execution.getVariable("DCVFMR_vnfId") + String vnfType = execution.getVariable("DCVFMR_vnfType") + String vnfName = execution.getVariable("DCVFMR_vnfName") + String tenantId = execution.getVariable("DCVFMR_tenantId") + String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + String vfModuleName = execution.getVariable("DCVFMR_vfModuleName") + String vfModuleModelName = execution.getVariable("DCVFMR_vfModuleModelName") + String cloudSiteId = execution.getVariable("DCVFMR_cloudSiteId") + String requestId = execution.getVariable("DCVFMR_requestId") + + String serviceInstanceIdToSdnc = "" + if (srvInstId != null && !srvInstId.isEmpty()) { + serviceInstanceIdToSdnc = srvInstId + } else { + serviceInstanceIdToSdnc = vfModuleId + } + + def doSDNCActivateRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestActivate") + def doSDNCAssignRollback = execution.getVariable("DCVFMR_rollbackSDNCRequestAssign") + + def action = "" + def requestAction = "" + + if (doSDNCActivateRollback.equals("true")) { + action = "delete" + requestAction = "DisconnectVNFRequest" + } + else if (doSDNCAssignRollback.equals("true")) { + action = "rollback" + requestAction = "VNFActivateRequest" + } + else + return + + + String request = """ + + ${requestId} + ${vfModuleId} + ${action} + vnf-topology-operation + ${callbackUrl} + + + + ${requestId} + ${requestAction} + ${source} + + + + + + ${serviceId} + ${serviceId} + ${serviceInstanceIdToSdnc} + notsurewecare + + + ${vfModuleId} + ${vfModuleModelName} + ${vfModuleName} + ${vnfId} + ${vnfName} + ${vnfType} + ${cloudSiteId} + ${tenantId} + + + """ + + utils.log("DEBUG", "sdncAdapterWorkflowRequest: " + request, isDebugEnabled) + utils.logAudit("DoCreateVfModuleRollback sdncAdapterWorkflow Request: " + request) + execution.setVariable("sdncAdapterWorkflowRequest", request) + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing VnfAdapterDeleteV1 request + public void prepVNFAdapterRequest(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + String requestId = UUID.randomUUID().toString() + String origRequestId = execution.getVariable("DCVFMR_requestId") + String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId") + String aicCloudRegion = execution.getVariable("DCVFMR_cloudSiteId") + String vnfId = execution.getVariable("DCVFMR_vnfId") + String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + String vfModuleStackId = execution.getVariable("DCVFMR_heatStackId") + String tenantId = execution.getVariable("DCVFMR_tenantId") + def messageId = execution.getVariable('mso-request-id') + '-' + + System.currentTimeMillis() + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + + String request = """ + + ${aicCloudRegion} + ${tenantId} + ${vnfId} + ${vfModuleId} + ${vfModuleStackId} + true + + ${origRequestId} + ${srvInstId} + + ${messageId} + ${notificationUrl} + + """ as String + + utils.log("DEBUG", "vnfAdapterRestV1Request: " + request, isDebugEnabled) + utils.logAudit("PrepareUpdateAAIVfModule vnfAdapterRestV1 Request: " + request) + execution.setVariable("vnfAdapterRestV1Request", request) + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing UpdateAAIVfModuleRequest request + public void prepUpdateAAIVfModule(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + String vnfId = execution.getVariable("DCVFMR_vnfId") + String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """ + ${vnfId} + ${vfModuleId} + DELETE + deleted + """ as String + utils.log("DEBUG", "UpdateAAIVfModuleRequest :" + request, isDebugEnabled) + utils.logAudit("UpdateAAIVfModule Request: " + request) + execution.setVariable("UpdateAAIVfModuleRequest", request) + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing DeleteAAIVfModuleRequest request + public void prepDeleteAAIVfModule(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + String vnfId = execution.getVariable("DCVFMR_vnfId") + String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """ + ${vnfId} + ${vfModuleId} + """ as String + utils.log("DEBUG", "DeleteAAIVfModuleRequest :" + request, isDebugEnabled) + utils.logAudit("DeleteAAIVfModule Request: " + request) + execution.setVariable("DeleteAAIVfModuleRequest", request) + } + + // generates a WorkflowException if + // - + public void handleDoDeleteVfModuleFailure(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("ERROR", "AAI error occurred deleting the Generic Vnf: " + + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), isDebugEnabled) + String processKey = getProcessKey(execution); + exceptionUtil.buildWorkflowException(execution, 5000, "Failure in DoDeleteVfModule") + + } + + public void sdncValidateResponse(Execution execution, String response){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + utils.log("DEBUG", "Successfully Validated SDNC Response", isDebugEnabled) + }else{ + throw new BpmnError("MSOWorkflowException") + } + } + + public void deleteNetworkPoliciesFromAAI(Execution execution) { + def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + execution.setVariable("prefix", Prefix) + logDebug(" ======== STARTED deleteNetworkPoliciesFromAAI ======== ", isDebugLogEnabled) + + try { + // get variables + List fqdnList = execution.getVariable(Prefix + "createdNetworkPolicyFqdnList") + if (fqdnList == null) { + logDebug("No network policies to delete", isDebugLogEnabled) + return + } + int fqdnCount = fqdnList.size() + + execution.setVariable(Prefix + "networkPolicyFqdnCount", fqdnCount) + logDebug("networkPolicyFqdnCount - " + fqdnCount, isDebugLogEnabled) + + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) + + if (fqdnCount > 0) { + // AII loop call over contrail network policy fqdn list + for (i in 0..fqdnCount-1) { + + int counting = i+1 + String fqdn = fqdnList[i] + + // Query AAI for this network policy FQDN + + String queryNetworkPolicyByFqdnAAIRequest = "${aai_endpoint}${aai_uri}?network-policy-fqdn=" + UriUtils.encode(fqdn, "UTF-8") + utils.logAudit("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest) + logDebug("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest, isDebugLogEnabled) + + def aaiRequestId = UUID.randomUUID().toString() + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkPolicyByFqdnAAIRequest) + int returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiQueryNetworkPolicyByFqdnReturnCode", returnCode) + logDebug(" ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode, isDebugLogEnabled) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (isOneOf(returnCode, 200, 201)) { + logDebug("The return code is: " + returnCode, isDebugLogEnabled) + // This network policy FQDN exists in AAI - need to delete it now + utils.logAudit(aaiResponseAsString) + execution.setVariable(Prefix + "queryNetworkPolicyByFqdnAAIResponse", aaiResponseAsString) + logDebug("QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString, isDebugLogEnabled) + // Retrieve the network policy id for this FQDN + def networkPolicyId = utils.getNodeText1(aaiResponseAsString, "network-policy-id") + logDebug("Deleting network-policy with network-policy-id " + networkPolicyId, isDebugLogEnabled) + + // Retrieve the resource version for this network policy + def resourceVersion = utils.getNodeText1(aaiResponseAsString, "resource-version") + logDebug("Deleting network-policy with resource-version " + resourceVersion, isDebugLogEnabled) + + String delNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(networkPolicyId, "UTF-8") + + "?resource-version=" + UriUtils.encode(resourceVersion, "UTF-8") + + utils.logAudit("AAI request endpoint: " + delNetworkPolicyAAIRequest) + logDebug("AAI request endpoint: " + delNetworkPolicyAAIRequest, isDebugLogEnabled) + + def aaiRequestIdDel = UUID.randomUUID().toString() + logDebug("invoking DELETE call to AAI", isDebugLogEnabled) + utils.logAudit("Sending DELETE call to AAI with Endpoint /n" + delNetworkPolicyAAIRequest) + + APIResponse responseDel = aaiUriUtil.executeAAIDeleteCall(execution, delNetworkPolicyAAIRequest) + + int returnCodeDel = responseDel.getStatusCode() + execution.setVariable(Prefix + "aaiDeleteNetworkPolicyReturnCode", returnCodeDel) + logDebug(" ***** AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + returnCodeDel, isDebugLogEnabled) + + if (isOneOf(returnCodeDel, 200, 201, 204)) { + logDebug("The return code from deleting network policy is: " + returnCodeDel, isDebugLogEnabled) + // This network policy was deleted from AAI successfully + logDebug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ", isDebugLogEnabled) + + } else { + // aai all errors + String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + returnCodeDel + logDebug(delErrorMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage) + } + } else if (returnCode == 404) { + // This network policy FQDN is not in AAI. No need to delete. + logDebug("The return code is: " + returnCode, isDebugLogEnabled) + logDebug("This network policy FQDN is not in AAI: " + fqdn, isDebugLogEnabled) + utils.logAudit("Network policy FQDN is not in AAI") + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + returnCode + logDebug(dataErrorMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + + + + } // end loop + + + } else { + logDebug("No contrail network policies to query/create", isDebugLogEnabled) + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoCreateVfModuleRollback flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() + logDebug(exceptionMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + } + + + /** + * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. + * + * @param execution The flow's execution instance. + */ + public void preProcessUpdateAAIGenericVnf(Execution execution) { + def method = getClass().getSimpleName() + '.preProcessUpdateAAIGenericVnf((' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def vnfId = execution.getVariable('DCVFMR_vnfId') + def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address') + def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address') + def ipv4OamAddressElement = '' + def managementV6AddressElement = '' + + if (oamManagementV4Address != null) { + ipv4OamAddressElement = '' + 'DELETE' + '' + } + + if (oamManagementV6Address != null) { + managementV6AddressElement = '' + 'DELETE' + '' + } + + + String updateAAIGenericVnfRequest = """ + + ${vnfId} + ${ipv4OamAddressElement} + ${managementV6AddressElement} + + """ + updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) + execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) + utils.logAudit("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) + logDebug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest, isDebugLogEnabled) + + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 1002, 'Error in preProcessUpdateAAIGenericVnf((): ' + e.getMessage()) + } + } +} \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoCreateVfModuleVolumeV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV1.groovy similarity index 94% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoCreateVfModuleVolumeV1.groovy rename to bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV1.groovy index 12a21c6eba..f54fa5c88b 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoCreateVfModuleVolumeV1.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV1.groovy @@ -18,25 +18,20 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.infrastructure.scripts -import static org.camunda.spin.Spin.XML; -import groovy.json.JsonSlurper -import groovy.lang.GroovyInterceptable; -import groovy.xml.XmlUtil -import org.springframework.web.util.UriUtils - -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.core.WorkflowException - -import java.util.UUID; +import static org.camunda.spin.Spin.XML +import org.apache.commons.lang3.* import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.NetworkUtils +import org.openecomp.mso.bpmn.common.scripts.VfModuleBase +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse +import org.springframework.web.util.UriUtils class DoCreateVfModuleVolumeV1 extends VfModuleBase { @@ -63,7 +58,7 @@ class DoCreateVfModuleVolumeV1 extends VfModuleBase { execution.setVariable(prefix+'SuccessIndicator', false) - // INPUT: DoCreateVfModuleVolumeV1Request, att-mso-request-id, volume-group-id, vnf-id, is-vid-request + // INPUT: DoCreateVfModuleVolumeV1Request, mso-request-id, volume-group-id, vnf-id, is-vid-request // OUTPUT: DCVFMODVOLV1_SuccessIndicator. WorkflowException def volumeRequest = getVariable(execution, 'DoCreateVfModuleVolumeV1Request') @@ -86,12 +81,12 @@ class DoCreateVfModuleVolumeV1 extends VfModuleBase { (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, 'DoCreateVfModuleVolumeV1 received null volume-group-id.') } - def requestId = execution.getVariable("att-mso-request-id") + def requestId = execution.getVariable("mso-request-id") if (requestId == null || requestId == "") { requestId = utils.getNodeText1(volumeRequest, "request-id") } - //def serviceId = execution.getVariable("att-mso-service-instance-id") + //def serviceId = execution.getVariable("mso-service-instance-id") //if (serviceId == null || serviceId == "") { def serviceId = utils.getNodeText1(volumeRequest, "service-id") //} @@ -240,6 +235,7 @@ class DoCreateVfModuleVolumeV1 extends VfModuleBase { def volumeRequest = execution.getVariable(prefix+'Request') def vnfId = execution.getVariable('vnf-id') def volumeName = utils.getNodeText(volumeRequest, "volume-group-name") + def modelCustomizationId = getNodeTextForce(volumeRequest, "model-customization-id") def cloudRegion = execution.getVariable(prefix+"aicCloudRegion") def groupId = execution.getVariable('volume-group-id') @@ -259,7 +255,7 @@ class DoCreateVfModuleVolumeV1 extends VfModuleBase { def tenantId = utils.getNodeText(volumeRequest, "tenant-id") NetworkUtils networkUtils = new NetworkUtils() - String payload = networkUtils.createCloudRegionVolumeRequest(groupId, volumeName, vnfType, vnfId, tenantId, cloudRegion, namespace) + String payload = networkUtils.createCloudRegionVolumeRequest(groupId, volumeName, vnfType, vnfId, tenantId, cloudRegion, namespace, modelCustomizationId) String payloadXml = utils.formatXml(payload) utils.logAudit(payloadXml) @@ -306,7 +302,8 @@ class DoCreateVfModuleVolumeV1 extends VfModuleBase { def aaiGenericVnfResponse = execution.getVariable(prefix+'AAIQueryGenericVfnResponse') def vnfId = utils.getNodeText1(aaiGenericVnfResponse, 'vnf-id') def vnfName = utils.getNodeText1(aaiGenericVnfResponse, 'vnf-name') - + def modelCustomizationId = getNodeTextForce(volumeRequest, "model-customization-id") + String messageId = UUID.randomUUID() utils.log("DEBUG", "messageId to be used is generated: " + messageId, isDebugEnabled) @@ -324,7 +321,7 @@ class DoCreateVfModuleVolumeV1 extends VfModuleBase { utils.log("DEBUG", "volumeGroupParams: "+ volumeGroupParams, isDebugEnabled) String volumeGroupId = execution.getVariable('volume-group-id') - def notificationUrl = execution.getVariable("URN_mso_workflow_vnfadapter_rest_callback") + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") if ('true'.equals(useQualifiedHostName)) { notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) @@ -347,6 +344,7 @@ class DoCreateVfModuleVolumeV1 extends VfModuleBase { ${vnfType} ${vnfVersion} ${vnfModuleType} + ${modelCustomizationId} vnf_id @@ -380,6 +378,7 @@ class DoCreateVfModuleVolumeV1 extends VfModuleBase { String vnfSubCreateWorkflowRequestAsString = utils.formatXml(vnfSubCreateWorkflowRequest) utils.logAudit(vnfSubCreateWorkflowRequestAsString) + utils.log('DEBUG', vnfSubCreateWorkflowRequestAsString, isDebugEnabled) execution.setVariable(prefix+"createVnfARequest", vnfSubCreateWorkflowRequestAsString) // build rollback request for use later if needed @@ -418,6 +417,7 @@ class DoCreateVfModuleVolumeV1 extends VfModuleBase { // get variables String requeryAAIVolGrpNameResponse = execution.getVariable(prefix+"queryAAIVolGrpNameResponse") String volumeGroupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id") + String modelCustomizationId = getNodeTextForce(requeryAAIVolGrpNameResponse, "vf-module-persona-model-customization-id") String cloudRegion = execution.getVariable(prefix+"aicCloudRegion") AaiUtil aaiUtil = new AaiUtil(this) @@ -442,7 +442,7 @@ class DoCreateVfModuleVolumeV1 extends VfModuleBase { } NetworkUtils networkUtils = new NetworkUtils() - String payload = networkUtils.updateCloudRegionVolumeRequest(requeryAAIVolGrpNameResponse, vnfId, namespace) + String payload = networkUtils.updateCloudRegionVolumeRequest(requeryAAIVolGrpNameResponse, vnfId, namespace, modelCustomizationId) String payloadXml = utils.formatXml(payload) //execution.setVariable(prefix+"updateCreatedAAIVolumeGrpNamePayloadRequest", payloadXml) @@ -591,7 +591,7 @@ class DoCreateVfModuleVolumeV1 extends VfModuleBase { """ - + ${requestId} BPMN ${statusMessage} @@ -626,9 +626,9 @@ class DoCreateVfModuleVolumeV1 extends VfModuleBase { String requestId = execution.getVariable(prefix+'requestId') String msoCompletionRequest = - """ - + """ + ${requestId} CREATE ${source} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy new file mode 100644 index 0000000000..23763c63b8 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -0,0 +1,414 @@ +/*- + * ============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.apache.commons.lang3.StringUtils.* + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils + + +/** + * This class supports the DoCreateVnf building block subflow + * with the creation of a generic vnf for + * infrastructure. + * + */ +class DoCreateVnf extends AbstractServiceTaskProcessor { + + String Prefix="DoCVNF_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + + /** + * This method gets and validates the incoming + * request. + * + * @param - execution + * + */ + public void preProcessRequest(Execution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + utils.log("DEBUG", " *** STARTED DoCreateVnf PreProcessRequest Process*** ", isDebugEnabled) + + // DISABLE SDNC INTERACTION FOR NOW + execution.setVariable("SDNCInteractionEnabled", false) + + + /*******************/ + try{ + // Get Variables + + String cloudConfiguration = execution.getVariable("cloudConfiguration") + String vnfModelInfo = execution.getVariable("vnfModelInfo") + + String requestId = execution.getVariable("requestId") + execution.setVariable("DoCVNF_requestId", requestId) + execution.setVariable("mso-request-id", requestId) + utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + execution.setVariable("DoCVNF_serviceInstanceId", serviceInstanceId) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + + String vnfType = execution.getVariable("vnfType") + execution.setVariable("DoCVNF_vnfType", vnfType) + utils.log("DEBUG", "Incoming Vnf Type is: " + vnfType, isDebugEnabled) + + String vnfName = execution.getVariable("vnfName") + execution.setVariable("DoCVNF_vnfName", vnfName) + utils.log("DEBUG", "Incoming Vnf Name is: " + vnfName, isDebugEnabled) + + String serviceId = execution.getVariable("productFamilyId") + execution.setVariable("DoCVNF_serviceId", serviceId) + utils.log("DEBUG", "Incoming Service Id is: " + serviceId, isDebugEnabled) + + String source = "VID" + execution.setVariable("DoCVNF_source", source) + utils.log("DEBUG", "Incoming Source is: " + source, isDebugEnabled) + + String suppressRollback = execution.getVariable("disableRollback") + execution.setVariable("DoCVNF_suppressRollback", suppressRollback) + utils.log("DEBUG", "Incoming Suppress Rollback is: " + suppressRollback, isDebugEnabled) + + String modelInvariantId = jsonUtil.getJsonValue(vnfModelInfo, "modelInvariantId") + execution.setVariable("DoCVNF_modelInvariantId", modelInvariantId) + utils.log("DEBUG", "Incoming Invariant Id is: " + modelInvariantId, isDebugEnabled) + + String modelVersionId = jsonUtil.getJsonValue(vnfModelInfo, "modelVersionId") + if (modelVersionId == null) { + modelVersionId = "" + } + execution.setVariable("DoCVNF_modelVersionId", modelVersionId) + utils.log("DEBUG", "Incoming Version Id is: " + modelVersionId, isDebugEnabled) + + String modelVersion = jsonUtil.getJsonValue(vnfModelInfo, "modelVersion") + execution.setVariable("DoCVNF_modelVersion", modelVersion) + utils.log("DEBUG", "Incoming Model Version is: " + modelVersion, isDebugEnabled) + + String modelName = jsonUtil.getJsonValue(vnfModelInfo, "modelName") + execution.setVariable("DoCVNF_modelName", modelName) + utils.log("DEBUG", "Incoming Model Name is: " + modelName, isDebugEnabled) + + String modelCustomizationId = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationId") + if (modelCustomizationId == null) { + modelCustomizationId = "" + } + execution.setVariable("DoCVNF_modelCustomizationId", modelCustomizationId) + utils.log("DEBUG", "Incoming Model Customization Id is: " + modelCustomizationId, isDebugEnabled) + + String cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId") + execution.setVariable("DoCVNF_cloudSiteId", cloudSiteId) + utils.log("DEBUG", "Incoming Cloud Site Id is: " + cloudSiteId, isDebugEnabled) + + String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId") + execution.setVariable("DoCVNF_tenantId", tenantId) + utils.log("DEBUG", "Incoming Tenant Id is: " + tenantId, isDebugEnabled) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${requestId} + CREATE + ${source} + """ + + execution.setVariable("DoCVNF_requestInfo", requestInfo) + //TODO: Orch Status - TBD, will come from SDN-C Response in 1702 + String orchStatus = "Created" + execution.setVariable("DoCVNF_orchStatus", orchStatus) + + //TODO: Equipment Role - Should come from SDN-C Response in 1702 + String equipmentRole = " " + execution.setVariable("DoCVNF_equipmentRole", equipmentRole) + String vnfId = execution.getVariable("testVnfId") // for junits + if(isBlank(vnfId)){ + vnfId = execution.getVariable("vnfId") + if (isBlank(vnfId)) { + vnfId = UUID.randomUUID().toString() + utils.log("DEBUG", "Generated Vnf Id is: " + vnfId, isDebugEnabled) + } + } + execution.setVariable("DoCVNF_vnfId", vnfId) + + // Setting for Sub Flow Calls + execution.setVariable("DoCVNF_type", "generic-vnf") + execution.setVariable("GENGS_type", "service-instance") + + String sdncCallbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') + if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { + def msg = 'Required variable \'URN_mso_workflow_sdncadapter_callback\' is missing' + logError(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + execution.setVariable("DoCVNF_sdncCallbackUrl", sdncCallbackUrl) + utils.logAudit("SDNC Callback URL: " + sdncCallbackUrl) + logDebug("SDNC Callback URL is: " + sdncCallbackUrl, isDebugEnabled) + + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("DEBUG", " Error Occured in DoCreateVnf PreProcessRequest method!" + e.getMessage(), isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest") + + } + utils.log("DEBUG", "*** COMPLETED DoCreateVnf PreProcessRequest Process ***", isDebugEnabled) + } + + + public void prepareCreateGenericVnf (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " *** STARTED DoCreateVnf PrepareCreateGenericVnf Process *** ", isDebugEnabled) + try { + //Get Vnf Info + String vnfId = execution.getVariable("DoCVNF_vnfId") + def vnfName = execution.getVariable("DoCVNF_vnfName") + def vnfType = execution.getVariable("DoCVNF_vnfType") + def serviceId = execution.getVariable("DoCVNF_serviceId") + def orchStatus = execution.getVariable("DoCVNF_orchStatus") + def modelInvariantId = execution.getVariable("DoCVNF_modelInvariantId") + def modelVersion = execution.getVariable("DoCVNF_modelVersion") + def modelCustomizationId = execution.getVariable("DoCVNF_modelCustomizationId") + // TODO: 1702 Variable + def equipmentRole = execution.getVariable("DoCVNF_equipmentRole") + + //Get Service Instance Info + def serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId") + String siRelatedLink = execution.getVariable("GENGS_siResourceLink") + + int custStart = siRelatedLink.indexOf("customer/") + int custEnd = siRelatedLink.indexOf("/service-subscriptions") + String globalCustId = siRelatedLink.substring(custStart + 9, custEnd) + int serviceStart = siRelatedLink.indexOf("service-subscription/") + int serviceEnd = siRelatedLink.indexOf("/service-instances/") + String serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd) + + //Get Namespace + AaiUtil aaiUtil = new AaiUtil(this) + def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution) + String namespace = aaiUtil.getNamespaceFromUri(aai_uri) + + String payload = + """ + ${vnfId} + ${vnfName} + ${serviceId} + ${vnfType} + ${orchStatus} + ${modelInvariantId} + ${modelVersion} + ${modelCustomizationId} + + + service-instance + ${siRelatedLink} + + customer.global-customer-id + ${globalCustId} + + + service-subscription.service-type + ${serviceType} + + + service-instance.service-instance-id + ${serviceInstanceId} + + + + """ + + execution.setVariable("DoCVNF_genericVnfPayload", payload) + + }catch(Exception ex) { + utils.log("DEBUG", "Error Occured in DoCreateVnf PrepareCreateGenericVnf Process " + ex.getMessage(), isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PrepareCreateGenericVnf Process") + } + utils.log("DEBUG", "*** COMPLETED DoCreateVnf PrepareCreateGenericVnf Process ***", isDebugEnabled) + } + + public void preProcessSDNCAssignRequest(Execution execution){ + def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + logDebug(" ======== STARTED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) + def vnfId = execution.getVariable("DoCVNF_vnfId") + def serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId") + logDebug("NEW VNF ID: " + vnfId, isDebugLogEnabled) + utils.logAudit("NEW VNF ID: " + vnfId) + + try{ + //Build SDNC Request + + String assignSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "assign") + + assignSDNCRequest = utils.formatXml(assignSDNCRequest) + execution.setVariable("DoCVNF_assignSDNCRequest", assignSDNCRequest) + logDebug("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest, isDebugLogEnabled) + utils.logAudit("Outgoing AssignSDNCRequest is: \n" + assignSDNCRequest) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing preProcessSDNCAssignRequest. Exception is:\n" + e, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during prepareProvision Method:\n" + e.getMessage()) + } + logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) + } + + public void preProcessSDNCActivateRequest(Execution execution) { + def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + execution.setVariable("prefix", Prefix) + logDebug(" ======== STARTED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled) + try{ + String vnfId = execution.getVariable("DoCVNF_vnfId") + String serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId") + + String activateSDNCRequest = buildSDNCRequest(execution, serviceInstanceId, "activate") + + execution.setVariable("DoCVNF_activateSDNCRequest", activateSDNCRequest) + logDebug("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest, isDebugLogEnabled) + utils.logAudit("Outgoing CommitSDNCRequest is: \n" + activateSDNCRequest) + + }catch(Exception e){ + log.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage()) + } + logDebug("======== COMPLETED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled) + } + + public String buildSDNCRequest(Execution execution, String svcInstId, String action){ + + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis() + } + def callbackURL = execution.getVariable("DoCVNF_sdncCallbackUrl") + def requestId = execution.getVariable("DoCVNF_requestId") + def serviceId = execution.getVariable("DoCVNF_serviceId") + def vnfType = execution.getVariable("DoCVNF_vnfType") + def vnfName = execution.getVariable("DoCVNF_vnfName") + def tenantId = execution.getVariable("DoCVNF_tenantId") + def source = execution.getVariable("DoCVNF_source") + def vnfId = execution.getVariable("DoCVNF_vnfId") + def cloudSiteId = execution.getVariable("DoCVNF_cloudSiteId") + def modelInvariantId = execution.getVariable("DoCVNF_modelInvariantId") + def modelVersionId = execution.getVariable("DoCVNF_modelVersionId") + def modelVersion = execution.getVariable("DoCVNF_modelVersion") + def modelName = execution.getVariable("DoCVNF_modelName") + + String sdncVNFParamsXml = "" + + if(execution.getVariable("DoCVNF_vnfParamsExistFlag") == true){ + sdncVNFParamsXml = buildSDNCParamsXml(execution) + }else{ + sdncVNFParamsXml = "" + } + + String sdncRequest = + """ + + ${requestId} + ${svcInstId} + ${action} + vnf-topology-operation + ${callbackURL} + + + + ${requestId} + VNFActivateRequest + ${source} + + + + + + ${serviceId} + ${serviceId} + ${svcInstId} + notsurewecare + + + ${vnfId} + ${vnfType} + + ${modelInvariantId} + ${modelVersionId} + ${modelVersion} + ${modelName} + + + + ${vnfName} + ${cloudSiteId} + ${tenantId} + ${sdncVNFParamsXml} + + + """ + + utils.logAudit("sdncRequest: " + sdncRequest) + return sdncRequest + } + + public void validateSDNCResponse(Execution execution, String response, String method){ + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled) + + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + utils.logAudit("workflowException: " + workflowException) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + utils.logAudit("SDNCResponse: " + response) + + String sdncResponse = response + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + logDebug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse, isDebugLogEnabled) + + }else{ + logDebug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.", isDebugLogEnabled) + throw new BpmnError("MSOWorkflowException") + } + logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled) + } + + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy new file mode 100644 index 0000000000..e1fca3ddc3 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy @@ -0,0 +1,241 @@ +/*- + * ============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 java.util.UUID; + +import org.json.JSONObject; +import org.json.JSONArray; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException + + + +/** + * This class supports the macro VID Flow + * with the creation of a generic vnf and related VF modules. + */ +class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { + + String Prefix="DCVAM_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + CatalogDbUtils cutils = new CatalogDbUtils() + + /** + * This method gets and validates the incoming + * request. + * + * @param - execution + */ + public void preProcessRequest(Execution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + utils.log("DEBUG", " *** STARTED DoCreateVnfAndModules PreProcessRequest Process*** ", isDebugEnabled) + + try{ + // Get Variables + + + String cloudConfiguration = execution.getVariable("cloudConfiguration") + String vnfModelInfo = execution.getVariable("vnfModelInfo") + + String requestId = execution.getVariable("requestId") + execution.setVariable("mso-request-id", requestId) + utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + + String vnfType = execution.getVariable("vnfType") + utils.log("DEBUG", "Incoming Vnf Type is: " + vnfType, isDebugEnabled) + + String vnfName = execution.getVariable("vnfName") + execution.setVariable("CREVI_vnfName", vnfName) + utils.log("DEBUG", "Incoming Vnf Name is: " + vnfName, isDebugEnabled) + + String productFamilyId = execution.getVariable("productFamilyId") + utils.log("DEBUG", "Incoming Product Family Id is: " + productFamilyId, isDebugEnabled) + + String source = "VID" + execution.setVariable("source", source) + utils.log("DEBUG", "Incoming Source is: " + source, isDebugEnabled) + + String disableRollback = execution.getVariable("disableRollback") + utils.log("DEBUG", "Incoming Disable Rollback is: " + disableRollback, isDebugEnabled) + + String asdcServiceModelVersion = execution.getVariable("asdcServiceModelVersion") + utils.log("DEBUG", "Incoming asdcServiceModelVersion: " + asdcServiceModelVersion, isDebugEnabled) + + String vnfId = execution.getVariable("testVnfId") // for junits + if(isBlank(vnfId)){ + vnfId = execution.getVariable("vnfId") + if (isBlank(vnfId)) { + vnfId = UUID.randomUUID().toString() + utils.log("DEBUG", "Generated Vnf Id is: " + vnfId, isDebugEnabled) + } + } + execution.setVariable("vnfId", vnfId) + + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("DEBUG", " Error Occured in DoCreateVnfAndModules PreProcessRequest method!" + e.getMessage(), isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnf PreProcessRequest") + + } + utils.log("DEBUG", "*** COMPLETED DoCreateVnfAndModules PreProcessRequest Process ***", isDebugEnabled) + } + + + public void queryCatalogDB (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " *** STARTED DoCreateVnfAndModules QueryCatalogDB Process *** ", isDebugEnabled) + try { + //Get Vnf Info + String vnfModelInfo = execution.getVariable("vnfModelInfo") + String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationId") + utils.log("DEBUG", "querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid) + String catalogDbEndpoint = execution.getVariable("URN_mso_catalog_db_endpoint") + + JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(catalogDbEndpoint, + vnfModelCustomizationUuid) + utils.log("DEBUG", "obtained VNF list") + // Only one match here + JSONObject vnf = vnfs[0] + JSONArray vfModules = vnf.getJSONArray("vfModules") + JSONArray addOnModules = new JSONArray() + + // Set up base Vf Module info + for (int i = 0; i < vfModules.length(); i++) { + utils.log("DEBUG", "handling VF Module ") + JSONObject vfModule = vfModules[i] + String isBase = jsonUtil.getJsonValueForKey(vfModule, "isBase") + if (isBase.equals("true")) { + JSONObject baseVfModuleModelInfoObject = vfModule.getJSONObject("modelInfo") + String baseVfModuleModelInfo = baseVfModuleModelInfoObject.toString() + execution.setVariable("baseVfModuleModelInfo", baseVfModuleModelInfo) + String baseVfModuleLabel = jsonUtil.getJsonValueForKey(vfModule, "vfModuleLabel") + execution.setVariable("baseVfModuleLabel", baseVfModuleLabel) + String basePersonaModelId = jsonUtil.getJsonValueForKey(baseVfModuleModelInfoObject, "modelInvariantId") + execution.setVariable("basePersonaModelId", basePersonaModelId) + } + else { + addOnModules.add(vfModules[i]) + } + } + + execution.setVariable("addOnModules", addOnModules) + execution.setVariable("addOnModulesToDeploy", addOnModules.length()) + execution.setVariable("addOnModulesDeployed", 0) + + }catch(Exception ex) { + utils.log("DEBUG", "Error Occured in DoCreateVnfAndModules QueryCatalogDB Process " + ex.getMessage(), isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoCreateVnfAndModules QueryCatalogDB Process") + } + + // Generate vfModuleId for base VF Module + def baseVfModuleId = UUID.randomUUID().toString() + execution.setVariable("baseVfModuleId", baseVfModuleId) + utils.log("DEBUG", "*** COMPLETED CreateVnfInfra PrepareCreateGenericVnf Process ***", isDebugEnabled) + } + + public void preProcessAddOnModule(Execution execution){ + def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + logDebug(" ======== STARTED preProcessAddOnModule ======== ", isDebugLogEnabled) + + try { + JSONArray addOnModules = (JSONArray) execution.getVariable("addOnModules") + int addOnIndex = (int) execution.getVariable("addOnModulesDeployed") + + JSONObject addOnModule = addOnModules[addOnIndex] + + def newVfModuleId = UUID.randomUUID().toString() + execution.setVariable("addOnVfModuleId", newVfModuleId) + + execution.setVariable("instancesOfThisModelDeployed", 0) + + JSONObject addOnVfModuleModelInfoObject = jsonUtil.getJsonValueForKey(addOnModule, "modelInfo") + String addOnVfModuleModelInfo = addOnVfModuleModelInfoObject.toString() + execution.setVariable("addOnVfModuleModelInfo", addOnVfModuleModelInfo) + String addOnVfModuleLabel = jsonUtil.getJsonValueForKey(addOnModule, "vfModuleLabel") + execution.setVariable("addOnVfModuleLabel", addOnVfModuleLabel) + String addOnPersonaModelId = jsonUtil.getJsonValueForKey(addOnVfModuleModelInfoObject, "modelInvariantId") + execution.setVariable("addOnPersonaModelId", addOnPersonaModelId) + String addOnInitialCount = jsonUtil.getJsonValueForKey(addOnModule, "initialCount") + execution.setVariable("initialCount", addOnInitialCount) + + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) + } + logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) + } + + public void validateAddOnModule(Execution execution){ + def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + logDebug(" ======== STARTED validateAddOnModule ======== ", isDebugLogEnabled) + + try { + int instancesOfThisModuleDeployed = execution.getVariable("instancesOfThisModuleDeployed") + execution.setVariable("instancesOfThisModuleDeployed", instancesOfThisModuleDeployed + 1) + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) + } + logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) + } + + public void finishProcessingInitialCountDeployment(Execution execution){ + def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + logDebug(" ======== STARTED finishProcessingInitialCountDeployment ======== ", isDebugLogEnabled) + + try { + int addOnModulesDeployed = execution.getVariable("addOnModulesDeployed") + execution.setVariable("addOnModulesDeployed", addOnModulesDeployed + 1) + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing preProcessAddOnModule. Exception is:\n" + e, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessAddOnModule Method:\n" + e.getMessage()) + } + logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) + } + + + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy new file mode 100644 index 0000000000..dbe31528cf --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -0,0 +1,1061 @@ +/*- + * ============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 org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.NetworkUtils +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils + +import groovy.xml.XmlUtil +import groovy.json.* + +public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { + String Prefix= "DELNWKI_" + String groovyClassName = "DoDeleteNetworkInstance" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + NetworkUtils networkUtils = new NetworkUtils() + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + public InitializeProcessVariables(Execution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable(Prefix + "networkRequest", "") + execution.setVariable(Prefix + "isSilentSuccess", false) + execution.setVariable(Prefix + "Success", false) + + execution.setVariable(Prefix + "requestId", "") + execution.setVariable(Prefix + "source", "") + execution.setVariable(Prefix + "lcpCloudRegion", "") + execution.setVariable(Prefix + "networkInputs", "") + execution.setVariable(Prefix + "tenantId", "") + + execution.setVariable(Prefix + "queryAAIRequest","") + execution.setVariable(Prefix + "queryAAIResponse", "") + execution.setVariable(Prefix + "aaiReturnCode", "") + execution.setVariable(Prefix + "isAAIGood", false) + execution.setVariable(Prefix + "isVfRelationshipExist", false) + + // AAI query Cloud Region + execution.setVariable(Prefix + "queryCloudRegionRequest","") + execution.setVariable(Prefix + "queryCloudRegionReturnCode","") + execution.setVariable(Prefix + "queryCloudRegionResponse","") + execution.setVariable(Prefix + "cloudRegionPo","") + execution.setVariable(Prefix + "cloudRegionSdnc","") + + execution.setVariable(Prefix + "deleteNetworkRequest", "") + execution.setVariable(Prefix + "deleteNetworkResponse", "") + execution.setVariable(Prefix + "networkReturnCode", "") + execution.setVariable(Prefix + "rollbackNetworkRequest", "") + + execution.setVariable(Prefix + "deleteSDNCRequest", "") + execution.setVariable(Prefix + "deleteSDNCResponse", "") + execution.setVariable(Prefix + "sdncReturnCode", "") + execution.setVariable(Prefix + "sdncResponseSuccess", false) + + execution.setVariable(Prefix + "deactivateSDNCRequest", "") + execution.setVariable(Prefix + "deactivateSDNCResponse", "") + execution.setVariable(Prefix + "deactivateSdncReturnCode", "") + execution.setVariable(Prefix + "isSdncDeactivateRollbackNeeded", "") + + execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", "") + execution.setVariable(Prefix + "isException", false) + + + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside preProcessRequest() of " + groovyClassName + " Request ***** ", isDebugEnabled) + + // initialize flow variables + InitializeProcessVariables(execution) + + try { + // get incoming message/input + execution.setVariable("action", "DELETE") + String deleteNetwork = execution.getVariable("bpmnRequest") + if (deleteNetwork != null) { + if (deleteNetwork.contains("requestDetails")) { + // JSON format request is sent, create xml + try { + def prettyJson = JsonOutput.prettyPrint(deleteNetwork.toString()) + utils.log("DEBUG", " Incoming message formatted . . . : " + '\n' + prettyJson, isDebugEnabled) + deleteNetwork = vidUtils.createXmlNetworkRequestInfra(execution, deleteNetwork) + + } catch (Exception ex) { + String dataErrorMessage = " Invalid json format Request - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + } else { + // XML format request is sent + + } + } else { + // vIPR format request is sent, create xml from individual variables + deleteNetwork = vidUtils.createXmlNetworkRequestInstance(execution) + } + + deleteNetwork = utils.formatXml(deleteNetwork) + utils.logAudit(deleteNetwork) + execution.setVariable(Prefix + "networkRequest", deleteNetwork) + utils.log("DEBUG", Prefix + "networkRequest - " + '\n' + deleteNetwork, isDebugEnabled) + + // validate 'backout-on-failure' to override 'URN_mso_rollback' + boolean rollbackEnabled = networkUtils.isRollbackEnabled(execution, deleteNetwork) + execution.setVariable(Prefix + "rollbackEnabled", rollbackEnabled) + utils.log("DEBUG", Prefix + "rollbackEnabled - " + rollbackEnabled, isDebugEnabled) + + String networkInputs = utils.getNodeXml(deleteNetwork, "network-inputs", false).replace("tag0:","").replace(":tag0","") + execution.setVariable(Prefix + "networkInputs", networkInputs) + + // prepare messageId + String messageId = execution.getVariable("testMessageId") // for testing + if (messageId == null || messageId == "") { + messageId = UUID.randomUUID() + utils.log("DEBUG", Prefix + "messageId, random generated: " + messageId, isDebugEnabled) + } else { + utils.log("DEBUG", Prefix + "messageId, pre-assigned: " + messageId, isDebugEnabled) + } + execution.setVariable(Prefix + "messageId", messageId) + + String source = utils.getNodeText1(deleteNetwork, "source") + execution.setVariable(Prefix + "source", source) + utils.log("DEBUG", Prefix + "source - " + source, isDebugEnabled) + + String networkId = "" + if (utils.nodeExists(networkInputs, "network-id")) { + networkId = utils.getNodeText1(networkInputs, "network-id") + if (networkId == null || networkId == "" || networkId == 'null' ) { + sendSyncError(execution) + // missing value of network-id + String dataErrorMessage = "network-request has missing 'network-id' element/value." + utils.log("DEBUG", " Invalid Request - " + dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + } + + // lcpCloudRegion or tenantId not sent, will be extracted from query AA&I + def lcpCloudRegion = null + if (utils.nodeExists(networkInputs, "aic-cloud-region")) { + lcpCloudRegion = utils.getNodeText(networkInputs, "aic-cloud-region") + if (lcpCloudRegion == 'null') { + lcpCloudRegion = null + } + } + execution.setVariable(Prefix + "lcpCloudRegion", lcpCloudRegion) + utils.log("DEBUG", "lcpCloudRegion : " + lcpCloudRegion, isDebugEnabled) + + String tenantId = null + if (utils.nodeExists(networkInputs, "tenant-id")) { + tenantId = utils.getNodeText1(networkInputs, "tenant-id") + if (tenantId == 'null') { + tenantId = null + } + + } + execution.setVariable(Prefix + "tenantId", tenantId) + utils.log("DEBUG", "tenantId : " + tenantId, isDebugEnabled) + + String sdncVersion = execution.getVariable("sdncVersion") + utils.log("DEBUG", "sdncVersion? : " + sdncVersion, isDebugEnabled) + + // PO Authorization Info / headers Authorization= + String basicAuthValuePO = execution.getVariable("URN_mso_adapters_po_auth") + utils.log("DEBUG", " Obtained BasicAuth userid password for PO/SDNC adapter: " + basicAuthValuePO, isDebugEnabled) + try { + def encodedString = utils.getBasicAuth(basicAuthValuePO, execution.getVariable("URN_mso_msoKey")) + execution.setVariable("BasicAuthHeaderValuePO",encodedString) + execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) + + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode PO/SDNC user/password string - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage, , isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex){ + // caught exception + String exceptionMessage = "Exception Encountered in DoDeleteNetworkInstance, PreProcessRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + public void callRESTQueryAAI (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside callRESTQueryAAI() of DoDoDeleteNetworkInstance ***** " , isDebugEnabled) + + // get variables + String networkInputs = execution.getVariable(Prefix + "networkInputs") + String networkId = utils.getNodeText(networkInputs, "network-id") + networkId = UriUtils.encode(networkId,"UTF-8") + String messageId = execution.getVariable(Prefix + "messageId") + + // Prepare AA&I url + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) + String queryAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + utils.logAudit(queryAAIRequest) + execution.setVariable(Prefix + "queryAAIRequest", queryAAIRequest) + utils.log("DEBUG", Prefix + "AAIRequest - " + "\n" + queryAAIRequest, isDebugEnabled) + + RESTConfig config = new RESTConfig(queryAAIRequest); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + Boolean isVfRelationshipExist = false + try { + RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) + .addHeader("X-FromAppId", "MSO") + .addHeader("Content-Type", "application/xml") + .addHeader("Accept","application/xml"); + APIResponse response = client.get() + String returnCode = response.getStatusCode() + execution.setVariable(Prefix + "aaiReturnCode", returnCode) + + utils.log("DEBUG", " ***** AAI Response Code : " + returnCode, isDebugEnabled) + + String aaiResponseAsString = response.getResponseBodyAsString() + aaiResponseAsString = StringEscapeUtils.unescapeXml(aaiResponseAsString) + execution.setVariable(Prefix + "queryAAIResponse", aaiResponseAsString) + + if (returnCode=='200' || returnCode=='204') { + utils.logAudit(aaiResponseAsString) + execution.setVariable(Prefix + "isAAIGood", true) + utils.log("DEBUG", " AAI Query Success REST Response - " + "\n" + aaiResponseAsString, isDebugEnabled) + // verify if vf or vnf relationship exist + if (utils.nodeExists(aaiResponseAsString, "relationship")) { + NetworkUtils networkUtils = new NetworkUtils() + isVfRelationshipExist = networkUtils.isVfRelationshipExist(aaiResponseAsString) + execution.setVariable(Prefix + "isVfRelationshipExist", isVfRelationshipExist) + if (isVfRelationshipExist == true) { + String relationshipMessage = "AAI Query Success Response but 'vf-module' relationship exist, not allowed to delete: network Id: " + networkId + exceptionUtil.buildWorkflowException(execution, 2500, relationshipMessage) + + } else { + // verify if lcpCloudRegion was sent as input, if not get value from AAI Response + if (execution.getVariable(Prefix + "lcpCloudRegion") == null ) { + String lcpCloudRegion = networkUtils.getCloudRegion(aaiResponseAsString) + execution.setVariable(Prefix + "lcpCloudRegion", lcpCloudRegion) + utils.log("DEBUG", " Get AAI getCloudRegion() : " + lcpCloudRegion, isDebugEnabled) + } + if (execution.getVariable(Prefix + "tenantId") == null ) { + String tenantId = networkUtils.getTenantId(aaiResponseAsString) + execution.setVariable(Prefix + "tenantId", tenantId) + utils.log("DEBUG", " Get AAI getTenantId() : " + tenantId, isDebugEnabled) + } + + } + } + utils.log("DEBUG", Prefix + "isVfRelationshipExist - " + isVfRelationshipExist, isDebugEnabled) + + } else { + execution.setVariable(Prefix + "isAAIGood", false) + if (returnCode=='404' || aaiResponseAsString == "" || aaiResponseAsString == null) { + // not found // empty aai response + execution.setVariable(Prefix + "isSilentSuccess", true) + utils.log("DEBUG", " AAI Query is Silent Success", isDebugEnabled) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Error Response from callRESTQueryAAI() - " + returnCode + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 2500, dataErrorMessage) + + } + } + } + + utils.log("DEBUG", " AAI Query call, isAAIGood? : " + execution.getVariable(Prefix + "isAAIGood"), isDebugEnabled) + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Exception Encountered in DoDeleteNetworkInstance, callRESTQueryAAI() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void callRESTQueryAAICloudRegion (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside callRESTQueryAAICloudRegion of DoDeleteNetworkInstance ***** " , isDebugEnabled) + + try { + String networkInputs = execution.getVariable(Prefix + "networkInputs") + // String cloudRegion = utils.getNodeText(networkInputs, "aic-cloud-region") + String cloudRegion = execution.getVariable(Prefix + "lcpCloudRegion") + cloudRegion = UriUtils.encode(cloudRegion,"UTF-8") + // Prepare AA&I url + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + AaiUtil aaiUtil = new AaiUtil(this) + String aai_uri = aaiUtil.getCloudInfrastructureCloudRegionUri(execution) + String queryCloudRegionRequest = "${aai_endpoint}${aai_uri}/" + cloudRegion + utils.logAudit(queryCloudRegionRequest) + execution.setVariable(Prefix + "queryCloudRegionRequest", queryCloudRegionRequest) + utils.log("DEBUG", Prefix + "queryCloudRegionRequest - " + "\n" + queryCloudRegionRequest, isDebugEnabled) + + String cloudRegionPo = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion) + String cloudRegionSdnc = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "SDNC", cloudRegion) + + if ((cloudRegionPo != "ERROR") && (cloudRegionSdnc != "ERROR")) { + execution.setVariable(Prefix + "cloudRegionPo", cloudRegionPo) + execution.setVariable(Prefix + "cloudRegionSdnc", cloudRegionSdnc) + + } else { + String dataErrorMessage = "QueryAAICloudRegion Unsuccessful. Return Code: " + execution.getVariable(Prefix + "queryCloudRegionReturnCode") + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, callRESTQueryAAICloudRegion(). Unexpected Response from AAI - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareNetworkRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside prepareNetworkRequest of DoDeleteNetworkInstance ***** ", isDebugEnabled) + ExceptionUtil exceptionUtil = new ExceptionUtil() + try { + // get variables + String networkInputs = execution.getVariable(Prefix + "networkInputs") + String cloudSiteId = execution.getVariable(Prefix + "cloudRegionPo") + String tenantId = execution.getVariable(Prefix + "tenantId") + + String queryAAIResponse = execution.getVariable(Prefix + "queryAAIResponse") + String networkType = utils.getNodeText1(queryAAIResponse, "network-type") + String networkId = utils.getNodeText1(queryAAIResponse, "network-id") + String backoutOnFailure = execution.getVariable(Prefix + "rollbackEnabled") + + String networkStackId = "" + networkStackId = utils.getNodeText1(queryAAIResponse, "heat-stack-id") + if (networkStackId == 'null' || networkStackId == "") { + networkStackId = "force_delete" + } + + String requestId = execution.getVariable(Prefix + "requestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + // Added new Elements + String messageId = execution.getVariable(Prefix + "messageId") + String notificationUrl = "" //TODO - is this coming from URN? What variable/value to use? + //String notificationUrl = execution.getVariable("URN_?????") //TODO - is this coming from URN? What variable/value to use? + + String deleteNetworkRequest = """ + + ${cloudSiteId} + ${tenantId} + ${networkId} + ${networkStackId} + ${networkType} + true + + ${requestId} + ${serviceInstanceId} + + ${messageId} + ${notificationUrl} + + """.trim() + + utils.log("DEBUG", Prefix + "deleteNetworkRequest - " + "\n" + deleteNetworkRequest, isDebugEnabled) + // Format Response + String buildDeleteNetworkRequestAsString = utils.formatXml(deleteNetworkRequest) + utils.logAudit(buildDeleteNetworkRequestAsString) + utils.log("DEBUG", Prefix + "deleteNetworkRequestAsString - " + "\n" + buildDeleteNetworkRequestAsString, isDebugEnabled) + + String restURL = execution.getVariable("URN_mso_adapters_network_rest_endpoint") + execution.setVariable("URN_mso_adapters_network_rest_endpoint", restURL + "/" + networkId) + utils.log("DEBUG", "URN_mso_adapters_network_rest_endpoint - " + "\n" + restURL + "/" + networkId, isDebugEnabled) + + execution.setVariable(Prefix + "deleteNetworkRequest", buildDeleteNetworkRequestAsString) + utils.log("DEBUG", Prefix + "deleteNetworkRequest - " + "\n" + buildDeleteNetworkRequestAsString, isDebugEnabled) + } + catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareNetworkRequest(). Unexpected Response from AAI - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + } + + /** + * This method is used instead of an HTTP Connector task because the + * connector does not allow DELETE with a body. + */ + public void sendRequestToVnfAdapter(Execution execution) { + def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' + + 'execution=' + execution.getId() + + ')' + def isDebugEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugEnabled) + + try { + + String vnfAdapterUrl = execution.getVariable("URN_mso_adapters_network_rest_endpoint") + String vnfAdapterRequest = execution.getVariable(Prefix + "deleteNetworkRequest") + + RESTConfig config = new RESTConfig(vnfAdapterUrl) + RESTClient client = new RESTClient(config). + addHeader("Content-Type", "application/xml"). + addAuthorizationHeader(execution.getVariable("BasicAuthHeaderValuePO")); + + APIResponse response; + + response = client.httpDelete(vnfAdapterRequest) + + execution.setVariable(Prefix + "networkReturnCode", response.getStatusCode()) + execution.setVariable(Prefix + "deleteNetworkResponse", response.getResponseBodyAsString()) + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, sendRequestToVnfAdapter() - " + ex.getMessage() + logError(exceptionMessage) + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + } + + + public void prepareSDNCRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside prepareSDNCRequest of DoDeleteNetworkInstance ***** ", isDebugEnabled) + + try { + // get variables + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") + + String networkId = "" + if (utils.nodeExists(deleteNetworkInput, "network-id")) { + networkId = utils.getNodeText1(deleteNetworkInput, "network-id") + } + if (networkId == 'null') {networkId = ""} + + String serviceInstanceId = utils.getNodeText1(deleteNetworkInput, "service-instance-id") + + // get/set 'msoRequestId' and 'mso-request-id' + String requestId = execution.getVariable("msoRequestId") + if (requestId != null) { + execution.setVariable("mso-request-id", requestId) + } else { + requestId = execution.getVariable("mso-request-id") + } + execution.setVariable(Prefix + "requestId", requestId) + + String queryAAIResponse = execution.getVariable(Prefix + "queryAAIResponse") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + // 1. prepare delete topology via SDNC Adapter SUBFLOW call + String sndcTopologyDeleteRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "delete", "DisconnectNetworkRequest", cloudRegionId, networkId, queryAAIResponse, null) + String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) + utils.logAudit(sndcTopologyDeleteRequesAsString) + execution.setVariable(Prefix + "deleteSDNCRequest", sndcTopologyDeleteRequesAsString) + utils.log("DEBUG", Prefix + "deleteSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage() + logError(exceptionMessage) + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRpcSDNCRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside prepareRpcSDNCRequest of DoDeleteNetworkInstance ***** ", isDebugEnabled) + + try { + // get variables + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") + + String networkId = "" + if (utils.nodeExists(deleteNetworkInput, "network-id")) { + networkId = utils.getNodeText1(deleteNetworkInput, "network-id") + } + if (networkId == 'null') {networkId = ""} + + String serviceInstanceId = utils.getNodeText1(deleteNetworkInput, "service-instance-id") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + // 1. prepare delete topology via SDNC Adapter SUBFLOW call + String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "unassign", "DeleteNetworkInstance", cloudRegionId, networkId, null) + String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) + utils.logAudit(sndcTopologyDeleteRequesAsString) + execution.setVariable(Prefix + "deleteSDNCRequest", sndcTopologyDeleteRequesAsString) + utils.log("DEBUG", Prefix + "deleteSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRequest() - " + ex.getMessage() + logError(exceptionMessage) + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + + public void prepareRpcSDNCDeactivate(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareRpcSDNCDeactivate() of DoDeleteNetworkInstance ***** ", isDebugEnabled) + + try { + + // get variables + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + String networkId = "" + if (utils.nodeExists(deleteNetworkInput, "network-id")) { + networkId = utils.getNodeText1(deleteNetworkInput, "network-id") + } + if (networkId == 'null') {networkId = ""} + String serviceInstanceId = utils.getNodeText1(deleteNetworkInput, "service-instance-id") + + String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "deactivate", "DeleteNetworkInstance", cloudRegionId, networkId, null) + String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) + execution.setVariable(Prefix + "deactivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString) + utils.log("DEBUG", " Preparing request for RPC SDNC Topology deactivate - " + "\n" + sndcTopologyRollbackRpcRequestAsString, isDebugEnabled) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCActivateRollback() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + // ************************************************** + // Post or Validate Response Section + // ************************************************** + + public void validateNetworkResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside validateNetworkResponse of DoDeleteNetworkInstance *****", isDebugEnabled) + + try { + String returnCode = execution.getVariable(Prefix + "networkReturnCode") + String networkResponse = execution.getVariable(Prefix + "deleteNetworkResponse") + + utils.log("DEBUG", " Network Adapter responseCode: " + returnCode, isDebugEnabled) + utils.log("DEBUG", "Network Adapter Response - " + "\n" + networkResponse, isDebugEnabled) + utils.logAudit(networkResponse) + + String errorMessage = "" + if (returnCode == "200") { + utils.log("DEBUG", " Network Adapter Response is successful - " + "\n" + networkResponse, isDebugEnabled) + + // prepare rollback data + String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","") + if ((rollbackData == null) || (rollbackData.isEmpty())) { + utils.log("DEBUG", " Network Adapter 'rollback' data is not Sent: " + "\n" + networkResponse, isDebugEnabled) + execution.setVariable(Prefix + "rollbackNetworkRequest", "") + } else { + String rollbackNetwork = + """ + ${rollbackData} + """ + String rollbackNetworkXml = utils.formatXml(rollbackNetwork) + execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkXml) + utils.log("DEBUG", " Network Adapter rollback data - " + "\n" + rollbackNetworkXml, isDebugEnabled) + } + + + } else { // network error + if (returnCode.toInteger() > 399 && returnCode.toInteger() < 600) { //4xx, 5xx + if (networkResponse.contains("deleteNetworkError") ) { + networkResponse = networkResponse.replace('', '') + errorMessage = utils.getNodeText1(networkResponse, "message") + errorMessage = "Received error from Network Adapter: " + errorMessage + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + + } else { // CatchAll exception + if (returnCode == "500") { + errorMessage = "JBWEB000065: HTTP Status 500." + } else { + errorMessage = "Return code is " + returnCode + } + errorMessage = "Received error from Network Adapter: " + errorMessage + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMessage) + + } + + } else { // CatchAll exception + String dataErrorMessage = "Received error from Network Adapter. Return code is: " + returnCode + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, validateNetworkResponse() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void validateSDNCResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside validateSDNCResponse of DoDeleteNetworkInstance ***** ", isDebugEnabled) + + String response = execution.getVariable(Prefix + "deleteSDNCResponse") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + WorkflowException workflowException = execution.getVariable("WorkflowException") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + // reset variable + String deleteSDNCResponseDecodeXml = sdncAdapterUtils.decodeXML(execution.getVariable(Prefix + "deleteSDNCResponse")) + deleteSDNCResponseDecodeXml = deleteSDNCResponseDecodeXml.replace("&", "&").replace('', "") + execution.setVariable(Prefix + "deleteSDNCResponse", deleteSDNCResponseDecodeXml) + + if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, prefix+'sdncResponseSuccess' + execution.setVariable(Prefix + "isSdncRollbackNeeded", true) // + execution.setVariable(Prefix + "isPONR", true) + utils.log("DEBUG", "Successfully Validated SDNC Response", isDebugEnabled) + } else { + utils.log("DEBUG", "Did NOT Successfully Validated SDNC Response", isDebugEnabled) + throw new BpmnError("MSOWorkflowException") + } + + } + + public void validateRpcSDNCDeactivateResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside validateRpcSDNCDeactivateResponse() of DoDeleteNetworkInstance ***** ", isDebugEnabled) + + String response = execution.getVariable(Prefix + "deactivateSDNCResponse") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + WorkflowException workflowException = execution.getVariable("WorkflowException") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + // reset variable + String assignSDNCResponseDecodeXml = sdncAdapterUtils.decodeXML(execution.getVariable(Prefix + "deactivateSDNCResponse")) + assignSDNCResponseDecodeXml = assignSDNCResponseDecodeXml.replace("&", "&").replace('', "") + execution.setVariable(Prefix + "deactivateSDNCResponse", assignSDNCResponseDecodeXml) + + if (execution.getVariable(Prefix + "sdncResponseSuccess") == true) { // from sdnc util, Prefix+'sdncResponseSuccess' + execution.setVariable(Prefix + "isSdncDeactivateRollbackNeeded", true) + utils.log("DEBUG", "Successfully Validated Rpc SDNC Activate Response", isDebugEnabled) + + } else { + utils.log("DEBUG", "Did NOT Successfully Validated Rpc SDNC Deactivate Response", isDebugEnabled) + throw new BpmnError("MSOWorkflowException") + } + + } + + public void prepareRpcSDNCDeactivateRollback(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareRpcSDNCDeactivateRollback() of DoDeleteNetworkInstance ***** ", isDebugEnabled) + + try { + + // get variables + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + String deactivateSDNCResponse = execution.getVariable(Prefix + "deactivateSDNCResponse") + String networkId = utils.getNodeText1(deactivateSDNCResponse, "network-id") + if (networkId == 'null') {networkId = ""} + String serviceInstanceId = utils.getNodeText1(deleteNetworkInput, "service-instance-id") + + // 2. prepare rollback topology via SDNC Adapter SUBFLOW call + String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "activate", "ActivateNetworkInstance", cloudRegionId, networkId, null) + String sndcTopologyRollbackRpcRequestAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) + execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", sndcTopologyRollbackRpcRequestAsString) + utils.log("DEBUG", " Preparing request for RPC SDNC Topology 'activate-ActivateNetworkInstance' rollback . . . - " + "\n" + sndcTopologyRollbackRpcRequestAsString, isDebugEnabled) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCDeactivateRollback() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRollbackData(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareRollbackData() of DoDeleteNetworkInstance ***** ", isDebugEnabled) + + try { + + Map rollbackData = new HashMap(); + String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") + if (rollbackNetworkRequest != null) { + if (rollbackNetworkRequest != "") { + rollbackData.put("rollbackNetworkRequest", execution.getVariable(Prefix + "rollbackNetworkRequest")) + } + } + String rollbackDeactivateSDNCRequest = execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest") + if (rollbackDeactivateSDNCRequest != null) { + if (rollbackDeactivateSDNCRequest != "") { + rollbackData.put("rollbackDeactivateSDNCRequest", execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest")) + } + } + execution.setVariable("rollbackData", rollbackData) + utils.log("DEBUG", "** rollbackData : " + rollbackData, isDebugEnabled) + + execution.setVariable("WorkflowException", execution.getVariable("WorkflowException")) + utils.log("DEBUG", "** WorkflowException : " + execution.getVariable("WorkflowException"), isDebugEnabled) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRollbackData() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void postProcessResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside postProcessResponse of DoDeleteNetworkInstance ***** ", isDebugEnabled) + + try { + + utils.log("DEBUG", " ***** Is Exception Encountered (isException)? : " + execution.getVariable(Prefix + "isException"), isDebugEnabled) + if (execution.getVariable(Prefix + "isException") == false) { + execution.setVariable(Prefix + "Success", true) + execution.setVariable("WorkflowException", null) + if (execution.getVariable(Prefix + "isSilentSuccess") == true) { + execution.setVariable("rolledBack", false) + } else { + execution.setVariable("rolledBack", true) + } + prepareSuccessRollbackData(execution) // populate rollbackData + + } else { + execution.setVariable(Prefix + "Success", false) + execution.setVariable("rollbackData", null) + String exceptionMessage = " Exception encountered in MSO Bpmn. " + if (execution.getVariable("workflowException") != null) { // Output of Rollback flow. + utils.log("DEBUG", " ***** workflowException: " + execution.getVariable("workflowException"), isDebugEnabled) + WorkflowException wfex = execution.getVariable("workflowException") + exceptionMessage = wfex.getErrorMessage() + } else { + if (execution.getVariable(Prefix + "WorkflowException") != null) { + WorkflowException pwfex = execution.getVariable(Prefix + "WorkflowException") + exceptionMessage = pwfex.getErrorMessage() + } + } + // going to the Main flow: a-la-carte or macro + utils.log("DEBUG", " ***** postProcessResponse(), BAD !!!", isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + throw new BpmnError("MSOWorkflowException") + + } + + } catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, postProcessResponse() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + throw new BpmnError("MSOWorkflowException") + + } + + } + + public void prepareSuccessRollbackData(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareSuccessRollbackData() of DoDeleteNetworkInstance ***** ", isDebugEnabled) + + try { + + if (execution.getVariable("sdncVersion") == '1702') { + prepareRpcSDNCDeactivateRollback(execution) + prepareRpcSDNCUnassignRollback(execution) + } else { + prepareSDNCRollback(execution) + } + + Map rollbackData = new HashMap(); + String rollbackSDNCRequest = execution.getVariable(Prefix + "rollbackSDNCRequest") + if (rollbackSDNCRequest != null) { + if (rollbackSDNCRequest != "") { + rollbackData.put("rollbackSDNCRequest", execution.getVariable(Prefix + "rollbackSDNCRequest")) + } + } + String rollbackNetworkRequest = execution.getVariable(Prefix + "rollbackNetworkRequest") + if (rollbackNetworkRequest != null) { + if (rollbackNetworkRequest != "") { + rollbackData.put("rollbackNetworkRequest", execution.getVariable(Prefix + "rollbackNetworkRequest")) + } + } + String rollbackDeactivateSDNCRequest = execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest") + if (rollbackDeactivateSDNCRequest != null) { + if (rollbackDeactivateSDNCRequest != "") { + rollbackData.put("rollbackDeactivateSDNCRequest", execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest")) + } + } + execution.setVariable("rollbackData", rollbackData) + + utils.log("DEBUG", "** rollbackData : " + rollbackData, isDebugEnabled) + execution.setVariable("WorkflowException", null) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareSuccessRollbackData() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareRpcSDNCUnassignRollback(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside prepareRpcSDNCUnassignRollbac() of DoDeleteNetworkInstance ***** ", isDebugEnabled) + + try { + + // get variables + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") + + String deleteSDNCResponse = execution.getVariable(Prefix + "deleteSDNCResponse") + String networkId = utils.getNodeText1(deleteSDNCResponse, "network-id") + if (networkId == 'null') {networkId = ""} + String serviceInstanceId = utils.getNodeText1(deleteNetworkInput, "service-instance-id") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + // 1. prepare delete topology via SDNC Adapter SUBFLOW call + String sndcTopologyRollbackRpcRequest = sdncAdapterUtils.sdncTopologyRequestRsrc(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "assign", "CreateNetworkInstance", cloudRegionId, networkId, null) + String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyRollbackRpcRequest) + utils.logAudit(sndcTopologyDeleteRequesAsString) + execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyDeleteRequesAsString) + utils.log("DEBUG", Prefix + "rollbackSDNCRequest" + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) + utils.log("DEBUG", " Preparing request for RPC SDNC Topology 'assign-CreateNetworkInstance' rollback . . . - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) + + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstance flow. prepareRpcSDNCUnassignRollback() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void prepareSDNCRollback (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside prepareSDNCRollback of DoDeleteNetworkInstance ***** ", isDebugEnabled) + + try { + + // get variables + String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") + + String networkId = "" + if (utils.nodeExists(deleteNetworkInput, "network-id")) { + networkId = utils.getNodeText1(deleteNetworkInput, "network-id") + } + if (networkId == 'null') {networkId = ""} + + String serviceInstanceId = utils.getNodeText1(deleteNetworkInput, "service-instance-id") + + // get/set 'msoRequestId' and 'mso-request-id' + String requestId = execution.getVariable("msoRequestId") + if (requestId != null) { + execution.setVariable("mso-request-id", requestId) + } else { + requestId = execution.getVariable("mso-request-id") + } + execution.setVariable(Prefix + "requestId", requestId) + + String queryAAIResponse = execution.getVariable(Prefix + "queryAAIResponse") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + String cloudRegionId = execution.getVariable(Prefix + "cloudRegionSdnc") + // 1. prepare delete topology via SDNC Adapter SUBFLOW call + String sndcTopologyDeleteRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, deleteNetworkInput, serviceInstanceId, sdncCallback, "rollback", "DisconnectNetworkRequest", cloudRegionId, networkId, queryAAIResponse, null) + String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) + utils.logAudit(sndcTopologyDeleteRequesAsString) + execution.setVariable(Prefix + "rollbackSDNCRequest", sndcTopologyDeleteRequesAsString) + utils.log("DEBUG", Prefix + "rollbackSDNCRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) + utils.log("DEBUG", " Preparing request for RPC SDNC Topology 'rollback-DisconnectNetworkRequest' rollback . . . - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) + + + } catch (Exception ex) { + // caught exception + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance, prepareSDNCRollback() - " + ex.getMessage() + logError(exceptionMessage) + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void setExceptionFlag(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside setExceptionFlag() of DoDeleteNetworkInstance ***** ", isDebugEnabled) + + try { + + execution.setVariable(Prefix + "isException", true) + + if (execution.getVariable("SavedWorkflowException1") != null) { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) + } else { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) + } + utils.log("DEBUG", Prefix + "WorkflowException - " +execution.getVariable(Prefix + "WorkflowException"), isDebugEnabled) + + } catch(Exception ex){ + String exceptionMessage = "Bpmn error encountered in DoDeleteNetworkInstance flow. setExceptionFlag(): " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + } + + } + + + // ******************************* + // Build Error Section + // ******************************* + + public void processJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + try{ + utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") + } + utils.log("DEBUG", "Completed processJavaException Method of " + Prefix, isDebugEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy new file mode 100644 index 0000000000..5863fdcb65 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy @@ -0,0 +1,335 @@ +/*- + * ============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 groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.NetworkUtils +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils + +/** + * This groovy class supports the DoCreateNetworkInstanceRollback.bpmn process. + * + */ +public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcessor { + String Prefix="DELNWKIR_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + NetworkUtils networkUtils = new NetworkUtils() + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + def className = getClass().getSimpleName() + + /** + * This method is executed during the preProcessRequest task of the DoDeleteNetworkInstanceRollback.bpmn process. + * @param execution + */ + public InitializeProcessVariables(Execution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable(Prefix + "WorkflowException", null) + + execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", null) + execution.setVariable(Prefix + "rollbackDeactivateSDNCResponse", "") + execution.setVariable(Prefix + "rollbackDeactivateSDNCReturnCode", "") + + execution.setVariable(Prefix + "rollbackSDNCRequest", "") + execution.setVariable(Prefix + "rollbackSDNCResponse", "") + execution.setVariable(Prefix + "rollbackSDNCReturnCode", "") + + execution.setVariable(Prefix + "rollbackNetworkRequest", null) + execution.setVariable(Prefix + "rollbackNetworkResponse", "") + execution.setVariable(Prefix + "rollbackNetworkReturnCode", "") + + execution.setVariable(Prefix + "Success", false) + execution.setVariable(Prefix + "fullRollback", false) + + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the DoDeleteNetworkInstanceRollback.bpmn process. + * @param execution + */ + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside preProcessRequest() of " + className + ".groovy ***** ", isDebugEnabled) + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + // GET Incoming request/variables + String rollbackDeactivateSDNCRequest = null + String rollbackSDNCRequest = null + String rollbackNetworkRequest = null + + Map rollbackData = execution.getVariable("rollbackData") + if (rollbackData != null && rollbackData instanceof Map) { + + if(rollbackData.containsKey("rollbackDeactivateSDNCRequest")) { + rollbackDeactivateSDNCRequest = rollbackData["rollbackDeactivateSDNCRequest"] + } + + if(rollbackData.containsKey("rollbackSDNCRequest")) { + rollbackSDNCRequest = rollbackData["rollbackSDNCRequest"] + } + + if(rollbackData.containsKey("rollbackNetworkRequest")) { + rollbackNetworkRequest = rollbackData["rollbackNetworkRequest"] + } + } + + execution.setVariable(Prefix + "rollbackNetworkRequest", rollbackNetworkRequest) + execution.setVariable(Prefix + "rollbackSDNCRequest", rollbackSDNCRequest) + execution.setVariable(Prefix + "rollbackDeactivateSDNCRequest", rollbackDeactivateSDNCRequest) + utils.log("DEBUG", "'rollbackData': " + '\n' + execution.getVariable("rollbackData"), isDebugEnabled) + + String sdncVersion = execution.getVariable("sdncVersion") + utils.log("DEBUG", "sdncVersion? : " + sdncVersion, isDebugEnabled) + + // PO Authorization Info / headers Authorization= + String basicAuthValuePO = execution.getVariable("URN_mso_adapters_po_auth") + utils.log("DEBUG", " Obtained BasicAuth userid password for PO/SDNC adapter: " + basicAuthValuePO, isDebugEnabled) + try { + def encodedString = utils.getBasicAuth(basicAuthValuePO, execution.getVariable("URN_mso_msoKey")) + execution.setVariable("BasicAuthHeaderValuePO",encodedString) + execution.setVariable("BasicAuthHeaderValueSDNC", encodedString) + + } catch (IOException ex) { + String exceptionMessage = "Exception Encountered in DoCreateNetworkInstance, PreProcessRequest() - " + String dataErrorMessage = exceptionMessage + " Unable to encode PO/SDNC user/password string - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage , isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + + if (execution.getVariable("SavedWorkflowException1") != null) { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("SavedWorkflowException1")) + } else { + execution.setVariable(Prefix + "WorkflowException", execution.getVariable("WorkflowException")) + } + utils.log("DEBUG", "*** WorkflowException : " + execution.getVariable(Prefix + "WorkflowException"), isDebugEnabled) + if(execution.getVariable(Prefix + "WorkflowException") != null) { + // called by: DoCreateNetworkInstance, partial rollback + execution.setVariable(Prefix + "fullRollback", false) + + } else { + // called by: Macro - Full Rollback, WorkflowException = null + execution.setVariable(Prefix + "fullRollback", true) + + } + + utils.log("DEBUG", "*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"), isDebugEnabled) + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + sendSyncError(execution) + // caught exception + String exceptionMessage = "Exception Encountered in PreProcessRequest() of " + className + ".groovy ***** : " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + public void validateRollbackResponses (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside validateRollbackResponses() of DoDeleteNetworkInstanceRollback ***** ", isDebugEnabled) + + try { + + // validate SDNC activate response + String rollbackDeactivateSDNCMessages = "" + String rollbackDeactivateSDNCReturnCode = "200" + if (execution.getVariable(Prefix + "rollbackDeactivateSDNCRequest") != null) { + rollbackDeactivateSDNCReturnCode = execution.getVariable(Prefix + "rollbackDeactivateSDNCReturnCode") + String rollbackDeactivateSDNCResponse = execution.getVariable(Prefix + "rollbackDeactivateSDNCResponse") + String rollbackDeactivateSDNCReturnInnerCode = "" + rollbackDeactivateSDNCResponse = sdncAdapterUtils.decodeXML(rollbackDeactivateSDNCResponse) + rollbackDeactivateSDNCResponse = rollbackDeactivateSDNCResponse.replace("&", "&").replace('$', '').replace('', "") + if (rollbackDeactivateSDNCReturnCode == "200") { + if (utils.nodeExists(rollbackDeactivateSDNCResponse, "response-code")) { + rollbackDeactivateSDNCReturnInnerCode = utils.getNodeText1(rollbackDeactivateSDNCResponse, "response-code") + if (rollbackDeactivateSDNCReturnInnerCode == "200" || rollbackDeactivateSDNCReturnInnerCode == "" || rollbackDeactivateSDNCReturnInnerCode == "0") { + rollbackDeactivateSDNCMessages = " + SNDC deactivate rollback completed." + } else { + rollbackDeactivateSDNCMessages = " + SDNC deactivate rollback failed. " + } + } else { + rollbackDeactivateSDNCMessages = " + SNDC deactivate rollback completed." + } + } else { + rollbackDeactivateSDNCMessages = " + SDNC deactivate rollback failed. " + } + utils.log("DEBUG", " SDNC deactivate rollback Code - " + rollbackDeactivateSDNCReturnCode, isDebugEnabled) + utils.log("DEBUG", " SDNC deactivate rollback Response - " + rollbackDeactivateSDNCResponse, isDebugEnabled) + } + + // validate SDNC rollback response + String rollbackSdncErrorMessages = "" + String rollbackSDNCReturnCode = "200" + if (execution.getVariable(Prefix + "rollbackSDNCRequest") != null) { + rollbackSDNCReturnCode = execution.getVariable(Prefix + "rollbackSDNCReturnCode") + String rollbackSDNCResponse = execution.getVariable(Prefix + "rollbackSDNCResponse") + String rollbackSDNCReturnInnerCode = "" + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + rollbackSDNCResponse = sdncAdapterUtils.decodeXML(rollbackSDNCResponse) + rollbackSDNCResponse = rollbackSDNCResponse.replace("&", "&").replace('$', '').replace('', "") + if (rollbackSDNCReturnCode == "200") { + if (utils.nodeExists(rollbackSDNCResponse, "response-code")) { + rollbackSDNCReturnInnerCode = utils.getNodeText1(rollbackSDNCResponse, "response-code") + if (rollbackSDNCReturnInnerCode == "200" || rollbackSDNCReturnInnerCode == "" || rollbackSDNCReturnInnerCode == "0") { + rollbackSdncErrorMessages = " + SNDC unassign rollback completed." + } else { + rollbackSdncErrorMessages = " + SDNC unassign rollback failed. " + } + } else { + rollbackSdncErrorMessages = " + SNDC unassign rollback completed." + } + } else { + rollbackSdncErrorMessages = " + SDNC unassign rollback failed. " + } + utils.log("DEBUG", " SDNC assign rollback Code - " + rollbackSDNCReturnCode, isDebugEnabled) + utils.log("DEBUG", " SDNC assign rollback Response - " + rollbackSDNCResponse, isDebugEnabled) + } + + // validate PO network rollback response + String rollbackNetworkErrorMessages = "" + String rollbackNetworkReturnCode = "200" + if (execution.getVariable(Prefix + "rollbackNetworkRequest") != null) { + rollbackNetworkReturnCode = execution.getVariable(Prefix + "rollbackNetworkReturnCode") + String rollbackNetworkResponse = execution.getVariable(Prefix + "rollbackNetworkResponse") + if (rollbackNetworkReturnCode != "200") { + rollbackNetworkErrorMessages = " + PO Network rollback failed. " + } else { + rollbackNetworkErrorMessages = " + PO Network rollback completed." + } + + utils.log("DEBUG", " NetworkRollback Code - " + rollbackNetworkReturnCode, isDebugEnabled) + utils.log("DEBUG", " NetworkRollback Response - " + rollbackNetworkResponse, isDebugEnabled) + } + + String statusMessage = "" + int errorCode = 7000 + utils.log("DEBUG", "*** fullRollback? : " + execution.getVariable(Prefix + "fullRollback"), isDebugEnabled) + if (execution.getVariable(Prefix + "fullRollback") == false) { + WorkflowException wfe = execution.getVariable(Prefix + "WorkflowException") // original WorkflowException + if (wfe != null) { + statusMessage = wfe.getErrorMessage() + errorCode = wfe.getErrorCode() + } else { + statusMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." + errorCode = '7000' + } + + // set if all rolledbacks are successful + if (rollbackDeactivateSDNCReturnCode == "200" && rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200") { + execution.setVariable("rolledBack", true) + execution.setVariable("wasDeleted", true) + + } else { + execution.setVariable("rolledBack", false) + execution.setVariable("wasDeleted", true) + } + + statusMessage = statusMessage + rollbackDeactivateSDNCMessages + rollbackNetworkErrorMessages + rollbackSdncErrorMessages + utils.log("DEBUG", "Final DoDeleteNetworkInstanceRollback status message: " + statusMessage, isDebugEnabled) + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, errorCode, statusMessage); + execution.setVariable("workflowException", exception); + + } else { + // rollback due to failures in Main flow (Macro or a-ala-carte) - Full rollback + if (rollbackDeactivateSDNCReturnCode == "200" && rollbackNetworkReturnCode == "200" && rollbackSDNCReturnCode == "200") { + execution.setVariable("rollbackSuccessful", true) + execution.setVariable("rollbackError", false) + } else { + String exceptionMessage = "Network Delete Rollback was not Successful. " + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + execution.setVariable("rollbackSuccessful", false) + execution.setVariable("rollbackError", true) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + throw new BpmnError("MSOWorkflowException") + } + } + + } catch (Exception ex) { + String errorMessage = "See Previous Camunda flows for cause of Error: Undetermined Exception." + String exceptionMessage = " Bpmn error encountered in DoDeleteNetworkInstanceRollback flow. validateRollbackResponses() - " + errorMessage + ": " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) + + } + + } + + // ******************************* + // Build Error Section + // ******************************* + + + + public void processJavaException(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + try{ + utils.log("DEBUG", "Caught a Java Exception in " + Prefix, isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + execution.setVariable("UnexpectedError", "Exception in processJavaException method - " + Prefix) // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method" + Prefix) + } + utils.log("DEBUG", "Completed processJavaException Method in " + Prefix, isDebugEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy new file mode 100644 index 0000000000..83fcd33443 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy @@ -0,0 +1,420 @@ +/*- + * ============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.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + +import java.util.UUID; +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.json.JSONObject; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource + +/** + * This groovy class supports the DoDeleteServiceInstance.bpmn process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId - O + * @param - subscriptionServiceType - O + * @param - serviceInstanceId + * @param - serviceInstanceName - O + * @param - serviceModelInfo - O + * @param - productFamilyId + * @param - sdncVersion + * @param - failNotFound - TODO + * @param - serviceInputParams - TODO + * + * Outputs: + * @param - WorkflowException + * + * Rollback - Deferred + */ +public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix="DDELSI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + + public void preProcessRequest (Execution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) + String msg = "" + + try { + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("prefix",Prefix) + + //Inputs + //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology + String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + if (globalSubscriberId == null) + { + execution.setVariable("globalSubscriberId", "") + } + + //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + if (subscriptionServiceType == null) + { + execution.setVariable("subscriptionServiceType", "") + } + + //Generated in parent for AAI PUT + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)){ + msg = "Input serviceInstanceId is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback') + if (isBlank(sdncCallbackUrl)) { + msg = "URN_mso_workflow_sdncadapter_callback is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void preProcessSDNCDelete (Execution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** preProcessSDNCDelete *****", isDebugEnabled) + String msg = "" + + try { + /* + String uuid = execution.getVariable('testReqId') // for junits + if(uuid==null){ + uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis() + } + */ + def serviceInstanceId = execution.getVariable("serviceInstanceId") + def serviceInstanceName = execution.getVariable("serviceInstanceName") + def callbackURL = execution.getVariable("sdncCallbackUrl") + def requestId = execution.getVariable("msoRequestId") + def serviceId = execution.getVariable("productFamilyId") + def subscriptionServiceType = execution.getVariable("subscriptionServiceType") + def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + + String serviceModelInfo = execution.getVariable("serviceModelInfo") + def modelInvariantId = "" + def modelVersion = "" + def modelUUId = "" + def modelName = "" + if (!isBlank(serviceModelInfo)) + { + modelInvariantId = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantId") + modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") + modelUUId = jsonUtil.getJsonValue(serviceModelInfo, "modelVersionId") + modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") + + if (modelInvariantId == null) { + modelInvariantId = "" + } + if (modelVersion == null) { + modelVersion = "" + } + if (modelUUId == null) { + modelUUId = "" + } + if (modelName == null) { + modelName = "" + } + } + if (serviceInstanceName == null) { + serviceInstanceName = "" + } + if (serviceId == null) { + serviceId = "" + } + + def sdncRequestId = UUID.randomUUID().toString() + + String sdncDelete = + """ + + ${sdncRequestId} + ${serviceInstanceId} + delete + service-topology-operation + ${callbackURL} + + + + ${requestId} + MSO + + + + DeleteServiceInstance + + + ${serviceId} + ${subscriptionServiceType} + + ${modelInvariantId} + ${modelUUId} + ${modelVersion} + ${modelName} + + ${serviceInstanceId} + + ${globalSubscriberId} + + + ${serviceInstanceName} + + + """ + + utils.log("DEBUG","sdncDelete:\n" + sdncDelete, isDebugEnabled) + sdncDelete = utils.formatXml(sdncDelete) + execution.setVariable("sdncDelete", sdncDelete) + utils.logAudit("sdncDelete: " + sdncDelete) + + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage()) + } + utils.log("DEBUG"," *****Exit preProcessSDNCDelete *****", isDebugEnabled) + } + + public void postProcessSDNCDelete(Execution execution) { + + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessSDNCDelete ***** ", isDebugEnabled) + String msg = "" + + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + String response = execution.getVariable("sdncAdapterResponse") + utils.logAudit("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + utils.log("DEBUG","Good response from SDNC Adapter for service-instance topology assign: \n" + response, isDebugEnabled) + + }else{ + msg = "Bad Response from SDNC Adapter for service-instance delete" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 3500, msg) + } + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in postProcessSDNCDelete. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage()) + } + utils.log("DEBUG"," *** Exit postProcessSDNCDelete *** ", isDebugEnabled) + } + + public void postProcessAAIGET(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessAAIGET ***** ", isDebugEnabled) + String msg = "" + + try { + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + + if(foundInAAI == true){ + utils.log("DEBUG","Found Service-instance in AAI", isDebugEnabled) + + //Extract GlobalSubscriberId + String siRelatedLink = execution.getVariable("GENGS_siResourceLink") + if (isBlank(siRelatedLink)) + { + msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + else + { + utils.log("DEBUG","Found Service-instance in AAI. link: " + siRelatedLink, isDebugEnabled) + String globalSubscriberId = execution.getVariable("globalSubscriberId") + if(isBlank(globalSubscriberId)){ + int custStart = siRelatedLink.indexOf("customer/") + int custEnd = siRelatedLink.indexOf("/service-subscriptions") + globalSubscriberId = siRelatedLink.substring(custStart + 9, custEnd) + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //Extract Service Type if not provided on request + String serviceType = execution.getVariable("subscriptionServiceType") + if(isBlank(serviceType)){ + int serviceStart = siRelatedLink.indexOf("service-subscription/") + int serviceEnd = siRelatedLink.indexOf("/service-instances/") + String serviceTypeEncoded = siRelatedLink.substring(serviceStart + 21, serviceEnd) + serviceType = UriUtils.decode(serviceTypeEncoded, "UTF-8") + execution.setVariable("subscriptionServiceType", serviceType) + } + + if (isBlank(globalSubscriberId) || isBlank(serviceType)) + { + msg = "Could not retrive global-customer-id & service-type from AAI to delete id:" + serviceInstanceId + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + } + + String siData = execution.getVariable("GENGS_service") + utils.log("DEBUG", "SI Data", isDebugEnabled) + if (isBlank(siData)) + { + msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + else + { + utils.log("DEBUG", "SI Data" + siData, isDebugEnabled) + //Confirm there are no related service instances (vnf/network or volume) + if (utils.nodeExists(siData, "relationship-list")) { + utils.log("DEBUG", "SI Data relationship-list exists:", isDebugEnabled) + InputSource source = new InputSource(new StringReader(siData)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document serviceXml = docBuilder.parse(source) + + NodeList nodeList = serviceXml.getElementsByTagName("relationship") + for (int x = 0; x < nodeList.getLength(); x++) { + Node node = nodeList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() + if(e.equals("generic-vnf") || e.equals("l3-network")){ + utils.log("DEBUG", "ServiceInstance still has relationship(s) to generic-vnfs or l3-networks", isDebugEnabled) + execution.setVariable("siInUse", true) + //there are relationship dependencies to this Service Instance + msg = " Stopped deleting Service Instance, it has dependencies. Service instance id: " + serviceInstanceId + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + }else{ + utils.log("DEBUG", "Relationship NOT related to OpenStack", isDebugEnabled) + } + } + } + } + } + }else{ + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(succInAAI != true){ + utils.log("DEBUG","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + utils.log("DEBUG","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoDeleteServiceInstance.postProcessAAIGET. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *** Exit postProcessAAIGET *** ", isDebugEnabled) + } + + public void postProcessAAIDEL(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessAAIDEL ***** ", isDebugEnabled) + String msg = "" + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator") + if(succInAAI != true){ + msg = "Error deleting Service-instance in AAI" + serviceInstanceId + utils.log("DEBUG", msg, isDebugEnabled) + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoDeleteServiceInstance.postProcessAAIDEL. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *** Exit postProcessAAIDEL *** ", isDebugEnabled) + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy new file mode 100644 index 0000000000..dcb70ff712 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy @@ -0,0 +1,599 @@ +/*- + * ============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 javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.common.scripts.VfModule +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.rest.APIResponse +import org.springframework.web.util.UriUtils +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.xml.sax.InputSource + + +/* Subflow for Delete VF Module. When no DoDeleteVfModuleRequest is specified on input, + * functions as a building block subflow + +* Inputs for building block interface: +* @param - requestId +* @param - isDebugLogEnabled +* @param - vnfId +* @param - vfModuleId +* @param - serviceInstanceId +* @param - vfModuleName O +* @param - vfModuleModelInfo +* @param - cloudConfiguration* +* @param - sdncVersion ("1610") +* +* Outputs: +* @param - WorkflowException +* +*/ +public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ + + def Prefix="DoDVfMod_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void initProcessVariables(Execution execution) { + execution.setVariable("prefix",Prefix) + execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", null) + execution.setVariable("DoDVfMod_oamManagementV4Address", null) + execution.setVariable("DoDVfMod_oamManagementV6Address", null) + + } + + // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids + // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest + public void preProcessRequest(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + initProcessVariables(execution) + + try { + def xml = execution.getVariable("DoDeleteVfModuleRequest") + String vnfId = "" + String vfModuleId = "" + + if (xml == null || xml.isEmpty()) { + // Building Block-type request + + // Set mso-request-id to request-id for VNF Adapter interface + String requestId = execution.getVariable("requestId") + execution.setVariable("mso-request-id", requestId) + + String cloudConfiguration = execution.getVariable("cloudConfiguration") + String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo") + String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId") + execution.setVariable("tenantId", tenantId) + String cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId") + execution.setVariable("cloudSiteId", cloudSiteId) + // Source is HARDCODED + String source = "VID" + execution.setVariable("source", source) + // SrvInstId is hardcoded to empty + execution.setVariable("srvInstId", "") + // ServiceId is hardcoded to empty + execution.setVariable("serviceId", "") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + vnfId = execution.getVariable("vnfId") + vfModuleId = execution.getVariable("vfModuleId") + if (serviceInstanceId == null || serviceInstanceId.isEmpty()) { + execution.setVariable(Prefix + "serviceInstanceIdToSdnc", vfModuleId) + } + else { + execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceId) + } + //vfModuleModelName + def vfModuleModelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName") + execution.setVariable("vfModuleModelName", vfModuleModelName) + + } + else { + + utils.logAudit("DoDeleteVfModule Request: " + xml) + + utils.log("DEBUG", "input request xml: " + xml, isDebugEnabled) + + vnfId = utils.getNodeText1(xml,"vnf-id") + execution.setVariable("vnfId", vnfId) + vfModuleId = utils.getNodeText1(xml,"vf-module-id") + execution.setVariable("vfModuleId", vfModuleId) + def srvInstId = execution.getVariable("mso-service-instance-id") + execution.setVariable("srvInstId", srvInstId) + String requestId = "" + try { + requestId = execution.getVariable("mso-request-id") + } catch (Exception ex) { + requestId = utils.getNodeText1(xml, "request-id") + } + execution.setVariable("requestId", requestId) + String source = utils.getNodeText1(xml, "source") + execution.setVariable("source", source) + String serviceId = utils.getNodeText1(xml, "service-id") + execution.setVariable("serviceId", serviceId) + String tenantId = utils.getNodeText1(xml, "tenant-id") + execution.setVariable("tenantId", tenantId) + + String serviceInstanceIdToSdnc = "" + if (xml.contains("service-instance-id")) { + serviceInstanceIdToSdnc = utils.getNodeText1(xml, "service-instance-id") + } else { + serviceInstanceIdToSdnc = vfModuleId + } + execution.setVariable(Prefix + "serviceInstanceIdToSdnc", serviceInstanceIdToSdnc) + String vfModuleName = utils.getNodeText1(xml, "vf-module-name") + execution.setVariable("vfModuleName", vfModuleName) + String vfModuleModelName = utils.getNodeText1(xml, "vf-module-model-name") + execution.setVariable("vfModuleModelName", vfModuleModelName) + String cloudSiteId = utils.getNodeText1(xml, "aic-cloud-region") + execution.setVariable("cloudSiteId", cloudSiteId) + } + + // formulate the request for PrepareUpdateAAIVfModule + String request = """ + ${vnfId} + ${vfModuleId} + pending-delete + """ as String + utils.log("DEBUG", "PrepareUpdateAAIVfModuleRequest :" + request, isDebugEnabled) + utils.logAudit("UpdateAAIVfModule Request: " + request) + execution.setVariable("PrepareUpdateAAIVfModuleRequest", request) + execution.setVariable("vfModuleFromAAI", null) + }catch(BpmnError b){ + throw b + }catch(Exception e){ + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in PreProcess method!") + } + } + + // build a SDNC vnf-topology-operation request for the specified action + // (note: the action passed is expected to be 'changedelete' or 'delete') + public void prepSDNCAdapterRequest(Execution execution, String action) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + def srvInstId = execution.getVariable("srvInstId") + def callbackUrl = execution.getVariable("URN_mso_workflow_sdncadapter_callback") + String requestId = execution.getVariable("requestId") + String source = execution.getVariable("source") + String serviceId = execution.getVariable("serviceId") + String vnfId = execution.getVariable("vnfId") + String tenantId = execution.getVariable("tenantId") + String vfModuleId = execution.getVariable("vfModuleId") + String serviceInstanceIdToSdnc = execution.getVariable(Prefix + "serviceInstanceIdToSdnc") + String vfModuleName = execution.getVariable("vfModuleName") + // Get vfModuleName from AAI response if it was not specified on the request + if (vfModuleName == null || vfModuleName.isEmpty()) { + if (execution.getVariable("vfModuleFromAAI") != null) { + VfModule vfModuleFromAAI = execution.getVariable("vfModuleFromAAI") + vfModuleName = vfModuleFromAAI.getElementText("vf-module-name") + } + } + String vfModuleModelName = execution.getVariable("vfModuleModelName") + String cloudSiteId = execution.getVariable("cloudSiteId") + String request = """ + + ${requestId} + ${vfModuleId} + ${action} + vnf-topology-operation + ${callbackUrl} + + + + ${requestId} + DisconnectVNFRequest + ${source} + + + + + + ${serviceId} + ${serviceId} + ${serviceInstanceIdToSdnc} + notsurewecare + + + ${vfModuleId} + ${vfModuleModelName} + ${vfModuleName} + ${vnfId} + + + ${cloudSiteId} + ${tenantId} + + + """ + + utils.log("DEBUG", "sdncAdapterWorkflowRequest: " + request, isDebugEnabled) + utils.logAudit("DoDeleteVfModule - SDNCAdapterWorkflowRequest: " + request) + execution.setVariable("sdncAdapterWorkflowRequest", request) + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing VnfAdapterDeleteV1 request + public void prepVNFAdapterRequest(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + def requestId = UUID.randomUUID().toString() + def origRequestId = execution.getVariable('requestId') + def srvInstId = execution.getVariable("serviceInstanceId") + def aicCloudRegion = execution.getVariable("cloudSiteId") + def vnfId = execution.getVariable("vnfId") + def vfModuleId = execution.getVariable("vfModuleId") + def vfModuleStackId = execution.getVariable('DoDVfMod_heatStackId') + def tenantId = execution.getVariable("tenantId") + def messageId = execution.getVariable('requestId') + '-' + + System.currentTimeMillis() + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + + String request = """ + + ${aicCloudRegion} + ${tenantId} + ${vnfId} + ${vfModuleId} + ${vfModuleStackId} + true + + ${origRequestId} + ${srvInstId} + + ${messageId} + ${notificationUrl} + + """ as String + + utils.log("DEBUG", "vnfAdapterRestV1Request: " + request, isDebugEnabled) + utils.logAudit("deleteVfModuleRequest: " + request) + execution.setVariable("vnfAdapterRestV1Request", request) + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing UpdateAAIVfModuleRequest request + public void prepUpdateAAIVfModule(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + def vnfId = execution.getVariable("vnfId") + def vfModuleId = execution.getVariable("vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """ + ${vnfId} + ${vfModuleId} + DELETE + deleted + """ as String + utils.log("DEBUG", "UpdateAAIVfModuleRequest :" + request, isDebugEnabled) + utils.logAudit("UpdateAAIVfModuleRequest: " + request) + execution.setVariable("UpdateAAIVfModuleRequest", request) + } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing DeleteAAIVfModuleRequest request + public void prepDeleteAAIVfModule(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + def vnfId = execution.getVariable("vnfId") + def vfModuleId = execution.getVariable("vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """ + ${vnfId} + ${vfModuleId} + """ as String + utils.log("DEBUG", "DeleteAAIVfModuleRequest :" + request, isDebugEnabled) + utils.logAudit("DeleteAAIVfModuleRequest: " + request) + execution.setVariable("DeleteAAIVfModuleRequest", request) + } + + // generates a WorkflowException if + // - + public void handleDoDeleteVfModuleFailure(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("ERROR", "AAI error occurred deleting the Generic Vnf: " + + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), isDebugEnabled) + String processKey = getProcessKey(execution); + WorkflowException exception = new WorkflowException(processKey, 5000, + execution.getVariable("DoDVfMod_deleteGenericVnfResponse")) + execution.setVariable("WorkflowException", exception) + } + + public void sdncValidateResponse(Execution execution, String response){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + + WorkflowException workflowException = execution.getVariable("WorkflowException") + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + utils.log("DEBUG", "Successfully Validated SDNC Response", isDebugEnabled) + }else{ + throw new BpmnError("MSOWorkflowException") + } + } + + public void postProcessVNFAdapterRequest(Execution execution) { + def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + execution.setVariable("prefix",Prefix) + try{ + logDebug(" *** STARTED postProcessVNFAdapterRequest Process*** ", isDebugLogEnabled) + + String vnfResponse = execution.getVariable("DoDVfMod_doDeleteVfModuleResponse") + logDebug("VNF Adapter Response is: " + vnfResponse, isDebugLogEnabled) + utils.logAudit("deleteVnfAResponse is: \n" + vnfResponse) + + if(vnfResponse != null){ + + if(vnfResponse.contains("deleteVfModuleResponse")){ + logDebug("Received a Good Response from VNF Adapter for DELETE_VF_MODULE Call.", isDebugLogEnabled) + execution.setVariable("DoDVfMod_vnfVfModuleDeleteCompleted", true) + + // Parse vnfOutputs for contrail network polcy FQDNs + if (vnfResponse.contains("vfModuleOutputs")) { + def vfModuleOutputsXml = utils.getNodeXml(vnfResponse, "vfModuleOutputs") + InputSource source = new InputSource(new StringReader(vfModuleOutputsXml)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + docFactory.setNamespaceAware(true) + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document outputsXml = docBuilder.parse(source) + + NodeList entries = outputsXml.getElementsByTagNameNS("*", "entry") + List contrailNetworkPolicyFqdnList = [] + for (int i = 0; i< entries.getLength(); i++) { + Node node = entries.item(i) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element element = (Element) node + String key = element.getElementsByTagNameNS("*", "key").item(0).getTextContent() + if (key.endsWith("contrail_network_policy_fqdn")) { + String contrailNetworkPolicyFqdn = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + logDebug("Obtained contrailNetworkPolicyFqdn: " + contrailNetworkPolicyFqdn, isDebugLogEnabled) + contrailNetworkPolicyFqdnList.add(contrailNetworkPolicyFqdn) + } + else if (key.equals("oam_management_v4_address")) { + String oamManagementV4Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + logDebug("Obtained oamManagementV4Address: " + oamManagementV4Address, isDebugLogEnabled) + execution.setVariable(Prefix + "oamManagementV4Address", oamManagementV4Address) + } + else if (key.equals("oam_management_v6_address")) { + String oamManagementV6Address = element.getElementsByTagNameNS("*", "value").item(0).getTextContent() + logDebug("Obtained oamManagementV6Address: " + oamManagementV6Address, isDebugLogEnabled) + execution.setVariable(Prefix + "oamManagementV6Address", oamManagementV6Address) + } + + } + } + if (!contrailNetworkPolicyFqdnList.isEmpty()) { + logDebug("Setting the fqdn list", isDebugLogEnabled) + execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", contrailNetworkPolicyFqdnList) + } + } + }else{ + logDebug("Received a BAD Response from VNF Adapter for DELETE_VF_MODULE Call.", isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "VNF Adapter Error") + } + }else{ + logDebug("Response from VNF Adapter is Null for DELETE_VF_MODULE Call.", isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Empty response from VNF Adapter") + } + + }catch(BpmnError b){ + throw b + }catch(Exception e){ + logDebug("Internal Error Occured in PostProcess Method", isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Internal Error Occured in PostProcess Method") + } + logDebug(" *** COMPLETED postProcessVnfAdapterResponse Process*** ", isDebugLogEnabled) + } + + public void deleteNetworkPoliciesFromAAI(Execution execution) { + def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + execution.setVariable("prefix", Prefix) + logDebug(" ======== STARTED deleteNetworkPoliciesFromAAI ======== ", isDebugLogEnabled) + + try { + // get variables + List fqdnList = execution.getVariable("DoDVfMod_contrailNetworkPolicyFqdnList") + if (fqdnList == null) { + logDebug("No network policies to delete", isDebugLogEnabled) + return + } + int fqdnCount = fqdnList.size() + + execution.setVariable("DoDVfMod_networkPolicyFqdnCount", fqdnCount) + logDebug("DoDVfMod_networkPolicyFqdnCount - " + fqdnCount, isDebugLogEnabled) + + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getNetworkPolicyUri(execution) + + if (fqdnCount > 0) { + // AII loop call over contrail network policy fqdn list + for (i in 0..fqdnCount-1) { + + int counting = i+1 + String fqdn = fqdnList[i] + + // Query AAI for this network policy FQDN + + String queryNetworkPolicyByFqdnAAIRequest = "${aai_endpoint}${aai_uri}?network-policy-fqdn=" + UriUtils.encode(fqdn, "UTF-8") + utils.logAudit("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest) + logDebug("AAI request endpoint: " + queryNetworkPolicyByFqdnAAIRequest, isDebugLogEnabled) + + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkPolicyByFqdnAAIRequest) + int returnCode = response.getStatusCode() + execution.setVariable("DCVFM_aaiQueryNetworkPolicyByFqdnReturnCode", returnCode) + logDebug(" ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode, isDebugLogEnabled) + + String aaiResponseAsString = response.getResponseBodyAsString() + + if (isOneOf(returnCode, 200, 201)) { + logDebug("The return code is: " + returnCode, isDebugLogEnabled) + // This network policy FQDN exists in AAI - need to delete it now + utils.logAudit(aaiResponseAsString) + execution.setVariable("DoDVfMod_queryNetworkPolicyByFqdnAAIResponse", aaiResponseAsString) + logDebug("QueryAAINetworkPolicyByFQDN Success REST Response, , NetworkPolicy #" + counting + " : " + "\n" + aaiResponseAsString, isDebugLogEnabled) + // Retrieve the network policy id for this FQDN + def networkPolicyId = utils.getNodeText1(aaiResponseAsString, "network-policy-id") + logDebug("Deleting network-policy with network-policy-id " + networkPolicyId, isDebugLogEnabled) + + // Retrieve the resource version for this network policy + def resourceVersion = utils.getNodeText1(aaiResponseAsString, "resource-version") + logDebug("Deleting network-policy with resource-version " + resourceVersion, isDebugLogEnabled) + + String delNetworkPolicyAAIRequest = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(networkPolicyId, "UTF-8") + + "?resource-version=" + UriUtils.encode(resourceVersion, "UTF-8") + utils.logAudit("AAI request endpoint: " + delNetworkPolicyAAIRequest) + logDebug("AAI request endpoint: " + delNetworkPolicyAAIRequest, isDebugLogEnabled) + + logDebug("invoking DELETE call to AAI", isDebugLogEnabled) + utils.logAudit("Sending DELETE call to AAI with Endpoint /n" + delNetworkPolicyAAIRequest) + APIResponse responseDel = aaiUriUtil.executeAAIDeleteCall(execution, delNetworkPolicyAAIRequest) + int returnCodeDel = responseDel.getStatusCode() + execution.setVariable("DoDVfMod_aaiDeleteNetworkPolicyReturnCode", returnCodeDel) + logDebug(" ***** AAI delete network policy Response Code, NetworkPolicy #" + counting + " : " + returnCodeDel, isDebugLogEnabled) + + if (isOneOf(returnCodeDel, 200, 201, 204)) { + logDebug("The return code from deleting network policy is: " + returnCodeDel, isDebugLogEnabled) + // This network policy was deleted from AAI successfully + logDebug(" DelAAINetworkPolicy Success REST Response, , NetworkPolicy #" + counting + " : ", isDebugLogEnabled) + + } else { + // aai all errors + String delErrorMessage = "Unable to delete network-policy to AAI deleteNetworkPoliciesFromAAI - " + returnCodeDel + logDebug(delErrorMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, delErrorMessage) + } + } else if (returnCode == 404) { + // This network policy FQDN is not in AAI. No need to delete. + logDebug("The return code is: " + returnCode, isDebugLogEnabled) + logDebug("This network policy FQDN is not in AAI: " + fqdn, isDebugLogEnabled) + utils.logAudit("Network policy FQDN is not in AAI") + } else { + if (aaiResponseAsString.contains("RESTFault")) { + WorkflowException exceptionObject = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", exceptionObject) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + String dataErrorMessage = "Unexpected Response from deleteNetworkPoliciesFromAAI - " + returnCode + logDebug(dataErrorMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } + } + + + + } // end loop + + + } else { + logDebug("No contrail network policies to query/create", isDebugLogEnabled) + + } + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in DoDeletVfModule flow. deleteNetworkPoliciesFromAAI() - " + ex.getMessage() + logDebug(exceptionMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + + } + + /** + * Prepare a Request for invoking the UpdateAAIGenericVnf subflow. + * + * @param execution The flow's execution instance. + */ + public void prepUpdateAAIGenericVnf(Execution execution) { + def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def vnfId = execution.getVariable('vnfId') + def oamManagementV4Address = execution.getVariable(Prefix + 'oamManagementV4Address') + def oamManagementV6Address = execution.getVariable(Prefix + 'oamManagementV6Address') + def ipv4OamAddressElement = '' + def managementV6AddressElement = '' + + if (oamManagementV4Address != null) { + ipv4OamAddressElement = '' + 'DELETE' + '' + } + + if (oamManagementV6Address != null) { + managementV6AddressElement = '' + 'DELETE' + '' + } + + + String updateAAIGenericVnfRequest = """ + + ${vnfId} + ${ipv4OamAddressElement} + ${managementV6AddressElement} + + """ + updateAAIGenericVnfRequest = utils.formatXml(updateAAIGenericVnfRequest) + execution.setVariable(Prefix + 'updateAAIGenericVnfRequest', updateAAIGenericVnfRequest) + utils.logAudit("updateAAIGenericVnfRequest : " + updateAAIGenericVnfRequest) + logDebug('Request for UpdateAAIGenericVnf:\n' + updateAAIGenericVnfRequest, isDebugLogEnabled) + + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) + } + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnf.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnf.groovy new file mode 100644 index 0000000000..fe98b709a5 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnf.groovy @@ -0,0 +1,136 @@ +/*- + * ============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 javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource + + +/** + * This class supports the DoDeleteVnf subFlow + * with the Deletion of a generic vnf for + * infrastructure. + * + */ +class DoDeleteVnf extends AbstractServiceTaskProcessor { + + String Prefix="DoDVNF_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils(this) + + /** + * This method gets and validates the incoming + * request. + * + * @param - execution + * + */ + public void preProcessRequest(Execution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + utils.log("DEBUG", " *** STARTED DoDeleteVnf PreProcessRequest Process*** ", isDebugEnabled) + + execution.setVariable("DoDVNF_SuccessIndicator", false) + execution.setVariable("DoDVNF_vnfInUse", false) + + try{ + // Get Variables + + String vnfId = execution.getVariable("vnfId") + execution.setVariable("DoDVNF_vnfId", vnfId) + utils.log("DEBUG", "Incoming Vnf(Instance) Id is: " + vnfId, isDebugEnabled) + + // Setting for sub flow calls + execution.setVariable("DoDVNF_type", "generic-vnf") + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("DEBUG", " Error Occured in DoDeleteVnf PreProcessRequest method!" + e, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoDeleteVnf PreProcessRequest") + + } + utils.log("DEBUG", "*** COMPLETED DoDeleteVnf PreProcessRequest Process ***", isDebugEnabled) + } + + + public void processGetVnfResponse(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + utils.log("DEBUG", " *** STARTED DoDeleteVnf processGetVnfResponse Process *** ", isDebugEnabled) + try { + String vnf = execution.getVariable("DoDVNF_genericVnf") + String resourceVersion = utils.getNodeText1(vnf, "resource-version") + execution.setVariable("DoDVNF_resourceVersion", resourceVersion) + + if(utils.nodeExists(vnf, "relationship")){ + InputSource source = new InputSource(new StringReader(vnf)); + DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder docBuilder = docFactory.newDocumentBuilder() + Document vnfXml = docBuilder.parse(source) + + NodeList nodeList = vnfXml.getElementsByTagName("relationship") + for (int x = 0; x < nodeList.getLength(); x++) { + Node node = nodeList.item(x) + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element eElement = (Element) node + def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() + if(e.equals("volume-group") || e.equals("l3-network")){ + utils.log("DEBUG", "Generic Vnf still has relationship to OpenStack.", isDebugEnabled) + execution.setVariable("DoDVNF_vnfInUse", true) + }else{ + utils.log("DEBUG", "Relationship NOT related to OpenStack", isDebugEnabled) + } + } + } + } + + if(utils.nodeExists(vnf, "vf-module")){ + execution.setVariable("DoDVNF_vnfInUse", true) + utils.log("DEBUG", "Generic Vnf still has vf-modules.", isDebugEnabled) + } + + + } catch (Exception ex) { + utils.log("DEBUG", "Error Occured in DoDeleteVnf processGetVnfResponse Process " + ex.getMessage(), isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoDeleteVnf processGetVnfResponse Process") + + } + utils.log("DEBUG", "*** COMPLETED DoDeleteVnf processGetVnfResponse Process ***", isDebugEnabled) + } + + + +} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoUpdateVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy similarity index 92% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoUpdateVfModule.groovy rename to bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy index 35600bcd10..7d6a21dc98 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/DoUpdateVfModule.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy @@ -18,23 +18,19 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts - -import groovy.util.Node -import groovy.xml.QName - -import java.io.Serializable; - -import org.springframework.web.util.UriUtils +package org.openecomp.mso.bpmn.infrastructure.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution - -import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.NetworkUtils +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.common.scripts.VfModule +import org.openecomp.mso.bpmn.common.scripts.VfModuleBase import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse +import org.springframework.web.util.UriUtils public class DoUpdateVfModule extends VfModuleBase { @@ -59,6 +55,7 @@ public class DoUpdateVfModule extends VfModuleBase { execution.setVariable('DOUPVfMod_vnfType', null) execution.setVariable('DOUPVfMod_asdcServiceModelVersion', null) execution.setVariable('DOUPVfMod_vfModuleModelName', null) + execution.setVariable('DOUPVfMod_modelCustomizationUuid', null) execution.setVariable("DOUPVfMod_isBaseVfModule", "false") execution.setVariable('DOUPVfMod_serviceId', null) execution.setVariable('DOUPVfMod_aicCloudRegion', null) @@ -69,6 +66,10 @@ public class DoUpdateVfModule extends VfModuleBase { execution.setVariable("DOUPVfMod_baseVfModuleId", "") execution.setVariable("DOUPVfMod_baseVfModuleHeatStackId", "") execution.setVariable('DOUPVfMod_prepareUpdateAAIVfModuleRequest', null) + execution.setVariable('DOUPVfMod_sdncChangeAssignRequest', null) + execution.setVariable('DOUPVfMod_sdncChangeAssignResponse', null) + execution.setVariable('DOUPVfMod_sdncActivateRequest', null) + execution.setVariable('DOUPVfMod_sdncActivateResponse', null) execution.setVariable('DOUPVfMod_sdncTopologyRequest', null) execution.setVariable('DOUPVfMod_sdncTopologyResponse', null) execution.setVariable('DOUPVfMod_vnfAdapterRestRequest', null) @@ -99,7 +100,7 @@ public class DoUpdateVfModule extends VfModuleBase { def requestInfo = getRequiredNodeXml(execution, xml, 'request-info') execution.setVariable('DOUPVfMod_requestInfo', requestInfo) execution.setVariable('DOUPVfMod_requestId', getRequiredNodeText(execution, requestInfo, 'request-id')) - def serviceInstanceId = execution.getVariable('att-mso-service-instance-id') + def serviceInstanceId = execution.getVariable('mso-service-instance-id') if (serviceInstanceId == null) { serviceInstanceId = '' } @@ -114,6 +115,7 @@ public class DoUpdateVfModule extends VfModuleBase { execution.setVariable('DOUPVfMod_vnfName', getNodeTextForce(vnfInputs, 'vnf-name')) execution.setVariable('DOUPVfMod_asdcServiceModelVersion', getNodeTextForce(vnfInputs, 'asdc-service-model-version')) execution.setVariable('DOUPVfMod_vfModuleModelName', getRequiredNodeText(execution, vnfInputs, 'vf-module-model-name')) + execution.setVariable('DOUPVfMod_modelCustomizationUuid', getNodeTextForce(vnfInputs, 'model-customization-id')) execution.setVariable('DOUPVfMod_serviceId', getRequiredNodeText(execution, vnfInputs, 'service-id')) execution.setVariable('DOUPVfMod_aicCloudRegion', getRequiredNodeText(execution, vnfInputs, 'aic-cloud-region')) execution.setVariable('DOUPVfMod_tenantId', getRequiredNodeText(execution, vnfInputs, 'tenant-id')) @@ -140,12 +142,6 @@ public class DoUpdateVfModule extends VfModuleBase { logError(msg) createWorkflowException(execution, 2000, msg) } - def vnfCallbackUrl = (String) execution.getVariable('URN_mso_workflow_vnfadapter_rest_callback') - if (vnfCallbackUrl == null || vnfCallbackUrl.trim().isEmpty()) { - def msg = 'Required variable \'URN_mso_workflow_vnfadapter_rest_callback\' is missing' - logError(msg) - createWorkflowException(execution, 2000, msg) - } logDebug('Exited ' + method, isDebugLogEnabled) } catch (BpmnError e) { @@ -256,8 +252,8 @@ public class DoUpdateVfModule extends VfModuleBase { String sdncTopologyRequest = """ + xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1" + xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> ${requestId} ${serviceInstanceId} @@ -294,8 +290,8 @@ public class DoUpdateVfModule extends VfModuleBase { """ sdncTopologyRequest = utils.formatXml(sdncTopologyRequest) - execution.setVariable('DOUPVfMod_sdncTopologyRequest', sdncTopologyRequest) - utils.logAudit("sdncTopologyRequest : " + sdncTopologyRequest) + execution.setVariable('DOUPVfMod_sdncChangeAssignRequest', sdncTopologyRequest) + utils.logAudit("sdncChangeAssignRequest : " + sdncTopologyRequest) logDebug('Request for SDNCAdapter topology/changeassign:\n' + sdncTopologyRequest, isDebugLogEnabled) logDebug('Exited ' + method, isDebugLogEnabled) @@ -339,8 +335,8 @@ public class DoUpdateVfModule extends VfModuleBase { String sdncTopologyRequest = """ + xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1" + xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> ${requestId} ${svcInstId} @@ -395,13 +391,14 @@ public class DoUpdateVfModule extends VfModuleBase { def baseVfModuleId = execution.getVariable("DOUPVfMod_baseVfModuleId") def baseVfModuleStackId = execution.getVariable("DOUPVfMod_baseVfModuleHeatStackId") def asdcServiceModelVersion = execution.getVariable('DOUPVfMod_asdcServiceModelVersion') + def modelCustomizationUuid = execution.getVariable('DOUPVfMod_modelCustomizationUuid') def backoutOnFailure = execution.getVariable("DOUPVfMod_backoutOnFailure") def vnfParamsXml = execution.getVariable('DOUPVfMod_vnfParams') def vfModuleParamsEntries = transformParamsToEntries(vnfParamsXml) - def messageId = execution.getVariable('att-mso-request-id') + '-' + System.currentTimeMillis() - def notificationUrl = execution.getVariable("URN_mso_workflow_vnfadapter_rest_callback") + def messageId = execution.getVariable('mso-request-id') + '-' + System.currentTimeMillis() + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") if ('true'.equals(useQualifiedHostName)) { notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) @@ -422,6 +419,7 @@ public class DoUpdateVfModule extends VfModuleBase { ${heatStackId} ${vnfType} ${asdcServiceModelVersion} + ${modelCustomizationUuid} ${vfModuleModelName} ${volumeGroupId} ${baseVfModuleId} @@ -540,6 +538,11 @@ public class DoUpdateVfModule extends VfModuleBase { if (contrailServiceInstanceFqdn != null) { contrailServiceInstanceFqdnElement = '' + contrailServiceInstanceFqdn + '' } + def personaModelCustomizationIdElement = '' + def modelCustomizationId = execution.getVariable('DOUPVfMod_modelCustomizationUuid') + if (modelCustomizationId != null) { + personaModelCustomizationIdElement = '' + modelCustomizationId + '' + } String updateAAIVfModuleRequest = """ @@ -550,6 +553,7 @@ public class DoUpdateVfModule extends VfModuleBase { ${personaModelIdElement} ${personaModelVersionElement} ${contrailServiceInstanceFqdnElement} + ${personaModelCustomizationIdElement} """ updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest) @@ -585,6 +589,8 @@ public class DoUpdateVfModule extends VfModuleBase { def callbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') def serviceId = execution.getVariable('DOUPVfMod_serviceId') def vnfId = execution.getVariable('DOUPVfMod_vnfId') + def vnfName = execution.getVariable('DOUPVfMod_vnfName') + def vnfType = execution.getVariable('DOUPVfMod_vnfType') def vfModuleId = execution.getVariable('DOUPVfMod_vfModuleId') def vfModuleModelName = execution.getVariable('DOUPVfMod_vfModuleModelName') def VfModule vfModule = (VfModule) execution.getVariable('DOUPVfMod_vfModule') @@ -597,8 +603,8 @@ public class DoUpdateVfModule extends VfModuleBase { String sdncTopologyRequest = """ + xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1" + xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> ${requestId} ${serviceInstanceId} @@ -624,16 +630,18 @@ public class DoUpdateVfModule extends VfModuleBase { ${vfModuleId} ${vfModuleModelName} ${vfModuleName} + ${vnfId} + ${vnfName} + ${vnfType} ${tenantId} - ${aicCloudRegion} - ${vnfNetworks} + ${aicCloudRegion} """ sdncTopologyRequest = utils.formatXml(sdncTopologyRequest) - execution.setVariable('DOUPVfMod_sdncTopologyRequest', sdncTopologyRequest) - utils.logAudit("sdncTopologyRequest : " + sdncTopologyRequest) + execution.setVariable('DOUPVfMod_sdncActivateRequest', sdncTopologyRequest) + utils.logAudit("sdncActivateRequest : " + sdncTopologyRequest) logDebug('Request for SDNCAdapter topology/activate:\n' + sdncTopologyRequest, isDebugLogEnabled) @@ -718,28 +726,16 @@ public class DoUpdateVfModule extends VfModuleBase { String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution) logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled) - String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1" utils.logAudit("AAI endPoint: " + endPoint) - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - try { - RESTConfig config = new RESTConfig(endPoint); - def responseData = '' def aaiRequestId = UUID.randomUUID().toString() - RESTClient client = new RESTClient(config). - addHeader('X-TransactionId', aaiRequestId). - addHeader('X-FromAppId', 'MSO'). - addHeader('Content-Type', 'application/xml'). - addHeader('Accept','application/xml'); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) - APIResponse response = client.httpGet() + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint) utils.logAudit("createVfModule - invoking httpGet() to AAI") - responseData = response.getResponseBodyAsString() + def responseData = response.getResponseBodyAsString() if (responseData != null) { logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled) diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/HealchCheckActivate.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/HealchCheckActivate.groovy similarity index 93% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/HealchCheckActivate.groovy rename to bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/HealchCheckActivate.groovy index 9f21faaa27..dd9f94d2f2 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/HealchCheckActivate.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/HealchCheckActivate.groovy @@ -18,10 +18,11 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts; +package org.openecomp.mso.bpmn.infrastructure.scripts; import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; import org.apache.commons.lang3.* public class HealthCheckActivate extends AbstractServiceTaskProcessor { diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/UpdateNetworkInstanceInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstanceInfra.groovy similarity index 92% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/UpdateNetworkInstanceInfra.groovy rename to bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstanceInfra.groovy index 77f4768c8c..a682c4d463 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/UpdateNetworkInstanceInfra.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstanceInfra.groovy @@ -18,16 +18,20 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts; +package org.openecomp.mso.bpmn.infrastructure.scripts; import groovy.xml.XmlUtil import groovy.json.* +import org.openecomp.mso.bpmn.common.scripts.AaiUtil; +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.bpmn.common.scripts.NetworkUtils; +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils; +import org.openecomp.mso.bpmn.common.scripts.VidUtils; import org.openecomp.mso.bpmn.core.WorkflowException import org.openecomp.mso.bpmn.core.json.JsonUtils; import org.openecomp.mso.rest.APIResponse -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig import java.util.UUID; @@ -186,10 +190,23 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { } catch (IOException ex) { String dataErrorMessage = " Unable to encode PO/SDNC user/password string - " + ex.getMessage() - utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + utils.log("DEBUG", dataErrorMessage, , isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) } + try { + // Catalog DB headers Authorization + String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth") + utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugEnabled) + + def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey")) + execution.setVariable("BasicAuthHeaderValueDB",encodedString) + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } + try { execution.setVariable("UPDNETI_UpdateNetworkInstanceInfraJsonRequest", updateNetworkJsonIncoming) @@ -213,7 +230,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { execution.setVariable("UPDNETI_networkOutputs", networkOutputs) utils.log("DEBUG", " networkOutputs - " + '\n' + networkOutputs, isDebugEnabled) - String requestId = execution.getVariable("att-mso-request-id") + String requestId = execution.getVariable("mso-request-id") if (requestId == null || requestId == "") { requestId = execution.getVariable("requestId") } @@ -292,7 +309,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { try { String serviceInstanceId = execution.getVariable("UPDNETI_serviceInstanceId") - String requestId = execution.getVariable("att-mso-request-id") + String requestId = execution.getVariable("mso-request-id") // RESTResponse (for API Handler (APIH) Reply Task) String updateNetworkRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() @@ -381,18 +398,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { execution.setVariable("UPDNETI_queryIdAAIRequest", queryIdAAIRequest) utils.log("DEBUG", " UPDNETI_queryIdAAIRequest - " + "\n" + queryIdAAIRequest, isDebugEnabled) - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(queryIdAAIRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - - APIResponse response = client.get() + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryIdAAIRequest) String returnCode = response.getStatusCode() execution.setVariable("UPDNETI_aaiIdReturnCode", returnCode) @@ -460,18 +466,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { execution.setVariable("UPDNETI_requeryIdAAIRequest", requeryIdAAIRequest) utils.log("DEBUG", " UPDNETI_requeryIdAAIRequest - " + "\n" + requeryIdAAIRequest, isDebugEnabled) - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(requeryIdAAIRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - - APIResponse response = client.get() + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, requeryIdAAIRequest) String returnCode = response.getStatusCode() execution.setVariable("UPDNETI_aaiRequeryIdReturnCode", returnCode) utils.log("DEBUG", " ***** AAI ReQuery Response Code : " + returnCode, isDebugEnabled) @@ -587,18 +582,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { execution.setVariable("UPDNETI_queryVpnBindingAAIRequest", queryVpnBindingAAIRequest) utils.log("DEBUG", " UPDNETI_queryVpnBindingAAIRequest, , vpnBinding #" + counting + " : " + "\n" + queryVpnBindingAAIRequest, isDebugEnabled) - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(queryVpnBindingAAIRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - - APIResponse response = client.get() + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryVpnBindingAAIRequest) String returnCode = response.getStatusCode() execution.setVariable("UPDNETI_aaiQqueryVpnBindingReturnCode", returnCode) utils.log("DEBUG", " ***** AAI query vpn binding Response Code, vpnBinding #" + counting + " : " + returnCode, isDebugEnabled) @@ -735,18 +719,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { execution.setVariable("UPDNETI_queryNetworkPolicyAAIRequest", queryNetworkPolicyAAIRequest) utils.log("DEBUG", " UPDNETI_queryNetworkPolicyAAIRequest, , NetworkPolicy #" + counting + " : " + "\n" + queryNetworkPolicyAAIRequest, isDebugEnabled) - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(queryNetworkPolicyAAIRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - - APIResponse response = client.get() + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkPolicyAAIRequest) String returnCode = response.getStatusCode() execution.setVariable("UPDNETI_aaiQqueryNetworkPolicyReturnCode", returnCode) utils.log("DEBUG", " ***** AAI query network policy Response Code, NetworkPolicy #" + counting + " : " + returnCode, isDebugEnabled) @@ -883,18 +856,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { execution.setVariable("UPDNETI_queryNetworkTableRefAAIRequest", queryNetworkTableRefAAIRequest) utils.log("DEBUG", " UPDNETI_queryNetworkTableRefAAIRequest, , NetworkTableRef #" + counting + " : " + "\n" + queryNetworkTableRefAAIRequest, isDebugEnabled) - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(queryNetworkTableRefAAIRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - - APIResponse response = client.get() + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, queryNetworkTableRefAAIRequest) String returnCode = response.getStatusCode() execution.setVariable("UPDNETI_aaiQqueryNetworkTableRefReturnCode", returnCode) utils.log("DEBUG", " ***** AAI query network Table Reference Response Code, NetworkTableRef #" + counting + " : " + returnCode, isDebugEnabled) @@ -1001,18 +963,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { execution.setVariable("UPDNETI_updateContrailAAIPayloadRequest", payloadXml) utils.log("DEBUG", " 'payload' to Update Contrail - " + "\n" + payloadXml, isDebugEnabled) - String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey")) - - RESTConfig config = new RESTConfig(updateContrailAAIUrlRequest); - RESTClient client = new RESTClient(config).addHeader("X-TransactionId", messageId) - .addHeader("X-FromAppId", "MSO") - .addHeader("Content-Type", "application/xml") - .addHeader("Accept","application/xml"); - if (basicAuthCred != null && !"".equals(basicAuthCred)) { - client.addAuthorizationHeader(basicAuthCred) - } - - APIResponse response = client.httpPut(payload) + APIResponse response = aaiUriUtil.executeAAIPutCall(execution, updateContrailAAIUrlRequest, payload) String returnCode = response.getStatusCode() execution.setVariable("UPDNETI_aaiUpdateContrailReturnCode", returnCode) @@ -1121,7 +1072,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { String serviceInstanceId = utils.getNodeText1(updateNetworkInput, "service-instance-id") // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, updateNetworkInput, serviceInstanceId, sdncCallback, "changeassign", "NetworkActivateRequest", cloudRegionId, networkId, null) + String sndcTopologyCreateRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, updateNetworkInput, serviceInstanceId, sdncCallback, "changeassign", "NetworkActivateRequest", cloudRegionId, networkId, null, null) String sndcTopologyUpdateRequesAsString = utils.formatXml(sndcTopologyCreateRequest) utils.logAudit(sndcTopologyUpdateRequesAsString) @@ -1170,7 +1121,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { """ - + ${requestId} BPMN ${statusMessage} @@ -1239,7 +1190,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { """ - + ${requestId} BPMN ${statusMessage} @@ -1257,7 +1208,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in UpdateNetworkInstanceInfra flow. prepareDBRequestError() - " + ex.getMessage() utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -1293,7 +1244,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { // prepare rollback data String rollbackData = utils.getNodeXml(networkResponse, "rollback", false).replace("tag0:","").replace(":tag0","") String rollbackNetwork = - """ + """ ${rollbackData} """ String rollbackNetworkXml = utils.formatXml(rollbackNetwork) @@ -1394,9 +1345,9 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { String requestId = execution.getVariable("UPDNETI_requestId") String msoCompletionRequest = - """ - + """ + ${requestId} UPDATE ${source} @@ -1454,7 +1405,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { String serviceInstanceId = utils.getNodeText1(updateNetworkInput, "service-instance-id") // 2. prepare rollback topology via SDNC Adapter SUBFLOW call - String sndcTopologyRollbackRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, updateNetworkInput, serviceInstanceId, sdncCallback, "rollback", "NetworkActivateRequest", cloudRegionId, networkId, null) + String sndcTopologyRollbackRequest = sdncAdapterUtils.sdncTopologyRequestV2(execution, updateNetworkInput, serviceInstanceId, sdncCallback, "rollback", "NetworkActivateRequest", cloudRegionId, networkId, null, null) String sndcTopologyRollbackRequestAsString = utils.formatXml(sndcTopologyRollbackRequest) execution.setVariable("UPDNETI_rollbackSDNCRequest", sndcTopologyRollbackRequestAsString) utils.log("DEBUG", " Preparing request for SDNC Topology assign's rollback/compensation . . . - " + "\n" + sndcTopologyRollbackRequestAsString, isDebugEnabled) @@ -1463,7 +1414,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in UpdateNetworkInstanceInfra flow. prepareSDNCRollbackRequest() - " + ex.getMessage() utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + exceptionUtil.buildWorkflowException(execution, 7000, exceptionMessage) } @@ -1577,15 +1528,15 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { String errorCode = String.valueOf(wfe.getErrorCode()) String errorMessage = wfe.getErrorMessage() falloutHandlerRequest = - """ - + """ + ${requestId} UPDATE ${source} - + ${errorMessage} ${errorCode} @@ -1599,15 +1550,15 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { String errorException = " Bpmn error encountered in UpdateNetworkInstanceInfra flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() utils.log("DEBUG", errorException, isDebugEnabled) falloutHandlerRequest = - """ - + """ + ${requestId} UPDATE ${source} - + ${errorException} 7000 @@ -1627,7 +1578,7 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { try { - String requestId = execution.getVariable("att-mso-request-id") + String requestId = execution.getVariable("mso-request-id") // REST Error (for API Handler (APIH) Reply Task) String syncError = """{"requestReferences":{"instanceId":"","requestId":"${requestId}"}}""".trim() @@ -1649,14 +1600,12 @@ public class UpdateNetworkInstanceInfra extends AbstractServiceTaskProcessor { utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) execution.setVariable("UnexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") - }catch(BpmnError b){ - utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception") + }catch(Exception e){ utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) execution.setVariable("UnexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") } utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModule.groovy new file mode 100644 index 0000000000..8f2eb27b91 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModule.groovy @@ -0,0 +1,329 @@ +/*- + * ============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 groovy.util.Node +import groovy.util.XmlParser; +import groovy.xml.QName + +import java.io.Serializable; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution + +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils; +import org.openecomp.mso.rest.APIResponse +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.core.RollbackData + + +public class UpdateVfModule extends AbstractServiceTaskProcessor { + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(Execution execution) { + execution.setVariable('prefix', 'UPDVfMod_') + execution.setVariable('UPDVfMod_Request', null) + execution.setVariable('UPDVfMod_requestInfo', null) + execution.setVariable('UPDVfMod_requestId', null) + execution.setVariable('UPDVfMod_source', null) + execution.setVariable('UPDVfMod_vnfInputs', null) + execution.setVariable('UPDVfMod_vnfId', null) + execution.setVariable('UPDVfMod_vfModuleId', null) + execution.setVariable('UPDVfMod_tenantId', null) + execution.setVariable('UPDVfMod_volumeGroupId', null) + execution.setVariable('UPDVfMod_vnfParams', null) + execution.setVariable('UPDVfMod_updateInfraRequest', null) + execution.setVariable('UpdateVfModuleSuccessIndicator', false) + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(Execution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + initProcessVariables(execution) + String request = validateRequest(execution) + + utils.logAudit("UpdateVfModule request: " + request) + def requestInfo = getRequiredNodeXml(execution, request, 'request-info') + execution.setVariable('UPDVfMod_requestInfo', requestInfo) + execution.setVariable('UPDVfMod_requestId', getRequiredNodeText(execution, requestInfo, 'request-id')) + execution.setVariable('UPDVfMod_source', getNodeTextForce(requestInfo, 'source')) + + def vnfInputs = getRequiredNodeXml(execution, request, 'vnf-inputs') + execution.setVariable('UPDVfMod_vnfInputs', vnfInputs) + execution.setVariable('UPDVfMod_vnfId', getRequiredNodeText(execution, vnfInputs, 'vnf-id')) + execution.setVariable('UPDVfMod_vfModuleId', getRequiredNodeText(execution, vnfInputs, 'vf-module-id')) + execution.setVariable('UPDVfMod_tenantId', getRequiredNodeText(execution, vnfInputs, 'tenant-id')) + execution.setVariable('UPDVfMod_volumeGroupId', getNodeTextForce(vnfInputs, 'volume-group-id')) + + def vnfParams = utils.getNodeXml(request, 'vnf-params') + execution.setVariable('UPDVfMod_vnfParams', vnfParams) + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) + } + } + + /** + * Prepare and send the synchronous response for this flow. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(Execution execution) { + def method = getClass().getSimpleName() + '.sendSynchResponse(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def requestInfo = execution.getVariable('UPDVfMod_requestInfo') + def requestId = execution.getVariable('UPDVfMod_requestId') + def source = execution.getVariable('UPDVfMod_source') + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + def vnfInputs = execution.getVariable('UPDVfMod_vnfInputs') + + String synchResponse = """ + + + ${requestId} + UPDATE_VF_MODULE + IN_PROGRESS + ${progress} + ${startTime} + ${source} + + ${vnfInputs} + + """ + + synchResponse = utils.formatXml(synchResponse) + sendWorkflowResponse(execution, 200, synchResponse) + + utils.logAudit("UpdateVfModule Synch Response: " + synchResponse) + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage()) + } + } + + /** + * Prepare the Request for invoking the DoUpdateVfModule subflow. + * + * NOTE: Currently, the method just logs passing through as the + * incoming Request to this main flow is used as the Request to + * the DoUpdateVfModule subflow. No preparation processing is + * necessary. + * + * @param execution The flow's execution instance. + */ + public void prepDoUpdateVfModule(Execution execution) { + def method = getClass().getSimpleName() + '.prepDoUpdateVfModule(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 1002, 'Error in prepDoUpdateVfModule(): ' + e.getMessage()) + } + } + + /** + * Prepare the Request for updating the DB for this Infra Request. + * + * @param execution The flow's execution instance. + */ + public void prepUpdateInfraRequest(Execution execution) { + def method = getClass().getSimpleName() + '.prepUpdateInfraRequest(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def requestId = execution.getVariable('UPDVfMod_requestId') + def vnfId = execution.getVariable('UPDVfMod_vnfId') + def vfModuleId = execution.getVariable('UPDVfMod_vfModuleId') + def tenantId = execution.getVariable('UPDVfMod_tenantId') + def volumeGroupId = execution.getVariable('UPDVfMod_volumeGroupId') + + String updateInfraRequest = """ + + + + + ${requestId} + BPEL + COMPLETE + 100 + + ${vnfId} + ${vfModuleId} + ${tenantId} + ${volumeGroupId} + + + + + """ + + updateInfraRequest = utils.formatXml(updateInfraRequest) + execution.setVariable('UPDVfMod_updateInfraRequest', updateInfraRequest) + logDebug('Request for Update Infra Request:\n' + updateInfraRequest, isDebugLogEnabled) + + utils.logAudit("UpdateVfModule Infra Request: " + updateInfraRequest) + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 1002, 'Error in prepUpdateInfraRequest(): ' + e.getMessage()) + } + } + + /** + * Builds a "CompletionHandler" request and stores it in the specified execution variable. + * + * @param execution the execution + * @param resultVar the execution variable in which the result will be stored + */ + public void completionHandlerPrep(Execution execution, String resultVar) { + def method = getClass().getSimpleName() + '.completionHandlerPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def requestInfo = getVariable(execution, 'UPDVfMod_requestInfo') + + String content = """ + + ${requestInfo} + MSO_ACTIVATE_BPEL + + """ + + content = utils.formatXml(content) + logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) + execution.setVariable(resultVar, content) + + utils.logAudit("UpdateVfModule CompletionHandler Request: " + content) + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 2000, 'Internal Error') + } + } + + /** + * Builds a "FalloutHandler" request and stores it in the specified execution variable. + * + * @param execution the execution + * @param resultVar the execution variable in which the result will be stored + */ + public void falloutHandlerPrep(Execution execution, String resultVar) { + def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def prefix = execution.getVariable('prefix') + def request = getVariable(execution, prefix+'Request') + def requestInformation = utils.getNodeXml(request, 'request-information', false) + + def WorkflowException workflowException = execution.getVariable("WorkflowException") + def errorResponseCode = workflowException.getErrorCode() + def errorResponseMsg = workflowException.getErrorMessage() + def encErrorResponseMsg = "" + if (errorResponseMsg != null) { + encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">") + } + + String content = """ + + ${requestInformation} + + ${encErrorResponseMsg} + ${errorResponseCode} + + + """ + content = utils.formatXml(content) + logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) + execution.setVariable(resultVar, content) + + utils.logAudit("UpdateVfModule fallOutHandler Request: " + content) + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 2000, 'Internal Error') + } + } +} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/UpdateVfModuleInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy similarity index 94% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/UpdateVfModuleInfra.groovy rename to bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy index 57c5269a68..8d05f41774 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/UpdateVfModuleInfra.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.infrastructure.scripts import groovy.json.JsonSlurper import groovy.util.Node @@ -29,10 +29,11 @@ import java.io.Serializable; import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution - import org.openecomp.mso.rest.APIResponse import org.openecomp.mso.rest.RESTClient import org.openecomp.mso.rest.RESTConfig +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.openecomp.mso.bpmn.common.scripts.VidUtils; import org.openecomp.mso.bpmn.core.RollbackData import org.openecomp.mso.bpmn.core.WorkflowException @@ -232,7 +233,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { String updateInfraRequest = """ + xmlns:req="http://org.openecomp.mso/requestsdb"> @@ -282,8 +283,8 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { def requestInfo = getVariable(execution, 'UPDVfModI_requestInfo') String content = """ - + ${requestInfo} MSO_ACTIVATE_BPEL @@ -330,10 +331,10 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { } String content = """ - + ${requestInformation} ${encErrorResponseMsg} @@ -396,18 +397,18 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { /* - def requestId = execution.getVariable("att-mso-request-id") + def requestId = execution.getVariable("mso-request-id") if (requestId == null) { - createWorkflowException(execution, 1002, processKey + " request has no att-mso-request-id") + createWorkflowException(execution, 1002, processKey + " request has no mso-request-id") } setVariable(execution, prefix + 'requestId', requestId) - def serviceInstanceId = execution.getVariable("att-mso-service-instance-id") + def serviceInstanceId = execution.getVariable("mso-service-instance-id") if (serviceInstanceId == null) { - createWorkflowException(execution, 1002, processKey + " request message has no att-mso-service-instance-id") + createWorkflowException(execution, 1002, processKey + " request message has no mso-service-instance-id") } utils.logContext(requestId, serviceInstanceId) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy new file mode 100644 index 0000000000..996fd56e0d --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy @@ -0,0 +1,440 @@ +/*- + * ============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 java.util.concurrent.ExecutionException; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.springframework.web.util.UriUtils +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.VfModuleBase +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils; +import org.openecomp.mso.rest.APIResponse + +class UpdateVfModuleVolume extends VfModuleBase { + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + private void initProcessVariables(Execution execution) { + execution.setVariable('prefix', 'UPDVfModVol_') + execution.setVariable('UPDVfModVol_Request', null) + execution.setVariable('UPDVfModVol_requestInfo', null) + execution.setVariable('UPDVfModVol_requestId', null) + execution.setVariable('UPDVfModVol_source', null) + execution.setVariable('UPDVfModVol_volumeInputs', null) + execution.setVariable('UPDVfModVol_volumeGroupId', null) + execution.setVariable('UPDVfModVol_vnfType', null) + execution.setVariable('UPDVfModVol_serviceId', null) + execution.setVariable('UPDVfModVol_aicCloudRegion', null) + execution.setVariable('UPDVfModVol_tenantId', null) + execution.setVariable('UPDVfModVol_volumeParams', null) + execution.setVariable('UPDVfModVol_volumeGroupHeatStackId', null) + execution.setVariable('UPDVfModVol_volumeGroupTenantId', null) + execution.setVariable('UpdateVfModuleVolumeSuccessIndicator', false) + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + @Override + public void preProcessRequest(Execution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + initProcessVariables(execution) + String request = validateRequest(execution) + + def requestInfo = getRequiredNodeXml(execution, request, 'request-info') + execution.setVariable('UPDVfModVol_requestInfo', requestInfo) + execution.setVariable('UPDVfModVol_requestId', getRequiredNodeText(execution, requestInfo, 'request-id')) + execution.setVariable('UPDVfModVol_source', getNodeTextForce(requestInfo, 'source')) + + def volumeInputs = getRequiredNodeXml(execution, request, 'volume-inputs') + execution.setVariable('UPDVfModVol_volumeInputs', volumeInputs) + execution.setVariable('UPDVfModVol_volumeGroupId', getRequiredNodeText(execution, volumeInputs, 'volume-group-id')) + execution.setVariable('UPDVfModVol_vnfType', getRequiredNodeText(execution, volumeInputs, 'vnf-type')) + execution.setVariable('UPDVfModVol_serviceId', getRequiredNodeText(execution, volumeInputs, 'service-id')) + execution.setVariable('UPDVfModVol_aicCloudRegion', getRequiredNodeText(execution, volumeInputs, 'aic-cloud-region')) + execution.setVariable('UPDVfModVol_tenantId', getRequiredNodeText(execution, volumeInputs, 'tenant-id')) + + def volumeParams = utils.getNodeXml(request, 'volume-params') + execution.setVariable('UPDVfModVol_volumeParams', volumeParams) + + logDebug('Exited ' + method, isDebugLogEnabled) + utils.logAudit("UpdateVfModuleVolume request: " + request) + } catch (BpmnError bpmnError) { + throw bpmnError + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage()) + } + } + + /** + * Prepare and send the synchronous response. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(Execution execution) { + def method = getClass().getSimpleName() + '.sendSynchResponse(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def requestInfo = execution.getVariable('UPDVfModVol_requestInfo') + def requestId = execution.getVariable('UPDVfModVol_requestId') + def source = execution.getVariable('UPDVfModVol_source') + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + def volumeInputs = execution.getVariable('UPDVfModVol_volumeInputs') + + String synchResponse = """ + + + ${requestId} + UPDATE_VF_MODULE_VOL + IN_PROGRESS + ${progress} + ${startTime} + ${source} + + ${volumeInputs} + + """ + + synchResponse = utils.formatXml(synchResponse) + sendWorkflowResponse(execution, 200, synchResponse) + utils.logAudit("UpdateVfModuleVolume Synch Response: " + synchResponse) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 1002, 'Error in sendSynchResponse(): ' + e.getMessage()) + } + } + + /** + * Prepare a Request for querying AAI for Volume Group information using the + * Volume Group Id and Aic Cloud Region. + * + * @param execution The flow's execution instance. + */ + public void queryAAIForVolumeGroup(Execution execution) { + def method = getClass().getSimpleName() + '.queryAAIForVolumeGroup(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') + def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') + def endPoint = execution.getVariable('URN_aai_endpoint') + + '/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/att-aic/' + UriUtils.encode(aicCloudRegion, "UTF-8") + + '/volume-groups/volume-group/' + UriUtils.encode(volumeGroupId, "UTF-8") + + logDebug('Sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled) + utils.logAudit("UpdateVfModuleVolume sending GET for quering AAI endpoint: " + endPoint) + + AaiUtil aaiUtil = new AaiUtil(this) + APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint) + def int statusCode = response.getStatusCode() + def responseData = response.getResponseBodyAsString() + logDebug('Response code:' + statusCode, isDebugLogEnabled) + logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) + utils.logAudit("UpdateVfModuleVolume response data: " + responseData) + + def volumeGroup = responseData + def heatStackId = getNodeTextForce(volumeGroup, 'heat-stack-id') + execution.setVariable('UPDVfModVol_volumeGroupHeatStackId', heatStackId) + if ((statusCode == 200) || (statusCode == 204)) { + def volumeGroupTenantId = getTenantIdFromVolumeGroup(volumeGroup) + if (volumeGroupTenantId == null) { + throw new Exception('Could not find Tenant Id element in Volume Group with Volume Group Id \'' + volumeGroupId + '\'' + + '\', AIC Cloud Region \'' + aicCloudRegion + '\'') + } + execution.setVariable('UPDVfModVol_volumeGroupTenantId', volumeGroupTenantId) + logDebug('Received Tenant Id \'' + volumeGroupTenantId + '\' from AAI for Volume Group with Volume Group Id \'' + volumeGroupId + '\'' + + '\', AIC Cloud Region \'' + aicCloudRegion + '\'', isDebugLogEnabled) + } else if (statusCode == 404) { + throw new Exception('Volume Group \'' + volumeGroupId + '\' not found at AAI') + } else { + throw new Exception('Bad status code ' + statusCode + ' received from AAI; Response data: ' + responseData) + } + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 1002, 'Error in queryAAIForVolumeGroup(): ' + e.getMessage()) + } + } + + /** + * Prepare a Request for invoking the VnfAdapterRest subflow to do + * a Volume Group update. + * + * @param execution The flow's execution instance. + */ + public void prepVnfAdapterRest(Execution execution) { + def method = getClass().getSimpleName() + '.prepVnfAdapterRest(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') + def tenantId = execution.getVariable('UPDVfModVol_tenantId') + def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') + def volumeGroupHeatStackId = execution.getVariable('UPDVfModVol_volumeGroupHeatStackId') + def vnfType = execution.getVariable('UPDVfModVol_vnfType') + + def volumeParamsXml = execution.getVariable('UPDVfModVol_volumeParams') + def volumeGroupParams = transformParamsToEntries(volumeParamsXml) + + def requestId = execution.getVariable('UPDVfModVol_requestId') + def serviceId = execution.getVariable('UPDVfModVol_serviceId') + + def messageId = execution.getVariable('mso-request-id') + '-' + System.currentTimeMillis() + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) + def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") + if ('true'.equals(useQualifiedHostName)) { + notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) + } + + String vnfAdapterRestRequest = """ + + ${aicCloudRegion} + ${tenantId} + ${volumeGroupId} + ${volumeGroupHeatStackId} + ${vnfType} + + + + ${volumeGroupParams} + + true + + ${requestId} + ${serviceId} + + ${messageId} + ${notificationUrl} + + """ + vnfAdapterRestRequest = utils.formatXml(vnfAdapterRestRequest) + execution.setVariable('UPDVfModVol_vnfAdapterRestRequest', vnfAdapterRestRequest) + logDebug('Request for VNFAdapter Rest:\n' + vnfAdapterRestRequest, isDebugLogEnabled) + + utils.logAudit("UpdateVfModuleVolume Request for VNFAdapter Rest: " + vnfAdapterRestRequest) + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 1002, 'Error in prepVnfAdapterRest(): ' + e.getMessage()) + } + } + + /** + * Prepare a Request for updating the DB for this Infra request. + * + * @param execution The flow's execution instance. + */ + public void prepDbInfraDbRequest(Execution execution) { + def method = getClass().getSimpleName() + '.prepDbInfraDbRequest(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def requestId = execution.getVariable('UPDVfMod_requestId') + + String updateInfraRequest = """ + + + + + ${requestId} + BPEL + COMPLETE + 100 + + + + """ + + updateInfraRequest = utils.formatXml(updateInfraRequest) + execution.setVariable('UPDVfModVol_updateInfraRequest', updateInfraRequest) + logDebug('Request for Update Infra Request:\n' + updateInfraRequest, isDebugLogEnabled) + + utils.logAudit("UpdateVfModuleVolume Request for Updating DB for Infra: " + updateInfraRequest) + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 1002, 'Error in prepDbInfraDbRequest(): ' + e.getMessage()) + } + } + + /** + * Build a "CompletionHandler" request. + * + * @param execution The flow's execution instance. + */ + public void prepCompletionHandlerRequest(Execution execution) { + def method = getClass().getSimpleName() + '.prepCompletionHandlerRequest(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def requestInfo = execution.getVariable('UPDVfModVol_requestInfo') + + String content = """ + + ${requestInfo} + MSO_ACTIVATE_BPEL + + """ + + content = utils.formatXml(content) + logDebug('Request for Completion Handler:\n' + content, isDebugLogEnabled) + utils.logAudit("UpdateVfModuleVolume Completion Handler request: " + content) + execution.setVariable('UPDVfModVol_CompletionHandlerRequest', content) + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 1002, 'Error in prepCompletionHandlerRequest(): ' + e.getMessage()) + } + } + + /** + * Build a "FalloutHandler" request. + * + * @param execution The flow's execution instance. + */ + public void prepFalloutHandler(Execution execution) { + def method = getClass().getSimpleName() + '.prepFalloutHandler(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def requestInfo = execution.getVariable('UPDVfModVol_requestInfo') + + def WorkflowException workflowException = execution.getVariable("WorkflowException") + def errorResponseCode = workflowException.getErrorCode() + def errorResponseMsg = workflowException.getErrorMessage() + def encErrorResponseMsg = "" + if (errorResponseMsg != null) { + encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">") + } + + String content = """ + + ${requestInfo} + + ${encErrorResponseMsg} + ${errorResponseCode} + + + """ + content = utils.formatXml(content) + logDebug('Request for Fallout Handler:\n' + content, isDebugLogEnabled) + utils.logAudit("UpdateVfModuleVolume Fallout request: " + content) + execution.setVariable('UPDVfModVol_FalloutHandlerRequest', content) + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + createWorkflowException(execution, 1002, 'Error in prepFalloutHandler(): ' + e.getMessage()) + } + } + + /** + * Create a WorkflowException for the error case where the Tenant Id from + * AAI did not match the Tenant Id in the incoming request. + * + * @param execution The flow's execution instance. + */ + public void handleTenantIdMismatch(Execution execution) { + def method = getClass().getSimpleName() + '.handleTenantIdMismatch(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + String processKey = getProcessKey(execution); + def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') + def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') + def tenantId = execution.getVariable('UPDVfModVol_tenantId') + def volumeGroupTenantId = execution.getVariable('UPDVfModVol_volumeGroupTenantId') + + def String errorMessage = 'TenantId \'' + tenantId + '\' in incoming request does not match Tenant Id \'' + volumeGroupTenantId + + '\' retrieved from AAI for Volume Group Id \'' + volumeGroupId + '\', AIC Cloud Region \'' + aicCloudRegion + '\'' + + logError('Error in UpdateVfModuleVol: ' + errorMessage) + + WorkflowException exception = new WorkflowException(processKey, 5000, errorMessage); + execution.setVariable("WorkflowException", exception); + + logDebug('Exited ' + method, isDebugLogEnabled) + utils.logAudit("UpdateVfModuleVolume workflowException in Tenant Mismatch: " + errorMessage) + } +} diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy similarity index 91% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/UpdateVfModuleVolumeInfraV1.groovy rename to bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy index b048df5f6b..2f716f5668 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/UpdateVfModuleVolumeInfraV1.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy @@ -18,16 +18,20 @@ * ============LICENSE_END========================================================= */ -package com.att.bpm.scripts +package org.openecomp.mso.bpmn.infrastructure.scripts import groovy.json.JsonSlurper + import java.util.concurrent.ExecutionException; import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.runtime.Execution import org.apache.commons.lang3.* import org.springframework.web.util.UriUtils - +import org.openecomp.mso.bpmn.common.scripts.AaiUtil; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.bpmn.common.scripts.VfModuleBase; +import org.openecomp.mso.bpmn.common.scripts.VidUtils; import org.openecomp.mso.bpmn.core.WorkflowException import org.openecomp.mso.rest.APIResponse import org.openecomp.mso.rest.RESTClient @@ -101,7 +105,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { // assume request is in XML format - proceed as usual to process XML request } - def requestId = execution.getVariable('att-mso-request-id') + def requestId = execution.getVariable('mso-request-id') def requestInfo = getRequiredNodeXml(execution, request, 'request-info') execution.setVariable('UPDVfModVol_requestInfo', requestInfo) @@ -117,7 +121,20 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { execution.setVariable('UPDVfModVol_serviceId', getRequiredNodeText(execution, volumeInputs, 'service-id')) execution.setVariable('UPDVfModVol_aicCloudRegion', getRequiredNodeText(execution, volumeInputs, 'aic-cloud-region')) execution.setVariable('UPDVfModVol_tenantId', getRequiredNodeText(execution, volumeInputs, 'tenant-id')) + //execution.setVariable('UPDVfModVol_modelCustomizationId', getRequiredNodeText(execution, volumeInputs, 'model-customization-id')) + try { + // Catalog DB headers Authorization + String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth") + utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled) + + def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey")) + execution.setVariable("BasicAuthHeaderValueDB",encodedString) + } catch (IOException ex) { + String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage() + utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + } def volumeParams = utils.getNodeXml(request, 'volume-params') execution.setVariable('UPDVfModVol_volumeParams', volumeParams) } @@ -143,7 +160,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { def volumeInputs = execution.getVariable('UPDVfModVol_volumeInputs') String xmlSyncResponse = """ - + ${requestId} UPDATE_VF_MODULE_VOL @@ -336,6 +353,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { def aaiVolumeGroupResponse = execution.getVariable('UPDVfModVol_aaiVolumeGroupResponse') def volumeGroupHeatStackId = getNodeTextForce(aaiVolumeGroupResponse, 'heat-stack-id') def volumeGroupName = getNodeTextForce(aaiVolumeGroupResponse, 'volume-group-name') + def modelCustomizationId = getNodeTextForce(aaiVolumeGroupResponse, 'vf-module-persona-model-customization-id') def vnfType = execution.getVariable('UPDVfModVol_vnfType') def vnfVersion = execution.getVariable('UPDVfModVol_vnfVersion') @@ -351,8 +369,8 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { def requestId = execution.getVariable('UPDVfModVol_requestId') def serviceId = execution.getVariable('UPDVfModVol_serviceId') - def messageId = execution.getVariable('att-mso-request-id') + '-' + System.currentTimeMillis() - def notificationUrl = execution.getVariable("URN_mso_workflow_vnfadapter_rest_callback") + def messageId = execution.getVariable('mso-request-id') + '-' + System.currentTimeMillis() + def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId) def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host") if ('true'.equals(useQualifiedHostName)) { notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) @@ -370,6 +388,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { ${vnfType} ${vnfVersion} + ${modelCustomizationId} vnf_id @@ -414,7 +433,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { String updateInfraRequest = """ + xmlns:req="http://org.openecomp.mso/requestsdb"> @@ -439,9 +458,9 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { public void prepCompletionHandlerRequest(Execution execution, requestId, action, source, isDebugLogEnabled) { String content = """ - - + + ${requestId} CREATE ${source} @@ -473,10 +492,10 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { } String content = """ - + ${requestInfo} ${encErrorResponseMsg} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java new file mode 100644 index 0000000000..2f1ca17c0d --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -0,0 +1,58 @@ +/*- + * ============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.util.List; + +import org.camunda.bpm.application.PostDeploy; +import org.camunda.bpm.application.PreUndeploy; +import org.camunda.bpm.application.ProcessApplication; +import org.camunda.bpm.application.ProcessApplicationInfo; +import org.camunda.bpm.application.impl.ServletProcessApplication; +import org.camunda.bpm.engine.ProcessEngine; + +import org.openecomp.mso.logger.MsoLogger; + +/** + * @since Version 1.0 + * + */ +@ProcessApplication("MSO Infrastructure Application") +public class MSOInfrastructureApplication extends ServletProcessApplication { + + private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); + + @PostDeploy + public void postDeploy(ProcessEngine processEngineInstance) { + long startTime = System.currentTimeMillis(); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Post deployment complete..."); + } + + @PreUndeploy + public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo, List processEngines) { + long startTime = System.currentTimeMillis(); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Pre Undeploy complete..."); + + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowAsyncInfrastructureResource.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowAsyncInfrastructureResource.java new file mode 100644 index 0000000000..0a35f5220f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowAsyncInfrastructureResource.java @@ -0,0 +1,50 @@ +/*- + * ============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.workflow.service; + +import javax.ws.rs.Path; + +import org.camunda.bpm.engine.ProcessEngineServices; +import org.camunda.bpm.engine.ProcessEngines; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowAsyncResource; + + +/** + * + * @version 1.0 + * Asynchronous Workflow processing using JAX RS RESTeasy implementation + * Both Synchronous and Asynchronous BPMN process can benefit from this implementation since the workflow gets executed in the background + * and the server thread is freed up, server scales better to process more incoming requests + * + * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the response + * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process + */ +@Path("/async") +public class WorkflowAsyncInfrastructureResource extends WorkflowAsyncResource { + + protected ProcessEngineServices getProcessEngineServices() { + if (pes4junit == null) { + return ProcessEngines.getProcessEngine("infrastructure"); + } else { + return pes4junit; + } + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.java new file mode 100644 index 0000000000..79eafbe5d8 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/service/WorkflowResourceApplication.java @@ -0,0 +1,57 @@ +/*- + * ============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.workflow.service; + +import java.util.HashSet; +import java.util.Set; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowMessageResource; +import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource; + +/** + * @version 1.0 + * RESTeasy workflow application which wires synchronous and asynchronous response + * + */ +@ApplicationPath("/") +public class WorkflowResourceApplication extends Application { + private Set singletons = new HashSet(); + private Set> classes = new HashSet>(); + + public WorkflowResourceApplication() { + singletons.add(new WorkflowResource()); + singletons.add(new WorkflowAsyncInfrastructureResource()); + singletons.add(new WorkflowMessageResource()); + } + + @Override + public Set> getClasses() { + return classes; + } + + @Override + public Set getSingletons() { + return singletons; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/persistence.xml b/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000000..62fcfadca7 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,37 @@ + + + + + + + java:jboss/datasources/ProcessEngine + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/processes.xml b/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/processes.xml new file mode 100644 index 0000000000..511ba0ae3d --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/processes.xml @@ -0,0 +1,81 @@ + + + + + + + org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration + java:jboss/datasources/ProcessEngine + + full + true + true + true + true + + + + + + org.camunda.bpm.application.impl.event.ProcessApplicationEventListenerPlugin + + + + + org.camunda.spin.plugin.impl.SpinProcessEnginePlugin + + + + + org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin + + + + org.openecomp.mso.bpmn.core.plugins.LoggingAndURNMappingPlugin + + + + + org.openecomp.mso.bpmn.core.plugins.WorkflowExceptionPlugin + + + + + + + + + + infrastructure + + false + true + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/logback.xml b/bpmn/MSOInfrastructureBPMN/src/main/resources/logback.xml new file mode 100644 index 0000000000..133fa54003 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/logback.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${logDirectory}/${auditLogName}${jboss.server.name}.log + + ${logDirectory}/${auditLogName}${jboss.server.name}.log.%d + + + + ${auditPattern} + + + + 256 + + + + + ${logDirectory}/${metricsLogName}${jboss.server.name}.log + + ${logDirectory}/${metricsLogName}${jboss.server.name}.log.%d + + + + + ${metricPattern} + + + + + + 256 + + + + + ${logDirectory}/${errorLogName}${jboss.server.name}.log + + ${logDirectory}/${errorLogName}${jboss.server.name}.log.%d + + + + INFO + + + ${errorPattern} + + + + + 256 + + + + + ${debugLogDirectory}/${debugLogName}${jboss.server.name}.log + + ${debugLogDirectory}/${debugLogName}${jboss.server.name}.log.%d + + + + ${debugPattern} + + + + + 256 + + true + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateGenericMacroServiceNetworkVnf.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateGenericMacroServiceNetworkVnf.bpmn new file mode 100644 index 0000000000..1f5318224b --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateGenericMacroServiceNetworkVnf.bpmn @@ -0,0 +1,1203 @@ + + + + + SequenceFlow_7 + SequenceFlow_3 + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_7 + + + + + SequenceFlow_10o22u2 + + + + SequenceFlow_0afe2pg + SequenceFlow_29 + + + + + + + + + + + + + + + SequenceFlow_29 + SequenceFlow_8 + + + + SequenceFlow_8 + SequenceFlow_6 + + + + + SequenceFlow_6 + + + + + SequenceFlow_2 + + + + SequenceFlow_5 + + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + SequenceFlow_12ilko1 + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1bwbn7r + SequenceFlow_12ag2bk + + + SequenceFlow_0cmebdc + SequenceFlow_0dfkfh1 + SequenceFlow_1bwbn7r + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0j6sjye + SequenceFlow_1ky2sv9 + + + + + + + + + + + + + + + + + + + + SequenceFlow_1h77psn + SequenceFlow_0qi5uxg + + + SequenceFlow_0bvecvm + SequenceFlow_1h77psn + + + + SequenceFlow_0xowenu + + + + SequenceFlow_3 + + + + + SequenceFlow_0zq7i3q + SequenceFlow_0zpbskl + SequenceFlow_0dhf2js + + + SequenceFlow_0zq7i3q + + + + SequenceFlow_0zpbskl + SequenceFlow_1sx5llu + SequenceFlow_02o4yqx + + + SequenceFlow_0sdb3on + SequenceFlow_05lo85t + SequenceFlow_0xtr1g5 + + + SequenceFlow_05lo85t + SequenceFlow_09xerwk + SequenceFlow_19mxskt + SequenceFlow_0tmepzk + + + + + + + + + + + SequenceFlow_0807ukc + SequenceFlow_19yywk8 + + + SequenceFlow_19yywk8 + + + SequenceFlow_19mxskt + SequenceFlow_1brxd2r + SequenceFlow_08s0ew2 + + + SequenceFlow_0jg47xm + SequenceFlow_0807ukc + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0xtr1g5 + SequenceFlow_09xerwk + + + + + + + + + + + SequenceFlow_0136s37 + SequenceFlow_1fqmrda + SequenceFlow_1dmsx0d + + + SequenceFlow_1ieiew4 + SequenceFlow_1os9x7w + SequenceFlow_0g7scsg + + + + + + + + + + SequenceFlow_1os9x7w + SequenceFlow_1f1hd3l + + + SequenceFlow_1sx5llu + SequenceFlow_0dhf2js + SequenceFlow_1rabks0 + SequenceFlow_0jg47xm + + + + + + + + + + + SequenceFlow_1dmsx0d + SequenceFlow_1otyild + + + + SequenceFlow_1otyild + SequenceFlow_0136s37 + SequenceFlow_12u8ufr + + + + + 0 }]]> + + + + SequenceFlow_0tmepzk + SequenceFlow_1fqmrda + SequenceFlow_1brxd2r + + + + + + + + + + SequenceFlow_12u8ufr + SequenceFlow_08s0ew2 + SequenceFlow_1ieiew4 + SequenceFlow_0sezboq + + + + + + + + + SequenceFlow_1f1hd3l + SequenceFlow_0g7scsg + SequenceFlow_0sezboq + SequenceFlow_0f4u373 + + + SequenceFlow_02o4yqx + SequenceFlow_0sdb3on + + + + SequenceFlow_0f4u373 + SequenceFlow_1rabks0 + + + + + + + + SequenceFlow_1vwssu7 + SequenceFlow_19etqmx + + + + SequenceFlow_10o22u2 + SequenceFlow_0j6sjye + + + + + SequenceFlow_12ilko1 + SequenceFlow_0afe2pg + + + + + + + + + SequenceFlow_1vwssu7 + + + + SequenceFlow_13uceka + + + + SequenceFlow_19etqmx + SequenceFlow_0cmebdc + SequenceFlow_1f26zbk + + + SequenceFlow_04vlq8r + SequenceFlow_1n7r495 + SequenceFlow_0dfkfh1 + + + + + + 0}]]> + + + SequenceFlow_1n7r495 + SequenceFlow_1f26zbk + SequenceFlow_1j7n6qx + + + + SequenceFlow_1j7n6qx + + + + + + + SequenceFlow_10tbv62 + + + + SequenceFlow_10tbv62 + SequenceFlow_0bvecvm + SequenceFlow_0w7328u + + + SequenceFlow_0qi5uxg + SequenceFlow_0w7328u + SequenceFlow_0xowenu + + + + 0}]]> + + + in 1702 scope only one VNF will be created + + + + + SequenceFlow_12ag2bk + SequenceFlow_04vlq8r + + + + + + + + + + ${URN_mso_adapters_db_endpoint} + + + + application/soap+xml + + + POST + + soap-http-connector + + + SequenceFlow_0vj46ej + SequenceFlow_13uceka + + + + SequenceFlow_1ky2sv9 + SequenceFlow_0vj46ej + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateNetworkInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateNetworkInstance.bpmn new file mode 100644 index 0000000000..e86d287e27 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateNetworkInstance.bpmn @@ -0,0 +1,372 @@ + + + + + SequenceFlow_0lp2z7l + + + + SequenceFlow_10 + SequenceFlow_14 + + + + + SequenceFlow_10 + + + + + SequenceFlow_14 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0eto8sn + SequenceFlow_1lj31zp + + + SequenceFlow_0x3znm5 + + + SequenceFlow_095crcd + SequenceFlow_0x3znm5 + + + + + + SequenceFlow_0lp2z7l + SequenceFlow_1ablr60 + + + + + + SequenceFlow_1lj31zp + SequenceFlow_0xxvjxq + + + + + + + + + + + + SequenceFlow_0xxvjxq + SequenceFlow_095crcd + + + + + SequenceFlow_0n4umjf + + + + SequenceFlow_1ghqolv + + + SequenceFlow_0n4umjf + SequenceFlow_1s5niqb + + + + + + + ${URN_mso_adapters_db_endpoint} + ${CRENI_createDBRequest} + + + application/soap+xml + + + POST + ${response} + ${statusCode} + + http-connector + + + SequenceFlow_1s5niqb + SequenceFlow_06s5eu4 + + + SequenceFlow_06s5eu4 + SequenceFlow_1reso2f + + + + + + + + + + + + SequenceFlow_1reso2f + SequenceFlow_1ghqolv + + + + + + + + + + + + SequenceFlow_1ablr60 + SequenceFlow_0rt8wax + + + + SequenceFlow_0rt8wax + SequenceFlow_0eto8sn + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateServiceInstance.bpmn new file mode 100644 index 0000000000..d8e8dfda30 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateServiceInstance.bpmn @@ -0,0 +1,336 @@ + + + + + SequenceFlow_0lp2z7l + + + + SequenceFlow_10 + SequenceFlow_14 + + + + + SequenceFlow_10 + + + + + SequenceFlow_14 + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0eto8sn + SequenceFlow_1lj31zp + + + SequenceFlow_095crcd + + + + SequenceFlow_0lp2z7l + SequenceFlow_0ktadna + + + + + SequenceFlow_1o4wwba + SequenceFlow_0xxvjxq + + + + + + + + + + + + SequenceFlow_0xxvjxq + SequenceFlow_095crcd + + + + + SequenceFlow_0n4umjf + + + + SequenceFlow_1ghqolv + + + SequenceFlow_14eadeb + SequenceFlow_1reso2f + + + + + + + + + + + + SequenceFlow_1reso2f + SequenceFlow_1ghqolv + + + + + + SequenceFlow_0n4umjf + SequenceFlow_14eadeb + + + + + + + + SequenceFlow_0ktadna + SequenceFlow_0eto8sn + + + + + SequenceFlow_1lj31zp + SequenceFlow_1o4wwba + SequenceFlow_1mdnv3l + + + SequenceFlow_1mdnv3l + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateVfModuleInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn similarity index 65% rename from bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateVfModuleInfra.bpmn rename to bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn index 0d08da38f4..7e5a1cd497 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateVfModuleInfra.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn @@ -1,472 +1,473 @@ - - - - - SequenceFlow_1 - - - - - - - - - - - - - - - - SequenceFlow_7 - SequenceFlow_4 - - - SequenceFlow_3 - SequenceFlow_7 - + + + + SequenceFlow_1 + + + + + + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_4 + + + SequenceFlow_3 + SequenceFlow_7 + - - - - SequenceFlow_4 - - - - - SequenceFlow_5 - - - - - SequenceFlow_5 - SequenceFlow_6 - + + + + SequenceFlow_4 + + + + + SequenceFlow_5 + + + + + SequenceFlow_5 + SequenceFlow_6 + - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - - - application/soap+xml - - - ${CVFMI_updateInfraRequest} - POST - ${statusCode} - ${response} - - - - SequenceFlow_6 - SequenceFlow_8 - - - - - updateInfraRequestResponseGood - SequenceFlow_12 - + + + + + + ${URN_mso_adapters_db_endpoint} + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + ${CVFMI_updateInfraRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_6 + SequenceFlow_8 + + + + + updateInfraRequestResponseGood + SequenceFlow_12 + - - - - - - - - - - - - SequenceFlow_12 - SequenceFlow_14 - - - SequenceFlow_8 - updateInfraRequestResponseBad - updateInfraRequestResponseGood - - - - - - - updateInfraRequestResponseBad - - - - - SequenceFlow_17 - SequenceFlow_21 - + + + + + + + + + + + + SequenceFlow_12 + SequenceFlow_14 + + + SequenceFlow_8 + updateInfraRequestResponseBad + updateInfraRequestResponseGood + + + + + + + updateInfraRequestResponseBad + + + + + SequenceFlow_17 + SequenceFlow_21 + - - - - - - - - - - SequenceFlow_19 - SequenceFlow_17 - - - - SequenceFlow_13 - - - - - - - - - - - SequenceFlow_10 - SequenceFlow_11 - - - - SequenceFlow_11 - - - - SequenceFlow_22 - SequenceFlow_10 - + + + + + + + + + + SequenceFlow_19 + SequenceFlow_17 + + + + SequenceFlow_13 + + + + + + + + + + + SequenceFlow_10 + SequenceFlow_11 + + + + SequenceFlow_11 + + + + SequenceFlow_22 + SequenceFlow_10 + - - - - SequenceFlow_21 - isRollbackOnNoSequenceFlow - SequenceFlow_22 - - - - SequenceFlow_13 - isRollbackOnNoSequenceFlow - IsRollbackOnYesSequenceFlow - - - - IsRollbackOnYesSequenceFlow - SequenceFlow_19 - + + + + SequenceFlow_21 + isRollbackOnNoSequenceFlow + SequenceFlow_22 + + + + SequenceFlow_13 + isRollbackOnNoSequenceFlow + IsRollbackOnYesSequenceFlow + + + + IsRollbackOnYesSequenceFlow + SequenceFlow_19 + - - - - - - - - SequenceFlow_14 - SequenceFlow_16 - - - - SequenceFlow_16 - - - - - - SequenceFlow_15 - - - - - SequenceFlow_15 - - - - SequenceFlow_1 - SequenceFlow_3 - + + + + + + + + SequenceFlow_14 + SequenceFlow_16 + + + + SequenceFlow_16 + + + + + + SequenceFlow_15 + + + + + SequenceFlow_15 + + + + SequenceFlow_1 + SequenceFlow_3 + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file +createVfModule.preProcessRequest(execution)]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateVfModuleVolumeInfraV1.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleVolumeInfraV1.bpmn similarity index 68% rename from bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateVfModuleVolumeInfraV1.bpmn rename to bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleVolumeInfraV1.bpmn index 9beaad909b..5c8074e01e 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/CreateVfModuleVolumeInfraV1.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleVolumeInfraV1.bpmn @@ -1,480 +1,481 @@ - - - - - SequenceFlow_1 - - - - - SequenceFlow_14 - - - - - SequenceFlow_14 - SequenceFlow_syncResponseSent - SequenceFlow_syncResponseNotSent - - - #{CVMVINFRAV1_syncResponseSent == true} - - - SequenceFlow_syncResponseNotSent - SequenceFlow_22 - + + + + SequenceFlow_1 + + + + + SequenceFlow_14 + + + + + SequenceFlow_14 + SequenceFlow_syncResponseSent + SequenceFlow_syncResponseNotSent + + + #{CVMVINFRAV1_syncResponseSent == true} + + + SequenceFlow_syncResponseNotSent + SequenceFlow_22 + - - - - - SequenceFlow_22 - SequenceFlow_syncResponseSent - SequenceFlow_18 - + + + + + SequenceFlow_22 + SequenceFlow_syncResponseSent + SequenceFlow_18 + - - - - - - - - - - - - - SequenceFlow_18 - SequenceFlow_19 - - - - SequenceFlow_19 - - - - - SequenceFlow_1 - SequenceFlow_4 - + + + + + + + + + + + + + SequenceFlow_18 + SequenceFlow_19 + + + + SequenceFlow_19 + + + + + SequenceFlow_1 + SequenceFlow_4 + - - - - SequenceFlow_4 - SequenceFlow_3 - + + + + SequenceFlow_4 + SequenceFlow_3 + - - - - SequenceFlow_3 - SequenceFlow_volGrpNamePresent - SequenceFlow_volGrpNameMissing - - - - - - - SequenceFlow_volGrpNameMissing - SequenceFlow_7 - + + + + SequenceFlow_3 + SequenceFlow_volGrpNamePresent + SequenceFlow_volGrpNameMissing + + + + + + + SequenceFlow_volGrpNameMissing + SequenceFlow_7 + - - - - SequenceFlow_7 - - - - - - - - - - - SequenceFlow_volGrpNamePresent - SequenceFlow_5 - - - - - - - - - - - - - - - - SequenceFlow_serviceInstanceFound - SequenceFlow_2 - - - - SequenceFlow_12 - SequenceFlow_13 - + + + + SequenceFlow_7 + + + + + + + + + + + SequenceFlow_volGrpNamePresent + SequenceFlow_5 + + + + + + + + + + + + + + + + SequenceFlow_serviceInstanceFound + SequenceFlow_2 + + + + SequenceFlow_12 + SequenceFlow_13 + - - - - - - - - - - - - SequenceFlow_11 - SequenceFlow_12 - - - - SequenceFlow_8 - SequenceFlow_11 - + + + + + + + + + + + + SequenceFlow_11 + SequenceFlow_12 + + + + SequenceFlow_8 + SequenceFlow_11 + - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${CVMVINFRAV1_createDBRequest} - - - application/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_6 - SequenceFlow_8 - - - - SequenceFlow_13 - - - - SequenceFlow_2 - SequenceFlow_6 - + + + + + + + ${URN_mso_adapters_db_endpoint} + ${CVMVINFRAV1_createDBRequest} + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + POST + ${response} + ${statusCode} + + http-connector + + + SequenceFlow_6 + SequenceFlow_8 + + + + SequenceFlow_13 + + + + SequenceFlow_2 + SequenceFlow_6 + - - - - SequenceFlow_5 - SequenceFlow_serviceInstanceFound - SequenceFlow_serviceInstanceNotFound - - - - - - - - SequenceFlow_16 - - - - SequenceFlow_serviceInstanceNotFound - SequenceFlow_16 - + + + + SequenceFlow_5 + SequenceFlow_serviceInstanceFound + SequenceFlow_serviceInstanceNotFound + + + + + + + + SequenceFlow_16 + + + + SequenceFlow_serviceInstanceNotFound + SequenceFlow_16 + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file +createVfModuleVolumeInfraV1.executeMethod('buildWorkflowException', execution, 2500, "Service instance id not found in AAI: $CVMVINFRAV1_serviceInstanceId.", isDebugLogEnabled)]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVnfInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVnfInfra.bpmn new file mode 100644 index 0000000000..f98f8eda03 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVnfInfra.bpmn @@ -0,0 +1,284 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + SequenceFlow_2 + SequenceFlow_3 + + + + + + + + + + + + + + + + + + + + + SequenceFlow_3 + SequenceFlow_0lso26t + + + + SequenceFlow_8 + SequenceFlow_9 + + + + + SequenceFlow_9 + + + SequenceFlow_8 + + + + + + + + + + + + SequenceFlow_13 + SequenceFlow_14 + + + + SequenceFlow_15 + SequenceFlow_13 + + + + + SequenceFlow_14 + + + + SequenceFlow_12 + SequenceFlow_15 + + + + + SequenceFlow_12 + + + + + + SequenceFlow_0lso26t + SequenceFlow_16 + + + + + SequenceFlow_17 + + + + + + + + + + SequenceFlow_16 + SequenceFlow_17 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DelServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DelServiceInstance.bpmn new file mode 100644 index 0000000000..6d47b1a9ba --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DelServiceInstance.bpmn @@ -0,0 +1,331 @@ + + + + + SequenceFlow_0lp2z7l + + + + SequenceFlow_10 + SequenceFlow_14 + + + + + SequenceFlow_10 + + + + + SequenceFlow_14 + + + + + + + + + + + + + + + + + + SequenceFlow_0eto8sn + SequenceFlow_1lj31zp + + + SequenceFlow_095crcd + + + + SequenceFlow_0lp2z7l + SequenceFlow_0ktadna + + + + + SequenceFlow_1qjygj5 + SequenceFlow_0xxvjxq + + + + + + + + + + + + SequenceFlow_0xxvjxq + SequenceFlow_095crcd + + + + + SequenceFlow_0n4umjf + + + + SequenceFlow_1ghqolv + + + SequenceFlow_14eadeb + SequenceFlow_1reso2f + + + + + + + + + + + + SequenceFlow_1reso2f + SequenceFlow_1ghqolv + + + + + + SequenceFlow_0n4umjf + SequenceFlow_14eadeb + + + + + + + + SequenceFlow_0ktadna + SequenceFlow_0eto8sn + + + + + SequenceFlow_1lj31zp + SequenceFlow_1qjygj5 + SequenceFlow_0hgiouk + + + + + + SequenceFlow_0hgiouk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteGenericMacroServiceNetworkVnf.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteGenericMacroServiceNetworkVnf.bpmn new file mode 100644 index 0000000000..3bd8b91abd --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteGenericMacroServiceNetworkVnf.bpmn @@ -0,0 +1,771 @@ + + + + + SequenceFlow_7 + SequenceFlow_3 + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_7 + + + + + SequenceFlow_10o22u2 + + + + SequenceFlow_12ilko1 + SequenceFlow_29 + + + + + + + + + + + + + + + SequenceFlow_29 + SequenceFlow_8 + + + + SequenceFlow_8 + SequenceFlow_6 + + + + + SequenceFlow_6 + + + + + SequenceFlow_2 + + + + SequenceFlow_5 + + + + SequenceFlow_2 + SequenceFlow_5 + + + + + + SequenceFlow_12ilko1 + + + + + + + + + + + + + + + + + + + SequenceFlow_1bwbn7r + SequenceFlow_12ag2bk + + + SequenceFlow_0cmebdc + SequenceFlow_0dfkfh1 + SequenceFlow_1bwbn7r + + + + + + + + + + + + + + + SequenceFlow_10o22u2 + SequenceFlow_04ao07f + + + + + + + + + + + + + + SequenceFlow_1h77psn + SequenceFlow_1dmn40p + + + SequenceFlow_0bvecvm + SequenceFlow_0mr8jgt + SequenceFlow_1h77psn + + + + SequenceFlow_0xowenu + + + + SequenceFlow_3 + + + + + SequenceFlow_06llof4 + + + + + + + + + + + + SequenceFlow_0807ukc + SequenceFlow_19yywk8 + + + SequenceFlow_19yywk8 + + + SequenceFlow_06llof4 + SequenceFlow_0807ukc + + + + + + + + + + + + + SequenceFlow_1vwssu7 + + + + SequenceFlow_04ao07f + + + + SequenceFlow_1vwssu7 + SequenceFlow_0cmebdc + SequenceFlow_1f26zbk + + + SequenceFlow_04vlq8r + SequenceFlow_1n7r495 + SequenceFlow_0dfkfh1 + + + + + + 0}]]> + + + SequenceFlow_1n7r495 + SequenceFlow_1f26zbk + SequenceFlow_1j7n6qx + + + + SequenceFlow_1j7n6qx + + + + + + SequenceFlow_10tbv62 + + + + SequenceFlow_10tbv62 + SequenceFlow_0bvecvm + SequenceFlow_0w7328u + + + SequenceFlow_0w7328u + SequenceFlow_1wc8h5g + SequenceFlow_0xowenu + + + + 0}]]> + + + + + SequenceFlow_12ag2bk + SequenceFlow_04vlq8r + + + + + + + + + + + + + + + + SequenceFlow_0jek18q + SequenceFlow_1ttswdr + + + SequenceFlow_1ttswdr + SequenceFlow_18103ca + + + + SequenceFlow_0jek18q + + + + SequenceFlow_18103ca + + + + + + + + SequenceFlow_1dmn40p + SequenceFlow_0g2cw86 + + + + SequenceFlow_0g2cw86 + SequenceFlow_0mr8jgt + SequenceFlow_1wc8h5g + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteNetworkInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteNetworkInstance.bpmn new file mode 100644 index 0000000000..8c37d212c3 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteNetworkInstance.bpmn @@ -0,0 +1,370 @@ + + + + + SequenceFlow_0lp2z7l + + + + SequenceFlow_10 + SequenceFlow_14 + + + + + SequenceFlow_10 + + + + + SequenceFlow_14 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0eto8sn + SequenceFlow_1lj31zp + + + SequenceFlow_0x3znm5 + + + SequenceFlow_095crcd + SequenceFlow_0x3znm5 + + + + + + SequenceFlow_0lp2z7l + SequenceFlow_1ablr60 + + + + + + SequenceFlow_1lj31zp + SequenceFlow_0xxvjxq + + + + + + + + + + + + SequenceFlow_0xxvjxq + SequenceFlow_095crcd + + + + + SequenceFlow_0n4umjf + + + + SequenceFlow_1ghqolv + + + SequenceFlow_0n4umjf + SequenceFlow_1s5niqb + + + + + + + ${URN_mso_adapters_db_endpoint} + ${DELNI_deleteDBRequest} + + + application/soap+xml + + + POST + ${response} + ${statusCode} + + http-connector + + + SequenceFlow_1s5niqb + SequenceFlow_06s5eu4 + + + SequenceFlow_06s5eu4 + SequenceFlow_1reso2f + + + + + + + + + + + + SequenceFlow_1reso2f + SequenceFlow_1ghqolv + + + + + + + + + + + + SequenceFlow_1ablr60 + SequenceFlow_0rt8wax + + + + SequenceFlow_0rt8wax + SequenceFlow_0eto8sn + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteVfModuleInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleInfra.bpmn similarity index 64% rename from bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteVfModuleInfra.bpmn rename to bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleInfra.bpmn index d30042c4f6..b974bd01aa 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteVfModuleInfra.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleInfra.bpmn @@ -1,324 +1,330 @@ - - - - - SequenceFlow_5 - SequenceFlow_2 - - - - - SequenceFlow_4 - SequenceFlow_5 - - - - - SequenceFlow_2 - SequenceFlow_9 - - - - - - - - - - - - SequenceFlow_9 - SequenceFlow_8 - - - - - - - - - - SequenceFlow_17 - SequenceFlow_14 - - - - SequenceFlow_6 - - - - SequenceFlow_14 - SequenceFlow_6 - - - - - SequenceFlow_13 - SequenceFlow_17 - - - - - - - - soap-http-connector - - ${URN_mso_adapters_db_endpoint} - POST - - - application/soap+xml - - - ${DELVfModI_updateInfraRequest} - ${response} - ${statusCode} - - - - SequenceFlow_10 - SequenceFlow_13 - - - - SequenceFlow_8 - SequenceFlow_10 - - - - - - SequenceFlow_1 - - - - - SequenceFlow_1 - SequenceFlow_7 - - - - - - - - - - - SequenceFlow_7 - SequenceFlow_19 - - - SequenceFlow_19 - - - - - - SequenceFlow_12 - - - - SequenceFlow_12 - - - - - SequenceFlow_4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + SequenceFlow_5 + SequenceFlow_2 + + + + + SequenceFlow_4 + SequenceFlow_5 + + + + + SequenceFlow_2 + SequenceFlow_9 + + + + + + + + + + + + + + + + + SequenceFlow_9 + SequenceFlow_8 + + + + + + + + + + SequenceFlow_17 + SequenceFlow_14 + + + + SequenceFlow_6 + + + + SequenceFlow_14 + SequenceFlow_6 + + + + + SequenceFlow_13 + SequenceFlow_17 + + + + + + + + + ${URN_mso_adapters_db_endpoint} + POST + + + #{BasicAuthHeaderValueDB} + application/soap+xml + + + ${DELVfModI_updateInfraRequest} + ${response} + ${statusCode} + + soap-http-connector + + + SequenceFlow_10 + SequenceFlow_13 + + + + SequenceFlow_8 + SequenceFlow_10 + + + + + + SequenceFlow_1 + + + + + SequenceFlow_1 + SequenceFlow_7 + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_19 + + + SequenceFlow_19 + + + + + + SequenceFlow_12 + + + + SequenceFlow_12 + + + + + SequenceFlow_4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteVfModuleVolumeInfraV1.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn similarity index 94% rename from bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteVfModuleVolumeInfraV1.bpmn rename to bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn index 49392553a7..163e50be23 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/DeleteVfModuleVolumeInfraV1.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleVolumeInfraV1.bpmn @@ -1,567 +1,568 @@ - - - - - SequenceFlow_1 - SequenceFlow_7 - + + + + SequenceFlow_1 + SequenceFlow_7 + - - - - SequenceFlow_1 - - - - SequenceFlow_7 - SequenceFlow_12 - + + + + SequenceFlow_1 + + + + SequenceFlow_7 + SequenceFlow_12 + - - - - SequenceFlow_12 - SequenceFlow_6 - + + + + SequenceFlow_12 + SequenceFlow_6 + - - - SequenceFlow_15 - SequenceFlow_2 - + + + SequenceFlow_15 + SequenceFlow_2 + - - - - SequenceFlow_22 - - - - SequenceFlow_13 - SequenceFlow_15 - SequenceFlow_21 - - - - - - - - - - - - - - - - SequenceFlow_2 - SequenceFlow_5 - - - - SequenceFlow_8 - SequenceFlow_13 - + + + + SequenceFlow_22 + + + + SequenceFlow_13 + SequenceFlow_15 + SequenceFlow_21 + + + + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_5 + + + + SequenceFlow_8 + SequenceFlow_13 + - - - - SequenceFlow_21 - SequenceFlow_22 - + + + + SequenceFlow_21 + SequenceFlow_22 + - - - - - SequenceFlow_6 - SequenceFlow_4 - SequenceFlow_8 - - - - - - - SequenceFlow_4 - - - - - SequenceFlow_23 - - - - - SequenceFlow_23 - SequenceFlow_responseNotSent - SequenceFlow_responseSent - - - SequenceFlow_responseNotSent - SequenceFlow_14 - + + + + + SequenceFlow_6 + SequenceFlow_4 + SequenceFlow_8 + + + + + + + SequenceFlow_4 + + + + + SequenceFlow_23 + + + + + SequenceFlow_23 + SequenceFlow_responseNotSent + SequenceFlow_responseSent + + + SequenceFlow_responseNotSent + SequenceFlow_14 + - - - - #{DELVfModVol_syncResponseSent == true} - - - SequenceFlow_responseSent - SequenceFlow_14 - SequenceFlow_25 - + + + + #{DELVfModVol_syncResponseSent == true} + + + SequenceFlow_responseSent + SequenceFlow_14 + SequenceFlow_25 + - - - - - - - - - - - - - - SequenceFlow_25 - SequenceFlow_19 - - - - SequenceFlow_19 - - - - - - SequenceFlow_35 - SequenceFlow_37 - + + + + + + + + + + + + + + SequenceFlow_25 + SequenceFlow_19 + + + + SequenceFlow_19 + + + + + + SequenceFlow_35 + SequenceFlow_37 + - - - - SequenceFlow_27 - SequenceFlow_29 - + + + + SequenceFlow_27 + SequenceFlow_29 + - - - - SequenceFlow_10 - SequenceFlow_24 +]]> + + + + SequenceFlow_10 + SequenceFlow_24 - - - - - - - - - - - - - - SequenceFlow_29 - SequenceFlow_10 - - - - SequenceFlow_24 - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${DELVfModVol_updateInfraRequest} - - - application/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_37 - SequenceFlow_27 - - - - SequenceFlow_vnfAdapterCallOK - SequenceFlow_35 - + + + + + + + + + + + + + + SequenceFlow_29 + SequenceFlow_10 + + + + SequenceFlow_24 + + + + + + http-connector + + ${URN_mso_adapters_db_endpoint} + ${DELVfModVol_updateInfraRequest} + + + #{BasicAuthHeaderValueDB} + application/soap+xml + + + POST + ${response} + ${statusCode} + + + + SequenceFlow_37 + SequenceFlow_27 + + + + SequenceFlow_vnfAdapterCallOK + SequenceFlow_35 + - - - - SequenceFlow_5 - SequenceFlow_vnfAdapterCallOK - SequenceFlow_vnfAdapterCallNotOK - - - #{VNFREST_SuccessIndicator == true} - - - SequenceFlow_vnfAdapterCallNotOK - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +deleteVfMod.executeMethod('deleteVolGrpId', execution, isDebugLogEnabled)]]> + + + + SequenceFlow_5 + SequenceFlow_vnfAdapterCallOK + SequenceFlow_vnfAdapterCallNotOK + + + #{VNFREST_SuccessIndicator == true} + + + SequenceFlow_vnfAdapterCallNotOK + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVnfInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVnfInfra.bpmn new file mode 100644 index 0000000000..765bb1ffa6 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVnfInfra.bpmn @@ -0,0 +1,353 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_2 + SequenceFlow_16ikne0 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + + SequenceFlow_15 + SequenceFlow_16 + + + + + + + + + + SequenceFlow_16 + SequenceFlow_17 + + + + SequenceFlow_17 + + + + SequenceFlow_14 + + + + + SequenceFlow_14 + SequenceFlow_15 + + + + + + + SequenceFlow_19 + + + SequenceFlow_18 + + + + + SequenceFlow_18 + SequenceFlow_19 + + + + + + SequenceFlow_0slfgmy + SequenceFlow_6 + + + + + + + + + + + SequenceFlow_6 + SequenceFlow_7 + + + + SequenceFlow_7 + + + + + + + + + SequenceFlow_00bhxtl + SequenceFlow_1f56g06 + + + SequenceFlow_16ikne0 + SequenceFlow_00o02cv + SequenceFlow_00bhxtl + + + + SequenceFlow_1f56g06 + SequenceFlow_0dy2xw0 + SequenceFlow_0slfgmy + + + + + + + + + + + + + + + SequenceFlow_00o02cv + SequenceFlow_0dy2xw0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/UpdateNetworkInstanceInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateNetworkInstanceInfra.bpmn similarity index 68% rename from bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/UpdateNetworkInstanceInfra.bpmn rename to bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateNetworkInstanceInfra.bpmn index 8a203d1f6f..bba8b6f7a7 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/UpdateNetworkInstanceInfra.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateNetworkInstanceInfra.bpmn @@ -1,1014 +1,1016 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_32 - SequenceFlow_11 - + + + + SequenceFlow_1 + + + + SequenceFlow_32 + SequenceFlow_11 + - - - - SequenceFlow_12 - SequenceFlow_5 - + + + + SequenceFlow_12 + SequenceFlow_5 + - - - SequenceFlow_5 - sdncTopoNo_SequenceFlow - sdncTopoYes_SequenceFlow - - - - - - - - SequenceFlow_34 - - - - - sdncTopoNo_SequenceFlow - SequenceFlow_34 - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_11 - SequenceFlow_12 - - - - SequenceFlow_27 - SequenceFlow_29 - + + + SequenceFlow_5 + sdncTopoNo_SequenceFlow + sdncTopoYes_SequenceFlow + + + + + + + + SequenceFlow_34 + + + + + sdncTopoNo_SequenceFlow + SequenceFlow_34 + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_11 + SequenceFlow_12 + + + + SequenceFlow_27 + SequenceFlow_29 + - - - - - SequenceFlow_23 - isRollbackOn_YesNetwork_SequenceFlow - isRollbackOn_NoNetwork_SequenceFlow - - - - - - - SequenceFlow_23 - - - - - isRollbackOn_YesNetwork_SequenceFlow - isPONR_Yes_SequenceFlow - isPONR_No_SequenceFlow - - - - - - - isPONR_No_SequenceFlow - isNetworkOk_No_SequenceFlow - isNetworkOk_Yes_SequenceFlow - - - - - - - isNetworkOk_No_SequenceFlow - isNetworkOk_Yes_SequenceFlow - sdncOk_Yeso_ExclusiveGateway - sdncOk_No_ExclusiveGateway - - - - - - - sdncOk_Yeso_ExclusiveGateway - SequenceFlow_53 - + + + + + SequenceFlow_23 + isRollbackOn_YesNetwork_SequenceFlow + isRollbackOn_NoNetwork_SequenceFlow + + + + + + + SequenceFlow_23 + + + + + isRollbackOn_YesNetwork_SequenceFlow + isPONR_Yes_SequenceFlow + isPONR_No_SequenceFlow + + + + + + + isPONR_No_SequenceFlow + isNetworkOk_No_SequenceFlow + isNetworkOk_Yes_SequenceFlow + + + + + + + isNetworkOk_No_SequenceFlow + isNetworkOk_Yes_SequenceFlow + sdncOk_Yeso_ExclusiveGateway + sdncOk_No_ExclusiveGateway + + + + + + + sdncOk_Yeso_ExclusiveGateway + SequenceFlow_53 + - - - - SequenceFlow_53 - SequenceFlow_55 - - - - - SequenceFlow_47 - SequenceFlow_22 - + + + + SequenceFlow_53 + SequenceFlow_55 + + + + + SequenceFlow_47 + SequenceFlow_22 + - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${UPDNETI_updateDBRequest} - - - application/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_22 - SequenceFlow_19 - - - - - - - - - - - - - - SequenceFlow_25 - SequenceFlow_18 - - - - SequenceFlow_18 - - - SequenceFlow_55 - sdncOk_No_ExclusiveGateway - SequenceFlow_4 - + + + + + + + ${URN_mso_adapters_db_endpoint} + ${UPDNETI_updateDBRequest} + + + #{BasicAuthHeaderValueDB} + application/soap+xml + + + POST + ${response} + ${statusCode} + + http-connector + + + SequenceFlow_22 + SequenceFlow_19 + + + + + + + + + + + + + + SequenceFlow_25 + SequenceFlow_18 + + + + SequenceFlow_18 + + + SequenceFlow_55 + sdncOk_No_ExclusiveGateway + SequenceFlow_4 + - - - - isRollbackOn_NoNetwork_SequenceFlow - isPONR_Yes_SequenceFlow - SequenceFlow_4 - SequenceFlow_47 - - - - SequenceFlow_19 - SequenceFlow_25 - + + + + isRollbackOn_NoNetwork_SequenceFlow + isPONR_Yes_SequenceFlow + SequenceFlow_4 + SequenceFlow_47 + + + + SequenceFlow_19 + SequenceFlow_25 + - - - - - SequenceFlow_13 - SequenceFlow_35 - + + + + + SequenceFlow_13 + SequenceFlow_35 + - - - - SequenceFlow_35 - SequenceFlow_46 - + + + + SequenceFlow_35 + SequenceFlow_46 + - - - - SequenceFlow_46 - SequenceFlow_37 - + + + + SequenceFlow_46 + SequenceFlow_37 + - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${UPDNETI_updateDBRequest} - - - application/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_37 - SequenceFlow_27 - - - - - - - - - - - - - - SequenceFlow_29 - SequenceFlow_17 - - - - SequenceFlow_17 - - - - SequenceFlow_10 - SequenceFlow_14 - + + + + + + + ${URN_mso_adapters_db_endpoint} + ${UPDNETI_updateDBRequest} + + + #{BasicAuthHeaderValueDB} + application/soap+xml + + + POST + ${response} + ${statusCode} + + http-connector + + + SequenceFlow_37 + SequenceFlow_27 + + + + + + + + + + + + + + SequenceFlow_29 + SequenceFlow_17 + + + + SequenceFlow_17 + + + + SequenceFlow_10 + SequenceFlow_14 + - - - - SequenceFlow_10 - - - - - SequenceFlow_14 - - - - SequenceFlow_1 - SequenceFlow_7 - + + + + SequenceFlow_10 + + + + + SequenceFlow_14 + + + + SequenceFlow_1 + SequenceFlow_7 + - - - - SequenceFlow_24 - SequenceFlow_32 - + + + + SequenceFlow_24 + SequenceFlow_32 + - - - - siFoundYes - SequenceFlow_24 - + + + + siFoundYes + SequenceFlow_24 + - - - - SequenceFlow_30 - - - - siFoundNo - SequenceFlow_30 - + + + + SequenceFlow_30 + + + + siFoundNo + SequenceFlow_30 + - - - - SequenceFlow_3 - siFoundYes - siFoundNo - - - - - - - - - - - - - - - - SequenceFlow_28 - SequenceFlow_3 - - - - SequenceFlow_7 - SequenceFlow_28 - + + + + SequenceFlow_3 + siFoundYes + siFoundNo + + + + + + + + + + + + + + + + SequenceFlow_28 + SequenceFlow_3 + + + + SequenceFlow_7 + SequenceFlow_28 + - - - - SequenceFlow_59 - SequenceFlow_13 - + + + + SequenceFlow_59 + SequenceFlow_13 + - - - - - - http-connector - - ${UPDNETI_updateNetworkRequest} - ${URN_mso_adapters_network_rest_endpoint}/${UPDNETI_networkId} - - - #{BasicAuthHeaderValuePO} - application/xml - - - PUT - ${statusCode} - ${response} - - - - SequenceFlow_61 - SequenceFlow_59 - - - - SequenceFlow_2 - SequenceFlow_61 - + + + + + + + ${UPDNETI_updateNetworkRequest} + ${URN_mso_adapters_network_rest_endpoint}/${UPDNETI_networkId} + + + #{BasicAuthHeaderValuePO} + application/xml + + + PUT + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_61 + SequenceFlow_59 + + + + SequenceFlow_2 + SequenceFlow_61 + - - - - SequenceFlow_38 - SequenceFlow_2 - + + + + SequenceFlow_38 + SequenceFlow_2 + - - - - sdncTopoYes_SequenceFlow - SequenceFlow_6 - - - - - SequenceFlow_6 - SequenceFlow_15 - + + + + sdncTopoYes_SequenceFlow + SequenceFlow_6 + - - - - SequenceFlow_15 - SequenceFlow_38 - + + + + SequenceFlow_6 + SequenceFlow_15 + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file +UpdateNetworkInstanceInfra.callRESTQueryAAINetworkVpnBinding(execution)]]> + + + + SequenceFlow_15 + SequenceFlow_38 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/UpdateVfModuleInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleInfra.bpmn similarity index 91% rename from bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/UpdateVfModuleInfra.bpmn rename to bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleInfra.bpmn index fdd2b65d4f..1d20bd099c 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/UpdateVfModuleInfra.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleInfra.bpmn @@ -1,275 +1,275 @@ - - - - - SequenceFlow_5 - SequenceFlow_2 - + + + + SequenceFlow_5 + SequenceFlow_2 + - - - - SequenceFlow_4 - SequenceFlow_5 - + + + + SequenceFlow_4 + SequenceFlow_5 + - - - - SequenceFlow_2 - SequenceFlow_9 - + + + + SequenceFlow_2 + SequenceFlow_9 + - - - - - - - - - - SequenceFlow_9 - SequenceFlow_3 - - - - - - - - - - SequenceFlow_17 - SequenceFlow_14 - - - - SequenceFlow_6 - - - - SequenceFlow_14 - SequenceFlow_6 +uvfm.prepDoUpdateVfModule(execution)]]> + + + + + + + + + + SequenceFlow_9 + SequenceFlow_3 + + + + + + + + + + SequenceFlow_17 + SequenceFlow_14 + + + + SequenceFlow_6 + + + + SequenceFlow_14 + SequenceFlow_6 - - - - SequenceFlow_3 - SequenceFlow_17 - + + + + SequenceFlow_3 + SequenceFlow_17 + - - - - - SequenceFlow_1 - - - - - SequenceFlow_1 - SequenceFlow_7 - + + + + + SequenceFlow_1 + + + + + SequenceFlow_1 + SequenceFlow_7 + - - - - - - - - - - SequenceFlow_7 - SequenceFlow_19 - - - SequenceFlow_19 - - - - - - SequenceFlow_12 - - - - SequenceFlow_12 - - - - - SequenceFlow_4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +]]> + + + + + + + + + + SequenceFlow_7 + SequenceFlow_19 + + + SequenceFlow_19 + + + + + + SequenceFlow_12 + + + + SequenceFlow_12 + + + + + SequenceFlow_4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/UpdateVfModuleVolumeInfraV1.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn similarity index 94% rename from bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/UpdateVfModuleVolumeInfraV1.bpmn rename to bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn index b98a4de8e2..75b88b2e8d 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/process/Infrastructure/UpdateVfModuleVolumeInfraV1.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVfModuleVolumeInfraV1.bpmn @@ -1,516 +1,517 @@ - - - - - SequenceFlow_1 - - - - - - - - - - - SequenceFlow_13 - SequenceFlow_14 - - - - - - http-connector - - ${URN_mso_adapters_db_endpoint} - ${UPDVfModVol_updateInfraRequest} - - - aapplication/soap+xml - - - POST - ${response} - ${statusCode} - - - - SequenceFlow_11 - SequenceFlow_12 - - - - SequenceFlow_22 - SequenceFlow_21 - + + + + SequenceFlow_1 + + + + + + + + + + + SequenceFlow_13 + SequenceFlow_14 + + + + + + http-connector + + ${URN_mso_adapters_db_endpoint} + ${UPDVfModVol_updateInfraRequest} + + + #{BasicAuthHeaderValueDB} + aapplication/soap+xml + + + POST + ${response} + ${statusCode} + + + + SequenceFlow_11 + SequenceFlow_12 + + + + SequenceFlow_22 + SequenceFlow_21 + - - - - SequenceFlow_12 - SequenceFlow_13 - + + + + SequenceFlow_12 + SequenceFlow_13 + - - - - - - - - - - - - SequenceFlow_21 - SequenceFlow_19 - - - - SequenceFlow_19 - SequenceFlow_11 - + + + + + + + + + + + + SequenceFlow_21 + SequenceFlow_19 + + + + SequenceFlow_19 + SequenceFlow_11 + - - - - SequenceFlow_14 - SequenceFlow_1 +uvmv.executeMethod('prepDbInfraDbRequest', execution, isDebugLogEnabled)]]> + + + + SequenceFlow_14 + SequenceFlow_1 - - - - SequenceFlow_noVfModuleRelation - SequenceFlow_personaModelIdMatchYes - SequenceFlow_22 - - - - SequenceFlow_7 - - - - SequenceFlow_6 - - - - - SequenceFlow_7 - SequenceFlow_4 - + + + + SequenceFlow_noVfModuleRelation + SequenceFlow_personaModelIdMatchYes + SequenceFlow_22 + + + + SequenceFlow_7 + + + + SequenceFlow_6 + + + + + SequenceFlow_7 + SequenceFlow_4 + - - - - - - - - - - - - - SequenceFlow_4 - SequenceFlow_6 - - - - - - SequenceFlow_8 - SequenceFlow_personaModelIdMatchYes - SequenceFlow_personaModelidMatchNo - - - #{UPDVfModVol_modelInvariantId == UPDVfModVol_personaModelId} - - - - SequenceFlow_YesVfModuleRelation - SequenceFlow_8 - + + + + + + + + + + + + + SequenceFlow_4 + SequenceFlow_6 + + + + + + SequenceFlow_8 + SequenceFlow_personaModelIdMatchYes + SequenceFlow_personaModelidMatchNo + + + #{UPDVfModVol_modelInvariantId == UPDVfModVol_personaModelId} + + + + SequenceFlow_YesVfModuleRelation + SequenceFlow_8 + - - - - SequenceFlow_personaModelidMatchNo - SequenceFlow_18 - + + + + SequenceFlow_personaModelidMatchNo + SequenceFlow_18 + - - - - SequenceFlow_18 - - - - SequenceFlow_3 - SequenceFlow_2 - + + + + SequenceFlow_18 + + + + SequenceFlow_3 + SequenceFlow_2 + - - - - SequenceFlow_3 - - - - SequenceFlow_2 - SequenceFlow_20 - + + + + SequenceFlow_3 + + + + SequenceFlow_2 + SequenceFlow_20 + - - - - SequenceFlow_tenantIsMatch - SequenceFlow_YesVfModuleRelation - SequenceFlow_noVfModuleRelation - - - #{UPDVfModVol_relatedVfModuleLink != ''} - - - - SequenceFlow_15 - SequenceFlow_NoTenantMatch - SequenceFlow_tenantIsMatch - - - - #{UPDVfModVol_tenantId == UPDVfModVol_volumeGroupTenantId} - - - SequenceFlow_NoTenantMatch - SequenceFlow_17 - + + + + SequenceFlow_tenantIsMatch + SequenceFlow_YesVfModuleRelation + SequenceFlow_noVfModuleRelation + + + #{UPDVfModVol_relatedVfModuleLink != ''} + + + + SequenceFlow_15 + SequenceFlow_NoTenantMatch + SequenceFlow_tenantIsMatch + + + + #{UPDVfModVol_tenantId == UPDVfModVol_volumeGroupTenantId} + + + SequenceFlow_NoTenantMatch + SequenceFlow_17 + - - - - SequenceFlow_17 - - - - SequenceFlow_5 - SequenceFlow_15 - + + + + SequenceFlow_17 + + + + SequenceFlow_5 + SequenceFlow_15 + - - - - SequenceFlow_20 - SequenceFlow_5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uvmv.executeMethod('queryAAIForVolumeGroup', execution, isDebugLogEnabled)]]> + + + + SequenceFlow_20 + SequenceFlow_5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/processengine.properties b/bpmn/MSOInfrastructureBPMN/src/main/resources/processengine.properties new file mode 100644 index 0000000000..d071fdabf8 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/processengine.properties @@ -0,0 +1,20 @@ +### +# ============LICENSE_START======================================================= +# ECOMP 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========================================================= +### +processEngineName=infrastructure diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn new file mode 100644 index 0000000000..59f82013b1 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstance.bpmn @@ -0,0 +1,1385 @@ + + + + + SequenceFlow_1n61wit + + + isReturnCode404_No_SequenceFlow + + + + isNetworkActiveNo_SequenceFlow + isReturnCode404_Yes_SequenceFlow + SequenceFlow_21 + + + + SequenceFlow_21 + isNameSentNo_SequenceFlow + SequenceFlow_32 + + + + + isSdncRpc1No_SequenceFlow1 + SequenceFlow_11 + + + + + SequenceFlow_12 + SequenceFlow_0d93bqw + SequenceFlow_5 + + + + SequenceFlow_5 + sdncTopoNo_SequenceFlow + sdncTopoYes_SequenceFlow + + + + + + + + SequenceFlow_34 + + + + + sdncTopoNo_SequenceFlow + SequenceFlow_34 + + + + sdncTopoYes_SequenceFlow + SequenceFlow_16 + + + + + + + + + + + + + + SequenceFlow_11 + SequenceFlow_12 + + + + SequenceFlow_59 + SequenceFlow_13 + + + + isAAIQueryNameYes_SequenceFlow + isNetworkActiveYes_SequenceFlow + isNetworkActiveNo_SequenceFlow + + + + + + + SequenceFlow_6 + isAAIQueryNameNo_SequenceFlow + isAAIQueryNameYes_SequenceFlow + + + + + + + isAAIQueryNameNo_SequenceFlow + isReturnCode404_No_SequenceFlow + isReturnCode404_Yes_SequenceFlow + + + + + + + + SequenceFlow_23 + + + + + isRollbackOn_SequenceFlow_Yes + isPONR_Yes_SequenceFlow + isPONR_No_SequenceFlow + + + + + + + SequenceFlow_0k7y7b5 + sdncOk_Yeso_ExclusiveGateway + sdncOk_No_ExclusiveGateway + + + + + + + isSdncRpc4No_SequenceFlow4 + SequenceFlow_0lndbvr + + + + isPONR_No_SequenceFlow + SequenceFlow_0cly7z2 + SequenceFlow_12tlymf + + + + + + + sdncOk_Yeso_ExclusiveGateway + isSdncRpc4Yes_SequenceFlow4 + isSdncRpc4No_SequenceFlow4 + + + + + + + isSdncRpc4Yes_SequenceFlow4 + SequenceFlow_0bwpkkb + + + + SequenceFlow_1qwubew + + + SequenceFlow_15sffxc + SequenceFlow_096tad6 + + + + + SequenceFlow_0cly7z2 + SequenceFlow_0b8j5rw + + + + + + + + + + + + + + + + + + SequenceFlow_096tad6 + SequenceFlow_0vzsyrd + + + + + + + SequenceFlow_0vzsyrd + SequenceFlow_17nx822 + SequenceFlow_1qwubew + + + + + SequenceFlow_10ttvwn + isRollbackOn_SequenceFlow_Yes + isRollbackOn_SequenceFlow_No + + + + + + + SequenceFlow_0lndbvr + sdncOk_No_ExclusiveGateway + SequenceFlow_0bwpkkb + SequenceFlow_15sffxc + + + + SequenceFlow_0b8j5rw + SequenceFlow_12tlymf + SequenceFlow_0k7y7b5 + + + + isPONR_Yes_SequenceFlow + isRollbackOn_SequenceFlow_No + SequenceFlow_17nx822 + + + + SequenceFlow_23 + SequenceFlow_10ttvwn + + + + + + + PO Network Rollback is created in validation. + + + + + + + + ${CRENWKI_createNetworkRequest} + ${URN_mso_adapters_network_rest_endpoint} + + + #{BasicAuthHeaderValuePO} + application/xml + + + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_61 + SequenceFlow_59 + + + + + isSdncRpc2No_SequenceFlow2 + SequenceFlow_1jia57e + SequenceFlow_35 + + + + + SequenceFlow_35 + SequenceFlow_1ipz2ze + + + + + SequenceFlow_10 + SequenceFlow_14 + + + + + SequenceFlow_10 + + + + + SequenceFlow_14 + + + + + + + + + + + + + SequenceFlow_0ftylq3 + SequenceFlow_3 + + + isNameSentYes_SequenceFlow + SequenceFlow_6 + + + + + + SequenceFlow_3 + siFoundYes + siFoundNo + + + + + + + siFoundNo + SequenceFlow_30 + + + + + SequenceFlow_30 + + + + SequenceFlow_16 + SequenceFlow_15 + + + + + SequenceFlow_15 + SequenceFlow_38 + + + + + SequenceFlow_20 + SequenceFlow_61 + + + + + SequenceFlow_38 + SequenceFlow_20 + + + + + + SequenceFlow_1n61wit + SequenceFlow_0ftylq3 + + + + + siFoundYes + isNameSentYes_SequenceFlow + isNameSentNo_SequenceFlow + + + + + + + + + + + + + + + + SequenceFlow_13deudk + SequenceFlow_08qibb9 + + + isSdncRpc2Yes_SequenceFlow2 + SequenceFlow_13deudk + + + + SequenceFlow_1t03rs2 + SequenceFlow_1jia57e + SequenceFlow_18ybfu5 + + + + + + + + + + SequenceFlow_08qibb9 + SequenceFlow_1t03rs2 + + + + SequenceFlow_0s51ns0 + + + + + SequenceFlow_18ybfu5 + SequenceFlow_0s51ns0 + + + + SequenceFlow_32 + isSdncRpc1No_SequenceFlow1 + isSdncRpc1Yes_SequenceFlow1 + + + + + + + + + + + + + + + + SequenceFlow_0j8bxnb + SequenceFlow_0d93bqw + + + + + SequenceFlow_13 + isSdncRpc2Yes_SequenceFlow2 + isSdncRpc2No_SequenceFlow2 + + + + + + + isSdncRpc1Yes_SequenceFlow1 + SequenceFlow_0j8bxnb + + + + SequenceFlow_1s8b1m1 + + + SequenceFlow_18ylufb + + + + SequenceFlow_1ipz2ze + SequenceFlow_1s8b1m1 + + + + + isNetworkActiveYes_SequenceFlow + SequenceFlow_18ylufb + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstanceRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstanceRollback.bpmn new file mode 100644 index 0000000000..00ef41c168 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateNetworkInstanceRollback.bpmn @@ -0,0 +1,517 @@ + + + + + SequenceFlow_1krl2dg + + + SequenceFlow_1krl2dg + SequenceFlow_0u41iz2 + + + + + + + + + + + + + + + SequenceFlow_1mxbdps + SequenceFlow_07s5r14 + + + + + + + + + + + + SequenceFlow_0mw0dgd + SequenceFlow_1rrutp3 + + + SequenceFlow_0u41iz2 + SequenceFlow_1bb7zpp + SequenceFlow_1mxbdps + + + SequenceFlow_1bb7zpp + SequenceFlow_07s5r14 + SequenceFlow_0e1uixp + SequenceFlow_1lteduj + + + + + + + + + + + + SequenceFlow_101y57s + SequenceFlow_0790olb + + + SequenceFlow_0virkpu + SequenceFlow_101y57s + SequenceFlow_0mw0dgd + + + SequenceFlow_0qc4v9t + SequenceFlow_0el8yzs + SequenceFlow_0yto4gz + + + + SequenceFlow_1lteduj + SequenceFlow_17o4w67 + SequenceFlow_0virkpu + SequenceFlow_0qc4v9t + + + + + + + + + + + + + + + + + + + + SequenceFlow_0yto4gz + + + + + + + SequenceFlow_0xktw7v + SequenceFlow_0soe5t3 + + + + SequenceFlow_0xktw7v + + + + SequenceFlow_0soe5t3 + + + + + + SequenceFlow_1rrutp3 + SequenceFlow_0790olb + SequenceFlow_0el8yzs + + + + + + SequenceFlow_0lomcvn + + + SequenceFlow_0q0te67 + SequenceFlow_0lomcvn + + + + + + SequenceFlow_0q0te67 + + + + + SequenceFlow_0ctlrql + + + + + SequenceFlow_0ctlrql + + + + SequenceFlow_1j55a94 + + + + SequenceFlow_1yn24xq + + + + SequenceFlow_1j55a94 + SequenceFlow_1yn24xq + + + + + + SequenceFlow_0e1uixp + SequenceFlow_17o4w67 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstance.bpmn new file mode 100644 index 0000000000..302620fdaf --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstance.bpmn @@ -0,0 +1,390 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_2 + SequenceFlow_3 + + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + SequenceFlow_156ih25 + SequenceFlow_14 + + + + SequenceFlow_9 + SequenceFlow_10 + + + + + + + + + + + + SequenceFlow_14 + SequenceFlow_9 + + + SequenceFlow_10 + + + + + + + + + + + + + + + SequenceFlow_11fnnkb + SequenceFlow_4 + + + + + + + + + + + + + SequenceFlow_1uw2p9a + SequenceFlow_1w01tqs + SequenceFlow_129ih1g + + + + SequenceFlow_3 + SequenceFlow_11fnnkb + SequenceFlow_1uw2p9a + + + + + + + + SequenceFlow_0tgrn11 + + + + SequenceFlow_1xzgv5k + + + + + + + + + + SequenceFlow_1lqktwf + SequenceFlow_0eumzpf + + + + + SequenceFlow_0tgrn11 + SequenceFlow_1lqktwf + + + + + SequenceFlow_0eumzpf + SequenceFlow_1xzgv5k + + + + + + SequenceFlow_1dd86x8 + SequenceFlow_156ih25 + SequenceFlow_00v4npo + + + + SequenceFlow_00v4npo + + + + + + SequenceFlow_4 + SequenceFlow_1w01tqs + + + + + SequenceFlow_129ih1g + SequenceFlow_1dd86x8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn new file mode 100644 index 0000000000..e73c79d953 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn @@ -0,0 +1,338 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + SequenceFlow_01l4ssl + + + + SequenceFlow_8 + + + + SequenceFlow_7 + + + + SequenceFlow_8 + SequenceFlow_7 + + + + + + + + + + + + + + + + + SequenceFlow_1x9eh33 + SequenceFlow_05wu9i7 + + + SequenceFlow_06aasqh + SequenceFlow_11fnnkb + SequenceFlow_1uw2p9a + + + + + + + rollback AAI + SequenceFlow_1uw2p9a + SequenceFlow_0khjo7l + SequenceFlow_1n7wade + SequenceFlow_1x9eh33 + + + + + + + + + + + + + + + + + SequenceFlow_11fnnkb + SequenceFlow_0k28xib + + + SequenceFlow_0k28xib + SequenceFlow_0khjo7l + + + + + SequenceFlow_2 + SequenceFlow_06aasqh + SequenceFlow_1rzlaoy + + + SequenceFlow_05wu9i7 + SequenceFlow_1n7wade + SequenceFlow_1rzlaoy + SequenceFlow_01l4ssl + + + + + + + + + + SequenceFlow_1ch4xrf + + + + SequenceFlow_1ch4xrf + SequenceFlow_1pjk2ff + + + + SequenceFlow_1pjk2ff + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/DoCreateVfModule.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModule.bpmn similarity index 54% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/DoCreateVfModule.bpmn rename to bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModule.bpmn index 46b4e1fc02..62eb91810f 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/DoCreateVfModule.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModule.bpmn @@ -1,830 +1,1006 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_15 - - - - - SequenceFlow_15 - SequenceFlow_11 - SequenceFlow_40 - - - - - - - - - - - - - - SequenceFlow_43 - SequenceFlow_17 - - - - SequenceFlow_17 - SequenceFlow_19 - SequenceFlow_21 - - - + + + + SequenceFlow_1 + + + + SequenceFlow_15 + + + + + SequenceFlow_15 + SequenceFlow_11 + SequenceFlow_40 + + + + + + + + + + + + + + SequenceFlow_43 + SequenceFlow_17 + + + + SequenceFlow_17 + SequenceFlow_19 + SequenceFlow_21 + + + - - - - - - - - - - - - SequenceFlow_19 - SequenceFlow_35 - - - - SequenceFlow_11 - SequenceFlow_21 - SequenceFlow_35 - SequenceFlow_6 - - - - - - - - - - - - - SequenceFlow_18 - SequenceFlow_20 - - - SequenceFlow_20 - SequenceFlow_22 - + + + + + + + + + + + + SequenceFlow_19 + SequenceFlow_35 + + + + SequenceFlow_11 + SequenceFlow_21 + SequenceFlow_35 + SequenceFlow_6 + + + + + + + + + + + + + SequenceFlow_18 + SequenceFlow_20 + + + SequenceFlow_20 + SequenceFlow_22 + - - - SequenceFlow_8 - SequenceFlow_18 - + + + SequenceFlow_8 + SequenceFlow_18 + - - - - - SequenceFlow_22 - SequenceFlow_23 - + + + + + SequenceFlow_22 + SequenceFlow_23 + - - - - - - - - - - - - SequenceFlow_23 - SequenceFlow_24 - - - - - - SequenceFlow_24 - SequenceFlow_31 - + + + + + + + + + + + + SequenceFlow_23 + SequenceFlow_24 + + + + + + SequenceFlow_24 + SequenceFlow_31 + - - - - - - - - - SequenceFlow_5 - SequenceFlow_10 - - - SequenceFlow_26 - SequenceFlow_5 - + + + + + + + + + SequenceFlow_5 + SequenceFlow_10 + + + SequenceFlow_1avfxsz + SequenceFlow_5 + - - - SequenceFlow_10 - SequenceFlow_12 - + + + SequenceFlow_10 + SequenceFlow_12 + - - - - - - - - - - - - SequenceFlow_12 - SequenceFlow_13 - - - SequenceFlow_13 - SequenceFlow_14 - + + + + + + + + + + + + SequenceFlow_12 + SequenceFlow_13 + + + SequenceFlow_13 + SequenceFlow_14 + - - - SequenceFlow_14 - SequenceFlow_28 - SequenceFlow_30 - - - + + + SequenceFlow_14 + SequenceFlow_28 + SequenceFlow_30 + + + - - - - - - - - - SequenceFlow_26 - - - - - SequenceFlow_8 - - - - - SequenceFlow_28 - SequenceFlow_3 - - - - - - - - - - SequenceFlow_3 - SequenceFlow_29 - - - - - SequenceFlow_30 - SequenceFlow_29 - SequenceFlow_16 - - - - SequenceFlow_31 - SequenceFlow_32 - + + + + + + + + + SequenceFlow_0363dz7 + + + + SequenceFlow_8 + + + + + SequenceFlow_28 + SequenceFlow_3 + - - - - - - - - - - - SequenceFlow_32 - SequenceFlow_33 - - - SequenceFlow_33 - SequenceFlow_34 - + + + + + + + + + SequenceFlow_3 + SequenceFlow_29 + + + + + SequenceFlow_30 + SequenceFlow_29 + SequenceFlow_16 + + + + SequenceFlow_31 + SequenceFlow_32 + - - - SequenceFlow_34 - - - - - - - - - - - - - - - - SequenceFlow_6 - SequenceFlow_25 - - - SequenceFlow_41 - - - - SequenceFlow_39 - SequenceFlow_37 - SequenceFlow_41 - - - SequenceFlow_25 - SequenceFlow_27 - + + + + + + + + + + + SequenceFlow_32 + SequenceFlow_33 + + + SequenceFlow_33 + SequenceFlow_1ushk1d + - - - - - SequenceFlow_27 - SequenceFlow_36 - SequenceFlow_39 - - - - - - - SequenceFlow_36 - SequenceFlow_37 - + + + SequenceFlow_0xfanpi + SequenceFlow_0abffyj + + + + + + + SequenceFlow_41 + + + + SequenceFlow_39 + SequenceFlow_37 + SequenceFlow_41 + + + SequenceFlow_25 + SequenceFlow_27 + - - - - - SequenceFlow_16 - SequenceFlow_7 - + + + + SequenceFlow_27 + SequenceFlow_36 + SequenceFlow_39 + + + + + + + SequenceFlow_36 + SequenceFlow_37 + - - - - SequenceFlow_7 - - - - SequenceFlow_40 - SequenceFlow_43 - + + + + + SequenceFlow_16 + SequenceFlow_7 + - - - + + + + SequenceFlow_7 + + + + SequenceFlow_40 + SequenceFlow_43 + - - - - - SequenceFlow_9 - SequenceFlow_38 - + + + - - - - SequenceFlow_9 - - - - - SequenceFlow_38 - - - - SequenceFlow_1 - SequenceFlow_4 - + + + + + SequenceFlow_9 + SequenceFlow_38 + - - - - SequenceFlow_4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +doCreateVfModule.processBPMNException(execution)]]> + + + + SequenceFlow_9 + + + + + SequenceFlow_38 + + + + SequenceFlow_1 + SequenceFlow_4 + + + + + SequenceFlow_4 + + + + + + + + + + + + + + + + + + + + + SequenceFlow_6 + SequenceFlow_25 + + + + SequenceFlow_1ushk1d + SequenceFlow_0ery1pk + SequenceFlow_0xfanpi + + + + + + + + + SequenceFlow_0ery1pk + SequenceFlow_0abffyj + + + + SequenceFlow_0363dz7 + SequenceFlow_0bi38s7 + SequenceFlow_1k5uku2 + + + SequenceFlow_112los9 + SequenceFlow_1k5uku2 + SequenceFlow_1avfxsz + + + + + + + + + + + SequenceFlow_0bi38s7 + SequenceFlow_1qm81ym + + + + + + + + + + + SequenceFlow_1qm81ym + SequenceFlow_112los9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn similarity index 50% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn rename to bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn index 49e612f543..0444b69633 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn @@ -1,520 +1,674 @@ - - - - - SequenceFlow_1 - - - - SequenceFlow_5 - SequenceFlow_6 - SequenceFlow_9 - - - SequenceFlow_6 - SequenceFlow_7 - + + + + SequenceFlow_1 + + + + SequenceFlow_5 + SequenceFlow_6 + SequenceFlow_9 + + + SequenceFlow_6 + SequenceFlow_7 + - - - - - - - - - SequenceFlow_7 - SequenceFlow_8 - - - - - - - - - SequenceFlow_8 - SequenceFlow_9 - SequenceFlow_10 - SequenceFlow_15 - - - SequenceFlow_10 - SequenceFlow_16 - + + + + + + + + + SequenceFlow_7 + SequenceFlow_8 + + + + + + + + + SequenceFlow_8 + SequenceFlow_9 + SequenceFlow_10 + SequenceFlow_15 + + + SequenceFlow_1p0v6yk + SequenceFlow_16 + - - - - - - - - - - - - SequenceFlow_16 - SequenceFlow_11 - - - - - - - - SequenceFlow_13 - SequenceFlow_14 - + + + + + + + + + + + + SequenceFlow_16 + SequenceFlow_11 + + + + + + + + SequenceFlow_13 + SequenceFlow_14 + - - - - - - - - - SequenceFlow_14 - SequenceFlow_18 - - - - SequenceFlow_11 - SequenceFlow_15 - SequenceFlow_13 - SequenceFlow_17 - - - - - - - SequenceFlow_17 - SequenceFlow_18 - SequenceFlow_19 - SequenceFlow_20 - - - - - - - SequenceFlow_19 - SequenceFlow_32 - + + + + + + + + + SequenceFlow_14 + SequenceFlow_18 + + + + SequenceFlow_11 + SequenceFlow_03i4czf + SequenceFlow_13 + SequenceFlow_17 + + + + + + + SequenceFlow_17 + SequenceFlow_18 + SequenceFlow_19 + SequenceFlow_20 + + + + + + + SequenceFlow_19 + SequenceFlow_32 + - - - - - - - - - - - - - SequenceFlow_32 - SequenceFlow_2 - - - SequenceFlow_20 - SequenceFlow_4 - SequenceFlow_21 - SequenceFlow_24 - - - - - - - - - - - - - SequenceFlow_34 - SequenceFlow_35 - - - - SequenceFlow_35 - SequenceFlow_21 - - - SequenceFlow_24 - SequenceFlow_34 - + + + + + + + + + + + + + SequenceFlow_32 + SequenceFlow_2 + + + SequenceFlow_20 + SequenceFlow_4 + SequenceFlow_21 + SequenceFlow_24 + + + + + + + + + + + + + SequenceFlow_34 + SequenceFlow_35 + + + + SequenceFlow_35 + SequenceFlow_21 + + + SequenceFlow_24 + SequenceFlow_34 + - - - - - SequenceFlow_2 - SequenceFlow_4 - + + + + + SequenceFlow_2 + SequenceFlow_4 + - - - - - SequenceFlow_12 - - - - SequenceFlow_22 - - - - SequenceFlow_12 - SequenceFlow_22 - + + + + + SequenceFlow_12 + + + + SequenceFlow_22 + + + + SequenceFlow_12 + SequenceFlow_22 + - - - - - SequenceFlow_23 - - - - SequenceFlow_23 - - - - SequenceFlow_1 - SequenceFlow_5 - + + + + + SequenceFlow_23 + + + + SequenceFlow_23 + + + + SequenceFlow_1 + SequenceFlow_5 + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +dcvfmr.preProcessRequest(execution)]]> + + + + SequenceFlow_0djpj3r + SequenceFlow_15 + SequenceFlow_185bo77 + SequenceFlow_111l1he + + + SequenceFlow_10 + SequenceFlow_0djpj3r + + + + SequenceFlow_111l1he + SequenceFlow_0ca4brn + + + + + + + + + + + SequenceFlow_0ca4brn + SequenceFlow_19r2uus + + + + SequenceFlow_185bo77 + SequenceFlow_19r2uus + SequenceFlow_1p0v6yk + SequenceFlow_03i4czf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeV1.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeV1.bpmn similarity index 95% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeV1.bpmn rename to bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeV1.bpmn index 9477aac5e8..de88284db6 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeV1.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeV1.bpmn @@ -1,675 +1,675 @@ - - - - - SequenceFlow_1 - SequenceFlow_22 - + + + + SequenceFlow_1 + SequenceFlow_22 + - - - - SequenceFlow_22 - SequenceFlow_23 - + + + + SequenceFlow_22 + SequenceFlow_23 + - - - - SequenceFlow_volGrpName404No - SequenceFlow_7 - + + + + SequenceFlow_volGrpName404No + SequenceFlow_7 + - - - - SequenceFlow_19 - SequenceFlow_6 - SequenceFlow_volGrpName404Yes - SequenceFlow_volGrpName404No - - - #{DCVFMODVOLV1_AaiReturnCode == '404'} - - - - SequenceFlow_23 - SequenceFlow_14 - + + + + SequenceFlow_19 + SequenceFlow_6 + SequenceFlow_volGrpName404Yes + SequenceFlow_volGrpName404No + + + #{DCVFMODVOLV1_AaiReturnCode == '404'} + + + + SequenceFlow_23 + SequenceFlow_14 + - - - - SequenceFlow_19 - - - - - SequenceFlow_14 - SequenceFlow_6 - + + + + SequenceFlow_19 + + + + + SequenceFlow_14 + SequenceFlow_6 + - - - - SequenceFlow_volGrpName404Yes - SequenceFlow_9 - + + + + SequenceFlow_volGrpName404Yes + SequenceFlow_9 + - - - - - - - - - - - - - - SequenceFlow_10 - SequenceFlow_3 - - - - SequenceFlow_11 - - - - - SequenceFlow_3 - SequenceFlow_vnfAdapterFail - SequenceFlow_vnfAdapterSuccess - - - - #{VNFREST_SuccessIndicator == true} - - - SequenceFlow_vnfAdapterSuccess - SequenceFlow_28 - + + + + + + + + + + + + + + SequenceFlow_10 + SequenceFlow_3 + + + + SequenceFlow_11 + + + + + SequenceFlow_3 + SequenceFlow_vnfAdapterFail + SequenceFlow_vnfAdapterSuccess + + + + #{VNFREST_SuccessIndicator == true} + + + SequenceFlow_vnfAdapterSuccess + SequenceFlow_28 + - - - - - - - SequenceFlow_5 - SequenceFlow_8 - + + + + + + + SequenceFlow_5 + SequenceFlow_8 + - - - - + + + + - - - SequenceFlow_28 - SequenceFlow_5 - + + + SequenceFlow_28 + SequenceFlow_5 + - - - - SequenceFlow_8 - - - SequenceFlow_9 - SequenceFlow_10 - + + + + SequenceFlow_8 + + + SequenceFlow_9 + SequenceFlow_10 + - - - - - - - SequenceFlow_4 - SequenceFlow_12 - - - - - SequenceFlow_rollbackIsEnabled1 - SequenceFlow_4 - - - - - SequenceFlow_11 - SequenceFlow_17 - SequenceFlow_rollbackIsEnabled1 - SequenceFlow_rollbackIsNotEnabled1 - - - #{DCVFMODVOLV1_rollbackEnabled == true} - - - - SequenceFlow_rollbackIsEnabled2 - SequenceFlow_15 - - - - - SequenceFlow_vnfAdapterFail - SequenceFlow_rollbackIsEnabled2 - SequenceFlow_rollbackIsNotEnabled2 - - - #{DCVFMODVOLV1_rollbackEnabled == true} - - - - SequenceFlow_1 - - - - - - - - - - - - - - SequenceFlow_rollbackEnabledYes91 - SequenceFlow_16 - - - - - SequenceFlow_13 - SequenceFlow_rollbackEnabledYes91 - SequenceFlow_rollbackNotEnabled92 - - - #{DCVFMODVOLV1_rollbackEnabled == true} - - - - SequenceFlow_13 - - - - - SequenceFlow_16 - SequenceFlow_rollbackNotEnabled92 - - - - SequenceFlow_17 - - - - - SequenceFlow_rollbackIsNotEnabled1 - SequenceFlow_12 - - - SequenceFlow_rollbackIsNotEnabled2 - SequenceFlow_15 - - - SequenceFlow_7 - - - WorkflowException should already have been created in VNF create subflow - - - - - - Catch MsoException triggered by Plugin. The vnfAdapterRest subflow is currently not directly throwing the BPMNError(MSOException. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +doCreateVfModuleVolumeV1.executeMethod('prepareVnfAdapterCreateRequest', execution, isDebugLogEnabled)]]> + + + + + + + SequenceFlow_4 + SequenceFlow_12 + + + + + SequenceFlow_rollbackIsEnabled1 + SequenceFlow_4 + + + + + SequenceFlow_11 + SequenceFlow_17 + SequenceFlow_rollbackIsEnabled1 + SequenceFlow_rollbackIsNotEnabled1 + + + #{DCVFMODVOLV1_rollbackEnabled == true} + + + + SequenceFlow_rollbackIsEnabled2 + SequenceFlow_15 + + + + + SequenceFlow_vnfAdapterFail + SequenceFlow_rollbackIsEnabled2 + SequenceFlow_rollbackIsNotEnabled2 + + + #{DCVFMODVOLV1_rollbackEnabled == true} + + + + SequenceFlow_1 + + + + + + + + + + + + + + SequenceFlow_rollbackEnabledYes91 + SequenceFlow_16 + + + + + SequenceFlow_13 + SequenceFlow_rollbackEnabledYes91 + SequenceFlow_rollbackNotEnabled92 + + + #{DCVFMODVOLV1_rollbackEnabled == true} + + + + SequenceFlow_13 + + + + + SequenceFlow_16 + SequenceFlow_rollbackNotEnabled92 + + + + SequenceFlow_17 + + + + + SequenceFlow_rollbackIsNotEnabled1 + SequenceFlow_12 + + + SequenceFlow_rollbackIsNotEnabled2 + SequenceFlow_15 + + + SequenceFlow_7 + + + WorkflowException should already have been created in VNF create subflow + + + + + + Catch MsoException triggered by Plugin. The vnfAdapterRest subflow is currently not directly throwing the BPMNError(MSOException. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnf.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnf.bpmn new file mode 100644 index 0000000000..91fca3d213 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnf.bpmn @@ -0,0 +1,475 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + notFound + SequenceFlow_6 + + + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_4 + + + + SequenceFlow_4 + notFound + found + + + + + + + SequenceFlow_7 + vnfExistYes + vnfExistNo + + + + + + + + + + + + + + + + found + SequenceFlow_7 + + + + vnfExistYes + SequenceFlow_10 + + + + + SequenceFlow_6 + + + + SequenceFlow_10 + + + + vnfExistNo + SequenceFlow_11 + + + + + + + + + + + + + SequenceFlow_11 + SequenceFlow_1acnwwu + + + + SequenceFlow_8 + SequenceFlow_9 + + + + + SequenceFlow_9 + + + SequenceFlow_8 + + + + + + SequenceFlow_15z3gpq + SequenceFlow_0ay5l4b + + + + + + + + + + + SequenceFlow_0ttqcwx + SequenceFlow_1q6udwm + + + + + + + + + + + + + SequenceFlow_1q6udwm + SequenceFlow_15knw0q + + + SequenceFlow_15knw0q + SequenceFlow_0c5h00o + + + + SequenceFlow_0c5h00o + SequenceFlow_1lalmvp + + + + + + + + + + + + + SequenceFlow_1lalmvp + SequenceFlow_0eb41vb + + + SequenceFlow_0eb41vb + SequenceFlow_15z3gpq + + + + SequenceFlow_1acnwwu + SequenceFlow_0ttqcwx + SequenceFlow_0ay5l4b + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn new file mode 100644 index 0000000000..58a88c2b56 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn @@ -0,0 +1,352 @@ + + + + + SequenceFlow_0o4vuzt + + + SequenceFlow_0o4vuzt + SequenceFlow_1xd3ri5 + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1hf7k7q + SequenceFlow_02oe9wx + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1lh21yl + SequenceFlow_1llbx0k + + + SequenceFlow_1llbx0k + SequenceFlow_1mguf2m + + + + SequenceFlow_132bohl + + + + + + + + + + SequenceFlow_02oe9wx + SequenceFlow_07gl6gw + SequenceFlow_132bohl + SequenceFlow_0jz6bqn + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1xd3ri5 + SequenceFlow_08i3uo6 + + + SequenceFlow_0jz6bqn + SequenceFlow_12x4dvf + + + + SequenceFlow_08i3uo6 + SequenceFlow_1ifw9tw + + + + + SequenceFlow_1mguf2m + SequenceFlow_12x4dvf + SequenceFlow_0kld3qt + SequenceFlow_1vrogpr + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1ifw9tw + SequenceFlow_1hf7k7q + + + + + + + + + + + SequenceFlow_0kld3qt + SequenceFlow_1lh21yl + + + + + + SequenceFlow_1vrogpr + SequenceFlow_07gl6gw + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstance.bpmn new file mode 100644 index 0000000000..84b6d68149 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstance.bpmn @@ -0,0 +1,933 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_0msqfwu + SequenceFlow_6 + + + + + + + + + + + + + + SequenceFlow_1pdp4d2 + SequenceFlow_12 + + + + SequenceFlow_12 + SequenceFlow_1jnva78 + SequenceFlow_5 + + + + + SequenceFlow_8 + + + + + SequenceFlow_5 + sdncTopoDeleteNo_SequenceFlow + sdncTopoDeleteYes_SequenceFlow + + + SequenceFlow_8 + sdncTopoDeleteNo_SequenceFlow + + + + + + + + + SequenceFlow_1a51h25 + + + + SequenceFlow_1yvnovn + + + SequenceFlow_1loz6nk + SequenceFlow_1nl99y6 + SequenceFlow_1yvnovn + + + + + + SequenceFlow_0jb7rws + SequenceFlow_1wif0e5 + + + + SequenceFlow_021b0sz + SequenceFlow_0tiz0kk + SequenceFlow_1suj1nc + + + + + + + + + + + + + + + + + + + + + SequenceFlow_147vc14 + SequenceFlow_1loz6nk + + + + SequenceFlow_0tiz0kk + SequenceFlow_0jb7rws + SequenceFlow_1raa09h + + + + + + SequenceFlow_1suj1nc + SequenceFlow_1raa09h + SequenceFlow_1nl99y6 + + + + + SequenceFlow_1wif0e5 + SequenceFlow_147vc14 + + + + + + + SequenceFlow_1a51h25 + SequenceFlow_021b0sz + + + + + isRelationshipExistNo_SequenceFlow + querySuccessYes_SequenceFlow + querySuccessNo_SequenceFlow + + + + + + + querySuccessNo_SequenceFlow + isReturnCode404_No_SequenceFlow + isReturnCode404_Yes_SequenceFlow + + + + + + + isReturnCode404_No_SequenceFlow + + + + querySuccessYes_SequenceFlow + isResponseEmptyNo_SequenceFlow + isResponseEmptyYes_SequenceFlow + + + + + + + isReturnCode404_Yes_SequenceFlow + isResponseEmptyYes_SequenceFlow + silentSuccess_SequenceFlow + + + + SequenceFlow_0f25bme + + + isResponseEmptyNo_SequenceFlow + SequenceFlow_30 + + + + + SequenceFlow_6 + isRelationshipExistNo_SequenceFlow + isRelationshipExistYes_SequenceFlow + + + + + + + isRelationshipExistYes_SequenceFlow + + + + SequenceFlow_1pbgnr2 + + + SequenceFlow_0r3pvf8 + SequenceFlow_1pdp4d2 + + + + SequenceFlow_2 + SequenceFlow_20 + + + + + SequenceFlow_30 + SequenceFlow_15 + + + + + SequenceFlow_15 + SequenceFlow_2 + + + + + + SequenceFlow_13 + + + + SequenceFlow_17 + + + SequenceFlow_13 + SequenceFlow_17 + + + + + + + sdncTopoDeleteYes_SequenceFlow + SequenceFlow_1pbgnr2 + + + + + + SequenceFlow_20 + SequenceFlow_0r3pvf8 + SequenceFlow_0kqnddy + + + + SequenceFlow_0f13b17 + SequenceFlow_0zlbzad + + + + + + + + + + + + + SequenceFlow_0zlbzad + SequenceFlow_1jnva78 + + + + + + + + SequenceFlow_1 + SequenceFlow_0msqfwu + + + + + silentSuccess_SequenceFlow + SequenceFlow_0f25bme + + + + + + + + + + + + + + SequenceFlow_1o088sy + SequenceFlow_1i3193l + + + SequenceFlow_0kqnddy + SequenceFlow_1o088sy + + + + + SequenceFlow_0n8sf23 + SequenceFlow_1qyo7ot + SequenceFlow_0f13b17 + + + SequenceFlow_1i3193l + SequenceFlow_0n8sf23 + + + + SequenceFlow_08hus4u + + + + + + + + + + + SequenceFlow_08hus4u + SequenceFlow_1qyo7ot + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstanceRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstanceRollback.bpmn new file mode 100644 index 0000000000..17f5ce4a40 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteNetworkInstanceRollback.bpmn @@ -0,0 +1,546 @@ + + + + + SequenceFlow_1krl2dg + + + SequenceFlow_1krl2dg + SequenceFlow_0u41iz2 + + + + + + + + + + + + + + + SequenceFlow_1mxbdps + SequenceFlow_07s5r14 + + + SequenceFlow_0u41iz2 + SequenceFlow_1bb7zpp + SequenceFlow_1mxbdps + + + SequenceFlow_1xokvq6 + SequenceFlow_1xs882r + SequenceFlow_1ucaagl + + + + + + + + + SequenceFlow_1ucaagl + + + + + SequenceFlow_0xktw7v + SequenceFlow_0soe5t3 + + + + SequenceFlow_0xktw7v + + + + SequenceFlow_0soe5t3 + + + + + + SequenceFlow_1hcmrh9 + SequenceFlow_1pi168e + SequenceFlow_1xs882r + + + + SequenceFlow_1bb7zpp + SequenceFlow_07s5r14 + SequenceFlow_1yj3542 + SequenceFlow_18e00sw + + + + + + + ${DELNWKIR_rollbackNetworkRequest} + CRENWKIR_urlRollbackPoNetwork + + + #{BasicAuthHeaderValuePO} + application/xml + + + POST + ${response} + ${statusCode} + + http-connector + + + SequenceFlow_18e00sw + SequenceFlow_1eyt8z2 + + + + + + SequenceFlow_1yj3542 + SequenceFlow_1eyt8z2 + SequenceFlow_1xokvq6 + SequenceFlow_172safw + + + SequenceFlow_172safw + SequenceFlow_1wy1aba + SequenceFlow_1yltkyg + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1yltkyg + SequenceFlow_1hcmrh9 + + + + + + + + + + + + SequenceFlow_1wy1aba + SequenceFlow_1pi168e + + + + + SequenceFlow_1s5yjuu + + + SequenceFlow_01hh1wq + SequenceFlow_1s5yjuu + + + + SequenceFlow_01hh1wq + + + + + + + SequenceFlow_0b0m3o7 + + + + SequenceFlow_141226w + + + + + + SequenceFlow_141226w + SequenceFlow_0b0m3o7 + + + + SequenceFlow_1lr1613 + + + + SequenceFlow_0np0b8p + + + + SequenceFlow_1lr1613 + SequenceFlow_0np0b8p + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn new file mode 100644 index 0000000000..c40f73d059 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn @@ -0,0 +1,332 @@ + + + + + SequenceFlow_0jfgn05 + + + SequenceFlow_0jfgn05 + SequenceFlow_1jqc16k + + + + SequenceFlow_1wyvxwi + + + + + + + + + + + + + SequenceFlow_1w8ao21 + SequenceFlow_0riudmc + SequenceFlow_05wu9i7 + + + + + + + + + + + + + SequenceFlow_0rtflal + SequenceFlow_0k28xib + + + SequenceFlow_0k28xib + SequenceFlow_1w8ao21 + + + + + SequenceFlow_1dwch0k + SequenceFlow_0rtflal + + + + + SequenceFlow_1up0j5r + SequenceFlow_1hcfvcj + SequenceFlow_05jfuko + + + + + + SequenceFlow_05jfuko + + + + + SequenceFlow_1hcfvcj + SequenceFlow_0riudmc + SequenceFlow_1dwch0k + + + + + + + + + + + + + + + + SequenceFlow_1jqc16k + SequenceFlow_1grea1r + + + + SequenceFlow_1grea1r + SequenceFlow_1up0j5r + + + + + + SequenceFlow_05wu9i7 + SequenceFlow_1wyvxwi + + + + + + SequenceFlow_0u33vy6 + + + + SequenceFlow_0hevfee + + + SequenceFlow_0u33vy6 + SequenceFlow_0hevfee + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModule.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModule.bpmn new file mode 100644 index 0000000000..ab0812343b --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModule.bpmn @@ -0,0 +1,422 @@ + + + + + SequenceFlow_0fp1wqz + SequenceFlow_28 + + + + + + + + + + SequenceFlow_28 + SequenceFlow_31 + + + + + + + + + + + SequenceFlow_42 + SequenceFlow_1j9dvfx + + + + + + + + + + + + + SequenceFlow_32 + SequenceFlow_33 + + + + SequenceFlow_1j9dvfx + SequenceFlow_4 + + + + SequenceFlow_31 + SequenceFlow_32 + + + + + + + + + + + + + SequenceFlow_4 + SequenceFlow_01cvxjf + + + SequenceFlow_35 + + + + + + + + + SequenceFlow_34 + SequenceFlow_35 + + + + SequenceFlow_2 + SequenceFlow_34 + + + + + SequenceFlow_33 + SequenceFlow_2 + + + + + SequenceFlow_1 + SequenceFlow_12 + + + + + SequenceFlow_12 + SequenceFlow_42 + + + + + SequenceFlow_1 + + + + + SequenceFlow_0coa90m + SequenceFlow_08g02ch + + + + + + SequenceFlow_01cvxjf + SequenceFlow_0coa90m + + + + + SequenceFlow_08g02ch + SequenceFlow_1yehsyc + SequenceFlow_0ep3hjm + + + + + + + + SequenceFlow_0ep3hjm + SequenceFlow_14l7olw + SequenceFlow_0fp1wqz + + + + + + SequenceFlow_1yehsyc + SequenceFlow_1a7lzhz + + + + + + + + + + + SequenceFlow_1a7lzhz + SequenceFlow_14l7olw + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnf.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnf.bpmn new file mode 100644 index 0000000000..2e9d860ac9 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnf.bpmn @@ -0,0 +1,308 @@ + + + + + SequenceFlow_1 + + + + SequenceFlow_1 + SequenceFlow_2 + + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_5 + + + + SequenceFlow_5 + vnfFound + notFound + + + + + + + vnfFound + SequenceFlow_4 + + + + + notFound + + + + SequenceFlow_4 + inUse + notInUse + + + + + + + inUse + SequenceFlow_8 + + + + + + + + + + + + + notInUse + SequenceFlow_9 + + + SequenceFlow_8 + + + + + + SequenceFlow_19 + + + SequenceFlow_18 + + + + + SequenceFlow_18 + SequenceFlow_19 + + + + + + SequenceFlow_9 + SequenceFlow_12 + SequenceFlow_10 + + + + SequenceFlow_12 + + + + + SequenceFlow_10 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/DoUpdateVfModule.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateVfModule.bpmn similarity index 88% rename from bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/DoUpdateVfModule.bpmn rename to bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateVfModule.bpmn index 2e96035388..5911067a49 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/subprocess/VfModularity/DoUpdateVfModule.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateVfModule.bpmn @@ -1,650 +1,668 @@ - - - - This flow expects its incoming request to be in the variable 'DoUpdateVfModuleRequest'. This flow produces no output. - - SequenceFlow_38 - SequenceFlow_2 - + + + This flow expects its incoming request to be in the variable 'DoUpdateVfModuleRequest'. This flow produces no output. + + SequenceFlow_38 + SequenceFlow_2 + - - - - - - - - - - - - - SequenceFlow_2 - SequenceFlow_15 - - - SequenceFlow_1 - SequenceFlow_38 - + + + + + + + + + + + + + SequenceFlow_2 + SequenceFlow_15 + + + SequenceFlow_1 + SequenceFlow_38 + - - - - - SequenceFlow_6 - SequenceFlow_35 - + + + + + SequenceFlow_6 + SequenceFlow_35 + - - - SequenceFlow_35 - - - - - SequenceFlow_6 - - - - - - SequenceFlow_36 - - - - SequenceFlow_36 - - - - - SequenceFlow_9 - SequenceFlow_18 - SequenceFlow_25 - + + + SequenceFlow_35 + + + + + SequenceFlow_6 + + + + + + SequenceFlow_36 + + + + SequenceFlow_36 + + + + + SequenceFlow_9 + SequenceFlow_18 + SequenceFlow_25 + - - - - - - - - - - - SequenceFlow_25 - SequenceFlow_26 - - - - SequenceFlow_26 - SequenceFlow_27 - + + + + + + + + + + + SequenceFlow_25 + SequenceFlow_26 + + + + SequenceFlow_26 + SequenceFlow_27 + - - - - - - - - - - - SequenceFlow_27 - SequenceFlow_8 - - - - SequenceFlow_8 - SequenceFlow_4 - - - - - SequenceFlow_4 - - - - SequenceFlow_24 - SequenceFlow_13 - + + + + + + + + + + + + + SequenceFlow_27 + SequenceFlow_7 + + + SequenceFlow_24 + SequenceFlow_13 + - - - - - - - - - - - SequenceFlow_14 - SequenceFlow_9 - - - - SequenceFlow_13 - SequenceFlow_14 - SequenceFlow_18 - - - - ${execution.getVariable('DOUPVfMod_skipUpdateGenericVnf')} == true - - - SequenceFlow_1 - - - - SequenceFlow_16 - SequenceFlow_17 - SequenceFlow_12 - + + + + + + + + + + + SequenceFlow_14 + SequenceFlow_9 + + + + SequenceFlow_13 + SequenceFlow_14 + SequenceFlow_18 + + + + ${execution.getVariable('DOUPVfMod_skipUpdateGenericVnf')} == true + + + SequenceFlow_1 + + + + SequenceFlow_16 + SequenceFlow_17 + SequenceFlow_12 + - - - - - - - - - - - - - SequenceFlow_12 - SequenceFlow_3 - - - - - - - - - - - SequenceFlow_21 - SequenceFlow_24 - - - - SequenceFlow_23 - SequenceFlow_21 - + + + + + + + + + + + + + SequenceFlow_12 + SequenceFlow_3 + + + + + + + + + + + SequenceFlow_21 + SequenceFlow_24 + + + + SequenceFlow_23 + SequenceFlow_21 + - - - - SequenceFlow_22 - SequenceFlow_23 - + + + + SequenceFlow_22 + SequenceFlow_23 + - - - - - - - - - - - - SequenceFlow_19 - SequenceFlow_22 - - - SequenceFlow_3 - SequenceFlow_5 - + + + + + + + + + + + + SequenceFlow_19 + SequenceFlow_22 + + + SequenceFlow_3 + SequenceFlow_5 + - - - - - SequenceFlow_5 - SequenceFlow_19 - + + + + + SequenceFlow_5 + SequenceFlow_19 + + + + + + + SequenceFlow_15 + SequenceFlow_28 + SequenceFlow_30 + + + + + + + + + + + + + SequenceFlow_11 + SequenceFlow_17 + + + + SequenceFlow_10 + SequenceFlow_11 + - - - - - - SequenceFlow_15 - SequenceFlow_28 - SequenceFlow_30 - - - - - - - - - - - - - SequenceFlow_11 - SequenceFlow_17 - - - - SequenceFlow_10 - SequenceFlow_11 - + + + + SequenceFlow_29 + SequenceFlow_10 + SequenceFlow_16 + + + ${execution.getVariable('DOUPVfMod_volumeGroupId').isEmpty()} == false + + + + + + + SequenceFlow_30 + SequenceFlow_34 + + + + + + SequenceFlow_28 + SequenceFlow_34 + SequenceFlow_29 + + + + + SequenceFlow_7 + SequenceFlow_20 + - - - - SequenceFlow_29 - SequenceFlow_10 - SequenceFlow_16 - - - ${execution.getVariable('DOUPVfMod_volumeGroupId').isEmpty()} == false - - - - - - - SequenceFlow_30 - SequenceFlow_34 - - - - - - SequenceFlow_28 - SequenceFlow_34 - SequenceFlow_29 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +duvm.validateSDNCResponse(execution, response, "activate")]]> + + + SequenceFlow_20 + SequenceFlow_4 + + + + + SequenceFlow_4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/MSOGammaBPMN/src/main/resources/urn.properties b/bpmn/MSOInfrastructureBPMN/src/main/resources/urn.properties similarity index 89% rename from bpmn/MSOGammaBPMN/src/main/resources/urn.properties rename to bpmn/MSOInfrastructureBPMN/src/main/resources/urn.properties index 44967b75f9..b3fee32765 100644 --- a/bpmn/MSOGammaBPMN/src/main/resources/urn.properties +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/urn.properties @@ -24,7 +24,6 @@ # TODO: Implement a real URN mapping capability. #AAIEndPoint= http://localhost:8080/SoapUIMocks -#AAIEndPoint= http://calypso-36.cif.att.com:8080/SoapUIMocks -AAIEndPoint= http://localhost:8090/ -SDNCEndPoint=http://localhost:8090/SDNCAdapter/ +AAIEndPoint= http://localhost:28090/ +SDNCEndPoint=http://localhost:28090/SDNCAdapter/ msoRollback = true diff --git a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml new file mode 100644 index 0000000000..130f95e171 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + diff --git a/bpmn/MSOGammaBPMN/src/main/webapp/WEB-INF/jboss-web.xml b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/jboss-web.xml similarity index 100% rename from bpmn/MSOGammaBPMN/src/main/webapp/WEB-INF/jboss-web.xml rename to bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/jboss-web.xml diff --git a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/web.xml b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..3bdba77999 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,74 @@ + + + + MSO Infrastructure BPMN Workflow Servlet + + resteasy-servlet + org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher + + javax.ws.rs.Application + org.openecomp.mso.bpmn.infrastructure.workflow.service.WorkflowResourceApplication + + + + resteasy-servlet + /* + + + mso.configuration + MSO_PROP_TOPOLOGY=topology.properties + + + log.configuration + logback.bpmn.xml + + + resteasy.resources + org.openecomp.mso.logger.MsoLoggingServlet,org.openecomp.mso.bpmn.core.HealthCheckHandler + + + LogFilter + org.openecomp.mso.logger.LogFilter + + + LogFilter + /* + + + + HTTPBasicAuth + Authentication for Client Apps + /workflow/* + GET + POST + + + BPMN-Client + + + + BASIC + ApplicationRealm + + + BPMN-Client + + \ No newline at end of file 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 diff --git a/bpmn/MSOMockServer/.gitignore b/bpmn/MSOMockServer/.gitignore new file mode 100644 index 0000000000..f6c8fbcdef --- /dev/null +++ b/bpmn/MSOMockServer/.gitignore @@ -0,0 +1,4 @@ +/bin +/target +/target +/target diff --git a/bpmn/MSOGammaBPMN/WebContent/META-INF/MANIFEST.MF b/bpmn/MSOMockServer/WebContent/META-INF/MANIFEST.MF similarity index 100% rename from bpmn/MSOGammaBPMN/WebContent/META-INF/MANIFEST.MF rename to bpmn/MSOMockServer/WebContent/META-INF/MANIFEST.MF diff --git a/bpmn/MSOMockServer/WebContent/WEB-INF/web.xml b/bpmn/MSOMockServer/WebContent/WEB-INF/web.xml new file mode 100644 index 0000000000..1aa8cdb8d7 --- /dev/null +++ b/bpmn/MSOMockServer/WebContent/WEB-INF/web.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/bpmn/MSOMockServer/pom.xml b/bpmn/MSOMockServer/pom.xml new file mode 100644 index 0000000000..268f392977 --- /dev/null +++ b/bpmn/MSOMockServer/pom.xml @@ -0,0 +1,95 @@ + + + org.openecomp.mso + bpmn + 1.1.0-SNAPSHOT + + 4.0.0 + org.openecomp.mso + MSOMockServer + war + + + + + + org.apache.maven.plugins + maven-war-plugin + 2.4 + + true + true + false + + + + + + + + com.github.tomakehurst + wiremock + 1.56 + standalone + + + org.mortbay.jetty + jetty + + + com.google.guava + guava + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-databind + + + org.apache.httpcomponents + httpclient + + + org.skyscreamer + jsonassert + + + xmlunit + xmlunit + + + com.jayway.jsonpath + json-path + + + net.sf.jopt-simple + jopt-simple + + + + + javax.ws.rs + javax.ws.rs-api + 2.0 + + + org.jboss.resteasy + resteasy-client + 3.0.8.Final + + + org.apache.httpcomponents + httpclient + + + + + \ No newline at end of file diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/FileUtil.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/FileUtil.java new file mode 100644 index 0000000000..12231c9ee5 --- /dev/null +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/FileUtil.java @@ -0,0 +1,64 @@ +/*- + * ============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.mock; + +import java.io.IOException; +import java.io.InputStream; + +public class FileUtil { + + /** + * Read the specified resource file and return the contents as a String. + * + * @param fileName Name of the resource file + * @return the contents of the resource file as a String + * @throws IOException if there is a problem reading the file + */ + public static String readResourceFile(String fileName) { + InputStream stream; + try { + stream = getResourceAsStream(fileName); + byte[] bytes; + bytes = new byte[stream.available()]; + stream.read(bytes); + stream.close(); + return new String(bytes); + } catch (IOException e) { + return ""; + } + } + + /** + * Get an InputStream for the resource specified. + * + * @param resourceName Name of resource for which to get InputStream. + * @return an InputStream for the resource specified. + * @throws IOException If we can't get the InputStream for whatever reason. + */ + private static InputStream getResourceAsStream(String resourceName) throws IOException { + InputStream stream = + FileUtil.class.getClassLoader().getResourceAsStream(resourceName); + if (stream == null) { + throw new IOException("Can't access resource '" + resourceName + "'"); + } + return stream; + } +} diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResource.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResource.java new file mode 100644 index 0000000000..8b8bea6a8d --- /dev/null +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResource.java @@ -0,0 +1,207 @@ +/*- + * ============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.mock; + +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; + +import java.util.HashMap; +import java.util.Map; + +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Response; + +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.client.WireMock; + +/** + * + * Mock Resource which is used to start, stop the WireMock Server + * Also up to 50 mock properties can be added at run-time to change the properties used in transformers such as sdnc_delay in SDNCAdapterMockTransformer + * You can also selectively setup a stub (use reset before setting up), reset all stubs + */ +@Path("/server") +public class MockResource { + + private boolean started = false; + private final Integer defaultPort = 28090; + private WireMockServer wireMockServer = null; + private static Map mockProperties = new HashMap(); + + public static String getMockProperties(String key) { + return mockProperties.get(key); + } + + private synchronized void initMockServer(int portNumber) { + String path = FileUtil.class.getClassLoader().getResource("__files/sdncSimResponse.xml").getFile(); + path = path.substring(0,path.indexOf("__files/")); + + wireMockServer = new WireMockServer(wireMockConfig().port(portNumber).extensions("org.openecomp.mso.bpmn.mock.SDNCAdapterMockTransformer") + .extensions("org.openecomp.mso.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer") + .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterCreateMockTransformer") + .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterDeleteMockTransformer") + .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterUpdateMockTransformer") + .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterRollbackMockTransformer") + .extensions("org.openecomp.mso.bpmn.mock.VnfAdapterQueryMockTransformer")); + //.withRootDirectory(path)); + //Mocks were failing - commenting out for now, both mock and transformers seem to work fine + WireMock.configureFor("localhost", portNumber); + wireMockServer.start(); +// StubResponse.setupAllMocks(); + started= true; + } + + public static void main(String [] args) { + MockResource mockresource = new MockResource(); + mockresource.start(28090); + mockresource.reset(); +// mockresource.setupStub("MockCreateTenant"); + } + + /** + * Starts the wiremock server in default port + * @return + */ + @GET + @Path("/start") + @Produces("application/json") + public Response start() { + return startMockServer(defaultPort); + } + + private Response startMockServer(int port) { + if (!started) { + initMockServer(defaultPort); + System.out.println("Started Mock Server in port " + port); + return Response.status(200).entity("Started Mock Server in port " + port).build(); + } else { + return Response.status(200).entity("Mock Server is already running").build(); + } + } + + /** + * Starts the wiremock server in a different port + * @param portNumber + * @return + */ + @GET + @Path("/start/{portNumber}") + @Produces("application/json") + public Response start(@PathParam("portNumber") Integer portNumber) { + if (portNumber == null) portNumber = defaultPort; + return startMockServer(portNumber.intValue()); + } + + + /** + * Stop the wiremock server + * @return + */ + @GET + @Path("/stop") + @Produces("application/json") + public synchronized Response stop() { + if (wireMockServer.isRunning()) { + wireMockServer.stop(); + started = false; + return Response.status(200).entity("Stopped Mock Server in port ").build(); + } + return Response.status(200).entity("Mock Server is not running").build(); + } + + + /** + * Return list of mock properties + * @return + */ + @GET + @Path("/properties") + @Produces("application/json") + public Response getProperties() { + return Response.status(200).entity(mockProperties).build(); + } + + /** + * Update a particular mock property at run-time + * @param name + * @param value + * @return + */ + @POST + @Path("/properties/{name}/{value}") + public Response updateProperties(@PathParam("name") String name, @PathParam("value") String value) { + if (mockProperties.size() > 50) return Response.serverError().build(); + mockProperties.put(name, value); + return Response.status(200).build(); + } + + /** + * Reset all stubs + * @return + */ + @GET + @Path("/reset") + @Produces("application/json") + public Response reset() { + WireMock.reset(); + return Response.status(200).entity("Wiremock stubs are reset").build(); + } + + + /** + * Setup a stub selectively + * Prior to use, make sure that stub method is available in StubResponse class + * @param methodName + * @return + */ + + // commenting for now until we figure out a way to use new StubResponse classes to setupStubs +// @GET +// @Path("/stub/{methodName}") +// @Produces("application/json") +// public Response setupStub(@PathParam("methodName") String methodName) { +// +// @SuppressWarnings("rawtypes") +// Class params[] = {}; +// Object paramsObj[] = {}; +// +// try { +// Method thisMethod = StubResponse.class.getDeclaredMethod(methodName, params); +// try { +// thisMethod.invoke(StubResponse.class, paramsObj); +// } catch (IllegalAccessException | IllegalArgumentException +// | InvocationTargetException e) { +// return Response.status(200).entity("Error invoking " + methodName ).build(); +// } +// } catch (NoSuchMethodException | SecurityException e) { +// return Response.status(200).entity("Stub " + methodName + " not found...").build(); +// } +// return Response.status(200).entity("Successfully invoked " + methodName).build(); +// } + + + public static Map getMockProperties(){ + return mockProperties; + } +} \ No newline at end of file diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java new file mode 100644 index 0000000000..8cf947c600 --- /dev/null +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/MockResourceApplication.java @@ -0,0 +1,52 @@ +/*- + * ============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.mock; + +import java.util.HashSet; +import java.util.Set; + +import javax.ws.rs.ApplicationPath; +import javax.ws.rs.core.Application; + +/** + * + * JAX RS Application wiring for Mock Resource + */ +@ApplicationPath("/console") +public class MockResourceApplication extends Application { + + private Set singletons = new HashSet(); + private Set> classes = new HashSet>(); + + public MockResourceApplication() { + singletons.add(new MockResource()); + } + + @Override + public Set> getClasses() { + return classes; + } + + @Override + public Set getSingletons() { + return singletons; + } +} diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.java new file mode 100644 index 0000000000..f30c223449 --- /dev/null +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterMockTransformer.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.mock; + +import org.jboss.resteasy.client.ClientRequest; +import org.jboss.resteasy.client.ClientResponse; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +/** + * + * Simulates SDNC Adapter Callback response + * + */ +public class SDNCAdapterMockTransformer extends ResponseTransformer { + + private String callbackResponse; + private String requestId; + + public SDNCAdapterMockTransformer() { + callbackResponse = FileUtil.readResourceFile("__files/sdncSimResponse.xml"); + } + + public SDNCAdapterMockTransformer(String requestId) { + this.requestId = requestId; + } + + public String name() { + return "sdnc-adapter-transformer"; + } + + /** + * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id + * so that callback response can be correlated + * + * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before + * the callback response is sent + */ + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, + FileSource fileSource) { + String requestBody = request.getBodyAsString(); + + String callbackUrl = requestBody.substring(requestBody.indexOf("")+25, requestBody.indexOf("")); + String requestId = requestBody.substring(requestBody.indexOf("")+23, requestBody.indexOf("")); + + callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + System.out.println("callbackResponse:" + callbackResponse); + + if (this.requestId != null) { + callbackResponse = callbackResponse.replace(this.requestId, requestId); + } else { + callbackResponse = callbackResponse.replace("testRequestId", requestId); + } + + + Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay"); + int delay = 300; + if (sdncDelay != null) { + delay = Integer.parseInt(sdncDelay.toString()); + } + + //Kick off callback thread + System.out.println("callback Url:" + callbackUrl + ":delay:" + delay); + CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay); + calbackResponseThread.start(); + + //return 200 OK with empty body + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(200).withBody("").withHeader("Content-Type", "text/xml") + .build(); + } + + @Override + public boolean applyGlobally() { + return false; + } + + /** + * + * Callback response thread which sends the callback response asynchronously + * + */ + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + System.out.println("Sending callback response:" + callbackUrl); + ClientRequest request = new ClientRequest(callbackUrl); + request.body("text/xml", payLoad); + System.err.println(payLoad); + try { + ClientResponse result = request.post(); + //System.err.println("Successfully posted callback:" + result.getStatus()); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } +} diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java new file mode 100644 index 0000000000..ead12ec755 --- /dev/null +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java @@ -0,0 +1,130 @@ +/*- + * ============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.mock; + +import org.jboss.resteasy.client.ClientRequest; +import org.jboss.resteasy.client.ClientResponse; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseTransformer { + + private String callbackResponse; + private String requestId; + + public SDNCAdapterNetworkTopologyMockTransformer() { + callbackResponse = ""; // FileUtil.readResourceFile("__files/sdncDeleteNetworkTopologySimResponse.xml"); + } + + public SDNCAdapterNetworkTopologyMockTransformer(String requestId) { + this.requestId = requestId; + } + + public String name() { + return "network-topology-operation-transformer"; + } + + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, FileSource fileSource) { + String requestBody = request.getBodyAsString(); + + String callbackUrl = requestBody.substring(requestBody.indexOf("")+25, requestBody.indexOf("")); + String requestId = requestBody.substring(requestBody.indexOf("")+23, requestBody.indexOf("")); + System.out.println("request callbackUrl : " + callbackUrl); + System.out.println("request requestId : " + requestId); + + System.out.println("file path/name : " + responseDefinition.getBodyFileName()); + callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + // extract Response responseRequestId + String responseRequestId = callbackResponse.substring(callbackResponse.indexOf("")+11, callbackResponse.indexOf("")); + System.out.println("response requestId: " + responseRequestId); + System.out.println("callbackResponse (before): " + callbackResponse); + callbackResponse = callbackResponse.replace(responseRequestId, requestId); + if (this.requestId != null) { + callbackResponse = callbackResponse.replace(this.requestId, requestId); + } else { + callbackResponse = callbackResponse.replace(responseRequestId, requestId); + } + System.out.println("callbackResponse (after):" + callbackResponse); + + Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay"); + int delay = 300; + if (sdncDelay != null) { + delay = Integer.parseInt(sdncDelay.toString()); + } + + //Kick off callback thread + System.out.println("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay); + CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay); + calbackResponseThread.start(); + + //return 200 OK with body + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(200).withBody(callbackResponse).withHeader("Content-Type", "text/xml") + .build(); + } + + @Override + public boolean applyGlobally() { + return false; + } + + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + System.out.println("Sending callback response to url: " + callbackUrl); + ClientRequest request = new ClientRequest(callbackUrl); + request.body("text/xml", payLoad); + //System.err.println(payLoad); + try { + ClientResponse result = request.post(); + System.out.println("Successfully posted callback? Status: " + result.getStatus()); + } catch (Exception e) { + // TODO Auto-generated catch block + System.out.println("catch error in - request.post() "); + e.printStackTrace(); + } + } + + } +} diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java new file mode 100644 index 0000000000..8effc08445 --- /dev/null +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseAAI.java @@ -0,0 +1,776 @@ +/* + * © 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.mock; + +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.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; + +/** + * Reusable Mock StubResponses for AAI Endpoints + * + */ +public class StubResponseAAI { + + public static void setupAllMocks() { + + } + + + /** + * Tunnel-XConnect Mock Stub Response + */ + public static void MockPutTunnelXConnect(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String tunnelId){ + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "/tunnel-xconnects/tunnel-xconnect/" + tunnelId)) + .willReturn(aResponse() + .withStatus(200))); + } + + + /** + * Allotted Resource Mock StubResponses below + */ + public static void MockPutAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutAllottedResource_500(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) + .willReturn(aResponse() + .withStatus(500))); + } + + + /** + * Service Instance Mock StubResponses below + */ + public static void MockGetServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockGetServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockNodeQueryServiceInstanceByName(String serviceInstanceName, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-name:EQUALS:" + serviceInstanceName)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockNodeQueryServiceInstanceByName_404(String serviceInstanceName){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockNodeQueryServiceInstanceByName_500(String serviceInstanceName){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-name:EQUALS:" + serviceInstanceName)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockNodeQueryServiceInstanceById(String serviceInstanceId, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance[&]filter=service-instance-id:EQUALS:" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockNodeQueryServiceInstanceById_404(String serviceInstanceId){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockNodeQueryServiceInstanceById_500(String serviceInstanceId){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/nodes-query[?]search-node-type=service-instance&filter=service-instance-id:EQUALS:" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(204))); + } + + public static void MockGetServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockGetServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml"))); + } + + public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" +1234)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockDeleteServiceInstance_404(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockDeleteServiceInstance_500(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockPutServiceInstance(String globalCustId, String subscriptionType, String serviceInstanceId, String responseFile) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutServiceInstance_500(String globalCustId, String subscriptionType, String serviceInstanceId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(500))); + } + + + /** + * Service-Subscription Mock StubResponses below + */ + public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockDeleteServiceSubscription(String globalCustId, String subscriptionType, int statusCode) { + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockDeleteServiceInstanceId(String globalCustId, String subscriptionType, String serviceInstanceId) { + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutServiceSubscription(String globalCustId, String subscriptionType) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + /** + * Customer Mock StubResponses below + */ + public static void MockGetCustomer(String globalCustId, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockDeleteCustomer(String globalCustId) { + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutCustomer(String globalCustId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutCustomer_500(String globalCustId) { + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId)) + .willReturn(aResponse() + .withStatus(500))); + } + + + /** + * Generic-Vnf Mock StubResponses below + */ + public static void MockGetGenericVnfById(String vnfId, String responseFile, int statusCode){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfByIdWithPriority(String vnfId, int statusCode, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + .atPriority(1) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfByIdWithPriority(String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .atPriority(priority) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfByIdWithDepth(String vnfId, int depth, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=" + depth)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfById_404(String vnfId){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockGetGenericVnfById_500(String vnfId){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockGetGenericVnfByName(String vnfName, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfByNameWithDepth(String vnfName, int depth, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetGenericVnfByName_404(String vnfName){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName)) + .willReturn(aResponse() + .withStatus(404))); + } + + public static void MockDeleteGenericVnf(String vnfId, String resourceVersion){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(204))); + } + + public static void MockDeleteGenericVnf(String vnfId, String resourceVersion, int statusCode){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockDeleteGenericVnf_500(String vnfId, String resourceVersion){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockPutGenericVnf(String vnfId){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutGenericVnf(String vnfId, String requestBodyContaining, int statusCode) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + .withRequestBody(containing(requestBodyContaining)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockPutGenericVnf(String vnfId, int statusCode) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockPutGenericVnf_Bad(String vnfId, int statusCode){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + + /** + * Vce Mock StubResponses below + */ + public static void MockGetVceById(String vnfId, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetVceByName(String vnfName, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockDeleteVce(String vnfId, String resourceVersion, int statusCode){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void MockPutVce(String vnfId){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/" + vnfId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockGetGenericVceByNameWithDepth(String vnfName, int depth, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetVceGenericQuery(String serviceInstanceName, int depth, int statusCode, String responseFile){ + stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=service-instance.service-instance-name:" + serviceInstanceName + "[&]start-node-type=service-instance[&]include=vce[&]depth=" + depth)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + /** + * Tenant Mock StubResponses below + */ + public static void MockGetTenantGenericQuery(String customer, String serviceType, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/search/generic-query[?]key=customer.global-customer-id:" + customer + "&key=service-subscription.service-type:" + serviceType + "&start-node-type=service-subscription&include=tenant&include=service-subscription&depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetTenant(String tenantId, String responseFile) { + stubFor(get(urlEqualTo("/aai/v2/cloud-infrastructure/tenants/tenant/" + tenantId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + /** + * Network Mock StubResponses below + */ + public static void MockGetNetwork(String networkId, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutNetwork(String networkId, int statusCode, String responseFile) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutNetwork(String networkPolicyId, String responseFile, int statusCode) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkName(String networkPolicyName, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkVpnBinding(String networkBindingId, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkPolicy(String networkPolicy, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkPolicyfqdn(String networkPolicy, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetNetworkRouteTable(String networkRouteId, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + + /** + * Cloud infrastructure below + */ + + public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + /** + * Volume Group StubResponse below + */ + public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) { + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) { + stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) { + stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + /** + * VF-Module StubResponse below + * @param statusCode TODO + */ + public static void MockGetVfModuleId(String vnfId, String vfModuleId, String responseFile, int statusCode) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockGetVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) { + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml"))); + } + + public static void MockPutVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId +"/vf-modules/vf-module/" +vfModuleId)) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutVfModuleId(String vnfId, String vfModuleId) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockPutVfModuleId(String vnfId, String vfModuleId, int returnCode) { + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) + .willReturn(aResponse() + .withStatus(returnCode))); + } + + public static void MockDeleteVfModuleId(String vnfId, String vfModuleId, String resourceVersion, int returnCode) { + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion)) + .willReturn(aResponse() + .withStatus(returnCode))); + } + + //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above //// + @Deprecated + public static void MockGetVceById(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123?depth=1")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getVceResponse.xml"))); + } + @Deprecated + public static void MockGetVceByName(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=testVnfName123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getVceByNameResponse.xml"))); + } + @Deprecated + public static void MockPutVce(){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123")) + .willReturn(aResponse() + .withStatus(200))); + } + @Deprecated + public static void MockDeleteVce(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(204))); + } + @Deprecated + public static void MockDeleteVce_404(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/vces/vce/testVnfId123[?]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(404))); + } + + @Deprecated + public static void MockDeleteServiceSubscription(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234")) + .willReturn(aResponse() + .withStatus(204))); + } + @Deprecated + public static void MockGetServiceSubscription(){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getServiceSubscription.xml"))); + } + @Deprecated + public static void MockGetServiceSubscription_200Empty(){ + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET[?]resource-version=1234")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBody(" "))); + } + @Deprecated + public static void MockGetServiceSubscription_404() { + stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) + .willReturn(aResponse() + .withStatus(404))); + } + @Deprecated + public static void MockGENPSIPutServiceInstance(){ + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"))); + } + + @Deprecated + public static void MockGENPSIPutServiceSubscription(){ + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"))); + } + @Deprecated + public static void MockGENPSIPutServiceInstance_get500(){ + stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericPutServiceInstance/aaiFault.xml"))); + } + + @Deprecated + public static void MockGetGenericVnfById(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml"))); + } + @Deprecated + public static void MockGetGenericVnfById_404(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(404))); + } + @Deprecated + public static void MockGetGenericVnfByName(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse.xml"))); + } + @Deprecated + public static void MockGetGenericVnfByName_hasRelationships(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml"))); + } + @Deprecated + public static void MockGetGenericVnfById_hasRelationships(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile("GenericFlows/getGenericVnfResponse_hasRelationships.xml"))); + } + @Deprecated + public static void MockGetGenericVnfById_500(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(500))); + } + @Deprecated + public static void MockGetGenericVnfByName_404(){ + stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=testVnfName123")) + .willReturn(aResponse() + .withStatus(404))); + } + @Deprecated + public static void MockPutGenericVnf(){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(200))); + } + @Deprecated + public static void MockPutGenericVnf_400(){ + stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123")) + .willReturn(aResponse() + .withStatus(400))); + } + @Deprecated + public static void MockDeleteGenericVnf(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(204))); + } + @Deprecated + public static void MockDeleteGenericVnf_404(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(404))); + } + @Deprecated + public static void MockDeleteGenericVnf_500(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[?]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(500))); + } + @Deprecated + public static void MockDeleteGenericVnf_412(){ + stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/testVnfId123[[?]]resource-version=testReVer123")) + .willReturn(aResponse() + .withStatus(412))); + } + +} diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java new file mode 100644 index 0000000000..7eefa4bc39 --- /dev/null +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseDatabase.java @@ -0,0 +1,65 @@ +/* + * © 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.mock; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; + +/** + * Stub response class for Database stubs + * including database adapter, catalog db, + * and other databases. + */ +public class StubResponseDatabase { + + public static void setupAllMocks() { + + } + + public static void mockUpdateRequestDB(int statusCode, String reponseFile) { + stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(reponseFile))); + } + + public static void MockGetAllottedResourcesByModelInvariantId(String modelInvariantId, String responseFile){ + stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBodyFile(responseFile))); + } + + public static void MockGetAllottedResourcesByModelInvariantId_500(String modelInvariantId, String responseFile){ + stubFor(get(urlEqualTo("/v1/serviceAllottedResources?serviceModelInvariantUuid=" + modelInvariantId)) + .willReturn(aResponse() + .withStatus(500))); + } + +} diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java new file mode 100644 index 0000000000..c81578a998 --- /dev/null +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseNetworkAdapter.java @@ -0,0 +1,93 @@ +/* + * © 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.mock; + +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.post; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; + +/** + * Please describe the StubResponseNetwork.java class + * + */ +public class StubResponseNetworkAdapter { + + private static final String EOL = "\n"; + + public static void setupAllMocks() { + + } + + + public static void MockNetworkAdapter() { + stubFor(post(urlEqualTo("/networks/NetworkAdapter")) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void MockNetworkAdapter(String response) { + stubFor(post(urlEqualTo("/networks/NetworkAdapter")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(response))); + } + + public static void MockNetworkAdapter_500() { + stubFor(post(urlEqualTo("/networks/NetworkAdapter")) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void MockNetworkAdapter(String networkId, int statusCode, String responseFile) { + stubFor(delete(urlEqualTo("/networks/NetworkAdapter/" + networkId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml") + .withBodyFile(responseFile))); + } + + public static void MockNetworkAdapterContainingRequest(String requestContaining, int statusCode, String responseFile) { + stubFor(post(urlEqualTo("/networks/NetworkAdapter")) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void MockPutNetworkAdapter(String networkId, String requestContaining, int statusCode, String responseFile) { + stubFor(put(urlEqualTo("/networks/NetworkAdapter/" + networkId)) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + +} diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java new file mode 100644 index 0000000000..8e4b789366 --- /dev/null +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseSDNCAdapter.java @@ -0,0 +1,138 @@ +/* + * © 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.mock; + +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.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; + +/** + * Please describe the StubResponseSDNC.java class + */ +public class StubResponseSDNCAdapter { + + public static void setupAllMocks() { + + } + + public static void mockSDNCAdapter(int statusCode) { + stubFor(post(urlEqualTo("/SDNCAdapter")) + .willReturn(aResponse() + .withStatus(statusCode))); + } + + public static void mockSDNCAdapter(String endpoint, int statusCode, String responseFile) { + stubFor(post(urlEqualTo(endpoint)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void mockSDNCAdapter(String responseFile) { + stubFor(post(urlEqualTo("/SDNCAdapter")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void mockSDNCAdapter(String endpoint, String requestContaining, int statusCode, String responseFile) { + stubFor(post(urlEqualTo(endpoint)) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void mockSDNCAdapterSimulator(String responseFile) { + MockResource mockResource = new MockResource(); + mockResource.updateProperties("sdnc_delay", "300"); + stubFor(post(urlEqualTo("/SDNCAdapter")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/soap+xml") + .withTransformers("sdnc-adapter-transformer") + .withBodyFile(responseFile))); + } + + public static void mockSDNCAdapterSimulator(String responseFile, String requestContaining) { + MockResource mockResource = new MockResource(); + mockResource.updateProperties("sdnc_delay", "300"); + stubFor(post(urlEqualTo("/SDNCAdapter")) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/soap+xml") + .withTransformers("sdnc-adapter-transformer") + .withBodyFile(responseFile))); + } + + public static void mockSDNCAdapterRest() { + stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockSDNCAdapterRest_500() { + stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockSDNCAdapterRest(String requestContaining) { + stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockSDNCAdapterRest_500(String requestContaining) { + stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services")) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockSDNCAdapterTopology(String responseFile, String requestContaining) { + MockResource mockResource = new MockResource(); + mockResource.updateProperties("sdnc_delay", "300"); + stubFor(post(urlEqualTo("/SDNCAdapter")) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withTransformers("network-topology-operation-transformer") + .withBodyFile(responseFile))); + } + + +} diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java new file mode 100644 index 0000000000..7951a48184 --- /dev/null +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java @@ -0,0 +1,130 @@ +/* + * © 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.mock; + +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; + +/** + * Please describe the StubResponseVNF.java class + */ +public class StubResponseVNFAdapter { + + public static void mockVNFAdapter() { + stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) + .willReturn(aResponse() + .withStatus(200))); + } + + public static void mockVNFAdapter(String responseFile) { + stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "text/xml") + .withBodyFile(responseFile))); + } + + public static void mockVNFAdapter_500() { + stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) + .willReturn(aResponse() + .withStatus(500))); + } + + public static void mockVNFAdapterTransformer(String transformer, String responseFile) { + MockResource mockResource = new MockResource(); + mockResource.updateProperties("vnf_delay", "300"); + stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/soap+xml") + .withTransformers(transformer) + .withBodyFile(responseFile))); + } + + public static void mockVNFAdapterTransformer(String transformer, String responseFile, String requestContaining) { + MockResource mockResource = new MockResource(); + mockResource.updateProperties("vnf_delay", "300"); + stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync")) + .withRequestBody(containing(requestContaining)) + .willReturn(aResponse() + .withStatus(200) + .withHeader("Content-Type", "application/soap+xml") + .withTransformers(transformer) + .withBodyFile(responseFile))); + } + + public static void mockVNFPost(String vfModuleId, int statusCode, String vnfId) { + stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } + + public static void mockVNFPut(String vfModuleId, int statusCode) { + stubFor(put(urlEqualTo("/vnfs/v1/vnfs/vnfId/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } + + public static void mockVNFPut(String vnfId, String vfModuleId, int statusCode) { + stubFor(put(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } + + public static void mockVNFDelete(String vnfId, String vfModuleId, int statusCode) { + stubFor(delete(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } + + public static void mockVNFRollbackDelete(String vfModuleId, int statusCode) { + stubFor(delete(urlEqualTo("/vnfs/v1/vnfs/vnfId/vf-modules" + vfModuleId + "/rollback")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } + + public static void mockPutVNFVolumeGroup(String volumeGroupId, int statusCode) { + stubFor(put(urlEqualTo("/vnfs/v1/volume-groups/" + volumeGroupId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } + + public static void mockPostVNFVolumeGroup(int statusCode) { + stubFor(post(urlEqualTo("/vnfs/v1/volume-groups")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); + } +} diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java new file mode 100644 index 0000000000..2afe048db4 --- /dev/null +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterCreateMockTransformer.java @@ -0,0 +1,148 @@ +/* + * © 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.mock; + +import javax.xml.ws.Endpoint; + +import org.jboss.resteasy.client.ClientRequest; +import org.jboss.resteasy.client.ClientResponse; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +/** + * Please describe the VnfAdapterCreateMockTransformer.java class + * + */ +public class VnfAdapterCreateMockTransformer extends ResponseTransformer { + + private String notifyCallbackResponse; + private String ackResponse; + + public VnfAdapterCreateMockTransformer() { + notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfCreateSimResponse.xml"); // default response + } + + @Override + public String name() { + return "vnf-adapter-create-transformer"; + } + + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, + FileSource fileSource) { + + String requestBody = request.getBodyAsString(); + + String notficationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); + String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); + String responseMessageId = ""; + String updatedResponse = ""; + + try { + // try supplied response file (if any) + System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + notifyCallbackResponse = ackResponse; + responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); + updatedResponse = ackResponse.replace(responseMessageId, messageId); + } catch (Exception ex) { + System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfCreateSimResponse.xml'"); + responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); + updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); + } + + System.out.println("response (mock) messageId : " + responseMessageId); + System.out.println("request (replacement) messageId: " + messageId); + + System.out.println("vnf Response (before):" + notifyCallbackResponse); + System.out.println("vnf Response (after):" + updatedResponse); + + Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); + int delay = 300; + if (vnfDelay != null) { + delay = Integer.parseInt(vnfDelay.toString()); + } + + //Kick off callback thread + System.out.println("VnfAdapterCreateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); + callbackResponseThread.start(); + + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") + .build(); + + } + + @Override + public boolean applyGlobally() { + return false; + } + + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + @SuppressWarnings("deprecation") + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + System.out.println("Sending callback response to url: " + callbackUrl); + ClientRequest request = new ClientRequest(callbackUrl); + request.body("text/xml", payLoad); + //System.out.println("payLoad: " + payLoad); + + try { + ClientResponse result = request.post(); + System.out.println("Successfully posted callback? Status: " + result.getStatus()); + //System.err.println("Successfully posted callback:" + result.getStatus()); + } catch (Exception e) { + // TODO Auto-generated catch block + System.out.println("catch error in - request.post() "); + e.printStackTrace(); + } + } + + } + + +} \ No newline at end of file diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java new file mode 100644 index 0000000000..e9b67b78e5 --- /dev/null +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterDeleteMockTransformer.java @@ -0,0 +1,146 @@ +/* + * © 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.mock; + +import org.jboss.resteasy.client.ClientRequest; +import org.jboss.resteasy.client.ClientResponse; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +/** + * Please describe the VnfAdapterCreateMockTransformer.java class + * + */ +public class VnfAdapterDeleteMockTransformer extends ResponseTransformer { + + + private String notifyCallbackResponse; + private String ackResponse; + + public VnfAdapterDeleteMockTransformer() { + notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfDeleteSimResponse.xml"); + } + + @Override + public String name() { + return "vnf-adapter-delete-transformer"; + } + + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, + FileSource fileSource) { + + // System.err.println("notifyCallbackResponse:" + notifyCallbackResponse); + + String requestBody = request.getBodyAsString(); + + String notficationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); + String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); + String responseMessageId = ""; + String updatedResponse = ""; + + try { + // try supplied response file (if any) + System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + notifyCallbackResponse = ackResponse; + responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); + updatedResponse = ackResponse.replace(responseMessageId, messageId); + } catch (Exception ex) { + System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'"); + responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); + updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); + } + + System.out.println("response (mock) messageId : " + responseMessageId); + System.out.println("request (replacement) messageId: " + messageId); + + System.out.println("vnf Response (before):" + notifyCallbackResponse); + System.out.println("vnf Response (after):" + updatedResponse); + + Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); + int delay = 300; + if (vnfDelay != null) { + delay = Integer.parseInt(vnfDelay.toString()); + } + + //Kick off callback thread + System.out.println("VnfAdapterDeleteMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); + callbackResponseThread.start(); + + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") + .build(); + + } + + @Override + public boolean applyGlobally() { + return false; + } + + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + @SuppressWarnings("deprecation") + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + System.out.println("Sending callback response to url: " + callbackUrl); + ClientRequest request = new ClientRequest(callbackUrl); + request.body("text/xml", payLoad); + //System.err.println(payLoad); + try { + ClientResponse result = request.post(); + System.out.println("Successfully posted callback? Status: " + result.getStatus()); + //System.err.println("Successfully posted callback:" + result.getStatus()); + } catch (Exception e) { + // TODO Auto-generated catch block + System.out.println("catch error in - request.post() "); + e.printStackTrace(); + } + } + + } +} \ No newline at end of file diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java new file mode 100644 index 0000000000..1acd8db723 --- /dev/null +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterQueryMockTransformer.java @@ -0,0 +1,160 @@ +/*- + * ============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.mock; + + +import com.github.tomakehurst.wiremock.extension.ResponseTransformer; + +import org.jboss.resteasy.client.ClientRequest; +import org.jboss.resteasy.client.ClientResponse; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +/** + * Please describe the VnfAdapterQueryMockTransformer.java class + * + */ + + +public class VnfAdapterQueryMockTransformer extends ResponseTransformer{ + + private String notifyCallbackResponse; + private String ackResponse; + private String messageId; + + public VnfAdapterQueryMockTransformer() { + notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfQuerySimResponse.xml"); + } + + public VnfAdapterQueryMockTransformer(String messageId) { + this.messageId = messageId; + } + + @Override + public String name() { + return "vnf-adapter-query-transformer"; + } + + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, + FileSource fileSource) { + + String requestBody = request.getBodyAsString(); + + String notficationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); + String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); + // String updatedResponse = notifyCallbackResponse.replace("b1a82ce6-7f5c-45fd-9273-acaf88fc2137", messageId); + + String responseMessageId = ""; + String updatedResponse = ""; + + // if (ackResponse == null) { + //System.err.println("file:" + responseDefinition.getBodyFileName()); + // ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + //} + + + try { + // try supplied response file (if any) + System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + notifyCallbackResponse = ackResponse; + responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); + updatedResponse = ackResponse.replace(responseMessageId, messageId); + } catch (Exception ex) { + System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'"); + responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); + updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); + } + + System.out.println("response (mock) messageId : " + responseMessageId); + System.out.println("request (replacement) messageId: " + messageId); + + System.out.println("vnf Response (before):" + notifyCallbackResponse); + System.out.println("vnf Response (after):" + updatedResponse); + + + Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); + int delay = 300; + if (vnfDelay != null) { + delay = Integer.parseInt(vnfDelay.toString()); + } + + //Kick off callback thread + + //System.out.println("notficationUrl" + notficationUrl); + //System.out.println("updatedResponse" + updatedResponse); + System.out.println("VnfAdapterQueryMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); + System.out.println("Inside Callback" ); + callbackResponseThread.start(); + + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") + .build(); + } + + @Override + public boolean applyGlobally() { + return false; + } + + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + ClientRequest request = new ClientRequest(callbackUrl); + request.body("text/xml", payLoad); + //System.err.println(payLoad); + try { + ClientResponse result = request.post(); + //System.err.println("Successfully posted callback:" + result.getStatus()); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } + + +} diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java new file mode 100644 index 0000000000..259d2e3b4b --- /dev/null +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterRollbackMockTransformer.java @@ -0,0 +1,147 @@ +/* + * © 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.mock; + +import org.jboss.resteasy.client.ClientRequest; +import org.jboss.resteasy.client.ClientResponse; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +/** + * Please describe the VnfAdapterCreateMockTransformer.java class + * + */ +public class VnfAdapterRollbackMockTransformer extends ResponseTransformer { + + private String notifyCallbackResponse; + private String ackResponse; + private String messageId; + + public VnfAdapterRollbackMockTransformer() { + notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfRollbackSimResponse.xml"); + } + + public VnfAdapterRollbackMockTransformer(String messageId) { + this.messageId = messageId; + } + + @Override + public String name() { + return "vnf-adapter-rollback-transformer"; + } + + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, + FileSource fileSource) { + + String requestBody = request.getBodyAsString(); + + String notficationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); + String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); + String responseMessageId = ""; + String updatedResponse = ""; + + try { + // try supplied response file (if any) + System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + notifyCallbackResponse = ackResponse; + responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); + updatedResponse = ackResponse.replace(responseMessageId, messageId); + } catch (Exception ex) { + System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'"); + responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); + updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); + } + + System.out.println("response (mock) messageId : " + responseMessageId); + System.out.println("request (replacement) messageId: " + messageId); + + System.out.println("vnf Response (before):" + notifyCallbackResponse); + System.out.println("vnf Response (after):" + updatedResponse); + + Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); + int delay = 300; + if (vnfDelay != null) { + delay = Integer.parseInt(vnfDelay.toString()); + } + + //Kick off callback thread + System.out.println("VnfAdapterRollbackMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); + callbackResponseThread.start(); + + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") + .build(); + + } + + @Override + public boolean applyGlobally() { + return false; + } + + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + System.out.println("Sending callback response to url: " + callbackUrl); + ClientRequest request = new ClientRequest(callbackUrl); + request.body("text/xml", payLoad); + //System.err.println(payLoad); + try { + ClientResponse result = request.post(); + System.out.println("Successfully posted callback? Status: " + result.getStatus()); + //System.err.println("Successfully posted callback:" + result.getStatus()); + } catch (Exception e) { + // TODO Auto-generated catch block + System.out.println("catch error in - request.post() "); + e.printStackTrace(); + } + } + + } +} diff --git a/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java new file mode 100644 index 0000000000..d720b2410b --- /dev/null +++ b/bpmn/MSOMockServer/src/main/java/org/openecomp/mso/bpmn/mock/VnfAdapterUpdateMockTransformer.java @@ -0,0 +1,148 @@ +/* + * © 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.mock; + +import org.jboss.resteasy.client.ClientRequest; +import org.jboss.resteasy.client.ClientResponse; + +import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.ResponseDefinition; + +/** + * Please describe the VnfAdapterUpdateMockTransformer.java class + * + */ +public class VnfAdapterUpdateMockTransformer extends ResponseTransformer { + + private String notifyCallbackResponse; + private String requestId; + private String ackResponse; + + public VnfAdapterUpdateMockTransformer() { + notifyCallbackResponse = FileUtil.readResourceFile("vnfAdapter/vnfUpdateSimResponse.xml"); + } + + public VnfAdapterUpdateMockTransformer(String requestId) { + this.requestId = requestId; + } + + + public String name() { + return "vnf-adapter-update-transformer"; + } + + @Override + public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, + FileSource fileSource) { + + String requestBody = request.getBodyAsString(); + + String notficationUrl = requestBody.substring(requestBody.indexOf("")+17, requestBody.indexOf("")); + String messageId = requestBody.substring(requestBody.indexOf("")+11, requestBody.indexOf("")); + String responseMessageId = ""; + String updatedResponse = ""; + + try { + // try supplied response file (if any) + System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName()); + ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName()); + notifyCallbackResponse = ackResponse; + responseMessageId = ackResponse.substring(ackResponse.indexOf("")+11, ackResponse.indexOf("")); + updatedResponse = ackResponse.replace(responseMessageId, messageId); + } catch (Exception ex) { + System.out.println(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'"); + responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("")+11, notifyCallbackResponse.indexOf("")); + updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId); + } + + System.out.println("response (mock) messageId : " + responseMessageId); + System.out.println("request (replacement) messageId: " + messageId); + + System.out.println("vnf Response (before):" + notifyCallbackResponse); + System.out.println("vnf Response (after):" + updatedResponse); + + Object vnfDelay = MockResource.getMockProperties().get("vnf_delay"); + int delay = 300; + if (vnfDelay != null) { + delay = Integer.parseInt(vnfDelay.toString()); + } + + //Kick off callback thread + System.out.println("VnfAdapterUpdateMockTransformer notficationUrl: " + notficationUrl + ":delay: " + delay); + CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay); + callbackResponseThread.start(); + + return ResponseDefinitionBuilder + .like(responseDefinition).but() + .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml") + .build(); + + } + + @Override + public boolean applyGlobally() { + return false; + } + + private class CallbackResponseThread extends Thread { + + private String callbackUrl; + private String payLoad; + private int delay; + + public CallbackResponseThread(String callbackUrl, String payLoad, int delay) { + this.callbackUrl = callbackUrl; + this.payLoad = payLoad; + this.delay = delay; + } + + public void run () { + try { + //Delay sending callback response + sleep(delay); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + System.out.println("Sending callback response to url: " + callbackUrl); + ClientRequest request = new ClientRequest(callbackUrl); + request.body("text/xml", payLoad); + //System.err.println(payLoad); + try { + ClientResponse result = request.post(); + System.out.println("Successfully posted callback? Status: " + result.getStatus()); + //System.err.println("Successfully posted callback:" + result.getStatus()); + } catch (Exception e) { + // TODO Auto-generated catch block + System.out.println("catch error in - request.post() "); + e.printStackTrace(); + } + } + + } +} + diff --git a/bpmn/MSOMockServer/src/main/resources/__files/sdncSimResponse.xml b/bpmn/MSOMockServer/src/main/resources/__files/sdncSimResponse.xml new file mode 100644 index 0000000000..eef8f06a90 --- /dev/null +++ b/bpmn/MSOMockServer/src/main/resources/__files/sdncSimResponse.xml @@ -0,0 +1,19 @@ + + + + + + + d325c9a7-84c0-4081-b979-9cc773a0976d + 200 + OK + + <layer3-service-list + xmlns="com:att:sdnctl:l3api"><service-instance-id>0XX/VXXX/003717//Shakeout</service-instance-id><service-status><rpc-name>svc-topology-operation</rpc-name><rpc-action>delete</rpc-action><request-status>synccomplete</request-status><final-indicator>Y</final-indicator><l3sdn-action>DisconnectLayer3ServiceRequest</l3sdn-action><response-timestamp>2015-10-22T02:11:52.010Z</response-timestamp></service-status><service-data><svc-config-additional-data/></service-data></layer3-service-list> + + + + diff --git a/bpmn/MSOMockServer/src/main/webapp/WEB-INF/jboss-web.xml b/bpmn/MSOMockServer/src/main/webapp/WEB-INF/jboss-web.xml new file mode 100644 index 0000000000..cca27bb062 --- /dev/null +++ b/bpmn/MSOMockServer/src/main/webapp/WEB-INF/jboss-web.xml @@ -0,0 +1,6 @@ + + + + other + /msomock + \ No newline at end of file diff --git a/bpmn/MSORESTClient/pom.xml b/bpmn/MSORESTClient/pom.xml index 3c2ea83bb6..d2e294d5c0 100644 --- a/bpmn/MSORESTClient/pom.xml +++ b/bpmn/MSORESTClient/pom.xml @@ -2,21 +2,27 @@ 4.0.0 - + org.openecomp.mso - bpmn + bpmn 1.1.0-SNAPSHOT - + org.openecomp.mso MSORESTClient - + jar - + MSO REST Client API - + + + org.evosuite + evosuite-standalone-runtime + ${evosuiteVersion} + test + org.apache.httpcomponents httpmime @@ -27,33 +33,20 @@ json-rpc 1.0 - - junit - junit - test - + org.mockito mockito-all 1.10.19 test - - - MSORESTClient - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.1 - - 1.7 - 1.7 - - - + + + MSORESTClient + + + + diff --git a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java index 5c200046ca..cab3e5082e 100644 --- a/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java +++ b/bpmn/MSORESTClient/src/main/java/org/openecomp/mso/rest/RESTClient.java @@ -91,7 +91,6 @@ public class RESTClient { private final LinkedHashMap> parameters; private HttpEntity httpEntity; - private HttpClient unitTestClient; /** * Internal method used to build an APIResponse using the specified @@ -583,13 +582,6 @@ public class RESTClient { return httpEntity; } - public HttpClient getUnitTestClient() { - return unitTestClient; - } - - public void setUnitTestClient(HttpClient unitTestClient) { - this.unitTestClient = unitTestClient; - } /** * Allows inclusion of a request body with DELETE. diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTest.java index 87a3f47cfe..e44a44d118 100644 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTest.java +++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTest.java @@ -3,6 +3,26 @@ * Mon Nov 14 11:46:25 GMT 2016 */ +/*- + * ============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.rest; import org.junit.Test; diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTestscaffolding.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTestscaffolding.java index 59f09a0bc9..80915d74cf 100644 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTestscaffolding.java +++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/APIResponseESTestscaffolding.java @@ -4,6 +4,26 @@ * Mon Nov 14 11:46:25 GMT 2016 */ +/*- + * ============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.rest; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTest.java index 21043496db..f0aeee0f99 100644 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTest.java +++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTest.java @@ -3,6 +3,26 @@ * Mon Nov 14 11:47:07 GMT 2016 */ +/*- + * ============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.rest; import org.junit.Test; diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTestscaffolding.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTestscaffolding.java index e59f7da9fb..0438c1fba6 100644 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTestscaffolding.java +++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/HttpHeaderESTestscaffolding.java @@ -4,6 +4,26 @@ * Mon Nov 14 11:47:07 GMT 2016 */ +/*- + * ============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.rest; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTest.java deleted file mode 100644 index 1a9e05abd0..0000000000 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTest.java +++ /dev/null @@ -1,1068 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Mon Nov 14 11:49:09 GMT 2016 - */ - -package org.openecomp.mso.rest; - -import org.junit.Test; -import static org.junit.Assert.*; -import static org.evosuite.shaded.org.mockito.Mockito.*; -import static org.evosuite.runtime.MockitoExtension.*; -import static org.evosuite.runtime.EvoAssertions.*; - -import java.io.InputStream; -import java.util.LinkedHashMap; -import java.util.List; -import org.apache.http.Header; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.StatusLine; -import org.apache.http.client.HttpClient; -import org.apache.http.entity.InputStreamEntity; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.evosuite.runtime.ViolatedAssumptionAnswer; -import org.junit.runner.RunWith; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class RESTClientESTest extends RESTClientESTestscaffolding { - - @Test(timeout = 4000) - public void test00() throws Throwable { - RESTClient rESTClient0 = new RESTClient("org.apache.http.ParseException"); - HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(httpClient0).toString(); - doReturn((HttpResponse) null).when(httpClient0).execute(any(org.apache.http.client.methods.HttpUriRequest.class)); - rESTClient0.setUnitTestClient(httpClient0); - // Undeclared exception! - try { - rESTClient0.patch("<;xR"); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.rest.APIResponse", e); - } - } - - @Test(timeout = 4000) - public void test01() throws Throwable { - RESTConfig rESTConfig0 = mock(RESTConfig.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(rESTConfig0).getProxyHost(); - doReturn(0).when(rESTConfig0).getProxyPort(); - doReturn((String) null).when(rESTConfig0).getURL(); - RESTClient rESTClient0 = new RESTClient(rESTConfig0); - HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(httpClient0).toString(); - rESTClient0.setUnitTestClient(httpClient0); - HttpClient httpClient1 = rESTClient0.getUnitTestClient(); - assertSame(httpClient1, httpClient0); - } - - @Test(timeout = 4000) - public void test02() throws Throwable { - RESTClient rESTClient0 = new RESTClient((String) null, "Jhhlq!Y8o>CaA", (-3767)); - String string0 = rESTClient0.getURL(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test03() throws Throwable { - RESTConfig rESTConfig0 = new RESTConfig("", "=&http.request_sent=http.request_sent", 783, true); - RESTClient rESTClient0 = new RESTClient(rESTConfig0); - String string0 = rESTClient0.getURL(); - assertEquals("", string0); - } - - @Test(timeout = 4000) - public void test04() throws Throwable { - RESTClient rESTClient0 = new RESTClient("http"); - RESTClient rESTClient1 = rESTClient0.setParameter("http", "http"); - LinkedHashMap> linkedHashMap0 = rESTClient1.getParameters(); - assertEquals(1, linkedHashMap0.size()); - } - - @Test(timeout = 4000) - public void test05() throws Throwable { - RESTClient rESTClient0 = new RESTClient(",%LX:SC+'3!nt"); - RESTClient rESTClient1 = rESTClient0.setHeader(",%LX:SC+'3!nt", ",[o<:aGQK"); - LinkedHashMap> linkedHashMap0 = rESTClient1.getHeaders(); - assertEquals(1, linkedHashMap0.size()); - } - - @Test(timeout = 4000) - public void test06() throws Throwable { - RESTClient rESTClient0 = new RESTClient(""); - InputStream inputStream0 = mock(InputStream.class, new ViolatedAssumptionAnswer()); - InputStreamEntity inputStreamEntity0 = new InputStreamEntity(inputStream0); - StatusLine statusLine0 = mock(StatusLine.class, new ViolatedAssumptionAnswer()); - doReturn(0).when(statusLine0).getStatusCode(); - HttpResponse httpResponse0 = mock(HttpResponse.class, new ViolatedAssumptionAnswer()); - doReturn(inputStreamEntity0, (HttpEntity) null, (HttpEntity) null).when(httpResponse0).getEntity(); - doReturn(statusLine0).when(httpResponse0).getStatusLine(); - HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer()); - doReturn("Q[z^W").when(httpClient0).toString(); - doReturn(httpResponse0).when(httpClient0).execute(any(org.apache.http.client.methods.HttpUriRequest.class)); - rESTClient0.setUnitTestClient(httpClient0); - HttpClient httpClient1 = mock(HttpClient.class, new ViolatedAssumptionAnswer()); - // Undeclared exception! - try { - rESTClient0.post(); - fail("Expecting exception: IllegalArgumentException"); - - } catch(IllegalArgumentException e) { - // - // Entity may not be null - // - verifyException("org.apache.http.util.Args", e); - } - } - - @Test(timeout = 4000) - public void test07() throws Throwable { - RESTClient rESTClient0 = new RESTClient(""); - RESTClient rESTClient1 = rESTClient0.setParameter((String) null, "7%d/ia+s(I~@0E4sV]T"); - RESTClient rESTClient1 = rESTClient0.addParameter((String) null, ")7l9={q>0E4sV]T"); - // Undeclared exception! - try { - rESTClient1.httpPatch((String) null); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("java.net.URLEncoder", e); - } - } - - @Test(timeout = 4000) - public void test20() throws Throwable { - RESTClient rESTClient0 = new RESTClient("[59t(J)"); - // Undeclared exception! - try { - rESTClient0.httpPatch("[59t(J)"); - fail("Expecting exception: IllegalArgumentException"); - - } catch(IllegalArgumentException e) { - // - // Illegal character in path at index 0: [59t(J) - // - verifyException("java.net.URI", e); - } - } - - @Test(timeout = 4000) - public void test21() throws Throwable { - RESTClient rESTClient0 = new RESTClient("A29%23fZqv%7F*%405=%7F%7Frdbt-X%22DB%2FhCrUn", "=", (-1)); - HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer()); - doReturn((String) null).when(httpClient0).toString(); - doReturn((HttpResponse) null).when(httpClient0).execute(any(org.apache.http.client.methods.HttpUriRequest.class)); - rESTClient0.setUnitTestClient(httpClient0); - // Undeclared exception! - try { - rESTClient0.httpGet(); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.rest.APIResponse", e); - } - } - - @Test(timeout = 4000) - public void test22() throws Throwable { - RESTClient rESTClient0 = new RESTClient("*;R"); - // Undeclared exception! - try { - rESTClient0.httpGet(); - fail("Expecting exception: IllegalArgumentException"); - - } catch(IllegalArgumentException e) { - // - // Illegal character in path at index 0: *;R - // - verifyException("java.net.URI", e); - } - } - - @Test(timeout = 4000) - public void test23() throws Throwable { - RESTClient rESTClient0 = new RESTClient("compatibility"); - RESTClient rESTClient1 = rESTClient0.addParameter("https", "https"); - RESTClient rESTClient2 = rESTClient1.setHeader("compatibility", "https"); - RESTClient rESTClient3 = rESTClient2.setParameter("4#'mD<\"jNh?>_vfI:]", "Char array buffer"); - InputStream inputStream0 = mock(InputStream.class, new ViolatedAssumptionAnswer()); - InputStreamEntity inputStreamEntity0 = new InputStreamEntity(inputStream0); - StatusLine statusLine0 = mock(StatusLine.class, new ViolatedAssumptionAnswer()); - doReturn(0).when(statusLine0).getStatusCode(); - rESTClient3.addHeader("2b?N", "https"); - HttpResponse httpResponse0 = mock(HttpResponse.class, new ViolatedAssumptionAnswer()); - doReturn(inputStreamEntity0, (HttpEntity) null, (HttpEntity) null).when(httpResponse0).getEntity(); - doReturn(statusLine0).when(httpResponse0).getStatusLine(); - HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer()); - doReturn("GiQ=eHBwH9zA4COa").when(httpClient0).toString(); - doReturn(httpResponse0).when(httpClient0).execute(any(org.apache.http.client.methods.HttpUriRequest.class)); - rESTClient2.setUnitTestClient(httpClient0); - // Undeclared exception! - try { - rESTClient3.httpDelete(""); - fail("Expecting exception: IllegalArgumentException"); - - } catch(IllegalArgumentException e) { - // - // Entity may not be null - // - verifyException("org.apache.http.util.Args", e); - } - } - - @Test(timeout = 4000) - public void test24() throws Throwable { - RESTClient rESTClient0 = new RESTClient(")TZ;T]b%B[FkT4", "%y@{Wz}c3J-!m", 1772); - RESTClient rESTClient1 = rESTClient0.addParameter("$y*O^k0", (String) null); - // Undeclared exception! - try { - rESTClient1.httpDelete((String) null); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("java.net.URLEncoder", e); - } - } - - @Test(timeout = 4000) - public void test25() throws Throwable { - RESTClient rESTClient0 = new RESTClient("Length Required"); - // Undeclared exception! - try { - rESTClient0.httpDelete("Length Required"); - fail("Expecting exception: IllegalArgumentException"); - - } catch(IllegalArgumentException e) { - // - // Illegal character in path at index 6: Length Required - // - verifyException("java.net.URI", e); - } - } - - @Test(timeout = 4000) - public void test26() throws Throwable { - RESTConfig rESTConfig0 = new RESTConfig("yhPl=c#;0E4sV]T"); - RESTClient rESTClient1 = rESTClient0.addParameter((String) null, ")7l9={q>0E4sV]T"); - // Undeclared exception! - try { - rESTClient1.get(); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("java.net.URLEncoder", e); - } - } - - @Test(timeout = 4000) - public void test29() throws Throwable { - RESTClient rESTClient0 = new RESTClient("z8UR?=)5pTtS]*"); - // Undeclared exception! - try { - rESTClient0.get(); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test30() throws Throwable { - RESTClient rESTClient0 = new RESTClient("JB<TRwDR@k.-C$=w3", "|N", 0); - // Undeclared exception! - try { - rESTClient0.get(); - fail("Expecting exception: IllegalArgumentException"); - - } catch(IllegalArgumentException e) { - // - // Illegal character in path at index 2: JB<TRwDR@k.-C$=w3 - // - verifyException("java.net.URI", e); - } - } - - @Test(timeout = 4000) - public void test31() throws Throwable { - RESTClient rESTClient0 = new RESTClient("YoeLljo%3A%5C%3D=http", "http.protocol.element-charset", (-1908874351)); - RESTClient rESTClient1 = rESTClient0.setParameter("I/O exception (", (String) null); - // Undeclared exception! - try { - rESTClient1.delete(); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("java.net.URLEncoder", e); - } - } - - @Test(timeout = 4000) - public void test32() throws Throwable { - RESTClient rESTClient0 = new RESTClient("\":VYxeR;PP]jO_[f'"); - // Undeclared exception! - try { - rESTClient0.delete(); - fail("Expecting exception: IllegalArgumentException"); - - } catch(IllegalArgumentException e) { - // - // Illegal character in scheme name at index 0: \":VYxeR;PP]jO_[f' - // - verifyException("java.net.URI", e); - } - } - - @Test(timeout = 4000) - public void test33() throws Throwable { - RESTClient rESTClient0 = null; - try { - rESTClient0 = new RESTClient((RESTConfig) null); - fail("Expecting exception: NullPointerException"); - - } catch(NullPointerException e) { - // - // no message in exception (getMessage() returned null) - // - verifyException("org.openecomp.mso.rest.RESTClient", e); - } - } - - @Test(timeout = 4000) - public void test34() throws Throwable { - RESTClient rESTClient0 = new RESTClient(""); - rESTClient0.addParameter("", ""); - // Undeclared exception! - try { - rESTClient0.httpPatch("lr"); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test35() throws Throwable { - RESTClient rESTClient0 = new RESTClient("", "netscape", 1); - // Undeclared exception! - try { - rESTClient0.httpPost(""); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test36() throws Throwable { - RESTConfig rESTConfig0 = new RESTConfig((String) null); - RESTClient rESTClient0 = new RESTClient(rESTConfig0); - // Undeclared exception! - try { - rESTClient0.httpGet(); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test37() throws Throwable { - RESTClient rESTClient0 = new RESTClient("K.7:dc=", "K.7:dc=", 0); - try { - rESTClient0.httpPost(); - fail("Expecting exception: Exception"); - - } catch(Exception e) { - // - // org.evosuite.runtime.mock.java.lang.MockThrowable: URI does not specify a valid host name: K.7:dc= - // - verifyException("org.openecomp.mso.rest.RESTClient", e); - } - } - - @Test(timeout = 4000) - public void test38() throws Throwable { - RESTClient rESTClient0 = new RESTClient("org.apache.http.ParseException=", "EWh2BZ[]:q+%4S#7K", (-1847)); - // Undeclared exception! - try { - rESTClient0.httpDelete(); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test39() throws Throwable { - RESTClient rESTClient0 = new RESTClient(",%LX:SC+'3!nt"); - String string0 = rESTClient0.getURL(); - assertEquals(",%LX:SC+'3!nt", string0); - } - - @Test(timeout = 4000) - public void test40() throws Throwable { - RESTClient rESTClient0 = new RESTClient("compatibility"); - InputStream inputStream0 = mock(InputStream.class, new ViolatedAssumptionAnswer()); - doReturn((-3113)).when(inputStream0).read(any(byte[].class)); - HttpEntity httpEntity0 = mock(HttpEntity.class, new ViolatedAssumptionAnswer()); - StatusLine statusLine0 = mock(StatusLine.class, new ViolatedAssumptionAnswer()); - doReturn(201).when(statusLine0).getStatusCode(); - HttpEntity httpEntity1 = mock(HttpEntity.class, new ViolatedAssumptionAnswer()); - doReturn(inputStream0).when(httpEntity1).getContent(); - doReturn(0L, (long)(-2116360694)).when(httpEntity1).getContentLength(); - HttpEntity httpEntity2 = mock(HttpEntity.class, new ViolatedAssumptionAnswer()); - doReturn(false).when(httpEntity2).isStreaming(); - HttpResponse httpResponse0 = mock(HttpResponse.class, new ViolatedAssumptionAnswer()); - doReturn(httpEntity0, httpEntity1, httpEntity2).when(httpResponse0).getEntity(); - doReturn(statusLine0).when(httpResponse0).getStatusLine(); - HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer()); - doReturn("GiQ=eHBwH9zA4COa").when(httpClient0).toString(); - doReturn(httpResponse0).when(httpClient0).execute(any(org.apache.http.client.methods.HttpUriRequest.class)); - rESTClient0.setUnitTestClient(httpClient0); - // Undeclared exception! - try { - rESTClient0.httpDelete(""); - fail("Expecting exception: IndexOutOfBoundsException"); - - } catch(IndexOutOfBoundsException e) { - // - // off: 0 len: -3113 b.length: 4096 - // - verifyException("org.apache.http.util.ByteArrayBuffer", e); - } - } - - @Test(timeout = 4000) - public void test41() throws Throwable { - RESTClient rESTClient0 = new RESTClient("compatibility"); - HttpEntity httpEntity0 = mock(HttpEntity.class, new ViolatedAssumptionAnswer()); - StatusLine statusLine0 = mock(StatusLine.class, new ViolatedAssumptionAnswer()); - doReturn(201).when(statusLine0).getStatusCode(); - Header[] headerArray0 = new Header[0]; - HttpEntity httpEntity1 = mock(HttpEntity.class, new ViolatedAssumptionAnswer()); - doReturn((InputStream) null).when(httpEntity1).getContent(); - HttpEntity httpEntity2 = mock(HttpEntity.class, new ViolatedAssumptionAnswer()); - doReturn(false).when(httpEntity2).isStreaming(); - HttpResponse httpResponse0 = mock(HttpResponse.class, new ViolatedAssumptionAnswer()); - doReturn(headerArray0).when(httpResponse0).getAllHeaders(); - doReturn(httpEntity0, httpEntity1, httpEntity2).when(httpResponse0).getEntity(); - doReturn(statusLine0).when(httpResponse0).getStatusLine(); - HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer()); - doReturn("GiQ=eHBwH9zA4COa").when(httpClient0).toString(); - doReturn(httpResponse0).when(httpClient0).execute(any(org.apache.http.client.methods.HttpUriRequest.class)); - rESTClient0.setUnitTestClient(httpClient0); - APIResponse aPIResponse0 = rESTClient0.httpDelete(""); - assertEquals(201, aPIResponse0.getStatusCode()); - } - - @Test(timeout = 4000) - public void test42() throws Throwable { - RESTClient rESTClient0 = new RESTClient("wlq:6r"); - try { - rESTClient0.httpDelete("E"); - fail("Expecting exception: Exception"); - - } catch(Exception e) { - // - // org.evosuite.runtime.mock.java.lang.MockThrowable: URI does not specify a valid host name: wlq:6r - // - verifyException("org.openecomp.mso.rest.RESTClient", e); - } - } - - @Test(timeout = 4000) - public void test43() throws Throwable { - RESTClient rESTClient0 = new RESTClient(""); - // Undeclared exception! - try { - rESTClient0.httpPatch(""); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test44() throws Throwable { - RESTClient rESTClient0 = new RESTClient("DELETE"); - // Undeclared exception! - try { - rESTClient0.httpPatch((String) null); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test45() throws Throwable { - RESTClient rESTClient0 = new RESTClient("org.apache.http.ParseException"); - RESTClient rESTClient1 = rESTClient0.addParameter("DELETE", ""); - // Undeclared exception! - try { - rESTClient1.patch("<;xR"); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test46() throws Throwable { - RESTClient rESTClient0 = new RESTClient("compatibility"); - HttpEntity httpEntity0 = mock(HttpEntity.class, new ViolatedAssumptionAnswer()); - StatusLine statusLine0 = mock(StatusLine.class, new ViolatedAssumptionAnswer()); - doReturn(201).when(statusLine0).getStatusCode(); - Header[] headerArray0 = new Header[0]; - HttpEntity httpEntity1 = mock(HttpEntity.class, new ViolatedAssumptionAnswer()); - doReturn((InputStream) null).when(httpEntity1).getContent(); - HttpEntity httpEntity2 = mock(HttpEntity.class, new ViolatedAssumptionAnswer()); - doReturn(false).when(httpEntity2).isStreaming(); - HttpResponse httpResponse0 = mock(HttpResponse.class, new ViolatedAssumptionAnswer()); - doReturn(headerArray0).when(httpResponse0).getAllHeaders(); - doReturn(httpEntity0, httpEntity1, httpEntity2).when(httpResponse0).getEntity(); - doReturn(statusLine0).when(httpResponse0).getStatusLine(); - HttpClient httpClient0 = mock(HttpClient.class, new ViolatedAssumptionAnswer()); - doReturn("GiQ=eHBwH9zA4COa").when(httpClient0).toString(); - doReturn(httpResponse0).when(httpClient0).execute(any(org.apache.http.client.methods.HttpUriRequest.class)); - rESTClient0.setUnitTestClient(httpClient0); - APIResponse aPIResponse0 = rESTClient0.httpPut("compatibility"); - assertEquals(201, aPIResponse0.getStatusCode()); - } - - @Test(timeout = 4000) - public void test47() throws Throwable { - RESTClient rESTClient0 = new RESTClient(""); - // Undeclared exception! - try { - rESTClient0.httpPut(""); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test48() throws Throwable { - RESTClient rESTClient0 = new RESTClient("compatibility"); - rESTClient0.addParameter("https", "https"); - // Undeclared exception! - try { - rESTClient0.httpPut("compatibility"); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test49() throws Throwable { - RESTClient rESTClient0 = new RESTClient("", "(", 307); - // Undeclared exception! - try { - rESTClient0.httpPut((String) null); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test50() throws Throwable { - RESTClient rESTClient0 = new RESTClient("@0*Eu-=Fa"); - // Undeclared exception! - try { - rESTClient0.httpPost("@0*Eu-=Fa"); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test51() throws Throwable { - RESTClient rESTClient0 = new RESTClient("x"); - // Undeclared exception! - try { - rESTClient0.httpPost((String) null); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test52() throws Throwable { - RESTConfig rESTConfig0 = new RESTConfig("2cSq'/FF]W'K.S^k=<=", "2cSq'/FF]W'K.S^k=<=", 2605); - RESTClient rESTClient0 = new RESTClient(rESTConfig0); - RESTClient rESTClient1 = rESTClient0.setHeader("WkI<", "http"); - RESTClient rESTClient2 = rESTClient1.setHeader("WkI<", ""); - assertEquals("2cSq'/FF]W'K.S^k=<=", rESTClient2.getURL()); - } - - @Test(timeout = 4000) - public void test53() throws Throwable { - RESTClient rESTClient0 = new RESTClient("szM4DVVoiAs`]T/", "szM4DVVoiAs`]T/", (-697)); - RESTClient rESTClient1 = rESTClient0.setHeader("szM4DVVoiAs`]T/", "szM4DVVoiAs`]T/"); - RESTClient rESTClient2 = rESTClient1.addHeader("szM4DVVoiAs`]T/", "szM4DVVoiAs`]T/"); - assertSame(rESTClient0, rESTClient2); - } - - @Test(timeout = 4000) - public void test54() throws Throwable { - RESTClient rESTClient0 = new RESTClient("E U(~h|zVLWi", "http", 0); - rESTClient0.setParameter("E U(~h|zVLWi", "http"); - RESTClient rESTClient1 = rESTClient0.setParameter("E U(~h|zVLWi", "k@(}4U05'$}yl)W"); - assertSame(rESTClient1, rESTClient0); - } - - @Test(timeout = 4000) - public void test55() throws Throwable { - RESTClient rESTClient0 = new RESTClient(""); - RESTClient rESTClient1 = rESTClient0.addParameter("", ""); - RESTClient rESTClient2 = rESTClient0.addParameter("", (String) null); - assertSame(rESTClient2, rESTClient1); - } - - @Test(timeout = 4000) - public void test56() throws Throwable { - RESTClient rESTClient0 = new RESTClient("compatibility"); - rESTClient0.addParameter("https", "https"); - RESTClient rESTClient1 = rESTClient0.setParameter("4#'mD<\"jNh?>_vfI:]", "Char array buffer"); - // Undeclared exception! - try { - rESTClient1.httpDelete(""); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test57() throws Throwable { - RESTClient rESTClient0 = new RESTClient("K.7:dc="); - try { - rESTClient0.get(); - fail("Expecting exception: Exception"); - - } catch(Exception e) { - // - // org.evosuite.runtime.mock.java.lang.MockThrowable: URI does not specify a valid host name: K.7:dc= - // - verifyException("org.openecomp.mso.rest.RESTClient", e); - } - } - - @Test(timeout = 4000) - public void test58() throws Throwable { - RESTClient rESTClient0 = new RESTClient("http.virtual-host"); - RESTClient rESTClient1 = rESTClient0.addAuthorizationHeader("EWh2BZ[]:q+%4S#7K"); - assertSame(rESTClient0, rESTClient1); - } - - @Test(timeout = 4000) - public void test59() throws Throwable { - RESTClient rESTClient0 = new RESTClient("YoeLljo%3A%5C%3D=http", "http.protocol.element-charset", (-1908874351)); - // Undeclared exception! - try { - rESTClient0.delete(); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test60() throws Throwable { - RESTConfig rESTConfig0 = new RESTConfig("UTF-8"); - RESTClient rESTClient0 = new RESTClient(rESTConfig0); - HttpEntity httpEntity0 = rESTClient0.getHttpEntity(); - assertNull(httpEntity0); - } - - @Test(timeout = 4000) - public void test61() throws Throwable { - RESTClient rESTClient0 = new RESTClient(",%LX:SC+'3!nt"); - LinkedHashMap> linkedHashMap0 = rESTClient0.getHeaders(); - assertEquals(0, linkedHashMap0.size()); - } - - @Test(timeout = 4000) - public void test62() throws Throwable { - RESTClient rESTClient0 = new RESTClient("DELETE"); - HttpClient httpClient0 = rESTClient0.getUnitTestClient(); - assertNull(httpClient0); - } - - @Test(timeout = 4000) - public void test63() throws Throwable { - RESTClient rESTClient0 = new RESTClient("A29%23fZqv%7F*%405=%7F%7Frdbt-X%22DB%2FhCrUn", "=", (-1)); - RESTClient rESTClient1 = rESTClient0.addParameter("o", "o"); - // Undeclared exception! - try { - rESTClient1.httpGet(); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test64() throws Throwable { - RESTClient rESTClient0 = new RESTClient("DELETE"); - LinkedHashMap> linkedHashMap0 = rESTClient0.getParameters(); - assertTrue(linkedHashMap0.isEmpty()); - } - - @Test(timeout = 4000) - public void test65() throws Throwable { - RESTClient rESTClient0 = new RESTClient(""); - // Undeclared exception! - try { - rESTClient0.post(); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } - - @Test(timeout = 4000) - public void test66() throws Throwable { - RESTClient rESTClient0 = new RESTClient("DELETE"); - // Undeclared exception! - try { - rESTClient0.httpDelete((String) null); - fail("Expecting exception: IllegalStateException"); - - } catch(IllegalStateException e) { - // - // Target host is null - // - verifyException("org.apache.http.util.Asserts", e); - } - } -} diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTestscaffolding.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTestscaffolding.java deleted file mode 100644 index 2761b252fd..0000000000 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientESTestscaffolding.java +++ /dev/null @@ -1,366 +0,0 @@ -/** - * Scaffolding file used to store all the setups needed to run - * tests automatically generated by EvoSuite - * Mon Nov 14 11:49:09 GMT 2016 - */ - -package org.openecomp.mso.rest; - -import org.evosuite.runtime.annotation.EvoSuiteClassExclude; -import org.junit.BeforeClass; -import org.junit.Before; -import org.junit.After; -import org.junit.AfterClass; -import org.evosuite.runtime.sandbox.Sandbox; - -@EvoSuiteClassExclude -public class RESTClientESTestscaffolding { - - @org.junit.Rule - public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); - - private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.rest.RESTClient"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); - initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } - - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } - - @Before - public void initTestCase(){ - threadStopper.storeCurrentThreads(); - threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } - - @After - public void doneWithTestCase(){ - threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } - - - private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(RESTClientESTestscaffolding.class.getClassLoader() , - "org.apache.http.client.methods.HttpPatch", - "org.apache.http.io.HttpMessageParserFactory", - "org.apache.http.impl.conn.DefaultHttpResponseParserFactory", - "org.apache.http.impl.execchain.RequestAbortedException", - "org.apache.http.impl.execchain.ProtocolExec", - "org.apache.http.config.Registry", - "org.apache.http.cookie.MalformedCookieException", - "org.apache.http.impl.conn.SystemDefaultDnsResolver", - "org.apache.http.client.protocol.RequestClientConnControl", - "org.apache.http.conn.ConnectionRequest", - "org.apache.http.impl.client.DefaultUserTokenHandler", - "org.apache.http.impl.conn.DefaultManagedHttpClientConnection", - "org.apache.http.conn.HttpClientConnectionManager", - "org.apache.http.client.protocol.RequestAcceptEncoding", - "org.apache.http.HttpException", - "org.apache.http.cookie.CookieSpec", - "org.apache.http.impl.cookie.RFC2965SpecFactory", - "org.apache.http.pool.AbstractConnPool$1", - "org.apache.http.conn.ssl.AllowAllHostnameVerifier", - "org.apache.http.client.CredentialsProvider", - "org.apache.http.client.ClientProtocolException", - "org.apache.http.pool.RouteSpecificPool", - "org.apache.http.client.methods.Configurable", - "org.apache.http.config.RegistryBuilder", - "org.apache.http.params.AbstractHttpParams", - "org.apache.http.io.HttpTransportMetrics", - "org.apache.http.conn.ssl.AbstractVerifier", - "org.openecomp.mso.rest.RESTConfig", - "org.apache.http.auth.Credentials", - "org.apache.http.io.HttpMessageParser", - "org.apache.http.client.methods.AbstractExecutionAwareRequest", - "org.apache.http.impl.BHttpConnectionBase", - "org.apache.http.HttpConnectionMetrics", - "org.apache.http.io.HttpMessageWriter", - "org.apache.http.HttpClientConnection", - "org.apache.http.conn.ConnectionPoolTimeoutException", - "org.apache.http.conn.routing.HttpRouteDirector", - "org.apache.http.pool.ConnPool", - "org.apache.http.protocol.HttpProcessor", - "org.apache.http.auth.AuthProtocolState", - "org.apache.http.client.RedirectStrategy", - "org.apache.http.impl.client.BasicCookieStore", - "org.apache.http.conn.routing.BasicRouteDirector", - "org.apache.http.protocol.HttpContext", - "org.apache.http.params.HttpParams", - "org.apache.http.client.NonRepeatableRequestException", - "org.apache.http.HttpResponse", - "org.apache.http.impl.client.AuthenticationStrategyImpl", - "org.apache.http.impl.client.HttpClientBuilder", - "org.apache.http.message.HeaderGroup", - "org.apache.http.impl.io.DefaultHttpRequestWriterFactory", - "org.apache.http.client.protocol.RequestAuthCache", - "org.apache.http.impl.conn.PoolingHttpClientConnectionManager$InternalConnectionFactory", - "org.apache.http.impl.conn.DefaultSchemePortResolver", - "org.apache.http.config.MessageConstraints", - "org.apache.http.Header", - "org.apache.http.conn.HttpHostConnectException", - "org.apache.http.util.EntityUtils", - "org.apache.http.impl.NoConnectionReuseStrategy", - "org.apache.http.impl.client.BasicCredentialsProvider", - "org.apache.http.conn.ConnectionKeepAliveStrategy", - "org.apache.http.cookie.CookieSpecFactory", - "org.apache.http.conn.ssl.X509HostnameVerifier", - "org.apache.http.protocol.ChainBuilder", - "org.apache.http.impl.client.DefaultHttpRequestRetryHandler", - "org.apache.http.impl.conn.PoolingHttpClientConnectionManager", - "org.apache.http.impl.conn.DefaultProxyRoutePlanner", - "org.apache.http.impl.auth.KerberosSchemeFactory", - "org.apache.http.util.ByteArrayBuffer", - "org.apache.http.cookie.CookieOrigin", - "org.apache.http.client.methods.HttpRequestBase", - "org.apache.http.HttpEntity", - "org.apache.http.pool.PoolEntryCallback", - "org.apache.http.entity.StringEntity", - "org.apache.http.impl.DefaultConnectionReuseStrategy", - "org.apache.http.pool.ConnFactory", - "org.apache.http.client.methods.HttpGet", - "org.apache.http.protocol.BasicHttpContext", - "org.apache.commons.logging.impl.Jdk14Logger", - "org.apache.http.impl.execchain.ClientExecChain", - "org.apache.http.HttpVersion", - "org.apache.http.conn.SchemePortResolver", - "org.apache.http.message.BasicStatusLine", - "org.apache.http.conn.DnsResolver", - "org.apache.http.impl.client.TargetAuthenticationStrategy", - "org.apache.http.params.CoreProtocolPNames", - "org.apache.http.auth.AuthScheme", - "org.apache.http.message.AbstractHttpMessage", - "org.apache.http.auth.MalformedChallengeException", - "org.apache.http.HttpEntityEnclosingRequest", - "org.apache.http.entity.AbstractHttpEntity", - "org.apache.http.ReasonPhraseCatalog", - "org.apache.http.impl.cookie.BrowserCompatSpecFactory$SecurityLevel", - "org.apache.http.client.UserTokenHandler", - "org.apache.http.impl.auth.DigestSchemeFactory", - "org.apache.http.impl.conn.HttpClientConnectionOperator", - "org.apache.http.HttpResponseFactory", - "org.apache.http.client.methods.HttpPut", - "org.openecomp.mso.rest.RESTClient", - "org.apache.http.ConnectionReuseStrategy", - "org.apache.http.client.protocol.RequestDefaultHeaders", - "org.apache.http.message.BasicHeader", - "org.apache.http.impl.conn.ConnectionShutdownException", - "org.apache.http.conn.ManagedHttpClientConnection", - "org.apache.http.client.protocol.ResponseContentEncoding", - "org.apache.http.message.BasicLineParser", - "org.apache.http.client.methods.HttpPost", - "org.apache.http.auth.AuthSchemeProvider", - "org.apache.http.config.SocketConfig", - "org.apache.http.util.Asserts", - "org.apache.http.client.config.RequestConfig", - "org.apache.http.StatusLine", - "org.apache.http.impl.DefaultBHttpClientConnection", - "org.apache.http.impl.DefaultHttpResponseFactory", - "org.apache.http.io.SessionOutputBuffer", - "org.apache.http.RequestLine", - "org.apache.http.conn.HttpConnectionFactory", - "org.apache.http.protocol.RequestContent", - "org.apache.http.cookie.CookieIdentityComparator", - "org.apache.http.config.Lookup", - "org.apache.http.HttpMessage", - "org.apache.http.impl.cookie.NetscapeDraftSpecFactory", - "org.apache.http.HttpRequestInterceptor", - "org.apache.http.HeaderElementIterator", - "org.apache.http.client.AuthCache", - "org.apache.http.pool.AbstractConnPool", - "org.apache.http.HeaderIterator", - "org.apache.http.conn.ClientConnectionManager", - "org.apache.http.HttpInetConnection", - "org.apache.http.entity.ContentType", - "org.apache.http.message.LineFormatter", - "org.apache.http.cookie.CookieSpecProvider", - "org.apache.http.HttpRequest", - "org.apache.http.pool.ConnPoolControl", - "org.openecomp.mso.rest.APIResponse", - "org.apache.http.client.BackoffManager", - "org.openecomp.mso.rest.HostNameVerifier", - "org.apache.http.client.AuthenticationStrategy", - "org.apache.http.conn.socket.ConnectionSocketFactory", - "org.apache.http.protocol.RequestTargetHost", - "org.apache.http.pool.PoolEntry", - "org.apache.http.message.BasicLineFormatter", - "org.apache.http.client.methods.HttpUriRequest", - "org.apache.http.protocol.HttpRequestExecutor", - "org.apache.http.client.methods.HttpRequestWrapper", - "org.apache.http.io.SessionInputBuffer", - "org.apache.http.impl.cookie.IgnoreSpecFactory", - "org.apache.http.impl.auth.HttpAuthenticator", - "org.apache.http.impl.conn.ManagedHttpClientConnectionFactory", - "org.apache.http.conn.ConnectTimeoutException", - "org.apache.http.client.methods.AbortableHttpRequest", - "org.apache.http.client.HttpClient", - "org.apache.http.auth.AuthSchemeFactory", - "org.apache.http.cookie.Cookie", - "org.apache.http.protocol.ImmutableHttpProcessor", - "org.apache.http.impl.auth.SPNegoSchemeFactory", - "org.apache.http.protocol.HTTP", - "org.apache.http.impl.conn.PoolingHttpClientConnectionManager$ConfigData", - "org.openecomp.mso.rest.RESTClient$HttpDeleteWithBody", - "org.apache.http.TokenIterator", - "org.openecomp.mso.rest.HttpHeader", - "org.apache.http.client.methods.HttpRequestWrapper$HttpEntityEnclosingRequestWrapper", - "org.apache.http.protocol.HttpCoreContext", - "org.apache.http.impl.conn.CPool", - "org.apache.http.impl.auth.NTLMSchemeFactory", - "org.apache.http.client.utils.URIUtils", - "org.apache.http.ProtocolVersion", - "org.apache.http.client.protocol.RequestExpectContinue", - "org.apache.http.util.VersionInfo", - "org.apache.http.impl.cookie.RFC2109SpecFactory", - "org.apache.http.entity.InputStreamEntity", - "org.apache.http.HttpHost", - "org.apache.http.conn.UnsupportedSchemeException", - "org.apache.http.ProtocolException", - "org.apache.http.impl.cookie.BrowserCompatSpecFactory", - "org.apache.http.client.methods.HttpEntityEnclosingRequestBase", - "org.apache.http.params.BasicHttpParams", - "org.apache.http.client.protocol.HttpClientContext", - "org.apache.http.impl.client.ProxyAuthenticationStrategy", - "org.apache.http.conn.ssl.StrictHostnameVerifier", - "org.apache.http.io.HttpMessageWriterFactory", - "org.apache.http.concurrent.Cancellable", - "org.apache.http.impl.execchain.MainClientExec", - "org.apache.http.protocol.HttpProcessorBuilder", - "org.apache.http.entity.ContentLengthStrategy", - "org.apache.http.impl.execchain.TunnelRefusedException", - "org.apache.http.conn.routing.HttpRoutePlanner", - "org.apache.http.Consts", - "org.apache.http.conn.ssl.SSLConnectionSocketFactory", - "org.apache.http.message.LineParser", - "org.apache.http.impl.cookie.BestMatchSpecFactory", - "org.apache.http.params.HttpParamsNames", - "org.apache.http.conn.ssl.SSLInitializationException", - "org.openecomp.mso.rest.RESTException", - "org.apache.http.util.Args", - "org.apache.http.params.HttpProtocolParams", - "org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy", - "org.apache.http.protocol.RequestUserAgent", - "org.apache.http.config.ConnectionConfig", - "org.apache.http.conn.socket.LayeredConnectionSocketFactory", - "org.apache.http.conn.ssl.BrowserCompatHostnameVerifier", - "org.apache.http.util.TextUtils", - "org.apache.http.HttpResponseInterceptor", - "org.apache.http.impl.EnglishReasonPhraseCatalog", - "org.apache.http.client.config.RequestConfig$Builder", - "org.apache.http.auth.AuthenticationException", - "org.apache.http.auth.AuthState", - "org.apache.http.client.protocol.RequestAddCookies", - "org.apache.http.impl.conn.DefaultRoutePlanner", - "org.apache.http.conn.routing.HttpRoute", - "org.apache.http.impl.conn.CPoolEntry", - "org.apache.http.client.CookieStore", - "org.apache.http.impl.auth.BasicSchemeFactory", - "org.apache.http.conn.socket.PlainConnectionSocketFactory", - "org.apache.http.client.HttpRequestRetryHandler", - "org.apache.http.ParseException", - "org.apache.http.impl.client.CloseableHttpClient", - "org.apache.http.client.protocol.ResponseProcessCookies", - "org.apache.http.message.BasicRequestLine", - "org.apache.http.client.ServiceUnavailableRetryStrategy", - "org.apache.http.client.methods.HttpExecutionAware", - "org.apache.http.impl.client.InternalHttpClient", - "org.apache.http.HeaderElement", - "org.apache.http.client.ConnectionBackoffStrategy", - "org.apache.http.util.CharArrayBuffer", - "org.apache.http.impl.execchain.RetryExec", - "org.apache.http.conn.routing.RouteInfo", - "org.apache.http.client.ResponseHandler", - "org.apache.http.HttpConnection", - "org.apache.http.message.ParserCursor" - ); - } - - private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(RESTClientESTestscaffolding.class.getClassLoader()); - - org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "org.openecomp.mso.rest.RESTClient$HttpDeleteWithBody", - "org.apache.http.conn.socket.PlainConnectionSocketFactory", - "org.apache.http.conn.ssl.AbstractVerifier", - "org.apache.commons.logging.impl.Jdk14Logger", - "org.apache.http.conn.ssl.SSLConnectionSocketFactory", - "org.apache.http.impl.conn.CPool", - "org.apache.http.message.BasicLineFormatter", - "org.apache.http.impl.io.DefaultHttpRequestWriterFactory", - "org.apache.http.ProtocolVersion", - "org.apache.http.HttpVersion", - "org.apache.http.message.BasicLineParser", - "org.apache.http.impl.EnglishReasonPhraseCatalog", - "org.apache.http.impl.DefaultHttpResponseFactory", - "org.apache.http.impl.conn.DefaultHttpResponseParserFactory", - "org.apache.http.impl.conn.ManagedHttpClientConnectionFactory", - "org.apache.http.impl.conn.HttpClientConnectionOperator", - "org.apache.http.impl.conn.DefaultSchemePortResolver", - "org.apache.http.impl.conn.SystemDefaultDnsResolver", - "org.apache.http.util.VersionInfo", - "org.apache.http.impl.client.HttpClientBuilder", - "org.apache.http.protocol.HttpRequestExecutor", - "org.apache.http.impl.DefaultConnectionReuseStrategy", - "org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy", - "org.apache.http.impl.client.AuthenticationStrategyImpl", - "org.apache.http.impl.client.TargetAuthenticationStrategy", - "org.apache.http.impl.client.ProxyAuthenticationStrategy", - "org.apache.http.impl.client.DefaultUserTokenHandler", - "org.apache.http.client.protocol.RequestClientConnControl", - "org.apache.http.client.protocol.ResponseContentEncoding", - "org.apache.http.impl.client.DefaultHttpRequestRetryHandler", - "org.apache.http.impl.cookie.BrowserCompatSpecFactory$SecurityLevel", - "org.apache.http.impl.client.BasicCookieStore", - "org.apache.http.cookie.CookieIdentityComparator", - "org.apache.http.client.config.RequestConfig", - "org.apache.http.client.methods.HttpPut", - "org.apache.http.message.HeaderGroup", - "org.apache.http.message.BasicHeader", - "org.apache.http.entity.AbstractHttpEntity", - "org.apache.http.Consts", - "org.apache.http.entity.ContentType", - "org.apache.http.util.CharArrayBuffer", - "org.apache.http.params.BasicHttpParams", - "org.apache.http.message.BasicRequestLine", - "org.apache.http.protocol.HttpCoreContext", - "org.apache.http.client.protocol.HttpClientContext", - "org.apache.http.auth.AuthProtocolState", - "org.apache.http.client.methods.HttpPost", - "org.apache.http.HttpHost", - "org.apache.http.client.methods.HttpGet", - "org.apache.http.client.methods.HttpPatch", - "org.openecomp.mso.rest.RESTException", - "org.apache.http.client.ClientProtocolException", - "org.apache.http.protocol.HTTP", - "org.apache.http.message.BasicStatusLine", - "org.apache.http.util.ByteArrayBuffer" - ); - } -} diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientTest.java deleted file mode 100644 index a1c83ba70e..0000000000 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTClientTest.java +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ============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.rest; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.IOException; - -import org.apache.http.HttpResponse; -import org.apache.http.HttpVersion; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.entity.StringEntity; -import org.apache.http.message.BasicHttpResponse; -import org.junit.Assert; -import org.junit.Test; -import org.mockito.Mockito; - -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient; -import org.openecomp.mso.rest.RESTException; - -/** - * @version 1.0 - * - */ -public class RESTClientTest { - - @Test - public void testSimpleHTTP() throws RESTException, ClientProtocolException, IOException { - HttpClient mockHttpClient = mock(HttpClient.class); - HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK"); - response.setEntity(new StringEntity("test","UTF-8")); - when(mockHttpClient.execute(Mockito.any())).thenReturn(response); - - RESTClient restClient = new RESTClient("http://localhost"); - restClient.setUnitTestClient(mockHttpClient); - APIResponse apiResponse = restClient.get(); - Assert.assertEquals(200, apiResponse.getStatusCode()); - Assert.assertEquals("test", apiResponse.getResponseBodyAsString()); - } - - @Test - public void testSimpleHTTPS() throws RESTException, ClientProtocolException, IOException { - HttpClient mockHttpClient = mock(HttpClient.class); - HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK"); - response.setEntity(new StringEntity("test","UTF-8")); - when(mockHttpClient.execute(Mockito.any())).thenReturn(response); - - RESTClient restClient = new RESTClient("https://localhost"); - restClient.setUnitTestClient(mockHttpClient); - APIResponse apiResponse = restClient.get(); - Assert.assertEquals(200, apiResponse.getStatusCode()); - Assert.assertEquals("test", apiResponse.getResponseBodyAsString()); - } - -} diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTest.java index 0a46cebf29..bb7460dfc6 100644 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTest.java +++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTest.java @@ -3,6 +3,26 @@ * Mon Nov 14 11:47:42 GMT 2016 */ +/*- + * ============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.rest; import org.junit.Test; diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTestscaffolding.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTestscaffolding.java index 1eb33ddd80..1fabc6bc5d 100644 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTestscaffolding.java +++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTConfigESTestscaffolding.java @@ -4,6 +4,26 @@ * Mon Nov 14 11:47:42 GMT 2016 */ +/*- + * ============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.rest; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTest.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTest.java index aff908ee98..e4ac23b3bd 100644 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTest.java +++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTest.java @@ -3,6 +3,26 @@ * Mon Nov 14 11:47:59 GMT 2016 */ +/*- + * ============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.rest; import org.junit.Test; diff --git a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTestscaffolding.java b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTestscaffolding.java index 13d4dcc026..3e3c9873b7 100644 --- a/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTestscaffolding.java +++ b/bpmn/MSORESTClient/src/test/java/org/openecomp/mso/rest/RESTExceptionESTestscaffolding.java @@ -4,6 +4,26 @@ * Mon Nov 14 11:47:59 GMT 2016 */ +/*- + * ============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.rest; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; diff --git a/bpmn/MSOURN-plugin/pom.xml b/bpmn/MSOURN-plugin/pom.xml index 5ad57a6096..6022f4865b 100644 --- a/bpmn/MSOURN-plugin/pom.xml +++ b/bpmn/MSOURN-plugin/pom.xml @@ -16,12 +16,11 @@ MSO URN Mapping Cockpit Plugin - - org.camunda.bpm.webapp - camunda-webapp-core - ${camunda.version} - + org.camunda.bpm.webapp + camunda-webapp + classes + ${camunda.version} commons-fileupload @@ -29,7 +28,6 @@ - commons-fileupload commons-fileupload @@ -51,11 +49,6 @@ h2 test - - junit - junit - test - javax.servlet javax.servlet-api @@ -68,5 +61,11 @@ ${project.version} compile + + org.evosuite + evosuite-standalone-runtime + ${evosuiteVersion} + test + \ No newline at end of file diff --git a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/URNMapPlugin.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPlugin.java similarity index 87% rename from bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/URNMapPlugin.java rename to bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPlugin.java index 9a02aa0c38..fc08d2d54e 100644 --- a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/URNMapPlugin.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPlugin.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.camunda.bpm.plugin.urnmap; +package org.openecomp.camunda.bpmn.plugin.urnmap; import java.util.Arrays; import java.util.HashSet; @@ -26,8 +26,7 @@ import java.util.List; import java.util.Set; import org.camunda.bpm.cockpit.plugin.spi.impl.AbstractCockpitPlugin; - -import com.att.camunda.bpm.plugin.urnmap.resources.URNMapPluginRootResource; +import org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNMapPluginRootResource; @@ -49,6 +48,6 @@ public class URNMapPlugin extends AbstractCockpitPlugin{ @Override public List getMappingFiles() { - return Arrays.asList("com/att/camunda/bpm/plugin/urnmap/queries/urnMap.xml"); + return Arrays.asList("org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml"); } } diff --git a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/MyBatisExtendedSessionFactory.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java similarity index 98% rename from bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/MyBatisExtendedSessionFactory.java rename to bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java index 8a9d136dd6..728042008d 100644 --- a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/MyBatisExtendedSessionFactory.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisExtendedSessionFactory.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.camunda.bpm.plugin.urnmap.db; +package org.openecomp.camunda.bpmn.plugin.urnmap.db; import org.camunda.bpm.engine.ProcessEngineConfiguration; import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; diff --git a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/MyBatisQueryCommandExecutor.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisQueryCommandExecutor.java similarity index 97% rename from bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/MyBatisQueryCommandExecutor.java rename to bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisQueryCommandExecutor.java index 0bd7d739c5..e7140cd318 100644 --- a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/MyBatisQueryCommandExecutor.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/MyBatisQueryCommandExecutor.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.camunda.bpm.plugin.urnmap.db; +package org.openecomp.camunda.bpmn.plugin.urnmap.db; import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; import org.camunda.bpm.engine.impl.interceptor.Command; diff --git a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/URNData.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNData.java similarity index 96% rename from bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/URNData.java rename to bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNData.java index f8396bb223..ac8b2e15ee 100644 --- a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/URNData.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNData.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.camunda.bpm.plugin.urnmap.db; +package org.openecomp.camunda.bpmn.plugin.urnmap.db; public class URNData { diff --git a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/URNService.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNService.java similarity index 97% rename from bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/URNService.java rename to bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNService.java index 7fd41c131d..3838343aba 100644 --- a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/db/URNService.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNService.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.camunda.bpm.plugin.urnmap.db; +package org.openecomp.camunda.bpmn.plugin.urnmap.db; import java.util.List; diff --git a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/ProcessInstanceResource.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResource.java similarity index 95% rename from bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/ProcessInstanceResource.java rename to bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResource.java index 44fe47b053..4a155809e5 100644 --- a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/ProcessInstanceResource.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResource.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.camunda.bpm.plugin.urnmap.resources; +package org.openecomp.camunda.bpmn.plugin.urnmap.resources; import java.util.List; import java.util.StringTokenizer; @@ -29,10 +29,8 @@ import javax.ws.rs.PUT; import org.camunda.bpm.cockpit.db.QueryParameters; import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginResource; -import com.att.camunda.bpm.plugin.urnmap.db.*; import org.camunda.bpm.cockpit.db.CommandExecutor; - -import com.att.camunda.bpm.plugin.urnmap.db.URNData; +import org.openecomp.camunda.bpmn.plugin.urnmap.db.*; public class ProcessInstanceResource extends AbstractPluginResource { diff --git a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/URNMapPluginRootResource.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResource.java similarity index 92% rename from bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/URNMapPluginRootResource.java rename to bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResource.java index c30eb8d8d7..d31fec66b9 100644 --- a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/URNMapPluginRootResource.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResource.java @@ -18,14 +18,13 @@ * ============LICENSE_END========================================================= */ -package com.att.camunda.bpm.plugin.urnmap.resources; +package org.openecomp.camunda.bpmn.plugin.urnmap.resources; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginRootResource; - -import com.att.camunda.bpm.plugin.urnmap.URNMapPlugin; +import org.openecomp.camunda.bpmn.plugin.urnmap.URNMapPlugin; @SuppressWarnings("deprecation") @Path("plugin/" + URNMapPlugin.ID) diff --git a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/URNResource.java b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java similarity index 94% rename from bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/URNResource.java rename to bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java index 08724db415..5838130a92 100644 --- a/bpmn/MSOURN-plugin/src/main/java/com/att/camunda/bpm/plugin/urnmap/resources/URNResource.java +++ b/bpmn/MSOURN-plugin/src/main/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResource.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package com.att.camunda.bpm.plugin.urnmap.resources; +package org.openecomp.camunda.bpmn.plugin.urnmap.resources; /*** import java.beans.Statement; import java.sql.DriverManager; @@ -44,7 +44,7 @@ import org.camunda.bpm.cockpit.plugin.resource.AbstractCockpitPluginResource; //import org.camunda.bpm.cockpit.plugin.resource.AbstractPluginResource; -import com.att.camunda.bpm.plugin.urnmap.db.URNData; +import org.openecomp.camunda.bpmn.plugin.urnmap.db.URNData; import org.openecomp.mso.logger.MsoLogger; @@ -65,7 +65,7 @@ public class URNResource extends AbstractCockpitPluginResource{ conn = getDBConnection(); PreparedStatement psData = conn - .prepareStatement("select * from ATT_URN_MAPPING order by NAME_"); + .prepareStatement("select * from MSO_URN_MAPPING order by NAME_"); ResultSet r = psData.executeQuery(); @@ -164,7 +164,7 @@ public class URNResource extends AbstractCockpitPluginResource{ conn = getDBConnection(); PreparedStatement psData = conn - .prepareStatement("Insert into ATT_URN_MAPPING values ('" + key_ + "', '" + value_ + "', '1')"); + .prepareStatement("Insert into MSO_URN_MAPPING values ('" + key_ + "', '" + value_ + "', '1')"); psData.executeUpdate(); @@ -189,7 +189,7 @@ public class URNResource extends AbstractCockpitPluginResource{ conn = getDBConnection(); PreparedStatement psData = conn - .prepareStatement("UPDATE ATT_URN_MAPPING set VALUE_ ='"+ d.getURNValue() + "' WHERE NAME_='" + d.getURNName() + "'"); + .prepareStatement("UPDATE MSO_URN_MAPPING set VALUE_ ='"+ d.getURNValue() + "' WHERE NAME_='" + d.getURNName() + "'"); psData.executeUpdate(); diff --git a/bpmn/MSOURN-plugin/src/main/resources/META-INF/services/org.camunda.bpm.cockpit.plugin.spi.CockpitPlugin b/bpmn/MSOURN-plugin/src/main/resources/META-INF/services/org.camunda.bpm.cockpit.plugin.spi.CockpitPlugin index 1e207d8022..9a5055af22 100644 --- a/bpmn/MSOURN-plugin/src/main/resources/META-INF/services/org.camunda.bpm.cockpit.plugin.spi.CockpitPlugin +++ b/bpmn/MSOURN-plugin/src/main/resources/META-INF/services/org.camunda.bpm.cockpit.plugin.spi.CockpitPlugin @@ -1 +1 @@ -com.att.camunda.bpm.plugin.urnmap.URNMapPlugin \ No newline at end of file +org.openecomp.camunda.bpm.plugin.urnmap.URNMapPlugin \ No newline at end of file diff --git a/bpmn/MSOURN-plugin/src/main/resources/mappings.xml b/bpmn/MSOURN-plugin/src/main/resources/mappings.xml index d0a9177b7e..3141dfee4c 100644 --- a/bpmn/MSOURN-plugin/src/main/resources/mappings.xml +++ b/bpmn/MSOURN-plugin/src/main/resources/mappings.xml @@ -27,6 +27,6 @@ - + diff --git a/bpmn/MSOURN-plugin/src/main/resources/com/att/camunda/bpm/plugin/urnmap/queries/urnMap.xml b/bpmn/MSOURN-plugin/src/main/resources/org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml similarity index 80% rename from bpmn/MSOURN-plugin/src/main/resources/com/att/camunda/bpm/plugin/urnmap/queries/urnMap.xml rename to bpmn/MSOURN-plugin/src/main/resources/org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml index ed610305ac..d0b58618e4 100644 --- a/bpmn/MSOURN-plugin/src/main/resources/com/att/camunda/bpm/plugin/urnmap/queries/urnMap.xml +++ b/bpmn/MSOURN-plugin/src/main/resources/org/openecomp/camunda/bpm/plugin/urnmap/queries/urnMap.xml @@ -23,39 +23,39 @@ - + - + - - insert into ATT_URN_MAPPING (NAME_, VALUE_, REV_) + + insert into MSO_URN_MAPPING (NAME_, VALUE_, REV_) values ( #{URNName}, #{URNValue}, 1 ) - + - update ATT_URN_MAPPING set + update MSO_URN_MAPPING set NAME_ = #{URNName}, VALUE_ = #{URNValue}, REV_ = 1 diff --git a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/URNMapPluginESTest.java b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPluginESTest.java similarity index 91% rename from bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/URNMapPluginESTest.java rename to bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPluginESTest.java index 0377b444be..386835c55d 100644 --- a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/URNMapPluginESTest.java +++ b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPluginESTest.java @@ -3,16 +3,19 @@ * Mon Nov 14 13:49:02 GMT 2016 */ -package com.att.camunda.bpm.plugin.urnmap; +package org.openecomp.camunda.bpmn.plugin.urnmap; import org.junit.Test; + import static org.junit.Assert.*; import java.util.List; import java.util.Set; + import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; +import org.openecomp.camunda.bpmn.plugin.urnmap.URNMapPlugin; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) public class URNMapPluginESTest extends URNMapPluginESTestscaffolding { diff --git a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/URNMapPluginESTestscaffolding.java b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPluginESTestscaffolding.java similarity index 90% rename from bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/URNMapPluginESTestscaffolding.java rename to bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPluginESTestscaffolding.java index 472a2bc7e3..d01955f3fb 100644 --- a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/URNMapPluginESTestscaffolding.java +++ b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/URNMapPluginESTestscaffolding.java @@ -4,7 +4,7 @@ * Mon Nov 14 13:49:02 GMT 2016 */ -package com.att.camunda.bpm.plugin.urnmap; +package org.openecomp.camunda.bpmn.plugin.urnmap; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; @@ -25,7 +25,7 @@ public class URNMapPluginESTestscaffolding { @BeforeClass public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "com.att.camunda.bpm.plugin.urnmap.URNMapPlugin"; + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.camunda.bpmn.plugin.urnmap.URNMapPlugin"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; @@ -75,9 +75,9 @@ public class URNMapPluginESTestscaffolding { "org.camunda.bpm.cockpit.plugin.spi.impl.AbstractCockpitPlugin", "org.camunda.bpm.webapp.plugin.resource.AbstractAppPluginRootResource", "org.camunda.bpm.cockpit.plugin.spi.CockpitPlugin", - "com.att.camunda.bpm.plugin.urnmap.resources.URNMapPluginRootResource", + "org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNMapPluginRootResource", "org.camunda.bpm.cockpit.plugin.resource.AbstractCockpitPluginRootResource", - "com.att.camunda.bpm.plugin.urnmap.URNMapPlugin" + "org.openecomp.camunda.bpmn.plugin.urnmap.URNMapPlugin" ); } @@ -85,7 +85,7 @@ public class URNMapPluginESTestscaffolding { org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(URNMapPluginESTestscaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "com.att.camunda.bpm.plugin.urnmap.URNMapPlugin" + "org.openecomp.camunda.bpmn.plugin.urnmap.URNMapPlugin" ); } } diff --git a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/db/URNDataESTest.java b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNDataESTest.java similarity index 95% rename from bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/db/URNDataESTest.java rename to bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNDataESTest.java index c7b241c2d5..f42e2a49a4 100644 --- a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/db/URNDataESTest.java +++ b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNDataESTest.java @@ -3,14 +3,16 @@ * Mon Nov 14 13:48:50 GMT 2016 */ -package com.att.camunda.bpm.plugin.urnmap.db; +package org.openecomp.camunda.bpmn.plugin.urnmap.db; import org.junit.Test; + import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; +import org.openecomp.camunda.bpmn.plugin.urnmap.db.URNData; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) public class URNDataESTest extends URNDataESTestscaffolding { diff --git a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/db/URNDataESTestscaffolding.java b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNDataESTestscaffolding.java similarity index 92% rename from bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/db/URNDataESTestscaffolding.java rename to bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNDataESTestscaffolding.java index 7ae4fabb38..cb0adccf12 100644 --- a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/db/URNDataESTestscaffolding.java +++ b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNDataESTestscaffolding.java @@ -4,7 +4,7 @@ * Mon Nov 14 13:48:50 GMT 2016 */ -package com.att.camunda.bpm.plugin.urnmap.db; +package org.openecomp.camunda.bpmn.plugin.urnmap.db; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; @@ -25,7 +25,7 @@ public class URNDataESTestscaffolding { @BeforeClass public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "com.att.camunda.bpm.plugin.urnmap.db.URNData"; + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.camunda.bpmn.plugin.urnmap.db.URNData"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; @@ -69,7 +69,7 @@ public class URNDataESTestscaffolding { private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(URNDataESTestscaffolding.class.getClassLoader() , - "com.att.camunda.bpm.plugin.urnmap.db.URNData" + "org.openecomp.camunda.bpmn.plugin.urnmap.db.URNData" ); } diff --git a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/db/URNServiceESTest.java b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNServiceESTest.java similarity index 82% rename from bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/db/URNServiceESTest.java rename to bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNServiceESTest.java index 9c71cdebf3..9838ff023d 100644 --- a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/db/URNServiceESTest.java +++ b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNServiceESTest.java @@ -3,15 +3,17 @@ * Mon Nov 14 13:47:07 GMT 2016 */ -package com.att.camunda.bpm.plugin.urnmap.db; +package org.openecomp.camunda.bpmn.plugin.urnmap.db; import org.junit.Test; + import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; +import org.openecomp.camunda.bpmn.plugin.urnmap.db.URNService; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) public class URNServiceESTest extends URNServiceESTestscaffolding { @@ -28,7 +30,7 @@ public class URNServiceESTest extends URNServiceESTestscaffolding { // // no message in exception (getMessage() returned null) // - verifyException("com.att.camunda.bpm.plugin.urnmap.db.URNService", e); + verifyException("org.openecomp.camunda.bpmn.plugin.urnmap.db.URNService", e); } } } diff --git a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/db/URNServiceESTestscaffolding.java b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNServiceESTestscaffolding.java similarity index 93% rename from bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/db/URNServiceESTestscaffolding.java rename to bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNServiceESTestscaffolding.java index d6ce3f31b4..887e11acb6 100644 --- a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/db/URNServiceESTestscaffolding.java +++ b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/db/URNServiceESTestscaffolding.java @@ -4,7 +4,7 @@ * Mon Nov 14 13:47:07 GMT 2016 */ -package com.att.camunda.bpm.plugin.urnmap.db; +package org.openecomp.camunda.bpmn.plugin.urnmap.db; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; @@ -25,7 +25,7 @@ public class URNServiceESTestscaffolding { @BeforeClass public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "com.att.camunda.bpm.plugin.urnmap.db.URNService"; + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.camunda.bpmn.plugin.urnmap.db.URNService"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; @@ -70,7 +70,7 @@ public class URNServiceESTestscaffolding { private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(URNServiceESTestscaffolding.class.getClassLoader() , "org.camunda.bpm.engine.ProcessEngineException", - "com.att.camunda.bpm.plugin.urnmap.db.URNService", + "org.openecomp.camunda.bpmn.plugin.urnmap.db.URNService", "org.camunda.bpm.engine.impl.interceptor.Command", "org.camunda.bpm.engine.ClassLoadingException", "org.camunda.bpm.engine.ProcessEngine", @@ -81,7 +81,7 @@ public class URNServiceESTestscaffolding { "org.camunda.bpm.engine.impl.context.Context", "org.camunda.bpm.engine.impl.util.ReflectUtil", "org.camunda.bpm.engine.ProcessEngineServices", - "com.att.camunda.bpm.plugin.urnmap.db.URNData" + "org.openecomp.camunda.bpmn.plugin.urnmap.db.URNData" ); } diff --git a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/ProcessInstanceResourceESTest.java b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResourceESTest.java similarity index 93% rename from bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/ProcessInstanceResourceESTest.java rename to bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResourceESTest.java index 56d7283026..8f45b8a0af 100644 --- a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/ProcessInstanceResourceESTest.java +++ b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResourceESTest.java @@ -3,17 +3,20 @@ * Mon Nov 14 13:45:16 GMT 2016 */ -package com.att.camunda.bpm.plugin.urnmap.resources; +package org.openecomp.camunda.bpmn.plugin.urnmap.resources; import org.junit.Test; + import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; -import com.att.camunda.bpm.plugin.urnmap.db.URNData; import java.util.NoSuchElementException; + import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; +import org.openecomp.camunda.bpmn.plugin.urnmap.db.URNData; +import org.openecomp.camunda.bpmn.plugin.urnmap.resources.ProcessInstanceResource; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) public class ProcessInstanceResourceESTest extends ProcessInstanceResourceESTestscaffolding { diff --git a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/ProcessInstanceResourceESTestscaffolding.java b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResourceESTestscaffolding.java similarity index 91% rename from bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/ProcessInstanceResourceESTestscaffolding.java rename to bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResourceESTestscaffolding.java index bb115f1586..27ae3e4dcd 100644 --- a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/ProcessInstanceResourceESTestscaffolding.java +++ b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/ProcessInstanceResourceESTestscaffolding.java @@ -4,7 +4,7 @@ * Mon Nov 14 13:45:16 GMT 2016 */ -package com.att.camunda.bpm.plugin.urnmap.resources; +package org.openecomp.camunda.bpmn.plugin.urnmap.resources; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; @@ -25,7 +25,7 @@ public class ProcessInstanceResourceESTestscaffolding { @BeforeClass public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "com.att.camunda.bpm.plugin.urnmap.resources.ProcessInstanceResource"; + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.camunda.bpmn.plugin.urnmap.resources.ProcessInstanceResource"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; @@ -76,11 +76,11 @@ public class ProcessInstanceResourceESTestscaffolding { "org.camunda.bpm.cockpit.plugin.resource.AbstractPluginResource", "org.camunda.bpm.cockpit.db.QueryService", "org.camunda.bpm.engine.ProcessEngine", - "com.att.camunda.bpm.plugin.urnmap.resources.ProcessInstanceResource", + "org.openecomp.camunda.bpmn.plugin.urnmap.resources.ProcessInstanceResource", "org.camunda.bpm.engine.ProcessEngineServices", "org.camunda.bpm.cockpit.db.CommandExecutor", "org.camunda.bpm.cockpit.Cockpit", - "com.att.camunda.bpm.plugin.urnmap.db.URNData" + "org.openecomp.camunda.bpmn.plugin.urnmap.db.URNData" ); } diff --git a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/URNMapPluginRootResourceESTest.java b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResourceESTest.java similarity index 89% rename from bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/URNMapPluginRootResourceESTest.java rename to bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResourceESTest.java index ba562f9bde..85a7f341f2 100644 --- a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/URNMapPluginRootResourceESTest.java +++ b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResourceESTest.java @@ -3,21 +3,25 @@ * Mon Nov 14 13:48:27 GMT 2016 */ -package com.att.camunda.bpm.plugin.urnmap.resources; +package org.openecomp.camunda.bpmn.plugin.urnmap.resources; import org.junit.Test; + import static org.junit.Assert.*; import static org.evosuite.shaded.org.mockito.Mockito.*; import javax.servlet.ServletContext; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.UriInfo; + import org.camunda.bpm.webapp.plugin.resource.AbstractAppPluginRootResource; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.ViolatedAssumptionAnswer; import org.evosuite.runtime.javaee.injection.Injector; import org.junit.runner.RunWith; +import org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNMapPluginRootResource; +import org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNResource; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) public class URNMapPluginRootResourceESTest extends URNMapPluginRootResourceESTestscaffolding { diff --git a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/URNMapPluginRootResourceESTestscaffolding.java b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResourceESTestscaffolding.java similarity index 91% rename from bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/URNMapPluginRootResourceESTestscaffolding.java rename to bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResourceESTestscaffolding.java index 27070528cf..9b556d7006 100644 --- a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/URNMapPluginRootResourceESTestscaffolding.java +++ b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNMapPluginRootResourceESTestscaffolding.java @@ -4,7 +4,7 @@ * Mon Nov 14 13:48:27 GMT 2016 */ -package com.att.camunda.bpm.plugin.urnmap.resources; +package org.openecomp.camunda.bpmn.plugin.urnmap.resources; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; @@ -25,7 +25,7 @@ public class URNMapPluginRootResourceESTestscaffolding { @BeforeClass public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "com.att.camunda.bpm.plugin.urnmap.resources.URNMapPluginRootResource"; + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNMapPluginRootResource"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; @@ -71,7 +71,7 @@ public class URNMapPluginRootResourceESTestscaffolding { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(URNMapPluginRootResourceESTestscaffolding.class.getClassLoader() , "org.camunda.bpm.webapp.plugin.resource.AbstractAppPluginResource", "org.camunda.bpm.webapp.plugin.spi.AppPlugin", - "com.att.camunda.bpm.plugin.urnmap.resources.URNResource", + "org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNResource", "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", "org.camunda.bpm.webapp.plugin.resource.AbstractAppPluginRootResource", "org.openecomp.mso.logger.MsoLogger$ErrorCode", @@ -80,7 +80,7 @@ public class URNMapPluginRootResourceESTestscaffolding { "org.camunda.bpm.engine.rest.exception.RestException", "com.att.eelf.configuration.SLF4jWrapper", "com.att.eelf.i18n.EELFResourceManager", - "com.att.camunda.bpm.plugin.urnmap.db.URNData", + "org.openecomp.camunda.bpmn.plugin.urnmap.db.URNData", "org.openecomp.mso.logger.MsoLogger", "org.openecomp.mso.logger.MessageEnum", "com.att.eelf.i18n.EELFResolvableErrorEnum", @@ -90,7 +90,7 @@ public class URNMapPluginRootResourceESTestscaffolding { "org.camunda.bpm.webapp.AppRuntimeDelegate", "org.openecomp.mso.logger.MsoLogger$StatusCode", "com.att.eelf.configuration.EELFManager", - "com.att.camunda.bpm.plugin.urnmap.resources.URNMapPluginRootResource", + "org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNMapPluginRootResource", "com.att.eelf.i18n.EELFMsgs", "org.camunda.bpm.cockpit.plugin.resource.AbstractCockpitPluginRootResource", "com.att.eelf.configuration.EELFLogger$Level", @@ -112,7 +112,7 @@ public class URNMapPluginRootResourceESTestscaffolding { "com.att.eelf.configuration.EELFLogger$Level", "com.att.eelf.configuration.EELFManager", "org.openecomp.mso.logger.MessageEnum", - "com.att.camunda.bpm.plugin.urnmap.resources.URNResource", + "org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNResource", "org.camunda.bpm.webapp.plugin.resource.AbstractAppPluginRootResource" ); } diff --git a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/URNResourceESTest.java b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResourceESTest.java similarity index 97% rename from bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/URNResourceESTest.java rename to bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResourceESTest.java index 2c0a5eaf67..b6b5478130 100644 --- a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/URNResourceESTest.java +++ b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResourceESTest.java @@ -3,24 +3,27 @@ * Mon Nov 14 13:47:41 GMT 2016 */ -package com.att.camunda.bpm.plugin.urnmap.resources; +package org.openecomp.camunda.bpmn.plugin.urnmap.resources; import org.junit.Test; + import static org.junit.Assert.*; import static org.evosuite.shaded.org.mockito.Mockito.*; import static org.evosuite.runtime.EvoAssertions.*; -import com.att.camunda.bpm.plugin.urnmap.db.URNData; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.List; import java.util.NoSuchElementException; + import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.PrivateAccess; import org.evosuite.runtime.ViolatedAssumptionAnswer; import org.junit.runner.RunWith; +import org.openecomp.camunda.bpmn.plugin.urnmap.db.URNData; +import org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNResource; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) public class URNResourceESTest extends URNResourceESTestscaffolding { diff --git a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/URNResourceESTestscaffolding.java b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResourceESTestscaffolding.java similarity index 97% rename from bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/URNResourceESTestscaffolding.java rename to bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResourceESTestscaffolding.java index 885426f3c8..61ef8e6c0b 100644 --- a/bpmn/MSOURN-plugin/src/test/java/com/att/camunda/bpm/plugin/urnmap/resources/URNResourceESTestscaffolding.java +++ b/bpmn/MSOURN-plugin/src/test/java/org/openecomp/camunda/bpmn/plugin/urnmap/resources/URNResourceESTestscaffolding.java @@ -4,7 +4,7 @@ * Mon Nov 14 13:47:41 GMT 2016 */ -package com.att.camunda.bpm.plugin.urnmap.resources; +package org.openecomp.camunda.bpmn.plugin.urnmap.resources; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; @@ -25,7 +25,7 @@ public class URNResourceESTestscaffolding { @BeforeClass public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "com.att.camunda.bpm.plugin.urnmap.resources.URNResource"; + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNResource"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; @@ -183,7 +183,7 @@ public class URNResourceESTestscaffolding { "org.h2.value.ValueDate", "org.h2.result.SearchRow", "org.h2.table.Table", - "com.att.camunda.bpm.plugin.urnmap.db.URNData", + "org.openecomp.camunda.bpmn.plugin.urnmap.db.URNData", "org.h2.store.fs.FileMemData", "org.h2.value.ValueFloat", "org.openecomp.mso.entity.MsoRequest", @@ -239,7 +239,7 @@ public class URNResourceESTestscaffolding { "org.h2.index.PageDelegateIndex", "org.h2.store.fs.FileBase", "com.mysql.jdbc.StatementImpl$CancelTask", - "com.att.camunda.bpm.plugin.urnmap.resources.URNResource", + "org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNResource", "org.h2.message.TraceWriter", "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", "com.att.eelf.configuration.EELFLogger", @@ -337,7 +337,7 @@ public class URNResourceESTestscaffolding { "com.att.eelf.configuration.EELFLogger$Level", "com.att.eelf.configuration.EELFManager", "org.openecomp.mso.logger.MessageEnum", - "com.att.camunda.bpm.plugin.urnmap.resources.URNResource", + "org.openecomp.camunda.bpmn.plugin.urnmap.resources.URNResource", "org.camunda.bpm.cockpit.Cockpit", "org.h2.jdbcx.JdbcConnectionPool", "org.h2.message.TraceObject", diff --git a/bpmn/pom.xml b/bpmn/pom.xml index ca9d69c5bc..ed062ba1c3 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -1,5 +1,5 @@ - + + 4.0.0 @@ -13,30 +13,30 @@ BPMN Subsystem BPMN Subsystem for MSO pom - + - 7.3.0 + 7.6.0 1.2 1.3.173 2.4.7 9.5.1-8 - 4.11 1.6 - + UTF-8 UTF-8 - + MSOCoreBPMN + MSOMockServer MSORESTClient - MSOGammaBPMN + MSOCommonBPMN + MSOInfrastructureBPMN MSOURN-plugin MSOCockpit - - - + + @@ -67,11 +67,6 @@ Saxon-HE ${saxon.version} - - junit - junit - ${junit.version} - xmlunit xmlunit @@ -90,7 +85,7 @@ - + org.apache.httpcomponents @@ -101,18 +96,26 @@ httpclient - + - + org.apache.maven.plugins maven-surefire-plugin 2.17 - true + false -Xss1m @{argLine} + + + + usedefaultlisteners + true + + + + + org.jboss + jandex + + + org.javassist + javassist + + + org.jboss.logging + jboss-logging + + + org.jboss.logging + jboss-logging-annotations + + + org.jboss.spec.javax.transaction + jboss-transaction-api_1.2_spec + + + antlr + antlr + + + dom4j + dom4j + + + @@ -148,7 +189,7 @@ Messages and Codes test test - http://wiki.web.att.com + diff --git a/common/src/main/java/org/openecomp/mso/db/HibernateUtils.java b/common/src/main/java/org/openecomp/mso/db/HibernateUtils.java new file mode 100644 index 0000000000..ba452fff44 --- /dev/null +++ b/common/src/main/java/org/openecomp/mso/db/HibernateUtils.java @@ -0,0 +1,55 @@ +/*- + * ============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.db; + +import org.hibernate.cfg.Configuration; +import org.hibernate.SessionFactory; +import org.hibernate.service.ServiceRegistry; +import org.hibernate.boot.registry.StandardServiceRegistryBuilder; +import java.net.URL; + +public abstract class HibernateUtils { + + protected SessionFactory sessionFactory; + + protected synchronized void initializeHibernate(URL hibernateConfigFile) { + // Can be null, in that case, we skip the loading + if (hibernateConfigFile != null) { + // Already initialized, skip + if (sessionFactory != null) { + return; + } + + Configuration conf = new Configuration().configure(hibernateConfigFile); + ServiceRegistry sr = new StandardServiceRegistryBuilder().applySettings(conf.getProperties()).build(); + sessionFactory = conf.buildSessionFactory(sr); + } + } + + public SessionFactory getSessionFactory() { + if (sessionFactory == null) { + initializeHibernate(getHibernateConfigFile()); + } + return sessionFactory; + } + + protected abstract URL getHibernateConfigFile(); +} diff --git a/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java b/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java index 323c4dbe99..976b579fcf 100644 --- a/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java +++ b/common/src/main/java/org/openecomp/mso/properties/MsoJsonProperties.java @@ -112,10 +112,10 @@ public class MsoJsonProperties extends AbstractMsoProperties { public synchronized MsoJsonProperties clone() { MsoJsonProperties msoCopy = new MsoJsonProperties(); - ObjectMapper mapper = new ObjectMapper(); + ObjectMapper newMapper = new ObjectMapper(); try { - msoCopy.jsonRootNode = mapper.createObjectNode(); - msoCopy.jsonRootNode = mapper.readValue(this.jsonRootNode.toString(), JsonNode.class); + msoCopy.jsonRootNode = newMapper.createObjectNode(); + msoCopy.jsonRootNode = newMapper.readValue(this.jsonRootNode.toString(), JsonNode.class); } catch (JsonParseException e) { LOGGER.debug("JsonParseException when cloning the object:" + this.propertiesFileName, e); } catch (JsonMappingException e) { diff --git a/common/src/test/java/org/openecomp/mso/utils/CryptoUtilsESTest.java b/common/src/test/java/org/openecomp/mso/utils/CryptoUtilsESTest.java index 397db374bb..59e8cec92d 100644 --- a/common/src/test/java/org/openecomp/mso/utils/CryptoUtilsESTest.java +++ b/common/src/test/java/org/openecomp/mso/utils/CryptoUtilsESTest.java @@ -11,6 +11,8 @@ import static org.evosuite.runtime.EvoAssertions.*; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; +import java.security.InvalidKeyException; + import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @@ -65,7 +67,7 @@ public class CryptoUtilsESTest extends CryptoUtilsESTestscaffolding { CryptoUtils.decrypt("B20000000000000000000000000000000000000000000000", "B20000000000000000000000000000000000000000000000"); fail("Expecting exception: IllegalBlockSizeException"); - } catch(IllegalBlockSizeException e) { + } catch(IllegalBlockSizeException | InvalidKeyException e) { } } diff --git a/mso-api-handlers/mso-api-handler-common/pom.xml b/mso-api-handlers/mso-api-handler-common/pom.xml index 859155a1b7..e11fbb8c25 100644 --- a/mso-api-handlers/mso-api-handler-common/pom.xml +++ b/mso-api-handlers/mso-api-handler-common/pom.xml @@ -46,16 +46,6 @@ commons-io - - org.apache.httpcomponents - httpcore - - - - org.apache.httpcomponents - httpclient - - javax javaee-web-api diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java index 5cf859d537..00e52ab7e4 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java @@ -52,7 +52,7 @@ public class CamundaVIDRequest { private CamundaInput requestId; @JsonProperty(CommonConstants.REQUEST_ID_HEADER) - private CamundaInput attMsoRequestId; + private CamundaInput msoRequestId; @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) @@ -122,13 +122,13 @@ public class CamundaVIDRequest { } @JsonProperty(CommonConstants.REQUEST_ID_HEADER) - public CamundaInput getAttMsoRequestId() { - return attMsoRequestId; + public CamundaInput getMsoRequestId() { + return msoRequestId; } @JsonProperty(CommonConstants.REQUEST_ID_HEADER) - public void setAttMsoRequestId(CamundaInput attMsoRequestId) { - this.attMsoRequestId = attMsoRequestId; + public void setMsoRequestId(CamundaInput msoRequestIdp) { + this.msoRequestId = msoRequestIdp; } @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java index dd83d24c9e..d893a12b24 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java @@ -7,9 +7,9 @@ * 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. @@ -38,7 +38,7 @@ public class CamundaClient extends RequestClient{ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); public CamundaClient() { - super(CommonConstants.CAMUNDA); + super(CommonConstants.CAMUNDA); } @@ -141,8 +141,8 @@ public class CamundaClient extends RequestClient{ if(schemaVersion == null){ schemaVersion = ""; } - - + + try{ CamundaRequest camundaRequest = new CamundaRequest(); CamundaInput camundaInput = new CamundaInput(); @@ -221,7 +221,6 @@ public class CamundaClient extends RequestClient{ try{ CamundaVIDRequest camundaRequest = new CamundaVIDRequest(); - BpmnRequest bpmnRequest = new BpmnRequest(); CamundaInput serviceInput = new CamundaInput(); CamundaInput host = new CamundaInput(); CamundaInput requestIdInput= new CamundaInput(); @@ -253,26 +252,11 @@ public class CamundaClient extends RequestClient{ vfModuleTypeInput.setValue(vfModuleType); networkTypeInput.setValue(networkType); - bpmnRequest.setRequestId(requestIdInput); - bpmnRequest.setIsBaseVfModule(isBaseVfModuleInput); - bpmnRequest.setRecipeTimeout(recipeTimeoutInput); - bpmnRequest.setRequestAction(requestActionInput); - bpmnRequest.setServiceInstanceId(serviceInstanceIdInput); - bpmnRequest.setVnfId(vnfIdInput); - bpmnRequest.setVfModuleId(vfModuleIdInput); - bpmnRequest.setVolumeGroupId(volumeGroupIdInput); - bpmnRequest.setNetworkId(networkIdInput); - bpmnRequest.setServiceType(serviceTypeInput); - bpmnRequest.setVnfType(vnfTypeInput); - bpmnRequest.setVfModuleType(vfModuleTypeInput); - bpmnRequest.setNetworkType(networkTypeInput); - //bpmnRequest.setRequestDetails(requestDetailsInput); - serviceInput.setValue(requestDetails); camundaRequest.setServiceInput(serviceInput); camundaRequest.setHost(host); camundaRequest.setRequestId(requestIdInput); - camundaRequest.setAttMsoRequestId(requestIdInput); + camundaRequest.setMsoRequestId(requestIdInput); camundaRequest.setIsBaseVfModule(isBaseVfModuleInput); camundaRequest.setRecipeTimeout(recipeTimeoutInput); camundaRequest.setRequestAction(requestActionInput); diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java index 3a9ad60ac2..187e0ed0a6 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java @@ -26,11 +26,11 @@ public final class CommonConstants { public static final String DEFAULT_BPEL_AUTH = "admin:admin"; public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; - public static final String REQUEST_ID_HEADER = "att-mso-request-id"; - public static final String REQUEST_TIMEOUT_HEADER = "att-mso-service-request-timeout"; - public static final String SCHEMA_VERSION_HEADER = "att-mso-schema-version"; - public static final String SERVICE_INSTANCE_ID_HEADER = "att-mso-service-instance-id"; - public static final String ACTION_HEADER = "att-mso-action"; + public static final String REQUEST_ID_HEADER = "mso-request-id"; + public static final String REQUEST_TIMEOUT_HEADER = "mso-service-request-timeout"; + public static final String SCHEMA_VERSION_HEADER = "mso-schema-version"; + public static final String SERVICE_INSTANCE_ID_HEADER = "mso-service-instance-id"; + public static final String ACTION_HEADER = "mso-action"; public static final String CAMUNDA_SERVICE_INPUT = "bpmnRequest"; public static final String CAMUNDA_ROOT_INPUT = "variables"; @@ -45,7 +45,7 @@ public final class CommonConstants { public static final int BPEL = 0; public static final int CAMUNDA = 1; public static final String CAMUNDA_HOST = "host"; - public static final String SDNC_UUID_HEADER = "att-mso-sdnc-request-id"; + public static final String SDNC_UUID_HEADER = "mso-sdnc-request-id"; public static final String REQUEST_ID_VARIABLE = "requestId"; public static final String IS_BASE_VF_MODULE_VARIABLE = "isBaseVfModule"; diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ValidationException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ValidationException.java index 0136a2d3b7..eb7a01210f 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ValidationException.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/ValidationException.java @@ -7,9 +7,9 @@ * 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. @@ -26,12 +26,13 @@ public class ValidationException extends Exception { /** * This class simply extends Exception (without addition additional functionality) * to provide an identifier for RequestsDB related exceptions on create, delete, query. - * + * * **/ private static final long serialVersionUID = 1L; private static final String validationFailMessage = "No valid $ELEMENT is specified"; + private static final String invalidElementMessage = "$ELEMENT is not valid in the $VERSION version"; public ValidationException (String msg) { super (validationFailMessage.replaceAll ("\\$ELEMENT", msg)); @@ -40,5 +41,7 @@ public class ValidationException extends Exception { public ValidationException (String msg, Exception cause) { super (validationFailMessage.replaceAll ("\\$ELEMENT", msg), cause); } - + public ValidationException(String msg, String version) { + super(invalidElementMessage.replaceAll("\\$ELEMENT", msg).replaceAll("\\$VERSION", version)); + } } diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java index 46e3a4602f..a0bed927e8 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/BPELRestClientTest.java @@ -70,8 +70,8 @@ public class BPELRestClientTest { JsonMappingException, IOException { - String responseBody ="" + "req5" diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java index bd2fee6f1e..a988111d61 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java @@ -54,7 +54,7 @@ public class CamundaRequestTest { CamundaInput svcid = new CamundaInput(); CamundaInput timeout = new CamundaInput(); camundaInput - .setValue(" 155415ab-b4a7-4382-b4c6-d17d950604Layer3ServiceActivateRequestOMXhttps://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws50515631 SDN-ETHERNET-INTERNETHI/VLXM/950604//SW_INTERNETSubName01 MTSNJA4LCP1 "); + .setValue(" 155415ab-b4a7-4382-b4c6-d17d950604Layer3ServiceActivateRequestOMXhttps://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws50515631 SDN-ETHERNET-INTERNETHI/VLXM/950604//SW_INTERNETSubName01 MTSNJA4LCP1 "); camundaRequest.setServiceInput(camundaInput); host.setValue("localhost"); camundaRequest.setHost(host); @@ -72,8 +72,8 @@ public class CamundaRequestTest { String json = mapper.writeValueAsString(camundaRequest); System.out.println(json); assertEquals( - "{\"variables\":{\""+CommonConstants.CAMUNDA_SERVICE_INPUT+"\":{\"value\":\" 155415ab-b4a7-4382-b4c6-d17d950604Layer3ServiceActivateRequestOMXhttps://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws50515631 SDN-ETHERNET-INTERNETHI/VLXM/950604//SW_INTERNETSubName01 MTSNJA4LCP1 \",\"type\":\"String\"}" + - ",\"host\":{\"value\":\"localhost\",\"type\":\"String\"},\"att-mso-schema-version\":{\"value\":\"v1\",\"type\":\"String\"},\"att-mso-request-id\":{\"value\":\"reqid123\",\"type\":\"String\"},\"att-mso-service-instance-id\":{\"value\":\"svcid123\",\"type\":\"String\"},\"att-mso-service-request-timeout\":{\"value\":\"\",\"type\":\"String\"}}}", + "{\"variables\":{\""+CommonConstants.CAMUNDA_SERVICE_INPUT+"\":{\"value\":\" 155415ab-b4a7-4382-b4c6-d17d950604Layer3ServiceActivateRequestOMXhttps://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws50515631 SDN-ETHERNET-INTERNETHI/VLXM/950604//SW_INTERNETSubName01 MTSNJA4LCP1 \",\"type\":\"String\"}" + + ",\"host\":{\"value\":\"localhost\",\"type\":\"String\"},\"mso-schema-version\":{\"value\":\"v1\",\"type\":\"String\"},\"mso-request-id\":{\"value\":\"reqid123\",\"type\":\"String\"},\"mso-service-instance-id\":{\"value\":\"svcid123\",\"type\":\"String\"},\"mso-service-request-timeout\":{\"value\":\"\",\"type\":\"String\"}}}", json); } diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java index ba2c5524b5..6318d43485 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/ResponseHandlerTest.java @@ -65,8 +65,8 @@ public class ResponseHandlerTest { @Test public void tesParseBpelResponse () throws JsonGenerationException, JsonMappingException, IOException { - String body = "" + "req5" diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml index 0cce04ae19..71f8249546 100644 --- a/mso-api-handlers/mso-api-handler-infra/pom.xml +++ b/mso-api-handlers/mso-api-handler-infra/pom.xml @@ -95,7 +95,7 @@ maven-war-plugin - 2.3 + 2.4 WebContent false diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java index 34d739b310..12cfdb0ee8 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Constants.java @@ -7,9 +7,9 @@ * 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. @@ -27,23 +27,24 @@ public class Constants { public static final String NETWORK_TYPES_PATH = "/{version: v1|v2|v3}/network-types"; public static final String VF_MODULE_MODEL_NAMES_PATH = "/{version: v2|v3}/vf-module-model-names"; public static final String REQUEST_ID_PATH = "/{request-id}"; - + public static final String STATUS_SUCCESS = "SUCCESS"; - + public static final String MODIFIED_BY_APIHANDLER = "APIH"; - + public static final String SCHEMA_VERSION_V1 = "v1"; public static final String SCHEMA_VERSION_V2 = "v2"; public static final String SCHEMA_VERSION_V3 = "v3"; - + public static final long PROGRESS_REQUEST_COMPLETED = 100L; public static final long PROGRESS_REQUEST_RECEIVED = 0L; public static final long PROGRESS_REQUEST_IN_PROGRESS = 20L; - + public static final String VNF_TYPE_WILDCARD = "*"; - + public static final String VOLUME_GROUP_COMPONENT_TYPE = "VOLUME_GROUP"; - - public static final String VALID_INSTANCE_NAME_FORMAT = "^[a-zA-Z][a-zA-Z0-9_-]*$"; - -} + + public static final String VALID_INSTANCE_NAME_FORMAT = "^[a-zA-Z][a-zA-Z0-9._-]*$"; + + public static final String A_LA_CARTE = "aLaCarte"; +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java index 64bdc3f269..5b84a59b6b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java @@ -7,9 +7,9 @@ * 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. @@ -22,10 +22,9 @@ package org.openecomp.mso.apihandlerinfra; import java.io.StringReader; import java.io.StringWriter; +import java.io.IOException; import java.sql.Timestamp; -import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -35,29 +34,25 @@ import java.util.StringTokenizer; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamResult; +import org.codehaus.jackson.JsonGenerationException; +import org.codehaus.jackson.map.JsonMappingException; import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig.Feature; import org.codehaus.jackson.map.annotate.JsonSerialize; +import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; import org.hibernate.Session; -import org.jboss.resteasy.specimpl.MultivaluedMapImpl; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.openecomp.mso.apihandler.common.ErrorNumbers; import org.openecomp.mso.apihandler.common.ValidationException; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.CloudConfiguration; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ModelInfo; @@ -65,18 +60,17 @@ import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.PolicyException; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstance; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstanceList; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestError; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestInfo; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestParameters; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceException; import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest; -import org.openecomp.mso.apihandlerinfra.vnfbeans.ActionType; -import org.openecomp.mso.apihandlerinfra.vnfbeans.ObjectFactory; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestInfo; import org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType; import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfInputs; import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequest; -import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.db.HibernateUtils; import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.requestsdb.HibernateUtil; +import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb; import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; import org.openecomp.mso.utils.UUIDChecker; @@ -107,235 +101,292 @@ public class MsoRequest { private String vfModuleType; private String vfModuleModelName; private String networkType; - private String asdcServiceModelVersion; + private String asdcServiceModelVersion; private String requestScope; + private int reqVersion; + private boolean aLaCarteFlag = false; private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); private static final String NOT_PROVIDED = "not provided"; + protected HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb (); + MsoRequest (String requestId) { this.requestId = requestId; this.startTime = System.currentTimeMillis(); MsoLogger.setLogContext (requestId, null); - } - + } + MsoRequest () { this.startTime = System.currentTimeMillis(); MsoLogger.setLogContext (requestId, null); } - - + + public Response buildServiceErrorResponse (int httpResponseCode, MsoException exceptionType, String text, String messageId, List variables) { - this.errorCode = messageId; - - if (text != null) { - this.errorMessage = text; - } - else { - this.errorMessage = ""; - } - this.httpResponse = Integer.toString(httpResponseCode); - if(errorMessage.length() > 1999){ - errorMessage = errorMessage.substring(0, 1999); - } - - RequestError re = new RequestError(); - - if(exceptionType.name().equals("PolicyException")){ - - PolicyException pe = new PolicyException(); - pe.setMessageId(messageId); - pe.setText(text); - if(variables != null){ - for(String variable: variables){ - pe.getVariables().add(variable); - } - } - re.setPolicyException(pe); - - } else { - - ServiceException se = new ServiceException(); - se.setMessageId(messageId); - se.setText(text); - if(variables != null){ - if(variables != null){ - for(String variable: variables){ - se.getVariables().add(variable); - } - } - } - re.setServiceException(se); - } + this.errorCode = messageId; + + if (text != null) { + this.errorMessage = text; + } + else { + this.errorMessage = ""; + } + this.httpResponse = Integer.toString(httpResponseCode); + if(errorMessage.length() > 1999){ + errorMessage = errorMessage.substring(0, 1999); + } + + RequestError re = new RequestError(); + + if(exceptionType.name().equals("PolicyException")){ + + PolicyException pe = new PolicyException(); + pe.setMessageId(messageId); + pe.setText(text); + if(variables != null){ + for(String variable: variables){ + pe.getVariables().add(variable); + } + } + re.setPolicyException(pe); + + } else { + + ServiceException se = new ServiceException(); + se.setMessageId(messageId); + se.setText(text); + if(variables != null){ + if(variables != null){ + for(String variable: variables){ + se.getVariables().add(variable); + } + } + } + re.setServiceException(se); + } String requestErrorStr = null; try{ - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_DEFAULT); - requestErrorStr = mapper.writeValueAsString(re); + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_DEFAULT); + requestErrorStr = mapper.writeValueAsString(re); }catch(Exception e){ - msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in buildServiceErrorResponse writing exceptionType to string ", e); + msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, "", "", MsoLogger.ErrorCode.DataError, "Exception in buildServiceErrorResponse writing exceptionType to string ", e); } - + return Response.status (httpResponseCode).entity(requestErrorStr).build (); - + } + private int reqVersionToInt(String version){ + if(version!=null){ + return Integer.parseInt(version.substring(1)); + }else{ + return 0; + } + } // Parse request JSON - void parse (ServiceInstancesRequest sir, HashMap instanceIdMap, Action action) throws ValidationException { + void parse (ServiceInstancesRequest sir, HashMap instanceIdMap, Action action, String version) throws ValidationException { msoLogger.debug ("Validating the Service Instance request"); - + this.sir = sir; this.action = action; - + this.reqVersion = reqVersionToInt(version); + msoLogger.debug ("Incoming version is: " + version + " coverting to int: " + this.reqVersion); + + try{ - ObjectMapper mapper = new ObjectMapper(); - //mapper.configure(Feature.WRAP_ROOT_VALUE, true); - requestJSON = mapper.writeValueAsString(sir.getRequestDetails()); + ObjectMapper mapper = new ObjectMapper(); + //mapper.configure(Feature.WRAP_ROOT_VALUE, true); + requestJSON = mapper.writeValueAsString(sir.getRequestDetails()); } catch(Exception e){ - throw new ValidationException ("Parse ServiceInstanceRequest to JSON string"); - } - + throw new ValidationException ("Parse ServiceInstanceRequest to JSON string"); + } + if(instanceIdMap != null){ - if(instanceIdMap.get("serviceInstanceId") != null){ - if (!UUIDChecker.isValidUUID (instanceIdMap.get ("serviceInstanceId"))) { - throw new ValidationException ("serviceInstanceId"); - } - this.sir.setServiceInstanceId(instanceIdMap.get("serviceInstanceId")); - } - - if(instanceIdMap.get("vnfInstanceId") != null){ - if (!UUIDChecker.isValidUUID (instanceIdMap.get ("vnfInstanceId"))) { - throw new ValidationException ("vnfInstanceId"); - } - this.sir.setVnfInstanceId(instanceIdMap.get("vnfInstanceId")); - } - - if(instanceIdMap.get("vfModuleInstanceId") != null){ - if (!UUIDChecker.isValidUUID (instanceIdMap.get ("vfModuleInstanceId"))) { - throw new ValidationException ("vfModuleInstanceId"); - } - this.sir.setVfModuleInstanceId(instanceIdMap.get("vfModuleInstanceId")); - } - - if(instanceIdMap.get("volumeGroupInstanceId") != null){ - if (!UUIDChecker.isValidUUID (instanceIdMap.get ("volumeGroupInstanceId"))) { - throw new ValidationException ("volumeGroupInstanceId"); - } - this.sir.setVolumeGroupInstanceId(instanceIdMap.get("volumeGroupInstanceId")); - } - - if(instanceIdMap.get("networkInstanceId") != null){ - if (!UUIDChecker.isValidUUID (instanceIdMap.get ("networkInstanceId"))) { - throw new ValidationException ("networkInstanceId"); - } - this.sir.setNetworkInstanceId(instanceIdMap.get("networkInstanceId")); - } + if(instanceIdMap.get("serviceInstanceId") != null){ + if (!UUIDChecker.isValidUUID (instanceIdMap.get ("serviceInstanceId"))) { + throw new ValidationException ("serviceInstanceId"); + } + this.sir.setServiceInstanceId(instanceIdMap.get("serviceInstanceId")); + } + + if(instanceIdMap.get("vnfInstanceId") != null){ + if (!UUIDChecker.isValidUUID (instanceIdMap.get ("vnfInstanceId"))) { + throw new ValidationException ("vnfInstanceId"); + } + this.sir.setVnfInstanceId(instanceIdMap.get("vnfInstanceId")); + } + + if(instanceIdMap.get("vfModuleInstanceId") != null){ + if (!UUIDChecker.isValidUUID (instanceIdMap.get ("vfModuleInstanceId"))) { + throw new ValidationException ("vfModuleInstanceId"); + } + this.sir.setVfModuleInstanceId(instanceIdMap.get("vfModuleInstanceId")); + } + + if(instanceIdMap.get("volumeGroupInstanceId") != null){ + if (!UUIDChecker.isValidUUID (instanceIdMap.get ("volumeGroupInstanceId"))) { + throw new ValidationException ("volumeGroupInstanceId"); + } + this.sir.setVolumeGroupInstanceId(instanceIdMap.get("volumeGroupInstanceId")); + } + + if(instanceIdMap.get("networkInstanceId") != null){ + if (!UUIDChecker.isValidUUID (instanceIdMap.get ("networkInstanceId"))) { + throw new ValidationException ("networkInstanceId"); + } + this.sir.setNetworkInstanceId(instanceIdMap.get("networkInstanceId")); + } } - + + RequestParameters requestParameters = sir.getRequestDetails().getRequestParameters(); + if(this.reqVersion >= 3){ + if(requestParameters!=null){ + this.aLaCarteFlag = sir.getRequestDetails().getRequestParameters().getALaCarte(); + }else{ + this.aLaCarteFlag = false; + } + }else{ + this.aLaCarteFlag = true; + } + + if(requestParameters != null && (reqVersion < 3) && requestParameters.getAutoBuildVfModules()){ + throw new ValidationException("AutoBuildVfModule", version); + } + this.modelInfo = sir.getRequestDetails().getModelInfo(); - + if (this.modelInfo == null) { throw new ValidationException ("model-info"); } - + this.requestInfo = sir.getRequestDetails().getRequestInfo(); - + if (this.requestInfo == null) { throw new ValidationException ("requestInfo"); } - + if (modelInfo.getModelType () == null) { - throw new ValidationException ("modelType"); - } - + throw new ValidationException ("modelType"); + } + this.requestScope = modelInfo.getModelType().name(); - - if (empty (modelInfo.getModelInvariantId ()) && !(requestScope.equalsIgnoreCase (ModelType.network.name ()) && - (action == Action.createInstance || action == Action.updateInstance))) { - throw new ValidationException ("modelInvariantId"); + + //is required for serviceInstance delete macro when aLaCarte=false (v3) + //create and updates except for network + if (empty (modelInfo.getModelInvariantId ()) && ((this.reqVersion >2 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) || + !(requestScope.equalsIgnoreCase (ModelType.network.name ())) && (action == Action.createInstance || action == Action.updateInstance))) { + throw new ValidationException ("modelInvariantId"); } - + if (!empty (modelInfo.getModelInvariantId ()) && !UUIDChecker.isValidUUID (modelInfo.getModelInvariantId ())) { - throw new ValidationException ("modelInvariantId format"); - } - - if (empty (modelInfo.getModelName ()) && (action == Action.createInstance || action == Action.updateInstance || (action == Action.deleteInstance && - (requestScope.equalsIgnoreCase (ModelType.network.name ()) || requestScope.equalsIgnoreCase (ModelType.vfModule.name ()))))) { - throw new ValidationException ("modelName"); - } - - if (empty (modelInfo.getModelVersion ()) && !(requestScope.equalsIgnoreCase (ModelType.network.name ()) && - (action == Action.createInstance || action == Action.updateInstance))) { - throw new ValidationException ("modelVersion"); - } - + throw new ValidationException ("modelInvariantId format"); + } + + if (this.reqVersion <= 2 && empty (modelInfo.getModelName ()) && (action == Action.createInstance || action == Action.updateInstance || (action == Action.deleteInstance && + (requestScope.equalsIgnoreCase (ModelType.network.name ()) || requestScope.equalsIgnoreCase (ModelType.vfModule.name ()))))) { + throw new ValidationException ("modelName"); + } + if(this.reqVersion > 2 && empty (modelInfo.getModelName ()) && (action == Action.createInstance || action == Action.updateInstance || (action == Action.deleteInstance && + (requestScope.equalsIgnoreCase (ModelType.vfModule.name ()))))){ + throw new ValidationException ("modelName"); + } + + if (empty (modelInfo.getModelVersion ()) && ((this.reqVersion >2 && !this.aLaCarteFlag && requestScope.equalsIgnoreCase(ModelType.service.name()) && action == Action.deleteInstance) || + !(requestScope.equalsIgnoreCase (ModelType.network.name ())) && (action == Action.createInstance || action == Action.updateInstance))) { + throw new ValidationException ("modelVersion"); + } + if(requestScope.equalsIgnoreCase(ModelType.vnf.name()) && action != Action.deleteInstance && empty (modelInfo.getModelCustomizationName ())) { - throw new ValidationException ("modelCustomizationName"); + if(this.reqVersion<=2){ + throw new ValidationException ("modelCustomizationName"); + } else if (!UUIDChecker.isValidUUID (modelInfo.getModelCustomizationId())) { + throw new ValidationException ("modelCustomizationId or modelCustomizationName"); + } + } + + if(this.reqVersion > 2 && (!UUIDChecker.isValidUUID (modelInfo.getModelCustomizationId())) && requestScope.equalsIgnoreCase (ModelType.network.name ()) + && (action == Action.updateInstance || action == Action.createInstance)){ + throw new ValidationException ("modelCustomizationId"); } - + + if(!empty(modelInfo.getModelNameVersionId())){ + modelInfo.setModelVersionId(modelInfo.getModelNameVersionId()); + } + if(!empty(modelInfo.getModelVersionId())){ + modelInfo.setModelNameVersionId(modelInfo.getModelVersionId()); + } + this.cloudConfiguration = sir.getRequestDetails ().getCloudConfiguration (); - if (!requestScope.equalsIgnoreCase (ModelType.service.name ()) && cloudConfiguration == null) { - throw new ValidationException ("cloudConfiguration"); + if ( (((!this.aLaCarteFlag && requestScope.equalsIgnoreCase (ModelType.service.name ())) || + (!requestScope.equalsIgnoreCase (ModelType.service.name ())) && action != Action.updateInstance)) + && cloudConfiguration == null) { + throw new ValidationException ("cloudConfiguration"); } - + if (cloudConfiguration != null) { - if (empty (cloudConfiguration.getLcpCloudRegionId ())) { - throw new ValidationException ("lcpCloudRegionId"); - } - if (empty (cloudConfiguration.getTenantId ())) { - throw new ValidationException ("tenantId"); - } + if (empty (cloudConfiguration.getLcpCloudRegionId ())) { + throw new ValidationException ("lcpCloudRegionId"); + } + if (empty (cloudConfiguration.getTenantId ())) { + throw new ValidationException ("tenantId"); + } } - + + + if (requestScope.equalsIgnoreCase (ModelType.service.name ()) && action == Action.createInstance) { - if (sir.getRequestDetails ().getRequestParameters () == null) { - throw new ValidationException ("requestParameters"); - } - if (empty (sir.getRequestDetails ().getRequestParameters ().getSubscriptionServiceType ())) { - throw new ValidationException ("subscriptionServiceType"); - } - } - + if (requestParameters == null) { + throw new ValidationException ("requestParameters"); + } + if (empty (requestParameters.getSubscriptionServiceType ())) { + throw new ValidationException ("subscriptionServiceType"); + } + } + if(requestScope.equalsIgnoreCase(ModelType.service.name())){ - this.serviceInstanceType = modelInfo.getModelName(); + this.serviceInstanceType = modelInfo.getModelName(); } - + if(requestScope.equalsIgnoreCase(ModelType.network.name())){ - this.networkType = modelInfo.getModelName(); - } - - // Verify instanceName existence and format - if (empty (requestInfo.getInstanceName ()) && action == Action.createInstance) { - throw new ValidationException ("instanceName"); - } - - if (!empty (requestInfo.getInstanceName ()) && !requestInfo.getInstanceName ().matches (Constants.VALID_INSTANCE_NAME_FORMAT)) { - throw new ValidationException ("instanceName format"); - } - + this.networkType = modelInfo.getModelName(); + } + + // Verify instanceName existence and format except for macro serviceInstance + if (this.reqVersion < 3 && requestScope.equalsIgnoreCase (ModelType.service.name ()) && empty (requestInfo.getInstanceName ()) && action == Action.createInstance) { + throw new ValidationException ("instanceName"); + } + + if (!empty (requestInfo.getInstanceName ())) { + if (!requestInfo.getInstanceName ().matches (Constants.VALID_INSTANCE_NAME_FORMAT)) { + throw new ValidationException ("instanceName format"); + } + } + if (empty (requestInfo.getProductFamilyId ()) && ((requestScope.equalsIgnoreCase (ModelType.vnf.name ()) && action == Action.createInstance) || - (requestScope.equalsIgnoreCase (ModelType.network.name ()) && (action == Action.createInstance || action == Action.updateInstance)))) { - throw new ValidationException ("productFamilyId"); - } - + (requestScope.equalsIgnoreCase (ModelType.network.name ()) && (action == Action.createInstance || action == Action.updateInstance)))) { + throw new ValidationException ("productFamilyId"); + } + if (empty (requestInfo.getSource ())) { - throw new ValidationException ("source"); + throw new ValidationException ("source"); } - + RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList(); @@ -344,169 +395,202 @@ public class MsoRequest { String asdcServiceModelVersion = null; String volumeGroupId = null; boolean isRelatedServiceInstancePresent = false; - boolean isRelatedVnfInstancePresent = false; + boolean isRelatedVnfInstancePresent = false; if (instanceList != null) { - for(RelatedInstanceList relatedInstanceList : instanceList){ - RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance(); + for(RelatedInstanceList relatedInstanceList : instanceList){ + RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance(); + + if (relatedInstance.getModelInfo () == null) { + throw new ValidationException ("modelInfo in relatedInstance"); + } + + if (relatedInstance.getModelInfo ().getModelType () == null) { + throw new ValidationException ("modelType in relatedInstance"); + } + + + if (!empty (relatedInstance.getInstanceName ())) { + if (!relatedInstance.getInstanceName ().matches (Constants.VALID_INSTANCE_NAME_FORMAT)) { + throw new ValidationException ("instanceName format in relatedInstance"); + } + } + + if (empty (relatedInstance.getInstanceId ())) { + throw new ValidationException ("instanceId in relatedInstance"); + } + + if (!UUIDChecker.isValidUUID (relatedInstance.getInstanceId ())) { + throw new ValidationException ("instanceId format in relatedInstance"); + } + + + if (action != Action.deleteInstance) { + + // ModelInvariantId is not required in volumeGroup relatedInstance + if(!(relatedInstance.getModelInfo ().getModelType ().equals(ModelType.volumeGroup)) && + empty (relatedInstance.getModelInfo ().getModelInvariantId ())) { + throw new ValidationException ("modelInvariantId in relatedInstance"); + } + + if (!empty (relatedInstance.getModelInfo ().getModelInvariantId ()) && + !UUIDChecker.isValidUUID (relatedInstance.getModelInfo ().getModelInvariantId ())) { + throw new ValidationException ("modelInvariantId format in relatedInstance"); + } + + if (empty(relatedInstance.getModelInfo ().getModelName ()) && + !(relatedInstance.getModelInfo ().getModelType ().equals (ModelType.volumeGroup))) { + throw new ValidationException ("modelName in relatedInstance"); + } + + if (empty (relatedInstance.getModelInfo ().getModelVersion ()) && + !(relatedInstance.getModelInfo ().getModelType ().equals (ModelType.volumeGroup))) { + throw new ValidationException ("modelVersion in relatedInstance"); + } + } + + if (empty (relatedInstance.getModelInfo ().getModelCustomizationName ()) && + relatedInstance.getModelInfo ().getModelType ().equals (ModelType.vnf)) { + throw new ValidationException ("modelCustomizationName in relatedInstance"); + } + + if(relatedInstance.getModelInfo().getModelType().equals(ModelType.service)) { + isRelatedServiceInstancePresent = true; + if (!relatedInstance.getInstanceId ().equals (this.sir.getServiceInstanceId ())) { + throw new ValidationException ("serviceInstanceId matching the serviceInstanceId in request URI"); + } + serviceModelName = relatedInstance.getModelInfo ().getModelName (); + asdcServiceModelVersion = relatedInstance.getModelInfo().getModelVersion (); + } + else if(relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { + isRelatedVnfInstancePresent = true; + if (!relatedInstance.getInstanceId ().equals (this.sir.getVnfInstanceId ())) { + throw new ValidationException ("vnfInstanceId matching the vnfInstanceId in request URI"); + } + vnfModelName = relatedInstance.getModelInfo().getModelCustomizationName(); + } + else if(relatedInstance.getModelInfo().getModelType().equals(ModelType.volumeGroup)) { + volumeGroupId = relatedInstance.getInstanceId (); + } + } + + + if(requestScope.equalsIgnoreCase (ModelType.volumeGroup.name ())) { + if (!isRelatedServiceInstancePresent) { + throw new ValidationException ("related service instance for volumeGroup request"); + } + if (!isRelatedVnfInstancePresent) { + throw new ValidationException ("related vnf instance for volumeGroup request"); + } + this.serviceInstanceType = serviceModelName; + this.vnfType = serviceModelName + "/" + vnfModelName; + this.asdcServiceModelVersion = asdcServiceModelVersion; + } + else if(requestScope.equalsIgnoreCase(ModelType.vfModule.name ())) { + if (!isRelatedServiceInstancePresent) { + throw new ValidationException ("related service instance for vfModule request"); + } + if (!isRelatedVnfInstancePresent) { + throw new ValidationException ("related vnf instance for vfModule request"); + } + String vfModuleModelName = modelInfo.getModelName (); + this.vfModuleModelName = vfModuleModelName; + this.serviceInstanceType = serviceModelName; + this.vnfType = serviceModelName + "/" + vnfModelName; + this.asdcServiceModelVersion = asdcServiceModelVersion; + this.vfModuleType = vnfType + "::" + vfModuleModelName; + this.sir.setVolumeGroupInstanceId (volumeGroupId); + } + else if (requestScope.equalsIgnoreCase (ModelType.vnf.name ())) { + if (!isRelatedServiceInstancePresent) { + throw new ValidationException ("related service instance for vnf request"); + } + this.vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName(); + } + } + else if ((( requestScope.equalsIgnoreCase(ModelType.vnf.name ()) || requestScope.equalsIgnoreCase(ModelType.volumeGroup.name ()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name ()) ) && (action == Action.createInstance)) || + (this.reqVersion > 2 && (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name ()) || requestScope.equalsIgnoreCase(ModelType.vfModule.name ())) && action == Action.updateInstance)){ + msoLogger.debug ("related instance exception"); + throw new ValidationException ("related instances"); + } - if (!empty (relatedInstance.getInstanceName ()) && !relatedInstance.getInstanceName ().matches (Constants.VALID_INSTANCE_NAME_FORMAT)) { - throw new ValidationException ("instanceName format in relatedInstance"); - } + } - if (empty (relatedInstance.getInstanceId ())) { - throw new ValidationException ("instanceId in relatedInstance"); - } + void parseOrchestration (ServiceInstancesRequest sir) throws ValidationException { - if (!UUIDChecker.isValidUUID (relatedInstance.getInstanceId ())) { - throw new ValidationException ("instanceId format in relatedInstance"); - } + msoLogger.debug ("Validating the Orchestration request"); - if (relatedInstance.getModelInfo () == null) { - throw new ValidationException ("modelInfo in relatedInstance"); - } + this.sir = sir; - if (relatedInstance.getModelInfo ().getModelType () == null) { - throw new ValidationException ("modelType in relatedInstance"); - } + try{ + ObjectMapper mapper = new ObjectMapper(); + //mapper.configure(Feature.WRAP_ROOT_VALUE, true); + requestJSON = mapper.writeValueAsString(sir.getRequestDetails()); - if (action != Action.deleteInstance) { - - if (empty (relatedInstance.getModelInfo ().getModelInvariantId ()) && - !(requestScope.equalsIgnoreCase (ModelType.vfModule.name ()) && action == Action.createInstance && - relatedInstance.getModelInfo ().getModelType ().equals(ModelType.volumeGroup))) { - throw new ValidationException ("modelInvariantId in relatedInstance"); - } - - if (!empty (relatedInstance.getModelInfo ().getModelInvariantId ()) && - !UUIDChecker.isValidUUID (relatedInstance.getModelInfo ().getModelInvariantId ())) { - throw new ValidationException ("modelInvariantId format in relatedInstance"); - } - - if (empty(relatedInstance.getModelInfo ().getModelName ()) && - !(requestScope.equalsIgnoreCase (ModelType.vfModule.name ()) && action == Action.createInstance && - relatedInstance.getModelInfo ().getModelType ().equals (ModelType.volumeGroup))) { - throw new ValidationException ("modelName in relatedInstance"); - } - - if (empty (relatedInstance.getModelInfo ().getModelVersion ()) && - !(requestScope.equalsIgnoreCase (ModelType.vfModule.name ()) && action == Action.createInstance && - relatedInstance.getModelInfo ().getModelType ().equals (ModelType.volumeGroup))) { - throw new ValidationException ("modelVersion in relatedInstance"); - } - } + } catch(Exception e){ + throw new ValidationException ("Parse ServiceInstanceRequest to JSON string", e); + } - if (empty (relatedInstance.getModelInfo ().getModelCustomizationName ()) && - relatedInstance.getModelInfo ().getModelType ().equals (ModelType.vnf)) { - throw new ValidationException ("modelCustomizationName in relatedInstance"); - } + this.requestInfo = sir.getRequestDetails().getRequestInfo(); - if(relatedInstance.getModelInfo().getModelType().equals(ModelType.service)) { - isRelatedServiceInstancePresent = true; - if (!relatedInstance.getInstanceId ().equals (this.sir.getServiceInstanceId ())) { - throw new ValidationException ("serviceInstanceId matching the serviceInstanceId in request URI"); - } - serviceModelName = relatedInstance.getModelInfo ().getModelName (); - asdcServiceModelVersion = relatedInstance.getModelInfo().getModelVersion (); - } - else if(relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { - isRelatedVnfInstancePresent = true; - if (!relatedInstance.getInstanceId ().equals (this.sir.getVnfInstanceId ())) { - throw new ValidationException ("vnfInstanceId matching the vnfInstanceId in request URI"); - } - vnfModelName = relatedInstance.getModelInfo().getModelCustomizationName(); - } - else if(relatedInstance.getModelInfo().getModelType().equals(ModelType.volumeGroup)) { - volumeGroupId = relatedInstance.getInstanceId (); - } - } - - - if(requestScope.equalsIgnoreCase (ModelType.volumeGroup.name ())) { - if (!isRelatedServiceInstancePresent) { - throw new ValidationException ("related service instance for volumeGroup request"); - } - if (!isRelatedVnfInstancePresent) { - throw new ValidationException ("related vnf instance for volumeGroup request"); - } - this.serviceInstanceType = serviceModelName; - this.vnfType = serviceModelName + "/" + vnfModelName; - this.asdcServiceModelVersion = asdcServiceModelVersion; - } - else if(requestScope.equalsIgnoreCase(ModelType.vfModule.name ())) { - if (!isRelatedServiceInstancePresent) { - throw new ValidationException ("related service instance for vfModule request"); - } - if (!isRelatedVnfInstancePresent) { - throw new ValidationException ("related vnf instance for vfModule request"); - } - String vfModuleModelName = modelInfo.getModelName (); - this.vfModuleModelName = vfModuleModelName; - this.serviceInstanceType = serviceModelName; - this.vnfType = serviceModelName + "/" + vnfModelName; - this.asdcServiceModelVersion = asdcServiceModelVersion; - this.vfModuleType = vnfType + "::" + vfModuleModelName; - this.sir.setVolumeGroupInstanceId (volumeGroupId); - } - else if (requestScope.equalsIgnoreCase (ModelType.vnf.name ())) { - if (!isRelatedServiceInstancePresent) { - throw new ValidationException ("related service instance for vnf request"); - } - this.vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName(); - } + if (this.requestInfo == null) { + throw new ValidationException ("requestInfo"); } - else if (action != Action.deleteInstance && !requestScope.equalsIgnoreCase(ModelType.service.name ()) && - !requestScope.equalsIgnoreCase(ModelType.network.name ())) { - throw new ValidationException ("related instances"); + + if (empty (requestInfo.getSource ())) { + throw new ValidationException ("source"); + } + if (empty (requestInfo.getRequestorId ())) { + throw new ValidationException ("requestorId"); } - } - + public Map> getOrchestrationFilters (MultivaluedMap queryParams) throws ValidationException { - String queryParam = null; + String queryParam = null; Map> orchestrationFilterParams = new HashMap>(); - - + + for (Entry> entry : queryParams.entrySet()) { queryParam = entry.getKey(); - + try{ - if(queryParam.equalsIgnoreCase("filter")){ - - StringTokenizer st = new StringTokenizer(entry.getValue().get(0), ":"); - - int counter=0; - String mapKey=null; - List orchestrationList = new ArrayList(); - while (st.hasMoreElements()) { - if(counter == 0){ - mapKey = st.nextElement() + ""; - } else{ - orchestrationList.add(st.nextElement() + ""); - } - counter++; - } - orchestrationFilterParams.put(mapKey, orchestrationList); - } + if(queryParam.equalsIgnoreCase("filter")){ + + StringTokenizer st = new StringTokenizer(entry.getValue().get(0), ":"); + + int counter=0; + String mapKey=null; + List orchestrationList = new ArrayList(); + while (st.hasMoreElements()) { + if(counter == 0){ + mapKey = st.nextElement() + ""; + } else{ + orchestrationList.add(st.nextElement() + ""); + } + counter++; + } + orchestrationFilterParams.put(mapKey, orchestrationList); + } }catch(Exception e){ //msoLogger.error (MessageEnum.APIH_VALIDATION_ERROR, e); throw new ValidationException ("QueryParam ServiceInfo", e); - } - + } + } + return orchestrationFilterParams; - } + } public void createRequestRecord (Status status, Action action) { Session session = null; try { - session = HibernateUtil.getSessionFactory ().openSession (); + session = hibernateUtils.getSessionFactory ().openSession (); session.beginTransaction (); if (null == sir) { @@ -515,108 +599,106 @@ public class MsoRequest { InfraActiveRequests aq = new InfraActiveRequests (); aq.setRequestId (requestId); - + aq.setRequestAction(action.name()); aq.setAction(action.name()); - + Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis()); - + aq.setStartTime (startTimeStamp); - - if (requestInfo != null) { - if(requestInfo.getSource() != null){ - aq.setSource(requestInfo.getSource()); - } - if(requestInfo.getCallbackUrl() != null){ - aq.setCallBackUrl(requestInfo.getCallbackUrl()); - } - if(requestInfo.getCorrelator() != null){ - aq.setCorrelator(requestInfo.getCorrelator()); - } - + if (requestInfo != null) { + + if(requestInfo.getSource() != null){ + aq.setSource(requestInfo.getSource()); + } + if(requestInfo.getCallbackUrl() != null){ + aq.setCallBackUrl(requestInfo.getCallbackUrl()); + } + if(requestInfo.getCorrelator() != null){ + aq.setCorrelator(requestInfo.getCorrelator()); + } + + if(requestInfo.getRequestorId() != null) { + aq.setRequestorId(requestInfo.getRequestorId()); + } } - - if (modelInfo != null) { - aq.setRequestScope(requestScope); + + if (modelInfo != null) { + aq.setRequestScope(requestScope); } - + if (cloudConfiguration != null) { - if(cloudConfiguration.getLcpCloudRegionId() != null) { - aq.setAicCloudRegion(cloudConfiguration.getLcpCloudRegionId()); - } + if(cloudConfiguration.getLcpCloudRegionId() != null) { + aq.setAicCloudRegion(cloudConfiguration.getLcpCloudRegionId()); + } - if(cloudConfiguration.getTenantId() != null) { - aq.setTenantId(cloudConfiguration.getTenantId()); - } + if(cloudConfiguration.getTenantId() != null) { + aq.setTenantId(cloudConfiguration.getTenantId()); + } } - + if(sir.getServiceInstanceId() != null){ - aq.setServiceInstanceId(sir.getServiceInstanceId()); + aq.setServiceInstanceId(sir.getServiceInstanceId()); } - + if(sir.getVnfInstanceId() != null){ - aq.setVnfId(sir.getVnfInstanceId()); + aq.setVnfId(sir.getVnfInstanceId()); } - if (null != requestScope) { - if (requestScope.equalsIgnoreCase(ModelType.service.name())) { - if (requestInfo.getInstanceName() != null) { - aq.setServiceInstanceName(requestInfo.getInstanceName()); - } - } - - if (requestScope.equalsIgnoreCase(ModelType.network.name())) { - aq.setNetworkName(requestInfo.getInstanceName()); - aq.setNetworkType(networkType); - aq.setNetworkId(sir.getNetworkInstanceId()); - } + if(ModelType.service.name().equalsIgnoreCase(requestScope)){ + if(requestInfo.getInstanceName() != null){ + aq.setServiceInstanceName(requestInfo.getInstanceName()); + } + } - if (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name())) { - aq.setVolumeGroupId(sir.getVolumeGroupInstanceId()); - aq.setVolumeGroupName(requestInfo.getInstanceName()); - aq.setVnfType(vnfType); + if(ModelType.network.name().equalsIgnoreCase(requestScope)){ + aq.setNetworkName(requestInfo.getInstanceName()); + aq.setNetworkType(networkType); + aq.setNetworkId(sir.getNetworkInstanceId()); + } - } + if(ModelType.volumeGroup.name().equalsIgnoreCase(requestScope)){ + aq.setVolumeGroupId(sir.getVolumeGroupInstanceId()); + aq.setVolumeGroupName(requestInfo.getInstanceName()); + aq.setVnfType(vnfType); - if (requestScope.equalsIgnoreCase(ModelType.vfModule.name())) { - aq.setVfModuleName(requestInfo.getInstanceName()); - aq.setVfModuleModelName(modelInfo.getModelName()); - aq.setVfModuleId(sir.getVfModuleInstanceId()); - aq.setVolumeGroupId(sir.getVolumeGroupInstanceId()); - aq.setVnfType(vnfType); + } - } + if(ModelType.vfModule.name().equalsIgnoreCase(requestScope)){ + aq.setVfModuleName(requestInfo.getInstanceName()); + aq.setVfModuleModelName(modelInfo.getModelName()); + aq.setVfModuleId(sir.getVfModuleInstanceId()); + aq.setVolumeGroupId(sir.getVolumeGroupInstanceId()); + aq.setVnfType(vnfType); - if (requestScope.equalsIgnoreCase(ModelType.vnf.name())) { - aq.setVnfName(requestInfo.getInstanceName()); - if (null != sir.getRequestDetails()) { - RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList(); + } - if (instanceList != null) { + if(ModelType.vnf.name().equalsIgnoreCase(requestScope)){ + aq.setVnfName(requestInfo.getInstanceName()); + if (null != sir.getRequestDetails()) { + RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList(); - for (RelatedInstanceList relatedInstanceList : instanceList) { + if (instanceList != null) { - RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance(); - if (relatedInstance.getModelInfo().getModelType().equals(ModelType.service)) { - aq.setVnfType(vnfType); - } - } - } - } - //aq.setVnfType(sir.getRequestDetails().getRelatedInstanceList()); + for(RelatedInstanceList relatedInstanceList : instanceList){ - } + RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance(); + if(relatedInstance.getModelInfo().getModelType().equals(ModelType.service)){ + aq.setVnfType(vnfType); + } + } + } + } } aq.setRequestBody (this.requestJSON); - - + aq.setRequestStatus (status.toString ()); aq.setLastModifiedBy (Constants.MODIFIED_BY_APIHANDLER); - + if ((status == Status.FAILED) || (status == Status.COMPLETE)) { aq.setStatusMessage (this.errorMessage); aq.setResponseBody (this.responseBody); @@ -625,14 +707,14 @@ public class MsoRequest { Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis()); aq.setEndTime (endTimeStamp); } - + msoLogger.debug ("About to insert a record"); session.save (aq); session.getTransaction ().commit (); session.close (); } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request", e); + msoLogger.error (MessageEnum.APIH_DB_INSERT_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception when creation record request", e); if (session != null) { session.close (); } @@ -652,7 +734,7 @@ public class MsoRequest { this.responseBody, Constants.MODIFIED_BY_APIHANDLER); } catch (Exception e) { - msoLogger.error(MessageEnum.APIH_DB_UPDATE_EXC, e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "Exception when updating record in DB"); + msoLogger.error(MessageEnum.APIH_DB_UPDATE_EXC, e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "Exception when updating record in DB"); msoLogger.debug ("Exception: ", e); } } @@ -666,8 +748,8 @@ public class MsoRequest { InfraActiveRequests inProgress, String errorString) { - - + + // Log the failed request into the MSO Requests database return Response.status (httpResponseCode).entity (null).build (); @@ -676,7 +758,7 @@ public class MsoRequest { public Response buildResponseFailedValidation (int httpResponseCode, String exceptionMessage) { - + return Response.status (httpResponseCode).entity (null).build (); } @@ -728,13 +810,13 @@ public class MsoRequest { public RequestStatusType getStatus () { return status; } - + public String getServiceType () { - if (this.vnfInputs.getServiceType () != null) - return this.vnfInputs.getServiceType (); - if (this.vnfInputs.getServiceId () != null) - return this.vnfInputs.getServiceId (); - return null; + if (this.vnfInputs.getServiceType () != null) + return this.vnfInputs.getServiceType (); + if (this.vnfInputs.getServiceId () != null) + return this.vnfInputs.getServiceId (); + return null; } public void setStatus (RequestStatusType status) { @@ -742,46 +824,46 @@ public class MsoRequest { switch (status) { case FAILED: case COMPLETE: - this.progress = Constants.PROGRESS_REQUEST_COMPLETED; - break; + this.progress = Constants.PROGRESS_REQUEST_COMPLETED; + break; case IN_PROGRESS: - this.progress = Constants.PROGRESS_REQUEST_IN_PROGRESS; - break; + this.progress = Constants.PROGRESS_REQUEST_IN_PROGRESS; + break; } } - + public ModelInfo getModelInfo() { - return modelInfo; + return modelInfo; } - + public ServiceInstancesRequest getServiceInstancesRequest() { - return sir; + return sir; } - + public String getServiceInstanceType () { - return serviceInstanceType; - } - + return serviceInstanceType; + } + public String getNetworkType () { - return networkType; + return networkType; } - + public String getVnfType () { - return vnfType; + return vnfType; } - + public String getVfModuleModelName () { - return vfModuleModelName; + return vfModuleModelName; } - + public String getVfModuleType () { - return vfModuleType; + return vfModuleType; } - + public String getAsdcServiceModelVersion () { - return asdcServiceModelVersion; + return asdcServiceModelVersion; } - + public static String domToStr (Document doc) { if (doc == null) { return null; @@ -816,16 +898,16 @@ public class MsoRequest { } return null; } - + public void addBPMNSpecificInputs(String personaModelId, String personaModelVersion, Boolean isBaseVfModule, - String vnfPersonaModelId, String vnfPersonaModelVersion) { - vnfInputs.setPersonaModelId(personaModelId); - vnfInputs.setPersonaModelVersion(personaModelVersion); - vnfInputs.setIsBaseVfModule(isBaseVfModule); - vnfInputs.setVnfPersonaModelId(vnfPersonaModelId); - vnfInputs.setVnfPersonaModelVersion(vnfPersonaModelVersion); + String vnfPersonaModelId, String vnfPersonaModelVersion) { + vnfInputs.setPersonaModelId(personaModelId); + vnfInputs.setPersonaModelVersion(personaModelVersion); + vnfInputs.setIsBaseVfModule(isBaseVfModule); + vnfInputs.setVnfPersonaModelId(vnfPersonaModelId); + vnfInputs.setVnfPersonaModelVersion(vnfPersonaModelVersion); - this.vnfReq.setVnfInputs(vnfInputs); + this.vnfReq.setVnfInputs(vnfInputs); StringWriter stringWriter = new StringWriter (); try { @@ -846,8 +928,33 @@ public class MsoRequest { } - + private static boolean empty(String s) { - return (s == null || s.trim().isEmpty()); + return (s == null || s.trim().isEmpty()); + } + + public String getRequestJSON() throws JsonGenerationException, JsonMappingException, IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Inclusion.NON_NULL); + //mapper.configure(Feature.WRAP_ROOT_VALUE, true); + msoLogger.debug ("building sir from object " + sir); + requestJSON = mapper.writeValueAsString(sir); + return requestJSON; } -} + + public boolean getALaCarteFlag() { + return aLaCarteFlag; + } + + public void setaLaCarteFlag(boolean aLaCarteFlag) { + this.aLaCarteFlag = aLaCarteFlag; + } + + public int getReqVersion() { + return reqVersion; + } + + public void setReqVersion(int reqVersion) { + this.reqVersion = reqVersion; + } +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java index 61f4b9f7cd..c25f5ce1ef 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkMsoInfraRequest.java @@ -56,9 +56,10 @@ import org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.requestsdb.HibernateUtil; +import org.openecomp.mso.db.HibernateUtils; import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; +import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb; public class NetworkMsoInfraRequest { @@ -79,6 +80,8 @@ public class NetworkMsoInfraRequest { private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); private static final String NOT_PROVIDED = "not provided"; + protected HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb (); + NetworkMsoInfraRequest (String requestId) { this.requestId = requestId; this.startTime = System.currentTimeMillis(); @@ -239,8 +242,8 @@ public class NetworkMsoInfraRequest { msoLogger.debug ("Exception: ", e); } - this.requestXML = stringWriter.toString ().replace ("http://ecomp.att.com/mso/infra/network-request", - "http://ecomp.att.com/mso/infra/vnf-request"); + this.requestXML = stringWriter.toString ().replace ("http://org.openecomp/mso/infra/network-request", + "http://org.openecomp/mso/infra/vnf-request"); msoLogger.debug("REQUEST XML to BPEL: " + this.requestXML); } @@ -252,7 +255,7 @@ public class NetworkMsoInfraRequest { Session session = null; try { - session = HibernateUtil.getSessionFactory ().openSession (); + session = hibernateUtils.getSessionFactory ().openSession (); session.beginTransaction (); InfraActiveRequests aq = new InfraActiveRequests (); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java index f89cae988a..3bdb745b15 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/NetworkTypesHandler.java @@ -7,9 +7,9 @@ * 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. diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java index 00104daaf6..f42ba97e89 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/OrchestrationRequests.java @@ -7,9 +7,9 @@ * 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. @@ -24,10 +24,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; @@ -38,20 +35,14 @@ import org.apache.http.HttpStatus; import org.codehaus.jackson.map.ObjectMapper; import org.openecomp.mso.apihandler.common.ErrorNumbers; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationListResponse; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationResponse; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.InstanceReferences; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.Request; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestDetails; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestList; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestStatus; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.*; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoAlarmLogger; import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; -@Path("/orchestrationRequests/v2") +@Path("/") public class OrchestrationRequests { public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; @@ -61,28 +52,28 @@ public class OrchestrationRequests { private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); /** - * + * */ public OrchestrationRequests() { // TODO Auto-generated constructor stub } @GET - @Path("/{requestId}") + @Path("/orchestrationRequests/{version:[vV][2-3]}/{requestId}") @Produces(MediaType.APPLICATION_JSON) public Response getOrchestrationRequest(@PathParam("requestId") String requestId) { - + GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse(); - + MsoRequest msoRequest = new MsoRequest (requestId); - + long startTime = System.currentTimeMillis (); - + InfraActiveRequests requestDB = null; - + try { requestDB = RequestsDatabase.getRequestFromInfraActive(requestId); - + } catch (Exception e) { msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e); msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); @@ -97,57 +88,57 @@ public class OrchestrationRequests { msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB"); msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); return response; - + } - + if(requestDB == null) { Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NO_CONTENT, MsoException.ServiceException, - "Orchestration RequestId " + requestId + " is not found in DB", + "Orchestration RequestId " + requestId + " is not found in DB", ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null); msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId"); msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId"); msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); return resp; - + } - + Request request = mapInfraActiveRequestToRequest(requestDB); - + orchestrationResponse.setRequest(request); - + return Response.status(200).entity(orchestrationResponse).build(); } - + @GET - @Path("/") + @Path("/orchestrationRequests/{version:[vV][2-3]}") @Produces(MediaType.APPLICATION_JSON) public Response getOrchestrationRequest(@Context UriInfo ui) { - + long startTime = System.currentTimeMillis (); - + MsoRequest msoRequest = new MsoRequest(); - + MultivaluedMap queryParams = ui.getQueryParameters(); - + List activeRequests = null; - + GetOrchestrationListResponse orchestrationList = null; - - + + try{ - + Map> orchestrationMap = msoRequest.getOrchestrationFilters(queryParams); - + activeRequests = RequestsDatabase.getOrchestrationFiltersFromInfraActive(orchestrationMap); - + orchestrationList = new GetOrchestrationListResponse(); List requestLists = new ArrayList(); - + for(InfraActiveRequests infraActive : activeRequests){ - + Request request = mapInfraActiveRequestToRequest(infraActive); RequestList requestList = new RequestList(); requestList.setRequest(request); @@ -155,36 +146,148 @@ public class OrchestrationRequests { requestLists.add(requestList); } - + orchestrationList.setRequestList(requestLists); }catch(Exception e){ msoLogger.debug ("Get Orchestration Request with Filters Failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException, - "Get Orchestration Request with Filters Failed. " + e.getMessage(), + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException, + "Get Orchestration Request with Filters Failed. " + e.getMessage(), ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null); msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Get Orchestration Request with Filters Failed : " + e); msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Get Orchestration Request with Filters Failed"); msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); return response; } - - + + return Response.status(200).entity(orchestrationList).build(); } + + @POST + @Path("/orchestrationRequests/v3/{requestId}/unlock") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId) { + + MsoRequest msoRequest = new MsoRequest (requestId); + + long startTime = System.currentTimeMillis (); + msoLogger.debug ("requestId is: " + requestId); + + InfraActiveRequests requestDB = null; + Request request = null; + + msoLogger.debug ("requestId is: " + requestId); + ServiceInstancesRequest sir = null; + + try{ + ObjectMapper mapper = new ObjectMapper(); + sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); + + } catch(Exception e){ + msoLogger.debug ("Mapping of request to JSON object failed : ", e); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, + "Mapping of request to JSON object failed. " + e.getMessage(), + ErrorNumbers.SVC_BAD_PARAMETER, null); + if (msoRequest.getRequestId () != null) { + msoLogger.debug ("Mapping of request to JSON object failed"); + } + msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + return response; + } + + + try{ + msoRequest.parseOrchestration(sir); + } catch (Exception e) { + msoLogger.debug ("Validation failed: ", e); + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, + "Error parsing request. " + e.getMessage(), + ErrorNumbers.SVC_BAD_PARAMETER, null); + if (msoRequest.getRequestId () != null) { + msoLogger.debug ("Logging failed message to the database"); + } + msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + return response; + } + + try { + requestDB = RequestsDatabase.getRequestFromInfraActive(requestId); + + if(requestDB == null) { + Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, + MsoException.ServiceException, + "Orchestration RequestId " + requestId + " is not found in DB", + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, + null); + msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId"); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); + return resp; + + }else{ + request = mapInfraActiveRequestToRequest(requestDB); + RequestStatus reqStatus = request.getRequestStatus(); + Status status = Status.valueOf(reqStatus.getRequestState()); + if(status == Status.IN_PROGRESS || status == Status.PENDING){ + msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.UNLOCKED); + reqStatus.setRequestState(Status.UNLOCKED.toString ()); + RequestsDatabase.updateInfraStatus (requestId, + Status.UNLOCKED.toString (), + Constants.MODIFIED_BY_APIHANDLER); + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "RequestId " + requestId + " has been unlocked"); + + }else{ + Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_REQUEST, + MsoException.ServiceException, + "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked", + ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, + null); + msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked"); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); + return resp; + } + } + } catch (Exception e) { + msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e); + msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); + Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, + MsoException.ServiceException, + e.getMessage (), + ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, + null); + alarmLogger.sendAlarm ("MsoDatabaseAccessError", + MsoAlarmLogger.CRITICAL, + Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB"); + msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); + return response; + + } + + return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build (); + } + private Request mapInfraActiveRequestToRequest(InfraActiveRequests requestDB) { - - + + Request request = new Request(); - + ObjectMapper mapper = new ObjectMapper(); // mapper.configure(Feature.WRAP_ROOT_VALUE, true); - + request.setRequestId(requestDB.getRequestId()); request.setRequestScope(requestDB.getRequestScope()); request.setRequestType(requestDB.getRequestAction()); - + InstanceReferences ir = new InstanceReferences(); if(requestDB.getNetworkId() != null) ir.setNetworkInstanceId(requestDB.getNetworkId()); @@ -206,46 +309,48 @@ public class OrchestrationRequests { ir.setVolumeGroupInstanceId(requestDB.getVolumeGroupId()); if(requestDB.getVolumeGroupName() != null) ir.setVolumeGroupInstanceName(requestDB.getVolumeGroupName()); + if(requestDB.getRequestorId() != null) + ir.setRequestorId(requestDB.getRequestorId()); + + + request.setInstanceReferences(ir); - - request.setInstanceReferences(ir); - String requestBody = requestDB.getRequestBody(); - + RequestDetails requestDetails = null; - + try{ requestDetails = mapper.readValue(requestBody, RequestDetails.class); - + }catch(Exception e){ msoLogger.debug("Exception caught mapping requestBody to RequestDetails"); } - + request.setRequestDetails(requestDetails); String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) + " GMT"; request.setStartTime(startTimeStamp); - + RequestStatus status = new RequestStatus(); if(requestDB.getStatusMessage() != null){ status.setStatusMessage(requestDB.getStatusMessage()); } - + if(requestDB.getEndTime() != null){ String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) + " GMT"; status.setFinishTime(endTimeStamp); } - + if(requestDB.getRequestStatus() != null){ status.setRequestState(requestDB.getRequestStatus()); } - + if(requestDB.getProgress() != null){ status.setPercentProgress(requestDB.getProgress().intValue()); } - + request.setRequestStatus(status); - + return request; } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestHandler.java deleted file mode 100644 index bfea00fad6..0000000000 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/RequestHandler.java +++ /dev/null @@ -1,2102 +0,0 @@ -package org.openecomp.mso.apihandlerinfra; - -/*- - * #%L - * MSO - * %% - * Copyright (C) 2016 OPENECOMP - MSO - * %% - * 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. - * #L% - */ - - -import java.text.SimpleDateFormat; -import java.util.*; - -import javax.servlet.ServletContext; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.HEAD; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; - -import org.openecomp.mso.HealthCheckUtils; - -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig.Feature; - -import org.openecomp.mso.apihandler.common.ErrorNumbers; -import org.openecomp.mso.apihandler.common.RequestClient; -import org.openecomp.mso.apihandler.common.RequestClientFactory; -import org.openecomp.mso.apihandler.common.ResponseHandler; -import org.openecomp.mso.apihandler.common.ValidationException; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationListResponse; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.GetOrchestrationResponse; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.InstanceReferences; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstance; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstanceList; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.Request; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestDetails; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestError; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestList; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestStatus; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestReferences; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesResponse; -import org.openecomp.mso.db.catalog.CatalogDatabase; -import org.openecomp.mso.db.catalog.beans.Recipe; -import org.openecomp.mso.db.catalog.beans.Service; -import org.openecomp.mso.db.catalog.beans.ServiceRecipe; -import org.openecomp.mso.db.catalog.beans.VfModule; -import org.openecomp.mso.db.catalog.beans.VnfComponentsRecipe; -import org.openecomp.mso.db.catalog.beans.VnfRecipe; -import org.openecomp.mso.db.catalog.beans.VnfResource; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesFactory; -import org.openecomp.mso.requestsdb.InfraActiveRequests; -import org.openecomp.mso.requestsdb.RequestsDatabase; -import org.openecomp.mso.utils.UUIDChecker; - -@Path("/") -public class RequestHandler { - - public final static String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; - - private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory (); - - @Context - private UriInfo uriInfo; - - private static final String NOT_FOUND = "Application Not StartedApplication not started, properties file missing or invalid or Database Connection failed"; - - private static final Response NOT_STARTED_RESPONSE = Response.status (HttpStatus.SC_SERVICE_UNAVAILABLE) - .entity (NOT_FOUND) - .build (); - - private static boolean noProperties = true; - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); - - @Context - private ServletContext sc; - - private static MsoJavaProperties props = loadMsoProperties (); - HashMap instanceIdMap = new HashMap(); - - @HEAD - @GET - @Path("/healthcheck") - @Produces("text/html") - public Response healthcheck (@QueryParam("requestId") String requestId) { - long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("Healthcheck"); - UUIDChecker.verifyOldUUID(requestId, msoLogger); - HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck(msoLogger, startTime)) { - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - - if (!healthCheck.configFileCheck(msoLogger, startTime, MSO_PROP_APIHANDLER_INFRA)) { - return HealthCheckUtils.NOT_STARTED_RESPONSE; - } - - if (!healthCheck.requestDBCheck (msoLogger, startTime)) { - return HealthCheckUtils.NOT_STARTED_RESPONSE; - } - msoLogger.debug("healthcheck - Successful"); - return HealthCheckUtils.HEALTH_CHECK_RESPONSE; - } - - @HEAD - @GET - @Path("/globalhealthcheck") - @Produces("text/html") - public Response globalHealthcheck (@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn) { - long startTime = System.currentTimeMillis (); - MsoLogger.setServiceName ("GlobalHealthcheck"); - // Generate a Request Id - String requestId = UUIDChecker.generateUUID(msoLogger); - HealthCheckUtils healthCheck = new HealthCheckUtils (); - if (!healthCheck.siteStatusCheck (msoLogger, startTime)) { - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - - if (healthCheck.verifyGlobalHealthCheck(enableBpmn, requestId)) { - msoLogger.debug("globalHealthcheck - Successful"); - return HealthCheckUtils.HEALTH_CHECK_RESPONSE; - } else { - msoLogger.debug("globalHealthcheck - At leaset one of the sub-modules is not available"); - return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; - } - } - - private static MsoJavaProperties loadMsoProperties () { - MsoJavaProperties msoProperties; - try { - msoProperties = msoPropertiesFactory.getMsoJavaProperties (MSO_PROP_APIHANDLER_INFRA); - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_LOAD_PROPERTIES_FAIL, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception when loading MSO Properties", e); - return null; - } - - if (msoProperties != null && msoProperties.size () > 0) { - noProperties = false; - msoLogger.info (MessageEnum.APIH_PROPERTY_LOAD_SUC, "", ""); - return msoProperties; - } else { - msoLogger.error (MessageEnum.APIH_NO_PROPERTIES, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No MSO APIH_INFRA Properties found"); - return null; - } - } - - @POST - @Path("/serviceInstances/v2") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response createServiceInstance(String request) { - - Response response = serviceInstances(request, Action.createInstance, null); - - return response; - } - - @DELETE - @Path("/serviceInstances/v2/{serviceInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response deleteServiceInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId) { - - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap); - return response; - } - - @POST - @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response createVnfInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId) { - - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - Response response = serviceInstances(request, Action.createInstance, instanceIdMap); - - return response; - } - - @DELETE - @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs/{vnfInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response deleteVnfInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { - - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap); - - return response; - } - - @POST - @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response createVfModuleInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { - - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - Response response = serviceInstances(request, Action.createInstance, instanceIdMap); - - return response; - } - - @PUT - @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response updateVfModuleInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) { - - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId); - Response response = serviceInstances(request, Action.updateInstance, instanceIdMap); - - return response; - } - - @DELETE - @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response deleteVfModuleInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) { - - - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId); - Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap); - - return response; - } - - - @POST - @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response createVolumeGroupInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { - - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - Response response = serviceInstances(request, Action.createInstance, instanceIdMap); - - return response; - } - - @PUT - @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response updateVolumeGroupInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) { - - - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - instanceIdMap.put("volumeGroupInstanceId", volumeGroupInstanceId); - Response response = serviceInstances(request, Action.updateInstance, instanceIdMap); - - return response; - } - - @DELETE - @Path("/serviceInstances/v2/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response deleteVolumeGroupInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) { - - - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("vnfInstanceId", vnfInstanceId); - instanceIdMap.put("volumeGroupInstanceId", volumeGroupInstanceId); - Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap); - - return response; - } - - @POST - @Path("/serviceInstances/v2/{serviceInstanceId}/networks") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response createNetworkInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId) { - - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - Response response = serviceInstances(request, Action.createInstance, instanceIdMap); - - return response; - } - - @PUT - @Path("/serviceInstances/v2/{serviceInstanceId}/networks/{networkInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response updateNetworkInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("networkInstanceId") String networkInstanceId) { - - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("networkInstanceId", networkInstanceId); - Response response = serviceInstances(request, Action.updateInstance, instanceIdMap); - - return response; - } - - @DELETE - @Path("/serviceInstances/v2/{serviceInstanceId}/networks/{networkInstanceId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public Response deleteNetworkInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("networkInstanceId") String networkInstanceId) { - - instanceIdMap.put("serviceInstanceId", serviceInstanceId); - instanceIdMap.put("networkInstanceId", networkInstanceId); - Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap); - - return response; - } - - - - private Response serviceInstances(String requestJSON, Action action, HashMap instanceIdMap) { - - String requestId = UUIDChecker.generateUUID(msoLogger); - long startTime = System.currentTimeMillis (); - msoLogger.debug ("requestId is: " + requestId); - ServiceInstancesRequest sir = null; - - MsoRequest msoRequest = new MsoRequest (requestId); - - - try{ - ObjectMapper mapper = new ObjectMapper(); - sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - - } catch(Exception e){ - msoLogger.debug ("Mapping of request to JSON object failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Mapping of request to JSON object failed. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Mapping of request to JSON object failed"); - msoRequest.createRequestRecord (Status.FAILED, action); - } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - - try{ - msoRequest.parse(sir, instanceIdMap, action); - } catch (Exception e) { - msoLogger.debug ("Validation failed: ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Error parsing request. " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, null); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Logging failed message to the database"); - msoRequest.createRequestRecord (Status.FAILED, action); - } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - InfraActiveRequests dup = null; - String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName(); - String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name(); - try { - dup = RequestsDatabase.checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope); - - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Error during duplicate check ", e); - - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException, - e.getMessage(), - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null) ; - - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Error during duplicate check"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - if (dup != null) { - // Found the duplicate record. Return the appropriate error. - String instance = null; - if(instanceName != null){ - instance = instanceName; - }else{ - instance = instanceIdMap.get(requestScope + "InstanceId"); - } - String dupMessage = "Error: Locked instance - This " + requestScope + " (" + instance + ") " + "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - " + dup.getRequestId() + "). The existing request must finish or be cleaned up before proceeding."; - //List variables = new ArrayList(); - //variables.add(dup.getRequestStatus()); - - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT, MsoException.ServiceException, - dupMessage, - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null) ; - - - msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError, "Duplicate request - Subscriber already has a request for this service"); - msoRequest.createRequestRecord (Status.FAILED, action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, dupMessage); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - - ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse(); - - RequestReferences referencesResponse = new RequestReferences(); - - referencesResponse.setRequestId(requestId); - - serviceResponse.setRequestReferences(referencesResponse); - - try (CatalogDatabase db = new CatalogDatabase()) { - - RecipeLookupResult recipeLookupResult = null; - try { - recipeLookupResult = getServiceInstanceOrchestrationURI (db, msoRequest, action); - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Exception while querying Catalog DB", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "Recipe could not be retrieved from catalog DB " + e.getMessage (), - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, - null); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.ERROR_FROM_CATALOG_DB)); - msoRequest.createRequestRecord (Status.FAILED,action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while querying Catalog DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - db.close(); - return response; - } - - if (recipeLookupResult == null) { - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "No recipe found in DB"); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "Recipe does not exist in catalog DB", - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, - null); - msoRequest.createRequestRecord (Status.FAILED, action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No recipe found in DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - db.close(); - return response; - } - - - Boolean isBaseVfModule = false; - - if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule)) { - String asdcServiceModelVersion = msoRequest.getAsdcServiceModelVersion (); - - // Get VF Module-specific base module indicator - VfModule vfm = null; - - if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) { - vfm = db.getVfModuleType (msoRequest.getVfModuleType (), asdcServiceModelVersion); - } - else { - vfm = db.getVfModuleType (msoRequest.getVfModuleType ()); - } - - if (vfm != null) { - if (vfm.getIsBase() == 1) { - isBaseVfModule = true; - } - } - else if (action == Action.createInstance || action == Action.updateInstance){ - // There is no entry for this vfModuleType with this version, if specified, in VF_MODULE table in Catalog DB. - // This request cannot proceed - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "VF Module Type", "", MsoLogger.ErrorCode.DataError, "No VfModuleType found in DB"); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - String serviceVersionText = ""; - if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) { - serviceVersionText = " with version " + asdcServiceModelVersion; - } - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "VnfType " + msoRequest.getVnfType () + " and VF Module Model Name " + msoRequest.getVfModuleModelName() + serviceVersionText + " not found in MSO Catalog DB", - ErrorNumbers.SVC_BAD_PARAMETER, - null); - msoRequest.createRequestRecord (Status.FAILED, action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No matching vfModuleType found in DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - db.close(); - return response; - } - } - - db.close(); - - String serviceInstanceId = ""; - String vnfId = ""; - String vfModuleId = ""; - String volumeGroupId = ""; - String networkId = ""; - ServiceInstancesRequest siReq = msoRequest.getServiceInstancesRequest(); - - if(siReq.getServiceInstanceId () != null){ - serviceInstanceId = siReq.getServiceInstanceId (); - } - - if(siReq.getVnfInstanceId () != null){ - vnfId = siReq.getVnfInstanceId (); - } - - if(siReq.getVfModuleInstanceId () != null){ - vfModuleId = siReq.getVfModuleInstanceId (); - } - - if(siReq.getVolumeGroupInstanceId () != null){ - volumeGroupId = siReq.getVolumeGroupInstanceId (); - } - - if(siReq.getNetworkInstanceId () != null){ - networkId = siReq.getNetworkInstanceId (); - } - - - requestId = msoRequest.getRequestId (); - msoLogger.debug ("requestId is: " + requestId); - msoLogger.debug ("About to insert a record"); - - try { - msoRequest.createRequestRecord (Status.PENDING, action); - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.SchemaError, "Exception while creating record in DB", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_INTERNAL_SERVER_ERROR, - MsoException.ServiceException, - "Exception while creating record in DB " + e.getMessage(), - ErrorNumbers.SVC_BAD_PARAMETER, - null); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while creating record in DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - RequestClient requestClient = null; - HttpResponse response = null; - long subStartTime = System.currentTimeMillis(); - try { - requestClient = RequestClientFactory.getRequestClient (recipeLookupResult.getOrchestrationURI (), props); - // Capture audit event - msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ()); - - System.out.println("URL : " + requestClient.getUrl ()); - - response = requestClient.post(requestId, isBaseVfModule, recipeLookupResult.getRecipeTimeout (), action.name (), - serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, - msoRequest.getServiceInstanceType (), - msoRequest.getVnfType (), msoRequest.getVfModuleType (), - msoRequest.getNetworkType (), requestJSON); - - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI (), null); - } catch (Exception e) { - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI (), null); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY, - MsoException.ServiceException, - "Failed calling bpmn " + e.getMessage (), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, - null); - alarmLogger.sendAlarm ("MsoConfigurationError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - - if (response == null) { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_BAD_GATEWAY, - MsoException.ServiceException, - "bpelResponse is null", - ErrorNumbers.SVC_NO_SERVER_RESOURCES, - null); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - - ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ()); - int bpelStatus = respHandler.getStatus (); - - // BPEL accepted the request, the request is in progress - if (bpelStatus == HttpStatus.SC_ACCEPTED) { - String camundaJSONResponseBody = respHandler.getResponseBody (); - msoLogger.debug ("Received from Camunda: " + camundaJSONResponseBody); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS); - RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (), - Status.IN_PROGRESS.toString (), - Constants.PROGRESS_REQUEST_IN_PROGRESS, - Constants.MODIFIED_BY_APIHANDLER); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN accepted the request, the request is in progress"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) camundaJSONResponseBody); - return Response.status (HttpStatus.SC_ACCEPTED).entity (camundaJSONResponseBody).build (); - } else { - List variables = new ArrayList(); - variables.add(bpelStatus + ""); - String camundaJSONResponseBody = respHandler.getResponseBody (); - if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty ()) { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, - MsoException.ServiceException, - "Request Failed due to BPEL error with HTTP Status= %1 " + '\n' + camundaJSONResponseBody, - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - variables); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is failed with HTTP Status=" + bpelStatus); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } else { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildServiceErrorResponse(bpelStatus, - MsoException.ServiceException, - "Request Failed due to BPEL error with HTTP Status= %1" , - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - variables); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPEL engine is empty"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - } - - //return Response.status (HttpStatus.SC_ACCEPTED).entity (serviceResponse).build (); - // return serviceResponse; - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - "No communication to catalog DB " + e.getMessage (), - ErrorNumbers.SVC_NO_SERVER_RESOURCES, - null); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB)); - msoRequest.createRequestRecord (Status.FAILED,action); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - } - - @GET - @Path("/orchestrationRequests/v2/{requestId}") - @Produces(MediaType.APPLICATION_JSON) - public Response getOrchestrationRequest(@PathParam("requestId") String requestId) { - - GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse(); - - MsoRequest msoRequest = new MsoRequest (requestId); - - long startTime = System.currentTimeMillis (); - - InfraActiveRequests requestDB = null; - - try { - requestDB = RequestsDatabase.getRequestFromInfraActive(requestId); - - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Request DB - Infra Request Lookup", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NOT_FOUND, - MsoException.ServiceException, - e.getMessage (), - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, - null); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with Request DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - - } - - if(requestDB == null) { - Response resp = msoRequest.buildServiceErrorResponse (HttpStatus.SC_NO_CONTENT, - MsoException.ServiceException, - "Orchestration RequestId " + requestId + " is not found in DB", - ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, - null); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Null response from RequestDB when searching by RequestId"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "Null response from RequestDB when searching by RequestId"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - - } - - Request request = mapInfraActiveRequestToRequest(requestDB); - - orchestrationResponse.setRequest(request); - - return Response.status(200).entity(orchestrationResponse).build(); - } - - @GET - @Path("/orchestrationRequests/v2") - @Produces(MediaType.APPLICATION_JSON) - public Response getOrchestrationRequest(@Context UriInfo ui) { - - long startTime = System.currentTimeMillis (); - - MsoRequest msoRequest = new MsoRequest(); - - MultivaluedMap queryParams = ui.getQueryParameters(); - - List activeRequests = null; - - GetOrchestrationListResponse orchestrationList = null; - - - try{ - - Map> orchestrationMap = msoRequest.getOrchestrationFilters(queryParams); - - activeRequests = RequestsDatabase.getOrchestrationFiltersFromInfraActive(orchestrationMap); - - orchestrationList = new GetOrchestrationListResponse(); - - List requestLists = new ArrayList(); - - for(InfraActiveRequests infraActive : activeRequests){ - - Request request = mapInfraActiveRequestToRequest(infraActive); - RequestList requestList = new RequestList(); - requestList.setRequest(request); - - requestLists.add(requestList); - - } - - orchestrationList.setRequestList(requestLists); - - }catch(Exception e){ - msoLogger.debug ("Get Orchestration Request with Filters Failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException, - "Get Orchestration Request with Filters Failed. " + e.getMessage(), - ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null); - msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Get Orchestration Request with Filters Failed : " + e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, "Get Orchestration Request with Filters Failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - - return Response.status(200).entity(orchestrationList).build(); - } - - @POST - @Path("/v3/vnf-request") - @Consumes("*/*") - @Produces("application/xml") - public Response manageVnfRequestV3 (String reqXML) { - // Set logger parameters - MsoLogger.setServiceName ("VnfRequest"); - return manageVnfRequestImpl (reqXML, Constants.SCHEMA_VERSION_V3); - } - - - @POST - @Path("/v2/vnf-request") - @Consumes("*/*") - @Produces("application/xml") - public Response manageVnfRequestV2 (String reqXML) { - // Set logger parameters - MsoLogger.setServiceName ("VnfRequest"); - return manageVnfRequestImpl (reqXML, Constants.SCHEMA_VERSION_V2); - } - - @POST - @Path("/v1/vnf-request") - @Consumes("*/*") - @Produces("application/xml") - public Response manageVnfRequestV1 (String reqXML) { - - // Set logger parameters - MsoLogger.setServiceName ("VnfRequest"); - - return manageVnfRequestImpl (reqXML, Constants.SCHEMA_VERSION_V1); - } - - @POST - @Path("/v3/network-request") - @Consumes("*/*") - @Produces("application/xml") - public Response manageNetworkRequestV3 (String reqXML) { - - // Set logger parameters - MsoLogger.setServiceName ("NetworkRequest"); - - return manageNetworkRequestImpl (reqXML, Constants.SCHEMA_VERSION_V3); - } - - @POST - @Path("/v2/network-request") - @Consumes("*/*") - @Produces("application/xml") - public Response manageNetworkRequestV2 (String reqXML) { - - // Set logger parameters - MsoLogger.setServiceName ("NetworkRequest"); - - return manageNetworkRequestImpl (reqXML, Constants.SCHEMA_VERSION_V2); - } - - @POST - @Path("/v1/network-request") - @Consumes("*/*") - @Produces("application/xml") - public Response manageNetworkRequestV1 (String reqXML) { - - // Set logger parameters - MsoLogger.setServiceName ("NetworkRequest"); - - return manageNetworkRequestImpl (reqXML, Constants.SCHEMA_VERSION_V1); - } - - @POST - @Path("/v3/volume-request") - @Consumes("*/*") - @Produces("application/xml") - public Response manageVolumeRequestV3 (String reqXML) { - // Set logger parameters - MsoLogger.setServiceName ("VolumeRequest"); - return manageVolumeRequestImpl (reqXML, Constants.SCHEMA_VERSION_V3); - } - - @POST - @Path("/v2/volume-request") - @Consumes("*/*") - @Produces("application/xml") - public Response manageVolumeRequestV2 (String reqXML) { - // Set logger parameters - MsoLogger.setServiceName ("VolumeRequest"); - return manageVolumeRequestImpl (reqXML, Constants.SCHEMA_VERSION_V2); - } - - @POST - @Path("/v1/volume-request") - @Consumes("*/*") - @Produces("application/xml") - public Response manageVolumeRequestV1 (String reqXML) { - - // Set logger parameters - MsoLogger.setServiceName ("VolumeRequest"); - - return manageVolumeRequestImpl (reqXML, Constants.SCHEMA_VERSION_V1); - } - - - private Response manageVnfRequestImpl (String reqXML, String version) { - String methodName = "VnfRequest"; - props = loadMsoProperties (); - long startTime = System.currentTimeMillis (); - - // Generate unique request id for the new request - UUID requestUUID = UUID.randomUUID (); - - VnfMsoInfraRequest msoRequest = new VnfMsoInfraRequest (requestUUID.toString ()); - MsoLogger.setLogContext (msoRequest.getRequestId (), null); - - if (noProperties) { - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Exiting the transaction: Infra API Handler not started, properties file missing or invalid"); - return NOT_STARTED_RESPONSE; - } - - uriInfo.getRequestUri (); - - if (reqXML == null) { - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "The content of the request is null"); - return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build (); - } - - String requestUri = uriInfo.getRequestUri ().toString (); - msoLogger.debug ("Incoming request received for pose VNFRequest:" + reqXML); - - msoRequest.setRequestUri (requestUri); - msoLogger.debug ("Schema version: " + version); - try { - msoRequest.parse (reqXML, version, props); - } catch (Exception e) { - msoLogger.debug ("Validation failed: ", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseFailedValidation (HttpStatus.SC_BAD_REQUEST, e.getMessage ()); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Logging failed message to the database"); - msoRequest.createRequestRecord (Status.FAILED); - } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, reqXML, "", "", MsoLogger.ErrorCode.SchemaError, "Exception when parsing reqXML", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - MsoLogger.setServiceName (MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo().getAction().name()); - msoLogger.debug ("Update serviceName with detailed action info to:" + MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo().getAction().name()); - if (msoRequest.getRequestInfo ().getAction () == org.openecomp.mso.apihandlerinfra.vnfbeans.ActionType.CREATE) { - // Check if this request is a duplicate of the one with the same vnfName - msoLogger.debug ("Checking for a duplicate with the same vnf-name"); - InfraActiveRequests dup = null; - try { - dup = RequestsDatabase.checkDuplicateByVnfName (msoRequest.getVnfInputs ().getVnfName (), - msoRequest.getRequestInfo ().getAction ().value (), - "VNF"); - - } catch (Exception e) { - msoLogger.debug ("Exception", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR, - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, - null, - e.getMessage ()); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "vnf-name", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for duplicated request", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for duplicated request"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - if (dup != null) { - // Found the duplicate record. Return the appropriate error. - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT, - ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS, - dup); - msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, "CREATE on the same VNF Name is already progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicates request - CREATE on the same VNF Name is already progress"); - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicates request - CREATE on the same VNF Name is already progress"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - } else { - // Check if this request is a duplicate of the one with the same vnfId - InfraActiveRequests dup = null; - msoLogger.debug ("Checking for a duplicate with the same vnf-id"); - try { - dup = RequestsDatabase.checkDuplicateByVnfId (msoRequest.getVnfInputs ().getVnfId (), - msoRequest.getRequestInfo ().getAction ().value (), - "VNF"); - - } catch (Exception e) { - msoLogger.debug ("Exception", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR, - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, - null, - e.getMessage ()); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "vnf-id", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for a duplicate request with the same vnf-id", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for a duplicate request with the same vnf-id"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - if (dup != null) { - // Found the duplicate record. Return the appropriate error. - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT, - ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID, - dup); - msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, - msoRequest.getRequestInfo ().getAction ().value () - + " on the same VNF Id already in progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicated request on the same VNF Id already in progress"); - - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicated request on the same VNF Id already in progress"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - } - - String orchestrationURI = ""; - - try (CatalogDatabase db = new CatalogDatabase()) { - - Recipe recipe = null; - - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - // First get recipe for the service type given - if (msoRequest.getServiceType () != null - && msoRequest.getServiceType ().length () > 0) { - recipe = db.getVnfRecipe (msoRequest.getVnfInputs ().getVnfType (), - msoRequest.getRequestInfo ().getAction ().value (), - msoRequest.getServiceType ()); - } - // If no recipe for the service type or no service type was given, look for recipe without service type - if (recipe == null) { - recipe = db.getVnfRecipe (msoRequest.getVnfInputs ().getVnfType (), - msoRequest.getRequestInfo ().getAction ().value (), - null); - } - } - if (version.equals (Constants.SCHEMA_VERSION_V2) || version.equals (Constants.SCHEMA_VERSION_V3)) { - switch (msoRequest.getRequestInfo ().getAction ()) { - case CREATE: - case UPDATE: - case DELETE: - // First get recipe for the vnf type given - recipe = db.getVnfRecipe (msoRequest.getVnfInputs ().getVnfType (), - msoRequest.getRequestInfo ().getAction ().value ()); - - // If no recipe for the vnf type is found, look for generic recipe with "*" vnf type - if (recipe == null) { - recipe = db.getVnfRecipe (Constants.VNF_TYPE_WILDCARD, - msoRequest.getRequestInfo ().getAction ().value ()); - } - break; - case CREATE_VF_MODULE: - case UPDATE_VF_MODULE: - case DELETE_VF_MODULE: - // First get recipe for the vnf type/vf module model name through vf module id query - recipe = db.getVfModuleRecipe (msoRequest.getVnfInputs ().getVnfType (), msoRequest.getVnfInputs ().getVfModuleModelName (), - msoRequest.getRequestInfo ().getAction ().value ()); - - // If no recipe is found, look for generic recipe with "*" vnf type - if (recipe == null) { - recipe = db.getVnfRecipeByVfModuleId (msoRequest.getVnfInputs ().getVfModuleId (), - Constants.VNF_TYPE_WILDCARD, msoRequest.getRequestInfo ().getAction ().value ()); - } - // First get recipe for the vnf type given - //recipe = db.getVnfRecipe (msoRequest.getVnfInputs ().getVnfType (), - // msoRequest.getRequestInfo ().getAction ().value ()); - - // If no recipe for the vnf type is found, look for generic recipe with "*" vnf type - //if (recipe == null) { - // recipe = db.getVnfRecipe (Constants.VNF_TYPE_WILDCARD, - // msoRequest.getRequestInfo ().getAction ().value ()); - // - //} - break; - default: - break; - } - - } - - if (recipe == null) { - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, "VNF Recipe", "", "", MsoLogger.ErrorCode.DataError, "No recipe found in DB"); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND, - ErrorNumbers.RECIPE_DOES_NOT_EXIST, - null, - ""); - msoRequest.createRequestRecord (Status.FAILED); - db.close (); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No recipe found in DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - orchestrationURI = recipe.getOrchestrationUri (); - msoLogger.debug ("Orchestration URI is: " + orchestrationURI); - - // Retrieve additional info for Vf Modules from Catalog DB to send it to BPMN - switch (msoRequest.getRequestInfo ().getAction ()) { - case CREATE_VF_MODULE: - case UPDATE_VF_MODULE: - String personaModelId = ""; - String personaModelVersion = ""; - String vnfPersonaModelId = ""; - String vnfPersonaModelVersion = ""; - Boolean isBase = false; - String asdcServiceModelVersion = msoRequest.getVnfInputs ().getAsdcServiceModelVersion (); - - // Get VF Module-specific persona info and base module indicator - VfModule vfm = null; - String vfModuleType = msoRequest.getVnfInputs ().getVnfType () + "::" + msoRequest.getVnfInputs ().getVfModuleModelName (); - if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) { - vfm = db.getVfModuleType (vfModuleType, asdcServiceModelVersion); - } - else { - vfm = db.getVfModuleType (vfModuleType); - } - if (vfm != null) { - if (vfm.getIsBase() == 1) { - isBase = true; - } - personaModelId = vfm.getModelInvariantUuid(); - personaModelVersion = vfm.getModelVersion(); - msoLogger.debug("Setting personaModelId to " + personaModelId + - ", personaModelVersion to " + personaModelVersion); - } - // Get VNF-specific persona info - VnfResource vnfr = null; - if (asdcServiceModelVersion != null && !asdcServiceModelVersion.isEmpty ()) { - vnfr = db.getVnfResource (msoRequest.getVnfInputs ().getVnfType (), asdcServiceModelVersion); - } - else { - vnfr = db.getVnfResource (msoRequest.getVnfInputs ().getVnfType ()); - } - if (vnfr != null) { - vnfPersonaModelId = vnfr.getModelInvariantUuid (); - vnfPersonaModelVersion = vnfr.getModelVersion(); - msoLogger.debug("Setting vnfPersonaModelId to " + vnfPersonaModelId + - ", vnfPersonaModelVersion to " + vnfPersonaModelVersion); - } - - msoRequest.addBPMNSpecificInputs(personaModelId, personaModelVersion, isBase, - vnfPersonaModelId, vnfPersonaModelVersion); - - break; - default: - break; - } - - db.close (); - - String requestId = msoRequest.getRequestId (); - msoLogger.debug ("requestId is: " + requestId); - msoLogger.debug ("About to insert a record"); - - try { - msoRequest.createRequestRecord (Status.PENDING); - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.SchemaError, "Exception while creating record in DB", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR, - ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB, - null, - "non-unique request-id specified"); - // Cannot create a record of this request here, our communication with MSO DB just failed. Do not try - // to create a failed record - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while creating record in DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - msoLogger.debug("Request going to BPEL: " + msoRequest.getRequestXML ()); - - RequestClient requestClient = null; - HttpResponse response = null; - long subStartTime = System.currentTimeMillis(); - try { - requestClient = RequestClientFactory.getRequestClient (orchestrationURI, props); - // Capture audit event - msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ()); - response = requestClient.post (msoRequest.getRequestXML (), - requestId, - Integer.toString (recipe.getRecipeTimeout ()).toString (), - version, - null, - null); - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", orchestrationURI, null); - } catch (Exception e) { - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", orchestrationURI, null); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY, - ErrorNumbers.NO_COMMUNICATION_TO_BPEL, - null, - e.getMessage ()); - alarmLogger.sendAlarm ("MsoConfigurationError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - - if (response == null) { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY, - ErrorNumbers.NO_RESPONSE_FROM_BPEL, - null, - "bpelResponse is null"); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Null response from BPEL", "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Null response from BPEL"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - - ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ()); - int bpelStatus = respHandler.getStatus (); - - // BPEL accepted the request, the request is in progress - if (bpelStatus == HttpStatus.SC_ACCEPTED) { - String bpelXMLResponseBody = respHandler.getResponseBody (); - msoLogger.debug ("Received from BPEL: " + bpelXMLResponseBody); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.IN_PROGRESS); - RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (), - Status.IN_PROGRESS.toString (), - Constants.PROGRESS_REQUEST_IN_PROGRESS, - Constants.MODIFIED_BY_APIHANDLER); - Response resp = msoRequest.buildResponse (bpelStatus, null, null); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN accepted the request, the request is in progress"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } else { - - String bpelXMLResponseBody = respHandler.getResponseBody (); - if (bpelXMLResponseBody != null && !bpelXMLResponseBody.isEmpty ()) { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildResponse (bpelStatus, bpelXMLResponseBody, null); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, - "Response from BPEL engine is failed with HTTP Status=" + bpelStatus, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is failed with HTTP Status=" + bpelStatus); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } else { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildResponse (bpelStatus, ErrorNumbers.ERROR_FROM_BPEL, null); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Response from BPEL engine is empty", "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPEL engine is empty"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - } - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND, - ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB, - null, - e.getMessage ()); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB)); - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - } - - private Response manageNetworkRequestImpl (String reqXML, String version) { - String methodName = "NetworkRequest"; - - props = loadMsoProperties (); - - long startTime = System.currentTimeMillis (); - if (noProperties) { - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Application not started, properties file missing or invalid"); - return NOT_STARTED_RESPONSE; - } - uriInfo.getRequestUri (); - - // Generate unique request id for the new request - UUID requestUUID = UUID.randomUUID (); - - NetworkMsoInfraRequest msoRequest = new NetworkMsoInfraRequest (requestUUID.toString ()); - MsoLogger.setLogContext (msoRequest.getRequestId (), null); - - if (reqXML == null) { - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "The input Request is null"); - return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build (); - } - - String requestUri = uriInfo.getRequestUri ().toString (); - - msoLogger.debug ("Incoming Request: " + reqXML); - - msoRequest.setRequestUri (requestUri); - msoLogger.debug ("Schema version: " + version); - try { - msoRequest.parse (reqXML, version, props); - } catch (Exception e) { - msoLogger.debug ("Validation failed: ", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseFailedValidation (HttpStatus.SC_BAD_REQUEST, e.getMessage ()); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Logging failed message to the database"); - msoRequest.createRequestRecord (Status.FAILED); - } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, reqXML, "", "", MsoLogger.ErrorCode.DataError, "Exception when parsing reqXML", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - MsoLogger.setServiceName (MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo().getAction().name()); - msoLogger.debug ("Update serviceName with detailed action info to:" + MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo().getAction().name()); - if (msoRequest.getRequestInfo () - .getAction () == org.openecomp.mso.apihandlerinfra.networkbeans.ActionType.CREATE) { - // Check if this request is a duplicate of the one with the same network Name - msoLogger.debug ("Checking for a duplicate with the same network-name"); - InfraActiveRequests dup = null; - try { - - dup = RequestsDatabase.checkDuplicateByVnfName (msoRequest.getNetworkInputs ().getNetworkName (), - msoRequest.getRequestInfo ().getAction ().value (), - "NETWORK"); - - } catch (Exception e) { - msoLogger.debug ("Exception", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR, - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, - null, - e.getMessage ()); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "network-name", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for duplicated request", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for duplicated request"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - if (dup != null) { - // Found the duplicate record. Return the appropriate error. - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT, - ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS, - dup); - msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, - "CREATE on the same Network Name is already progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicates request - CREATE on the same Network Name is already progress"); - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicates request - CREATE on the same Network Name is already progress"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - } else { - // Check if this request is a duplicate of the one with the same networkId - InfraActiveRequests dup = null; - msoLogger.debug ("Checking for a duplicate with the same network-id"); - try { - dup = RequestsDatabase.checkDuplicateByVnfId (msoRequest.getNetworkInputs ().getNetworkId (), - msoRequest.getRequestInfo ().getAction ().value (), - "NETWORK"); - - } catch (Exception e) { - msoLogger.debug ("Exception", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR, - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, - null, - e.getMessage ()); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "network-id", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for a duplicate request with the same network-id", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for a duplicate request with the same network-id"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - if (dup != null) { - // Found the duplicate record. Return the appropriate error. - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT, - ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID, - dup); - msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, - msoRequest.getRequestInfo ().getAction ().value () - + " on the same Network Id already in progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicated request on the same Network Id already in progress"); - - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicated request on the same Network Id already in progress."); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - } - - String orchestrationURI = ""; - - // Query MSO Catalog DB - try (CatalogDatabase db = new CatalogDatabase()) { - Recipe recipe = null; - - if (msoRequest.getServiceType () != null - && msoRequest.getServiceType ().length () > 0) { - recipe = db.getNetworkRecipe (msoRequest.getNetworkInputs ().getNetworkType (), - msoRequest.getRequestInfo ().getAction ().value (), - msoRequest.getServiceType ()); - - } - if (recipe == null) { - recipe = db.getNetworkRecipe (msoRequest.getNetworkInputs ().getNetworkType (), - msoRequest.getRequestInfo ().getAction ().value (), - null); - } - - if (recipe == null) { - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, "VNF Recipe", "", "", MsoLogger.ErrorCode.DataError, "VNF Recipe attribute not found"); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND, - ErrorNumbers.RECIPE_DOES_NOT_EXIST, - null, - ""); - msoRequest.createRequestRecord (Status.FAILED); - db.close (); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "No recipe found in DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - orchestrationURI = recipe.getOrchestrationUri (); - msoLogger.debug ("Orchestration URI is: " + orchestrationURI); - - String requestId = msoRequest.getRequestId (); - msoLogger.debug ("requestId is: " + requestId); - msoLogger.debug ("About to insert a record"); - - try { - msoRequest.createRequestRecord (Status.PENDING); - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.DataError, "Exception while creating record in DB", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR, - ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB, - null, - "non-unique request-id specified"); - // Cannot create a record of this request here, our communication with MSO DB just failed. Do not try - // to create a failed record - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while creating record in DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - RequestClient requestClient = null; - HttpResponse response = null; - long subStartTime = System.currentTimeMillis(); - try { - requestClient = RequestClientFactory.getRequestClient (orchestrationURI, props); - // Capture audit event - msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ()); - response = requestClient.post (msoRequest.getRequestXML (), - requestId, - Integer.toString (recipe.getRecipeTimeout ()).toString (), - version, - null, - null); - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", orchestrationURI, null); - } catch (Exception e) { - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", orchestrationURI, null); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY, - ErrorNumbers.NO_COMMUNICATION_TO_BPEL, - null, - e.getMessage ()); - alarmLogger.sendAlarm ("MsoConfigurationError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - - if (response == null) { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY, - ErrorNumbers.NO_RESPONSE_FROM_BPEL, - null, - "bpelResponse is null"); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Null response from BPEL", "Camunda", "", MsoLogger.ErrorCode.DataError, "bpelResponse is null"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is null"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - - ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ()); - int bpelStatus = respHandler.getStatus (); - - // BPEL accepted the request, the request is in progress - if (bpelStatus == HttpStatus.SC_ACCEPTED) { - String bpelXMLResponseBody = respHandler.getResponseBody (); - msoLogger.debug ("Received from BPEL: " + bpelXMLResponseBody); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.IN_PROGRESS); - RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (), - Status.IN_PROGRESS.toString (), - Constants.PROGRESS_REQUEST_IN_PROGRESS, - Constants.MODIFIED_BY_APIHANDLER); - Response resp = msoRequest.buildResponse (bpelStatus, null, null); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN accepted the request, the request is in progress"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } else { - - String bpelXMLResponseBody = respHandler.getResponseBody (); - if (bpelXMLResponseBody != null && !bpelXMLResponseBody.isEmpty ()) { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildResponse (bpelStatus, bpelXMLResponseBody, null); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, - "Response from BPEL engine is failed with HTTP Status=" + bpelStatus, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is failed with HTTP Status=" + bpelStatus); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is with status Failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } else { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildResponse (bpelStatus, ErrorNumbers.ERROR_FROM_BPEL, null); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Response from BPEL engine is empty", "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPEL engine is empty"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - } - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception while communciate with Catalog DB", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.networkbeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND, - ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB, - null, - e.getMessage ()); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB)); - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - } - - private Response manageVolumeRequestImpl (String reqXML, String version) { - String methodName = "VolumeRequest"; - props = loadMsoProperties (); - - long startTime = System.currentTimeMillis (); - if (noProperties) { - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, "Application not started, properties file missing or invalid"); - return NOT_STARTED_RESPONSE; - } - - uriInfo.getRequestUri (); - - // Generate unique request id for the new request - UUID requestUUID = UUID.randomUUID (); - - VolumeMsoInfraRequest msoRequest = new VolumeMsoInfraRequest (requestUUID.toString ()); - - if (reqXML == null) { - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "The input request is null"); - return Response.status (HttpStatus.SC_NO_CONTENT).entity ("").build (); - } - - String requestUri = uriInfo.getRequestUri ().toString (); - - msoLogger.debug ("Incoming Request: " + reqXML); - - msoRequest.setRequestUri (requestUri); - - msoLogger.debug ("Schema version: " + version); - try { - msoRequest.parse (reqXML, version, props); - } catch (Exception e) { - msoLogger.debug ("Validation failed: ", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseFailedValidation (HttpStatus.SC_BAD_REQUEST, e.getMessage ()); - if (msoRequest.getRequestId () != null) { - msoLogger.debug ("Logging failed message to the database"); - msoRequest.createRequestRecord (Status.FAILED); - } - msoLogger.error (MessageEnum.APIH_REQUEST_VALIDATION_ERROR, reqXML, "", "", MsoLogger.ErrorCode.DataError, "Exception when parsing reqXML", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Validation of the input request failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - MsoLogger.setServiceName (MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo ().getAction ().name ()); - msoLogger.debug ("Update serviceName with detailed action info to:" + MsoLogger.getServiceName () + "_" + msoRequest.getRequestInfo ().getAction ().name ()); - if (msoRequest.getRequestInfo () - .getAction () == org.openecomp.mso.apihandlerinfra.volumebeans.ActionType.CREATE) { - // Check if this request is a duplicate of the one with the same network Name - msoLogger.debug ("Checking for a duplicate with the same volume-name"); - InfraActiveRequests dup = null; - try { - - dup = RequestsDatabase.checkDuplicateByVnfName (msoRequest.getVolumeInputs ().getVolumeGroupName (), - msoRequest.getRequestInfo ().getAction ().value (), - "VOLUME"); - - } catch (Exception e) { - msoLogger.debug ("Exception", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR, - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, - null, - e.getMessage ()); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "volume-group-name", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for duplicated request", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for duplicated request"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - if (dup != null) { - // Found the duplicate record. Return the appropriate error. - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT, - ErrorNumbers.LOCKED_CREATE_ON_THE_SAME_VNF_NAME_IN_PROGRESS, - dup); - msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, - "CREATE on the same Volume Group Name is already progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicates request - CREATE on the same Volume Group Name is already progress"); - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicates request - CREATE on the same Volume Group Name is already progress"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - } else { - // Check if this request is a duplicate of the one with the same volumeGroupId - InfraActiveRequests dup = null; - msoLogger.debug ("Checking for a duplicate with the same volume-group-id"); - try { - dup = RequestsDatabase.checkDuplicateByVnfId (msoRequest.getVolumeInputs ().getVolumeGroupId (), - msoRequest.getRequestInfo ().getAction ().value (), - "VOLUME"); - - } catch (Exception e) { - msoLogger.debug ("Exception", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR, - ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, - null, - e.getMessage ()); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB)); - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC_ATT, "volume-group-id", "", "", MsoLogger.ErrorCode.DataError, "Exception while checking for a duplicate request with the sam volume-group-id", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while checking for a duplicate request with the sam volume-group-id"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - if (dup != null) { - // Found the duplicate record. Return the appropriate error. - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponse (HttpStatus.SC_CONFLICT, - ErrorNumbers.LOCKED_SAME_ACTION_AND_VNF_ID, - dup); - msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, - msoRequest.getRequestInfo ().getAction ().value () - + " on the same Volume Group Id already in progress", "", "", MsoLogger.ErrorCode.DataError, "Duplicated request on the same Volume Group Id already in progress"); - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, "Duplicated request on the same Volume Group Id already in progress"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - } - - String orchestrationURI = ""; - - // Query MSO Catalog DB - try (CatalogDatabase db = new CatalogDatabase()) { - - Recipe recipe = null; - - if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (msoRequest.getServiceType () != null - && msoRequest.getServiceType ().length () > 0) { - recipe = db.getVnfComponentsRecipe (msoRequest.getVolumeInputs ().getVnfType (), - Constants.VOLUME_GROUP_COMPONENT_TYPE, - msoRequest.getRequestInfo ().getAction ().value (), - msoRequest.getServiceType ()); - } - if (recipe == null) { - recipe = db.getVnfComponentsRecipe (msoRequest.getVolumeInputs ().getVnfType (), - Constants.VOLUME_GROUP_COMPONENT_TYPE, - msoRequest.getRequestInfo ().getAction ().value (), - null); - // If no recipe for the vnf type is found, look for generic recipe with "*" vnf type - if (recipe == null) { - recipe = db.getVnfComponentsRecipe (Constants.VNF_TYPE_WILDCARD, - Constants.VOLUME_GROUP_COMPONENT_TYPE, - msoRequest.getRequestInfo ().getAction ().value (), - null); - } - } - } - else if (version.equals (Constants.SCHEMA_VERSION_V2) || version.equals (Constants.SCHEMA_VERSION_V3)) { - switch (msoRequest.getRequestInfo ().getAction ()) { - case CREATE: - case UPDATE: - case DELETE: - // First get recipe for the vnf type given - recipe = db.getVnfComponentsRecipe (msoRequest.getVolumeInputs ().getVnfType (), - Constants.VOLUME_GROUP_COMPONENT_TYPE, - msoRequest.getRequestInfo ().getAction ().value (), null); - - // If no recipe for the vnf type is found, look for generic recipe with "*" vnf type - if (recipe == null) { - recipe = db.getVnfComponentsRecipe (Constants.VNF_TYPE_WILDCARD, - Constants.VOLUME_GROUP_COMPONENT_TYPE, - msoRequest.getRequestInfo ().getAction ().value (), null); - } - break; - case CREATE_VF_MODULE_VOL: - case UPDATE_VF_MODULE_VOL: - case DELETE_VF_MODULE_VOL: - // First get recipe for the vnf type given - recipe = db.getVnfComponentsRecipe (msoRequest.getVolumeInputs ().getVnfType (), - Constants.VOLUME_GROUP_COMPONENT_TYPE, - msoRequest.getRequestInfo ().getAction ().value (), null); - - // If no recipe for the vnf type is found, look for generic recipe with "*" in vf module id - if (recipe == null) { - recipe = db.getVnfComponentsRecipeByVfModuleId (Constants.VNF_TYPE_WILDCARD, - Constants.VOLUME_GROUP_COMPONENT_TYPE, - msoRequest.getRequestInfo ().getAction ().value ()); - } - break; - default: - break; - } - - } - - if (recipe == null) { - msoLogger.error (MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, "VNF Recipe", "", "", MsoLogger.ErrorCode.DataError, "VNF Recipe not found in DB"); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND, - ErrorNumbers.RECIPE_DOES_NOT_EXIST, - null, - ""); - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "VNF Recipe not found in DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - orchestrationURI = recipe.getOrchestrationUri (); - msoLogger.debug ("Orchestration URI is: " + orchestrationURI); - - String requestId = msoRequest.getRequestId (); - msoLogger.debug ("requestId is: " + requestId); - msoLogger.debug ("About to insert a record"); - - try { - msoRequest.createRequestRecord (Status.PENDING); - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "Exception while creating record in DB", "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception in createRequestRecord", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseWithError (HttpStatus.SC_INTERNAL_SERVER_ERROR, - ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB, - null, - "non-unique request-id specified"); - // Cannot create a record of this request here, our communication with MSO DB just failed. Do not try - // to create a failed record - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while creating record in DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - - RequestClient requestClient = null; - HttpResponse response = null; - long subStartTime = System.currentTimeMillis(); - try { - requestClient = RequestClientFactory.getRequestClient (orchestrationURI, props); - // Capture audit event - msoLogger.debug ("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl ()); - response = requestClient.post (msoRequest.getRequestXML (), - requestId, - Integer.toString (recipe.getRecipeTimeout ()).toString (), - version, - null, - null); - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", orchestrationURI, null); - } catch (Exception e) { - msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", orchestrationURI, null); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY, - ErrorNumbers.NO_COMMUNICATION_TO_BPEL, - null, - e.getMessage ()); - alarmLogger.sendAlarm ("MsoConfigurationError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_BPEL)); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, "Camunda", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine", e); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - - if (response == null) { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildResponseWithError (HttpStatus.SC_BAD_GATEWAY, - ErrorNumbers.NO_RESPONSE_FROM_BPEL, - null, - "bpelResponse is null"); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Null response from BPEL", "Camunda", "", MsoLogger.ErrorCode.DataError, "Null response from BPMN engine"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Null response from BPMN engine"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - - ResponseHandler respHandler = new ResponseHandler (response, requestClient.getType ()); - int bpelStatus = respHandler.getStatus (); - - // BPEL accepted the request, the request is in progress - if (bpelStatus == HttpStatus.SC_ACCEPTED) { - String bpelXMLResponseBody = respHandler.getResponseBody (); - msoLogger.debug ("Received from BPEL: " + bpelXMLResponseBody); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.IN_PROGRESS); - RequestsDatabase.updateInfraStatus (msoRequest.getRequestId (), - Status.IN_PROGRESS.toString (), - Constants.PROGRESS_REQUEST_IN_PROGRESS, - Constants.MODIFIED_BY_APIHANDLER); - Response resp = msoRequest.buildResponse (bpelStatus, null, null); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "BPMN accepted the request, the request is in progress"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } else { - - String bpelXMLResponseBody = respHandler.getResponseBody (); - if (bpelXMLResponseBody != null && !bpelXMLResponseBody.isEmpty ()) { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildResponse (bpelStatus, bpelXMLResponseBody, null); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, - "Response from BPEL engine is failed with HTTP Status=" + bpelStatus, "Camunda", "", MsoLogger.ErrorCode.DataError, "Response from BPEL engine is failed with HTTP Status=" + bpelStatus); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is with status Failed"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } else { - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED); - Response resp = msoRequest.buildResponse (bpelStatus, ErrorNumbers.ERROR_FROM_BPEL, null); - msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, "Response from BPEL engine is empty", "Camunda", "", MsoLogger.ErrorCode.DataError, "Response from BPEL engine is empty"); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is empty"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); - return resp; - } - } - } catch (Exception e) { - msoLogger.error (MessageEnum.APIH_DB_ACCESS_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception while communciate with Catalog DB", e); - msoRequest.setStatus (org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType.FAILED); - Response response = msoRequest.buildResponseWithError (HttpStatus.SC_NOT_FOUND, - ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB, - null, - e.getMessage ()); - alarmLogger.sendAlarm ("MsoDatabaseAccessError", - MsoAlarmLogger.CRITICAL, - Messages.errors.get (ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB)); - msoRequest.createRequestRecord (Status.FAILED); - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception while communciate with DB"); - msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); - return response; - } - } - - private Request mapInfraActiveRequestToRequest(InfraActiveRequests requestDB) { - - - Request request = new Request(); - - ObjectMapper mapper = new ObjectMapper(); - // mapper.configure(Feature.WRAP_ROOT_VALUE, true); - - request.setRequestId(requestDB.getRequestId()); - request.setRequestScope(requestDB.getRequestScope()); - request.setRequestType(requestDB.getRequestAction()); - - InstanceReferences ir = new InstanceReferences(); - if(requestDB.getNetworkId() != null) - ir.setNetworkInstanceId(requestDB.getNetworkId()); - if(requestDB.getNetworkName() != null) - ir.setNetworkInstanceName(requestDB.getNetworkName()); - if(requestDB.getServiceInstanceId() != null) - ir.setServiceInstanceId(requestDB.getServiceInstanceId()); - if(requestDB.getServiceInstanceName() != null) - ir.setServiceInstanceName(requestDB.getServiceInstanceName()); - if(requestDB.getVfModuleId() != null) - ir.setVfModuleInstanceId(requestDB.getVfModuleId()); - if(requestDB.getVfModuleName() != null) - ir.setVfModuleInstanceName(requestDB.getVfModuleName()); - if(requestDB.getVnfId() != null) - ir.setVnfInstanceId(requestDB.getVnfId()); - if(requestDB.getVnfName() != null) - ir.setVnfInstanceName(requestDB.getVnfName()); - if(requestDB.getVolumeGroupId() != null) - ir.setVolumeGroupInstanceId(requestDB.getVolumeGroupId()); - if(requestDB.getVolumeGroupName() != null) - ir.setVolumeGroupInstanceName(requestDB.getVolumeGroupName()); - - - request.setInstanceReferences(ir); - - String requestBody = requestDB.getRequestBody(); - - RequestDetails requestDetails = null; - - try{ - requestDetails = mapper.readValue(requestBody, RequestDetails.class); - - }catch(Exception e){ - msoLogger.debug("Exception caught mapping requestBody to RequestDetails"); - } - - request.setRequestDetails(requestDetails); - String startTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getStartTime()) + " GMT"; - request.setStartTime(startTimeStamp); - - RequestStatus status = new RequestStatus(); - if(requestDB.getStatusMessage() != null){ - status.setStatusMessage(requestDB.getStatusMessage()); - } - - if(requestDB.getEndTime() != null){ - String endTimeStamp = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(requestDB.getEndTime()) + " GMT"; - status.setFinishTime(endTimeStamp); - } - - - if(requestDB.getRequestStatus() != null){ - status.setRequestState(requestDB.getRequestStatus()); - } - - if(requestDB.getProgress() != null){ - status.setPercentProgress(requestDB.getProgress().intValue()); - } - - request.setRequestStatus(status); - - return request; - } - - private RecipeLookupResult getServiceInstanceOrchestrationURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { - - RecipeLookupResult recipeLookupResult = null; - // Query MSO Catalog DB - - if (msoRequest.getModelInfo().getModelType().equals(ModelType.service)) { - - // SERVICE REQUEST - // Construct the default service name - // TODO need to make this a configurable property - - String defaultServiceName = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; - Service serviceRecord = db.getServiceByName(defaultServiceName); - int serviceId = serviceRecord.getId(); - ServiceRecipe recipe = db.getServiceRecipe(serviceId, action.name()); - - if (recipe == null) { - return null; - } - - recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); - } - else if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule) || - msoRequest.getModelInfo().getModelType().equals(ModelType.volumeGroup)) { - - String vnfComponentType = msoRequest.getModelInfo().getModelType().name(); - VnfComponentsRecipe recipe = null; - - if (action != Action.deleteInstance) { - RelatedInstanceList[] instanceList = null; - if (msoRequest.getServiceInstancesRequest().getRequestDetails() != null) { - instanceList = msoRequest.getServiceInstancesRequest().getRequestDetails().getRelatedInstanceList(); - } - - String serviceModelName = null; - String vnfModelName = null; - String vfModuleModelName = null; - String asdcServiceModelVersion = null; - String modelVersion = null; - - if (instanceList != null) { - - for(RelatedInstanceList relatedInstanceList : instanceList){ - - RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance(); - if(relatedInstance.getModelInfo().getModelType().equals(ModelType.service)){ - serviceModelName = relatedInstance.getModelInfo().getModelName(); - asdcServiceModelVersion = relatedInstance.getModelInfo().getModelVersion(); - } - - if(relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)){ - vnfModelName = relatedInstance.getModelInfo().getModelCustomizationName(); - } - - if(relatedInstance.getModelInfo().getModelType().equals(ModelType.vfModule) || - relatedInstance.getModelInfo().getModelType().equals(ModelType.volumeGroup)) { - vfModuleModelName = relatedInstance.getModelInfo().getModelName(); - modelVersion = relatedInstance.getModelInfo().getModelVersion(); - } - } - } - - String vnfType = serviceModelName + "/" + vnfModelName; - - // Try to find a recipe for a custom flow first - recipe = db.getVnfComponentsRecipe(vnfType, vfModuleModelName, asdcServiceModelVersion, modelVersion, action.name()); - } - - if (recipe == null) { - // Find the default recipe record - recipe = db.getVnfComponentsRecipeByVfModuleId("VID_DEFAULT", vnfComponentType, action.name()); - - if (recipe == null) { - return null; - } - } - recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); - - } - else if (msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) { - // VNF REQUEST - // Construct the default vnf type - // TODO need to make this a configurable property - - String defaultVnfType = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; - - VnfRecipe recipe = db.getVnfRecipe(defaultVnfType, action.name()); - - if (recipe == null) { - return null; - } - recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); - } - else if (msoRequest.getModelInfo().getModelType().equals(ModelType.network)) { - // NETWORK REQUEST - // Construct the default network type - // TODO need to make this a configurable property - - String defaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; - - Recipe recipe = db.getNetworkRecipe(defaultNetworkType, action.name()); - - if (recipe == null) { - return null; - } - recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); - } - - if (recipeLookupResult != null) { - msoLogger.debug ("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: " + Integer.toString(recipeLookupResult.getRecipeTimeout ())); - } - else { - msoLogger.debug("No matching recipe record found"); - } - return recipeLookupResult; - } -} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java index 774b9d6f91..3410cf4b76 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java @@ -7,9 +7,9 @@ * 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. @@ -37,22 +37,10 @@ import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.codehaus.jackson.map.ObjectMapper; -import org.openecomp.mso.apihandler.common.ErrorNumbers; -import org.openecomp.mso.apihandler.common.RequestClient; -import org.openecomp.mso.apihandler.common.RequestClientFactory; -import org.openecomp.mso.apihandler.common.ResponseHandler; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstance; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RelatedInstanceList; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.RequestReferences; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesRequest; -import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.ServiceInstancesResponse; +import org.openecomp.mso.apihandler.common.*; +import org.openecomp.mso.apihandlerinfra.serviceinstancebeans.*; import org.openecomp.mso.db.catalog.CatalogDatabase; -import org.openecomp.mso.db.catalog.beans.Recipe; -import org.openecomp.mso.db.catalog.beans.Service; -import org.openecomp.mso.db.catalog.beans.ServiceRecipe; -import org.openecomp.mso.db.catalog.beans.VfModule; -import org.openecomp.mso.db.catalog.beans.VnfComponentsRecipe; -import org.openecomp.mso.db.catalog.beans.VnfRecipe; +import org.openecomp.mso.db.catalog.beans.*; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoAlarmLogger; import org.openecomp.mso.logger.MsoLogger; @@ -62,7 +50,7 @@ import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; import org.openecomp.mso.utils.UUIDChecker; -@Path("/serviceInstances/v2") +@Path("/serviceInstances/{version:[vV][2-3]}") public class ServiceInstances { private HashMap instanceIdMap = new HashMap(); @@ -76,7 +64,7 @@ public class ServiceInstances { private static MsoJavaProperties props = MsoPropertiesUtils.loadMsoProperties (); /** - * + * */ public ServiceInstances() { // TODO Auto-generated constructor stub @@ -86,206 +74,215 @@ public class ServiceInstances { @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - public Response createServiceInstance(String request) { - - Response response = serviceInstances(request, Action.createInstance, null); - + public Response createServiceInstance(String request, @PathParam("version") String version) { + + Response response = serviceInstances(request, Action.createInstance, null, version); + return response; } - + @DELETE @Path("/{serviceInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - public Response deleteServiceInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId) { - + public Response deleteServiceInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("version") String version) { + instanceIdMap.put("serviceInstanceId", serviceInstanceId); - Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap); + Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap, version); return response; } - + @POST @Path("/{serviceInstanceId}/vnfs") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - public Response createVnfInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId) { - + public Response createVnfInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("version") String version) { + instanceIdMap.put("serviceInstanceId", serviceInstanceId); - Response response = serviceInstances(request, Action.createInstance, instanceIdMap); - + Response response = serviceInstances(request, Action.createInstance, instanceIdMap, version); + return response; } - + @DELETE @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response deleteVnfInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { - + @PathParam("vnfInstanceId") String vnfInstanceId, + @PathParam("version") String version) { + instanceIdMap.put("serviceInstanceId", serviceInstanceId); instanceIdMap.put("vnfInstanceId", vnfInstanceId); - Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap); - + Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap, version); + return response; } - + @POST @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - public Response createVfModuleInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { - + public Response createVfModuleInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, + @PathParam("vnfInstanceId") String vnfInstanceId, + @PathParam("version") String version) { + instanceIdMap.put("serviceInstanceId", serviceInstanceId); instanceIdMap.put("vnfInstanceId", vnfInstanceId); - Response response = serviceInstances(request, Action.createInstance, instanceIdMap); - + Response response = serviceInstances(request, Action.createInstance, instanceIdMap, version); + return response; } - + @PUT @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - public Response updateVfModuleInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, + public Response updateVfModuleInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) { - + @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId, + @PathParam("version") String version) { + instanceIdMap.put("serviceInstanceId", serviceInstanceId); instanceIdMap.put("vnfInstanceId", vnfInstanceId); instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId); - Response response = serviceInstances(request, Action.updateInstance, instanceIdMap); - + Response response = serviceInstances(request, Action.updateInstance, instanceIdMap, version); + return response; } - + @DELETE @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response deleteVfModuleInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId) { - - + @PathParam("vfmoduleInstanceId") String vfmoduleInstanceId, + @PathParam("version") String version) { + + instanceIdMap.put("serviceInstanceId", serviceInstanceId); instanceIdMap.put("vnfInstanceId", vnfInstanceId); instanceIdMap.put("vfModuleInstanceId", vfmoduleInstanceId); - Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap); - + Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap, version); + return response; } - - + + @POST @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response createVolumeGroupInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("vnfInstanceId") String vnfInstanceId) { - + @PathParam("vnfInstanceId") String vnfInstanceId, + @PathParam("version") String version) { + instanceIdMap.put("serviceInstanceId", serviceInstanceId); instanceIdMap.put("vnfInstanceId", vnfInstanceId); - Response response = serviceInstances(request, Action.createInstance, instanceIdMap); - + Response response = serviceInstances(request, Action.createInstance, instanceIdMap, version); + return response; } - + @PUT @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateVolumeGroupInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) { - - + @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId, + @PathParam("version") String version) { + + instanceIdMap.put("serviceInstanceId", serviceInstanceId); instanceIdMap.put("vnfInstanceId", vnfInstanceId); instanceIdMap.put("volumeGroupInstanceId", volumeGroupInstanceId); - Response response = serviceInstances(request, Action.updateInstance, instanceIdMap); - + Response response = serviceInstances(request, Action.updateInstance, instanceIdMap, version); + return response; } - + @DELETE @Path("/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response deleteVolumeGroupInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId, - @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId) { - - + @PathParam("volumeGroupInstanceId") String volumeGroupInstanceId, + @PathParam("version") String version) { + + instanceIdMap.put("serviceInstanceId", serviceInstanceId); instanceIdMap.put("vnfInstanceId", vnfInstanceId); instanceIdMap.put("volumeGroupInstanceId", volumeGroupInstanceId); - Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap); - + Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap, version); + return response; } - + @POST @Path("/{serviceInstanceId}/networks") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) - public Response createNetworkInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId) { - + public Response createNetworkInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("version") String version) { + instanceIdMap.put("serviceInstanceId", serviceInstanceId); - Response response = serviceInstances(request, Action.createInstance, instanceIdMap); - + Response response = serviceInstances(request, Action.createInstance, instanceIdMap, version); + return response; } - + @PUT @Path("/{serviceInstanceId}/networks/{networkInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateNetworkInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("networkInstanceId") String networkInstanceId) { - + @PathParam("networkInstanceId") String networkInstanceId, + @PathParam("version") String version) { + instanceIdMap.put("serviceInstanceId", serviceInstanceId); instanceIdMap.put("networkInstanceId", networkInstanceId); - Response response = serviceInstances(request, Action.updateInstance, instanceIdMap); - + Response response = serviceInstances(request, Action.updateInstance, instanceIdMap, version); + return response; - } - + } + @DELETE @Path("/{serviceInstanceId}/networks/{networkInstanceId}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response deleteNetworkInstance(String request, @PathParam("serviceInstanceId") String serviceInstanceId, - @PathParam("networkInstanceId") String networkInstanceId) { - + @PathParam("networkInstanceId") String networkInstanceId, + @PathParam("version") String version) { + instanceIdMap.put("serviceInstanceId", serviceInstanceId); instanceIdMap.put("networkInstanceId", networkInstanceId); - Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap); - + Response response = serviceInstances(request, Action.deleteInstance, instanceIdMap, version); + return response; - } - - - - private Response serviceInstances(String requestJSON, Action action, HashMap instanceIdMap) { - + } + + + + private Response serviceInstances(String requestJSON, Action action, HashMap instanceIdMap, String version) { + String requestId = UUIDChecker.generateUUID(msoLogger); long startTime = System.currentTimeMillis (); msoLogger.debug ("requestId is: " + requestId); ServiceInstancesRequest sir = null; - + MsoRequest msoRequest = new MsoRequest (requestId); - - + + try{ ObjectMapper mapper = new ObjectMapper(); sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class); - + } catch(Exception e){ msoLogger.debug ("Mapping of request to JSON object failed : ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Mapping of request to JSON object failed. " + e.getMessage(), + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, + "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null); if (msoRequest.getRequestId () != null) { msoLogger.debug ("Mapping of request to JSON object failed"); @@ -295,15 +292,15 @@ public class ServiceInstances { msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Mapping of request to JSON object failed"); msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); return response; - } - - + } + + try{ - msoRequest.parse(sir, instanceIdMap, action); + msoRequest.parse(sir, instanceIdMap, action, version); } catch (Exception e) { msoLogger.debug ("Validation failed: ", e); - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, - "Error parsing request. " + e.getMessage(), + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, + "Error parsing request. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null); if (msoRequest.getRequestId () != null) { msoLogger.debug ("Logging failed message to the database"); @@ -314,27 +311,28 @@ public class ServiceInstances { msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); return response; } - + InfraActiveRequests dup = null; String instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName(); String requestScope = sir.getRequestDetails().getModelInfo().getModelType().name(); try { - dup = RequestsDatabase.checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope); - + if(!(instanceName==null && requestScope.equals("service") && action == Action.createInstance)){ + dup = RequestsDatabase.checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope); + } } catch (Exception e) { msoLogger.error (MessageEnum.APIH_DUPLICATE_CHECK_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.DataError, "Error during duplicate check ", e); - - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException, - e.getMessage(), + + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR, MsoException.ServiceException, + e.getMessage(), ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null) ; - - + + msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Error during duplicate check"); msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); return response; } - + if (dup != null) { // Found the duplicate record. Return the appropriate error. String instance = null; @@ -346,29 +344,29 @@ public class ServiceInstances { String dupMessage = "Error: Locked instance - This " + requestScope + " (" + instance + ") " + "already has a request being worked with a status of " + dup.getRequestStatus() + " (RequestId - " + dup.getRequestId() + "). The existing request must finish or be cleaned up before proceeding."; //List variables = new ArrayList(); //variables.add(dup.getRequestStatus()); - - Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT, MsoException.ServiceException, - dupMessage, + + Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT, MsoException.ServiceException, + dupMessage, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null) ; - - + + msoLogger.warn (MessageEnum.APIH_DUPLICATE_FOUND, dupMessage, "", "", MsoLogger.ErrorCode.SchemaError, "Duplicate request - Subscriber already has a request for this service"); msoRequest.createRequestRecord (Status.FAILED, action); msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, dupMessage); msoLogger.debug ("End of the transaction, the final response is: " + (String) response.getEntity ()); return response; } - - + + ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse(); - + RequestReferences referencesResponse = new RequestReferences(); - + referencesResponse.setRequestId(requestId); - - serviceResponse.setRequestReferences(referencesResponse); - + + serviceResponse.setRequestReferences(referencesResponse); + try (CatalogDatabase db = new CatalogDatabase()){ RecipeLookupResult recipeLookupResult = null; @@ -513,7 +511,7 @@ public class ServiceInstances { serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, msoRequest.getServiceInstanceType (), msoRequest.getVnfType (), msoRequest.getVfModuleType (), - msoRequest.getNetworkType (), requestJSON); + msoRequest.getNetworkType (), msoRequest.getRequestJSON()); msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI (), null); } catch (Exception e) { @@ -575,7 +573,7 @@ public class ServiceInstances { ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables); msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is failed with HTTP Status=" + bpelStatus); + msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is failed with HTTP Status=" + bpelStatus); msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPMN engine is failed"); msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); return resp; @@ -587,7 +585,7 @@ public class ServiceInstances { ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables); msoRequest.updateFinalStatus (Status.FAILED); - msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty"); + msoLogger.error (MessageEnum.APIH_BPEL_RESPONSE_ERROR, requestClient.getUrl (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Response from BPEL engine is empty"); msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, "Response from BPEL engine is empty"); msoLogger.debug ("End of the transaction, the final response is: " + (String) resp.getEntity ()); return resp; @@ -613,122 +611,199 @@ public class ServiceInstances { return response; } } - + private RecipeLookupResult getServiceInstanceOrchestrationURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { + RecipeLookupResult recipeLookupResult = null; + //if the aLaCarte flag is set to TRUE, the API-H should choose the “VID_DEFAULT” recipe for the requested action - RecipeLookupResult recipeLookupResult = null; + msoLogger.debug("aLaCarteFlag is " + msoRequest.getALaCarteFlag()); // Query MSO Catalog DB - + if (msoRequest.getModelInfo().getModelType().equals(ModelType.service)) { - - // SERVICE REQUEST - // Construct the default service name - // TODO need to make this a configurable property - - String defaultServiceName = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; - Service serviceRecord = db.getServiceByName(defaultServiceName); - int serviceId = serviceRecord.getId(); - ServiceRecipe recipe = db.getServiceRecipe(serviceId, action.name()); - - if (recipe == null) { - return null; - } - - recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); + recipeLookupResult = getServiceURI(db, msoRequest, action); } else if (msoRequest.getModelInfo().getModelType().equals(ModelType.vfModule) || - msoRequest.getModelInfo().getModelType().equals(ModelType.volumeGroup)) { - - String vnfComponentType = msoRequest.getModelInfo().getModelType().name(); - VnfComponentsRecipe recipe = null; - - if (action != Action.deleteInstance) { - RelatedInstanceList[] instanceList = null; - if (msoRequest.getServiceInstancesRequest().getRequestDetails() != null) { - instanceList = msoRequest.getServiceInstancesRequest().getRequestDetails().getRelatedInstanceList(); - } - - String serviceModelName = null; - String vnfModelName = null; - String vfModuleModelName = null; - String asdcServiceModelVersion = null; - String modelVersion = null; - - if (instanceList != null) { - - for(RelatedInstanceList relatedInstanceList : instanceList){ - - RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance(); - if(relatedInstance.getModelInfo().getModelType().equals(ModelType.service)){ - serviceModelName = relatedInstance.getModelInfo().getModelName(); - asdcServiceModelVersion = relatedInstance.getModelInfo().getModelVersion(); - } - - if(relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)){ - vnfModelName = relatedInstance.getModelInfo().getModelCustomizationName(); - } - - if(relatedInstance.getModelInfo().getModelType().equals(ModelType.vfModule) || - relatedInstance.getModelInfo().getModelType().equals(ModelType.volumeGroup)) { - vfModuleModelName = relatedInstance.getModelInfo().getModelName(); - modelVersion = relatedInstance.getModelInfo().getModelVersion(); - } - } - } - - String vnfType = serviceModelName + "/" + vnfModelName; - - // Try to find a recipe for a custom flow first - recipe = db.getVnfComponentsRecipe(vnfType, vfModuleModelName, asdcServiceModelVersion, modelVersion, action.name()); - } - - if (recipe == null) { - // Find the default recipe record - recipe = db.getVnfComponentsRecipeByVfModuleId("VID_DEFAULT", vnfComponentType, action.name()); - - if (recipe == null) { - return null; - } - } - recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); - - } - else if (msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) { - // VNF REQUEST - // Construct the default vnf type - // TODO need to make this a configurable property - - String defaultVnfType = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; - - VnfRecipe recipe = db.getVnfRecipe(defaultVnfType, action.name()); - - if (recipe == null) { - return null; - } - recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); + msoRequest.getModelInfo().getModelType().equals(ModelType.volumeGroup) || msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) { + + recipeLookupResult = getVnfOrVfModuleUri(db, msoRequest, action); + + }else if (msoRequest.getModelInfo().getModelType().equals(ModelType.network)) { + + recipeLookupResult = getNetworkUri(db, msoRequest, action); } - else if (msoRequest.getModelInfo().getModelType().equals(ModelType.network)) { - // NETWORK REQUEST - // Construct the default network type - // TODO need to make this a configurable property - - String defaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; - - Recipe recipe = db.getNetworkRecipe(defaultNetworkType, action.name()); - - if (recipe == null) { - return null; - } - recipeLookupResult = new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); - } - + if (recipeLookupResult != null) { - msoLogger.debug ("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: " + Integer.toString(recipeLookupResult.getRecipeTimeout ())); + msoLogger.debug ("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: " + Integer.toString(recipeLookupResult.getRecipeTimeout ())); } else { - msoLogger.debug("No matching recipe record found"); + msoLogger.debug("No matching recipe record found"); } return recipeLookupResult; } + + private RecipeLookupResult getServiceURI (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { + // SERVICE REQUEST + // Construct the default service name + // TODO need to make this a configurable property + String defaultServiceName = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; + + Service serviceRecord = null; + if(msoRequest.getALaCarteFlag()){ + serviceRecord = db.getServiceByName(defaultServiceName); + }else{ + serviceRecord = db.getServiceByVersionAndInvariantId(msoRequest.getModelInfo().getModelInvariantId(), msoRequest.getModelInfo().getModelVersion()); + } + int serviceId; + ServiceRecipe recipe = null; + if(serviceRecord !=null){ + serviceId = serviceRecord.getId(); + recipe = db.getServiceRecipe(serviceId, action.name()); + } + //if an aLaCarte flag was sent in the request, throw an error if the recipe was not found + RequestParameters reqParam = msoRequest.getServiceInstancesRequest().getRequestDetails().getRequestParameters(); + if(reqParam!=null && reqParam.isALaCarteSet() && recipe==null){ + return null; + }else if (recipe == null) { //aLaCarte wasn't sent, so we'll try the default + serviceRecord = db.getServiceByName(defaultServiceName); + serviceId = serviceRecord.getId(); + recipe = db.getServiceRecipe(serviceId, action.name()); + } + if(recipe==null){ + return null; + } + return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); + } + + + private RecipeLookupResult getVnfOrVfModuleUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { + + String vnfComponentType = msoRequest.getModelInfo().getModelType().name(); + + RelatedInstanceList[] instanceList = null; + if (msoRequest.getServiceInstancesRequest().getRequestDetails() != null) { + instanceList = msoRequest.getServiceInstancesRequest().getRequestDetails().getRelatedInstanceList(); + } + + String serviceModelName = null; + String vnfModelName = null; + String asdcServiceModelVersion = null; + String modelVersion = msoRequest.getModelInfo().getModelVersion(); + Recipe recipe = null; + String defaultVnfType = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; + String modelCustomizationId = msoRequest.getModelInfo().getModelCustomizationId(); + String vfModuleModelName = msoRequest.getModelInfo().getModelName(); + if (instanceList != null) { + + for(RelatedInstanceList relatedInstanceList : instanceList){ + + RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance(); + ModelInfo modelInfo = relatedInstance.getModelInfo(); + if(modelInfo.getModelType().equals(ModelType.service)){ + serviceModelName = modelInfo.getModelName(); + asdcServiceModelVersion = modelInfo.getModelVersion(); + } + + if(modelInfo.getModelType().equals(ModelType.vnf)){ + vnfModelName = modelInfo.getModelCustomizationName(); + if (null == vnfModelName || vnfModelName.trim().isEmpty()) { + VnfResource vnfResource = db.getVnfResourceByModelCustomizationId(modelInfo.getModelCustomizationUuid(), modelInfo.getModelVersion()); + vnfModelName = vnfResource.getModelName(); + } + } + } + + if(msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) { + String modelCustomizationName = msoRequest.getModelInfo().getModelCustomizationName(); + + VnfResource vnfResource = null; + + // Validation for vnfResource + if(modelCustomizationName!=null) { + vnfResource = db.getVnfResource(serviceModelName + "/" + modelCustomizationName, asdcServiceModelVersion); + }else{ + vnfResource = db.getVnfResourceByModelCustomizationId(modelCustomizationId, asdcServiceModelVersion); + } + + if(vnfResource==null){ + throw new ValidationException("catalog entry"); + } + + VnfRecipe vnfRecipe = db.getVnfRecipe(defaultVnfType, action.name()); + + if (vnfRecipe == null) { + return null; + } + + return new RecipeLookupResult (vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout()); + }else{ + String vnfType = serviceModelName + "/" + vnfModelName; + String vfModuleType = vnfType + "::" + vfModuleModelName; + List vfModule = db.getVfModule(vfModuleType, modelCustomizationId, asdcServiceModelVersion, modelVersion, action.name()); + if(vfModule==null || vfModule.isEmpty()){ + throw new ValidationException("catalog entry"); + }else{ + if(!msoRequest.getALaCarteFlag() && action != Action.deleteInstance){ + recipe = db.getVnfComponentsRecipeByVfModule(vfModule, action.name()); + } + } + if (recipe == null) { + msoLogger.debug("recipe is null, getting default"); + recipe = db.getVnfComponentsRecipeByVfModuleId("VID_DEFAULT", vnfComponentType, action.name()); + + if (recipe == null) { + return null; + } + } + + } + } else { + msoLogger.debug("recipe is null, getting default"); + + if(msoRequest.getModelInfo().getModelType().equals(ModelType.vnf)) { + recipe = db.getVnfRecipe(defaultVnfType, action.name()); + if (recipe == null) { + return null; + } + } else { + recipe = db.getVnfComponentsRecipeByVfModuleId("VID_DEFAULT", vnfComponentType, action.name()); + + if (recipe == null) { + return null; + } + } + } + + return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); + } + + private RecipeLookupResult getNetworkUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { + + String defaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; + + String modelName = msoRequest.getModelInfo().getModelName(); + Recipe recipe = null; + if(msoRequest.getALaCarteFlag()){ + recipe = db.getNetworkRecipe(defaultNetworkType, action.name()); + }else{ + if(msoRequest.getModelInfo().getModelCustomizationId()!=null){ + NetworkResource networkResource = db.getNetworkResourceByModelCustUuid(msoRequest.getModelInfo().getModelCustomizationId()); + if(networkResource!=null){ + recipe = db.getNetworkRecipe(networkResource.getNetworkType(), action.name()); + }else{ + throw new ValidationException("no catalog entry found"); + } + }else{ + //ok for version < 3 + recipe = db.getNetworkRecipe(modelName, action.name()); + } + if(recipe == null){ + recipe = db.getNetworkRecipe(defaultNetworkType, action.name()); + } + } + if (recipe == null) { + return null; + } + return new RecipeLookupResult (recipe.getOrchestrationUri (), recipe.getRecipeTimeout ()); + } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java index c98f90d70f..fdd19bda26 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/Status.java @@ -7,9 +7,9 @@ * 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. @@ -29,5 +29,6 @@ public enum Status { IN_PROGRESS, COMPLETE, FAILED, - TIMEOUT + TIMEOUT, + UNLOCKED } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java index 8a0a1f3152..07d70e9982 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VfModuleModelNamesHandler.java @@ -7,9 +7,9 @@ * 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. @@ -52,18 +52,18 @@ public class VfModuleModelNamesHandler { long startTime = System.currentTimeMillis (); String methodName = "getVfModuleModelNames"; MsoLogger.setServiceName (LOG_SERVICE_NAME + methodName); - msoLogger.debug ("Incoming request received for vfModuleModelNames"); + msoLogger.debug ("Incoming request received for vfModuleModelNames"); List vfModules = null; try (CatalogDatabase db = new CatalogDatabase()){ vfModules = db.getAllVfModules (); } catch (Exception e) { - msoLogger.debug ("No connection to catalog DB", e); + msoLogger.debug ("No connection to catalog DB", e); msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "no connection to catalog DB"); msoLogger.debug ("End of the transaction, the final response is: " + e.toString ()); return Response.status (HttpStatus.SC_NOT_FOUND).entity (e.toString ()).build (); } - if (vfModules == null) { + if (vfModules == null) { msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, "VfModule not found"); msoLogger.debug ("End of the transaction. VfModuleModelName not found the final response status: " + HttpStatus.SC_NOT_FOUND); return Response.status (HttpStatus.SC_NOT_FOUND).entity ("").build (); @@ -74,10 +74,10 @@ public class VfModuleModelNamesHandler { for (int i = 0; i < vfModules.size (); i++) { VfModuleModelName vfModuleModelName = beansObjectFactory.createVfModuleModelName (); VfModule vm = vfModules.get (i); - vfModuleModelName.setModelName (vm.getType ()); + vfModuleModelName.setModelName (vm.getModelName ()); vfModuleModelName.setModelVersion (vm.getVersion ()); vfModuleModelName.setModelInvariantUuid (vm.getModelInvariantUuid ()); - vfModuleModelName.setIsBase(vm.isBase()); + vfModuleModelName.setIsBase(vm.isBase()); vfModuleModelName.setDescription (vm.getDescription ()); vfModuleModelName.setId (String.valueOf (vm.getId ())); vfModuleModelName.setAsdcServiceModelVersion(vm.getVersion ()); @@ -93,10 +93,10 @@ public class VfModuleModelNamesHandler { jaxbMarshaller.marshal (vfModuleModelNames, stringWriter); } catch (JAXBException e) { - msoLogger.debug ("Error marshalling", e); + msoLogger.debug ("Error marshalling", e); } - String response = stringWriter.toString (); + String response = stringWriter.toString (); msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); msoLogger.debug ("End of the transaction, the final response is: " + response); return Response.status (HttpStatus.SC_OK).entity (response).build (); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java index 162e4f799a..bfcbe0d4d5 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfMsoInfraRequest.java @@ -59,9 +59,10 @@ import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequest; import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.requestsdb.HibernateUtil; +import org.openecomp.mso.db.HibernateUtils; import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; +import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb; public class VnfMsoInfraRequest { @@ -83,6 +84,8 @@ public class VnfMsoInfraRequest { private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); private static final String NOT_PROVIDED = "not provided"; + protected HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb (); + VnfMsoInfraRequest (String requestId) { this.requestId = requestId; this.startTime = System.currentTimeMillis(); @@ -276,7 +279,7 @@ public class VnfMsoInfraRequest { Session session = null; try { - session = HibernateUtil.getSessionFactory ().openSession (); + session = hibernateUtils.getSessionFactory ().openSession (); session.beginTransaction (); InfraActiveRequests aq = new InfraActiveRequests (); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java index 32fd80d58a..0b595855df 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VnfTypesHandler.java @@ -7,9 +7,9 @@ * 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. @@ -57,7 +57,6 @@ public class VnfTypesHandler { List vnfResources = null; try(CatalogDatabase db = new CatalogDatabase ()) { - ; if (vnfRole != null) { vnfResources = db.getVnfResourcesByRole (vnfRole); } else { diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java index eb7d1874cd..911ac48d03 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/VolumeMsoInfraRequest.java @@ -7,9 +7,9 @@ * 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. @@ -54,10 +54,11 @@ import org.openecomp.mso.apihandlerinfra.volumebeans.ObjectFactory; import org.openecomp.mso.apihandlerinfra.volumebeans.RequestInfo; import org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType; import org.openecomp.mso.apihandlerinfra.volumebeans.VolumeRequest; +import org.openecomp.mso.db.HibernateUtils; import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.requestsdb.HibernateUtil; +import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb; import org.openecomp.mso.requestsdb.InfraActiveRequests; import org.openecomp.mso.requestsdb.RequestsDatabase; @@ -77,6 +78,8 @@ public class VolumeMsoInfraRequest { private long startTime; private long progress = Constants.PROGRESS_REQUEST_RECEIVED; + protected HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb (); + private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); private static final String NOT_PROVIDED = "not provided"; @@ -133,37 +136,37 @@ public class VolumeMsoInfraRequest { action = this.rinfo.getAction (); if (action == null) { throw new ValidationException ("action"); - } + } this.volumeInputs = volumeReq.getVolumeInputs (); if (this.volumeInputs == null) { throw new ValidationException ("volume-inputs"); } - + // Verify that the elements correspond to the version - + if (version.equals(Constants.SCHEMA_VERSION_V1)) { - if (this.volumeInputs.getBackoutOnFailure() != null || this.volumeInputs.getAicCloudRegion() != null || - this.volumeInputs.getVfModuleModelName () != null || this.volumeInputs.getAsdcServiceModelVersion () != null || - this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) { - throw new ValidationException ("format for v1 version of volume request"); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V2)) { - if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null || - this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) { - throw new ValidationException ("format for v2 version of volume request"); - } - } - else if (version.equals(Constants.SCHEMA_VERSION_V3)) { - if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null) { - throw new ValidationException ("format for v3 version of volume request"); + if (this.volumeInputs.getBackoutOnFailure() != null || this.volumeInputs.getAicCloudRegion() != null || + this.volumeInputs.getVfModuleModelName () != null || this.volumeInputs.getAsdcServiceModelVersion () != null || + this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) { + throw new ValidationException ("format for v1 version of volume request"); + } + } + else if (version.equals(Constants.SCHEMA_VERSION_V2)) { + if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null || + this.volumeInputs.getServiceInstanceId () != null || this.volumeInputs.getVnfId () != null) { + throw new ValidationException ("format for v2 version of volume request"); } } - - + else if (version.equals(Constants.SCHEMA_VERSION_V3)) { + if (this.volumeInputs.getServiceType() != null || this.volumeInputs.getAicNodeClli() != null) { + throw new ValidationException ("format for v3 version of volume request"); + } + } + + if (!InfraUtils.isActionAllowed (props, "volume", version, action.value ())) { - throw new ValidationException ("action allowable for version " + version + " of volume request"); - } + throw new ValidationException ("action allowable for version " + version + " of volume request"); + } switch (action) { case UPDATE: @@ -177,7 +180,7 @@ public class VolumeMsoInfraRequest { default: break; } - + if (ActionType.CREATE.equals (action) || ActionType.CREATE_VF_MODULE_VOL.equals(action)) { if (this.volumeInputs.getVolumeGroupName () == null) { throw new ValidationException ("volume-group-name"); @@ -185,18 +188,18 @@ public class VolumeMsoInfraRequest { if (!InfraUtils.isValidHeatName(this.volumeInputs.getVolumeGroupName ())) { throw new ValidationException ("volume-group-name: no value meeting heat stack name syntax requirements"); } - } - - + } + + if (this.volumeInputs.getVnfType () == null) { throw new ValidationException ("vnf-type"); - } - - + } + + switch (action) { case CREATE_VF_MODULE_VOL: case UPDATE_VF_MODULE_VOL: - case DELETE_VF_MODULE_VOL: + case DELETE_VF_MODULE_VOL: if (this.volumeInputs.getVfModuleModelName () == null) { throw new ValidationException ("vf-module-model-name"); } @@ -204,38 +207,38 @@ public class VolumeMsoInfraRequest { default: break; } - + if (!version.equals(Constants.SCHEMA_VERSION_V1) && this.volumeInputs.getServiceId () == null) { throw new ValidationException ("service-id "); - } - + } + if (version.equals(Constants.SCHEMA_VERSION_V1) && this.volumeInputs.getServiceType () != null && this.volumeInputs.getServiceId () != null) { throw new ValidationException ("service-type or service-id "); } - + if (version.equals(Constants.SCHEMA_VERSION_V1) && this.volumeInputs.getAicNodeClli () == null) { throw new ValidationException ("aic-node-clli"); } - + if ((version.equals(Constants.SCHEMA_VERSION_V2) || version.equals(Constants.SCHEMA_VERSION_V3)) && (this.volumeInputs.getAicCloudRegion () == null || this.volumeInputs.getAicCloudRegion ().isEmpty())) { throw new ValidationException ("aic-cloud-region"); } - + if (version.equals(Constants.SCHEMA_VERSION_V3) && this.volumeInputs.getServiceInstanceId () == null) { throw new ValidationException ("service-instance-id"); } - + if (version.equals(Constants.SCHEMA_VERSION_V3) && this.volumeInputs.getVnfId () == null && ActionType.CREATE_VF_MODULE_VOL.equals(action)) { throw new ValidationException ("vnf-id"); } - if (ActionType.CREATE.equals (action) || ActionType.CREATE_VF_MODULE_VOL.equals(action)) { + if (ActionType.CREATE.equals (action) || ActionType.CREATE_VF_MODULE_VOL.equals(action)) { if (this.volumeInputs.getTenantId () == null) { throw new ValidationException ("tenant-id"); } } - + Object vpN = volumeReq.getVolumeParams (); if (vpN != null) { @@ -245,7 +248,7 @@ public class VolumeMsoInfraRequest { } msoLogger.debug ("VolumeParams: " + this.volumeParams); - + msoLogger.debug ("Request valid"); @@ -267,9 +270,9 @@ public class VolumeMsoInfraRequest { msoLogger.debug ("Exception: ", e); } - this.requestXML = stringWriter.toString ().replace("http://ecomp.att.com/mso/infra/volume-request", - "http://ecomp.att.com/mso/infra/vnf-request"); - + this.requestXML = stringWriter.toString ().replace("http://org.openecomp/mso/infra/volume-request", + "http://org.openecomp/mso/infra/vnf-request"); + msoLogger.debug("REQUEST XML to BPEL: " + this.requestXML); } @@ -279,7 +282,7 @@ public class VolumeMsoInfraRequest { Session session = null; try { - session = HibernateUtil.getSessionFactory ().openSession (); + session = hibernateUtils.getSessionFactory ().openSession (); session.beginTransaction (); InfraActiveRequests aq = new InfraActiveRequests (); @@ -295,7 +298,7 @@ public class VolumeMsoInfraRequest { } else { // Set up mandatory parameters aq.setAction (NOT_PROVIDED); - aq.setAction (NOT_PROVIDED); + aq.setRequestAction (NOT_PROVIDED); } aq.setRequestBody (this.requestXML); @@ -332,7 +335,7 @@ public class VolumeMsoInfraRequest { if (volumeInputs.getTenantId () != null) { aq.setTenantId (volumeInputs.getTenantId ()); } - + } aq.setStartTime (startTimeStamp); aq.setRequestStatus (status.toString ()); @@ -349,10 +352,10 @@ public class VolumeMsoInfraRequest { aq.setResponseBody (this.responseBody); Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis()); - aq.setEndTime (endTimeStamp); - } + aq.setEndTime (endTimeStamp); + } aq.setProgress (this.progress); - + msoLogger.debug ("About to insert a record"); @@ -373,7 +376,7 @@ public class VolumeMsoInfraRequest { public void updateFinalStatus (Status status) { int result = 0; try { - result = RequestsDatabase.updateInfraFinalStatus(requestId, status.toString (), + result = RequestsDatabase.updateInfraFinalStatus(requestId, status.toString (), this.errorMessage, this.progress, this.responseBody, Constants.MODIFIED_BY_APIHANDLER); } catch (Exception e) { msoLogger.error(MessageEnum.APIH_DB_UPDATE_EXC, e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "Exception in updateFinalStatus"); @@ -449,7 +452,7 @@ public class VolumeMsoInfraRequest { vr.setRequestInfo (ri); vr.setVolumeInputs (this.volumeInputs); - + StringWriter stringWriter = new StringWriter (); try { JAXBContext jaxbContext = JAXBContext.newInstance (VolumeRequest.class); @@ -512,7 +515,7 @@ public class VolumeMsoInfraRequest { vr.setRequestInfo (ri); vr.setVolumeInputs (this.volumeInputs); - + StringWriter stringWriter = new StringWriter (); try { JAXBContext jaxbContext = JAXBContext.newInstance (VolumeRequest.class); @@ -595,11 +598,11 @@ public class VolumeMsoInfraRequest { break; } } - + public String getServiceType () { - if (this.volumeInputs.getServiceType () != null) + if (this.volumeInputs.getServiceType () != null) return this.volumeInputs.getServiceType (); - if (this.volumeInputs.getServiceId () != null) + if (this.volumeInputs.getServiceId () != null) return this.volumeInputs.getServiceId (); return null; } @@ -630,9 +633,9 @@ public class VolumeMsoInfraRequest { String s = sw.toString (); return s; } - + return null; - + } catch (Exception e) { msoLogger.error (MessageEnum.APIH_DOM2STR_ERROR, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception in domToStr", e); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequest.java index 41e1236a8b..b843784776 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequest.java @@ -46,11 +46,11 @@ import javax.xml.bind.annotation.XmlType; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}request-info"/> + * <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}request-info"/> * <sequence> - * <element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}network-inputs"/> - * <element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}network-params" minOccurs="0"/> - * <element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}network-outputs" minOccurs="0"/> + * <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}network-inputs"/> + * <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}network-params" minOccurs="0"/> + * <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}network-outputs" minOccurs="0"/> * </sequence> * </sequence> * </restriction> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java index 1c0cd94ca2..f77d5e3cc4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkRequests.java @@ -48,7 +48,7 @@ import javax.xml.bind.annotation.XmlType; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <element ref="{http://ecomp.att.com/mso/infra/network-request/v1}network-request" maxOccurs="unbounded" minOccurs="0"/> + * <element ref="{http://org.openecomp/mso/infra/network-request/v1}network-request" maxOccurs="unbounded" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java index e7ddc929b2..a7e3ae03ba 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/NetworkTypes.java @@ -48,7 +48,7 @@ import javax.xml.bind.annotation.XmlType; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}vnf-type" maxOccurs="unbounded" minOccurs="0"/> + * <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}vnf-type" maxOccurs="unbounded" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java index df553da518..6099d37918 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/ObjectFactory.java @@ -52,7 +52,7 @@ import javax.xml.namespace.QName; @XmlRegistry public class ObjectFactory { - private final static QName _NetworkParams_QNAME = new QName("http://ecomp.att.com/mso/infra/network-request/v1", "network-params"); + private final static QName _NetworkParams_QNAME = new QName("http://org.openecomp/mso/infra/network-request/v1", "network-params"); /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.apihandlerinfra.vnfbeans1 @@ -121,7 +121,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}} * */ - @XmlElementDecl(namespace = "http://ecomp.att.com/mso/infra/network-request/v1", name = "network-params") + @XmlElementDecl(namespace = "http://org.openecomp/mso/infra/network-request/v1", name = "network-params") public JAXBElement createNetworkParams(Object value) { return new JAXBElement(_NetworkParams_QNAME, Object.class, null, value); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestInfo.java index c7e20aa034..35c8d30d6f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestInfo.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/RequestInfo.java @@ -7,9 +7,9 @@ * 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. @@ -19,16 +19,15 @@ */ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT // package org.openecomp.mso.apihandlerinfra.networkbeans; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -38,17 +37,17 @@ import javax.xml.bind.annotation.XmlType; /** *

    Java class for anonymous complex type. - * + * *

    The following schema fragment specifies the expected content contained within this class. - * + * *

      * <complexType>
      *   <complexContent>
      *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
      *       <sequence>
      *         <element name="request-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
    - *         <element name="action" type="{http://ecomp.att.com/mso/infra/vnf-request/v1}action-type"/>
    - *         <element name="request-status" type="{http://ecomp.att.com/mso/infra/vnf-request/v1}request-status-type" minOccurs="0"/>
    + *         <element name="action" type="{http://org.openecomp/mso/infra/vnf-request/v1}action-type"/>
    + *         <element name="request-status" type="{http://org.openecomp/mso/infra/vnf-request/v1}request-status-type" minOccurs="0"/>
      *         <element name="status-message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
      *         <element name="progress" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
      *         <element name="start-time" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
    @@ -59,8 +58,8 @@ import javax.xml.bind.annotation.XmlType;
      *   </complexContent>
      * </complexType>
      * 
    - * - * + * + * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { @@ -93,11 +92,11 @@ public class RequestInfo { /** * Gets the value of the requestId property. - * + * * @return * possible object is * {@link String } - * + * */ public String getRequestId() { return requestId; @@ -105,11 +104,11 @@ public class RequestInfo { /** * Sets the value of the requestId property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setRequestId(String value) { this.requestId = value; @@ -117,11 +116,11 @@ public class RequestInfo { /** * Gets the value of the action property. - * + * * @return * possible object is * {@link ActionType } - * + * */ public ActionType getAction() { return action; @@ -129,11 +128,11 @@ public class RequestInfo { /** * Sets the value of the action property. - * + * * @param value * allowed object is * {@link ActionType } - * + * */ public void setAction(ActionType value) { this.action = value; @@ -141,11 +140,11 @@ public class RequestInfo { /** * Gets the value of the requestStatus property. - * + * * @return * possible object is * {@link RequestStatusType } - * + * */ public RequestStatusType getRequestStatus() { return requestStatus; @@ -153,11 +152,11 @@ public class RequestInfo { /** * Sets the value of the requestStatus property. - * + * * @param value * allowed object is * {@link RequestStatusType } - * + * */ public void setRequestStatus(RequestStatusType value) { this.requestStatus = value; @@ -165,11 +164,11 @@ public class RequestInfo { /** * Gets the value of the statusMessage property. - * + * * @return * possible object is * {@link String } - * + * */ public String getStatusMessage() { return statusMessage; @@ -177,11 +176,11 @@ public class RequestInfo { /** * Sets the value of the statusMessage property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setStatusMessage(String value) { this.statusMessage = value; @@ -189,11 +188,11 @@ public class RequestInfo { /** * Gets the value of the progress property. - * + * * @return * possible object is * {@link Integer } - * + * */ public Integer getProgress() { return progress; @@ -201,11 +200,11 @@ public class RequestInfo { /** * Sets the value of the progress property. - * + * * @param value * allowed object is * {@link Integer } - * + * */ public void setProgress(Integer value) { this.progress = value; @@ -213,11 +212,11 @@ public class RequestInfo { /** * Gets the value of the startTime property. - * + * * @return * possible object is * {@link String } - * + * */ public String getStartTime() { return startTime; @@ -225,11 +224,11 @@ public class RequestInfo { /** * Sets the value of the startTime property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setStartTime(String value) { this.startTime = value; @@ -237,11 +236,11 @@ public class RequestInfo { /** * Gets the value of the endTime property. - * + * * @return * possible object is * {@link String } - * + * */ public String getEndTime() { return endTime; @@ -249,11 +248,11 @@ public class RequestInfo { /** * Sets the value of the endTime property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setEndTime(String value) { this.endTime = value; @@ -261,11 +260,11 @@ public class RequestInfo { /** * Gets the value of the source property. - * + * * @return * possible object is * {@link String } - * + * */ public String getSource() { return source; @@ -273,11 +272,11 @@ public class RequestInfo { /** * Sets the value of the source property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setSource(String value) { this.source = value; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/package-info.java index 54fb4971b5..b1121919ec 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/package-info.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/networkbeans/package-info.java @@ -25,6 +25,6 @@ // Generated on: 2015.09.03 at 02:02:13 PM EDT // -@javax.xml.bind.annotation.XmlSchema(namespace = "http://ecomp.att.com/mso/infra/network-request/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/mso/infra/network-request/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package org.openecomp.mso.apihandlerinfra.networkbeans; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java index 9225523d87..1d58fb8b83 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/package-info.java @@ -25,6 +25,6 @@ // Generated on: 2015.01.08 at 03:50:12 PM EST // -@javax.xml.bind.annotation.XmlSchema(namespace = "http://ecomp.att.com/mso/request/types/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/mso/request/types/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package org.openecomp.mso.apihandlerinfra; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/CloudConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/CloudConfiguration.java index a9f7f7a880..777c945e82 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/CloudConfiguration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/CloudConfiguration.java @@ -7,9 +7,9 @@ * 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. @@ -31,11 +31,11 @@ public class CloudConfiguration { /** * Gets the value of the aicNodeClli property. - * + * * @return * possible object is * {@link String } - * + * */ public String getAicNodeClli() { return aicNodeClli; @@ -43,11 +43,11 @@ public class CloudConfiguration { /** * Sets the value of the aicNodeClli property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setAicNodeClli(String value) { this.aicNodeClli = value; @@ -55,11 +55,11 @@ public class CloudConfiguration { /** * Gets the value of the tenantId property. - * + * * @return * possible object is * {@link String } - * + * */ public String getTenantId() { return tenantId; @@ -67,16 +67,16 @@ public class CloudConfiguration { /** * Sets the value of the tenantId property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setTenantId(String value) { this.tenantId = value; } - + public String getLcpCloudRegionId() { return lcpCloudRegionId; @@ -85,6 +85,12 @@ public class CloudConfiguration { public void setLcpCloudRegionId(String lcpCloudRegionId) { this.lcpCloudRegionId = lcpCloudRegionId; } - + + @Override + public String toString() { + return "CloudConfiguration [aicNodeClli=" + aicNodeClli + ", tenantId=" + + tenantId + ", lcpCloudRegionId=" + lcpCloudRegionId + "]"; + } + } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/InstanceReferences.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/InstanceReferences.java index fd5c73f97f..8f453c832d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/InstanceReferences.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/InstanceReferences.java @@ -7,9 +7,9 @@ * 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. @@ -24,7 +24,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize; @JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT) public class InstanceReferences { - + protected String serviceInstanceId; protected String serviceInstanceName; protected String vnfInstanceId; @@ -35,8 +35,9 @@ public class InstanceReferences { protected String volumeGroupInstanceName; protected String networkInstanceId; protected String networkInstanceName; - - + protected String requestorId; + + public String getServiceInstanceId() { return serviceInstanceId; } @@ -97,7 +98,12 @@ public class InstanceReferences { public void setNetworkInstanceName(String networkInstanceName) { this.networkInstanceName = networkInstanceName; } - + public String getRequestorId() { + return requestorId; + } + public void setRequestorId(String requestorId) { + this.requestorId = requestorId; + } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ModelInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ModelInfo.java index e361b1db32..f542d63da9 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ModelInfo.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ModelInfo.java @@ -7,9 +7,9 @@ * 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. @@ -19,10 +19,10 @@ */ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2016.03.30 at 02:48:23 PM CDT +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2016.03.30 at 02:48:23 PM CDT // @@ -38,11 +38,16 @@ public class ModelInfo { protected String modelCustomizationName; protected String modelInvariantId; protected ModelType modelType; + //v2 protected String modelNameVersionId; protected String modelName; protected String modelVersion; - - + protected String modelCustomizationUuid; + //v3 + protected String modelVersionId; + protected String modelCustomizationId; + + public String getModelCustomizationName() { return modelCustomizationName; } @@ -79,6 +84,34 @@ public class ModelInfo { public void setModelInvariantId(String modelInvariantId) { this.modelInvariantId = modelInvariantId; } - + public String getModelCustomizationUuid() { + return modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public String getModelVersionId() { + return modelVersionId; + } + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + public String getModelCustomizationId() { + return modelCustomizationId; + } + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + @Override + public String toString() { + return "ModelInfo [modelCustomizationName=" + modelCustomizationName + + ", modelInvariantId=" + modelInvariantId + ", modelType=" + + modelType + ", modelNameVersionId=" + modelNameVersionId + + ", modelName=" + modelName + ", modelVersion=" + modelVersion + + ", modelCustomizationUuid=" + modelCustomizationUuid + + ", modelVersionId=" + modelVersionId + + ", modelCustomizationId=" + modelCustomizationId + "]"; + } + -} +} \ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/PolicyException.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/PolicyException.java index 4d336c460a..5aed50ee5f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/PolicyException.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/PolicyException.java @@ -41,7 +41,7 @@ import javax.xml.bind.annotation.XmlType; *
      * <complexType name="policyException">
      *   <complexContent>
    - *     <extension base="{http://ecomp.att.com/mso/request/types/v1}exceptionType">
    + *     <extension base="{http://org.openecomp/mso/request/types/v1}exceptionType">
      *     </extension>
      *   </complexContent>
      * </complexType>
    diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstanceList.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstanceList.java
    index 1244d3b567..b60d4b6fdb 100644
    --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstanceList.java
    +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RelatedInstanceList.java
    @@ -7,9 +7,9 @@
      * 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.
    @@ -21,7 +21,7 @@
     package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
     
     public class RelatedInstanceList {
    -	
    +
     	protected RelatedInstance relatedInstance;
     
     	public RelatedInstance getRelatedInstance() {
    @@ -32,6 +32,11 @@ public class RelatedInstanceList {
     		this.relatedInstance = relatedInstance;
     	}
     
    +	@Override
    +	public String toString() {
    +		return "RelatedInstanceList [relatedInstance=" + relatedInstance + "]";
    +	}
    +
    +
     
    -	
     }
    diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestDetails.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestDetails.java
    index de6cbb7978..bb1fa3b8a5 100644
    --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestDetails.java
    +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestDetails.java
    @@ -7,9 +7,9 @@
      * 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.
    @@ -20,6 +20,8 @@
     
     package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
     
    +import java.util.Arrays;
    +
     import org.codehaus.jackson.map.annotate.JsonRootName;
     import org.codehaus.jackson.map.annotate.JsonSerialize;
     
    @@ -36,11 +38,11 @@ public class RequestDetails {
     
         /**
          * Gets the value of the serviceInfo property.
    -     * 
    +     *
          * @return
          *     possible object is
          *     {@link ModelInfo }
    -     *     
    +     *
          */
         public ModelInfo getModelInfo() {
             return modelInfo;
    @@ -48,11 +50,11 @@ public class RequestDetails {
     
         /**
          * Sets the value of the serviceInfo property.
    -     * 
    +     *
          * @param value
          *     allowed object is
          *     {@link ModelInfo }
    -     *     
    +     *
          */
         public void setModelInfo(ModelInfo value) {
             this.modelInfo = value;
    @@ -60,11 +62,11 @@ public class RequestDetails {
     
         /**
          * Gets the value of the requestInfo property.
    -     * 
    +     *
          * @return
          *     possible object is
          *     {@link RequestInfo }
    -     *     
    +     *
          */
         public RequestInfo getRequestInfo() {
             return requestInfo;
    @@ -72,11 +74,11 @@ public class RequestDetails {
     
         /**
          * Sets the value of the requestInfo property.
    -     * 
    +     *
          * @param value
          *     allowed object is
          *     {@link RequestInfo }
    -     *     
    +     *
          */
         public void setRequestInfo(RequestInfo value) {
             this.requestInfo = value;
    @@ -84,11 +86,11 @@ public class RequestDetails {
     
         /**
          * Gets the value of the subscriberInfo property.
    -     * 
    +     *
          * @return
          *     possible object is
          *     {@link SubscriberInfo }
    -     *     
    +     *
          */
         public SubscriberInfo getSubscriberInfo() {
             return subscriberInfo;
    @@ -96,11 +98,11 @@ public class RequestDetails {
     
         /**
          * Sets the value of the subscriberInfo property.
    -     * 
    +     *
          * @param value
          *     allowed object is
          *     {@link SubscriberInfo }
    -     *     
    +     *
          */
         public void setSubscriberInfo(SubscriberInfo value) {
             this.subscriberInfo = value;
    @@ -108,11 +110,11 @@ public class RequestDetails {
     
         /**
          * Gets the value of the cloudConfiguration property.
    -     * 
    +     *
          * @return
          *     possible object is
          *     {@link CloudConfiguration }
    -     *     
    +     *
          */
         public CloudConfiguration getCloudConfiguration() {
             return cloudConfiguration;
    @@ -120,11 +122,11 @@ public class RequestDetails {
     
         /**
          * Sets the value of the cloudConfiguration property.
    -     * 
    +     *
          * @param value
          *     allowed object is
          *     {@link CloudConfiguration }
    -     *     
    +     *
          */
         public void setCloudConfiguration(CloudConfiguration value) {
             this.cloudConfiguration = value;
    @@ -132,11 +134,11 @@ public class RequestDetails {
     
         /**
          * Gets the value of the requestParameters property.
    -     * 
    +     *
          * @return
          *     possible object is
          *     {@link RequestParameters }
    -     *     
    +     *
          */
         public RequestParameters getRequestParameters() {
             return requestParameters;
    @@ -144,11 +146,11 @@ public class RequestDetails {
     
         /**
          * Sets the value of the requestParameters property.
    -     * 
    +     *
          * @param value
          *     allowed object is
          *     {@link RequestParameters }
    -     *     
    +     *
          */
         public void setRequestParameters(RequestParameters value) {
             this.requestParameters = value;
    @@ -162,4 +164,13 @@ public class RequestDetails {
     		this.relatedInstanceList = relatedInstanceList;
     	}
     
    +	@Override
    +	public String toString() {
    +		return "RequestDetails [modelInfo=" + modelInfo + ", requestInfo="
    +				+ requestInfo + ", relatedInstanceList="
    +				+ Arrays.toString(relatedInstanceList) + ", subscriberInfo="
    +				+ subscriberInfo + ", cloudConfiguration=" + cloudConfiguration
    +				+ ", requestParameters=" + requestParameters + "]";
    +	}
    +
     }
    diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestError.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestError.java
    index 3a27238670..db2f1654a1 100644
    --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestError.java
    +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestError.java
    @@ -45,8 +45,8 @@ import javax.xml.bind.annotation.XmlType;
      *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
      *       <sequence>
      *         <choice>
    - *           <element name="policyException" type="{http://ecomp.att.com/mso/request/types/v1}policyException"/>
    - *           <element name="serviceException" type="{http://ecomp.att.com/mso/request/types/v1}serviceException"/>
    + *           <element name="policyException" type="{http://org.openecomp/mso/request/types/v1}policyException"/>
    + *           <element name="serviceException" type="{http://org.openecomp/mso/request/types/v1}serviceException"/>
      *         </choice>
      *       </sequence>
      *     </restriction>
    diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestInfo.java
    index e5f3167c1f..69c0dfc53d 100644
    --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestInfo.java
    +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestInfo.java
    @@ -7,9 +7,9 @@
      * 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.
    @@ -21,6 +21,7 @@
     package org.openecomp.mso.apihandlerinfra.serviceinstancebeans;
     
     import org.codehaus.jackson.map.annotate.JsonSerialize;
    +import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
     
     @JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
     public class RequestInfo {
    @@ -33,15 +34,17 @@ public class RequestInfo {
         protected Integer orderVersion;
         protected String source;
         protected String instanceName;
    +    @JsonSerialize(include=Inclusion.ALWAYS)
         protected boolean suppressRollback;
    +    protected String requestorId;
     
         /**
          * Gets the value of the callbackUrl property.
    -     * 
    +     *
          * @return
          *     possible object is
          *     {@link String }
    -     *     
    +     *
          */
         public String getCallbackUrl() {
             return callbackUrl;
    @@ -49,11 +52,11 @@ public class RequestInfo {
     
         /**
          * Sets the value of the callbackUrl property.
    -     * 
    +     *
          * @param value
          *     allowed object is
          *     {@link String }
    -     *     
    +     *
          */
         public void setCallbackUrl(String value) {
             this.callbackUrl = value;
    @@ -61,11 +64,11 @@ public class RequestInfo {
     
         /**
          * Gets the value of the correlator property.
    -     * 
    +     *
          * @return
          *     possible object is
          *     {@link String }
    -     *     
    +     *
          */
         public String getCorrelator() {
             return correlator;
    @@ -73,11 +76,11 @@ public class RequestInfo {
     
         /**
          * Sets the value of the correlator property.
    -     * 
    +     *
          * @param value
          *     allowed object is
          *     {@link String }
    -     *     
    +     *
          */
         public void setCorrelator(String value) {
             this.correlator = value;
    @@ -85,11 +88,11 @@ public class RequestInfo {
     
         /**
          * Gets the value of the orderNumber property.
    -     * 
    +     *
          * @return
          *     possible object is
          *     {@link String }
    -     *     
    +     *
          */
         public String getOrderNumber() {
             return orderNumber;
    @@ -97,11 +100,11 @@ public class RequestInfo {
     
         /**
          * Sets the value of the orderNumber property.
    -     * 
    +     *
          * @param value
          *     allowed object is
          *     {@link String }
    -     *     
    +     *
          */
         public void setOrderNumber(String value) {
             this.orderNumber = value;
    @@ -109,11 +112,11 @@ public class RequestInfo {
     
         /**
          * Gets the value of the orderVersion property.
    -     * 
    +     *
          * @return
          *     possible object is
          *     {@link Integer }
    -     *     
    +     *
          */
         public Integer getOrderVersion() {
             return orderVersion;
    @@ -121,11 +124,11 @@ public class RequestInfo {
     
         /**
          * Sets the value of the orderVersion property.
    -     * 
    +     *
          * @param value
          *     allowed object is
          *     {@link Integer }
    -     *     
    +     *
          */
         public void setOrderVersion(Integer value) {
             this.orderVersion = value;
    @@ -133,11 +136,11 @@ public class RequestInfo {
     
         /**
          * Gets the value of the source property.
    -     * 
    +     *
          * @return
          *     possible object is
          *     {@link String }
    -     *     
    +     *
          */
         public String getSource() {
             return source;
    @@ -145,11 +148,11 @@ public class RequestInfo {
     
         /**
          * Sets the value of the source property.
    -     * 
    +     *
          * @param value
          *     allowed object is
          *     {@link String }
    -     *     
    +     *
          */
         public void setSource(String value) {
             this.source = value;
    @@ -179,13 +182,36 @@ public class RequestInfo {
     		this.productFamilyId = productFamilyId;
     	}
     
    -	public boolean isSuppressRollback() {
    +	/**
    +	 * Required for Marshalers to send the fields.
    +	 * @return
    +	 */
    +	public boolean getSuppressRollback() {
     		return suppressRollback;
     	}
     
     	public void setSuppressRollback(boolean suppressRollback) {
     		this.suppressRollback = suppressRollback;
     	}
    -	
    +
    +	public String getRequestorId() {
    +		return requestorId;
    +	}
    +
    +	public void setRequestorId(String requestorId) {
    +		this.requestorId = requestorId;
    +	}
    +
    +	@Override
    +	public String toString() {
    +		return "RequestInfo [billingAccountNumber=" + billingAccountNumber
    +				+ ", callbackUrl=" + callbackUrl + ", correlator=" + correlator
    +				+ ", orderNumber=" + orderNumber + ", productFamilyId="
    +				+ productFamilyId + ", orderVersion=" + orderVersion
    +				+ ", source=" + source + ", instanceName=" + instanceName
    +				+ ", suppressRollback=" + suppressRollback + ", requestorId="
    +				+ requestorId + "]";
    +	}
    +
     
     }
    diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java
    index 1a8204055e..dee0649184 100644
    --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java
    +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestParameters.java
    @@ -7,9 +7,9 @@
      * 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.
    @@ -25,13 +25,25 @@ import java.util.HashMap;
     import java.util.List;
     import java.util.Map;
     
    +import org.codehaus.jackson.annotate.JsonIgnore;
     import org.codehaus.jackson.map.annotate.JsonSerialize;
    +import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion;
    +
    +import org.openecomp.mso.apihandlerinfra.MsoRequest;
     
     @JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)
     public class RequestParameters {
     
     	private String subscriptionServiceType;
     	private List> userParams = new ArrayList<>();
    +	@JsonSerialize(include=Inclusion.ALWAYS)
    +	private boolean aLaCarte = false;
    +	@JsonIgnore
    +	private boolean isALaCarteSet = false;
    +	@JsonSerialize(include=Inclusion.ALWAYS)
    +	private boolean autoBuildVfModules = false;
    +	@JsonSerialize(include=Inclusion.ALWAYS)
    +	private boolean cascadeDelete = false;
     
     
     	public String getSubscriptionServiceType() {
    @@ -42,6 +54,24 @@ public class RequestParameters {
     		this.subscriptionServiceType = subscriptionServiceType;
     	}
     
    +	public boolean getALaCarte() {
    +		return aLaCarte;
    +	}
    +
    +	public void setaLaCarte(boolean aLaCarte) {
    +		this.aLaCarte = aLaCarte;
    +		this.isALaCarteSet = true;
    +	}
    +
    +	//returns true if aLaCarte param came in on request
    +	public boolean isALaCarteSet() {
    +		return isALaCarteSet;
    +	}
    +
    +	public boolean isaLaCarte() {
    +		return aLaCarte;
    +	}
    +
     	public List> getUserParams() {
     		return userParams;
     	}
    @@ -50,5 +80,40 @@ public class RequestParameters {
     		this.userParams = userParams;
     	}
     
    +	public String getUserParamValue(String name){
    +	    	if(userParams!=null){
    +	    		for(Map param:userParams){
    +	    			if(param.get("name").equals(name)){
    +	    				return param.get("value");
    +	    			}
    +	    		}
    +	    	}
    +	    	return null;
    +	}
    +
    +	public boolean getAutoBuildVfModules() {
    +		return autoBuildVfModules;
    +	}
    +
    +	public void setAutoBuildVfModules(boolean autoBuildVfModules) {
    +		this.autoBuildVfModules = autoBuildVfModules;
    +	}
    +
    +	public boolean getCascadeDelete() {
    +		return cascadeDelete;
    +	}
    +
    +	public void setCascadeDelete(boolean cascadeDelete) {
    +		this.cascadeDelete = cascadeDelete;
    +	}
    +
    +	@Override
    +	public String toString() {
    +		return "RequestParameters [subscriptionServiceType="
    +				+ subscriptionServiceType + ", userParams=" + userParams
    +				+ ", aLaCarte=" + aLaCarte + ", autoBuildVfModules="
    +				+ autoBuildVfModules + "]";
    +	}
    +
     
    -}
    +}
    \ No newline at end of file
    diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestStatus.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestStatus.java
    index a9bf5e873f..89e8075836 100644
    --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestStatus.java
    +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/RequestStatus.java
    @@ -7,9 +7,9 @@
      * 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.
    @@ -31,8 +31,8 @@ public class RequestStatus {
         protected String statusMessage;
         protected Integer percentProgress;
         protected String finishTime;
    -    
    -    
    +
    +
     	public String getRequestState() {
     		return requestState;
     	}
    @@ -57,5 +57,4 @@ public class RequestStatus {
     	public void setFinishTime(String finishTime) {
     		this.finishTime = finishTime;
     	}
    -
    -}
    +}
    \ No newline at end of file
    diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceException.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceException.java
    index f207e96cb5..b3c01d0d0e 100644
    --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceException.java
    +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceException.java
    @@ -41,7 +41,7 @@ import javax.xml.bind.annotation.XmlType;
      * 
      * <complexType name="serviceException">
      *   <complexContent>
    - *     <extension base="{http://ecomp.att.com/mso/request/types/v1}exceptionType">
    + *     <extension base="{http://org.openecomp/mso/request/types/v1}exceptionType">
      *     </extension>
      *   </complexContent>
      * </complexType>
    diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesRequest.java
    index 30903b9649..2281f2ee72 100644
    --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesRequest.java
    +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/ServiceInstancesRequest.java
    @@ -7,9 +7,9 @@
      * 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.
    @@ -78,6 +78,15 @@ public class ServiceInstancesRequest {
     	public void setVfModuleInstanceId(String vfModuleInstanceId) {
     		this.vfModuleInstanceId = vfModuleInstanceId;
     	}
    -	
     
    -}
    +	@Override
    +	public String toString() {
    +		return "ServiceInstancesRequest [requestDetails=" + requestDetails
    +				+ ", serviceInstanceId=" + serviceInstanceId
    +				+ ", vnfInstanceId=" + vnfInstanceId + ", networkInstanceId="
    +				+ networkInstanceId + ", volumeGroupInstanceId="
    +				+ volumeGroupInstanceId + ", vfModuleInstanceId="
    +				+ vfModuleInstanceId + "]";
    +	}
    +
    +}
    \ No newline at end of file
    diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/SubscriberInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/SubscriberInfo.java
    index bf7a044b28..97fc4968bb 100644
    --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/SubscriberInfo.java
    +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/serviceinstancebeans/SubscriberInfo.java
    @@ -7,9 +7,9 @@
      * 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.
    @@ -30,11 +30,11 @@ public class SubscriberInfo {
     
         /**
          * Gets the value of the globalSubscriberId property.
    -     * 
    +     *
          * @return
          *     possible object is
          *     {@link String }
    -     *     
    +     *
          */
         public String getGlobalSubscriberId() {
             return globalSubscriberId;
    @@ -42,11 +42,11 @@ public class SubscriberInfo {
     
         /**
          * Sets the value of the globalSubscriberId property.
    -     * 
    +     *
          * @param value
          *     allowed object is
          *     {@link String }
    -     *     
    +     *
          */
         public void setGlobalSubscriberId(String value) {
             this.globalSubscriberId = value;
    @@ -54,11 +54,11 @@ public class SubscriberInfo {
     
         /**
          * Gets the value of the subscriberName property.
    -     * 
    +     *
          * @return
          *     possible object is
          *     {@link String }
    -     *     
    +     *
          */
         public String getSubscriberName() {
             return subscriberName;
    @@ -66,14 +66,20 @@ public class SubscriberInfo {
     
         /**
          * Sets the value of the subscriberName property.
    -     * 
    +     *
          * @param value
          *     allowed object is
          *     {@link String }
    -     *     
    +     *
          */
         public void setSubscriberName(String value) {
             this.subscriberName = value;
         }
     
    +	@Override
    +	public String toString() {
    +		return "SubscriberInfo [globalSubscriberId=" + globalSubscriberId
    +				+ ", subscriberName=" + subscriberName + "]";
    +	}
    +
     }
    diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java
    index b1c000f348..e86d2bb84a 100644
    --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java
    +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/ObjectFactory.java
    @@ -52,8 +52,8 @@ import javax.xml.namespace.QName;
     @XmlRegistry
     public class ObjectFactory {
     
    -    private final static QName _VnfParams_QNAME = new QName("http://ecomp.att.com/mso/infra/vnf-request/v1", "vnf-params");
    -    private final static QName _NetworkParams_QNAME = new QName("http://ecomp.att.com/mso/infra/vnf-request/v1", "network-params");
    +    private final static QName _VnfParams_QNAME = new QName("http://org.openecomp/mso/infra/vnf-request/v1", "vnf-params");
    +    private final static QName _NetworkParams_QNAME = new QName("http://org.openecomp/mso/infra/vnf-request/v1", "network-params");
     
         /**
          * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.apihandlerinfra.vnfbeans1
    @@ -142,7 +142,7 @@ public class ObjectFactory {
          * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}}
          * 
          */
    -    @XmlElementDecl(namespace = "http://ecomp.att.com/mso/infra/vnf-request/v1", name = "vnf-params")
    +    @XmlElementDecl(namespace = "http://org.openecomp/mso/infra/vnf-request/v1", name = "vnf-params")
         public JAXBElement createVnfParams(Object value) {
             return new JAXBElement(_VnfParams_QNAME, Object.class, null, value);
         }
    diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java
    index cb8973b83e..e9f88ab190 100644
    --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java
    +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestInfo.java
    @@ -7,9 +7,9 @@
      * 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.
    @@ -19,10 +19,10 @@
      */
     
     //
    -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 
    -// See http://java.sun.com/xml/jaxb 
    -// Any modifications to this file will be lost upon recompilation of the source schema. 
    -// Generated on: 2015.09.03 at 02:02:13 PM EDT 
    +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
    +// See http://java.sun.com/xml/jaxb
    +// Any modifications to this file will be lost upon recompilation of the source schema.
    +// Generated on: 2015.09.03 at 02:02:13 PM EDT
     //
     
     
    @@ -38,17 +38,17 @@ import javax.xml.bind.annotation.XmlType;
     
     /**
      * 

    Java class for anonymous complex type. - * + * *

    The following schema fragment specifies the expected content contained within this class. - * + * *

      * <complexType>
      *   <complexContent>
      *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
      *       <sequence>
      *         <element name="request-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
    - *         <element name="action" type="{http://ecomp.att.com/mso/infra/vnf-request/v1}action-type"/>
    - *         <element name="request-status" type="{http://ecomp.att.com/mso/infra/vnf-request/v1}request-status-type" minOccurs="0"/>
    + *         <element name="action" type="{http://org.openecomp/mso/infra/vnf-request/v1}action-type"/>
    + *         <element name="request-status" type="{http://org.openecomp/mso/infra/vnf-request/v1}request-status-type" minOccurs="0"/>
      *         <element name="status-message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
      *         <element name="progress" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
      *         <element name="start-time" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
    @@ -59,8 +59,8 @@ import javax.xml.bind.annotation.XmlType;
      *   </complexContent>
      * </complexType>
      * 
    - * - * + * + * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { @@ -93,11 +93,11 @@ public class RequestInfo { /** * Gets the value of the requestId property. - * + * * @return * possible object is * {@link String } - * + * */ public String getRequestId() { return requestId; @@ -105,11 +105,11 @@ public class RequestInfo { /** * Sets the value of the requestId property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setRequestId(String value) { this.requestId = value; @@ -117,11 +117,11 @@ public class RequestInfo { /** * Gets the value of the action property. - * + * * @return * possible object is * {@link ActionType } - * + * */ public ActionType getAction() { return action; @@ -129,11 +129,11 @@ public class RequestInfo { /** * Sets the value of the action property. - * + * * @param value * allowed object is * {@link ActionType } - * + * */ public void setAction(ActionType value) { this.action = value; @@ -141,11 +141,11 @@ public class RequestInfo { /** * Gets the value of the requestStatus property. - * + * * @return * possible object is * {@link RequestStatusType } - * + * */ public RequestStatusType getRequestStatus() { return requestStatus; @@ -153,11 +153,11 @@ public class RequestInfo { /** * Sets the value of the requestStatus property. - * + * * @param value * allowed object is * {@link RequestStatusType } - * + * */ public void setRequestStatus(RequestStatusType value) { this.requestStatus = value; @@ -165,11 +165,11 @@ public class RequestInfo { /** * Gets the value of the statusMessage property. - * + * * @return * possible object is * {@link String } - * + * */ public String getStatusMessage() { return statusMessage; @@ -177,11 +177,11 @@ public class RequestInfo { /** * Sets the value of the statusMessage property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setStatusMessage(String value) { this.statusMessage = value; @@ -189,11 +189,11 @@ public class RequestInfo { /** * Gets the value of the progress property. - * + * * @return * possible object is * {@link Integer } - * + * */ public Integer getProgress() { return progress; @@ -201,11 +201,11 @@ public class RequestInfo { /** * Sets the value of the progress property. - * + * * @param value * allowed object is * {@link Integer } - * + * */ public void setProgress(Integer value) { this.progress = value; @@ -213,11 +213,11 @@ public class RequestInfo { /** * Gets the value of the startTime property. - * + * * @return * possible object is * {@link String } - * + * */ public String getStartTime() { return startTime; @@ -225,11 +225,11 @@ public class RequestInfo { /** * Sets the value of the startTime property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setStartTime(String value) { this.startTime = value; @@ -237,11 +237,11 @@ public class RequestInfo { /** * Gets the value of the endTime property. - * + * * @return * possible object is * {@link String } - * + * */ public String getEndTime() { return endTime; @@ -249,11 +249,11 @@ public class RequestInfo { /** * Sets the value of the endTime property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setEndTime(String value) { this.endTime = value; @@ -261,11 +261,11 @@ public class RequestInfo { /** * Gets the value of the source property. - * + * * @return * possible object is * {@link String } - * + * */ public String getSource() { return source; @@ -273,11 +273,11 @@ public class RequestInfo { /** * Sets the value of the source property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setSource(String value) { this.source = value; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java index 4698c785a9..a8fa78b87f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/RequestStatusType.java @@ -7,9 +7,9 @@ * 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. @@ -19,10 +19,10 @@ */ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT // @@ -35,7 +35,7 @@ import javax.xml.bind.annotation.XmlType; /** *

    Java class for request-status-type. - * + * *

    The following schema fragment specifies the expected content contained within this class. *

    *

    @@ -47,7 +47,7 @@ import javax.xml.bind.annotation.XmlType;
      *   </restriction>
      * </simpleType>
      * 
    - * + * */ @XmlType(name = "request-status-type") @XmlEnum @@ -57,7 +57,8 @@ public enum RequestStatusType { FAILED, IN_PROGRESS, PENDING, - TIMEOUT; + TIMEOUT, + UNLOCKED; public String value() { return name(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java index 790a5e80ef..099a33d0a4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VfModuleModelNames.java @@ -48,7 +48,7 @@ import javax.xml.bind.annotation.XmlType; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}vf-module-model-name" maxOccurs="unbounded" minOccurs="0"/> + * <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}vf-module-model-name" maxOccurs="unbounded" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java index bd210a5aca..8d0fdcc67d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequest.java @@ -46,11 +46,11 @@ import javax.xml.bind.annotation.XmlType; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}request-info"/> + * <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}request-info"/> * <sequence> - * <element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}vnf-inputs"/> - * <element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}vnf-params" minOccurs="0"/> - * <element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}vnf-outputs" minOccurs="0"/> + * <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}vnf-inputs"/> + * <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}vnf-params" minOccurs="0"/> + * <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}vnf-outputs" minOccurs="0"/> * </sequence> * </sequence> * </restriction> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java index 65aa9c1d99..1ae229720c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfRequests.java @@ -48,7 +48,7 @@ import javax.xml.bind.annotation.XmlType; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}vnf-request" maxOccurs="unbounded" minOccurs="0"/> + * <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}vnf-request" maxOccurs="unbounded" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java index 473695c179..9b966cd2bf 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/VnfTypes.java @@ -48,7 +48,7 @@ import javax.xml.bind.annotation.XmlType; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <element ref="{http://ecomp.att.com/mso/infra/vnf-request/v1}vnf-type" maxOccurs="unbounded" minOccurs="0"/> + * <element ref="{http://org.openecomp/mso/infra/vnf-request/v1}vnf-type" maxOccurs="unbounded" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java index 700d7a9064..aa609615ab 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/vnfbeans/package-info.java @@ -25,6 +25,6 @@ // Generated on: 2015.09.03 at 02:02:13 PM EDT // -@javax.xml.bind.annotation.XmlSchema(namespace = "http://ecomp.att.com/mso/infra/vnf-request/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/mso/infra/vnf-request/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package org.openecomp.mso.apihandlerinfra.vnfbeans; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java index 24b620eb6b..3344d8d840 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/ObjectFactory.java @@ -52,7 +52,7 @@ import javax.xml.namespace.QName; @XmlRegistry public class ObjectFactory { - private final static QName _VolumeParams_QNAME = new QName("http://ecomp.att.com/mso/infra/volume-request/v1", "volume-params"); + private final static QName _VolumeParams_QNAME = new QName("http://org.openecomp/mso/infra/volume-request/v1", "volume-params"); /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.apihandlerinfra.vnfbeans1 @@ -107,7 +107,7 @@ public class ObjectFactory { * Create an instance of {@link JAXBElement }{@code <}{@link Object }{@code >}} * */ - @XmlElementDecl(namespace = "http://ecomp.att.com/mso/infra/volume-request/v1", name = "volume-params") + @XmlElementDecl(namespace = "http://org.openecomp/mso/infra/volume-request/v1", name = "volume-params") public JAXBElement createVolumeParams(Object value) { return new JAXBElement(_VolumeParams_QNAME, Object.class, null, value); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestInfo.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestInfo.java index 40e809c9fa..4dfa4a6f3d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestInfo.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/RequestInfo.java @@ -7,9 +7,9 @@ * 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. @@ -19,10 +19,10 @@ */ // -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2015.09.03 at 02:02:13 PM EDT +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.09.03 at 02:02:13 PM EDT // @@ -38,17 +38,17 @@ import javax.xml.bind.annotation.XmlType; /** *

    Java class for anonymous complex type. - * + * *

    The following schema fragment specifies the expected content contained within this class. - * + * *

      * <complexType>
      *   <complexContent>
      *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
      *       <sequence>
      *         <element name="request-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
    - *         <element name="action" type="{http://ecomp.att.com/mso/infra/vnf-request/v1}action-type"/>
    - *         <element name="request-status" type="{http://ecomp.att.com/mso/infra/vnf-request/v1}request-status-type" minOccurs="0"/>
    + *         <element name="action" type="{http://org.openecomp/mso/infra/vnf-request/v1}action-type"/>
    + *         <element name="request-status" type="{http://org.openecomp/mso/infra/vnf-request/v1}request-status-type" minOccurs="0"/>
      *         <element name="status-message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
      *         <element name="progress" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
      *         <element name="start-time" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
    @@ -59,8 +59,8 @@ import javax.xml.bind.annotation.XmlType;
      *   </complexContent>
      * </complexType>
      * 
    - * - * + * + * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { @@ -93,11 +93,11 @@ public class RequestInfo { /** * Gets the value of the requestId property. - * + * * @return * possible object is * {@link String } - * + * */ public String getRequestId() { return requestId; @@ -105,11 +105,11 @@ public class RequestInfo { /** * Sets the value of the requestId property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setRequestId(String value) { this.requestId = value; @@ -117,11 +117,11 @@ public class RequestInfo { /** * Gets the value of the action property. - * + * * @return * possible object is * {@link ActionType } - * + * */ public ActionType getAction() { return action; @@ -129,11 +129,11 @@ public class RequestInfo { /** * Sets the value of the action property. - * + * * @param value * allowed object is * {@link ActionType } - * + * */ public void setAction(ActionType value) { this.action = value; @@ -141,11 +141,11 @@ public class RequestInfo { /** * Gets the value of the requestStatus property. - * + * * @return * possible object is * {@link RequestStatusType } - * + * */ public RequestStatusType getRequestStatus() { return requestStatus; @@ -153,11 +153,11 @@ public class RequestInfo { /** * Sets the value of the requestStatus property. - * + * * @param value * allowed object is * {@link RequestStatusType } - * + * */ public void setRequestStatus(RequestStatusType value) { this.requestStatus = value; @@ -165,11 +165,11 @@ public class RequestInfo { /** * Gets the value of the statusMessage property. - * + * * @return * possible object is * {@link String } - * + * */ public String getStatusMessage() { return statusMessage; @@ -177,11 +177,11 @@ public class RequestInfo { /** * Sets the value of the statusMessage property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setStatusMessage(String value) { this.statusMessage = value; @@ -189,11 +189,11 @@ public class RequestInfo { /** * Gets the value of the progress property. - * + * * @return * possible object is * {@link Integer } - * + * */ public Integer getProgress() { return progress; @@ -201,11 +201,11 @@ public class RequestInfo { /** * Sets the value of the progress property. - * + * * @param value * allowed object is * {@link Integer } - * + * */ public void setProgress(Integer value) { this.progress = value; @@ -213,11 +213,11 @@ public class RequestInfo { /** * Gets the value of the startTime property. - * + * * @return * possible object is * {@link String } - * + * */ public String getStartTime() { return startTime; @@ -225,11 +225,11 @@ public class RequestInfo { /** * Sets the value of the startTime property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setStartTime(String value) { this.startTime = value; @@ -237,11 +237,11 @@ public class RequestInfo { /** * Gets the value of the endTime property. - * + * * @return * possible object is * {@link String } - * + * */ public String getEndTime() { return endTime; @@ -249,11 +249,11 @@ public class RequestInfo { /** * Sets the value of the endTime property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setEndTime(String value) { this.endTime = value; @@ -261,11 +261,11 @@ public class RequestInfo { /** * Gets the value of the source property. - * + * * @return * possible object is * {@link String } - * + * */ public String getSource() { return source; @@ -273,11 +273,11 @@ public class RequestInfo { /** * Sets the value of the source property. - * + * * @param value * allowed object is * {@link String } - * + * */ public void setSource(String value) { this.source = value; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequest.java index 9ec3d7e4d5..d67d8c9202 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequest.java @@ -46,11 +46,11 @@ import javax.xml.bind.annotation.XmlType; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <element ref="{http://ecomp.att.com/mso/infra/volume-request/v1}request-info"/> + * <element ref="{http://org.openecomp/mso/infra/volume-request/v1}request-info"/> * <sequence> - * <element ref="{http://ecomp.att.com/mso/infra/volume-request/v1}volume-inputs"/> - * <element ref="{http://ecomp.att.com/mso/infra/volume-request/v1}volume-params" minOccurs="0"/> - * <element ref="{http://ecomp.att.com/mso/infra/volume-request/v1}volume-outputs" minOccurs="0"/> + * <element ref="{http://org.openecomp/mso/infra/volume-request/v1}volume-inputs"/> + * <element ref="{http://org.openecomp/mso/infra/volume-request/v1}volume-params" minOccurs="0"/> + * <element ref="{http://org.openecomp/mso/infra/volume-request/v1}volume-outputs" minOccurs="0"/> * </sequence> * </sequence> * </restriction> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java index 04fc16e822..432df99d78 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/VolumeRequests.java @@ -48,7 +48,7 @@ import javax.xml.bind.annotation.XmlType; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <element ref="{http://ecomp.att.com/mso/infra/volume-request/v1}volume-request" maxOccurs="unbounded" minOccurs="0"/> + * <element ref="{http://org.openecomp/mso/infra/volume-request/v1}volume-request" maxOccurs="unbounded" minOccurs="0"/> * </sequence> * </restriction> * </complexContent> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/package-info.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/package-info.java index 3678024b75..da9b178bd4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/package-info.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/volumebeans/package-info.java @@ -25,6 +25,6 @@ // Generated on: 2015.09.03 at 02:02:13 PM EDT // -@javax.xml.bind.annotation.XmlSchema(namespace = "http://ecomp.att.com/mso/infra/volume-request/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/mso/infra/volume-request/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package org.openecomp.mso.apihandlerinfra.volumebeans; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/adv-feature-request.xml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/adv-feature-request.xml index aacab0bcce..00ea3fe231 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/adv-feature-request.xml +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/adv-feature-request.xml @@ -19,14 +19,14 @@ --> + xmlns="http://org.openecomp/mso/request/layer3serviceactivate/schema/v1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:msolayer3="http://org.openecomp/mso/request/layer3/schema/v1" + xmlns:msoservtypes="http://org.openecomp/mso/request/types/v1"> 155415ab-b4a7-4382-b4c6-d17d950565 ChangeFeatureActivateRequest OMX - https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws + https://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws 5051560 1 diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/adv-service-request.xml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/adv-service-request.xml index 1e495838b7..3186ae4845 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/adv-service-request.xml +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/adv-service-request.xml @@ -22,17 +22,17 @@ --> ChgActsm519-500 ChangeLayer3ServiceActivateRequest OMX - https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNot + https://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNot ification.jws 051815-1005 2 diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/feature-request.xml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/feature-request.xml index b652a62064..edcfc04f28 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/feature-request.xml +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/feature-request.xml @@ -19,7 +19,7 @@ ============LICENSE_END========================================================= --> - + tns1:request-id Layer3ServiceActivateRequest diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/service-request.xml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/service-request.xml index b9f70a0e53..c905eeba2b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/service-request.xml +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/test/resources/service-request.xml @@ -19,7 +19,7 @@ ============LICENSE_END========================================================= --> - + tns1:request-id Layer3ServiceActivateRequest diff --git a/mso-api-handlers/mso-requests-db/pom.xml b/mso-api-handlers/mso-requests-db/pom.xml index 2d9cc89216..63520f065b 100644 --- a/mso-api-handlers/mso-requests-db/pom.xml +++ b/mso-api-handlers/mso-requests-db/pom.xml @@ -96,7 +96,6 @@ hibernate-jpa-2.1-api 1.0.0.Final - org.openecomp.mso common @@ -107,17 +106,7 @@ ${project.artifactId} - - - maven-war-plugin - 2.3 - - WebContent - false - - - - + de.juplo hibernate4-maven-plugin 1.1.0 diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtil.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtil.java deleted file mode 100644 index 21bece9b10..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtil.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============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.requestsdb; - - -import org.hibernate.SessionFactory; -import org.hibernate.cfg.Configuration; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -@SuppressWarnings("deprecation") -public class HibernateUtil { - - //private static SessionFactory SESSION_FACTORY; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - - private static SessionFactory SESSION_FACTORY; - - - static { - try { - - if ("MYSQL".equals (System.getProperty ("mso.db")) || "MARIADB".equals(System.getProperty("mso.db"))) { - SESSION_FACTORY = new Configuration ().configure ("hibernate-mysql.cfg.xml").buildSessionFactory (); - } else { - LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC", "", "", MsoLogger.ErrorCode.DataError , "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC"); - } - } catch (Exception ex) { - LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, ex.getMessage (), "", "", MsoLogger.ErrorCode.DataError , "Problem in getting DB connection type", ex); - throw ex; - } - } - - public static SessionFactory getSessionFactory () { - return SESSION_FACTORY; - } - - private HibernateUtil () { - // Avoid creation of an instance - } -} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtilsRequestsDb.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtilsRequestsDb.java new file mode 100644 index 0000000000..09548116c5 --- /dev/null +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/HibernateUtilsRequestsDb.java @@ -0,0 +1,47 @@ +/*- + * ============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.requestsdb; + +import org.openecomp.mso.db.HibernateUtils; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; +import java.net.URL; + +public class HibernateUtilsRequestsDb extends HibernateUtils { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); + + @Override + protected URL getHibernateConfigFile() { + try { + + if ("MYSQL".equals (System.getProperty ("mso.db")) || "MARIADB".equals(System.getProperty("mso.db"))) { + return this.getClass().getClassLoader().getResource("hibernate-requests-core-mysql.cfg.xml"); + } else { + LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC", "", "", MsoLogger.ErrorCode.DataError , "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC"); + return null; + } + } catch (Exception ex) { + LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, ex.getMessage (), "", "", MsoLogger.ErrorCode.DataError , "Problem in getting DB connection type", ex); + return null; + } + + } +} \ No newline at end of file diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraRequests.java index 43128192d9..54574c85b5 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraRequests.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/InfraRequests.java @@ -7,9 +7,9 @@ * 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. @@ -77,7 +77,7 @@ public class InfraRequests implements java.io.Serializable { private String networkId; private String networkName; private String networkType; - + private String requestorId; public InfraRequests() { } @@ -273,7 +273,7 @@ public class InfraRequests implements java.io.Serializable { public void setRequestType(String requestType) { this.requestType = requestType; } - + public String getVolumeGroupId() { return this.volumeGroupId; } @@ -281,7 +281,7 @@ public class InfraRequests implements java.io.Serializable { public void setVolumeGroupId(String volumeGroupId) { this.volumeGroupId = volumeGroupId; } - + public String getVolumeGroupName() { return this.volumeGroupName; } @@ -289,7 +289,7 @@ public class InfraRequests implements java.io.Serializable { public void setVolumeGroupName(String volumeGroupName) { this.volumeGroupName = volumeGroupName; } - + public String getVfModuleId() { return this.vfModuleId; } @@ -297,7 +297,7 @@ public class InfraRequests implements java.io.Serializable { public void setVfModuleId(String vfModuleId) { this.vfModuleId = vfModuleId; } - + public String getVfModuleName() { return this.vfModuleName; } @@ -305,7 +305,7 @@ public class InfraRequests implements java.io.Serializable { public void setVfModuleName(String vfModuleName) { this.vfModuleName = vfModuleName; } - + public String getVfModuleModelName() { return this.vfModuleModelName; } @@ -313,7 +313,7 @@ public class InfraRequests implements java.io.Serializable { public void setVfModuleModelName(String vfModuleModelName) { this.vfModuleModelName = vfModuleModelName; } - + public String getAaiServiceId() { return this.aaiServiceId; } @@ -369,7 +369,7 @@ public class InfraRequests implements java.io.Serializable { public void setRequestScope(String requestScope) { this.requestScope = requestScope; } - + public String getRequestAction() { return requestAction; } @@ -401,5 +401,13 @@ public class InfraRequests implements java.io.Serializable { public void setNetworkType(String networkType) { this.networkType = networkType; } - + + public String getRequestorId() { + return requestorId; + } + + public void setRequestorId(String requestorId) { + this.requestorId = requestorId; + } + } diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java index fda4461840..e32c456295 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java @@ -35,13 +35,17 @@ import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.hibernate.persister.entity.AbstractEntityPersister; - +import org.openecomp.mso.db.HibernateUtils; +import org.openecomp.mso.requestsdb.HibernateUtilsRequestsDb; import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.logger.MessageEnum; public class RequestsDatabase { + protected static HibernateUtils hibernateUtils = new HibernateUtilsRequestsDb (); + protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); - + protected static final String SOURCE = "source"; protected static final String START_TIME = "startTime"; protected static final String REQUEST_TYPE = "requestType"; @@ -70,7 +74,7 @@ public class RequestsDatabase { } public static boolean healthCheck () { - Session session = HibernateUtil.getSessionFactory ().openSession (); + Session session = hibernateUtils.getSessionFactory ().openSession (); try { Query query = session.createSQLQuery (" show tables "); @@ -88,7 +92,7 @@ public class RequestsDatabase { public static int updateInfraStatus (String requestId, String requestStatus, String lastModifiedBy) { long startTime = System.currentTimeMillis (); msoLogger.debug ("Update infra request record " + requestId + " with status " + requestStatus); - Session session = HibernateUtil.getSessionFactory ().openSession (); + Session session = hibernateUtils.getSessionFactory ().openSession (); int result = 0; try { @@ -113,7 +117,7 @@ public class RequestsDatabase { public static int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) { long startTime = System.currentTimeMillis (); msoLogger.debug ("Update infra request record " + requestId + " with status " + requestStatus); - Session session = HibernateUtil.getSessionFactory ().openSession (); + Session session = hibernateUtils.getSessionFactory ().openSession (); int result = 0; try { @@ -139,7 +143,7 @@ public class RequestsDatabase { public static int updateInfraFinalStatus (String requestId, String requestStatus, String statusMessage, long progress, String responseBody, String lastModifiedBy) { long startTime = System.currentTimeMillis (); msoLogger.debug ("Update infra request record " + requestId + " with status " + requestStatus); - Session session = HibernateUtil.getSessionFactory ().openSession (); + Session session = hibernateUtils.getSessionFactory ().openSession (); int result = 0; try { @@ -172,7 +176,7 @@ public class RequestsDatabase { List results = new ArrayList(); - Session session = HibernateUtil.getSessionFactory ().openSession (); + Session session = hibernateUtils.getSessionFactory ().openSession (); try { session.beginTransaction (); Criteria crit = session.createCriteria (InfraActiveRequests.class); @@ -197,7 +201,7 @@ public class RequestsDatabase { long startTime = System.currentTimeMillis (); msoLogger.debug ("Get request " + requestId + " from InfraActiveRequests DB"); - Session session = HibernateUtil.getSessionFactory ().openSession (); + Session session = hibernateUtils.getSessionFactory ().openSession (); InfraActiveRequests ar = null; try { session.beginTransaction (); @@ -314,7 +318,7 @@ public class RequestsDatabase { long startTime = System.currentTimeMillis (); msoLogger.debug ("Get list of infra requests from DB with " + queryAttributeName + " = " + queryValue); - Session session = HibernateUtil.getSessionFactory ().openSession (); + Session session = hibernateUtils.getSessionFactory ().openSession (); try { session.beginTransaction (); Criteria crit = session.createCriteria (InfraActiveRequests.class) @@ -342,7 +346,7 @@ public class RequestsDatabase { long startTime = System.currentTimeMillis (); msoLogger.debug ("Get infra request from DB with id " + requestId); - Session session = HibernateUtil.getSessionFactory ().openSession (); + Session session = hibernateUtils.getSessionFactory ().openSession (); InfraActiveRequests ar = null; try { session.beginTransaction (); @@ -366,7 +370,7 @@ public class RequestsDatabase { msoLogger.debug ("Get infra request from DB for VNF " + vnfName + " and action " + action + " and requestType " + requestType); InfraActiveRequests ar = null; - Session session = HibernateUtil.getSessionFactory ().openSession (); + Session session = hibernateUtils.getSessionFactory ().openSession (); try { session.beginTransaction (); @@ -395,7 +399,7 @@ public class RequestsDatabase { msoLogger.debug ("Get list of infra requests from DB for VNF " + vnfId + " and action " + action); InfraActiveRequests ar = null; - Session session = HibernateUtil.getSessionFactory ().openSession (); + Session session = hibernateUtils.getSessionFactory ().openSession (); try { session.beginTransaction (); @@ -429,7 +433,7 @@ public class RequestsDatabase { * @return SiteStatus object or null if none found */ public static SiteStatus getSiteStatus (String siteName) { - Session session = HibernateUtil.getSessionFactory ().openSession (); + Session session = hibernateUtils.getSessionFactory ().openSession (); long startTime = System.currentTimeMillis (); SiteStatus siteStatus = null; @@ -456,7 +460,7 @@ public class RequestsDatabase { * @param status The updated status of the Site */ public static void updateSiteStatus (String siteName, boolean status) { - Session session = HibernateUtil.getSessionFactory ().openSession (); + Session session = hibernateUtils.getSessionFactory ().openSession (); session.beginTransaction (); long startTime = System.currentTimeMillis (); diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml b/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml index b98177ae83..ee12b45f5d 100644 --- a/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml +++ b/mso-api-handlers/mso-requests-db/src/main/resources/InfraActiveRequests.hbm.xml @@ -8,9 +8,9 @@ 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. @@ -142,5 +142,8 @@ + + + diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/hibernate-mysql.cfg.xml b/mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml similarity index 100% rename from mso-api-handlers/mso-requests-db/src/main/resources/hibernate-mysql.cfg.xml rename to mso-api-handlers/mso-requests-db/src/main/resources/hibernate-requests-core-mysql.cfg.xml diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/HibernateUtilESTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/HibernateUtilESTest.java deleted file mode 100644 index 6ae0a641c8..0000000000 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/HibernateUtilESTest.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file was automatically generated by EvoSuite - * Wed Dec 14 15:15:07 GMT 2016 - */ - -package org.openecomp.mso.requestsdb; - -import org.junit.Test; -import static org.junit.Assert.*; -import org.evosuite.runtime.EvoRunner; -import org.evosuite.runtime.EvoRunnerParameters; -import org.evosuite.runtime.PrivateAccess; -import org.junit.runner.RunWith; -import org.openecomp.mso.requestsdb.HibernateUtil; - -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) -public class HibernateUtilESTest extends HibernateUtilESTestscaffolding { - - @Test(timeout = 4000) - public void test0() throws Throwable { - HibernateUtil hibernateUtil0 = (HibernateUtil)PrivateAccess.callDefaultConstructorOfTheClassUnderTest(); - assertNotNull(hibernateUtil0); - } -} diff --git a/mso-api-handlers/pom.xml b/mso-api-handlers/pom.xml index 6b9448e63d..23f7be3f04 100644 --- a/mso-api-handlers/pom.xml +++ b/mso-api-handlers/pom.xml @@ -20,6 +20,12 @@ + + org.evosuite + evosuite-standalone-runtime + ${evosuiteVersion} + test + org.apache.httpcomponents httpcore diff --git a/mso-catalog-db/pom.xml b/mso-catalog-db/pom.xml index 6b9e55cc79..50ffa0a002 100644 --- a/mso-catalog-db/pom.xml +++ b/mso-catalog-db/pom.xml @@ -15,14 +15,6 @@ ${project.artifactId} - - maven-war-plugin - 2.3 - - WebContent - false - - de.juplo hibernate4-maven-plugin @@ -36,7 +28,7 @@ org.hibernate.dialect.MySQL5Dialect - ${project.basedir}/src/main/resources/HeatEnvironment.hbm.xml,${project.basedir}/src/main/resources/HeatNestedTemplate.hbm.xml,${project.basedir}/src/main/resources/HeatTemplate.hbm.xml,${project.basedir}/src/main/resources/NetworkResource.hbm.xml,${project.basedir}/src/main/resources/NetworkRecipe.hbm.xml,${project.basedir}/src/main/resources/Service.hbm.xml,${project.basedir}/src/main/resources/VnfRecipe.hbm.xml,${project.basedir}/src/main/resources/VnfResource.hbm.xml,${project.basedir}/src/main/resources/VnfComponent.hbm.xml,${project.basedir}/src/main/resources/VnfComponentsRecipe.hbm.xml,${project.basedir}/src/main/resources/VfModule.hbm.xml,${project.basedir}/src/main/resources/VfModuleToHeatFiles.hbm.xml + ${project.basedir}/src/main/resources/HeatEnvironment.hbm.xml,${project.basedir}/src/main/resources/HeatNestedTemplate.hbm.xml,${project.basedir}/src/main/resources/HeatTemplate.hbm.xml,${project.basedir}/src/main/resources/NetworkResource.hbm.xml,${project.basedir}/src/main/resources/NetworkRecipe.hbm.xml,${project.basedir}/src/main/resources/Service.hbm.xml,${project.basedir}/src/main/resources/VnfRecipe.hbm.xml,${project.basedir}/src/main/resources/VnfResource.hbm.xml,${project.basedir}/src/main/resources/VnfComponent.hbm.xml,${project.basedir}/src/main/resources/VnfComponentsRecipe.hbm.xml,${project.basedir}/src/main/resources/VfModule.hbm.xml,${project.basedir}/src/main/resources/VfModuleToHeatFiles.hbm.xml,${project.basedir}/src/main/resources/AllottedResourceCustomization.hbm.xml,${project.basedir}/src/main/resources/ModelRecipe.hbm.xml,${project.basedir}/src/main/resources/NetworkResourceCustomization.hbm.xml,${project.basedir}/src/main/resources/ServiceToAllottedResources.hbm.xml,${project.basedir}/src/main/resources/ServiceToNetworks.hbm.xml SCRIPT false true @@ -147,7 +139,12 @@ - + + org.evosuite + evosuite-standalone-runtime + ${evosuiteVersion} + test + org.openecomp.mso common diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java index 70b9618265..38e711eb16 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java @@ -21,6 +21,7 @@ package org.openecomp.mso.db.catalog; import java.io.Closeable; +import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -35,7 +36,9 @@ import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistryBuilder; +import org.openecomp.mso.db.HibernateUtils; import org.openecomp.mso.db.catalog.utils.MavenLikeVersioningComparator; +import org.openecomp.mso.db.catalog.utils.RecordNotFoundException; import org.openecomp.mso.logger.MessageEnum; import org.openecomp.mso.logger.MsoLogger; @@ -48,18 +51,21 @@ import org.openecomp.mso.logger.MsoLogger; */ public class CatalogDatabase implements Closeable { - protected static final String NETWORK_TYPE = "networkType"; - protected static final String ACTION = "action"; - protected static final String VNF_TYPE = "vnfType"; - protected static final String SERVICE_TYPE = "serviceType"; - protected static final String VNF_COMPONENT_TYPE = "vnfComponentType"; - protected static final String MODEL_NAME = "modelName"; - protected static final String TYPE = "type"; - protected static final String VF_MODULE_ID = "vfModuleId"; - protected static boolean initialized = false; - protected static SessionFactory sessionFactory; - protected static ServiceRegistry serviceRegistry; - protected static final String SERVICE_NAME_VERSION_ID= "serviceNameVersionId"; + protected static HibernateUtils hibernateUtils = new HibernateUtilsCatalogDb (); + + private static final String NETWORK_TYPE = "networkType"; + private static final String ACTION = "action"; + private static final String VNF_TYPE = "vnfType"; + private static final String SERVICE_TYPE = "serviceType"; + private static final String VNF_COMPONENT_TYPE = "vnfComponentType"; + private static final String MODEL_ID = "modelId"; + private static final String MODEL_NAME = "modelName"; + private static final String TYPE = "type"; + private static final String MODEL_TYPE = "modelType"; + private static final String MODEL_VERSION_ID = "modelVersionId"; + private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUuid"; + private static final String VF_MODULE_ID = "vfModuleId"; + private static final String SERVICE_NAME_VERSION_ID= "serviceNameVersionId"; protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); @@ -70,33 +76,10 @@ public class CatalogDatabase implements Closeable { private Session getSession () { - if (!initialized) { - LOGGER.debug ("Initializing Catalog Database in Hibernate"); - Configuration configuration = null; - try { - if ("MYSQL".equals (System.getProperty ("mso.db")) - || "MARIADB".equals (System.getProperty ("mso.db"))) { - configuration = new Configuration ().configure ("hibernate-catalog-mysql.cfg.xml"); - - serviceRegistry = new ServiceRegistryBuilder ().applySettings (configuration.getProperties ()).buildServiceRegistry (); - - sessionFactory = configuration.buildSessionFactory (serviceRegistry); - } else { - LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC", "", "", MsoLogger.ErrorCode.DataError, "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC"); - } - } catch (Exception e) { - LOGGER.error (MessageEnum.GENERAL_EXCEPTION_ARG, - "Catalog DB initialization issue: " + e.getMessage (), "", "", MsoLogger.ErrorCode.DataError, "Catalog DB initialization issue: " + e.getMessage (), e); - throw e; - } - initialized = true; - - LOGGER.debug ("Catalog Database initialization complete"); - } - - if (session == null) { + + if (session == null) { try { - session = sessionFactory.openSession (); + session = hibernateUtils.getSessionFactory ().openSession (); session.beginTransaction (); } catch (HibernateException he) { LOGGER.error (MessageEnum.GENERAL_EXCEPTION_ARG, "Error creating Hibernate Session: " + he, "", "", MsoLogger.ErrorCode.DataError, "Error creating Hibernate Session: " + he); @@ -230,6 +213,33 @@ public class CatalogDatabase implements Closeable { return resultList.get (0); } + /** + * Fetch a Service definition by InvariantUUID + */ + public Service getServiceByInvariantUUID (String modelInvariantUUID) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get service with Invariant UUID " + modelInvariantUUID); + + String hql = "FROM Service WHERE modelInvariantUUID = :model_invariant_uuid"; + Query query = getSession ().createQuery (hql); + query.setParameter ("model_invariant_uuid", modelInvariantUUID); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + // See if something came back. + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service not found", "CatalogDB", "getServiceByName", null); + return null; + } + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceByName", null); + return resultList.get (0); + } + /** * Fetch a Service definition */ @@ -388,6 +398,33 @@ public class CatalogDatabase implements Closeable { return resultList.get (0); } + public Service getServiceByVersionAndInvariantId(String modelInvariantId, String modelVersion) throws Exception { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get service with modelInvariantId: " + modelInvariantId + " and modelVersion: " + modelVersion); + + String hql = "FROM Service WHERE modelInvariantUUID = :MODEL_INVARIANT_UUID AND version = :VERSION_STR"; + Query query = getSession ().createQuery (hql); + query.setParameter ("MODEL_INVARIANT_UUID", modelInvariantId); + query.setParameter("VERSION_STR", modelVersion); + + Service result = null; + try { + result = (Service) query.uniqueResult(); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelInvariantId='" + modelInvariantId + "', modelVersion='" + modelVersion + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for modelInvariantId=" + modelInvariantId + " and modelVersion=" + modelVersion, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for modelInvariantId=" + modelInvariantId); + throw new Exception("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelInvariantId='" + modelInvariantId + "', modelVersion='" + modelVersion + "'"); + } + // See if something came back. + if (result==null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service not found", "CatalogDB", "getServiceByVersionAndInvariantId", null); + return null; + } + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceByVersionAndInvariantId", null); + return result; + } + /** * Return a Service recipe that matches a given SERVICE_NAME_VERSION_ID * (MODEL_VERSION_ID) and ACTION @@ -439,10 +476,15 @@ public class CatalogDatabase implements Closeable { * @return ServiceRecipe object or null if none found */ public ServiceRecipe getServiceRecipe (int serviceId, String action) { - - StringBuilder hql = new StringBuilder ("FROM ServiceRecipe WHERE serviceId = :serviceId AND action = :action "); - - + + StringBuilder hql = null; + + if(action == null){ + hql = new StringBuilder ("FROM ServiceRecipe WHERE serviceId = :serviceId"); + }else { + hql = new StringBuilder ("FROM ServiceRecipe WHERE serviceId = :serviceId AND action = :action "); + } + long startTime = System.currentTimeMillis (); LOGGER.debug ("Catalog database - get Service recipe with serviceId " + Integer.toString(serviceId) + " and action " @@ -452,7 +494,10 @@ public class CatalogDatabase implements Closeable { Query query = getSession ().createQuery (hql.toString ()); query.setParameter ("serviceId", serviceId); query.setParameter (ACTION, action); - + if(action != null){ + query.setParameter (ACTION, action); + } + @SuppressWarnings("unchecked") List resultList = query.list (); @@ -468,7 +513,33 @@ public class CatalogDatabase implements Closeable { return resultList.get (0); } - + public List getServiceRecipes (int serviceId) { + + StringBuilder hql = null; + + hql = new StringBuilder ("FROM ServiceRecipe WHERE serviceId = :serviceId"); + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get Service recipe with serviceId " + Integer.toString(serviceId)); + + Query query = getSession ().createQuery (hql.toString ()); + query.setParameter ("serviceId", serviceId); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Service recipe not found", "CatalogDB", "getServiceRecipes", null); + return null; + } + + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getServiceRecipes", null); + return resultList; + } + /** * Return the VNF component data - queried by the VNFs ID and the component type. * @@ -477,10 +548,10 @@ public class CatalogDatabase implements Closeable { * @return VnfComponent object or null if none found */ public VnfComponent getVnfComponent (int vnfId, String type) { - + long startTime = System.currentTimeMillis(); LOGGER.debug ("Catalog database - get VnfComponent where vnfId="+ vnfId+ " AND componentType="+ type); - + String hql = "FROM VnfComponent WHERE vnfId = :vnf_id AND componentType = :type"; Query query = getSession ().createQuery (hql); query.setParameter ("vnf_id", vnfId); @@ -488,7 +559,7 @@ public class CatalogDatabase implements Closeable { VnfComponent result = null; try { - result = (VnfComponent) query.uniqueResult(); + result = (VnfComponent) query.uniqueResult(); } catch (org.hibernate.NonUniqueResultException nure) { LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: vnf_id='" + vnfId + "', componentType='" + type + "'"); LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for vnf_id=" + vnfId + " and componentType=" + type, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for vnf_id=" + vnfId); @@ -583,6 +654,47 @@ public class CatalogDatabase implements Closeable { return resource; } + /** + * Return the newest version of a specific VNF resource (queried by modelCustomizationId). + * + * @param vnfType + * @param version + * @return VnfResource object or null if none found + */ + public VnfResource getVnfResourceByModelCustomizationId (String modelCustomizationId, String serviceVersion) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get VNF resource with modelCustomizationId " + modelCustomizationId); + + String hql = "FROM VnfResource WHERE modelCustomizationUuid = :modelCustomizationId and version = :serviceVersion"; + Query query = getSession ().createQuery (hql); + query.setParameter ("modelCustomizationId", modelCustomizationId); + query.setParameter ("serviceVersion", serviceVersion); + + VnfResource resource = null; + try { + resource = (VnfResource) query.uniqueResult (); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelCustomizationUuid='" + modelCustomizationId + "', serviceVersion='" + serviceVersion + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for modelCustomizationUuid=" + modelCustomizationId + " and serviceVersion=" + serviceVersion, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for modelCustomizationId=" + modelCustomizationId); + resource = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: modelCustomizationId='" + modelCustomizationId + "', asdc_service_model_version='" + serviceVersion + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for modelCustomizationId=" + modelCustomizationId + " and serviceVersion=" + serviceVersion, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for modelCustomizationId=" + modelCustomizationId); + resource = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: modelCustomizationId='" + modelCustomizationId + "', serviceVersion='" + serviceVersion + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for modelCustomizationId=" + modelCustomizationId + " and serviceVersion=" + serviceVersion, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for modelCustomizationId=" + modelCustomizationId); + resource = null; + } + if (resource == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVnfResource", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfResource", null); + } + return resource; + } + /** * Return the newest version of a specific VNF resource (queried by ID). * @@ -791,7 +903,7 @@ public class CatalogDatabase implements Closeable { * Return a VNF recipe that matches a given VF_MODULE_ID and ACTION * * @param vfModuleId - * @param action + * @param action * @return VnfRecipe object or null if none found */ public VnfRecipe getVnfRecipeByVfModuleId (String vnfType, String vfModuleId, String action) { @@ -819,7 +931,39 @@ public class CatalogDatabase implements Closeable { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF Recipe Entry found", "CatalogDB", "getVnfRecipeByVfModuleId", null); return resultList.get (0); } - + + public VfModule getVfModuleTypeByUuid(String modelCustomizationUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get vfModuleTypeByUuid with uuid=" + modelCustomizationUuid); + + String hql = "FROM VfModule WHERE modelCustomizationUuid = :modelCustomizationUuid"; + Query query = getSession().createQuery(hql); + query.setParameter("modelCustomizationUuid", modelCustomizationUuid); + + VfModule module = null; + try { + module = (VfModule) query.uniqueResult(); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelCustomizationUuid='" + modelCustomizationUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for modelCustomizationUuid=" + modelCustomizationUuid, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for modelCustomizationUuid==" + modelCustomizationUuid); + module = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: modelCustomizationUuid='" + modelCustomizationUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for modelCustomizationUuid=" + modelCustomizationUuid, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for modelCustomizationUuid=" + modelCustomizationUuid); + module = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: modelCustomizationUuid='" + modelCustomizationUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for modelCustomizationUuid=" + modelCustomizationUuid, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for modelCustomizationUuid=" + modelCustomizationUuid); + module = null; + } + if (module == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVfModuleTypeByUuid", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleTypeByUuid", null); + } + return module; + } + public VfModule getVfModuleType(String type) { long startTime = System.currentTimeMillis(); LOGGER.debug("Catalog database - get vfModuleType with type " + type); @@ -866,15 +1010,752 @@ public class CatalogDatabase implements Closeable { LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for type=" + type + " and version=" + version, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for type=" + type); module = null; } - if (module == null) { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVfModuleType", null); - } else { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleType", null); + if (module == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVfModuleType", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleType", null); + } + return module; + } + + public VnfResource getVnfResourceByServiceUuid(String serviceModelInvariantUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug ("Catalog database - get vfModuleType with serviceModelInvariantUuid " + serviceModelInvariantUuid); + + String hql = "FROM VnfResource WHERE serviceModelInvariantUuid = :serviceModelInvariantUuid"; + Query query = getSession().createQuery(hql); + query.setParameter ("serviceModelInvariantUuid", serviceModelInvariantUuid); + VnfResource vnfResource = null; + try { + vnfResource = (VnfResource) query.uniqueResult (); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: serviceModelInvariantUuid='" + serviceModelInvariantUuid); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for serviceModelInvariantUuid=" + serviceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for serviceModelInvariantUuid==" + serviceModelInvariantUuid); + vnfResource = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: serviceModelInvariantUuid='" + serviceModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid); + vnfResource = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: serviceModelInvariantUuid='" + serviceModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid); + vnfResource = null; + } + if (vnfResource == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVfModuleType", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleType", null); + } + return vnfResource; + } + + public VnfResource getVnfResourceByVnfUuid(String vnfResourceModelInvariantUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug ("Catalog database - get vfModuleType with vnfResourceModelInvariantUuid " + vnfResourceModelInvariantUuid); + + String hql = "FROM VnfResource WHERE vnfResourceModelInvariantUuid = :vnfResourceModelInvariantUuid"; + Query query = getSession().createQuery(hql); + query.setParameter ("vnfResourceModelInvariantUuid", vnfResourceModelInvariantUuid); + VnfResource vnfResource = null; + try { + vnfResource = (VnfResource) query.uniqueResult (); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: vnfResourceModelInvariantUuid='" + vnfResourceModelInvariantUuid); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for vnfResourceModelInvariantUuid=" + vnfResourceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for vnfResourceModelInvariantUuid==" + vnfResourceModelInvariantUuid); + vnfResource = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: vnfResourceModelInvariantUuid='" + vnfResourceModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for vnfResourceModelInvariantUuid=" + vnfResourceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for vnfResourceModelInvariantUuid=" + vnfResourceModelInvariantUuid); + vnfResource = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: vnfResourceModelInvariantUuid='" + vnfResourceModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for vnfResourceModelInvariantUuid=" + vnfResourceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for vnfResourceModelInvariantUuid=" + vnfResourceModelInvariantUuid); + vnfResource = null; + } + if (vnfResource == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVfModuleType", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleType", null); + } + return vnfResource; + } + + public VnfResource getVnfResourceByType(String vnfType) { + return this.getVnfResource(vnfType); + } + + public VfModule getVfModuleByModelInvariantUuid(String vfModuleModelInvariantUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug ("Catalog database - get vfModuleTypeByUuid with uuid " + vfModuleModelInvariantUuid); + + String hql = "FROM VfModule WHERE vfModuleModelInvariantUuid = :vfModuleModelInvariantUuid "; + Query query = getSession().createQuery(hql); + query.setParameter ("vfModuleModelInvariantUuid", vfModuleModelInvariantUuid); + VfModule module = null; + try { + module = (VfModule) query.uniqueResult (); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: vfModuleModelInvariantUuid='" + vfModuleModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid , "", "", MsoLogger.ErrorCode.DataError, "Non unique result for vfModuleModelInvariantUuid==" + vfModuleModelInvariantUuid); + module = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: vfModuleModelInvariantUuid='" + vfModuleModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid); + module = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: vfModuleModelInvariantUuid='" + vfModuleModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid); + module = null; + } + if (module == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVfModuleByModelInvariantUuid", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleByModelInvariantUuid", null); + } + return module; + } + + public VfModule getVfModuleByModelCustomizationUuid(String modelCustomizationUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug ("Catalog database - get vfModuleTypeByModelCustomizationUuid with uuid " + modelCustomizationUuid); + + String hql = "FROM VfModule WHERE modelCustomizationUuid = :modelCustomizationUuid "; + Query query = getSession().createQuery(hql); + query.setParameter ("modelCustomizationUuid", modelCustomizationUuid); + VfModule module = null; + try { + module = (VfModule) query.uniqueResult (); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: modelCustomizationUuid='" + modelCustomizationUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for vfModuleModelInvariantUuid=" + modelCustomizationUuid , "", "", MsoLogger.ErrorCode.DataError, "Non unique result for modelCustomizationUuid==" + modelCustomizationUuid); + module = null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: modelCustomizationUuid='" + modelCustomizationUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for modelCustomizationUuid=" + modelCustomizationUuid, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for modelCustomizationUuid=" + modelCustomizationUuid); + module = null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: modelCustomizationUuid='" + modelCustomizationUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for modelCustomizationUuid=" + modelCustomizationUuid, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for modelCustomizationUuid=" + modelCustomizationUuid); + module = null; + } + if (module == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getVfModuleByModelCustomizationUuid", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModuleByModelCustomizationUuid", null); + } + return module; + } + + public VfModule getVfModuleByType(String vfModuleType) { + return this.getVfModuleType(vfModuleType); + } + + public List getVfModulesForVnfResource(VnfResource vnfResource) { + if (vnfResource == null) + return null; + int vnfResourceId = vnfResource.getId(); + + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - getVfModulesForVnfResource - vnfResource: " + vnfResource.toString()); + + return this.getVfModulesForVnfResource(vnfResourceId); + + } + + public List getVfModulesForVnfResource(int vnfResourceId) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - getVfModulesForVnfResource - vnfResourceId: " + vnfResourceId); + StringBuilder hql = new StringBuilder("FROM VfModule where vnfResourceId = :vnfResourceId"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("vnfResourceId", vnfResourceId); + List resultList = null; + try { + resultList = query.list(); + if (resultList != null) + LOGGER.debug("\tQuery found " + resultList.size() + " records."); + else + LOGGER.debug("\tQuery found no records."); + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - getVfModulesForVnfResource - while searching for: vnfResourceId='" + vnfResourceId + " " + he.getMessage()); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception - getVfModulesForVnfResource - searching for vnfResourceId=" + vnfResourceId, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for vnfResourceId=" + vnfResourceId); + } catch (Exception e) { + LOGGER.debug("Exception - getVfModulesForVnfResource - while searching for: vnfResourceId='" + vnfResourceId + " " + e.getMessage()); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception - getVfModulesForVnfResource - searching for vnfResourceId=" + vnfResourceId, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for vnfResourceId=" + vnfResourceId); + } + if (resultList == null) { + resultList = new ArrayList(); + } + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVfModulesForVnfResource", null); + return resultList; + } + + public Service getServiceByUuid (String serviceModelInvariantUuid) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get service with ModelInvariantUuid " + serviceModelInvariantUuid); + + String hql = "FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid"; + Query query = getSession ().createQuery (hql); + query.setParameter ("serviceModelInvariantUuid", serviceModelInvariantUuid); + + Service service = null; + try { + service = (Service) query.uniqueResult (); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: serviceModelInvariantUuid='" + serviceModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for serviceModelInvariantUuid=" + serviceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for serviceModelInvariantUuid=" + serviceModelInvariantUuid); + return null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: serviceName='" + serviceModelInvariantUuid + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid); + return null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: serviceModelInvariantUuid='" + serviceModelInvariantUuid); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for serviceModelInvariantUuid=" + serviceModelInvariantUuid); + return null; + } + if (service == null) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "NotFound", "CatalogDB", "getService", null); + } else { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getService", null); + } + + return service; + } + + public NetworkResource getNetworkResourceById(Integer id) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - getNetworkResource with id " + id); + + String hql = "FROM NetworkResource WHERE id = :id"; + Query query = getSession ().createQuery (hql); + query.setParameter ("id", id); + + NetworkResource networkResource = null; + try { + networkResource = (NetworkResource) query.uniqueResult (); + } catch (org.hibernate.NonUniqueResultException nure) { + LOGGER.debug("Non Unique Result Exception - the Catalog Database does not match a unique row - data integrity error: NETWORK_RESOURCE.id='" + id + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " non unique result for NETWORK_RESOURCE.id=" + id, "", "", MsoLogger.ErrorCode.DataError, "Non unique result for NETWORK_RESOURCE.id=" + id); + return null; + } catch (org.hibernate.HibernateException he) { + LOGGER.debug("Hibernate Exception - while searching for: NETWORK_RESOURCE.id='" + id + "'"); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Hibernate exception searching for NETWORK_RESOURCE.id=" + id, "", "", MsoLogger.ErrorCode.DataError, "Hibernate exception searching for NETWORK_RESOURCE.id=" + id); + return null; + } catch (Exception e) { + LOGGER.debug("Generic Exception - while searching for: NETWORK_RESOURCE.id='" + id); + LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for NETWORK_RESOURCE.id=" + id, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for NETWORK_RESOURCE.id=" + id); + return null; + } + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNetworkResourceById", null); + return networkResource; + + } + + // 1702 API Spec - Query for all networks in a Service: + public List getAllNetworksByServiceModelUuid(String serviceModelUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getServiceNetworksByServiceModelUuid - " + serviceModelUuid); + + // This is a 2-step process (3 really) - 1) query ServiceToNetworks, 2) query NetworkResourceCustomization, 3) populate the networkType + + StringBuilder hql1 = new StringBuilder("FROM ServiceToNetworks WHERE serviceModelUuid = :serviceModelUuid"); + Query query = getSession().createQuery(hql1.toString()); + query.setParameter("serviceModelUuid", serviceModelUuid); + @SuppressWarnings("unchecked") + List resultList1 = query.list(); + if (resultList1 == null || resultList1.size() < 1) { + LOGGER.debug("Found no matches to the query - FROM ServiceToNetworks WHERE serviceModelUuid = " + serviceModelUuid); + return null; + } + LOGGER.debug("Found " + resultList1.size() + " entries in ServiceToNetworks with smu=" + serviceModelUuid); + + ArrayList masterList = new ArrayList(); + for (ServiceToNetworks stn : resultList1) { + String networkModelCustomizationUuid = stn.getNetworkModelCustomizationUuid(); + LOGGER.debug("Now searching for NetworkResourceCustomization for " + networkModelCustomizationUuid); + List resultSet = this.getAllNetworksByNetworkModelCustomizationUuid(networkModelCustomizationUuid); + for (NetworkResourceCustomization nrc : resultSet) { + masterList.add(nrc); + } + } + LOGGER.debug("Returning " + masterList.size() + " NRC records"); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllNetworksByServiceModelUuid", null); + return masterList; + + } + public List getAllNetworksByServiceModelInvariantUuid(String serviceModelInvariantUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getServiceNetworksByServiceModelInvariantUuid - " + serviceModelInvariantUuid); + + StringBuilder hql = new StringBuilder("FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + LOGGER.debug("Could not find Service for " + serviceModelInvariantUuid); + return null; + } + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + String serviceNameVersionId = service.getServiceNameVersionId(); + LOGGER.debug("The highest version for the Service " + serviceModelInvariantUuid + " is " + serviceNameVersionId); + + // Service.serviceNameVersionId == ServiceToNetworks.serviceModelUuid + return this.getAllNetworksByServiceModelUuid(serviceNameVersionId); + } + public List getAllNetworksByServiceModelInvariantUuid(String serviceModelInvariantUuid, String serviceModelVersion) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getServiceNetworksByServiceModelInvariantUuid - " + serviceModelInvariantUuid + ", version=" + serviceModelVersion); + + StringBuilder hql = new StringBuilder("FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid and version = :serviceModelVersion"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + query.setParameter("serviceModelVersion", serviceModelVersion); + + //TODO + //can fix this later - no time - could do a unique query here - but this should work + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + LOGGER.debug("No Service found with smu=" + serviceModelInvariantUuid + " and smv=" + serviceModelVersion); + return null; + } + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + String serviceNameVersionId = service.getServiceNameVersionId(); + + // Service.serviceNameVersionId == ServiceToNetworks.serviceModelUuid + return this.getAllNetworksByServiceModelUuid(serviceNameVersionId); + + } + public List getAllNetworksByNetworkModelCustomizationUuid(String networkModelCustomizationUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllNetworksByNetworkModelCustomizationUuid - " + networkModelCustomizationUuid); + + StringBuilder hql = new StringBuilder("FROM NetworkResourceCustomization WHERE modelCustomizationUuid = :networkModelCustomizationUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("networkModelCustomizationUuid", networkModelCustomizationUuid); + + @SuppressWarnings("unchecked") + List resultList = query.list(); + + this.populateNetworkResourceType(resultList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllNetworksByNetworkModelCustomizationUuid", null); + return resultList; + } + public List getAllNetworksByNetworkType(String networkType) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getServiceNetworksByNetworkType - " + networkType); + + NetworkResource nr = this.getNetworkResource(networkType); + if (nr == null) { + return new ArrayList(); + } + Integer networkResourceId = nr.getId(); + + LOGGER.debug("Now searching for NRC's with networkResourceId = " + networkResourceId); + StringBuilder hql = new StringBuilder("FROM NetworkResourceCustomization WHERE networkResourceId = :networkResourceId"); + + Query query = getSession().createQuery(hql.toString()); + query.setParameter("networkResourceId", networkResourceId); + + @SuppressWarnings("unchecked") + List resultList = query.list(); + + if (resultList != null && resultList.size() > 0) { + LOGGER.debug("Found " + resultList.size() + " results"); + for (NetworkResourceCustomization nrc : resultList) { + nrc.setNetworkType(networkType); + nrc.setNetworkResource(nr); + } + } + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllNetworksByNetworkType", null); + + return resultList; + } + + //1702 API Spec cont'd - Query for all VnfResources in a Service: + public List getAllVnfsByServiceModelUuid(String serviceModelUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllVnfsByServiceModelUuid - " + serviceModelUuid); + + StringBuilder hql = new StringBuilder("FROM Service WHERE serviceNameVersionId = :serviceModelUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelUuid", serviceModelUuid); + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + return null; + } + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + String serviceModelInvariantUuid = service.getModelInvariantUUID(); + String serviceModelVersion = service.getVersion(); + + return this.getAllVnfsByServiceModelInvariantUuid(serviceModelInvariantUuid, serviceModelVersion); + + } + public List getAllVnfsByServiceModelInvariantUuid(String serviceModelInvariantUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllVnfsByServiceModelInvariantUuid - " + serviceModelInvariantUuid); + + StringBuilder hqlService = new StringBuilder("FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid"); + Query query = getSession().createQuery(hqlService.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + @SuppressWarnings("unchecked") + List resultList = query.list(); + + if (resultList.isEmpty()) { + return null; + } + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + Service service = resultList.get(0); + //now just call the method that takes the version - the service object will have the highest version + return this.getAllVnfsByServiceModelInvariantUuid(serviceModelInvariantUuid, service.getVersion()); + } + public List getAllVnfsByServiceModelInvariantUuid(String serviceModelInvariantUuid, String serviceModelVersion) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllVnfsByServiceModelInvariantUuid - " + serviceModelInvariantUuid + ", version=" + serviceModelVersion); + + StringBuilder hql = new StringBuilder("FROM VnfResource WHERE serviceModelInvariantUUID = :serviceModelInvariantUuid and version = :serviceModelVersion"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + query.setParameter("serviceModelVersion", serviceModelVersion); + + @SuppressWarnings("unchecked") + List resultList = query.list(); + + if (resultList.isEmpty()) { + return null; + } + // so we have a list of VnfResource objects - but we need to add each one's VfModule objects + for (VnfResource vnfResource : resultList) { + List vfModules = this.getVfModulesForVnfResource(vnfResource); + if (vfModules != null && !vfModules.isEmpty()) { + for (VfModule vfm : vfModules) { + vnfResource.addVfModule(vfm); + } + } + } + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllVnfsByServiceModelInvariantUuid", null); + return resultList; + + } + public List getAllVnfsByServiceName(String serviceName, String serviceVersion) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllVnfsByServiceName - " + serviceName + ", version=" + serviceVersion); + if (serviceVersion == null || serviceVersion.equals("")) { + return this.getAllVnfsByServiceName(serviceName); + } + + StringBuilder hql = new StringBuilder("FROM Service WHERE serviceName = :serviceName and version = :serviceVersion"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceName", serviceName); + query.setParameter("serviceVersion", serviceVersion); + + @SuppressWarnings("unchecked") + List resultList = query.list(); + + if (resultList.isEmpty()) { + return null; + } + + Service service = resultList.get(0); + + return this.getAllVnfsByServiceModelInvariantUuid(service.getModelInvariantUUID(), service.getVersion()); + } + public List getAllVnfsByServiceName(String serviceName) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllVnfsByServiceName - " + serviceName); + + StringBuilder hql = new StringBuilder("FROM Service WHERE serviceName = :serviceName"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceName", serviceName); + + @SuppressWarnings("unchecked") + List resultList = query.list(); + + if (resultList.isEmpty()) { + return null; + } + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + Service service = resultList.get(0); + + return this.getAllVnfsByServiceModelInvariantUuid(service.getModelInvariantUUID(), service.getVersion()); + } + public List getAllVnfsByVnfModelCustomizationUuid(String vnfModelCustomizationUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllVnfsByVnfModelCustomizationUuid - " + vnfModelCustomizationUuid); + + StringBuilder hql = new StringBuilder("FROM VnfResource WHERE modelCustomizationUuid = :vnfModelCustomizationUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("vnfModelCustomizationUuid", vnfModelCustomizationUuid); + + @SuppressWarnings("unchecked") + List resultList = query.list(); + + if (resultList.isEmpty()) { + LOGGER.debug("Found no records matching " + vnfModelCustomizationUuid); + return null; + } + // so we have a list of VnfResource objects - but we need to add each one's VfModule objects + for (VnfResource vnfResource : resultList) { + LOGGER.debug("Finding vfModules for vnfResource.id=" + vnfResource.getId()); + List vfModules = this.getVfModulesForVnfResource(vnfResource); + if (vfModules != null && !vfModules.isEmpty()) { + LOGGER.debug("\tFound " + vfModules.size() + " vf modules"); + for (VfModule vfm : vfModules) { + vnfResource.addVfModule(vfm); + } + } + } + LOGGER.debug("Returning " + resultList + " vnf modules"); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllVnfsByVnfModelCustomizationUuid", null); + return resultList; + } + + //1702 API Spec cont'd - Query for all allotted resources in a Service + + public List getAllAllottedResourcesByServiceModelUuid(String serviceModelUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllAllottedResourcesByServiceModelUuid - " + serviceModelUuid); + + // This is a 2-step process (3 really) - 1) query ServiceToAllottedResources, 2) query AllottedResourceCustomization + + StringBuilder hql1 = new StringBuilder("FROM ServiceToAllottedResources WHERE serviceModelUuid = :serviceModelUuid"); + Query query = getSession().createQuery(hql1.toString()); + query.setParameter("serviceModelUuid", serviceModelUuid); + @SuppressWarnings("unchecked") + List resultList1 = query.list(); + if (resultList1 == null || resultList1.size() < 1) { + LOGGER.debug("Found no matches to the query " + hql1.toString()); + return null; + } + LOGGER.debug("Found " + resultList1.size() + " entries in ServiceToAllottedResources with smu=" + serviceModelUuid); + + ArrayList masterList = new ArrayList(); + for (ServiceToAllottedResources star : resultList1) { + String arModelCustomizationUuid = star.getArModelCustomizationUuid(); + LOGGER.debug("Now searching for AllottedResourceCustomization for " + arModelCustomizationUuid); + List resultSet = this.getAllAllottedResourcesByArModelCustomizationUuid(arModelCustomizationUuid); + for (AllottedResourceCustomization arc : resultSet) { + masterList.add(arc); + } + } + LOGGER.debug("Returning " + masterList.size() + " ARC records"); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllAllottedResourcesByServiceModelUuid", null); + return masterList; + } + + public List getAllAllottedResourcesByServiceModelInvariantUuid(String serviceModelInvariantUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllAllottedResourcesByServiceModelInvariantUuid - " + serviceModelInvariantUuid); + + StringBuilder hql = new StringBuilder("FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + LOGGER.debug("Could not find Service for " + serviceModelInvariantUuid); + return null; + } + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + String serviceNameVersionId = service.getServiceNameVersionId(); + LOGGER.debug("The highest version for the Service " + serviceModelInvariantUuid + " is " + serviceNameVersionId); + + // Service.serviceNameVersionId == ServiceToAllottedResources.serviceModelUuid + return this.getAllAllottedResourcesByServiceModelUuid(serviceNameVersionId); + } + + public List getAllAllottedResourcesByServiceModelInvariantUuid(String serviceModelInvariantUuid, String serviceModelVersion) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllAllottedResourcesByServiceModelInvariantUuid - " + serviceModelInvariantUuid + ", version=" + serviceModelVersion); + + StringBuilder hql = new StringBuilder("FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid and version = :serviceModelVersion"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + query.setParameter("serviceModelVersion", serviceModelVersion); + + //TODO + //can fix this later - no time - could do a unique query here - but this should work + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + LOGGER.debug("No Service found with smu=" + serviceModelInvariantUuid + " and smv=" + serviceModelVersion); + return null; + } + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + String serviceNameVersionId = service.getServiceNameVersionId(); + + // Service.serviceNameVersionId == ServiceToNetworks.serviceModelUuid + return this.getAllAllottedResourcesByServiceModelUuid(serviceNameVersionId); + } + + public List getAllAllottedResourcesByArModelCustomizationUuid(String arModelCustomizationUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllAllottedResourcesByArModelCustomizationUuid - " + arModelCustomizationUuid); + + StringBuilder hql = new StringBuilder("FROM AllottedResourceCustomization WHERE modelCustomizationUuid = :arModelCustomizationUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("arModelCustomizationUuid", arModelCustomizationUuid); + + @SuppressWarnings("unchecked") + List resultList = query.list(); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllAllottedResourcesByArModelCustomizationUuid", null); + return resultList; + } + + //1702 API Spec cont'd - Query for all resources in a Service: + public ServiceMacroHolder getAllResourcesByServiceModelUuid(String serviceModelUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllResourcesByServiceModelUuid - " + serviceModelUuid); + + StringBuilder hql = new StringBuilder("FROM Service WHERE serviceNameVersionId = :serviceModelUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelUuid", serviceModelUuid); + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + LOGGER.debug("Unable to find a Service with serviceModelUuid=" + serviceModelUuid); + return null; + } + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + ServiceMacroHolder smh = new ServiceMacroHolder(service); + ArrayList nrcList = (ArrayList) this.getAllNetworksByServiceModelUuid(serviceModelUuid); + smh.setNetworkResourceCustomization(nrcList); + ArrayList arcList = (ArrayList) this.getAllAllottedResourcesByServiceModelUuid(serviceModelUuid); + smh.setAllottedResourceCustomization(arcList); + ArrayList vnfList = (ArrayList) this.getAllVnfsByServiceModelInvariantUuid(service.getModelInvariantUUID(), service.getVersion()); + smh.setVnfResources(vnfList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllResourcesByServiceModelUuid", null); + return smh; + } + public ServiceMacroHolder getAllResourcesByServiceModelInvariantUuid(String serviceModelInvariantUuid) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllResourcesByServiceModelInvariantUuid - " + serviceModelInvariantUuid); + + StringBuilder hql = new StringBuilder("FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + LOGGER.debug("Unable to find a Service with serviceModelInvariantUuid=" + serviceModelInvariantUuid); + return null; + } + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + ServiceMacroHolder smh = new ServiceMacroHolder(service); + ArrayList nrcList = (ArrayList) this.getAllNetworksByServiceModelUuid(service.getServiceNameVersionId()); + smh.setNetworkResourceCustomization(nrcList); + ArrayList arcList = (ArrayList) this.getAllAllottedResourcesByServiceModelUuid(service.getServiceNameVersionId()); + smh.setAllottedResourceCustomization(arcList); + ArrayList vnfList = (ArrayList) this.getAllVnfsByServiceModelInvariantUuid(service.getModelInvariantUUID(), service.getVersion()); + smh.setVnfResources(vnfList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllResourcesByServiceModelInvariantUuid", null); + return smh; + + } + public ServiceMacroHolder getAllResourcesByServiceModelInvariantUuid(String serviceModelInvariantUuid, String serviceModelVersion) { + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database: getAllResourcesByServiceModelInvariantUuid - " + serviceModelInvariantUuid + ", version=" + serviceModelVersion); + + StringBuilder hql = new StringBuilder("FROM Service WHERE modelInvariantUUID = :serviceModelInvariantUuid and version = :serviceModelVersion"); + Query query = getSession().createQuery(hql.toString()); + query.setParameter("serviceModelInvariantUuid", serviceModelInvariantUuid); + query.setParameter("serviceModelVersion", serviceModelVersion); + //TODO make this a unique query + @SuppressWarnings("unchecked") + List serviceList = query.list(); + + if (serviceList.isEmpty()) { + LOGGER.debug("Unable to find a Service with serviceModelInvariantUuid=" + serviceModelInvariantUuid + " and serviceModelVersion=" + serviceModelVersion); + return null; } - return module; + + Collections.sort (serviceList, new MavenLikeVersioningComparator ()); + Collections.reverse (serviceList); + Service service = serviceList.get(0); + + ServiceMacroHolder smh = new ServiceMacroHolder(service); + ArrayList nrcList = (ArrayList) this.getAllNetworksByServiceModelUuid(service.getServiceNameVersionId()); + smh.setNetworkResourceCustomization(nrcList); + ArrayList arcList = (ArrayList) this.getAllAllottedResourcesByServiceModelUuid(service.getServiceNameVersionId()); + smh.setAllottedResourceCustomization(arcList); + ArrayList vnfList = (ArrayList) this.getAllVnfsByServiceModelInvariantUuid(service.getModelInvariantUUID(), service.getVersion()); + smh.setVnfResources(vnfList); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getAllResourcesByServiceModelUuid with version", null); + return smh; } - - + + private void populateNetworkResourceType(List resultList) { + HashMap networkResources = new HashMap(); + + for (NetworkResourceCustomization nrc : resultList) { + Integer network_id = nrc.getNetworkResourceId(); + if (network_id == null) { + nrc.setNetworkResource(null); + nrc.setNetworkType("UNKNOWN_NETWORK_ID_NULL"); + continue; + } + if (networkResources.containsKey(network_id)) { + nrc.setNetworkResource(networkResources.get(network_id)); + nrc.setNetworkType(networkResources.get(network_id).getNetworkType()); + } else { + NetworkResource nr = this.getNetworkResourceById(network_id); + if (nr == null) { + nrc.setNetworkType("INVALID_NETWORK_TYPE_ID_NOT_FOUND"); + } else { + nrc.setNetworkType(nr.getNetworkType()); + nrc.setNetworkResource(nr); + networkResources.put(network_id, nr); + } + } + } + } + /** * Return a VNF recipe that matches a given VNF_TYPE, VF_MODULE_MODEL_NAME, and ACTION * first query VF_MODULE table by type, and then use the ID to query @@ -936,33 +1817,116 @@ public class CatalogDatabase implements Closeable { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe found", "CatalogDB", "getVfModuleRecipe", null); return resultList1.get (0); } - + /** - * Return a VNF COMPONENTSrecipe that matches a given VNF_TYPE, VF_MODULE_MODEL_NAME, + * Return a VNF Module List that matches a given VNF_TYPE, VF_MODULE_MODEL_NAME, * ASDC_SERVICE_MODEL_VERSION, MODEL_VERSION, and ACTION - * first query VF_MODULE table by type, and then use the ID to query - * VNF_COMPONENTS_RECIPE by VF_MODULE_ID and ACTION + * + * @param vnfModuleType + * @parm modelCustomizationUuid + * @param asdcServiceModelVersion + * @param modelVersion + * @param action + * @return VfModule list + */ + public List getVfModule (String vfModuleType, String modelCustomizationUuid, String asdcServiceModelVersion, String modelVersion, String action) { + StringBuilder hql; + Query query; + if(modelCustomizationUuid != null){ + hql = new StringBuilder ("FROM VfModule WHERE modelCustomizationUuid = :modelCustomizationUuid AND version = :version"); + + LOGGER.debug ("Catalog database - get VF MODULE with type " + vfModuleType + ", asdcServiceModelVersion " + asdcServiceModelVersion + ", modelVersion " + modelVersion); + + query = getSession ().createQuery (hql.toString ()); + query.setParameter ("modelCustomizationUuid", modelCustomizationUuid); + query.setParameter ("version", asdcServiceModelVersion); + }else{ + hql = new StringBuilder ("FROM VfModule WHERE type = :type AND version = :version AND modelVersion = :modelVersion"); + + LOGGER.debug ("Catalog database - get VF MODULE with type " + vfModuleType + ", asdcServiceModelVersion " + asdcServiceModelVersion + ", modelVersion " + modelVersion); + + query = getSession ().createQuery (hql.toString ()); + query.setParameter (TYPE, vfModuleType); + query.setParameter ("version", asdcServiceModelVersion); + query.setParameter ("modelVersion", modelVersion); + } + + @SuppressWarnings("unchecked") + List resultList = query.list (); + return resultList; + } + + /** + * Return a VNF COMPONENTSrecipe that matches a given VNF_TYPE, VF_MODULE_MODEL_NAME, + * ASDC_SERVICE_MODEL_VERSION, MODEL_VERSION, and ACTION + * first query VF_MODULE table by type, and then use the ID to query + * VNF_COMPONENTS_RECIPE by VF_MODULE_ID and ACTION * * @param vnfType * @parm vfModuleModelName - * @param action + * @param action * @return VnfRecipe object or null if none found */ - public VnfComponentsRecipe getVnfComponentsRecipe (String vnfType, String vfModuleModelName, String asdcServiceModelVersion, String modelVersion, String action) { - String vfModuleType = vnfType + "::" + vfModuleModelName; - - StringBuilder hql = new StringBuilder ("FROM VfModule WHERE type = :type AND version = :version AND modelVersion = :modelVersion"); - + public VnfComponentsRecipe getVnfComponentsRecipe (String vnfType, String vfModuleModelName, String modelCustomizationUuid, String asdcServiceModelVersion, String modelVersion, String action) { + String vfModuleType = vnfType + "::" + vfModuleModelName; long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - get VF MODULE with type " + vfModuleType + ", asdcServiceModelVersion " + asdcServiceModelVersion + ", modelVersion " + modelVersion); - - Query query = getSession ().createQuery (hql.toString ()); - query.setParameter (TYPE, vfModuleType); - query.setParameter ("version", asdcServiceModelVersion); - query.setParameter ("modelVersion", modelVersion); - + List resultList = getVfModule(vfModuleType, modelCustomizationUuid, asdcServiceModelVersion, modelVersion, action); + + if (resultList.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VF Module Entry not found", "CatalogDB", "getVnfComponentsRecipe", null); + return null; + } + + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + VfModule vfMod = resultList.get(0); + + int id = vfMod.getId(); + String vfModuleId = Integer.toString(id); + + StringBuilder hql1 = new StringBuilder ("FROM VnfComponentsRecipe WHERE vfModuleId = :vfModuleId AND action = :action "); + + LOGGER.debug ("Catalog database - get Vnf Components recipe with vf module id " + vfModuleId + + " and action " + + action); + + Query query1 = getSession ().createQuery (hql1.toString ()); + query1.setParameter (VF_MODULE_ID, vfModuleId); + query1.setParameter (ACTION, action); + @SuppressWarnings("unchecked") - List resultList = query.list (); + List resultList1 = query1.list (); + + if (resultList1.isEmpty ()) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", "getVnfComponentsRecipe", null); + return null; + } + + Collections.sort (resultList1, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList1); + + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe found", "CatalogDB", "getVnfComponentsRecipe", null); + if (resultList1.size() > 1 && (!resultList1. get (0).getOrchestrationUri().equals(resultList1.get (1).getOrchestrationUri ()))) { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Different ORCHESTRATION URIs found for same VERSION and ID. No result returned.", "CatalogDB", "getVnfComponentsRecipe", null); + return null; + } + return resultList1.get (0); + } + + /** + * Return a VNF COMPONENTSrecipe that matches a given VNF_TYPE, VF_MODULE_MODEL_NAME, + * ASDC_SERVICE_MODEL_VERSION, MODEL_VERSION, and ACTION + * first query VF_MODULE table by type, and then use the ID to query + * VNF_COMPONENTS_RECIPE by VF_MODULE_ID and ACTION + * + * @param vnfType + * @parm vfModuleModelName + * @param action + * @return VnfRecipe object or null if none found + */ + public VnfComponentsRecipe getVnfComponentsRecipeByVfModule(List resultList, String action) { + long startTime = System.currentTimeMillis (); if (resultList.isEmpty ()) { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VF Module Entry not found", "CatalogDB", "getVnfComponentsRecipe", null); @@ -1000,8 +1964,8 @@ public class CatalogDatabase implements Closeable { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe found", "CatalogDB", "getVnfComponentsRecipe", null); if (resultList1.size() > 1 && (!resultList1. get (0).getOrchestrationUri().equals(resultList1.get (1).getOrchestrationUri ()))) { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Different ORCHESTRATION URIs found for same VERSION and ID. No result returned.", "CatalogDB", "getVnfComponentsRecipe", null); - return null; + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. Different ORCHESTRATION URIs found for same VERSION and ID. No result returned.", "CatalogDB", "getVnfComponentsRecipe", null); + return null; } return resultList1.get (0); } @@ -1472,21 +2436,116 @@ public class CatalogDatabase implements Closeable { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateVnfResource", null); } } - + + public void saveAllottedResourceCustomization (AllottedResourceCustomization resourceCustomization) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save Allotted Resource with Name " + resourceCustomization.getModelName()); + try { + List allottedResourcesList = getAllAllottedResourcesByArModelCustomizationUuid(resourceCustomization.getModelCustomizationUuid()); + + if(allottedResourcesList.size() == 0){ + this.getSession ().save(resourceCustomization); + } + + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateAllottedResourceCustomization", null); + } + } + + public void saveNetworkResourceCustomization (NetworkResourceCustomization networkResourceCustomization) throws RecordNotFoundException { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save Network Resource Customization with Network Name " + networkResourceCustomization.getModelName()); + try { + // Check if NetworkResourceCustomzation record already exists. If so, skip saving it. + List networkResourceCustomizationList = getAllNetworksByNetworkModelCustomizationUuid(networkResourceCustomization.getModelCustomizationUuid()); + // Do any matching customization records exist? + if(networkResourceCustomizationList.size() == 0){ + + // Retreive the record from the Network_Resource table associated to the Customization record based on ModelName + NetworkResource networkResource = getNetworkResource(networkResourceCustomization.getModelName()); + + if(networkResource == null){ + throw new RecordNotFoundException("No record found in NETWORK_RESOURCE table for model name " + networkResourceCustomization.getModelName()); + } + + networkResourceCustomization.setNetworkResourceId(networkResource.getId()); + + this.getSession ().save(networkResourceCustomization); + } + + + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveNetworkResourceCustomization", null); + } + } + + public void saveServiceToNetworks (ServiceToNetworks serviceToNetworks) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save to ServiceToNetworks table with NetworkModelCustomizationUUID of " + serviceToNetworks.getNetworkModelCustomizationUuid() + " and ServiceModelUUID of " + serviceToNetworks.getServiceModelUuid()); + try { + this.getSession ().save(serviceToNetworks); + + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveNetworkResourceCustomization", null); + } + } + + public void saveServiceToAllottedResources (ServiceToAllottedResources serviceToAllottedResources) { + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - save to serviceToAllottedResources table with ARModelCustomizationUUID of " + serviceToAllottedResources.getArModelCustomizationUuid() + " and ServiceModelUUID of " + serviceToAllottedResources.getServiceModelUuid()); + try { + this.getSession ().save(serviceToAllottedResources); + + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveServiceToAllottedResources", null); + } + } + public void saveService (Service service) { long startTime = System.currentTimeMillis (); - LOGGER.debug ("Catalog database - save Service with ServiceName/Version/serviceUUID(SERVICE_NAME_VERSION_ID)" + service.getServiceName()+"/"+service.getServiceVersion()+"/"+service.getServiceNameVersionId()); + LOGGER.debug ("Catalog database - save Service with ServiceName/Version/serviceUUID(SERVICE_NAME_VERSION_ID)" + service.getServiceName()+"/"+service.getVersion()+"/"+service.getServiceNameVersionId()); try { - Service serviceDB = this.getServiceByUUID(service.getServiceNameVersionId()); + Service serviceInvariantDB = null; + // Retrieve existing service record by nameVersionId + Service serviceDB = this.getServiceByUUID(service.getServiceNameVersionId()); if (serviceDB == null) { - this.getSession ().save (service); + // Check to see if a record with the same modelInvariantId already exists. This tells us that a previous version exists and we can copy its recipe Record for the new service record. + serviceInvariantDB = this.getServiceByInvariantUUID(service.getModelInvariantUUID()); + // Save the new Service record + this.getSession ().save (service); } - + + if(serviceInvariantDB != null){ // existing modelInvariantId was found. + // copy the recipe record with the matching invariant id. We will duplicate this for the new service record + List serviceRecipes = getServiceRecipes(serviceInvariantDB.getId()); + + if(serviceRecipes != null && serviceRecipes.size() > 0){ + for(ServiceRecipe serviceRecipe : serviceRecipes){ + if(serviceRecipe != null){ + // Fetch the service record that we just added. We do this so we can extract its Id column value, this will be the foreign key we use in the service recipe table. + Service newService = this.getServiceByUUID(service.getServiceNameVersionId()); + // Create a new ServiceRecipe record based on the existing one we just copied from the DB. + ServiceRecipe newServiceRecipe = new ServiceRecipe(); + newServiceRecipe.setAction(serviceRecipe.getAction()); + newServiceRecipe.setDescription(serviceRecipe.getDescription()); + newServiceRecipe.setOrchestrationUri(serviceRecipe.getOrchestrationUri()); + newServiceRecipe.setRecipeTimeout(serviceRecipe.getRecipeTimeout()); + newServiceRecipe.setServiceParamXSD(serviceRecipe.getServiceParamXSD()); + newServiceRecipe.setServiceId(newService.getId()); + newServiceRecipe.setVersion(serviceRecipe.getVersion()); + // Save the new recipe record in the service_recipe table and associate it to the new service record that we just added. + this.getSession ().save (newServiceRecipe); + } + } + } + + } + } finally { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateService", null); } } - + public void saveOrUpdateVfModule (VfModule vfModule) { long startTime = System.currentTimeMillis (); LOGGER.debug ("Catalog database - save VNF Module with VF Model Name " + vfModule.getModelName()); @@ -1497,9 +2556,9 @@ public class CatalogDatabase implements Closeable { } else { this.getSession ().save (vfModule); } - + } finally { - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateVfModule", null); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveOrUpdateVfModule", null); } } @@ -1511,21 +2570,21 @@ public class CatalogDatabase implements Closeable { HeatNestedTemplate nestedTemplate = new HeatNestedTemplate (); nestedTemplate.setParentTemplateId (parentTemplateId); nestedTemplate.setChildTemplateId (childTemplateId); - + return (HeatNestedTemplate)session.get (HeatNestedTemplate.class,nestedTemplate); } finally { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNestedHeatTemplate", null); } } - + public void saveNestedHeatTemplate (int parentTemplateId, HeatTemplate childTemplate, String yamlFile) { long startTime = System.currentTimeMillis (); LOGGER.debug ("Catalog database - save nested Heat template with name " + childTemplate.getTemplateName ()); try { - + saveHeatTemplate(childTemplate, childTemplate.getParameters()); - if (getNestedHeatTemplate(parentTemplateId,childTemplate.getId()) == null) { + if (getNestedHeatTemplate(parentTemplateId,childTemplate.getId()) == null) { HeatNestedTemplate nestedTemplate = new HeatNestedTemplate (); nestedTemplate.setParentTemplateId (parentTemplateId); nestedTemplate.setChildTemplateId (childTemplate.getId ()); @@ -1536,7 +2595,7 @@ public class CatalogDatabase implements Closeable { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveNestedHeatTemplate", null); } } - + public HeatFiles getHeatFiles(int vnfResourceId,String fileName,String asdcResourceName, String version) { long startTime = System.currentTimeMillis (); LOGGER.debug ("Catalog database - getHeatFiles with name " + fileName @@ -1571,8 +2630,8 @@ public class CatalogDatabase implements Closeable { LOGGER.debug("Generic Exception - while searching for: fileName='" + fileName + "', vnfResourceId='" + vnfResourceId + "' and asdcResourceName=" + asdcResourceName + " and version=" + version); LOGGER.error(MessageEnum.GENERAL_EXCEPTION, " Generic exception searching for fileName=" + fileName + " and vnfResourceId=" + vnfResourceId + " and asdcResourceName=" + asdcResourceName + " and version=" + version, "", "", MsoLogger.ErrorCode.DataError, "Generic exception searching for fileName=" + fileName); heatFilesResult = null; - } - + } + // See if something came back. if (heatFilesResult == null) { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. HeatFiles not found", "CatalogDB", "getHeatFiles", null); @@ -1582,7 +2641,7 @@ public class CatalogDatabase implements Closeable { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getHeatFiles", null); return heatFilesResult; } - + public void saveHeatFiles (HeatFiles childFile) { long startTime = System.currentTimeMillis (); LOGGER.debug ("Catalog database - save Heat File with name " @@ -1593,7 +2652,7 @@ public class CatalogDatabase implements Closeable { // asdc_heat_files_save this.getSession ().save (childFile); - + } else { /* replaced 'heatFiles' by 'childFile' Based on following comment: @@ -1606,7 +2665,7 @@ public class CatalogDatabase implements Closeable { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveHeatFiles", null); } } - + public void saveVfModuleToHeatFiles (int parentVfModuleId, HeatFiles childFile) { long startTime = System.currentTimeMillis (); LOGGER.debug ("Catalog database - save Heat File to VFmodule link " @@ -1616,14 +2675,14 @@ public class CatalogDatabase implements Closeable { VfModuleToHeatFiles vfModuleToHeatFile = new VfModuleToHeatFiles (); vfModuleToHeatFile.setVfModuleId(parentVfModuleId); vfModuleToHeatFile.setHeatFilesId(childFile.getId()); - + session.save (vfModuleToHeatFile); - + } finally { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "saveVfModuleToHeatFiles", null); } } - + /** * Return a Network recipe that matches a given NETWORK_TYPE, ACTION, and, if specified, SERVICE_TYPE @@ -1662,21 +2721,21 @@ public class CatalogDatabase implements Closeable { if (resultList.isEmpty ()) { return null; } - + Collections.sort (resultList, new MavenLikeVersioningComparator ()); Collections.reverse (resultList); - + return resultList.get (0); } finally { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNetworkRecipe", null); } } - + /** * Return a Network recipe that matches a given NETWORK_TYPE and ACTION * * @param networkType - * @param action + * @param action * @return NetworkRecipe object or null if none found */ public NetworkRecipe getNetworkRecipe (String networkType, String action) { @@ -1689,27 +2748,61 @@ public class CatalogDatabase implements Closeable { try { String hql = "FROM NetworkRecipe WHERE networkType = :networkType AND action = :action"; - + Query query = getSession ().createQuery (hql); query.setParameter (NETWORK_TYPE, networkType); query.setParameter (ACTION, action); - + @SuppressWarnings("unchecked") List resultList = query.list (); if (resultList.isEmpty ()) { return null; } - + Collections.sort (resultList, new MavenLikeVersioningComparator ()); Collections.reverse (resultList); - + return resultList.get (0); } finally { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNetworkRecipe", null); } } + /** + * Return a Network Resource that matches the Network Customization defined by given MODEL_CUSTOMIZATION_UUID + * + * @param networkType + * @param action + * @param serviceType + * @return NetworkRecipe object or null if none found + */ + public NetworkResource getNetworkResourceByModelCustUuid(String modelCustomizationUuid) { + + long startTime = System.currentTimeMillis (); + LOGGER.debug ("Catalog database - get network resource with modelCustomizationUuid " + modelCustomizationUuid); + + try { + String hql = "select n FROM NetworkResource n, NetworkResourceCustomization c WHERE n.id=c.networkResourceId and c.modelCustomizationUuid = :modelCustomizationUuid"; + Query query = getSession ().createQuery (hql); + query.setParameter (MODEL_CUSTOMIZATION_UUID, modelCustomizationUuid); + + @SuppressWarnings("unchecked") + List resultList = query.list (); + + if (resultList.isEmpty ()) { + return null; + } + + Collections.sort (resultList, new MavenLikeVersioningComparator ()); + Collections.reverse (resultList); + + return resultList.get (0); + } finally { + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getNetworkResourceBySvcNtwkRsrc", null); + } + } + /** * Return a VnfComponents recipe that matches a given VNF_TYPE, VNF_COMPONENT_TYPE, ACTION, and, if specified, * SERVICE_TYPE @@ -1757,24 +2850,24 @@ public class CatalogDatabase implements Closeable { } Collections.sort (resultList, new MavenLikeVersioningComparator ()); Collections.reverse (resultList); - + return resultList.get (0); } finally { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfComponentsRecipe", null); } } - + /** * Return a VnfComponents recipe that matches a given VF_MODULE_ID, VNF_COMPONENT_TYPE, ACTION * * @param vfModuleId * @param vnfComponentType - * @param action + * @param action * @return VnfComponentsRecipe object or null if none found */ public VnfComponentsRecipe getVnfComponentsRecipeByVfModuleId (String vfModuleId, String vnfComponentType, - String action) { + String action) { long startTime = System.currentTimeMillis (); LOGGER.debug ("Catalog database - get Vnf Component recipe with vfModuleId " + vfModuleId @@ -1786,12 +2879,12 @@ public class CatalogDatabase implements Closeable { try { String hql; hql = "FROM VnfComponentsRecipe WHERE vfModuleId = :vfModuleId AND vnfComponentType = :vnfComponentType AND action = :action "; - + Query query = getSession ().createQuery (hql); query.setParameter (VF_MODULE_ID, vfModuleId); query.setParameter (VNF_COMPONENT_TYPE, vnfComponentType); query.setParameter (ACTION, action); - + @SuppressWarnings("unchecked") List resultList = query.list (); @@ -1800,7 +2893,7 @@ public class CatalogDatabase implements Closeable { } Collections.sort (resultList, new MavenLikeVersioningComparator ()); Collections.reverse (resultList); - + return resultList.get (0); } finally { LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfComponentsRecipeByVfModuleId", null); @@ -1863,6 +2956,71 @@ public class CatalogDatabase implements Closeable { } } + /** + * Return a Model recipe that matches a given MODEL_TYPE, MODEL_VERSION_ID, ACTION + * Note: This method is not currently used but was retained in the event the + * architecture moves back to a MODEL/MODEL_RECIPE structure. + * + * @param modelType + * @param modelVersionId + * @param action + * @return ModelRecipe object or null if none found + */ + public ModelRecipe getModelRecipe(String modelType, + String modelVersionId, + String action) { + + long startTime = System.currentTimeMillis(); + LOGGER.debug("Catalog database - get Model recipe with modelType=" + modelType + + " and modeVersionId=" + modelVersionId + + " and action=" + action); + + try { + String hql; + // TBD - at some point it would be desirable to figure out how to do a HQL JOIN across + // the MODEL and MODEL_RECIPE tables in HQL instead of 2 separate queries. + // There seems to be 2 issues: formatting a hql query that executes successfully + // and then being able to generate a result that will fit into the ModelRecipe class. + + // 1st query to get the Model record for the given MODEL_TYPE and MODEL_VERSION_ID + hql = "FROM Model WHERE modelType = :modelType AND modelVersionId = :modelVersionId"; + Query query = getSession().createQuery(hql); + query.setParameter(MODEL_TYPE, modelType); + query.setParameter(MODEL_VERSION_ID, modelVersionId); + + @SuppressWarnings("unchecked") + List modelResultList = query.list(); + if (modelResultList.isEmpty()) { + LOGGER.debug("Catalog database - modelResultList is null"); + return null; + } + Collections.sort(modelResultList, new MavenLikeVersioningComparator()); + Collections.reverse(modelResultList); + LOGGER.debug("Catalog database - modelResultList contains " + modelResultList.get(0).toString()); + + // 2nd query to get the ModelRecipe record corresponding to the Model from the 1st query + hql = "FROM ModelRecipe WHERE modelId = :modelId AND action = :action"; + query = getSession().createQuery(hql); + // The MODEL table 'id' field maps to the MODEL_RECIPE table 'MODEL_ID' field + query.setParameter(MODEL_ID, modelResultList.get(0).getId()); + query.setParameter(ACTION, action); + + @SuppressWarnings("unchecked") + List recipeResultList = query.list(); + if (recipeResultList.isEmpty()) { + LOGGER.debug("Catalog database - recipeResultList is null"); + return null; + } + Collections.sort(recipeResultList, new MavenLikeVersioningComparator()); + Collections.reverse(recipeResultList); + LOGGER.debug("Catalog database - recipeResultList contains " + recipeResultList.get(0).toString()); + + return recipeResultList.get(0); + } finally { + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getModelRecipe", null); + } + } + /** * Verify the health of the DB. diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/HibernateUtilsCatalogDb.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/HibernateUtilsCatalogDb.java new file mode 100644 index 0000000000..c4069be443 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/HibernateUtilsCatalogDb.java @@ -0,0 +1,45 @@ +/*- + * ============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.db.catalog; + +import org.openecomp.mso.db.HibernateUtils; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; +import java.net.URL; + +public class HibernateUtilsCatalogDb extends HibernateUtils { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); + + @Override + protected URL getHibernateConfigFile() { + try { + if ("MYSQL".equals (System.getProperty ("mso.db")) || "MARIADB".equals(System.getProperty("mso.db"))) { + return this.getClass().getClassLoader().getResource("hibernate-catalog-core-mysql.cfg.xml"); + } else { + LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC", "", "", MsoLogger.ErrorCode.DataError , "DB Connection not specified to the JVM,choose either:-Dmso.db=MARIADB, -Dmso.db=MYSQL or -Dmso.container=AJSC"); + return null; + } + } catch (Exception ex) { + LOGGER.error (MessageEnum.APIH_DB_ACCESS_EXC_REASON, ex.getMessage (), "", "", MsoLogger.ErrorCode.DataError , "Problem in getting DB connection type", ex); + return null; + } + } +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java new file mode 100644 index 0000000000..21cef1ea9f --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomization.java @@ -0,0 +1,123 @@ +/*- + * ============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.db.catalog.beans; + +import java.sql.Timestamp; + +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; + +public class AllottedResourceCustomization extends MavenLikeVersioning { + + private String modelCustomizationUuid; + private String modelUuid; + private String modelInvariantUuid; + private String modelVersion = null; // duplicate of version kept in parent class + private String modelName; + private String description; + private Timestamp created; + private String modelInstanceName; + + public AllottedResourceCustomization() { + super(); + } + + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public String getModelUuid() { + return this.modelUuid; + } + public void setModelUuid(String modelUuid) { + this.modelUuid = modelUuid; + } + + public String getModelInvariantUuid() { + return this.modelInvariantUuid; + } + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + + public String getModelName() { + return this.modelName; + } + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getDescription() { + return this.description; + } + public void setDescription(String description) { + this.description = description; + } + + public Timestamp getCreated() { + return this.created; + } + public void setCreated(Timestamp created) { + this.created = created; + } + + public String getModelInstanceName() { + return this.modelInstanceName; + } + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + public String getModelVersion() { + return this.modelVersion; + } + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + @Override + public String toString () { + StringBuffer sb = new StringBuffer(); + sb.append("modelName="); + sb.append(this.modelName); + sb.append(",modelVersion="); + sb.append(this.modelVersion); + sb.append(",version="); + sb.append(this.version); + sb.append(",modelUuid="); + sb.append(this.modelUuid); + sb.append(",modelInvariantUuid="); + sb.append(this.modelInvariantUuid); + sb.append(",modelCustomizationUuid="); + sb.append(this.modelCustomizationUuid); + sb.append(",modelInstanceName="); + sb.append(this.modelInstanceName); + sb.append(",description="); + sb.append(this.description); + sb.append(",modelInstanceName="); + sb.append(this.modelInstanceName); + sb.append(",created="); + sb.append(this.created); + + return sb.toString(); + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java index 69db27e989..a920375bcd 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java @@ -7,9 +7,9 @@ * 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. @@ -35,9 +35,10 @@ public class HeatEnvironment extends MavenLikeVersioning { private String asdcUuid; private String asdcResourceName; private String asdcLabel; + private String artifactChecksum; private Timestamp created; - + public HeatEnvironment() {} public int getId() { @@ -92,8 +93,15 @@ public class HeatEnvironment extends MavenLikeVersioning { this.asdcLabel = asdcLabel; } + public String getArtifactChecksum() { + return artifactChecksum; + } - /** + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + + /** * @return the asdcResourceName */ public String getAsdcResourceName () { @@ -115,7 +123,7 @@ public class HeatEnvironment extends MavenLikeVersioning { public void setCreated(Timestamp created) { this.created = created; } - + @Override public String toString () { StringBuffer sb = new StringBuffer(); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java index a1b6f228e1..d379c2471a 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java @@ -7,9 +7,9 @@ * 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. @@ -36,38 +36,39 @@ public class HeatFiles extends MavenLikeVersioning { private String asdcUuid; private String asdcLabel; private String asdcResourceName; - + private String artifactChecksum; + public HeatFiles() {} - + public int getId() { return this.id; } - + public void setId(int id) { this.id = id; } - + public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } - + public String getFileName() { return this.fileName; } public void setFileName(String fileName) { this.fileName = fileName; } - + public String getFileBody() { return this.fileBody; } public void setFileBody(String fileBody) { this.fileBody = fileBody; } - + public int getVnfResourceId() { return this.vnfResourceId; } @@ -82,7 +83,7 @@ public class HeatFiles extends MavenLikeVersioning { public void setCreated(Timestamp created) { this.created = created; } - + public String getAsdcUuid() { return this.asdcUuid; } @@ -103,6 +104,14 @@ public class HeatFiles extends MavenLikeVersioning { this.asdcResourceName = asdcResourceName; } + public String getArtifactChecksum() { + return artifactChecksum; + } + + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + @Override public String toString () { StringBuffer sb = new StringBuffer(); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java index a80fa598b9..5762837bfb 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatTemplate.java @@ -7,9 +7,9 @@ * 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. @@ -46,9 +46,10 @@ public class HeatTemplate extends MavenLikeVersioning { private String asdcUuid; private String asdcResourceName; private String asdcLabel; - + private String artifactChecksum; + private Timestamp created; - + public enum TemplateStatus { PARENT, CHILD, PARENT_COMPLETE } @@ -103,7 +104,7 @@ public class HeatTemplate extends MavenLikeVersioning { public void setParameters (Set parameters) { this.parameters = parameters; } - + public String getDescription() { return description; } @@ -131,7 +132,7 @@ public class HeatTemplate extends MavenLikeVersioning { } catch (Exception e) { LOGGER.debug ("Error reading template file " + templatePath, e); } - + return body; } @@ -150,7 +151,7 @@ public class HeatTemplate extends MavenLikeVersioning { public void setAsdcUuid(String asdcUuidp) { this.asdcUuid = asdcUuidp; } - + public String getAsdcResourceName() { return asdcResourceName; } @@ -164,8 +165,15 @@ public class HeatTemplate extends MavenLikeVersioning { public void setAsdcLabel(String asdcLabel) { this.asdcLabel = asdcLabel; } - - public Timestamp getCreated() { + + public String getArtifactChecksum() { + return artifactChecksum; + } + + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + public Timestamp getCreated() { return created; } @@ -197,7 +205,7 @@ public class HeatTemplate extends MavenLikeVersioning { sb.append (",created="); sb.append (DateFormat.getInstance().format(created)); } - + if (parameters != null && !parameters.isEmpty ()) { sb.append (",params=["); diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java new file mode 100644 index 0000000000..51153c912b --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/Model.java @@ -0,0 +1,198 @@ +/*- + * ============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.db.catalog.beans; + + +import java.sql.Timestamp; +import java.text.DateFormat; +import java.util.Map; + +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; + +public class Model extends MavenLikeVersioning { + private int id; + private String modelCustomizationId; + private String modelCustomizationName; + private String modelInvariantId; + private String modelName; + private String modelType; + private String modelVersion; + private String modelVersionId; + private Timestamp created; + private Map recipes; + + /** + * @return the id + */ + public int getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(int id) { + this.id = id; + } + + /** + * @return the modelCustomizationId + */ + public String getModelCustomizationId() { + return modelCustomizationId; + } + + /** + * @param modelCustomizationId the modelCustomizationId to set + */ + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + + /** + * @return the modelCustomizationName + */ + public String getModelCustomizationName() { + return modelCustomizationName; + } + + /** + * @param modelCustomizationName the modelCustomizationName to set + */ + public void setModelCustomizationName(String modelCustomizationName) { + this.modelCustomizationName = modelCustomizationName; + } + + /** + * @return the modelInvariantId + */ + public String getModelInvariantId() { + return modelInvariantId; + } + + /** + * @param modelInvariantId the modelInvariantId to set + */ + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + /** + * @return the modelName + */ + public String getModelName() { + return modelName; + } + + /** + * @param modelName the modelName to set + */ + public void setModelName(String modelName) { + this.modelName = modelName; + } + + /** + * @return the modelType + */ + public String getModelType() { + return modelType; + } + + /** + * @param modelType the modelType to set + */ + public void setModelType(String modelType) { + this.modelType = modelType; + } + + /** + * @return the modelVersion + */ + public String getModelVersion() { + return modelVersion; + } + + /** + * @param modelVersion the modelVersion to set + */ + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + /** + * @return the modelVersionId + */ + public String getModelVersionId() { + return modelVersionId; + } + + /** + * @param modelVersionId the modelVersionId to set + */ + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + /** + * @return the created + */ + public Timestamp getCreated() { + return created; + } + + /** + * @param created the created to set + */ + public void setCreated(Timestamp created) { + this.created = created; + } + + /** + * @return the recipes + */ + public Map getRecipes() { + return recipes; + } + + /** + * @param recipes the recipes to set + */ + public void setRecipes(Map recipes) { + this.recipes = recipes; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("Model: "); + sb.append("modelCustomizationId=" + modelCustomizationId); + sb.append(",modelCustomizationName=" + modelCustomizationName); + sb.append(",modelInvariantId=" + modelInvariantId); + sb.append(",modelName=" + modelName); + sb.append(",modelType=" + modelType); + sb.append(",modelVersion=" + modelVersion); + sb.append(",modelVersionId=" + modelVersionId); + if (created != null) { + sb.append (",created="); + sb.append (DateFormat.getInstance().format(created)); + } + return sb.toString(); + } +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java new file mode 100644 index 0000000000..83fb773a8c --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ModelRecipe.java @@ -0,0 +1,180 @@ +/*- + * ============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.db.catalog.beans; + + +import java.sql.Timestamp; +import java.text.DateFormat; +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; + +public class ModelRecipe extends MavenLikeVersioning { + private int id; + private Integer modelId; + private String action; + private String schemaVersion; + private String description; + private String orchestrationUri; + private String modelParamXSD; + private Integer recipeTimeout; + private Timestamp created; + + /** + * @return the id + */ + public int getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(int id) { + this.id = id; + } + + /** + * @return the modelId + */ + public Integer getModelId() { + return modelId; + } + + /** + * @param modelId the modelId to set + */ + public void setModelId(Integer modelId) { + this.modelId = modelId; + } + + /** + * @return the action + */ + public String getAction() { + return action; + } + + /** + * @param action the action to set + */ + public void setAction(String action) { + this.action = action; + } + + /** + * @return the versionStr + */ + public String getSchemaVersion() { + return schemaVersion; + } + + /** + * @param versionStr the versionStr to set + */ + public void setSchemaVersion(String schemaVersion) { + this.schemaVersion = schemaVersion; + } + + /** + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * @param description the description to set + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * @return the orchestrationUri + */ + public String getOrchestrationUri() { + return orchestrationUri; + } + + /** + * @param orchestrationUri the orchestrationUri to set + */ + public void setOrchestrationUri(String orchestrationUri) { + this.orchestrationUri = orchestrationUri; + } + + /** + * @return the modelParamXSD + */ + public String getModelParamXSD() { + return modelParamXSD; + } + + /** + * @param modelParamXSD the modelParamXSD to set + */ + public void setModelParamXSD(String modelParamXSD) { + this.modelParamXSD = modelParamXSD; + } + + /** + * @return the recipeTimeout + */ + public Integer getRecipeTimeout() { + return recipeTimeout; + } + + /** + * @param recipeTimeout the recipeTimeout to set + */ + public void setRecipeTimeout(Integer recipeTimeout) { + this.recipeTimeout = recipeTimeout; + } + + /** + * @return the created + */ + public Timestamp getCreated() { + return created; + } + + /** + * @param created the created to set + */ + public void setCreated(Timestamp created) { + this.created = created; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("ModelRecipe: "); + sb.append("modelId=" + modelId.toString()); + sb.append(",action=" + action); + sb.append(",schemaVersion=" + schemaVersion); + sb.append(",orchestrationUri=" + orchestrationUri); + sb.append(",modelParamXSD=" + modelParamXSD); + sb.append(",recipeTimeout=" + recipeTimeout.toString()); + if (created != null) { + sb.append (",created="); + sb.append (DateFormat.getInstance().format(created)); + } + return sb.toString(); + } +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java new file mode 100644 index 0000000000..0c49f1b1a4 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/NetworkResourceCustomization.java @@ -0,0 +1,140 @@ +/*- + * ============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.db.catalog.beans; + +import java.sql.Timestamp; + +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; + +public class NetworkResourceCustomization extends MavenLikeVersioning{ + + private String modelCustomizationUuid; + private String modelName; + private String modelInstanceName; + private String modelUuid; + private String modelVersion; + private String modelInvariantUuid; + private int networkResourceId = 0; + private Timestamp created; + + // These fields are not in the table directly - but I'm adding them here for storage in the objects we're dealing with + private NetworkResource networkResource = null; + private String networkType = null; + + public NetworkResourceCustomization() { + super(); + } + + public int getNetworkResourceId() { + return this.networkResourceId; + } + public void setNetworkResourceId(int networkResourceId) { + this.networkResourceId = networkResourceId; + } + + public String getModelUuid() { + return this.modelUuid; + } + public void setModelUuid(String modelUuid) { + this.modelUuid = modelUuid; + } + + public String getModelInvariantUuid() { + return this.modelInvariantUuid; + } + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + + public String getModelVersion() { + return this.modelVersion; + } + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public String getModelInstanceName() { + return this.modelInstanceName; + } + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + + public String getModelName() { + return this.modelName; + } + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public NetworkResource getNetworkResource() { + return this.networkResource; + } + public void setNetworkResource(NetworkResource networkResource) { + this.networkResource = networkResource; + } + + public String getNetworkType() { + return this.networkType; + } + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + public Timestamp getCreated() { + return this.created; + } + public void setCreated(Timestamp timestamp) { + this.created = timestamp; + } + + + @Override + public String toString () { + StringBuffer sb = new StringBuffer(); + sb.append("modelName="); + sb.append(this.modelName); + sb.append("modelUuid="); + sb.append(this.modelUuid); + sb.append("modelUuid="); + sb.append(this.modelUuid); + sb.append("modelInvariantUuid="); + sb.append(this.modelInvariantUuid); + sb.append("modelVersion="); + sb.append(this.modelVersion); + sb.append("modelCustomizationUuid="); + sb.append(this.modelCustomizationUuid); + sb.append("modelInstanceName="); + sb.append(this.modelInstanceName); + sb.append("networkResourceId="); + sb.append(this.networkResourceId); + sb.append("networkType="); + sb.append(this.networkType); + + return sb.toString(); + } + +} \ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java new file mode 100644 index 0000000000..01369c4ecd --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.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.db.catalog.beans; + +import org.openecomp.mso.db.catalog.beans.Service; +import org.openecomp.mso.db.catalog.beans.VnfResource; +import org.openecomp.mso.db.catalog.beans.VfModule; +import java.util.ArrayList; + +/* + * A simple holder for Service and its associated elements: + * VnfResource, 1-n VfModule, Network TBD + */ + +public class ServiceMacroHolder { + + private Service service; + private ArrayList vnfResources; + private ArrayList networkResourceCustomizations; + private ArrayList allottedResourceCustomizations; + + public ServiceMacroHolder() { + super(); + this.service = null; + this.vnfResources = new ArrayList(); + this.networkResourceCustomizations = new ArrayList(); + this.allottedResourceCustomizations = new ArrayList(); + } + public ServiceMacroHolder(Service service) { + this(); + this.service = service; + } + + public Service getService() { + return this.service; + } + public void setService(Service service) { + this.service = service; + } + + public void setVnfResources(ArrayList vnfResources) { + this.vnfResources = vnfResources; + } + public ArrayList getVnfResources() { + return this.vnfResources; + } + public void addVnfResource(VnfResource vr) { + if (vr != null) { + if (this.vnfResources != null) { + this.vnfResources.add(vr); + } else { + this.vnfResources = new ArrayList(); + this.vnfResources.add(vr); + } + } + } + + public void setNetworkResourceCustomization(ArrayList networkResourceCustomizations) { + this.networkResourceCustomizations = networkResourceCustomizations; + } + public ArrayList getNetworkResourceCustomization() { + return this.networkResourceCustomizations; + } + public void addNetworkResourceCustomization(NetworkResourceCustomization nrc) { + if (this.networkResourceCustomizations != null) { + this.networkResourceCustomizations.add(nrc); + } else { + this.networkResourceCustomizations = new ArrayList(); + this.networkResourceCustomizations.add(nrc); + } + } + + public void setAllottedResourceCustomization(ArrayList allottedResourceCustomizations) { + this.allottedResourceCustomizations = allottedResourceCustomizations; + } + public ArrayList getAllottedResourceCustomization() { + return this.allottedResourceCustomizations; + } + public void addAllottedResourceCustomization(AllottedResourceCustomization arc) { + if (this.allottedResourceCustomizations != null) { + this.allottedResourceCustomizations.add(arc); + } else { + this.allottedResourceCustomizations = new ArrayList(); + this.allottedResourceCustomizations.add(arc); + } + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("ServicePlus: "); + if (this.service != null) { + sb.append("service: " + this.service.toString()); + } else { + sb.append("service: null"); + } + if (this.vnfResources != null && this.vnfResources.size() > 0) { + int i=0; + sb.append("VnfResources: "); + for (VnfResource vr : this.vnfResources) { + sb.append(", vnfResource[" + i++ + "]:" + vr.toString()); + } + } else { + sb.append("none"); + } + if (this.networkResourceCustomizations != null && this.networkResourceCustomizations.size() > 0) { + int i=0; + sb.append("NetworkResourceCustomizations:"); + for (NetworkResourceCustomization nrc : this.networkResourceCustomizations) { + sb.append("NRC[" + i++ + "]: " + nrc.toString()); + } + } + if (this.allottedResourceCustomizations != null && this.allottedResourceCustomizations.size() > 0) { + int i=0; + sb.append("AllottedResourceCustomizations:"); + for (AllottedResourceCustomization arc : this.allottedResourceCustomizations) { + sb.append("ARC[" + i++ + "]: " + arc.toString()); + } + } + + return sb.toString(); + } + + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java index 53ec3ba278..cc203ff98d 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceRecipe.java @@ -7,9 +7,9 @@ * 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. @@ -26,6 +26,9 @@ package org.openecomp.mso.db.catalog.beans; import java.sql.Timestamp; import java.text.DateFormat; import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; +import java.util.Date; +import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; +import org.openecomp.mso.logger.MsoLogger; public class ServiceRecipe extends MavenLikeVersioning { private int id; @@ -36,9 +39,38 @@ public class ServiceRecipe extends MavenLikeVersioning { private String serviceParamXSD; private int recipeTimeout; private Integer serviceTimeoutInterim; - + private Timestamp created; - + + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); + + // This 'default' CTR is now needed for backward compatibility since a new CTR was added below + public ServiceRecipe() { + super(); + } + + // This CTR is needed by the HQL SELECT JOIN between the SERVICE and SERVICE_RECIPE tables + // in CatalogDatabase::getServiceRecipe() + public ServiceRecipe(int id, int serviceId, String action, + String description, String orchestrationUri, + String serviceParamXSD, int recipeTimeout, + int serviceTimeoutInterim, Date created) { + super(); + LOGGER.debug("ServiceRecipe id=" + id + ", serviceId=" + serviceId + ", action=" + action + ", description=" + description + + ", orchestrationUri=" + orchestrationUri + ", serviceParamXSD=" + serviceParamXSD + + ", recipeTimeout=" + recipeTimeout + ", serviceTimeoutInterim=" + serviceTimeoutInterim + ", created=" + created); + this.id = id; + this.serviceId = serviceId; + this.action = action; + this.description = description; + this.orchestrationUri = orchestrationUri; + this.serviceParamXSD = serviceParamXSD; + this.recipeTimeout = recipeTimeout; + this.serviceTimeoutInterim = serviceTimeoutInterim; + long date = created.getTime(); + this.created = new Timestamp(date); + } public int getId() { return id; @@ -96,7 +128,7 @@ public class ServiceRecipe extends MavenLikeVersioning { public void setServiceTimeoutInterim(Integer serviceTimeoutInterim) { this.serviceTimeoutInterim = serviceTimeoutInterim; } - + public Timestamp getCreated() { return created; } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java new file mode 100644 index 0000000000..1fc93be6f5 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResources.java @@ -0,0 +1,67 @@ +/*- + * ============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.db.catalog.beans; + +import java.io.Serializable; +import java.sql.Timestamp; + +public class ServiceToAllottedResources implements Serializable { + + private String serviceModelUuid; + private String arModelCustomizationUuid; + private Timestamp created; + + public static final long serialVersionUID = -1322322139926390329L; + + public ServiceToAllottedResources() { + super(); + } + + public String getServiceModelUuid() { + return this.serviceModelUuid; + } + public void setServiceModelUuid(String serviceModelUuid) { + this.serviceModelUuid = serviceModelUuid; + } + public String getArModelCustomizationUuid() { + return this.arModelCustomizationUuid; + } + public void setArModelCustomizationUuid(String arModelCustomizationUuid) { + this.arModelCustomizationUuid = arModelCustomizationUuid; + } + public Timestamp getCreated() { + return this.created; + } + public void setCreated(Timestamp created) { + this.created = created; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("serviceModelUuid="); + sb.append(this.serviceModelUuid); + sb.append("arModelCustomizationUuid="); + sb.append(this.arModelCustomizationUuid); + + return sb.toString(); + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java new file mode 100644 index 0000000000..5ea171e93b --- /dev/null +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworks.java @@ -0,0 +1,68 @@ +/*- + * ============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.db.catalog.beans; + +import java.io.Serializable; +import java.sql.Timestamp; + +public class ServiceToNetworks implements Serializable { + + // This maps to SERVICE.SERVICE_NAME_VERSION_ID / Service.serviceNameVersionId in SERVICE/Service table + private String serviceModelUuid; + // This maps to NETWORK_RESOURCE_CUSTOMIZATION.MODEL_CUSTOMIZATION_UUID / NetworkResourceCustomization.ModelCustomizationUuid + private String networkModelCustomizationUuid; + private Timestamp created; + public static final long serialVersionUID = -1322322139926390329L; + + public ServiceToNetworks() { + super(); + } + + public String getServiceModelUuid() { + return this.serviceModelUuid; + } + public void setServiceModelUuid(String serviceModelUuid) { + this.serviceModelUuid = serviceModelUuid; + } + + public String getNetworkModelCustomizationUuid() { + return this.networkModelCustomizationUuid; + } + public void setNetworkModelCustomizationUuid(String networkCustomizationUuid) { + this.networkModelCustomizationUuid = networkCustomizationUuid; + } + + public Timestamp getCreated() { + return this.created; + } + public void setCreated(Timestamp timestamp) { + this.created = timestamp; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("ServiceToNetworks mapping: "); + sb.append("serviceModelUuid=" + this.serviceModelUuid); + sb.append(",networkModelCustomizationUuid=" + networkModelCustomizationUuid); + return sb.toString(); + } + +} diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java index 505b3bba9a..a551ef864e 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VfModule.java @@ -7,9 +7,9 @@ * 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. @@ -28,7 +28,7 @@ import java.text.DateFormat; import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; public class VfModule extends MavenLikeVersioning { - + private int id; private Integer vnfResourceId; private String type; @@ -40,35 +40,40 @@ public class VfModule extends MavenLikeVersioning { private Integer volEnvironmentId; private String description; private String asdcUuid; - private Timestamp created; + private Timestamp created; private String modelInvariantUuid; private String modelVersion; - + private String modelCustomizationUuid = null; + private Integer minInstances; + private Integer maxInstances; + private Integer initialCount; + private String label; + public VfModule() { super(); } - + public int getId(){ return this.id; } public void setId(int id) { this.id = id; } - + public Integer getVnfResourceId() { return this.vnfResourceId; } public void setVnfResourceId(Integer vnfResourceId) { this.vnfResourceId = vnfResourceId; } - + public String getModelName() { return this.modelName; } public void setModelName(String modelName) { this.modelName = modelName; } - + public String getType() { return type; } @@ -90,14 +95,14 @@ public class VfModule extends MavenLikeVersioning { return true; } } - + public Integer getTemplateId() { return this.templateId; } public void setTemplateId(Integer templateId) { this.templateId = templateId; } - + public Integer getEnvironmentId() { return this.environmentId; } @@ -111,21 +116,21 @@ public class VfModule extends MavenLikeVersioning { public void setVolTemplateId(Integer volTemplateId) { this.volTemplateId = volTemplateId; } - + public Integer getVolEnvironmentId() { return this.volEnvironmentId; } public void setVolEnvironmentId(Integer volEnvironmentId) { this.volEnvironmentId = volEnvironmentId; } - + public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } - + public String getAsdcUuid() { return asdcUuid; } @@ -133,7 +138,7 @@ public class VfModule extends MavenLikeVersioning { public void setAsdcUuid(String asdcUuidp) { this.asdcUuid = asdcUuidp; } - + public Timestamp getCreated() { return created; } @@ -147,19 +152,49 @@ public class VfModule extends MavenLikeVersioning { public void setModelInvariantUuid(String modelInvariantUuid) { this.modelInvariantUuid = modelInvariantUuid; } - - + + public String getModelVersion() { return this.modelVersion; } public void setModelVersion(String modelVersion) { this.modelVersion = modelVersion; } - - @Override + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public Integer getMinInstances() { + return this.minInstances; + } + public void setMinInstances(Integer minInstances) { + this.minInstances = minInstances; + } + public Integer getMaxInstances() { + return this.maxInstances; + } + public void setMaxInstances(Integer maxInstances) { + this.maxInstances = maxInstances; + } + public Integer getInitialCount() { + return this.initialCount; + } + public void setInitialCount(Integer initialCount) { + this.initialCount = initialCount; + } + public String getLabel() { + return this.label; + } + public void setLabel(String label) { + this.label = label; + } + + @Override public String toString () { StringBuffer buf = new StringBuffer(); - + buf.append("VF="); buf.append(this.type); buf.append(",modelName="); @@ -184,12 +219,22 @@ public class VfModule extends MavenLikeVersioning { buf.append(asdcUuid); buf.append(",modelVersion="); buf.append(this.modelVersion); - + buf.append(",modelCustomizationUuid="); + buf.append(this.modelCustomizationUuid); + buf.append(",minInstances="); + buf.append(this.minInstances); + buf.append(",maxInstances="); + buf.append(this.maxInstances); + buf.append(",initialCount="); + buf.append(this.initialCount); + buf.append(",label="); + buf.append(this.label); + if (this.created != null) { buf.append (",created="); buf.append (DateFormat.getInstance().format(this.created)); } return buf.toString(); } - + } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java index 60c7ef216e..72f143dcc0 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/VnfResource.java @@ -7,9 +7,9 @@ * 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. @@ -23,6 +23,7 @@ package org.openecomp.mso.db.catalog.beans; import java.sql.Timestamp; import java.text.DateFormat; +import java.util.ArrayList; import java.util.Map; import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning; @@ -31,30 +32,35 @@ public class VnfResource extends MavenLikeVersioning { private int id; private String vnfType; - + private String orchestrationMode = null; private String description = null; private Integer templateId; private Integer environmentId = null; - + private Map heatFiles; - + private String asdcUuid; - private Timestamp created; - + private Timestamp created; + private String aicVersionMin = null; private String aicVersionMax = null; - + private String modelInvariantUuid = null; private String modelVersion = null; private String modelCustomizationName = null; - + private String modelName = null; private String serviceModelInvariantUUID = null; - + private String modelCustomizationUuid = null; + + private ArrayList vfModules; + public VnfResource () { + super(); + this.vfModules = new ArrayList(); } public int getId () { @@ -104,7 +110,7 @@ public class VnfResource extends MavenLikeVersioning { public void setEnvironmentId (Integer environmentId) { this.environmentId = environmentId; } - + public Map getHeatFiles () { return this.heatFiles; } @@ -120,7 +126,7 @@ public class VnfResource extends MavenLikeVersioning { public void setAsdcUuid(String asdcUuidp) { this.asdcUuid = asdcUuidp; } - + public Timestamp getCreated() { return created; } @@ -128,38 +134,38 @@ public class VnfResource extends MavenLikeVersioning { public void setCreated(Timestamp created) { this.created = created; } - + public String getAicVersionMin() { return this.aicVersionMin; } - + public void setAicVersionMin(String aicVersionMin) { this.aicVersionMin = aicVersionMin; } - + public String getAicVersionMax() { return this.aicVersionMax; } - + public void setAicVersionMax(String aicVersionMax) { this.aicVersionMax = aicVersionMax; } - + public String getModelInvariantUuid() { return this.modelInvariantUuid; } - + public void setModelInvariantUuid(String modelInvariantUuid) { this.modelInvariantUuid = modelInvariantUuid; } - + public String getModelVersion() { return this.modelVersion; } public void setModelVersion(String modelVersion) { this.modelVersion = modelVersion; } - + public String getModelCustomizationName() { return modelCustomizationName; } @@ -184,6 +190,29 @@ public class VnfResource extends MavenLikeVersioning { this.serviceModelInvariantUUID = serviceModelInvariantUUID; } + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public ArrayList getVfModules() { + return this.vfModules; + } + public void setVfModules(ArrayList vfModules) { + this.vfModules = vfModules; + } + public void addVfModule(VfModule vfm) { + if (vfm != null) { + if (this.vfModules != null) { + this.vfModules.add(vfm); + } else { + this.vfModules = new ArrayList(); + this.vfModules.add(vfm); + } + } + } @Override public String toString () { StringBuffer buf = new StringBuffer(); @@ -214,11 +243,22 @@ public class VnfResource extends MavenLikeVersioning { buf.append(this.modelName); buf.append(",serviceModelInvariantUUID="); buf.append(this.serviceModelInvariantUUID); - + buf.append(",modelCustomizationUuid="); + buf.append(this.modelCustomizationUuid); + if (created != null) { buf.append(",created="); buf.append(DateFormat.getInstance().format(created)); } + if (this.vfModules != null && this.vfModules.size() > 0) { + buf.append("VfModules:"); + int i=0; + for (VfModule vfm : this.vfModules) { + buf.append("vfModule[" + i++ + "]:" + vfm.toString()); + } + } else { + buf.append("VfModules: NONE"); + } return buf.toString(); } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java index c617a4a6f4..73a9f8eb00 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/MavenLikeVersioning.java @@ -7,9 +7,9 @@ * 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. @@ -21,15 +21,16 @@ package org.openecomp.mso.db.catalog.utils; +import java.io.Serializable; /** * This class is the base class for object that requires a Version in Catalog DB. * The version is built on a string as ASDC provides a number like 1.2 or 2.0 ... * This class supports also 1.2.3.4... (Maven like version) - * + * * */ -public class MavenLikeVersioning { +public class MavenLikeVersioning implements Serializable { protected String version; diff --git a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/beans/CommonCompletionRequest.groovy b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundException.java similarity index 60% rename from bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/beans/CommonCompletionRequest.groovy rename to mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundException.java index 3963c2690f..d7f791005a 100644 --- a/bpmn/MSOGammaBPMN/src/main/groovy/com/att/bpm/scripts/beans/CommonCompletionRequest.groovy +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundException.java @@ -7,9 +7,9 @@ * 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. @@ -17,30 +17,33 @@ * limitations under the License. * ============LICENSE_END========================================================= */ +package org.openecomp.mso.db.catalog.utils; -package com.att.bpm.scripts.beans +/* +* Exception of the ASDC controller. +*/ +public class RecordNotFoundException extends Exception { -import javax.xml.bind.annotation.XmlAccessType -import javax.xml.bind.annotation.XmlAccessorType + /** + * serialization id. + */ + private static final long serialVersionUID = 8425657297510362736L; -@XmlAccessorType(XmlAccessType.FIELD) -class CommonCompletionRequest { - String source - String callbackURL - String basicAuthCred - String correlator - String startTime - String finishTime - String requestScope - String requestType - //complete, failed, inProgress - String requestState - //COMPLETED or FAILED - String status - //response message for callback - String message - //response body for db update - String response - int responseCode + /** + * @param message The message to dump + * @param cause The Throwable cause object + */ + public RecordNotFoundException(final String message) { + super (message); + } + + /** + * @param message The message to dump + * @param cause The Throwable cause object + */ + public RecordNotFoundException(final String message, final Throwable cause) { + super (message, cause); + + } } diff --git a/mso-catalog-db/src/main/resources/AllottedResourceCustomization.hbm.xml b/mso-catalog-db/src/main/resources/AllottedResourceCustomization.hbm.xml new file mode 100644 index 0000000000..4a039a45c4 --- /dev/null +++ b/mso-catalog-db/src/main/resources/AllottedResourceCustomization.hbm.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mso-catalog-db/src/main/resources/HeatEnvironment.hbm.xml b/mso-catalog-db/src/main/resources/HeatEnvironment.hbm.xml index 992e5d467a..8e86c584d5 100644 --- a/mso-catalog-db/src/main/resources/HeatEnvironment.hbm.xml +++ b/mso-catalog-db/src/main/resources/HeatEnvironment.hbm.xml @@ -8,9 +8,9 @@ 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. @@ -27,7 +27,7 @@ This class describes a HEAT Environment - + @@ -41,6 +41,9 @@ + + + @@ -49,10 +52,10 @@ - - - - + + + + diff --git a/mso-catalog-db/src/main/resources/HeatTemplate.hbm.xml b/mso-catalog-db/src/main/resources/HeatTemplate.hbm.xml index 9bc6fb1414..b77656896e 100644 --- a/mso-catalog-db/src/main/resources/HeatTemplate.hbm.xml +++ b/mso-catalog-db/src/main/resources/HeatTemplate.hbm.xml @@ -8,9 +8,9 @@ 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. @@ -26,11 +26,11 @@ This class describes a HEAT template - + - + @@ -41,21 +41,25 @@ + + + - + - - - + + + + @@ -64,14 +68,14 @@ - + - + This class describes an input parameter to a heat template - + diff --git a/mso-catalog-db/src/main/resources/ModelRecipe.hbm.xml b/mso-catalog-db/src/main/resources/ModelRecipe.hbm.xml new file mode 100644 index 0000000000..e59bb5c23b --- /dev/null +++ b/mso-catalog-db/src/main/resources/ModelRecipe.hbm.xml @@ -0,0 +1,87 @@ + + + + + + + + This class describes a Model that may be orchestrated + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This class describes a Model recipe + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml b/mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml index bdd16d37e6..28589ea639 100644 --- a/mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml +++ b/mso-catalog-db/src/main/resources/NetworkRecipe.hbm.xml @@ -8,9 +8,9 @@ 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. @@ -26,7 +26,7 @@ This class describes a Network recipe - + @@ -41,21 +41,21 @@ - + - - - - + + + + - + diff --git a/mso-catalog-db/src/main/resources/NetworkResource.hbm.xml b/mso-catalog-db/src/main/resources/NetworkResource.hbm.xml index b3b657aa9f..931db68406 100644 --- a/mso-catalog-db/src/main/resources/NetworkResource.hbm.xml +++ b/mso-catalog-db/src/main/resources/NetworkResource.hbm.xml @@ -8,9 +8,9 @@ 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. @@ -26,7 +26,7 @@ This class describes a Network Resource - + @@ -40,16 +40,18 @@ + + + - + - + - - + diff --git a/mso-catalog-db/src/main/resources/NetworkResourceCustomization.hbm.xml b/mso-catalog-db/src/main/resources/NetworkResourceCustomization.hbm.xml new file mode 100644 index 0000000000..401bca1f8d --- /dev/null +++ b/mso-catalog-db/src/main/resources/NetworkResourceCustomization.hbm.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/Service.hbm.xml b/mso-catalog-db/src/main/resources/Service.hbm.xml index 4e43413f47..f6049961fd 100644 --- a/mso-catalog-db/src/main/resources/Service.hbm.xml +++ b/mso-catalog-db/src/main/resources/Service.hbm.xml @@ -8,9 +8,9 @@ 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. @@ -26,16 +26,23 @@ This class describes a Service that may be orchestrated - + - - - + + + + + + + + + + + - - + @@ -44,32 +51,34 @@ - + - + This class describes a Service recipe - + - + - + + + diff --git a/mso-catalog-db/src/main/resources/ServiceToAllottedResources.hbm.xml b/mso-catalog-db/src/main/resources/ServiceToAllottedResources.hbm.xml new file mode 100644 index 0000000000..1d471ca193 --- /dev/null +++ b/mso-catalog-db/src/main/resources/ServiceToAllottedResources.hbm.xml @@ -0,0 +1,41 @@ + + + + + + + This class describes a Service to Allotted Resource Customization relationship + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mso-catalog-db/src/main/resources/ServiceToNetworks.hbm.xml b/mso-catalog-db/src/main/resources/ServiceToNetworks.hbm.xml new file mode 100644 index 0000000000..1c96f7ba95 --- /dev/null +++ b/mso-catalog-db/src/main/resources/ServiceToNetworks.hbm.xml @@ -0,0 +1,41 @@ + + + + + + + This class describes a Service to a Network Resource Customization relationship + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mso-catalog-db/src/main/resources/VfModule.hbm.xml b/mso-catalog-db/src/main/resources/VfModule.hbm.xml index 1ccc48daf6..1631057bfd 100644 --- a/mso-catalog-db/src/main/resources/VfModule.hbm.xml +++ b/mso-catalog-db/src/main/resources/VfModule.hbm.xml @@ -8,9 +8,9 @@ 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. @@ -27,55 +27,66 @@ - + + + + + + - + - + + + - - - - - - - - - - - - - - - + - + + + + - + + + + - + + + + + + + + + + + + + diff --git a/mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml b/mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml index e0ef0d2bc2..6297e1c52f 100644 --- a/mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml +++ b/mso-catalog-db/src/main/resources/VnfComponentsRecipe.hbm.xml @@ -8,9 +8,9 @@ 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. @@ -26,20 +26,22 @@ This class describes a VNF Components Recipe - + - - + + - + + + diff --git a/mso-catalog-db/src/main/resources/VnfRecipe.hbm.xml b/mso-catalog-db/src/main/resources/VnfRecipe.hbm.xml index ea2b39e861..4c471edfee 100644 --- a/mso-catalog-db/src/main/resources/VnfRecipe.hbm.xml +++ b/mso-catalog-db/src/main/resources/VnfRecipe.hbm.xml @@ -8,9 +8,9 @@ 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. @@ -26,13 +26,13 @@ This class describes a VNF Recipe - + - + @@ -42,23 +42,23 @@ - + - + - + - + - + - + - + diff --git a/mso-catalog-db/src/main/resources/VnfResource.hbm.xml b/mso-catalog-db/src/main/resources/VnfResource.hbm.xml index 4c9e3b59e3..2fc47009d7 100644 --- a/mso-catalog-db/src/main/resources/VnfResource.hbm.xml +++ b/mso-catalog-db/src/main/resources/VnfResource.hbm.xml @@ -8,9 +8,9 @@ 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. @@ -26,7 +26,7 @@ This class describes a VNF Resource - + @@ -37,14 +37,20 @@ + + + + + + - + @@ -69,66 +75,62 @@ - - - - - - - + + + - + - + This class describes a HEAT Template File - + - + + + - + - + + + + - - - - - - - + + + + - - - - - - + + + + - + diff --git a/mso-catalog-db/src/main/resources/hibernate-catalog-mysql.cfg.xml b/mso-catalog-db/src/main/resources/hibernate-catalog-core-mysql.cfg.xml similarity index 100% rename from mso-catalog-db/src/main/resources/hibernate-catalog-mysql.cfg.xml rename to mso-catalog-db/src/main/resources/hibernate-catalog-core-mysql.cfg.xml diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDatabaseESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDatabaseESTest.java index bfd4aa8e09..b577afef66 100644 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDatabaseESTest.java +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/CatalogDatabaseESTest.java @@ -39,7 +39,7 @@ import org.hibernate.Query; import org.hibernate.Session; import org.junit.runner.RunWith; -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { @Test(timeout = 4000) @@ -65,10 +65,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); // Undeclared exception! - try { + try { catalogDatabase0.getHeatTemplate((String) null); fail("Expecting exception: ClassCastException"); - + } catch(ClassCastException e) { // // org.openecomp.mso.db.catalog.beans.VfModuleToHeatFiles$$EnhancerByMockitoWithCGLIB$$309d9392 cannot be cast to org.openecomp.mso.db.catalog.beans.HeatTemplate @@ -89,10 +89,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { Session session1 = mock(Session.class, new ViolatedAssumptionAnswer()); HeatTemplate heatTemplate0 = mock(HeatTemplate.class, new ViolatedAssumptionAnswer()); // Undeclared exception! - try { + try { catalogDatabase0.getVfModuleType((String) null, (String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -143,10 +143,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { catalogDatabase0.saveHeatFiles(heatFiles0); Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatTemplate(heatTemplate0, set0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { } } @@ -190,10 +190,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); doReturn(iterator0).when(set0).iterator(); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatTemplate(heatTemplate0, set0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -214,10 +214,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((Query) null).when(session0).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); // Undeclared exception! - try { + try { catalogDatabase0.getService(hashMap0, "Successfully. No template found"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -234,10 +234,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((Query) null).when(session0).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); // Undeclared exception! - try { + try { catalogDatabase0.getNestedTemplates(2377); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -256,10 +256,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((Query) null).when(session0).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); // Undeclared exception! - try { + try { catalogDatabase0.getVnfComponentsRecipe("Generic exception searching for vnf_id=", (String) null, (String) null, (String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -287,10 +287,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session1); catalogDatabase0.getVnfComponent(187, ""); // Undeclared exception! - try { + try { catalogDatabase0.getHeatEnvironment((-1)); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { } } @@ -299,10 +299,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test08() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getNetworkRecipe("735uWxa&iIbU.4]O$", ",hpGX76\"X~ow4", (String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -322,10 +322,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((Query) null).when(session0).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); // Undeclared exception! - try { + try { catalogDatabase0.getVnfComponentsRecipeByVfModuleId("", "(3", ""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -343,10 +343,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); // Undeclared exception! - try { - catalogDatabase0.getVnfComponentsRecipe("B4@1", "v@(U", "", (String) null, ""); + try { + catalogDatabase0.getVnfComponentsRecipe("B4@1", "v@(U", "", (String) null, "", ""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -363,10 +363,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((Query) null).when(session0).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); // Undeclared exception! - try { + try { catalogDatabase0.getService((String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -383,10 +383,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((Query) null).when(session0).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); // Undeclared exception! - try { + try { catalogDatabase0.getVfModuleModelName("", "RiY"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -406,10 +406,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { VnfRecipe vnfRecipe0 = mock(VnfRecipe.class, new ViolatedAssumptionAnswer()); Service service0 = new Service(); // Undeclared exception! - try { + try { catalogDatabase0.saveService(service0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -426,10 +426,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((Query) null).when(session0).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session0); // Undeclared exception! - try { + try { catalogDatabase0.getNetworkRecipe("735uWxa&iIbU.4]O$", ",hpGX76\"X~ow4", ""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -444,10 +444,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { HeatTemplate heatTemplate0 = mock(HeatTemplate.class, new ViolatedAssumptionAnswer()); VnfResource vnfResource0 = mock(VnfResource.class, new ViolatedAssumptionAnswer()); // Undeclared exception! - try { + try { catalogDatabase0.saveService((Service) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -463,10 +463,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { HeatTemplate heatTemplate0 = new HeatTemplate(); LinkedHashSet linkedHashSet0 = new LinkedHashSet(); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatTemplate((HeatTemplate) null, (Set) linkedHashSet0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -482,10 +482,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((-1)).when(vnfResource0).getId(); doReturn("#5|%>JWRPJfP)S@").when(vnfResource0).getVnfType(); // Undeclared exception! - try { + try { catalogDatabase0.saveOrUpdateVnfResource(vnfResource0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -500,10 +500,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MsoLogger.StatusCode.values(); CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.saveVnfRecipe((VnfRecipe) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -520,10 +520,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn((String) null, (String) null).when(service0).getServiceNameVersionId(); doReturn((String) null).when(service0).getServiceVersion(); // Undeclared exception! - try { + try { catalogDatabase0.saveService(service0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -542,10 +542,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); HeatEnvironment heatEnvironment0 = new HeatEnvironment(); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatEnvironment(heatEnvironment0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -559,10 +559,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MessageEnum messageEnum0 = MessageEnum.APIH_GENERAL_METRICS; CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatEnvironment((HeatEnvironment) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -575,10 +575,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test22() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getVnfRecipe((String) null, (String) null, (String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -592,10 +592,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MsoLogger.ErrorCode.values(); CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.rollback(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -608,10 +608,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test24() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getAllHeatTemplates(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -624,10 +624,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test25() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getHeatFilesForVfModule((-1539)); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -640,10 +640,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test26() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getHeatEnvironment(0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -656,10 +656,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test27() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getAllHeatEnvironment(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -672,10 +672,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test28() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.commit(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -691,10 +691,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { heatFiles0.setVersion("E0)WE F/LaV~i2U01"); heatFiles0.setFileName("uIZl|"); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatFiles(heatFiles0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -707,10 +707,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test30() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.saveVnfComponentsRecipe((VnfComponentsRecipe) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -726,10 +726,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MessageEnum messageEnum2 = MessageEnum.NO_PROPERTIES; CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.healthCheck(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -743,10 +743,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); catalogDatabase0.close(); // Undeclared exception! - try { + try { catalogDatabase0.getHeatTemplate(1197); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -759,10 +759,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test33() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getAllNetworkResources(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -775,10 +775,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test34() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getVnfComponentsRecipe("Ikrt3T$WS\"UMs#Q", "Ikrt3T$WS\"UMs#Q", "Ikrt3T$WS\"UMs#Q", ""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -791,10 +791,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test35() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getHeatTemplate((String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -807,10 +807,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test36() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getVnfComponent(1987, "R$9=*_j3~I=:_"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -823,10 +823,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test37() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getHeatFiles(0, "r#j>oJCQI5r'@)jSH", "K6#W1{s", "vRm"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -839,10 +839,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { public void test38() throws Throwable { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getVnfResourcesByRole(""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -856,10 +856,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MessageEnum messageEnum0 = MessageEnum.RA_ASYNC_DELETE_VNF; CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getAllVnfResources(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -891,10 +891,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { PrivateAccess.callMethod((Class) CatalogDatabase.class, catalogDatabase0, "getSession"); catalogDatabase0.getHeatTemplate((String) null); // Undeclared exception! - try { + try { catalogDatabase0.getHeatEnvironment(148); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { } } @@ -936,10 +936,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { catalogDatabase0.saveHeatFiles(heatFiles0); Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatTemplate(heatTemplate0, set0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -978,10 +978,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { Iterator iterator0 = (Iterator) mock(Iterator.class, new ViolatedAssumptionAnswer()); Set set0 = (Set) mock(Set.class, new ViolatedAssumptionAnswer()); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatTemplate(heatTemplate0, set0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { } } @@ -999,10 +999,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { doReturn(query0).when(session1).createQuery(anyString()); PrivateAccess.setVariable((Class) CatalogDatabase.class, catalogDatabase0, "session", (Object) session1); // Undeclared exception! - try { + try { catalogDatabase0.getHeatEnvironment((-1)); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { } } @@ -1017,10 +1017,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { String string2 = "U`9Z8:QQUr-c(T@_/)"; String string3 = "$q')fpKG]Q&i\"'{x"; // Undeclared exception! - try { + try { catalogDatabase0.getNetworkResource("FT>Ri6U\"Ks<.H/g["); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1034,10 +1034,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); int int0 = 1030; // Undeclared exception! - try { + try { catalogDatabase0.getAllVfModules(); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1051,10 +1051,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MsoLogger.ResponseCode msoLogger_ResponseCode0 = MsoLogger.ResponseCode.DataNotFound; CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getVfModuleType("serviceVersion", "serviceVersion"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1068,10 +1068,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MsoLogger.ResponseCode msoLogger_ResponseCode0 = MsoLogger.ResponseCode.Conflict; CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getNestedTemplates(2377); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1088,10 +1088,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); String string0 = null; // Undeclared exception! - try { + try { catalogDatabase0.getVnfResource((String) null, (String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1105,10 +1105,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); String string0 = ", description="; // Undeclared exception! - try { + try { catalogDatabase0.getServiceRecipe((-1319), ", description="); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1124,10 +1124,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { String string1 = "735uWxa&iIbU.4]O$"; String string2 = "APIH_ERROR_FROM_BPEL_SERVER"; // Undeclared exception! - try { + try { catalogDatabase0.getNetworkRecipe("735uWxa&iIbU.4]O$", ",hpGX76\"X~ow4", ""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1142,10 +1142,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { String string0 = ",hpGX76\"X~ow4"; String string1 = "APIH_ERROR_FROM_BPEL_SERVER"; // Undeclared exception! - try { + try { catalogDatabase0.getNetworkRecipe("", ",hpGX76\"X~ow4"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1162,10 +1162,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { String string2 = ""; String string3 = null; // Undeclared exception! - try { + try { catalogDatabase0.getVnfResource((String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1180,10 +1180,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { String string0 = "Ikrt3T$WS\"UMs#Q"; String string1 = null; // Undeclared exception! - try { + try { catalogDatabase0.getServiceByUUID("Ikrt3T$WS\"UMs#Q"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1197,10 +1197,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); String string0 = "v@(U"; // Undeclared exception! - try { - catalogDatabase0.getVnfComponentsRecipe("!4@@1", "v@(U", "", (String) null, ""); + try { + catalogDatabase0.getVnfComponentsRecipe("!4@@1", "v@(U", "", (String) null, "", ""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1217,10 +1217,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { CatalogDatabase catalogDatabase0 = new CatalogDatabase(); HashMap hashMap0 = new HashMap(); // Undeclared exception! - try { + try { catalogDatabase0.getService(hashMap0, "Successfully. No template found"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1235,10 +1235,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MessageEnum messageEnum1 = MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL; CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getVnfComponentsRecipeByVfModuleId("", "(3", ""); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1255,10 +1255,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { String string0 = ""; String string1 = "RiY"; // Undeclared exception! - try { + try { catalogDatabase0.getHeatEnvironment("", "RiY", "RiY"); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1275,10 +1275,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { HeatTemplate heatTemplate0 = new HeatTemplate(); LinkedHashSet linkedHashSet0 = new LinkedHashSet(); // Undeclared exception! - try { + try { catalogDatabase0.saveHeatTemplate(heatTemplate0, (Set) linkedHashSet0); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) @@ -1293,10 +1293,10 @@ public class CatalogDatabaseESTest extends CatalogDatabaseESTestscaffolding { MessageEnum messageEnum1 = MessageEnum.RA_SEND_REQUEST_SDNC; CatalogDatabase catalogDatabase0 = new CatalogDatabase(); // Undeclared exception! - try { + try { catalogDatabase0.getVnfComponentsRecipe("Generic exception searching for vnf_id=", (String) null, (String) null, (String) null); fail("Expecting exception: NullPointerException"); - + } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomizationESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomizationESTest.java new file mode 100644 index 0000000000..2f0a1c85ae --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/AllottedResourceCustomizationESTest.java @@ -0,0 +1,214 @@ +/* + * This file was automatically generated by EvoSuite + * Wed Feb 22 09:34:38 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import java.sql.Timestamp; +import java.time.Instant; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.evosuite.runtime.mock.java.time.MockInstant; +import org.junit.runner.RunWith; +import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class AllottedResourceCustomizationESTest extends AllottedResourceCustomizationESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + AllottedResourceCustomization allottedResourceCustomization0 = new AllottedResourceCustomization(); + allottedResourceCustomization0.setModelVersion("T2 hashMap0 = new HashMap(); + ServiceRecipe serviceRecipe0 = new ServiceRecipe(); + hashMap0.putIfAbsent("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", serviceRecipe0); + model0.setRecipes(hashMap0); + Map map0 = model0.getRecipes(); + assertEquals(1, map0.size()); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + Model model0 = new Model(); + model0.setModelVersionId("9WI;kp?]"); + String string0 = model0.getModelVersionId(); + assertEquals("9WI;kp?]", string0); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + Model model0 = new Model(); + model0.setModelVersion("_Y+vZ)59ie"); + String string0 = model0.getModelVersion(); + assertEquals("_Y+vZ)59ie", string0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + Model model0 = new Model(); + model0.setModelType("{!]r;T"); + String string0 = model0.getModelType(); + assertEquals("{!]r;T", string0); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + Model model0 = new Model(); + model0.setModelName(", description="); + String string0 = model0.getModelName(); + assertEquals(", description=", string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + Model model0 = new Model(); + model0.setModelInvariantId(".m"); + String string0 = model0.getModelInvariantId(); + assertEquals(".m", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + Model model0 = new Model(); + model0.setModelCustomizationName("| map0 = model0.getRecipes(); + assertNull(map0); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + Model model0 = new Model(); + String string0 = model0.getModelCustomizationName(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + Model model0 = new Model(); + model0.setModelVersion(""); + String string0 = model0.getModelVersion(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + Model model0 = new Model(); + model0.setModelVersionId(""); + String string0 = model0.getModelVersionId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + Model model0 = new Model(); + String string0 = model0.getModelType(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + Model model0 = new Model(); + model0.setModelInvariantId(""); + String string0 = model0.getModelInvariantId(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + Model model0 = new Model(); + model0.setModelName(""); + String string0 = model0.getModelName(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + Model model0 = new Model(); + model0.setModelCustomizationName(""); + String string0 = model0.getModelCustomizationName(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + Model model0 = new Model(); + Timestamp timestamp0 = new Timestamp(0L); + model0.setCreated(timestamp0); + String string0 = model0.toString(); + assertEquals("Model: modelCustomizationId=null,modelCustomizationName=null,modelInvariantId=null,modelName=null,modelType=null,modelVersion=null,modelVersionId=null,created=1/1/70 12:00 AM", string0); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + Model model0 = new Model(); + int int0 = model0.getId(); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + Model model0 = new Model(); + HashMap hashMap0 = new HashMap(); + model0.setRecipes(hashMap0); + Map map0 = model0.getRecipes(); + assertTrue(map0.isEmpty()); + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + Model model0 = new Model(); + String string0 = model0.getModelVersionId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test27() throws Throwable { + Model model0 = new Model(); + String string0 = model0.getModelCustomizationId(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test28() throws Throwable { + Model model0 = new Model(); + String string0 = model0.getModelVersion(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test29() throws Throwable { + Model model0 = new Model(); + Timestamp timestamp0 = model0.getCreated(); + assertNull(timestamp0); + } + + @Test(timeout = 4000) + public void test30() throws Throwable { + Model model0 = new Model(); + String string0 = model0.getModelName(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test31() throws Throwable { + Model model0 = new Model(); + model0.setId(2803); + int int0 = model0.getId(); + assertEquals(2803, int0); + } +} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/HibernateUtilESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelESTestscaffolding.java similarity index 64% rename from mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/HibernateUtilESTestscaffolding.java rename to mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelESTestscaffolding.java index e2e9b60026..d9576e0681 100644 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/HibernateUtilESTestscaffolding.java +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelESTestscaffolding.java @@ -1,10 +1,10 @@ /** - * Scaffolding file used to store all the setups needed to run + * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite - * Wed Dec 14 15:15:07 GMT 2016 + * Wed Feb 22 09:32:26 GMT 2017 */ -package org.openecomp.mso.requestsdb; +package org.openecomp.mso.db.catalog.beans; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; @@ -12,96 +12,95 @@ import org.junit.Before; import org.junit.After; import org.junit.AfterClass; import org.evosuite.runtime.sandbox.Sandbox; -import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; @EvoSuiteClassExclude -public class HibernateUtilESTestscaffolding { +public class ModelESTestscaffolding { - @org.junit.Rule + @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.requestsdb.HibernateUtil"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.db.catalog.beans.Model"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; + org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); + } - @Before - public void initTestCase(){ + @Before + public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } - @After - public void doneWithTestCase(){ + @After + public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(HibernateUtilESTestscaffolding.class.getClassLoader() , + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ModelESTestscaffolding.class.getClassLoader() , "org.openecomp.mso.logger.MessageEnum", "com.att.eelf.i18n.EELFResolvableErrorEnum", "org.openecomp.mso.logger.MsoLogger$Catalog", "org.openecomp.mso.logger.MsoLogger$StatusCode", - "org.hibernate.SessionFactory", "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.openecomp.mso.db.catalog.beans.Model", "com.att.eelf.configuration.EELFManager", "com.att.eelf.configuration.EELFLogger", "com.att.eelf.i18n.EELFMsgs", "org.openecomp.mso.entity.MsoRequest", "com.att.eelf.configuration.EELFLogger$Level", - "org.openecomp.mso.requestsdb.HibernateUtil", + "org.openecomp.mso.db.catalog.beans.ServiceRecipe", "org.openecomp.mso.logger.MsoLogger$ResponseCode", "com.att.eelf.configuration.SLF4jWrapper", "com.att.eelf.i18n.EELFResourceManager", "org.openecomp.mso.logger.MsoLogger", "org.openecomp.mso.logger.MsoLogger$ErrorCode" ); - } + } private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(HibernateUtilESTestscaffolding.class.getClassLoader()); + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ModelESTestscaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "com.att.eelf.i18n.EELFResourceManager", - "org.openecomp.mso.logger.MessageEnum", "org.openecomp.mso.logger.MsoLogger$Catalog", "org.openecomp.mso.logger.MsoLogger", + "com.att.eelf.i18n.EELFResourceManager", "com.att.eelf.i18n.EELFMsgs", "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", "com.att.eelf.configuration.EELFLogger$Level", "com.att.eelf.configuration.EELFManager", - "org.openecomp.mso.logger.MsoLogger$ErrorCode", - "org.openecomp.mso.requestsdb.HibernateUtil" + "org.openecomp.mso.logger.MessageEnum", + "org.openecomp.mso.db.catalog.beans.ServiceRecipe" ); } } diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelRecipeESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelRecipeESTest.java new file mode 100644 index 0000000000..d148e94246 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ModelRecipeESTest.java @@ -0,0 +1,287 @@ +/* + * This file was automatically generated by EvoSuite + * Wed Feb 22 09:32:08 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import static org.evosuite.runtime.EvoAssertions.*; +import java.sql.Timestamp; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class ModelRecipeESTest extends ModelRecipeESTestscaffolding { + + @Test(timeout = 4000) + public void test00() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + modelRecipe0.setSchemaVersion("594t4m7A7,kaNK"); + String string0 = modelRecipe0.getSchemaVersion(); + assertEquals("594t4m7A7,kaNK", string0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + Integer integer0 = new Integer(0); + modelRecipe0.setRecipeTimeout(integer0); + Integer integer1 = modelRecipe0.getRecipeTimeout(); + assertEquals(0, (int)integer1); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + Integer integer0 = new Integer(1303); + modelRecipe0.setRecipeTimeout(integer0); + Integer integer1 = modelRecipe0.getRecipeTimeout(); + assertEquals(1303, (int)integer1); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + Integer integer0 = new Integer((-8)); + modelRecipe0.setRecipeTimeout(integer0); + Integer integer1 = modelRecipe0.getRecipeTimeout(); + assertEquals((-8), (int)integer1); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + modelRecipe0.setOrchestrationUri("+"); + String string0 = modelRecipe0.getOrchestrationUri(); + assertEquals("+", string0); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + modelRecipe0.setModelParamXSD(""); + String string0 = modelRecipe0.getModelParamXSD(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + Integer integer0 = new Integer(1); + modelRecipe0.setModelId(integer0); + Integer integer1 = modelRecipe0.getModelId(); + assertEquals(1, (int)integer1); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + Integer integer0 = new Integer((-8)); + modelRecipe0.setModelId(integer0); + Integer integer1 = modelRecipe0.getModelId(); + assertEquals((-8), (int)integer1); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + modelRecipe0.setId(2372); + int int0 = modelRecipe0.getId(); + assertEquals(2372, int0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + modelRecipe0.setId((-438)); + int int0 = modelRecipe0.getId(); + assertEquals((-438), int0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + ModelRecipe modelRecipe0 = new ModelRecipe(); + modelRecipe0.setDescription("D|`) null); + ArrayList arrayList0 = serviceMacroHolder0.getVnfResources(); + assertNull(arrayList0); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + VnfResource vnfResource0 = new VnfResource(); + serviceMacroHolder0.addVnfResource(vnfResource0); + ArrayList arrayList0 = serviceMacroHolder0.getVnfResources(); + assertEquals(1, arrayList0.size()); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + Service service0 = serviceMacroHolder0.getService(); + assertNull(service0); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + service0.setId(1124); + Service service1 = serviceMacroHolder0.getService(); + assertNull(service1.getServiceNameVersionId()); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + service0.setId((-760)); + Service service1 = serviceMacroHolder0.getService(); + assertNull(service1.getServiceNameVersionId()); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + NetworkResourceCustomization networkResourceCustomization0 = new NetworkResourceCustomization(); + serviceMacroHolder0.addNetworkResourceCustomization(networkResourceCustomization0); + ArrayList arrayList0 = serviceMacroHolder0.getNetworkResourceCustomization(); + assertFalse(arrayList0.isEmpty()); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + serviceMacroHolder0.setAllottedResourceCustomization((ArrayList) null); + ArrayList arrayList0 = serviceMacroHolder0.getAllottedResourceCustomization(); + assertNull(arrayList0); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + AllottedResourceCustomization allottedResourceCustomization0 = new AllottedResourceCustomization(); + serviceMacroHolder0.addAllottedResourceCustomization(allottedResourceCustomization0); + ArrayList arrayList0 = serviceMacroHolder0.getAllottedResourceCustomization(); + assertFalse(arrayList0.isEmpty()); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + serviceMacroHolder0.setAllottedResourceCustomization((ArrayList) null); + String string0 = serviceMacroHolder0.toString(); + assertEquals("ServicePlus: service: nullnone", string0); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + serviceMacroHolder0.setNetworkResourceCustomization((ArrayList) null); + String string0 = serviceMacroHolder0.toString(); + assertEquals("ServicePlus: service: nullnone", string0); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + Service service0 = mock(Service.class, new ViolatedAssumptionAnswer()); + doReturn((String) null).when(service0).toString(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + ArrayList arrayList0 = new ArrayList(); + arrayList0.add((Object) serviceMacroHolder0); + PrivateAccess.setVariable((Class) ServiceMacroHolder.class, serviceMacroHolder0, "vnfResources", (Object) arrayList0); + // Undeclared exception! + try { + serviceMacroHolder0.toString(); + fail("Expecting exception: ClassCastException"); + + } catch(ClassCastException e) { + // + // org.openecomp.mso.db.catalog.beans.ServiceMacroHolder cannot be cast to org.openecomp.mso.db.catalog.beans.VnfResource + // + verifyException("org.openecomp.mso.db.catalog.beans.ServiceMacroHolder", e); + } + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + serviceMacroHolder0.setVnfResources((ArrayList) null); + String string0 = serviceMacroHolder0.toString(); + assertEquals("ServicePlus: service: nullnone", string0); + } + + @Test(timeout = 4000) + public void test12() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + // Undeclared exception! + try { + serviceMacroHolder0.toString(); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.openecomp.mso.db.catalog.beans.Service", e); + } + } + + @Test(timeout = 4000) + public void test13() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + AllottedResourceCustomization allottedResourceCustomization0 = new AllottedResourceCustomization(); + serviceMacroHolder0.addAllottedResourceCustomization(allottedResourceCustomization0); + String string0 = serviceMacroHolder0.toString(); + assertEquals("ServicePlus: service: nullnoneAllottedResourceCustomizations:ARC[0]: modelName=null,modelVersion=null,version=null,modelUuid=null,modelInvariantUuid=null,modelCustomizationUuid=null,modelInstanceName=null,description=null,modelInstanceName=null,created=null", string0); + } + + @Test(timeout = 4000) + public void test14() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + NetworkResourceCustomization networkResourceCustomization0 = new NetworkResourceCustomization(); + serviceMacroHolder0.addNetworkResourceCustomization(networkResourceCustomization0); + String string0 = serviceMacroHolder0.toString(); + assertEquals("ServicePlus: service: nullnoneNetworkResourceCustomizations:NRC[0]: modelName=nullmodelUuid=nullmodelUuid=nullmodelInvariantUuid=nullmodelVersion=nullmodelCustomizationUuid=nullmodelInstanceName=nullnetworkResourceId=0networkType=null", string0); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + NetworkResourceCustomization networkResourceCustomization0 = new NetworkResourceCustomization(); + serviceMacroHolder0.setNetworkResourceCustomization((ArrayList) null); + serviceMacroHolder0.addNetworkResourceCustomization(networkResourceCustomization0); + assertNull(networkResourceCustomization0.getModelInstanceName()); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + serviceMacroHolder0.setVnfResources((ArrayList) null); + VnfResource vnfResource0 = new VnfResource(); + serviceMacroHolder0.addVnfResource(vnfResource0); + assertNull(vnfResource0.getModelCustomizationUuid()); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + VnfResource vnfResource0 = new VnfResource(); + serviceMacroHolder0.addVnfResource(vnfResource0); + String string0 = serviceMacroHolder0.toString(); + assertEquals("ServicePlus: service: nullVnfResources: , vnfResource[0]:VNF=null,version=null,mode=null,template=null,envtId=null,asdcUuid=null,aicVersionMin=null,aicVersionMax=null,modelInvariantUuid=null,modelVersion=null,modelCustomizationName=null,modelName=null,serviceModelInvariantUUID=null,modelCustomizationUuid=nullVfModules: NONE", string0); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + serviceMacroHolder0.addVnfResource((VnfResource) null); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + serviceMacroHolder0.setNetworkResourceCustomization((ArrayList) null); + ArrayList arrayList0 = serviceMacroHolder0.getNetworkResourceCustomization(); + assertNull(arrayList0); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + Service service1 = serviceMacroHolder0.getService(); + assertNull(service1.getModelInvariantUUID()); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + ArrayList arrayList0 = serviceMacroHolder0.getNetworkResourceCustomization(); + assertEquals(0, arrayList0.size()); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + serviceMacroHolder0.setAllottedResourceCustomization((ArrayList) null); + AllottedResourceCustomization allottedResourceCustomization0 = new AllottedResourceCustomization(); + serviceMacroHolder0.addAllottedResourceCustomization(allottedResourceCustomization0); + assertNull(allottedResourceCustomization0.getVersion()); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(); + Service service0 = new Service(); + serviceMacroHolder0.setService(service0); + assertNull(service0.getModelInvariantUUID()); + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + ArrayList arrayList0 = serviceMacroHolder0.getAllottedResourceCustomization(); + assertEquals(0, arrayList0.size()); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + Service service0 = new Service(); + ServiceMacroHolder serviceMacroHolder0 = new ServiceMacroHolder(service0); + ArrayList arrayList0 = serviceMacroHolder0.getVnfResources(); + assertTrue(arrayList0.isEmpty()); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolderESTestscaffolding.java similarity index 51% rename from bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTestscaffolding.java rename to mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolderESTestscaffolding.java index 2449157b43..43ccd7b728 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/BPMNLoggerESTestscaffolding.java +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolderESTestscaffolding.java @@ -1,10 +1,10 @@ /** - * Scaffolding file used to store all the setups needed to run + * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite - * Mon Nov 14 11:35:04 GMT 2016 + * Tue Feb 21 15:49:25 GMT 2017 */ -package org.openecomp.mso.bpmn.core; +package org.openecomp.mso.db.catalog.beans; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; @@ -14,82 +14,73 @@ import org.junit.AfterClass; import org.evosuite.runtime.sandbox.Sandbox; @EvoSuiteClassExclude -public class BPMNLoggerESTestscaffolding { +public class ServiceMacroHolderESTestscaffolding { - @org.junit.Rule + @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.bpmn.core.BPMNLogger"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.db.catalog.beans.ServiceMacroHolder"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; + org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); + } - @Before - public void initTestCase(){ + @Before + public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } - @After - public void doneWithTestCase(){ + @After + public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } - + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(BPMNLoggerESTestscaffolding.class.getClassLoader() , - "org.openecomp.mso.logger.MsoLogger", - "org.openecomp.mso.logger.MessageEnum", + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ServiceMacroHolderESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.VfModule", "com.att.eelf.i18n.EELFResolvableErrorEnum", - "org.openecomp.mso.logger.MsoLogger$ResponseCode", - "org.openecomp.mso.entity.MsoRequest", - "org.openecomp.mso.logger.MsoLogger$StatusCode", - "com.att.eelf.i18n.EELFResourceManager$RESOURCE_TYPES", - "com.att.eelf.configuration.EELFManager", - "org.openecomp.mso.logger.MsoLogger$ErrorCode", - "com.att.eelf.configuration.EELFLogger", - "com.att.eelf.i18n.EELFMsgs", - "com.att.eelf.configuration.EELFLogger$Level", - "org.openecomp.mso.logger.MsoLogger$Catalog", - "com.att.eelf.configuration.SLF4jWrapper", - "org.openecomp.mso.bpmn.core.BPMNLogger", - "com.att.eelf.i18n.EELFResourceManager" + "org.openecomp.mso.db.catalog.beans.Service", + "org.openecomp.mso.db.catalog.beans.NetworkResource", + "org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization", + "org.openecomp.mso.db.catalog.utils.MavenLikeVersioning", + "org.openecomp.mso.db.catalog.beans.VnfResource", + "org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization", + "org.openecomp.mso.db.catalog.beans.ServiceMacroHolder" ); - } + } private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(BPMNLoggerESTestscaffolding.class.getClassLoader()); + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ServiceMacroHolderESTestscaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "org.openecomp.mso.logger.MsoLogger$Catalog", @@ -100,7 +91,7 @@ public class BPMNLoggerESTestscaffolding { "com.att.eelf.configuration.EELFLogger$Level", "com.att.eelf.configuration.EELFManager", "org.openecomp.mso.logger.MessageEnum", - "org.openecomp.mso.bpmn.core.BPMNLogger" + "org.openecomp.mso.db.catalog.beans.ServiceRecipe" ); } } diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTest.java new file mode 100644 index 0000000000..84fbcb5391 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTest.java @@ -0,0 +1,95 @@ +/* + * This file was automatically generated by EvoSuite + * Wed Feb 22 09:33:37 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import java.sql.Timestamp; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class ServiceToAllottedResourcesESTest extends ServiceToAllottedResourcesESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + serviceToAllottedResources0.setServiceModelUuid("serviceModelUuid=nullarModelCustomizationUuid=null"); + String string0 = serviceToAllottedResources0.getServiceModelUuid(); + assertEquals("serviceModelUuid=nullarModelCustomizationUuid=null", string0); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + Timestamp timestamp0 = new Timestamp(0L); + serviceToAllottedResources0.setCreated(timestamp0); + Timestamp timestamp1 = serviceToAllottedResources0.getCreated(); + assertEquals("1970-01-01 00:00:00.0", timestamp1.toString()); + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + serviceToAllottedResources0.setArModelCustomizationUuid("D7q@"); + String string0 = serviceToAllottedResources0.getArModelCustomizationUuid(); + assertEquals("D7q@", string0); + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + serviceToAllottedResources0.setArModelCustomizationUuid(""); + String string0 = serviceToAllottedResources0.getArModelCustomizationUuid(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + String string0 = serviceToAllottedResources0.toString(); + assertEquals("serviceModelUuid=nullarModelCustomizationUuid=null", string0); + } + + @Test(timeout = 4000) + public void test5() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + serviceToAllottedResources0.setServiceModelUuid(""); + String string0 = serviceToAllottedResources0.getServiceModelUuid(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test6() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + Timestamp timestamp0 = new Timestamp((-683L)); + serviceToAllottedResources0.setCreated(timestamp0); + Timestamp timestamp1 = serviceToAllottedResources0.getCreated(); + assertEquals("1969-12-31 23:59:59.317", timestamp1.toString()); + } + + @Test(timeout = 4000) + public void test7() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + String string0 = serviceToAllottedResources0.getServiceModelUuid(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test8() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + String string0 = serviceToAllottedResources0.getArModelCustomizationUuid(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test9() throws Throwable { + ServiceToAllottedResources serviceToAllottedResources0 = new ServiceToAllottedResources(); + Timestamp timestamp0 = serviceToAllottedResources0.getCreated(); + assertNull(timestamp0); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTestscaffolding.java similarity index 52% rename from bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTestscaffolding.java rename to mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTestscaffolding.java index 03cb94f4e6..14ff62fb02 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/MissingInjectedFieldExceptionESTestscaffolding.java +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToAllottedResourcesESTestscaffolding.java @@ -1,10 +1,10 @@ /** - * Scaffolding file used to store all the setups needed to run + * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite - * Mon Nov 14 11:35:52 GMT 2016 + * Wed Feb 22 09:33:37 GMT 2017 */ -package org.openecomp.mso.bpmn.core; +package org.openecomp.mso.db.catalog.beans; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; @@ -14,72 +14,68 @@ import org.junit.AfterClass; import org.evosuite.runtime.sandbox.Sandbox; @EvoSuiteClassExclude -public class MissingInjectedFieldExceptionESTestscaffolding { +public class ServiceToAllottedResourcesESTestscaffolding { - @org.junit.Rule + @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.bpmn.core.MissingInjectedFieldException"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; + org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); + } - @Before - public void initTestCase(){ + @Before + public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } - @After - public void doneWithTestCase(){ + @After + public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } - + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(MissingInjectedFieldExceptionESTestscaffolding.class.getClassLoader() , - "org.openecomp.mso.bpmn.core.BadInjectedFieldException", - "org.openecomp.mso.bpmn.core.MissingInjectedFieldException" + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ServiceToAllottedResourcesESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources" ); - } + } private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(MissingInjectedFieldExceptionESTestscaffolding.class.getClassLoader()); + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ServiceToAllottedResourcesESTestscaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "org.openecomp.mso.bpmn.core.BadInjectedFieldException", - "org.openecomp.mso.bpmn.core.MissingInjectedFieldException" + "org.openecomp.mso.db.catalog.beans.ServiceToAllottedResources" ); } } diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTest.java new file mode 100644 index 0000000000..aa2ba2a488 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTest.java @@ -0,0 +1,95 @@ +/* + * This file was automatically generated by EvoSuite + * Wed Feb 22 09:34:56 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.beans; + +import org.junit.Test; +import static org.junit.Assert.*; +import java.sql.Timestamp; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class ServiceToNetworksESTest extends ServiceToNetworksESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + serviceToNetworks0.setServiceModelUuid("XcrRZj-Y)7"); + String string0 = serviceToNetworks0.getServiceModelUuid(); + assertEquals("XcrRZj-Y)7", string0); + } + + @Test(timeout = 4000) + public void test1() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + serviceToNetworks0.setNetworkModelCustomizationUuid("XcrRZj-Y)7"); + String string0 = serviceToNetworks0.getNetworkModelCustomizationUuid(); + assertEquals("XcrRZj-Y)7", string0); + } + + @Test(timeout = 4000) + public void test2() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + Timestamp timestamp0 = new Timestamp(4701L); + serviceToNetworks0.setCreated(timestamp0); + Timestamp timestamp1 = serviceToNetworks0.getCreated(); + assertEquals(701000000, timestamp1.getNanos()); + } + + @Test(timeout = 4000) + public void test3() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + Timestamp timestamp0 = serviceToNetworks0.getCreated(); + assertNull(timestamp0); + } + + @Test(timeout = 4000) + public void test4() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + String string0 = serviceToNetworks0.getNetworkModelCustomizationUuid(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test5() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + String string0 = serviceToNetworks0.getServiceModelUuid(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test6() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + String string0 = serviceToNetworks0.toString(); + assertEquals("ServiceToNetworks mapping: serviceModelUuid=null,networkModelCustomizationUuid=null", string0); + } + + @Test(timeout = 4000) + public void test7() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + Timestamp timestamp0 = new Timestamp(0L); + serviceToNetworks0.setCreated(timestamp0); + Timestamp timestamp1 = serviceToNetworks0.getCreated(); + assertEquals(0, timestamp1.getNanos()); + } + + @Test(timeout = 4000) + public void test8() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + serviceToNetworks0.setNetworkModelCustomizationUuid(""); + String string0 = serviceToNetworks0.getNetworkModelCustomizationUuid(); + assertEquals("", string0); + } + + @Test(timeout = 4000) + public void test9() throws Throwable { + ServiceToNetworks serviceToNetworks0 = new ServiceToNetworks(); + serviceToNetworks0.setServiceModelUuid(""); + String string0 = serviceToNetworks0.getServiceModelUuid(); + assertEquals("", string0); + } +} diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTestscaffolding.java similarity index 56% rename from bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTestscaffolding.java rename to mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTestscaffolding.java index 88e0e0f96f..ba0c5d7d5b 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/WorkflowExceptionESTestscaffolding.java +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/ServiceToNetworksESTestscaffolding.java @@ -1,10 +1,10 @@ /** - * Scaffolding file used to store all the setups needed to run + * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite - * Mon Nov 14 11:35:37 GMT 2016 + * Wed Feb 22 09:34:56 GMT 2017 */ -package org.openecomp.mso.bpmn.core; +package org.openecomp.mso.db.catalog.beans; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; @@ -14,70 +14,68 @@ import org.junit.AfterClass; import org.evosuite.runtime.sandbox.Sandbox; @EvoSuiteClassExclude -public class WorkflowExceptionESTestscaffolding { +public class ServiceToNetworksESTestscaffolding { - @org.junit.Rule + @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); - private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); - @BeforeClass - public static void initEvoSuiteFramework() { - org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.bpmn.core.WorkflowException"; - org.evosuite.runtime.GuiSupport.initialize(); - org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; - org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; - org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; - org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; - org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); - org.evosuite.runtime.classhandling.JDKClassResetter.init(); + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.db.catalog.beans.ServiceToNetworks"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; + org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); initializeClasses(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - } + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } - @AfterClass - public static void clearEvoSuiteFramework(){ - Sandbox.resetDefaultSecurityManager(); - java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); - } + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); + } - @Before - public void initTestCase(){ + @Before + public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); - org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); - - org.evosuite.runtime.GuiSupport.setHeadless(); - org.evosuite.runtime.Runtime.getInstance().resetRuntime(); - org.evosuite.runtime.agent.InstrumentingAgent.activate(); - } + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } - @After - public void doneWithTestCase(){ + @After + public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); - org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); - org.evosuite.runtime.classhandling.JDKClassResetter.reset(); - resetClasses(); - org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); - org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); - org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); - } - + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } private static void initializeClasses() { - org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(WorkflowExceptionESTestscaffolding.class.getClassLoader() , - "org.openecomp.mso.bpmn.core.WorkflowException" + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ServiceToNetworksESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.beans.ServiceToNetworks" ); - } + } private static void resetClasses() { - org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(WorkflowExceptionESTestscaffolding.class.getClassLoader()); + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ServiceToNetworksESTestscaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( - "org.openecomp.mso.bpmn.core.WorkflowException" + "org.openecomp.mso.db.catalog.beans.ServiceToNetworks" ); } } diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleESTest.java index 1a1c6ea2c2..1ab15a22fb 100644 --- a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleESTest.java +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/beans/VfModuleESTest.java @@ -1,6 +1,6 @@ /* * This file was automatically generated by EvoSuite - * Mon Nov 14 08:19:11 GMT 2016 + * Tue Feb 21 15:51:08 GMT 2017 */ package org.openecomp.mso.db.catalog.beans; @@ -8,719 +8,971 @@ package org.openecomp.mso.db.catalog.beans; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; - import java.sql.Timestamp; import java.time.Instant; +import java.time.temporal.ChronoField; +import java.time.temporal.ChronoUnit; +import java.time.temporal.TemporalField; +import java.time.temporal.UnsupportedTemporalTypeException; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.PrivateAccess; import org.evosuite.runtime.System; import org.evosuite.runtime.mock.java.time.MockInstant; +import org.evosuite.runtime.mock.java.util.MockDate; import org.junit.runner.RunWith; +import org.openecomp.mso.db.catalog.beans.VfModule; -@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) public class VfModuleESTest extends VfModuleESTestscaffolding { - @Test(timeout = 4000) - public void test00() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setModelVersion("EzJ)~3C++"); - Integer integer0 = new Integer((-1)); - vfModule0.setVnfResourceId(integer0); - vfModule0.getModelInvariantUuid(); - vfModule0.getModelInvariantUuid(); - VfModule vfModule1 = new VfModule(); - vfModule1.setDescription(""); - vfModule1.setIsBase((-1)); - Integer integer1 = new Integer((-289)); - vfModule1.setTemplateId(integer1); - vfModule1.getTemplateId(); - vfModule1.setModelName("Yp{,,+-pFJp!Ym6r^"); - vfModule1.getDescription(); - vfModule0.setId((-1)); - vfModule0.setId((-4103)); - vfModule0.getId(); - vfModule1.getVnfResourceId(); - vfModule1.setTemplateId((Integer) null); - Timestamp timestamp0 = new Timestamp((-3970L)); - vfModule0.setCreated(timestamp0); - } - - @Test(timeout = 4000) - public void test01() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.isTheSameVersion("1&T-qG"); - Integer integer0 = new Integer((-385)); - Integer integer1 = Integer.valueOf((-385)); - Integer.toUnsignedString((-1)); - Integer.getInteger("", integer1); - vfModule0.setVolTemplateId(integer0); - vfModule0.setModelInvariantUuid("1&T-qG"); - vfModule0.toString(); - vfModule0.getIsBase(); - vfModule0.setModelVersion("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=-385,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.setType("wO"); - vfModule0.getType(); - vfModule0.isBase(); - vfModule0.getIsBase(); - vfModule0.setAsdcUuid("VF="); - vfModule0.getModelVersion(); - vfModule0.setId(1); - vfModule0.setModelName("VF="); - vfModule0.getVolEnvironmentId(); - vfModule0.setVolTemplateId((Integer) null); - vfModule0.setAsdcUuid(""); - vfModule0.setModelVersion("1&T-qG"); - vfModule0.isBase(); - vfModule0.getEnvironmentId(); - vfModule0.toString(); - vfModule0.getDescription(); - vfModule0.setType(""); - vfModule0.setVnfResourceId(integer1); - System.setCurrentTimeMillis((-1L)); - vfModule0.getVnfResourceId(); - } - - @Test(timeout = 4000) - public void test02() throws Throwable { - System.setCurrentTimeMillis(1L); - VfModule vfModule0 = new VfModule(); - vfModule0.setModelInvariantUuid("57f9"); - vfModule0.setModelName(""); - vfModule0.getDescription(); - vfModule0.toString(); - vfModule0.setType(""); - vfModule0.getDescription(); - vfModule0.getCreated(); - vfModule0.setCreated((Timestamp) null); - Integer integer0 = new Integer(2109); - Integer integer1 = new Integer(1); - Integer.getInteger("D}'htOb?", integer1); - vfModule0.setVolEnvironmentId(integer0); - vfModule0.getVnfResourceId(); - vfModule0.getModelName(); - System.setCurrentTimeMillis(0L); - vfModule0.getModelName(); - vfModule0.getCreated(); - vfModule0.getModelName(); - vfModule0.getDescription(); - vfModule0.getDescription(); - vfModule0.getModelName(); - vfModule0.toString(); - vfModule0.getCreated(); - System.setCurrentTimeMillis(1L); - } - - @Test(timeout = 4000) - public void test03() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setId(600); - vfModule0.toString(); - Integer integer0 = new Integer((-1)); - Integer.divideUnsigned((-1), 1); - Integer.min((-1), 1); - Integer.max(2123, 600); - Integer integer1 = new Integer(2123); - vfModule0.setEnvironmentId(integer1); - vfModule0.setEnvironmentId(integer0); - vfModule0.isMoreRecentThan(",volEnvtId="); - vfModule0.getId(); - Integer.compareUnsigned(467, (-1)); - vfModule0.setEnvironmentId(integer0); - VfModule vfModule1 = new VfModule(); - vfModule1.isMoreRecentThan("VF=null,modelName=null,version=null,id=600,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule1.toString(); - VfModule vfModule2 = new VfModule(); - vfModule0.getEnvironmentId(); - vfModule2.getDescription(); - vfModule2.setDescription((String) null); - vfModule2.setModelVersion(", description="); - vfModule2.toString(); - vfModule1.getModelInvariantUuid(); - vfModule1.toString(); - vfModule1.getEnvironmentId(); - vfModule0.setAsdcUuid(""); - vfModule0.setDescription((String) null); - vfModule0.getIsBase(); - vfModule0.getAsdcUuid(); - vfModule0.getCreated(); - } - - @Test(timeout = 4000) - public void test04() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.getDescription(); - Integer integer0 = new Integer(0); - vfModule0.setVolTemplateId(integer0); - vfModule0.setVersion((String) null); - vfModule0.getDescription(); - vfModule0.setAsdcUuid((String) null); - Integer integer1 = new Integer(0); - Integer.getInteger((String) null); - vfModule0.setVnfResourceId(integer1); - vfModule0.setIsBase(1); - vfModule0.getVolEnvironmentId(); - vfModule0.setId(0); - vfModule0.getModelInvariantUuid(); - vfModule0.getEnvironmentId(); - vfModule0.getIsBase(); - vfModule0.setTemplateId(integer1); - vfModule0.getCreated(); - vfModule0.getId(); - vfModule0.getCreated(); - vfModule0.getId(); - vfModule0.setModelInvariantUuid((String) null); - vfModule0.getAsdcUuid(); - vfModule0.getVnfResourceId(); - } - - @Test(timeout = 4000) - public void test05() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.getDescription(); - Integer integer0 = new Integer(0); - Integer.divideUnsigned(1, 659); - vfModule0.setVolTemplateId(integer0); - vfModule0.setVersion((String) null); - vfModule0.getDescription(); - vfModule0.setAsdcUuid((String) null); - Integer integer1 = new Integer(0); - Integer.getInteger((String) null); - vfModule0.setVnfResourceId(integer1); - vfModule0.setIsBase(1); - vfModule0.getVolEnvironmentId(); - vfModule0.setId(0); - vfModule0.getModelInvariantUuid(); - vfModule0.getEnvironmentId(); - vfModule0.getIsBase(); - vfModule0.setTemplateId(integer1); - vfModule0.getCreated(); - vfModule0.getId(); - vfModule0.getCreated(); - vfModule0.getId(); - vfModule0.setModelInvariantUuid((String) null); - vfModule0.getAsdcUuid(); - System.setCurrentTimeMillis((-1L)); - vfModule0.getTemplateId(); - vfModule0.getDescription(); - vfModule0.getAsdcUuid(); - } - - @Test(timeout = 4000) - public void test06() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.getVolEnvironmentId(); - vfModule0.setEnvironmentId((Integer) null); - assertNull(vfModule0.getModelVersion()); - - Integer integer0 = new Integer(1); - Integer.getInteger((String) null, (Integer) null); - vfModule0.setEnvironmentId(integer0); - vfModule0.setModelVersion((String) null); - vfModule0.setId(171); - vfModule0.toString(); - vfModule0.getEnvironmentId(); - } - - @Test(timeout = 4000) - public void test07() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = Integer.valueOf((-2041)); - Integer.compareUnsigned((-2041), (-1)); - vfModule0.setTemplateId(integer0); - vfModule0.setIsBase(3154); - vfModule0.setModelInvariantUuid(""); - vfModule0.setDescription("nPVyq+_;@IZP:L"); - vfModule0.setId(883); - vfModule0.toString(); - vfModule0.setIsBase((-2041)); - vfModule0.getTemplateId(); - vfModule0.getModelName(); - vfModule0.getVnfResourceId(); - vfModule0.toString(); - vfModule0.isBase(); - } - - @Test(timeout = 4000) - public void test08() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setIsBase(0); - vfModule0.isMoreRecentThan("."); - vfModule0.toString(); - vfModule0.setIsBase((-1465)); - vfModule0.setModelInvariantUuid("u5L"); - vfModule0.getIsBase(); - vfModule0.setId(0); - vfModule0.getVolEnvironmentId(); - System.setCurrentTimeMillis((-1465)); - vfModule0.setModelVersion("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.setVersion(""); - vfModule0.toString(); - vfModule0.getAsdcUuid(); - vfModule0.getEnvironmentId(); - vfModule0.setVolEnvironmentId((Integer) null); - vfModule0.getVnfResourceId(); - vfModule0.getDescription(); - vfModule0.getVolEnvironmentId(); - vfModule0.getCreated(); - } - - @Test(timeout = 4000) - public void test09() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.isMoreRecentThan("zL"); - vfModule0.getType(); - vfModule0.setModelName((String) null); - Integer integer0 = new Integer(0); - Integer.getInteger("zL", (Integer) null); - vfModule0.setType(""); - Integer.sum(34, 34); - Integer.min(0, 2510); - Integer.divideUnsigned(0, (-1)); - Integer.compare(0, 0); - vfModule0.setVolEnvironmentId(integer0); - vfModule0.setCreated((Timestamp) null); - vfModule0.getCreated(); - vfModule0.getIsBase(); - vfModule0.setAsdcUuid(""); - vfModule0.setId(0); - vfModule0.getModelVersion(); - vfModule0.setCreated((Timestamp) null); - vfModule0.setModelVersion((String) null); - vfModule0.getEnvironmentId(); - vfModule0.getVolEnvironmentId(); - vfModule0.getType(); - vfModule0.setAsdcUuid((String) null); - } - - @Test(timeout = 4000) - public void test10() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setModelInvariantUuid(""); - vfModule0.setType(",modelName="); - vfModule0.setModelVersion(""); - vfModule0.setModelName("+cQA/1wAo}o/T7,S"); - vfModule0.getVolTemplateId(); - vfModule0.getVolEnvironmentId(); - vfModule0.getVolTemplateId(); - vfModule0.getModelInvariantUuid(); - } - - @Test(timeout = 4000) - public void test11() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer((-495)); - Integer.getInteger("M0@M@T", (-495)); - vfModule0.setVolEnvironmentId(integer0); - vfModule0.setId(892); - vfModule0.getTemplateId(); - vfModule0.toString(); - vfModule0.getVolEnvironmentId(); - vfModule0.setDescription("M0@M@T"); - vfModule0.getTemplateId(); - } - - @Test(timeout = 4000) - public void test12() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer(2707); - Integer integer1 = new Integer((-1)); - Integer.getInteger("", integer1); - vfModule0.setVolEnvironmentId(integer0); - vfModule0.getModelName(); - vfModule0.isMoreRecentThan(""); - vfModule0.getAsdcUuid(); - vfModule0.isMoreRecentThan((String) null); - vfModule0.getVnfResourceId(); - vfModule0.toString(); - vfModule0.getCreated(); - vfModule0.getVolEnvironmentId(); - vfModule0.getModelName(); - vfModule0.getVnfResourceId(); - vfModule0.getVnfResourceId(); - vfModule0.getModelName(); - vfModule0.getAsdcUuid(); - vfModule0.getCreated(); - } - - @Test(timeout = 4000) - public void test13() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.isMoreRecentThan((String) null); - vfModule0.getCreated(); - vfModule0.setVolEnvironmentId((Integer) null); - vfModule0.getVnfResourceId(); - Integer integer0 = new Integer(2983); - vfModule0.isTheSameVersion((String) null); - vfModule0.setDescription(")b,;fs\"&l\"#:Z"); - Integer.min(296, 0); - vfModule0.setTemplateId(integer0); - vfModule0.setType(")b,;fs\"&l\"#:Z"); - vfModule0.setModelInvariantUuid(")b,;fs\"&l\"#:Z"); - vfModule0.getId(); - vfModule0.setModelVersion(""); - vfModule0.getTemplateId(); - vfModule0.getModelVersion(); - vfModule0.setIsBase(2983); - Integer integer1 = new Integer(0); - try { - Integer.decode("X&-4c&g>;lQ`"); - fail("Expecting exception: NumberFormatException"); - - } catch(NumberFormatException e) { - // - // For input string: \"X&-4c&g>;lQ`\" - // - verifyException("java.lang.NumberFormatException", e); - } - } - - @Test(timeout = 4000) - public void test14() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.toString(); - vfModule0.isMoreRecentThan("ql"); - vfModule0.toString(); - vfModule0.isMoreRecentThan("v;ese"); - vfModule0.getCreated(); - Integer integer0 = new Integer(0); - Integer.getInteger("v;ese", 0); - vfModule0.setVolTemplateId(integer0); - vfModule0.isBase(); - vfModule0.getIsBase(); - vfModule0.setAsdcUuid("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.getId(); - vfModule0.getTemplateId(); - vfModule0.getVolTemplateId(); - vfModule0.getAsdcUuid(); - vfModule0.setId(0); - Integer integer1 = new Integer(0); - try { - Integer.parseUnsignedInt("ql", (-122)); - fail("Expecting exception: NumberFormatException"); - - } catch(NumberFormatException e) { - // - // radix -122 less than Character.MIN_RADIX - // - verifyException("java.lang.Integer", e); - } - } - - @Test(timeout = 4000) - public void test15() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer((-1847)); - vfModule0.setTemplateId(integer0); - vfModule0.setVolTemplateId(integer0); - vfModule0.getVolTemplateId(); - try { - Integer.decode(""); - fail("Expecting exception: NumberFormatException"); - - } catch(NumberFormatException e) { - // - // Zero length string - // - verifyException("java.lang.Integer", e); - } - } - - @Test(timeout = 4000) - public void test16() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer(1); - vfModule0.setVolTemplateId(integer0); - vfModule0.setType(""); - vfModule0.setDescription(""); - vfModule0.getVolTemplateId(); - vfModule0.getTemplateId(); - vfModule0.setModelInvariantUuid(""); - vfModule0.getType(); - vfModule0.setVersion(""); - vfModule0.getEnvironmentId(); - try { - Integer.decode(""); - fail("Expecting exception: NumberFormatException"); - - } catch(NumberFormatException e) { - // - // Zero length string - // - verifyException("java.lang.Integer", e); - } - } - - @Test(timeout = 4000) - public void test17() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = Integer.valueOf(797); - vfModule0.setVnfResourceId(integer0); - vfModule0.isMoreRecentThan("xApm&c~GA&l*X$"); - vfModule0.getVnfResourceId(); - vfModule0.getModelInvariantUuid(); - } - - @Test(timeout = 4000) - public void test18() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setModelVersion(""); - Integer integer0 = new Integer(1170); - vfModule0.setVnfResourceId(integer0); - vfModule0.getCreated(); - vfModule0.setVolTemplateId(integer0); - vfModule0.setType(""); - vfModule0.setDescription(""); - vfModule0.getVnfResourceId(); - VfModule vfModule1 = new VfModule(); - vfModule1.setId((-1424)); - vfModule1.getVolTemplateId(); - vfModule1.getModelVersion(); - vfModule0.getId(); - vfModule0.setAsdcUuid(""); - } - - @Test(timeout = 4000) - public void test19() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer((-1483)); - Integer.toUnsignedString((-1742)); - Integer.toUnsignedString(0); - Integer.getInteger("", (-1483)); - vfModule0.setModelVersion("."); - Integer.divideUnsigned(0, 1371); - vfModule0.setVolTemplateId(integer0); - Integer.compare(1783, (-1404)); - vfModule0.setEnvironmentId(integer0); - vfModule0.setVersion(""); - vfModule0.getModelVersion(); - vfModule0.getId(); - } - - @Test(timeout = 4000) - public void test20() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.getId(); - vfModule0.setDescription("JZ)_Y_-H SVr5xC"); - Integer integer0 = new Integer(1266); - Integer.remainderUnsigned(0, 1266); - vfModule0.setEnvironmentId(integer0); - vfModule0.getModelInvariantUuid(); - vfModule0.setDescription((String) null); - vfModule0.getEnvironmentId(); - vfModule0.getModelName(); - vfModule0.getIsBase(); - } - - @Test(timeout = 4000) - public void test21() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setModelInvariantUuid(",version="); - vfModule0.toString(); - vfModule0.toString(); - vfModule0.toString(); - vfModule0.isTheSameVersion("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.setId(1438); - vfModule0.getVolTemplateId(); - Instant instant0 = MockInstant.ofEpochMilli(1438); - Timestamp timestamp0 = Timestamp.from(instant0); - timestamp0.clone(); - vfModule0.setCreated(timestamp0); - vfModule0.setDescription(",version="); - vfModule0.getTemplateId(); - vfModule0.getId(); - } - - @Test(timeout = 4000) - public void test22() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setModelVersion("EzJ)~3C++"); - Integer integer0 = new Integer((-1)); - vfModule0.setVnfResourceId(integer0); - vfModule0.getModelInvariantUuid(); - vfModule0.getModelInvariantUuid(); - VfModule vfModule1 = new VfModule(); - vfModule1.setIsBase((-1)); - Integer integer1 = new Integer((-289)); - vfModule1.setTemplateId(integer1); - vfModule1.getTemplateId(); - vfModule1.setModelName("Yp{,,+-pFJp!Ym6r^"); - vfModule1.getDescription(); - vfModule0.setId((-1)); - vfModule0.setId((-4103)); - vfModule0.getId(); - vfModule1.getVnfResourceId(); - vfModule1.setTemplateId((Integer) null); - Timestamp timestamp0 = new Timestamp((-3970L)); - vfModule0.setCreated(timestamp0); - } - - @Test(timeout = 4000) - public void test23() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.isTheSameVersion(", description="); - vfModule0.setType(""); - Integer integer0 = new Integer(0); - Integer.max(0, 0); - Integer.min(0, 0); - vfModule0.setEnvironmentId(integer0); - vfModule0.setDescription("Kx6@ Rh^oX; 9s(c&>|"); - vfModule0.setId((-2750)); - vfModule0.setType((String) null); - vfModule0.getDescription(); - vfModule0.setId(0); - } - - @Test(timeout = 4000) - public void test24() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setType("}f"); - vfModule0.setModelName("?2n6Dj"); - vfModule0.toString(); - vfModule0.getModelName(); - vfModule0.setAsdcUuid("?2n6Dj"); - vfModule0.getId(); - vfModule0.isTheSameVersion(""); - vfModule0.getAsdcUuid(); - vfModule0.getVolTemplateId(); - try { - Integer.parseUnsignedInt("6pu", 0); - fail("Expecting exception: NumberFormatException"); - - } catch(NumberFormatException e) { - // - // radix 0 less than Character.MIN_RADIX - // - verifyException("java.lang.Integer", e); - } - } - - @Test(timeout = 4000) - public void test25() throws Throwable { - VfModule vfModule0 = new VfModule(); - Timestamp timestamp0 = new Timestamp(0L); - timestamp0.clone(); - timestamp0.setNanos(3848); - vfModule0.setCreated(timestamp0); - vfModule0.getVolTemplateId(); - Timestamp timestamp1 = vfModule0.getCreated(); - timestamp1.toInstant(); - Integer integer0 = new Integer(719); - timestamp1.setNanos(3848); - try { - Integer.parseUnsignedInt("1\t`FE9f:0z]~"); - fail("Expecting exception: NumberFormatException"); - - } catch(NumberFormatException e) { - // - // For input string: \"1\t`FE9f:0z]~\" - // - verifyException("java.lang.NumberFormatException", e); - } - } - - @Test(timeout = 4000) - public void test26() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer(2069); - Integer.compare(0, 0); - Integer.min(2661, 2661); - Integer.max(2069, 2069); - vfModule0.setVnfResourceId(integer0); - vfModule0.setDescription(",id="); - vfModule0.isTheSameVersion(",id="); - vfModule0.isMoreRecentThan(",id="); - vfModule0.getEnvironmentId(); - vfModule0.setType("h4:pQoD8*M"); - vfModule0.getType(); - vfModule0.getType(); - } - - @Test(timeout = 4000) - public void test27() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer(0); - vfModule0.setEnvironmentId(integer0); - vfModule0.setModelInvariantUuid("H'CQI+Q^^WoGt^Q2X]"); - vfModule0.toString(); - vfModule0.getModelInvariantUuid(); - Integer integer1 = vfModule0.getEnvironmentId(); - vfModule0.setVersion(""); - Integer.getInteger("", integer0); - Integer.getInteger("", integer0); - vfModule0.setVnfResourceId(integer1); - } - - @Test(timeout = 4000) - public void test28() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.toString(); - vfModule0.setModelVersion("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.setDescription("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.setId(0); - vfModule0.getModelName(); - vfModule0.getAsdcUuid(); - Timestamp timestamp0 = new Timestamp((long) 0); - timestamp0.toLocalDateTime(); - vfModule0.setCreated(timestamp0); - vfModule0.getVolTemplateId(); - int int0 = vfModule0.getId(); - vfModule0.getTemplateId(); - vfModule0.setModelInvariantUuid((String) null); - vfModule0.setType("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - Timestamp timestamp1 = vfModule0.getCreated(); - vfModule0.setDescription((String) null); - vfModule0.setCreated(timestamp1); - vfModule0.setVolTemplateId((Integer) null); - vfModule0.getTemplateId(); - int int1 = vfModule0.getIsBase(); - assertTrue(int1 == int0); - - vfModule0.setModelVersion((String) null); - boolean boolean0 = vfModule0.isBase(); - assertFalse(boolean0); - - vfModule0.setVolEnvironmentId((Integer) null); - vfModule0.setModelInvariantUuid("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.getDescription(); - String string0 = vfModule0.toString(); - assertEquals("VF=VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,created=1/1/70 12:00 AM", string0); - } - - @Test(timeout = 4000) - public void test29() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.setIsBase(1); - vfModule0.getVnfResourceId(); - vfModule0.getEnvironmentId(); - vfModule0.toString(); - vfModule0.isBase(); - Integer integer0 = new Integer(0); - vfModule0.getCreated(); - vfModule0.setAsdcUuid("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - vfModule0.getCreated(); - PrivateAccess.setVariable((Class) VfModule.class, vfModule0, "asdcUuid", (Object) "VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null"); - assertEquals(1, vfModule0.getIsBase()); - } - - @Test(timeout = 4000) - public void test30() throws Throwable { - VfModule vfModule0 = new VfModule(); - vfModule0.toString(); - vfModule0.getModelVersion(); - String string0 = vfModule0.getType(); - assertNull(string0); - } - - @Test(timeout = 4000) - public void test31() throws Throwable { - VfModule vfModule0 = new VfModule(); - Integer integer0 = new Integer((-1)); - vfModule0.setVnfResourceId(integer0); - vfModule0.getModelInvariantUuid(); - vfModule0.setTemplateId(integer0); - vfModule0.setModelName((String) null); - Timestamp timestamp0 = vfModule0.getCreated(); - assertNull(timestamp0); - } + @Test(timeout = 4000) + public void test00() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setIsBase(1684); + vfModule0.getMinInstances(); + vfModule0.setMaxInstances((Integer) null); + vfModule0.isBase(); + vfModule0.setVolTemplateId((Integer) null); + vfModule0.setModelVersion("p(>v(f\"rnCo"); + vfModule0.getIsBase(); + vfModule0.getModelInvariantUuid(); + vfModule0.setModelVersion("a,U*#FCv(}H+aG}"); + vfModule0.getVolTemplateId(); + vfModule0.getMinInstances(); + vfModule0.toString(); + } + + @Test(timeout = 4000) + public void test01() throws Throwable { + VfModule vfModule0 = new VfModule(); + Instant instant0 = MockInstant.now(); + Timestamp timestamp0 = Timestamp.from(instant0); + vfModule0.setCreated(timestamp0); + vfModule0.setLabel("7."); + vfModule0.isBase(); + vfModule0.getId(); + vfModule0.getLabel(); + vfModule0.toString(); + } + + @Test(timeout = 4000) + public void test02() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = Integer.valueOf((-3299)); + vfModule0.getEnvironmentId(); + Integer.toUnsignedString((-697)); + vfModule0.setMinInstances((Integer) null); + vfModule0.setMaxInstances(integer0); + Integer integer1 = new Integer(5932); + Integer integer2 = Integer.getInteger("DZ>}qM>", integer1); + vfModule0.setVolEnvironmentId(integer0); + vfModule0.setTemplateId(integer2); + Integer.toUnsignedString(5932); + vfModule0.getVolTemplateId(); + vfModule0.setTemplateId((Integer) null); + Integer.divideUnsigned((-3299), (-3299)); + vfModule0.setEnvironmentId((Integer) null); + vfModule0.setVolEnvironmentId((Integer) null); + vfModule0.setMinInstances(integer1); + vfModule0.setIsBase((-3299)); + vfModule0.setIsBase((-745)); + vfModule0.setModelVersion("5932"); + vfModule0.getVolTemplateId(); + vfModule0.getVolEnvironmentId(); + vfModule0.getMinInstances(); + vfModule0.getVolEnvironmentId(); + } + + @Test(timeout = 4000) + public void test03() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(0); + vfModule0.setVolTemplateId(integer0); + vfModule0.getVolTemplateId(); + Integer integer1 = vfModule0.getVolTemplateId(); + vfModule0.setVolTemplateId(integer1); + vfModule0.setIsBase(863); + Integer integer2 = new Integer(1554); + vfModule0.setVnfResourceId(integer2); + vfModule0.setIsBase(780); + vfModule0.setMaxInstances(integer2); + vfModule0.getEnvironmentId(); + vfModule0.getVolEnvironmentId(); + vfModule0.getVolEnvironmentId(); + } + + @Test(timeout = 4000) + public void test04() throws Throwable { + VfModule vfModule0 = new VfModule(); + Timestamp timestamp0 = new Timestamp((-2168L)); + vfModule0.setCreated(timestamp0); + vfModule0.setId((-1)); + vfModule0.getEnvironmentId(); + vfModule0.setCreated(timestamp0); + vfModule0.setVolTemplateId((Integer) null); + vfModule0.setLabel("."); + vfModule0.getModelName(); + vfModule0.getCreated(); + vfModule0.getTemplateId(); + } + + @Test(timeout = 4000) + public void test05() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.isMoreRecentThan(""); + vfModule0.setLabel(""); + Integer integer0 = new Integer(1183); + vfModule0.setMaxInstances(integer0); + Integer.compare(1183, 1183); + vfModule0.setTemplateId(integer0); + vfModule0.getLabel(); + vfModule0.getDescription(); + } + + @Test(timeout = 4000) + public void test06() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(0); + Integer.compare(1, 0); + vfModule0.setMaxInstances(integer0); + vfModule0.getVolEnvironmentId(); + Integer.sum(0, 1); + vfModule0.setVolTemplateId((Integer) null); + vfModule0.setMaxInstances((Integer) null); + vfModule0.setModelVersion(""); + vfModule0.setIsBase((-1435)); + vfModule0.setVnfResourceId((Integer) null); + vfModule0.getVnfResourceId(); + vfModule0.setIsBase((-3635)); + vfModule0.getDescription(); + vfModule0.getAsdcUuid(); + Integer integer1 = new Integer((-3635)); + Integer integer2 = new Integer(1); + Integer.getInteger(".", integer2); + vfModule0.setVolTemplateId(integer1); + vfModule0.getVnfResourceId(); + vfModule0.getModelVersion(); + } + + @Test(timeout = 4000) + public void test07() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setIsBase(597); + vfModule0.setId(662); + Integer integer0 = Integer.valueOf(597); + Integer.compare((-1), 0); + Integer.divideUnsigned(597, (-3368)); + vfModule0.setVolTemplateId(integer0); + Integer.getInteger(",modelCustomizationUuid=", 0); + vfModule0.setVolEnvironmentId(integer0); + vfModule0.setId(0); + vfModule0.getVnfResourceId(); + Integer integer1 = new Integer(0); + vfModule0.setMaxInstances(integer1); + vfModule0.getMaxInstances(); + vfModule0.setModelName(""); + } + + @Test(timeout = 4000) + public void test08() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(0); + vfModule0.setInitialCount(integer0); + Integer integer1 = new Integer((-2063)); + vfModule0.setVolTemplateId(integer1); + vfModule0.getModelVersion(); + Integer integer2 = new Integer(0); + vfModule0.setInitialCount(integer2); + vfModule0.getLabel(); + vfModule0.setTemplateId(integer0); + Integer integer3 = vfModule0.getInitialCount(); + vfModule0.setMaxInstances(integer3); + } + + @Test(timeout = 4000) + public void test09() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setModelInvariantUuid(""); + vfModule0.setDescription(",templateId="); + Timestamp timestamp0 = new Timestamp((-1360L)); + MockDate mockDate0 = new MockDate(0, 0, (-1723), (-3154), (-1723)); + vfModule0.setId((-1158)); + mockDate0.setTime(0L); + timestamp0.after(mockDate0); + vfModule0.setCreated(timestamp0); + vfModule0.setType("."); + vfModule0.getId(); + Integer integer0 = new Integer((-1158)); + vfModule0.setVnfResourceId(integer0); + vfModule0.isBase(); + vfModule0.setMinInstances((Integer) null); + } + + @Test(timeout = 4000) + public void test10() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.isTheSameVersion(""); + vfModule0.setMaxInstances((Integer) null); + vfModule0.setId((-2621)); + vfModule0.setModelVersion(""); + vfModule0.setAsdcUuid("."); + Integer integer0 = new Integer((-2621)); + vfModule0.isTheSameVersion(""); + vfModule0.setTemplateId(integer0); + vfModule0.getTemplateId(); + vfModule0.getModelVersion(); + } + + @Test(timeout = 4000) + public void test11() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.toString(); + vfModule0.setType("\"~J0_gjDe]"); + vfModule0.getModelCustomizationUuid(); + vfModule0.toString(); + vfModule0.getTemplateId(); + vfModule0.getMaxInstances(); + } + + @Test(timeout = 4000) + public void test15() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getModelName(); + vfModule0.setModelName("uQAnJq?Z"); + vfModule0.getTemplateId(); + vfModule0.setModelCustomizationUuid(""); + vfModule0.getModelCustomizationUuid(); + } + + @Test(timeout = 4000) + public void test16() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getInitialCount(); + vfModule0.setMinInstances((Integer) null); + vfModule0.isBase(); + vfModule0.getVolEnvironmentId(); + Integer integer0 = new Integer((-414)); + vfModule0.setMaxInstances(integer0); + vfModule0.getVolEnvironmentId(); + vfModule0.getMaxInstances(); + System.setCurrentTimeMillis(0L); + vfModule0.getMaxInstances(); + vfModule0.getTemplateId(); + vfModule0.getInitialCount(); + vfModule0.getEnvironmentId(); + } + + @Test(timeout = 4000) + public void test17() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setVolEnvironmentId((Integer) null); + vfModule0.setAsdcUuid(",created="); + Integer integer0 = new Integer(0); + vfModule0.setVnfResourceId(integer0); + Integer.getInteger(",created=", (Integer) null); + vfModule0.setDescription(",label="); + vfModule0.setLabel("."); + vfModule0.getModelName(); + vfModule0.setId(0); + Integer.max(0, 0); + vfModule0.setMinInstances(integer0); + vfModule0.setMaxInstances((Integer) null); + vfModule0.getCreated(); + vfModule0.getMaxInstances(); + vfModule0.getAsdcUuid(); + vfModule0.getDescription(); + vfModule0.getMaxInstances(); + Integer integer1 = new Integer(0); + vfModule0.setMaxInstances(integer1); + vfModule0.toString(); + vfModule0.setCreated((Timestamp) null); + } + + @Test(timeout = 4000) + public void test18() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setModelCustomizationUuid(",modelVersion="); + Integer integer0 = new Integer((-4139)); + vfModule0.setInitialCount(integer0); + Integer integer1 = new Integer((-789)); + Integer.sum((-4139), (-2408)); + Integer.toUnsignedString((-1850)); + Integer.sum(958, (-176)); + Integer.getInteger(",modelVersion=", integer0); + Integer.remainderUnsigned((-789), (-789)); + vfModule0.setAsdcUuid("Y?ht4"); + vfModule0.setEnvironmentId(integer1); + vfModule0.getEnvironmentId(); + System.setCurrentTimeMillis(0L); + System.setCurrentTimeMillis((-2179L)); + vfModule0.getMinInstances(); + vfModule0.getVolTemplateId(); + vfModule0.isBase(); + vfModule0.isBase(); + vfModule0.isBase(); + vfModule0.getVnfResourceId(); + vfModule0.getCreated(); + } + + @Test(timeout = 4000) + public void test19() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(714); + vfModule0.setEnvironmentId(integer0); + vfModule0.setInitialCount((Integer) null); + vfModule0.toString(); + vfModule0.setDescription("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=714,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null"); + vfModule0.setModelVersion("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=714,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null"); + vfModule0.setInitialCount((Integer) null); + vfModule0.setIsBase(1549); + vfModule0.setMinInstances((Integer) null); + vfModule0.getModelCustomizationUuid(); + Integer integer1 = vfModule0.getEnvironmentId(); + vfModule0.setAsdcUuid("."); + vfModule0.getVolEnvironmentId(); + vfModule0.getLabel(); + Integer.remainderUnsigned(1544, 1549); + Integer.sum((-277), (-277)); + vfModule0.setMaxInstances(integer1); + vfModule0.getVolTemplateId(); + vfModule0.getIsBase(); + vfModule0.getInitialCount(); + } + + @Test(timeout = 4000) + public void test20() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setId(0); + vfModule0.setDescription("sh;.zWRp.C?-rn"); + vfModule0.setModelInvariantUuid(",label="); + vfModule0.getLabel(); + vfModule0.getModelInvariantUuid(); + Timestamp timestamp0 = new Timestamp((long) 0); + vfModule0.setCreated(timestamp0); + vfModule0.setDescription(""); + vfModule0.setModelInvariantUuid((String) null); + vfModule0.getDescription(); + } + + @Test(timeout = 4000) + public void test21() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.toString(); + vfModule0.getDescription(); + vfModule0.setAsdcUuid("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null"); + vfModule0.getModelName(); + Integer integer0 = new Integer(0); + Integer.toUnsignedString(378); + Integer.sum(0, 0); + vfModule0.setMaxInstances(integer0); + vfModule0.setModelInvariantUuid((String) null); + vfModule0.setType("}^`%'{@?s`OiaLz"); + vfModule0.setInitialCount(integer0); + vfModule0.getType(); + vfModule0.setAsdcUuid("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null"); + VfModule vfModule1 = new VfModule(); + vfModule0.setType("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null"); + vfModule0.toString(); + vfModule0.getId(); + vfModule1.setVnfResourceId(integer0); + vfModule0.getDescription(); + vfModule0.getType(); + vfModule0.getVolEnvironmentId(); + vfModule0.getTemplateId(); + } + + @Test(timeout = 4000) + public void test22() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setId(2389); + vfModule0.setModelCustomizationUuid(""); + vfModule0.isTheSameVersion(""); + vfModule0.getVolTemplateId(); + vfModule0.getLabel(); + vfModule0.setInitialCount((Integer) null); + vfModule0.getCreated(); + vfModule0.setAsdcUuid(""); + vfModule0.getAsdcUuid(); + } + + @Test(timeout = 4000) + public void test23() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(1268); + vfModule0.setInitialCount(integer0); + Integer integer1 = new Integer(0); + Integer.compare(1268, 1); + vfModule0.setEnvironmentId(integer1); + vfModule0.setVersion(""); + vfModule0.getEnvironmentId(); + vfModule0.getVnfResourceId(); + vfModule0.getType(); + vfModule0.getIsBase(); + vfModule0.getCreated(); + ChronoUnit chronoUnit0 = ChronoUnit.MINUTES; + // Undeclared exception! + try { + MockInstant.truncatedTo((Instant) null, chronoUnit0); + fail("Expecting exception: NullPointerException"); + + } catch(NullPointerException e) { + // + // no message in exception (getMessage() returned null) + // + verifyException("org.evosuite.runtime.mock.java.time.MockInstant", e); + } + } + + @Test(timeout = 4000) + public void test24() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setTemplateId((Integer) null); + Integer integer0 = new Integer(2617); + vfModule0.setVolEnvironmentId(integer0); + vfModule0.setEnvironmentId((Integer) null); + vfModule0.setType(""); + vfModule0.toString(); + VfModule vfModule1 = new VfModule(); + vfModule0.toString(); + vfModule0.isMoreRecentThan(""); + vfModule0.getModelName(); + vfModule1.getLabel(); + Integer integer1 = new Integer(321); + vfModule1.setVolTemplateId(integer1); + vfModule1.getVnfResourceId(); + vfModule0.getVolTemplateId(); + vfModule0.getVnfResourceId(); + vfModule0.getVolEnvironmentId(); + } + + @Test(timeout = 4000) + public void test25() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getLabel(); + Integer integer0 = new Integer(0); + vfModule0.setEnvironmentId(integer0); + vfModule0.isMoreRecentThan("!X"); + vfModule0.setIsBase(0); + vfModule0.setId(4322); + vfModule0.getMaxInstances(); + vfModule0.setAsdcUuid(""); + vfModule0.getDescription(); + vfModule0.setDescription((String) null); + vfModule0.setIsBase(0); + vfModule0.setAsdcUuid((String) null); + vfModule0.setId(4322); + Integer.min(4322, (-1)); + vfModule0.getDescription(); + Integer.divideUnsigned((-2839), 4322); + vfModule0.getIsBase(); + vfModule0.setInitialCount(integer0); + vfModule0.toString(); + vfModule0.getModelName(); + vfModule0.getVolEnvironmentId(); + vfModule0.setAsdcUuid(""); + vfModule0.getId(); + VfModule vfModule1 = new VfModule(); + vfModule1.getTemplateId(); + Integer integer1 = new Integer(4322); + vfModule1.setMinInstances(integer1); + vfModule0.getId(); + } + + @Test(timeout = 4000) + public void test26() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getAsdcUuid(); + vfModule0.getModelVersion(); + vfModule0.setModelName((String) null); + vfModule0.getVolEnvironmentId(); + vfModule0.getIsBase(); + Integer integer0 = new Integer((-1)); + vfModule0.setEnvironmentId(integer0); + vfModule0.setMinInstances(integer0); + vfModule0.getVolTemplateId(); + vfModule0.setModelVersion((String) null); + VfModule vfModule1 = new VfModule(); + vfModule1.setId(0); + vfModule1.setModelInvariantUuid((String) null); + vfModule1.getModelInvariantUuid(); + vfModule1.getModelName(); + vfModule1.setVolEnvironmentId(integer0); + vfModule1.getMinInstances(); + vfModule0.setModelName(""); + Integer.getInteger(""); + vfModule0.setTemplateId((Integer) null); + vfModule0.getModelName(); + Integer integer1 = new Integer((-1)); + vfModule0.setVolEnvironmentId(integer1); + vfModule1.getVnfResourceId(); + Integer integer2 = vfModule1.getVolEnvironmentId(); + vfModule0.setVolEnvironmentId(integer2); + vfModule1.setMinInstances((Integer) null); + } + + @Test(timeout = 4000) + public void test27() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.toString(); + vfModule0.setModelVersion("LBV90^6*"); + vfModule0.setDescription("LBV90^6*"); + vfModule0.getVnfResourceId(); + vfModule0.setTemplateId((Integer) null); + vfModule0.isBase(); + vfModule0.setIsBase((-531)); + Integer integer0 = new Integer(2646); + vfModule0.setVolEnvironmentId(integer0); + Integer integer1 = new Integer((-531)); + Integer.divideUnsigned((-531), 2646); + Integer.compare((-1), (-531)); + Integer.toUnsignedLong((-1)); + vfModule0.setVolEnvironmentId((Integer) null); + vfModule0.setVolEnvironmentId(integer1); + vfModule0.setTemplateId((Integer) null); + vfModule0.getVolEnvironmentId(); + vfModule0.setModelName("LBV90^6*"); + vfModule0.getTemplateId(); + vfModule0.getModelName(); + } + + @Test(timeout = 4000) + public void test28() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(2752); + vfModule0.setVolEnvironmentId(integer0); + Integer integer1 = vfModule0.getVolEnvironmentId(); + vfModule0.setVnfResourceId(integer1); + vfModule0.getModelVersion(); + vfModule0.setModelVersion((String) null); + vfModule0.getMinInstances(); + vfModule0.getAsdcUuid(); + Integer integer2 = new Integer((-672)); + Instant instant0 = MockInstant.now(); + ChronoField chronoField0 = ChronoField.EPOCH_DAY; + // Undeclared exception! + try { + MockInstant.with(instant0, (TemporalField) chronoField0, 1268L); + fail("Expecting exception: UnsupportedTemporalTypeException"); + + } catch(UnsupportedTemporalTypeException e) { + // + // Unsupported field: EpochDay + // + verifyException("java.time.Instant", e); + } + } + + @Test(timeout = 4000) + public void test29() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getMinInstances(); + Integer integer0 = new Integer(397); + vfModule0.setInitialCount(integer0); + vfModule0.setMaxInstances((Integer) null); + vfModule0.isBase(); + vfModule0.setVolEnvironmentId((Integer) null); + vfModule0.setModelVersion("p(>v(f\"rnCo"); + vfModule0.setMinInstances((Integer) null); + vfModule0.setModelVersion("*"); + vfModule0.getIsBase(); + vfModule0.getModelInvariantUuid(); + vfModule0.setIsBase((-1066)); + vfModule0.getInitialCount(); + vfModule0.toString(); + vfModule0.getVolTemplateId(); + vfModule0.getCreated(); + } + + @Test(timeout = 4000) + public void test30() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getTemplateId(); + Instant instant0 = MockInstant.ofEpochSecond(1L); + Timestamp timestamp0 = Timestamp.from(instant0); + vfModule0.setCreated(timestamp0); + vfModule0.getCreated(); + vfModule0.getTemplateId(); + } + + @Test(timeout = 4000) + public void test31() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(0); + vfModule0.setTemplateId(integer0); + vfModule0.setModelVersion(""); + vfModule0.getModelName(); + vfModule0.setId(0); + vfModule0.setModelVersion("wk~z+v"); + Integer integer1 = new Integer(0); + Integer.getInteger((String) null, 0); + vfModule0.setEnvironmentId(integer1); + vfModule0.getTemplateId(); + vfModule0.setModelName("a("); + Integer integer2 = vfModule0.getTemplateId(); + vfModule0.setMinInstances(integer2); + vfModule0.setModelCustomizationUuid("01*}(,sCh"); + vfModule0.getModelCustomizationUuid(); + vfModule0.getVolEnvironmentId(); + vfModule0.getVolEnvironmentId(); + } + + @Test(timeout = 4000) + public void test32() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(4222); + vfModule0.setEnvironmentId(integer0); + vfModule0.getModelName(); + vfModule0.setAsdcUuid((String) null); + vfModule0.setModelCustomizationUuid((String) null); + vfModule0.setType(",minInstances="); + vfModule0.setVnfResourceId(integer0); + vfModule0.getEnvironmentId(); + vfModule0.getMaxInstances(); + vfModule0.getVolEnvironmentId(); + } + + @Test(timeout = 4000) + public void test33() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(0); + Integer integer1 = new Integer(1244); + Integer.compareUnsigned(0, 1549); + Integer.getInteger("", integer1); + vfModule0.setVolEnvironmentId(integer0); + vfModule0.getCreated(); + vfModule0.getVolEnvironmentId(); + System.setCurrentTimeMillis(1856L); + vfModule0.getVolTemplateId(); + } + + @Test(timeout = 4000) + public void test34() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getModelName(); + Integer integer0 = new Integer(0); + vfModule0.setVnfResourceId(integer0); + vfModule0.setId(0); + vfModule0.setModelVersion((String) null); + Integer integer1 = new Integer(0); + Integer.getInteger((String) null, 0); + vfModule0.setEnvironmentId(integer1); + vfModule0.getTemplateId(); + vfModule0.setModelName((String) null); + vfModule0.setMinInstances(integer1); + vfModule0.setModelCustomizationUuid("01*}(,sCh"); + vfModule0.getCreated(); + vfModule0.getVnfResourceId(); + vfModule0.getVolTemplateId(); + } + + @Test(timeout = 4000) + public void test35() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getInitialCount(); + Integer integer0 = new Integer((-1066)); + vfModule0.getVolEnvironmentId(); + Integer.getInteger("", (Integer) null); + Integer.getInteger(",envtId=", (-1066)); + vfModule0.setMinInstances(integer0); + vfModule0.toString(); + vfModule0.setVersion("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=-1066,maxInstances=null,initialCount=null,label=null"); + vfModule0.getVolTemplateId(); + vfModule0.getVolTemplateId(); + vfModule0.getVnfResourceId(); + vfModule0.getMinInstances(); + vfModule0.getVolTemplateId(); + vfModule0.setVersion(""); + vfModule0.getVnfResourceId(); + System.setCurrentTimeMillis((-1066)); + vfModule0.setModelCustomizationUuid("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=-1066,maxInstances=null,initialCount=null,label=null"); + vfModule0.getCreated(); + vfModule0.getCreated(); + System.setCurrentTimeMillis((-1066)); + } + + @Test(timeout = 4000) + public void test36() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getEnvironmentId(); + vfModule0.setVolEnvironmentId((Integer) null); + int int0 = vfModule0.getId(); + assertEquals(0, int0); + + vfModule0.getVolTemplateId(); + String string0 = vfModule0.toString(); + assertEquals("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null", string0); + } + + @Test(timeout = 4000) + public void test37() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.isTheSameVersion("X+]2+]y^$6"); + vfModule0.getTemplateId(); + vfModule0.getId(); + Integer.toUnsignedString(0); + vfModule0.getLabel(); + Integer.remainderUnsigned((-472), 1579); + Integer integer0 = new Integer((-1701)); + Integer.compare((-1701), (-1)); + Integer.getInteger("0", integer0); + vfModule0.setEnvironmentId((Integer) null); + vfModule0.setModelInvariantUuid((String) null); + vfModule0.getAsdcUuid(); + Integer integer1 = new Integer((-1701)); + vfModule0.setVnfResourceId((Integer) null); + vfModule0.getIsBase(); + Integer.compareUnsigned(1, 0); + vfModule0.getType(); + vfModule0.getVnfResourceId(); + vfModule0.setInitialCount(integer1); + vfModule0.setDescription(""); + vfModule0.getEnvironmentId(); + vfModule0.setInitialCount(integer1); + vfModule0.setId(1946); + vfModule0.getCreated(); + vfModule0.getInitialCount(); + vfModule0.getVnfResourceId(); + vfModule0.getCreated(); + assertEquals(1946, vfModule0.getId()); + } + + @Test(timeout = 4000) + public void test38() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getMaxInstances(); + Integer integer0 = new Integer(550); + vfModule0.setMinInstances(integer0); + Integer integer1 = new Integer(275); + Integer.max(0, 0); + vfModule0.setInitialCount(integer1); + vfModule0.setIsBase(275); + vfModule0.getEnvironmentId(); + Integer.compare(275, 275); + vfModule0.setMinInstances((Integer) null); + vfModule0.setType(""); + vfModule0.setVersion("]"); + vfModule0.getId(); + vfModule0.setId(0); + vfModule0.setIsBase((-17)); + vfModule0.setId((-17)); + vfModule0.getDescription(); + vfModule0.getAsdcUuid(); + vfModule0.getIsBase(); + vfModule0.getModelName(); + vfModule0.getEnvironmentId(); + vfModule0.toString(); + vfModule0.setModelInvariantUuid("D2"); + vfModule0.getInitialCount(); + assertEquals(-17, vfModule0.getIsBase()); + } + + @Test(timeout = 4000) + public void test39() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(4477); + vfModule0.setVolTemplateId(integer0); + vfModule0.getModelInvariantUuid(); + vfModule0.getModelInvariantUuid(); + vfModule0.getVolTemplateId(); + vfModule0.getMinInstances(); + System.setCurrentTimeMillis((-1006L)); + } + + @Test(timeout = 4000) + public void test40() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(0); + vfModule0.setMinInstances(integer0); + vfModule0.setType((String) null); + vfModule0.setAsdcUuid(",asdcUuid="); + Integer integer1 = vfModule0.getMinInstances(); + assertEquals(0, (int)integer1); + } + + @Test(timeout = 4000) + public void test41() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getDescription(); + String string0 = vfModule0.getModelCustomizationUuid(); + assertNull(string0); + } + + @Test(timeout = 4000) + public void test42() throws Throwable { + VfModule vfModule0 = new VfModule(); + Instant instant0 = MockInstant.now(); + Timestamp timestamp0 = Timestamp.from(instant0); + vfModule0.setCreated(timestamp0); + int int0 = vfModule0.getId(); + assertEquals(0, int0); + + vfModule0.getLabel(); + String string0 = vfModule0.toString(); + assertEquals("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null,created=2/14/14 8:21 PM", string0); + } + + @Test(timeout = 4000) + public void test43() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getMinInstances(); + vfModule0.isBase(); + vfModule0.setModelVersion(""); + vfModule0.getIsBase(); + vfModule0.getModelInvariantUuid(); + vfModule0.setIsBase((-1066)); + vfModule0.toString(); + boolean boolean0 = vfModule0.isBase(); + assertEquals(-1066, vfModule0.getIsBase()); + assertTrue(boolean0); + } + + @Test(timeout = 4000) + public void test44() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.getMinInstances(); + vfModule0.toString(); + vfModule0.setLabel("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=null,envtId=null,volTemplateId=null,volEnvtId=null, description=null,asdcUuid=null,modelVersion=null,modelCustomizationUuid=null,minInstances=null,maxInstances=null,initialCount=null,label=null"); + vfModule0.getDescription(); + vfModule0.getModelVersion(); + PrivateAccess.setVariable((Class) VfModule.class, vfModule0, "minInstances", (Object) null); + assertEquals(0, vfModule0.getIsBase()); + } + + @Test(timeout = 4000) + public void test45() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setAsdcUuid(",maxInstances="); + vfModule0.isTheSameVersion(",maxInstances="); + Integer integer0 = new Integer(0); + vfModule0.setEnvironmentId(integer0); + vfModule0.setTemplateId(integer0); + vfModule0.setModelCustomizationUuid(",maxInstances="); + vfModule0.getModelInvariantUuid(); + vfModule0.getType(); + vfModule0.getModelCustomizationUuid(); + vfModule0.setVolEnvironmentId(integer0); + vfModule0.getMaxInstances(); + String string0 = vfModule0.toString(); + assertEquals("VF=null,modelName=null,version=null,id=0,vnfResourceId=null,templateId=0,envtId=0,volTemplateId=null,volEnvtId=0, description=null,asdcUuid=,maxInstances=,modelVersion=null,modelCustomizationUuid=,maxInstances=,minInstances=null,maxInstances=null,initialCount=null,label=null", string0); + } + + @Test(timeout = 4000) + public void test46() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer((-1)); + Integer.remainderUnsigned((-1), (-1)); + Integer.remainderUnsigned(0, (-1)); + Integer.compareUnsigned((-1), 0); + vfModule0.setMaxInstances(integer0); + vfModule0.setMaxInstances(integer0); + vfModule0.setIsBase((-1)); + vfModule0.setVolTemplateId(integer0); + vfModule0.getTemplateId(); + Integer.divideUnsigned(0, (-1)); + vfModule0.setMinInstances((Integer) null); + vfModule0.getVnfResourceId(); + vfModule0.getVolTemplateId(); + vfModule0.setIsBase(0); + vfModule0.getInitialCount(); + int int0 = vfModule0.getIsBase(); + assertFalse(vfModule0.isBase()); + assertEquals(0, int0); + } + + @Test(timeout = 4000) + public void test47() throws Throwable { + VfModule vfModule0 = new VfModule(); + vfModule0.setType(""); + vfModule0.setVolEnvironmentId((Integer) null); + vfModule0.setDescription(""); + vfModule0.setModelInvariantUuid(""); + vfModule0.getModelInvariantUuid(); + vfModule0.getVolEnvironmentId(); + vfModule0.setVnfResourceId((Integer) null); + vfModule0.setModelName(""); + assertEquals(0, vfModule0.getIsBase()); + } + + @Test(timeout = 4000) + public void test48() throws Throwable { + VfModule vfModule0 = new VfModule(); + Integer integer0 = new Integer(275); + vfModule0.setInitialCount(integer0); + vfModule0.getEnvironmentId(); + vfModule0.setId(275); + vfModule0.getAsdcUuid(); + vfModule0.getModelName(); + vfModule0.getAsdcUuid(); + vfModule0.getCreated(); + assertEquals(275, vfModule0.getId()); + } } diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTest.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTest.java new file mode 100644 index 0000000000..1a0d1de41a --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTest.java @@ -0,0 +1,23 @@ +/* + * This file was automatically generated by EvoSuite + * Wed Feb 22 09:33:42 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.utils; + +import org.junit.Test; +import static org.junit.Assert.*; +import org.evosuite.runtime.EvoRunner; +import org.evosuite.runtime.EvoRunnerParameters; +import org.junit.runner.RunWith; + +@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, useJEE = true) +public class RecordNotFoundExceptionESTest extends RecordNotFoundExceptionESTestscaffolding { + + @Test(timeout = 4000) + public void test0() throws Throwable { + RecordNotFoundException recordNotFoundException0 = new RecordNotFoundException("K\"]E;o`'jowz5?'`3"); + RecordNotFoundException recordNotFoundException1 = new RecordNotFoundException("~&", (Throwable) recordNotFoundException0); + assertFalse(recordNotFoundException1.equals((Object)recordNotFoundException0)); + } +} diff --git a/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTestscaffolding.java b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTestscaffolding.java new file mode 100644 index 0000000000..e74f0c4502 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/openecomp/mso/db/catalog/utils/RecordNotFoundExceptionESTestscaffolding.java @@ -0,0 +1,81 @@ +/** + * Scaffolding file used to store all the setups needed to run + * tests automatically generated by EvoSuite + * Wed Feb 22 09:33:42 GMT 2017 + */ + +package org.openecomp.mso.db.catalog.utils; + +import org.evosuite.runtime.annotation.EvoSuiteClassExclude; +import org.junit.BeforeClass; +import org.junit.Before; +import org.junit.After; +import org.junit.AfterClass; +import org.evosuite.runtime.sandbox.Sandbox; + +@EvoSuiteClassExclude +public class RecordNotFoundExceptionESTestscaffolding { + + @org.junit.Rule + public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); + + private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); + + private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); + + @BeforeClass + public static void initEvoSuiteFramework() { + org.evosuite.runtime.RuntimeSettings.className = "org.openecomp.mso.db.catalog.utils.RecordNotFoundException"; + org.evosuite.runtime.GuiSupport.initialize(); + org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; + org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; + org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; + org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; + org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); + org.evosuite.runtime.classhandling.JDKClassResetter.init(); + initializeClasses(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + } + + @AfterClass + public static void clearEvoSuiteFramework(){ + Sandbox.resetDefaultSecurityManager(); + java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); + } + + @Before + public void initTestCase(){ + threadStopper.storeCurrentThreads(); + threadStopper.startRecordingTime(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); + org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); + org.evosuite.runtime.GuiSupport.setHeadless(); + org.evosuite.runtime.Runtime.getInstance().resetRuntime(); + org.evosuite.runtime.agent.InstrumentingAgent.activate(); + } + + @After + public void doneWithTestCase(){ + threadStopper.killAndJoinClientThreads(); + org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); + org.evosuite.runtime.classhandling.JDKClassResetter.reset(); + resetClasses(); + org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); + org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); + org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); + } + + private static void initializeClasses() { + org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(RecordNotFoundExceptionESTestscaffolding.class.getClassLoader() , + "org.openecomp.mso.db.catalog.utils.RecordNotFoundException" + ); + } + + private static void resetClasses() { + org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(RecordNotFoundExceptionESTestscaffolding.class.getClassLoader()); + + org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( + "org.openecomp.mso.db.catalog.utils.RecordNotFoundException" + ); + } +} diff --git a/packages/arquillian-unit-tests/pom.xml b/packages/arquillian-unit-tests/pom.xml index f90ca550ab..d56688b639 100644 --- a/packages/arquillian-unit-tests/pom.xml +++ b/packages/arquillian-unit-tests/pom.xml @@ -62,12 +62,6 @@ 1.3.16.GA test - - junit - junit - 4.11 - test - org.jboss.arquillian.junit @@ -254,9 +248,9 @@ - org.openecomp.sdc + org.openecomp.sdc.sdc-distribution-client sdc-distribution-client - 1.0.0 + 1.1.6-SNAPSHOT test @@ -359,6 +353,26 @@ + + + org.codehaus.mojo + wagon-maven-plugin + 1.0 + + + download-mariadb-connector + pre-integration-test + + download-single + + + http://central.maven.org/ + maven2/org/mariadb/jdbc/mariadb-java-client/1.5.4/mariadb-java-client-1.5.4.jar + ${project.build.directory}/mariadb-connector + + + + org.apache.maven.plugins maven-failsafe-plugin diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/IntegrationTestsSuite.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/IntegrationTestsSuite.java index a1fa04dd01..f71d2e7fa8 100644 --- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/IntegrationTestsSuite.java +++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/IntegrationTestsSuite.java @@ -11,14 +11,14 @@ import org.openecomp.mso.global_tests.soapui.SoapUiITCase; @RunWith(Suite.class) -@SuiteClasses({ +@SuiteClasses({ // MSOUiITCase.class, // AppCAdapterITCase.class, SoapUiITCase.class, ASDCITCase.class, LogsCheckerITCase.class - + }) public class IntegrationTestsSuite { diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/ASDCITCase.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/ASDCITCase.java index 47b261afd6..263454359d 100644 --- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/ASDCITCase.java +++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/ASDCITCase.java @@ -10,6 +10,7 @@ import java.security.NoSuchAlgorithmException; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.LinkedList; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.container.test.api.OperateOnDeployment; @@ -30,7 +31,8 @@ import org.junit.runner.RunWith; import org.openecomp.sdc.api.consumer.IDistributionStatusMessage; import org.openecomp.sdc.api.notification.IArtifactInfo; import org.openecomp.sdc.api.notification.IResourceInstance; -import org.openecomp.sdc.api.notification.IVfModuleMetadata; +import org.openecomp.mso.asdc.installer.VfModuleMetaData; +import org.openecomp.mso.asdc.installer.IVfModuleData; import org.openecomp.sdc.utils.DistributionStatusEnum; import org.openecomp.mso.asdc.client.ASDCConfiguration; import org.openecomp.mso.asdc.client.ASDCController; @@ -64,7 +66,7 @@ public class ASDCITCase { } for (File f : dir.listFiles()) { - + if (f.isFile()) { jar.addAsResource(f, destFolder + "/" + f.getName()); } else { @@ -82,16 +84,16 @@ public class ASDCITCase { // Add the current test class JavaArchive testclasses = ShrinkWrap.create (JavaArchive.class, "testClasses.jar"); - + testclasses.addPackage("org.openecomp.mso.global_tests.asdc.notif_emulator"); - + addFiles(testclasses,new File(Thread.currentThread().getContextClassLoader().getResource("resource-examples/asdc").getFile()),"resource-examples/asdc"); - + System.out.println(testclasses.toString(true)); warArchive.addAsLibraries(testclasses); - - - + + + // BE CAREFUL a settings.xml file must be located in ${home.user}/.m2/settings.xml warArchive.addAsLibraries(Maven.resolver() .resolve("org.mockito:mockito-all:1.10.19") @@ -100,11 +102,11 @@ public class ASDCITCase { //warArchive.addPackage("org.openecomp.mso.global_tests.asdc.notif_emulator"); //addFiles(warArchive,new File(ASDCITCase.class.getClassLoader().getResource("resource-examples").getPath()),"resource-examples"); - + // Take one war randomly to make arquilian happy Testable.archiveToTest(warArchive); - - + + System.out.println(warArchive.toString(true)); return warArchive; @@ -117,7 +119,7 @@ public class ASDCITCase { NoSuchAlgorithmException { System.out.println("Executing " + ASDCITCase.class.getName()); } - + @AfterClass public static final void waitAfterStart() throws InterruptedException, IOException, @@ -126,70 +128,70 @@ public class ASDCITCase { System.out.println("Waiting 60000ms " + ASDCITCase.class.getName()); Thread.sleep(60000); } - + /** * Be careful when using that notification fake structure, the UUID of notif artifacts MUST be different. * There is a static Map behind the scene. */ private JsonNotificationData notifDataWithoutModuleInfo; private DistributionClientEmulator distribClientWithoutModuleInfo; - + private JsonNotificationData notifDataV1, notifDataV2, notifDataV3, notifDataV4, notifDataV5,notifDataDNS,notifDataVFW; private DistributionClientEmulator distribClientV1, distribClientV2, distribClientV3, distribClientV4, distribClientV5, distribClientV1ForSameNotif, distribClientDNS,distribClientVFW; - - + + @Before public final void beforeEachTest() throws IOException { distribClientV1= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V1"); distribClientV1ForSameNotif= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V1"); notifDataV1 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V1"); - + // This is a duplicate in version 2 of the version 1 distribClientV2= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V2"); notifDataV2 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V2"); - + distribClientV3= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V3"); notifDataV3 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V3"); - + // This is a duplicate in version 4 of the version 3 distribClientV4= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V4"); notifDataV4 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V4"); - + // This notification is to test the deployment of volume with nested + an artifact not used (should send notification with DEPLOY_ERROR distribClientV5= new DistributionClientEmulator("/resource-examples/asdc/simpleNotif-V5"); notifDataV5 = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/simpleNotif-V5"); - - + + distribClientWithoutModuleInfo= new DistributionClientEmulator("/resource-examples/asdc/notif-without-modules-metadata"); notifDataWithoutModuleInfo = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/notif-without-modules-metadata"); - - + + distribClientDNS= new DistributionClientEmulator("/resource-examples/asdc/demo-dns-V1"); notifDataDNS = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/demo-dns-V1"); - - + + distribClientVFW= new DistributionClientEmulator("/resource-examples/asdc/demo-vfw-V1"); notifDataVFW = JsonNotificationData.instantiateNotifFromJsonFile("/resource-examples/asdc/demo-vfw-V1"); - - + + } - + @Test @OperateOnDeployment("asdc-controller") public void testNotifWithoutModuleInfo () throws NoSuchAlgorithmException, IOException, URISyntaxException, ArtifactInstallerException, ASDCControllerException, ASDCParametersException { - - - + + + ASDCController asdcController = new ASDCController("asdc-controller1", distribClientWithoutModuleInfo); asdcController.initASDC(); asdcController.treatNotification(notifDataWithoutModuleInfo); - + assertTrue(distribClientWithoutModuleInfo.getDistributionMessageReceived().size() > 0); - + int badDeployment=0; for (IDistributionStatusMessage message:distribClientWithoutModuleInfo.getDistributionMessageReceived()) { System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name()); @@ -198,23 +200,23 @@ public class ASDCITCase { } } assertTrue(badDeployment == 3); - + // Check if something has been recorder in DB, as it should not CatalogDatabase catalogDB = new CatalogDatabase(); - + HeatTemplate heatTemplate = catalogDB.getHeatTemplate("Whot-nimbus-oam_v1.0.yaml", "1.0", "resourceName-1"); assertNull(heatTemplate); } - - private void validateVnfResource(JsonNotificationData inputNotification,List moduleList) { - + + private void validateVnfResource(JsonNotificationData inputNotification, List moduleList) { + CatalogDatabase catalogDB = new CatalogDatabase(); - - + + for (IResourceInstance resource:inputNotification.getResources()) { VnfResource vnfResourceDB = catalogDB.getVnfResource(inputNotification.getServiceName()+"/"+resource.getResourceInstanceName(), inputNotification.getServiceVersion()); assertNotNull(vnfResourceDB); - + assertTrue(vnfResourceDB.getAsdcUuid().equals(resource.getResourceUUID())); assertTrue(vnfResourceDB.getDescription().equals(inputNotification.getServiceDescription())); assertTrue(vnfResourceDB.getModelInvariantUuid().equals(resource.getResourceInvariantUUID())); @@ -225,19 +227,19 @@ public class ASDCITCase { assertTrue(vnfResourceDB.getModelCustomizationName().equals(resource.getResourceInstanceName())); assertTrue(vnfResourceDB.getModelName().equals(resource.getResourceName())); assertTrue(vnfResourceDB.getServiceModelInvariantUUID().equals(inputNotification.getServiceInvariantUUID())); - - for (IVfModuleMetadata module:moduleList) { - + + for (IVfModuleData module:moduleList) { + VfModule vfModuleDB = catalogDB.getVfModuleModelName(module.getVfModuleModelName(),inputNotification.getServiceVersion()); assertNotNull(vfModuleDB); assertTrue(module.getVfModuleModelName().equals(vfModuleDB.getModelName())); - + assertTrue((inputNotification.getServiceName()+"/"+resource.getResourceInstanceName()+"::"+vfModuleDB.getModelName()).equals(vfModuleDB.getType())); assertTrue(vnfResourceDB.getId()!=0); assertNotNull(vfModuleDB.getVnfResourceId()); - + assertTrue(vnfResourceDB.getId()==vfModuleDB.getVnfResourceId().intValue()); - + for (String artifactUUID:module.getArtifacts()) { IArtifactInfo artifact = null; for (IArtifactInfo artifactTemp:resource.getArtifacts()) { @@ -247,7 +249,7 @@ public class ASDCITCase { } } assertNotNull(artifact); - + switch (artifact.getArtifactType()) { case ASDCConfiguration.HEAT: HeatTemplate heatTemplateDB= catalogDB.getHeatTemplate(vfModuleDB.getTemplateId()); @@ -257,63 +259,63 @@ public class ASDCITCase { assertTrue(heatTemplateDB.getDescription().equals(artifact.getArtifactDescription())); assertTrue(heatTemplateDB.getTemplateBody() != null && !heatTemplateDB.getTemplateBody().isEmpty()); assertTrue(heatTemplateDB.getParameters().size()>0); - + assertTrue(heatTemplateDB.getTemplateName().equals(artifact.getArtifactName())); - + if (artifact.getArtifactTimeout() != null) { assertTrue(heatTemplateDB.getTimeoutMinutes()== artifact.getArtifactTimeout().intValue()); } else { assertTrue(heatTemplateDB.getTimeoutMinutes()== 240); } assertTrue(heatTemplateDB.getVersion().equals(artifact.getArtifactVersion())); - + assertFalse(heatTemplateDB.getTemplateBody().contains("file:///")); break; case ASDCConfiguration.HEAT_ENV: - + HeatEnvironment heatEnvironmentDB = catalogDB.getHeatEnvironment(artifact.getArtifactName(), artifact.getArtifactVersion(), inputNotification.getServiceName()+"/"+resource.getResourceInstanceName()); - + assertNotNull(heatEnvironmentDB); assertTrue((vfModuleDB.getVolEnvironmentId() != null && vfModuleDB.getVolEnvironmentId().intValue() == heatEnvironmentDB.getId()) || (vfModuleDB.getEnvironmentId() != null && vfModuleDB.getEnvironmentId() == heatEnvironmentDB.getId())); - + assertTrue(heatEnvironmentDB.getAsdcResourceName().equals(inputNotification.getServiceName()+"/"+resource.getResourceInstanceName())); - + assertTrue(heatEnvironmentDB.getAsdcUuid().equals(artifact.getArtifactUUID())); assertTrue(heatEnvironmentDB.getDescription().equals(artifact.getArtifactDescription())); assertTrue(heatEnvironmentDB.getVersion().equals(artifact.getArtifactVersion())); assertTrue(heatEnvironmentDB.getName().equals(artifact.getArtifactName())); assertTrue(heatEnvironmentDB.getEnvironment() != null); assertFalse(heatEnvironmentDB.getEnvironment().contains("file:///")); - + break; case ASDCConfiguration.HEAT_NESTED: Map listNestedDBMainHeat=new HashMap(); Map listNestedDBVolHeat=new HashMap(); - + if (vfModuleDB.getTemplateId() != null) { listNestedDBMainHeat = catalogDB.getNestedTemplates(vfModuleDB.getTemplateId()); } if (vfModuleDB.getVolTemplateId() != null) { listNestedDBVolHeat = catalogDB.getNestedTemplates(vfModuleDB.getVolTemplateId()); } - + assertTrue(listNestedDBMainHeat.size() > 0 || listNestedDBVolHeat.size() > 0); - - - assertTrue(listNestedDBMainHeat.get(artifact.getArtifactName()) != null + + + assertTrue(listNestedDBMainHeat.get(artifact.getArtifactName()) != null || listNestedDBVolHeat.get(artifact.getArtifactName()) != null); - + HeatTemplate rightNestedTemplateDB = catalogDB.getHeatTemplate(artifact.getArtifactName(), artifact.getArtifactVersion(), resource.getResourceName()); assertNotNull(rightNestedTemplateDB); assertTrue(catalogDB.getNestedHeatTemplate(vfModuleDB.getTemplateId(), rightNestedTemplateDB.getId()) != null || catalogDB.getNestedHeatTemplate(vfModuleDB.getVolTemplateId(), rightNestedTemplateDB.getId()) != null); - + assertTrue(rightNestedTemplateDB.getAsdcResourceName().equals(resource.getResourceName())); assertTrue(rightNestedTemplateDB.getAsdcUuid().equals(artifact.getArtifactUUID())); assertTrue(rightNestedTemplateDB.getDescription().equals(artifact.getArtifactDescription())); assertTrue(rightNestedTemplateDB.getTemplateBody() != null && !rightNestedTemplateDB.getTemplateBody().isEmpty()); assertTrue(rightNestedTemplateDB.getTemplateName().equals(artifact.getArtifactName())); - + if (artifact.getArtifactTimeout() != null) { assertTrue(rightNestedTemplateDB.getTimeoutMinutes()== artifact.getArtifactTimeout().intValue()); } else { @@ -321,18 +323,18 @@ public class ASDCITCase { } assertTrue(rightNestedTemplateDB.getVersion().equals(artifact.getArtifactVersion())); assertFalse(rightNestedTemplateDB.getTemplateBody().contains("file:///")); - + break; case ASDCConfiguration.HEAT_VOL: HeatTemplate heatTemplateVolDB = catalogDB.getHeatTemplate(vfModuleDB.getVolTemplateId()); assertNotNull(heatTemplateVolDB); - + assertTrue(heatTemplateVolDB.getAsdcResourceName().equals(resource.getResourceName())); assertTrue(heatTemplateVolDB.getAsdcUuid().equals(artifact.getArtifactUUID())); assertTrue(heatTemplateVolDB.getDescription().equals(artifact.getArtifactDescription())); assertTrue(heatTemplateVolDB.getTemplateBody() != null && !heatTemplateVolDB.getTemplateBody().isEmpty()); assertTrue(heatTemplateVolDB.getTemplateName().equals(artifact.getArtifactName())); - + if (artifact.getArtifactTimeout() != null) { assertTrue(heatTemplateVolDB.getTimeoutMinutes()== artifact.getArtifactTimeout().intValue()); } else { @@ -340,32 +342,32 @@ public class ASDCITCase { } assertTrue(heatTemplateVolDB.getVersion().equals(artifact.getArtifactVersion())); assertFalse(heatTemplateVolDB.getTemplateBody().contains("file:///")); - + break; case ASDCConfiguration.HEAT_ARTIFACT: Map heatFilesDB= catalogDB.getHeatFilesForVfModule(vfModuleDB.getId()); assertTrue(heatFilesDB.size()>0); HeatFiles rightHeatFilesDB=heatFilesDB.get( artifact.getArtifactName()); assertNotNull(rightHeatFilesDB); - + assertTrue(rightHeatFilesDB.getAsdcResourceName().equals(resource.getResourceName())); assertTrue(rightHeatFilesDB.getAsdcUuid().equals(artifact.getArtifactUUID())); assertTrue(rightHeatFilesDB.getDescription().equals(artifact.getArtifactDescription())); assertTrue(rightHeatFilesDB.getFileBody() != null && !rightHeatFilesDB.getFileBody().isEmpty()); assertTrue(rightHeatFilesDB.getFileName().equals( artifact.getArtifactName())); assertTrue(rightHeatFilesDB.getVersion().equals(artifact.getArtifactVersion())); - + break; default: break; - + } } - + } - + } - + Service service = catalogDB.getServiceByUUID(inputNotification.getServiceUUID()); assertNotNull(service); assertTrue(service.getCreated() !=null && service.getCreated().getTime()>0); @@ -377,85 +379,85 @@ public class ASDCITCase { assertTrue(service.getVersion().equals(inputNotification.getServiceVersion())); } - + @Test @OperateOnDeployment("asdc-controller") public void testNotifsDeployment () throws NoSuchAlgorithmException, IOException, URISyntaxException, ArtifactInstallerException, ASDCControllerException, ASDCParametersException { - - - + + + ASDCController asdcControllerV1 = new ASDCController("asdc-controller1", distribClientV1); asdcControllerV1.initASDC(); asdcControllerV1.treatNotification(notifDataV1); - + assertTrue(distribClientV1.getDistributionMessageReceived().size() > 0); for (IDistributionStatusMessage message:distribClientV1.getDistributionMessageReceived()) { System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name()); assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK)); } - + this.validateVnfResource(notifDataV1,distribClientV1.getListVFModuleMetaData()); - - - + + + // Try again to load the same notif ASDCController asdcControllerNewNotif = new ASDCController("asdc-controller1", distribClientV1ForSameNotif); asdcControllerNewNotif.initASDC(); asdcControllerNewNotif.treatNotification(notifDataV1); - + for (IDistributionStatusMessage message:distribClientV1ForSameNotif.getDistributionMessageReceived()) { System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name()); assertTrue(message.getStatus().equals(DistributionStatusEnum.ALREADY_DEPLOYED) || message.getStatus().equals(DistributionStatusEnum.ALREADY_DOWNLOADED)); } - - + + // Try again to load same notif but in V2 ASDCController asdcControllerV2 = new ASDCController("asdc-controller1", distribClientV2); asdcControllerV2.initASDC(); asdcControllerV2.treatNotification(notifDataV2); - + for (IDistributionStatusMessage message:distribClientV2.getDistributionMessageReceived()) { System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name()); assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK)); } - + this.validateVnfResource(notifDataV2,distribClientV2.getListVFModuleMetaData()); - - + + // Try again to load same notif + Script + Volume artifacts and in service V3 ASDCController asdcControllerV3 = new ASDCController("asdc-controller1", distribClientV3); asdcControllerV3.initASDC(); asdcControllerV3.treatNotification(notifDataV3); - + for (IDistributionStatusMessage message:distribClientV3.getDistributionMessageReceived()) { System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name()); assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK)); } - + this.validateVnfResource(notifDataV3,distribClientV3.getListVFModuleMetaData()); - + // Try again to load same notif + Script + Volume artifacts and in service V4 ASDCController asdcControllerV4 = new ASDCController("asdc-controller1", distribClientV4); asdcControllerV4.initASDC(); asdcControllerV4.treatNotification(notifDataV4); - + for (IDistributionStatusMessage message:distribClientV4.getDistributionMessageReceived()) { System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name()); assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK)); } - + this.validateVnfResource(notifDataV4,distribClientV4.getListVFModuleMetaData()); - - - // Try again with service V5 (Nested template attached to Volume + HEat artifact not used by module), + + + // Try again with service V5 (Nested template attached to Volume + HEat artifact not used by module), //this should force the notification DEPLOY_ERROR to be sent for this artifact ASDCController asdcControllerV5 = new ASDCController("asdc-controller1", distribClientV5); asdcControllerV5.initASDC(); asdcControllerV5.treatNotification(notifDataV5); - + for (IDistributionStatusMessage message:distribClientV5.getDistributionMessageReceived()) { System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name()); if ("cloud-nimbus.sh".equals(message.getArtifactURL())) { @@ -464,22 +466,22 @@ public class ASDCITCase { assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK)); } } - + this.validateVnfResource(notifDataV5,distribClientV5.getListVFModuleMetaData()); - - + + // Try again with demo DNS ASDCController asdcControllerDNS = new ASDCController("asdc-controller1", distribClientDNS); asdcControllerDNS.initASDC(); asdcControllerDNS.treatNotification(notifDataDNS); - + for (IDistributionStatusMessage message:distribClientDNS.getDistributionMessageReceived()) { System.out.println("Message received, URL:"+message.getArtifactURL()+", Value:"+message.getStatus().name()); assertTrue(message.getStatus().equals(DistributionStatusEnum.DEPLOY_OK) || message.getStatus().equals(DistributionStatusEnum.DOWNLOAD_OK)); } - + this.validateVnfResource(notifDataDNS,distribClientDNS.getListVFModuleMetaData()); - + // Try again with demo VFW ASDCController asdcControllerVFW = new ASDCController("asdc-controller1", distribClientVFW); asdcControllerVFW.initASDC(); diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/DistributionClientEmulator.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/DistributionClientEmulator.java index f2fabc09ce..54be7cdc90 100644 --- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/DistributionClientEmulator.java +++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/DistributionClientEmulator.java @@ -16,6 +16,9 @@ import org.openecomp.sdc.api.consumer.IDistributionStatusMessage; import org.openecomp.sdc.api.consumer.INotificationCallback; import org.openecomp.sdc.api.notification.IArtifactInfo; import org.openecomp.sdc.api.notification.IVfModuleMetadata; +import org.openecomp.mso.asdc.installer.IVfModuleData; +import org.openecomp.mso.asdc.installer.VfModuleMetaData; +import org.openecomp.mso.asdc.client.ASDCConfiguration; import org.openecomp.sdc.api.results.IDistributionClientDownloadResult; import org.openecomp.sdc.api.results.IDistributionClientResult; import org.openecomp.sdc.impl.DistributionClientDownloadResultImpl; @@ -25,59 +28,51 @@ import org.openecomp.sdc.utils.DistributionActionResultEnum; public class DistributionClientEmulator implements IDistributionClient { private String resourcePath; - - private List listVFModuleMetaData; - + + private List listVFModuleMetaData; + private List distributionMessageReceived = new LinkedList<>(); - + public DistributionClientEmulator(String notifFolderInResource) { - + resourcePath = notifFolderInResource; } public List getDistributionMessageReceived() { return distributionMessageReceived; } - - @Override + @Deprecated public List decodeVfModuleArtifact(byte[] arg0) { - try { - listVFModuleMetaData = new ObjectMapper().readValue(arg0, new TypeReference>(){}); - return listVFModuleMetaData; - - } catch (JsonParseException e) { - e.printStackTrace(); - } catch (JsonMappingException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } + + return null; } - - public List getListVFModuleMetaData() { + + public List getListVFModuleMetaData() { return listVFModuleMetaData; } - @Override + @Override public IDistributionClientDownloadResult download (IArtifactInfo arg0) { - - + //String filename = resourcePath+"/artifacts/"+arg0.getArtifactURL(); String filename = arg0.getArtifactURL(); System.out.println("Emulating the download from resources files:"+filename); InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcePath+"/artifacts/"+filename); - + if (inputStream == null) { System.out.println("InputStream is NULL for:"+filename); } try { - return new DistributionClientDownloadResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name(),arg0.getArtifactName(),IOUtils.toByteArray(inputStream)); + byte[] bytes = IOUtils.toByteArray(inputStream); + if (arg0.getArtifactType().equals(ASDCConfiguration.VF_MODULES_METADATA)) { + listVFModuleMetaData = new ObjectMapper().readValue(bytes, new TypeReference>() { + }); + } + return new DistributionClientDownloadResultImpl(DistributionActionResultEnum.SUCCESS, DistributionActionResultEnum.SUCCESS.name(),arg0.getArtifactName(),bytes); } catch (IOException e) { - - e.printStackTrace(); + return null; } - return null; } @Override @@ -122,7 +117,7 @@ public class DistributionClientEmulator implements IDistributionClient { @Override public IDistributionClientResult stop() { return new DistributionClientResultImpl(DistributionActionResultEnum.SUCCESS,DistributionActionResultEnum.SUCCESS.name()); - + } @Override diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfo.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfo.java index e30bb5fcd0..79dcaed0c8 100644 --- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfo.java +++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/asdc/notif_emulator/JsonResourceInfo.java @@ -16,15 +16,15 @@ public class JsonResourceInfo implements IResourceInstance { @JsonIgnore private Map attributesMap = new HashMap<>(); - + @JsonProperty("artifacts") @JsonDeserialize(using=JsonArtifactInfoDeserializer.class) private List artifacts; - + public JsonResourceInfo() { - + } - + @Override public List getArtifacts() { return artifacts; @@ -59,7 +59,22 @@ public class JsonResourceInfo implements IResourceInstance { public String getResourceVersion() { return (String)attributesMap.get("resourceVersion"); } - + + @Override + public String getResourceCustomizationUUID() { + return (String)attributesMap.get("resourceCustomizationUUID"); + } + + @Override + public String getSubcategory() { + return (String)attributesMap.get("subCategory"); + } + + @Override + public String getCategory() { + return (String)attributesMap.get("category"); + } + @SuppressWarnings("unused") @JsonAnySetter public final void setAttribute(String attrName, Object attrValue) { diff --git a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/soapui/SoapUiITCase.java b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/soapui/SoapUiITCase.java index 5783b237ed..abcb7d09a8 100644 --- a/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/soapui/SoapUiITCase.java +++ b/packages/arquillian-unit-tests/src/test/java/org/openecomp/mso/global_tests/soapui/SoapUiITCase.java @@ -86,11 +86,18 @@ public class SoapUiITCase { return warArchive; } - @Deployment(name="gammaBPMN",testable=false) - public static Archive createGammaBPMNDeployment () { - System.out.println("Deploying Gamma BPMN WAR on default server"); - return ArquillianPackagerForITCases.createPackageFromExistingOne("../../bpmn/MSOGammaBPMN/target/", "MSOGammaBPMN*.war", "MSOGammaBPMN.war"); + @Deployment(name="common-bpmn",testable=false) + public static Archive createCommonBPMNDeployment () { + System.out.println("Deploying Common BPMN WAR on default server"); + return ArquillianPackagerForITCases.createPackageFromExistingOne("../../bpmn/MSOCommonBPMN/target/", "MSOCommonBPMN*.war", "MSOCommonBPMN.war"); } + + @Deployment(name = "infrastructure-bpmn", testable = false) + public static Archive createInfraBPMNDeployment() { + System.out.println("Deploying Infrastructure BPMN WAR on default server"); + return ArquillianPackagerForITCases.createPackageFromExistingOne("../../bpmn/MSOInfrastructureBPMN/target/", + "MSOInfrastructureBPMN*.war", "MSOInfrastructureBPMN.war"); + } /* @Deployment(name = "SoapUIMocks", testable = false) public static Archive createSoapUIMocksWarDeployment () { diff --git a/packages/arquillian-unit-tests/src/test/resources/JMeter/MSO-Perf.jmx b/packages/arquillian-unit-tests/src/test/resources/JMeter/MSO-Perf.jmx index 4d7e95ca4f..5f9325838e 100644 --- a/packages/arquillian-unit-tests/src/test/resources/JMeter/MSO-Perf.jmx +++ b/packages/arquillian-unit-tests/src/test/resources/JMeter/MSO-Perf.jmx @@ -140,12 +140,12 @@ false - <service-request xmlns="http://ecomp.att.com/mso/request/layer3serviceactivate/schema/v1" xmlns:msolayer3="http://ecomp.att.com/mso/request/layer3/schema/v1" xmlns:msoservtypes="http://ecomp.att.com/mso/request/types/v1"> + <service-request xmlns="http://org.openecomp/mso/request/layer3serviceactivate/schema/v1" xmlns:msolayer3="http://org.openecomp/mso/request/layer3/schema/v1" xmlns:msoservtypes="http://org.openecomp/mso/request/types/v1"> <msoservtypes:request-information> <msoservtypes:request-id>test${REQUEST_ID}-service</msoservtypes:request-id> <msoservtypes:request-action>Layer3ServiceActivateRequest</msoservtypes:request-action> <msoservtypes:source>OMX</msoservtypes:source> -<msoservtypes:notification-url>https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url> +<msoservtypes:notification-url>https://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url> <msoservtypes:order-number>5051560</msoservtypes:order-number> <msoservtypes:order-version>1</msoservtypes:order-version> </msoservtypes:request-information> @@ -252,14 +252,14 @@ false <feature-request - xmlns="http://ecomp.att.com/mso/request/layer3serviceactivate/schema/v1" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:msolayer3="http://ecomp.att.com/mso/request/layer3/schema/v1" - xmlns:msoservtypes="http://ecomp.att.com/mso/request/types/v1"> + xmlns="http://org.openecomp/mso/request/layer3serviceactivate/schema/v1" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:msolayer3="http://org.openecomp/mso/request/layer3/schema/v1" + xmlns:msoservtypes="http://org.openecomp/mso/request/types/v1"> <msoservtypes:request-information> <msoservtypes:request-id>test${REQUEST_ID}-feature</msoservtypes:request-id> <msoservtypes:request-action>ChangeFeatureActivateRequest</msoservtypes:request-action> <msoservtypes:source>OMX</msoservtypes:source> - <msoservtypes:notification-url>https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url> + <msoservtypes:notification-url>https://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url> <msoservtypes:order-number>5051560</msoservtypes:order-number> <msoservtypes:order-version>1</msoservtypes:order-version> </msoservtypes:request-information> @@ -495,12 +495,12 @@ false - <service-request xmlns="http://ecomp.att.com/mso/request/layer3serviceactivate/schema/v1" xmlns:msolayer3="http://ecomp.att.com/mso/request/layer3/schema/v1" xmlns:msoservtypes="http://ecomp.att.com/mso/request/types/v1"> + <service-request xmlns="http://org.openecomp/mso/request/layer3serviceactivate/schema/v1" xmlns:msolayer3="http://org.openecomp/mso/request/layer3/schema/v1" xmlns:msoservtypes="http://org.openecomp/mso/request/types/v1"> <msoservtypes:request-information> <msoservtypes:request-id>test${SERVICE_ID}-service</msoservtypes:request-id> <msoservtypes:request-action>Layer3ServiceActivateRequest</msoservtypes:request-action> <msoservtypes:source>OMX</msoservtypes:source> -<msoservtypes:notification-url>https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url> +<msoservtypes:notification-url>https://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url> <msoservtypes:order-number>5051560</msoservtypes:order-number> <msoservtypes:order-version>1</msoservtypes:order-version> </msoservtypes:request-information> @@ -693,12 +693,12 @@ false - <service-request xmlns="http://ecomp.att.com/mso/request/layer3serviceactivate/schema/v1" xmlns:msolayer3="http://ecomp.att.com/mso/request/layer3/schema/v1" xmlns:msoservtypes="http://ecomp.att.com/mso/request/types/v1"> + <service-request xmlns="http://org.openecomp/mso/request/layer3serviceactivate/schema/v1" xmlns:msolayer3="http://org.openecomp/mso/request/layer3/schema/v1" xmlns:msoservtypes="http://org.openecomp/mso/request/types/v1"> <msoservtypes:request-information> <msoservtypes:request-id>test${SERVICE_ID}-service</msoservtypes:request-id> <msoservtypes:request-action>Layer3ServiceActivateRequest</msoservtypes:request-action> <msoservtypes:source>OMX</msoservtypes:source> -<msoservtypes:notification-url>https://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url> +<msoservtypes:notification-url>https://localhost:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws</msoservtypes:notification-url> <msoservtypes:order-number>5051560</msoservtypes:order-number> <msoservtypes:order-version>1</msoservtypes:order-version> </msoservtypes:request-information> diff --git a/packages/arquillian-unit-tests/src/test/resources/SoapUI/Healthcheck-soapui-project.xml b/packages/arquillian-unit-tests/src/test/resources/SoapUI/Healthcheck-soapui-project.xml index 4629cd8173..19b3c5144d 100644 --- a/packages/arquillian-unit-tests/src/test/resources/SoapUI/Healthcheck-soapui-project.xml +++ b/packages/arquillian-unit-tests/src/test/resources/SoapUI/Healthcheck-soapui-project.xml @@ -1,114 +1,114 @@ -http://localhost:8080enabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 401 404htmltext/plain200dataapplication/jsontext/plain500datatext/html200html<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}No AuthorizationenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 401htmltext/plain200dataapplication/jsontext/plain500data0data<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}No AuthorizationenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 401 403htmltext/plain200dataapplication/json0data0data<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 401 403htmltext/plain200dataapplication/json0datatext/plain500data<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404 401htmltext/plain200dataapplication/json<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404htmltext/plain200dataapplication/json<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404 401htmltext/plain200dataapplication/json<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404 401htmltext/plain200dataapplication/json<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404 401htmltext/plain200dataapplication/json<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404htmltext/plain200dataapplication/json<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404htmltext/plain200dataapplication/json<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404 403htmltext/plain200dataapplication/jsontext/plain500data0data<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNamehttp://localhost:8080enableBpmnQUERY0datatext/html200htmltext/html503html<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/globalhealthcheckNo AuthorizationenableBpmnenableBpmnQUERY0data0data0datatext/html503htmltext/html200html<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/globalhealthcheckNo AuthorizationenableBpmnhttp://${#Project#jrahost}text/html200htmltext/html503html0data0data0data0datatext/html;charset=utf-8500html<xml-fragment/>http://${#Project#jrahost}http://localhost/networks/admin/healthcheckNo Authorizationtext/html200htmltext/html503html<xml-fragment/>truehttp://${#Project#jrahost}http://localhost/adapters/rest/healthcheckNo Authorizationtext/html200htmltext/html503html0datatext/html;charset=utf-8500 404html<xml-fragment/>http://${#Project#jrahost}http://localhost/vnfs/rest/healthcheckNo Authorization0data0datatext/html200htmltext/html503html<xml-fragment/>http://${#Project#jrahost}http://localhost/tenants/admin/healthcheckNo Authorizationtext/html200htmltext/html503html0datatext/html;charset=utf-8404html<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/healthcheckNo Authorizationtext/html200htmltext/html503html0data<xml-fragment/>http://${#Project#apihhost}http://localhost/asdc/healthcheckNo Authorizationnot used in Arquilian as not same repoapplication/jsonapplication/json500 503heal:Faulttext/html;charset=utf-8400 404 405htmlapplication/json200heal:Response0data0data0datatext/html200html<xml-fragment/>http://${#Project#bpmnhost}{"variables":{}}localhost/mso/async/services/HealthCheckNo Authorizationtext/html200htmltext/html503html0data0data0data0data200data200data200data200data0data0data0data0data0data<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/healthcheckNo Authorizationnot used in Arquilian as not same repoapplication/jsonapplication/json500 503heal:Faulttext/html;charset=utf-8400 404htmlapplication/json200heal:Response0data0data0data<xml-fragment/>http://${#Project#bpmnhost}{"variables":{"requestId":{"value":"test","type":"String"}}}localhost/mso/async/services/HealthCheckNo Authorizationhttp://192.168.126.130:8080text/xml;charset=ISO-8859-1200soapenv:Envelopeapplication/xmlsoapenv:Envelopetext/xml;charset=ISO-8859-1500soapenv:Envelopetext/html;charset=utf-8404html<xml-fragment/>http://${#Project#apihhost} +http://localhost:8080enabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 401 404htmltext/plain200dataapplication/jsontext/plain500datatext/html200html<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}No AuthorizationenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 401htmltext/plain200dataapplication/jsontext/plain500data0data<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}No AuthorizationenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 401 403htmltext/plain200dataapplication/json0data0data<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 401 403htmltext/plain200dataapplication/json0datatext/plain500data<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404 401htmltext/plain200dataapplication/json<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404htmltext/plain200dataapplication/json<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404 401htmltext/plain200dataapplication/json<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404 401htmltext/plain200dataapplication/json<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404 401htmltext/plain200dataapplication/json<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404htmltext/plain200dataapplication/json<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404htmltext/plain200dataapplication/json<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNameenabletrueQUERYtruesiteName${#Project#sitename}TEMPLATE${#Project#sitename}text/html;charset=utf-8405 404 403htmltext/plain200dataapplication/jsontext/plain500data0data<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteNamehttp://localhost:8080enableBpmnQUERY0datatext/html200htmltext/html503html<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/globalhealthcheckNo AuthorizationenableBpmnenableBpmnQUERY0data0data0datatext/html503htmltext/html200html<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/globalhealthcheckNo AuthorizationenableBpmnhttp://${#Project#jrahost}text/html200htmltext/html503html0data0data0data0datatext/html;charset=utf-8500html<xml-fragment/>http://${#Project#jrahost}http://localhost/networks/admin/healthcheckNo Authorizationtext/html200htmltext/html503html<xml-fragment/>truehttp://${#Project#jrahost}http://localhost/adapters/rest/healthcheckNo Authorizationtext/html200htmltext/html503html0datatext/html;charset=utf-8500 404html<xml-fragment/>http://${#Project#jrahost}http://localhost/vnfs/rest/healthcheckNo Authorization0data0datatext/html200htmltext/html503html<xml-fragment/>http://${#Project#jrahost}http://localhost/tenants/admin/healthcheckNo Authorizationtext/html200htmltext/html503html0datatext/html;charset=utf-8404html<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/healthcheckNo Authorizationtext/html200htmltext/html503html0data<xml-fragment/>http://${#Project#apihhost}http://localhost/asdc/healthcheckNo Authorizationnot used in Arquilian as not same repoapplication/jsonapplication/json500 503heal:Faulttext/html;charset=utf-8400 404 405htmlapplication/json200heal:Response0data0data0datatext/html200htmltext/html404html<xml-fragment/>http://${#Project#bpmnhost}{"variables":{}}localhost/mso/async/services/HealthCheckNo Authorizationtext/html200htmltext/html503html0data0data0data0data200data200data200data200data0data0data0data0data0data<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/healthcheckNo Authorizationnot used in Arquilian as not same repoapplication/jsonapplication/json500 503heal:Faulttext/html;charset=utf-8400 404htmlapplication/json200heal:Response0data0data0data<xml-fragment/>http://${#Project#bpmnhost}{"variables":{"requestId":{"value":"test","type":"String"}}}localhost/mso/async/services/HealthCheckNo Authorizationtext/html200htmlhttp://${#Project#jrahost}No Authorizationhttp://192.168.126.130:8080text/xml;charset=ISO-8859-1200soapenv:Envelopeapplication/xmlsoapenv:Envelopetext/xml;charset=ISO-8859-1500soapenv:Envelopetext/html;charset=utf-8404html<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapterNo Authorizationhttp://localhost:8080text/html200html<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/nodehealthcheckNo Authorizationtext/html200htmltext/html;charset=utf-8401htmltext/html503html<xml-fragment/>http://${#Project#apihhost}http://localhost/adapters/rest/nodehealthcheckNo AuthorizationSEQUENTIAL<xml-fragment/>http://${#Project#apihhost} +]]>http://localhost/dbadapters/RequestsDbAdapterNo Authorizationhttp://localhost:8080text/html200html<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/nodehealthcheckNo Authorizationtext/html200htmltext/html;charset=utf-8401htmltext/html503html<xml-fragment/>http://${#Project#apihhost}http://localhost/adapters/rest/nodehealthcheckNo Authorization0datatext/html200htmlhttp://localhost:8080No AuthorizationSEQUENTIAL<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalseNo Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/adapters/rest/nodehealthcheck200No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/nodehealthcheck200No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/globalhealthcheck200No AuthorizationenableBpmn<xml-fragment/>http://${#Project#jrahost}http://localhost/networks/admin/healthcheck200No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/healthcheck200No Authorization<xml-fragment/>http://${#Project#bpmnhost}{"variables":{}}localhost/mso/async/services/HealthCheck200No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} +]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#apihhost}http://localhost/adapters/rest/nodehealthcheck200No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/nodehealthcheck200No Authorization<xml-fragment/>UTF-8http://${#Project#jrahost}http://http//$%7B200No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/globalhealthcheck200No AuthorizationenableBpmn<xml-fragment/>http://${#Project#jrahost}http://localhost/networks/admin/healthcheck200No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/healthcheck200No Authorization<xml-fragment/>http://${#Project#bpmnhost}{"variables":{}}localhost/mso/async/services/HealthCheck200No Authorization<xml-fragment/>UTF-8http://${#Project#jrahost}http://localhost/mso/common/healthcheck200No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalseNo Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/nodehealthcheck200No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/globalhealthcheck200No AuthorizationenableBpmn<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/globalhealthcheck200No AuthorizationenableBpmn<xml-fragment/>http://${#Project#jrahost}http://localhost/networks/admin/healthcheck200No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/healthcheck200No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/vnfs/admin/healthcheck200No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/tenants/admin/healthcheck200No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/healthcheck200No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/asdc/healthcheck200No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}No AuthorizationenablesiteName<xml-fragment/>http://${#Project#apihhost}http://localhost/adapters/rest/nodehealthcheck503No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/nodehealthcheck503No Authorization<xml-fragment/>http://${#Project#apihhost} +]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/nodehealthcheck200No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/globalhealthcheck200No AuthorizationenableBpmn<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/globalhealthcheck200No AuthorizationenableBpmn<xml-fragment/>http://${#Project#jrahost}http://localhost/networks/admin/healthcheck200No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/healthcheck200No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/vnfs/admin/healthcheck200No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/tenants/admin/healthcheck200No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/healthcheck200No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/asdc/healthcheck200No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}No AuthorizationenablesiteName<xml-fragment/>http://${#Project#apihhost}http://localhost/adapters/rest/nodehealthcheck503No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/nodehealthcheck503No Authorization<xml-fragment/>UTF-8http://${#Project#jrahost}http://http//$%7B503No Authorization<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapter<return>false</return>falsefalseNo Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/globalhealthcheck503No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/healthcheck503No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/globalhealthcheck503No AuthorizationenableBpmn<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}No AuthorizationenablesiteName<xml-fragment/>http://${#Project#apihhost} +]]>http://localhost/dbadapters/RequestsDbAdapter<return>false</return>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/globalhealthcheck503No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/healthcheck503No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/globalhealthcheck503No AuthorizationenableBpmn<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}No AuthorizationenablesiteName<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalseNo Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#bpmnhost}{"variables":{}}localhost/mso/async/services/HealthCheck503No Authorization<xml-fragment/>http://${#Project#apihhost} +]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#bpmnhost}{"variables":{}}localhost/mso/async/services/HealthCheck503No Authorization<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapter<return>false</return>falsefalseNo Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} +]]>http://localhost/dbadapters/RequestsDbAdapter<return>false</return>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalseNo Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} +]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapter<return>false</return>falsefalseNo Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} +]]>http://localhost/dbadapters/RequestsDbAdapter<return>false</return>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalseNo Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} +]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapter<return>false</return>falsefalseNo Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} +]]>http://localhost/dbadapters/RequestsDbAdapter<return>false</return>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalseNo Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} +]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapter<return>false</return>falsefalseNo Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} +]]>http://localhost/dbadapters/RequestsDbAdapter<return>false</return>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalseNo Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} +]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalseNo Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} +]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapter<return>false</return>falsefalseNo Authorizationhttp://${#Project#jrahost}http://localhost/adapters/rest/globalhealthcheck503No AuthorizationenableBpmnhttp://${#Project#jrahost}http://localhost/networks/admin/healthcheck503No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/healthcheck503No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/vnfs/admin/healthcheck503No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/tenants/admin/healthcheck503No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/healthcheck503No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/asdc/healthcheck503No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} +]]>http://localhost/dbadapters/RequestsDbAdapter<return>false</return>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settingshttp://${#Project#jrahost}http://localhost/adapters/rest/globalhealthcheck503No AuthorizationenableBpmnhttp://${#Project#jrahost}http://localhost/networks/admin/healthcheck503No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/healthcheck503No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/vnfs/admin/healthcheck503No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/tenants/admin/healthcheck503No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/ecomp/mso/infra/healthcheck503No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/asdc/healthcheck503No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/ecomp/mso/infra/setStatus200${#Project#userlogin}${#Project#userpassword}BasicBasicGlobal HTTP SettingsenablesiteName<xml-fragment/>http://${#Project#apihhost} ${#Project#sitename} -]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalseNo Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/adapters/rest/nodehealthcheck200No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/globalhealthcheck200No AuthorizationenableBpmnhttp://${#Project#jrahost}http://localhost/tenants/admin/healthcheck200No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/asdc/healthcheck200No Authorizationapihhostlocalhost:8080jrahostlocalhost:8080userloginsitecontroluserpasswordDomain2.0!bpmnhostlocalhost:8080sitenamemso-dockerenableBpmn \ No newline at end of file +]]>http://localhost/dbadapters/RequestsDbAdapter<return>true</return>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#apihhost}http://localhost/adapters/rest/nodehealthcheck200No Authorization<xml-fragment/>http://${#Project#jrahost}http://localhost/adapters/rest/globalhealthcheck200No AuthorizationenableBpmnhttp://${#Project#jrahost}http://localhost/tenants/admin/healthcheck200No Authorization<xml-fragment/>http://${#Project#apihhost}http://localhost/asdc/healthcheck200No Authorizationapihhostlocalhost:8080jrahostlocalhost:8080userloginsitecontroluserpasswordDomain2.0!bpmnhostlocalhost:8080sitenamemso-dockerenableBpmndbadapteruserBPELClientdbadapterpasswordpassword1$ \ No newline at end of file diff --git a/packages/arquillian-unit-tests/src/test/resources/SoapUI/Local-API-Handler-soapui-project.xml b/packages/arquillian-unit-tests/src/test/resources/SoapUI/Local-API-Handler-soapui-project.xml index 80ac36c8af..49887308b9 100755 --- a/packages/arquillian-unit-tests/src/test/resources/SoapUI/Local-API-Handler-soapui-project.xml +++ b/packages/arquillian-unit-tests/src/test/resources/SoapUI/Local-API-Handler-soapui-project.xml @@ -1,5 +1,5 @@ -http://localhost:8080application/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404 502 409v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data<xml-fragment/>http://${#Project#host} +http://localhost:8080application/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404 502 409v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data<xml-fragment/>http://${#Project#host} 155415ab-b4a7-4382-b4c6-d17d950565 Layer3ServiceActivateRequest @@ -67,10 +67,10 @@ ]]>http://localhost/ecomp/mso/v1/services${#Project#user-csi}${#Project#password-csi}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#host} @@ -120,7 +120,7 @@ ification.jws 48 - + Y Y @@ -130,14 +130,14 @@ ification.jws 10.192.70.252 - + Y 2620:0:10d0:0:ffff:ffff:ffff:fffe 64 2620:0:10d0:0:ffff:ffff:ffff:fffd - + Y @@ -174,10 +174,10 @@ ification.jws - ]]>http://localhost/ecomp/mso/v1/services/${#Project#user-csi}${#Project#password-csi}BasicBasicGlobal HTTP Settingsapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404 502v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data<xml-fragment/>http://${#Project#host} + ]]>http://localhost/ecomp/mso/v1/services/${#Project#user-csi}${#Project#password-csi}BasicBasicGlobal HTTP Settingsapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404 502v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data<xml-fragment/>http://${#Project#host} 155415ab-b4a7-4382-b4c6-d17d950565 FeatureChangeActivateRequest @@ -197,16 +197,16 @@ ification.jws ST E2E Test50565_13000050565 -]]>http://localhost/ecomp/mso/v1/services/feature${#Project#user-gui}${#Project#password-gui}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#host}http://localhost/ecomp/mso/v1/services/feature${#Project#user-gui}${#Project#password-gui}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#host} requestid12392 - ChangeFeatureActivateRequest + ChangeFeatureActivateRequest OMX http://localhost:9096/CSINotify 123123 @@ -215,7 +215,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SDN-ETHERNET-INTERNET AS/VLXM/000212//SB_INTERNET - StevesPizzaPlace15 + StevesPizzaPlace15 FIREWALL-LITE @@ -230,10 +230,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -]]>http://localhost/ecomp/mso/v1/services/feature${#Project#user-gui}${#Project#password-gui}BasicBasicGlobal HTTP Settingsrequest-idTEMPLATEapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data*/*200v1:query-response<xml-fragment/>http://${#Project#host} +]]>http://localhost/ecomp/mso/v1/services/feature${#Project#user-gui}${#Project#password-gui}BasicBasicGlobal HTTP Settingsrequest-idTEMPLATEapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data*/*200v1:query-response<xml-fragment/>http://${#Project#host} 155415ab-b4a7-4382-b4c6-d17d950565 FeatureChangeActivateRequest @@ -253,10 +253,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ST E2E Test50565_13000050565 -]]>http://localhost/ecomp/mso/v1/services/feature${#Project#user-csi}${#Project#password-csi}BasicBasicGlobal HTTP Settingsrequest-idfeature-instance-idTEMPLATEapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data*/*200v1:query-responses<xml-fragment/>http://${#Project#host} +]]>http://localhost/ecomp/mso/v1/services/feature${#Project#user-csi}${#Project#password-csi}BasicBasicGlobal HTTP Settingsrequest-idfeature-instance-idTEMPLATEapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data*/*200v1:query-responses<xml-fragment/>http://${#Project#host} 155415ab-b4a7-4382-b4c6-d17d950565 FeatureChangeActivateRequest @@ -276,10 +276,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ST E2E Test50565_13000050565 -]]>http://localhost/ecomp/mso/v1/services/feature${#Project#user-gui}${#Project#password-gui}BasicBasicGlobal HTTP Settingsfeature-instance-idservice-instance-idTEMPLATEapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data400data*/*200v1:query-responses<xml-fragment/>http://${#Project#host} +]]>http://localhost/ecomp/mso/v1/services/feature${#Project#user-gui}${#Project#password-gui}BasicBasicGlobal HTTP Settingsfeature-instance-idservice-instance-idTEMPLATEapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data400data*/*200v1:query-responses<xml-fragment/>http://${#Project#host} 155415ab-b4a7-4382-b4c6-d17d950565 FeatureChangeActivateRequest @@ -299,10 +299,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ST E2E Test50565_13000050565 -]]>http://localhost/ecomp/mso/v1/services/feature${#Project#user-csi}${#Project#password-csi}BasicBasicGlobal HTTP Settingsservice-instance-idservice-instance-idQUERYfeature-instance-idQUERYapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data*/*200v1:query-responses<xml-fragment/>http://${#Project#host} +]]>http://localhost/ecomp/mso/v1/services/feature${#Project#user-csi}${#Project#password-csi}BasicBasicGlobal HTTP Settingsservice-instance-idservice-instance-idQUERYfeature-instance-idQUERYapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data*/*200v1:query-responses<xml-fragment/>http://${#Project#host} 155415ab-b4a7-4382-b4c6-d17d950565 FeatureChangeActivateRequest @@ -322,8 +322,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ST E2E Test50565_13000050565 -]]>http://localhost/ecomp/mso/v1/services/feature${#Project#user-gui}${#Project#password-gui}BasicBasicGlobal HTTP Settingsservice-instance-idfeature-instance-idapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404 502v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data<xml-fragment/>http://${#Project#host} - +]]>http://localhost/ecomp/mso/v1/services/feature${#Project#user-gui}${#Project#password-gui}BasicBasicGlobal HTTP Settingsservice-instance-idfeature-instance-idapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404 502v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data<xml-fragment/>http://${#Project#host} + tns:request-id GetAicNodesRequest @@ -343,8 +343,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 0 Mbps -]]>http://localhost/ecomp/mso/v1/services${#Project#user-csi}${#Project#password-csi}BasicBasicGlobal HTTP Settingsapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404 502 409v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data<xml-fragment/>http://${#Project#host}]]>http://localhost/ecomp/mso/v1/services${#Project#user-csi}${#Project#password-csi}BasicBasicGlobal HTTP Settingsapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404 502 409v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data<xml-fragment/>http://${#Project#host} 3d878a8e-51fa-44aa-8cb5-a56ae9352252 @@ -358,9 +358,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" AUSTXAALCP1 276b95b6d2b04e2e830c976eb70c9405 - + -]]>http://localhost/ecomp/mso/v1/services${#Project#user-csi}${#Project#password-csi}BasicBasicGlobal HTTP Settingsvnf-typeQUERYservice-typeQUERYaic-node-clliQUERYtenant-idQUERYvolume-group-idQUERYvolume-group-nameQUERY*/*200v1:vnf-requeststext/html;charset=utf-8405htmlhttp://localhost:8080No Authorizationvnf-typeservice-typeaic-node-cllitenant-idvolume-group-idvolume-group-namevnf-roleQUERYtext/html;charset=utf-8401 403 404 500html*/*200v1:vnf-types<xml-fragment/>http://${#Project#host}http://135.21.125.49/ecomp/mso/infra/V1/vnf-types${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsvnf-rolenetwork-typeQUERYtenant-idQUERYservice-typeQUERYaic-node-clliQUERYtext/html;charset=utf-8401 403 404 500html*/*200v1:vnf-types<xml-fragment/>http://${#Project#host}http://135.21.125.49/ecomp/mso/infra/V1/vnf-types${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsnetwork-typetenant-idservice-typeaic-node-clliapplication/xml400 500 409v1:network-requestapplication/json0data0dataapplication/xmlv1:network-requestapplication/xml202v1:network-request<xml-fragment/>http://localhost:8080 +]]>http://localhost/ecomp/mso/v1/services${#Project#user-csi}${#Project#password-csi}BasicBasicGlobal HTTP Settingsvnf-typeQUERYservice-typeQUERYaic-node-clliQUERYtenant-idQUERYvolume-group-idQUERYvolume-group-nameQUERY*/*200v1:vnf-requeststext/html;charset=utf-8405htmlhttp://localhost:8080No Authorizationvnf-typeservice-typeaic-node-cllitenant-idvolume-group-idvolume-group-namevnf-roleQUERYtext/html;charset=utf-8401 403 404 500html*/*200v1:vnf-types<xml-fragment/>http://${#Project#host}http://localhost/ecomp/mso/infra/V1/vnf-types${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsvnf-rolenetwork-typeQUERYtenant-idQUERYservice-typeQUERYaic-node-clliQUERYtext/html;charset=utf-8401 403 404 500html*/*200v1:vnf-types<xml-fragment/>http://${#Project#host}http://localhost/ecomp/mso/infra/V1/vnf-types${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsnetwork-typetenant-idservice-typeaic-node-clliapplication/xml400 500 409v1:network-requestapplication/json0data0dataapplication/xmlv1:network-requestapplication/xml202v1:network-request<xml-fragment/>http://localhost:8080 CREATE init-status-string 1 @@ -385,8 +385,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 0 -]]>No Authorizationtext/html;charset=utf-8401 403 404 500html*/*200v1:vnf-types<xml-fragment/>http://${#Project#host}http://135.21.125.49/ecomp/mso/infra/V1/vnf-types${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsrequest-idTEMPLATE*/*200v1:network-request<xml-fragment/>http://localhost:8080No Authorizationrequest-idTEMPLATE*/*200v1:vnf-requesttext/html;charset=utf-8404 400htmlapplication/octet-stream200v1:vnf-requesthttp://localhost:8080No AuthorizationtenantIdQUERYvnf-typeQUERY*/*200v1:network-requestapplication/jsonv1:volume-requesttext/html;charset=utf-8401 403htmlapplication/xmlv1:volume-requestapplication/xml400 501v1:volume-requestapplication/xml202v1:volume-request<xml-fragment/>http://localhost:8080 - +]]>No Authorizationtext/html;charset=utf-8401 403 404 500html*/*200v1:vnf-types<xml-fragment/>http://${#Project#host}http://localhost/ecomp/mso/infra/V1/vnf-types${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsrequest-idTEMPLATE*/*200v1:network-request<xml-fragment/>http://localhost:8080No Authorizationrequest-idTEMPLATE*/*200v1:vnf-requesttext/html;charset=utf-8404 400htmlapplication/octet-stream200v1:vnf-requesthttp://localhost:8080No AuthorizationtenantIdQUERYvnf-typeQUERY*/*200v1:network-requestapplication/jsonv1:volume-requesttext/html;charset=utf-8401 403htmlapplication/xmlv1:volume-requestapplication/xml400 501v1:volume-requestapplication/xml202v1:volume-request<xml-fragment/>http://localhost:8080 + cfbca420-14d5-4e68-ad84-b56715c946f4 DELETE_VF_MODULE_VOL @@ -402,7 +402,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" da9e0bdf-7d88-4111-bcad-8b72e3a5e601 -]]>${#Project#user-csi}${#Project#user-csi}BasicBasicGlobal HTTP Settingstext/html;charset=utf-8404 405html*/*200v1:volume-requestshttp://localhost:8080No AuthorizationtenantIdvnf-typeapplication/jsonapplication/json400 409v2:Faultapplication/json202v2:Response0datatext/html;charset=UTF-8401html0data0data0data0data0data0data0data0data0data0data0data<xml-fragment/>http://${#Project#host}{ +]]>${#Project#user-csi}${#Project#user-csi}BasicBasicGlobal HTTP Settingstext/html;charset=utf-8404 405html*/*200v1:volume-requestshttp://localhost:8080No AuthorizationtenantIdvnf-typeapplication/jsonapplication/json400 409 500v2:Faultapplication/json202v2:Response0datatext/html;charset=UTF-8401html0data0data0data0data0data0data0data0data0data0data0data<xml-fragment/>http://${#Project#host}{ "requestDetails": { "modelInfo": { "modelType": "service", @@ -426,11 +426,11 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "name": "someUserParam", "value": "someValue" - } + } ] } } -}http://localhost/ecomp/mso/infra/serviceInstances/v2${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP SettingsserviceInstanceIdTEMPLATEvnfInstanceIdTEMPLATEapplication/jsontext/html;charset=UTF-8401htmlapplication/json400 404 409vfm:Faultapplication/json202vfm:Response0data0data<xml-fragment/>http://${#Project#host}{ "requestDetails": { +}http://localhost/ecomp/mso/infra/serviceInstances/v2${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP SettingsserviceInstanceIdTEMPLATEvnfInstanceIdTEMPLATEapplication/jsontext/html;charset=UTF-8401htmlapplication/json400 404 409vfm:Faultapplication/json202vfm:Response0data0data0data<xml-fragment/>http://${#Project#host}{ "requestDetails": { "modelInfo": { "modelType": "vfModule", "modelInvariantId": "585822c7-4027-4f84-ba50-e9248606f132", @@ -451,7 +451,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "relatedInstance": { "instanceId": "9f3e7072-4cf2-4536-addb-7eed2fef8f39", - "modelInfo": { + "modelInfo": { "modelType": "service", "modelInvariantId": "585822c8-4027-4f84-ba50-e9248606f111", "modelNameVersionId": "1e34774e-715e-4fd6-bd09-7b654622f35i", @@ -460,7 +460,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" } } } - + ], @@ -469,7 +469,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" } } } -${#Project#user-infraportal}${#Project#user-infraportal}BasicBasicGlobal HTTP SettingsserviceInstanceIdvnfInstanceIdserviceInstanceIdserviceInstanceIdTEMPLATEserviceInstanceIdapplication/json502 400vnfs:Faultapplication/jsonapplication/json202vnfs:Response<xml-fragment/>http://${#Project#host}{ +${#Project#user-infraportal}${#Project#user-infraportal}BasicBasicGlobal HTTP SettingsserviceInstanceIdvnfInstanceIdserviceInstanceIdserviceInstanceIdTEMPLATEserviceInstanceIdapplication/json502 400 404vnfs:Faultapplication/jsonapplication/json202vnfs:Response0data0data<xml-fragment/>http://${#Project#host}{ "requestDetails": { "modelInfo": { "modelType": "vnf", @@ -493,7 +493,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "relatedInstance": { "instanceId": "${serviceInstanceId}", - "modelInfo": { + "modelInfo": { "modelType": "service", "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", @@ -531,7 +531,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "name": "someUserParam", "value": "someValue" - } + } ] } } @@ -556,7 +556,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "relatedInstance": { "instanceId": "9f3e7072-4cf2-4536-addb-7eed2fef8f39", - "modelInfo": { + "modelInfo": { "modelType": "service", "modelInvariantId": "585822c8-4027-4f84-ba50-e9248606f111", "modelNameVersionId": "1e34774e-715e-4fd6-bd09-7b654622f35i", @@ -565,7 +565,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" } } } - + ], @@ -595,7 +595,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "relatedInstance": { "instanceId": "9f3e7072-4cf2-4536-addb-7eed2fef8f39", - "modelInfo": { + "modelInfo": { "modelType": "service", "modelInvariantId": "585822c8-4027-4f84-ba50-e9248606f111", "modelNameVersionId": "1e34774e-715e-4fd6-bd09-7b654622f35i", @@ -604,7 +604,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" } } } - + ], @@ -637,7 +637,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "relatedInstance": { "instanceId": "${serviceInstanceId}", - "modelInfo": { + "modelInfo": { "modelType": "service", "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", @@ -672,7 +672,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "relatedInstance": { "instanceId": "9f3e7072-4cf2-4536-addb-7eed2fef8f39", - "modelInfo": { + "modelInfo": { "modelType": "service", "modelInvariantId": "585822c8-4027-4f84-ba50-e9248606f111", "modelNameVersionId": "1e34774e-715e-4fd6-bd09-7b654622f35i", @@ -681,7 +681,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" } } } - + ], @@ -711,7 +711,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "relatedInstance": { "instanceId": "9f3e7072-4cf2-4536-addb-7eed2fef8f39", - "modelInfo": { + "modelInfo": { "modelType": "service", "modelInvariantId": "585822c8-4027-4f84-ba50-e9248606f111", "modelNameVersionId": "1e34774e-715e-4fd6-bd09-7b654622f35i", @@ -720,7 +720,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" } } } - + ], @@ -750,7 +750,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "relatedInstance": { "instanceId": "9f3e7072-4cf2-4536-addb-7eed2fef8f39", - "modelInfo": { + "modelInfo": { "modelType": "service", "modelInvariantId": "585822c8-4027-4f84-ba50-e9248606f111", "modelNameVersionId": "1e34774e-715e-4fd6-bd09-7b654622f35i", @@ -759,7 +759,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" } } } - + ], @@ -768,7 +768,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" } } } -${#Project#user-infraportal}${#Project#user-infraportal}BasicBasicGlobal HTTP SettingsserviceInstanceIdvnfInstanceIdvolumeGroupInstanceIdserviceInstanceIdserviceInstanceIdTEMPLATEserviceInstanceIdapplication/json502 400 404vnfs:Faultapplication/jsonapplication/json202vnfs:Responsetext/html;charset=UTF-8401html415dataapplication/xmlv1:network-request0data<xml-fragment/>http://${#Project#host}{ +${#Project#user-infraportal}${#Project#user-infraportal}BasicBasicGlobal HTTP SettingsserviceInstanceIdvnfInstanceIdvolumeGroupInstanceIdserviceInstanceIdserviceInstanceIdTEMPLATEserviceInstanceIdapplication/json502 400 404vnfs:Faultapplication/jsonapplication/json202vnfs:Responsetext/html;charset=UTF-8401html415dataapplication/xmlv1:network-request0data<xml-fragment/>http://${#Project#host}{ "requestDetails": { "modelInfo": { "modelType": "vnf", @@ -792,7 +792,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "relatedInstance": { "instanceId": "${serviceInstanceId}", - "modelInfo": { + "modelInfo": { "modelType": "service", "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", @@ -830,7 +830,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "relatedInstance": { "instanceId": "${serviceInstanceId}", - "modelInfo": { + "modelInfo": { "modelType": "service", "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", @@ -868,7 +868,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "relatedInstance": { "instanceId": "${serviceInstanceId}", - "modelInfo": { + "modelInfo": { "modelType": "service", "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff", "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", @@ -882,10 +882,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" } } } -${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP SettingsserviceInstanceIdnetworkInstanceIdrequestIdrequestIdTEMPLATErequestIdtext/html;charset=UTF-8401htmlapplication/json200d28:Response204data204data204datahttp://localhost:8080No AuthorizationfilterQUERY0datatext/html404htmltext/html;charset=UTF-8401htmlapplication/json200v2:Response0data<xml-fragment/>http://localhost:8080http://localhost/orchestrationRequests/v2No Authorizationfilterfile:/RequestsDbAdapter.wsdl - +${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP SettingsserviceInstanceIdnetworkInstanceIdrequestIdrequestIdTEMPLATErequestIdtext/html;charset=UTF-8401htmlapplication/json200d28:Response204data204data204datahttp://localhost:8080No AuthorizationfilterQUERY0datatext/html404htmltext/html;charset=UTF-8401htmlapplication/json200v2:Response0data<xml-fragment/>http://localhost:8080http://localhost/orchestrationRequests/v2No Authorizationfilterfile:/RequestsDbAdapter.wsdl + - + @@ -1019,18 +1019,18 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - - - + + + - - - + + + - - + + @@ -1074,14 +1074,14 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -]]>http://schemas.xmlsoap.org/wsdl/REPLACE_WITH_ACTUAL_URLUTF-8REPLACE_WITH_ACTUAL_URL\r +]]>http://schemas.xmlsoap.org/wsdl/REPLACE_WITH_ACTUAL_URLUTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r ?\r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL\r +]]>UTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r @@ -1099,15 +1099,15 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ?\r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL +]]>UTF-8REPLACE_WITH_ACTUAL_URL ? -]]>SEQUENTIAL<xml-fragment/>http://${#Project#host} - +]]>SEQUENTIAL<xml-fragment/>http://${#Project#host} + 3d878a8e-51fa-44aa-8cb5-a56ae9352262 CREATE_VF_MODUL @@ -1130,7 +1130,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ]]>http://localhost/ecomp/mso/v1/services400 No valid actionfalsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#host} - + 3d878a8e-51fa-44aa-8cb5-a56ae9352262 CREATE_VF_MODULE @@ -1152,7 +1152,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ]]>http://localhost/ecomp/mso/v1/services202 <request-status>IN_PROGRESS</request-status>falsefalse<vnf-name>zrdm3ssdr02</vnf-name>falsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsrequest-idResponsePOST VNF request//*:request-idrequest-idGET VNF Request by requestIDtrue<xml-fragment/>http://${#Project#host} - + 3d878a8e-51fa-44aa-8cb5-a56ae9352262 CREATE_VF_MODULE @@ -1174,27 +1174,27 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ]]>http://localhost/ecomp/mso/v1/services409 <request-status>FAILED</request-status>falsefalsevnf-id (f7949288-876d-47c2-9a8c-aed107e7e016) is lockedfalsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#host} - + 3d878a8e-51fa-44aa-8cb5-a56ae9352263 CREATE_VF_MODULE PORTAL - + zrdm3ssdr02 Nimbus_LU2_SSDnoLM_Svc/SSDR_wo_LM_v10 2 SSDR_wo_LM_v10::module-0 a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb - + rdm3 eecd15e8e7ee46c3bbc2096f0924f4c4 ]]>http://localhost/ecomp/mso/v1/services400 <request-status>FAILED</request-status>falsefalse<status-message>Service request FAILED schema validation.falsefalseNo valid vf-module-name isfalsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#host} - + 3d878a8e-51fa-44aa-8cb5-a56ae9352263 DELETE_VF_MODULE @@ -1216,9 +1216,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ]]>http://localhost/ecomp/mso/v1/services202<request-status>IN_PROGRESS</request-status>falsefalse<vnf-name>zrdm3ssdr02</vnf-name>falsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#host}http://localhost/ecomp/mso/infra/v1/vnf-request/01bef4ef-fa1b-4fd4-b46d-12ada0d4d7e1 <request-status>IN_PROGRESS</request-status>falsefalse200${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings -vnf-typeservice-typeaic-node-cllitenantId<xml-fragment/>http://${#Project#host}http://135.21.125.49/ecomp/mso/infra/V1/vnf-types200 -<vnf-types xmlns="http://ecomp.att.com/mso/infra/vnf-request/v1"/>falsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsvnf-role<xml-fragment/>http://${#Project#host} - +vnf-typeservice-typeaic-node-cllitenantId<xml-fragment/>http://${#Project#host}http://localhost/ecomp/mso/infra/V1/vnf-types200 +<vnf-types xmlns="http://org.openecomp/mso/infra/vnf-request/v1"/>falsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsvnf-role<xml-fragment/>http://${#Project#host} + f9d87288-b726-4b23-a207-8eb845a7b8d9 CREATE @@ -1236,7 +1236,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ]]>http://localhost/ecomp/mso/infra/v1/network-requestIN_PROGRESSfalsefalse202 <network-name>Mobisupport-25193-T-Willows2_cor_pcrf_sy_net_1</network-name>falsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#host} - + f9d87288-b726-4b23-a207-8eb845a7b8d9 CREATE @@ -1252,14 +1252,14 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" e5225256ffcc4e22928a432f2bcee195 -]]>http://localhost/ecomp/mso/infra/v1/network-requestIN_PROGRESSfalsefalse409<network-name>Mobisupport-25193-T-Willows2_cor_pcrf_sy_net_1</network-name>falsefalseis lockedfalsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsrequest-idResponsePOST Network Request CREATE//*:request-idrequest-idGET NEtwork Request by request IDtrue<xml-fragment/>http://${#Project#host}http://135.21.125.49/ecomp/mso/infra/V1/vnf-typese5225256ffcc4e22928a432f2bcee195falsefalse200 -${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsnetwork-typetenant-idservice-typeaic-node-clli<xml-fragment/>http://${#Project#host}http://135.21.125.49/ecomp/mso/infra/V1/vnf-typesMobisupport-25193-T-Willows2_cor_pcrf_sy_net_1falsefalse200 +]]>http://localhost/ecomp/mso/infra/v1/network-requestIN_PROGRESSfalsefalse409<network-name>Mobisupport-25193-T-Willows2_cor_pcrf_sy_net_1</network-name>falsefalseis lockedfalsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsrequest-idResponsePOST Network Request CREATE//*:request-idrequest-idGET NEtwork Request by request IDtrue<xml-fragment/>http://${#Project#host}http://localhost/ecomp/mso/infra/V1/vnf-typese5225256ffcc4e22928a432f2bcee195falsefalse200 +${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsnetwork-typetenant-idservice-typeaic-node-clli<xml-fragment/>http://${#Project#host}http://localhost/ecomp/mso/infra/V1/vnf-typesMobisupport-25193-T-Willows2_cor_pcrf_sy_net_1falsefalse200 ${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings -network-typetenantIdservice-typeaic-node-clli<xml-fragment/>http://${#Project#host}http://135.21.125.49/ecomp/mso/infra/V1/vnf-types200vlanfalsefalse <description>Cool network</description> +network-typetenantIdservice-typeaic-node-clli<xml-fragment/>http://${#Project#host}http://localhost/ecomp/mso/infra/V1/vnf-types200vlanfalsefalse <description>Cool network</description> falsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#host} - + cfbca420-14d5-4e68-ad84-b56715c946f4 CREATE_VF_MODULE_VOL @@ -1305,12 +1305,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "name": "someUserParam", "value": "someValue" - } + } ] } } }http://localhost/ecomp/mso/infra/serviceInstances/v2202 -${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingstransfer-to-create-vnf-requestResponseCreate Service$.requestReferences.instanceIdRequestCreate VNF$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-create-vfmodule-requestResponseCreate Service$.requestReferences.instanceIdRequestCreate VFModule$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-create-volumegroups-requestResponseCreate Service$.requestReferences.instanceIdRequestCreate VolumeGroups$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtrueset-testcase-serviceInstanceId-propertyResponseCreate Service$.requestReferences.instanceIdserviceInstanceId#TestCase#JSONPATHXPATHtruetransfer-to-create-network-requestResponseCreate Service$.requestReferences.instanceIdRequestCreate Networks$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-update-vfmodule-requestResponseCreate Service$.requestReferences.instanceIdRequestUpdate VFModule$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-update-volumeGroups-requestResponseCreate Service$.requestReferences.instanceIdRequestUpdate VolumeGroups$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-update-network-requestResponseCreate Service$.requestReferences.instanceIdRequestUpdaate Networks$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtrueset-testcase-requestId-propertyResponseCreate Service$.requestReferences.requestIdrequestId#TestCase#JSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingstransfer-to-create-vnf-requestResponseCreate Service$.requestReferences.instanceIdRequestCreate VNF$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-create-vfmodule-requestResponseCreate Service$.requestReferences.instanceIdRequestCreate VFModule$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-create-volumegroups-requestResponseCreate Service$.requestReferences.instanceIdRequestCreate VolumeGroups$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtrueset-testcase-serviceInstanceId-propertyResponseCreate Service$.requestReferences.instanceIdserviceInstanceId#TestCase#JSONPATHXPATHtruetransfer-to-create-network-requestResponseCreate Service$.requestReferences.instanceIdRequestCreate Networks$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-update-vfmodule-requestResponseCreate Service$.requestReferences.instanceIdRequestUpdate VFModule$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-update-volumeGroups-requestResponseCreate Service$.requestReferences.instanceIdRequestUpdate VolumeGroups$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-update-network-requestResponseCreate Service$.requestReferences.instanceIdRequestUpdaate Networks$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtrueset-testcase-requestId-propertyResponseCreate Service$.requestReferences.requestIdrequestId#TestCase#JSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter @@ -1320,7 +1320,11 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ${#TestCase#serviceInstanceId} -]]>200No Authorization<xml-fragment/>UTF-8http://${#Project#host}http://localhost/ecomp/mso/infra/orchestrationRequests/v2/7d28d657-cdad-44eb-b048-7b0bc68b795a200"requestScope":"service","requestType":"createInstance","requestDetails":{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"ff3514e3-5a33-55df-13ab-12abad84e7ff","modelType":"service","modelNameVersionId":"fe6985cd-ea33-3346-ac12-ab121484a3fe","modelName":"dns-servicetest","modelVersion":"1.0"},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DNS_TEST","suppressRollback":true},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"subscriber-1","subscriberName":"testSubscriber"},"cloudConfiguration":null,"requestParameters":{"subscriptionServiceType":"MOG","userParams":[{"name":"someUserParam","value":"someValue"}]}},"instanceReferences":{"serviceInstanceId":"falsefalse"serviceInstanceName":"DNS_TEST","vnfInstanceId":null,"vnfInstanceName":null,"vfModuleInstanceId":null,"vfModuleInstanceName":null,"volumeGroupInstanceId":null,"volumeGroupInstanceName":null,"networkInstanceId":null,"networkInstanceName":null},"requestStatus":{"requestState":falsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings<xml-fragment/>UTF-8http://${#Project#host}http://localhost/ecomp/mso/infra/orchestrationRequests/v2/7d28d657-cdad-44eb-b048-7b0bc68b795a204${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#host}{"requestDetails": { +]]>200${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>UTF-8http://${#Project#host}http://localhost/ecomp/mso/infra/orchestrationRequests/v2/7d28d657-cdad-44eb-b048-7b0bc68b795a200"requestScope":"service","requestType":"createInstance","requestDetails":{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"ff3514e3-5a33-55df-13ab-12abad84e7ff","modelType":"service","modelNameVersionId":"fe6985cd-ea33-3346-ac12-ab121484a3fe","modelName":"dns-servicetest","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":null,"modelCustomizationId":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DNS_TEST","suppressRollback":true,"requestorId":null},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"subscriber-1","subscriberName":"testSubscriber"},"cloudConfiguration":null,"requestParameters":{"subscriptionServiceType":"MOG","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":falsefalsefalse"serviceInstanceName":"DNS_TEST","vnfInstanceId":null,"vnfInstanceName":null,"vfModuleInstanceId":null,"vfModuleInstanceName":null,"volumeGroupInstanceId":null,"volumeGroupInstanceName":null,"networkInstanceId":null,"networkInstanceName":null,"requestorId":null},"requestStatus":{"requestState":falsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings<xml-fragment/>UTF-8http://${#Project#host}http://localhost/ecomp/mso/infra/orchestrationRequests/v2/7d28d657-cdad-44eb-b048-7b0bc68b795a204${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#host}{"requestDetails": { + "cloudConfiguration": { + "tenantId": "88a6ca3ee0394ade9403f075db23167e", + "lcpCloudRegionId": "mdt1" + }, "modelInfo": { "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", "modelName": "DNSResource", @@ -1329,10 +1333,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "modelCustomizationName": "DNSResource-1", "modelInvariantId": "585822c7-4027-4f84-ba50-e9248606f112" }, - "cloudConfiguration": { - "tenantId": "88a6ca3ee0394ade9403f075db23167e", - "lcpCloudRegionId": "mdt1" - }, "relatedInstanceList": [{"relatedInstance": { "modelInfo": { "modelNameVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe", @@ -1341,16 +1341,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "modelVersion": "1.0", "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff" }, - "instanceId": "abda8f01-08fc-4d4f-8e57-9eaab06e33e4" + "instanceId": "a82d6977-6493-484f-ae8c-1b2f442e0d82" }}], "requestInfo": { "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", - "source": "VID", "suppressRollback": false, + "source": "VID", "instanceName": "DNSTEST1" }, "requestParameters": {} -}}http://localhost/ecomp/mso/infra/serviceInstances/v2/3713d5de-942f-41c4-a1b7-08245bc640cc/vnfs/202${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings<xml-fragment/>UTF-8http://${#Project#host}http://localhost/orchestrationRequests/v2200"requestScope":"service","requestType":"createInstance","requestDetails":{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"ff3514e3-5a33-55df-13ab-12abad84e7ff","modelType":"service","modelNameVersionId":"fe6985cd-ea33-3346-ac12-ab121484a3fe","modelName":"dns-servicetest","modelVersion":"1.0"},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DNS_TEST","suppressRollback":true},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"subscriber-1","subscriberName":"testSubscriber"},"cloudConfiguration":null,"requestParameters":{"subscriptionServiceType":"MOG","userParams":[{"name":"someUserParam","value":"someValue"}]}},"instanceReferences":{"serviceInstanceId":"falsefalse"serviceInstanceName":"DNS_TEST","vnfInstanceId":null,"vnfInstanceName":null,"vfModuleInstanceId":null,"vfModuleInstanceName":null,"volumeGroupInstanceId":null,"volumeGroupInstanceName":null,"networkInstanceId":null,"networkInstanceName":null},"requestStatus":{"requestState":"falsefalse$.requestList2falsefalsefalse"requestScope":"vnf","requestType":"createInstance","requestDetails":{"modelInfo":{"modelCustomizationName":"DNSResource-1","modelInvariantId":"585822c7-4027-4f84-ba50-e9248606f112","modelType":"vnf","modelNameVersionId":"fe6478e4-ea33-3346-ac12-ab121484a3fe","modelName":"DNSResource","modelVersion":"1.0"},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb","orderVersion":null,"source":"VID","instanceName":"DNSTEST1","suppressRollback":false},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"falsefalse"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"ff3514e3-5a33-55df-13ab-12abad84e7ff","modelType":"service","modelNameVersionId":"fe6985cd-ea33-3346-ac12-ab121484a3fe","modelName":"dns-servicetest","modelVersion":"1.0"}}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":"88a6ca3ee0394ade9403f075db23167e","lcpCloudRegionId":"mdt1"},"requestParameters":{"subscriptionServiceType":null,"userParams":[]}},"instanceReferences":{"serviceInstanceId":"falsefalse"serviceInstanceName":null,"vnfInstanceId":null,"vnfInstanceName":"DNSTEST1","vfModuleInstanceId":null,"vfModuleInstanceName":null,"volumeGroupInstanceId":null,"volumeGroupInstanceName":null,"networkInstanceId":null,"networkInstanceName":null},"requestStatus":{"requestState":"falsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsfiltertransfer-to-create-vfmodule-requestResponseCreate VNF$.requestReferences.instanceIdRequestCreate VFModule$.requestDetails.relatedInstanceList[1].relatedInstance.instanceIdJSONPATHJSONPATHtrueset-testcase-requestId-propertyResponseCreate VNF$.requestReferences.requestIdrequestId#TestCase#JSONPATHXPATHtrueset-testcase-vnfInstanceId-propertyResponseCreate VNF$.requestReferences.instanceIdvnfInstanceId#TestCase#JSONPATHXPATHtruetransfer-to-create-volumegroups-requestResponseCreate VNF$.requestReferences.instanceIdRequestCreate VolumeGroups$.requestDetails.relatedInstanceList[1].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-update-volumegroups-requestResponseCreate VNF$.requestReferences.instanceIdRequestUpdate VolumeGroups$.requestDetails.relatedInstanceList[1].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-update-vfmodule-requestResponseCreate VNF$.requestReferences.instanceIdRequestUpdate VFModule$.requestDetails.relatedInstanceList[1].relatedInstance.instanceIdJSONPATHJSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +}}http://localhost/ecomp/mso/infra/serviceInstances/v2/3713d5de-942f-41c4-a1b7-08245bc640cc/vnfs/202${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings<xml-fragment/>UTF-8http://${#Project#host}http://localhost/orchestrationRequests/v2200"requestScope":"service","requestType":"createInstance","requestDetails":{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"ff3514e3-5a33-55df-13ab-12abad84e7ff","modelType":"service","modelNameVersionId":"fe6985cd-ea33-3346-ac12-ab121484a3fe","modelName":"dns-servicetest","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":null,"modelCustomizationId":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DNS_TEST","suppressRollback":true,"requestorId":null},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"subscriber-1","subscriberName":"testSubscriber"},"cloudConfiguration":null,"requestParameters":{"subscriptionServiceType":"MOG","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,falsefalse"serviceInstanceName":"DNS_TEST","vnfInstanceId":null,"vnfInstanceName":null,"vfModuleInstanceId":null,"vfModuleInstanceName":null,"volumeGroupInstanceId":null,"volumeGroupInstanceName":null,"networkInstanceId":null,"networkInstanceName":null,"requestorId":null},"requestStatus":{"requestState":"falsefalse$.requestList2falsefalsefalse"requestScope":"vnf","requestType":"createInstance","requestDetails":{"modelInfo":{"modelCustomizationName":"DNSResource-1","modelInvariantId":"585822c7-4027-4f84-ba50-e9248606f112","modelType":"vnf","modelNameVersionId":"fe6478e4-ea33-3346-ac12-ab121484a3fe","modelName":"DNSResource","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":null,"modelCustomizationId":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb","orderVersion":null,"source":"VID","instanceName":"DNSTEST1","suppressRollback":false,"requestorId":null},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"falsefalse"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"ff3514e3-5a33-55df-13ab-12abad84e7ff","modelType":"service","modelNameVersionId":"fe6985cd-ea33-3346-ac12-ab121484a3fe","modelName":"dns-servicetest","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":null,"modelCustomizationId":null}}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":"88a6ca3ee0394ade9403f075db23167e","lcpCloudRegionId":"mdt1"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,falsefalse"serviceInstanceName":null,"vnfInstanceId":null,"vnfInstanceName":"DNSTEST1","vfModuleInstanceId":null,"vfModuleInstanceName":null,"volumeGroupInstanceId":null,"volumeGroupInstanceName":null,"networkInstanceId":null,"networkInstanceName":null,"requestorId":null},"requestStatus":{"requestState":falsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsfiltertransfer-to-create-vfmodule-requestResponseCreate VNF$.requestReferences.instanceIdRequestCreate VFModule$.requestDetails.relatedInstanceList[1].relatedInstance.instanceIdJSONPATHJSONPATHtrueset-testcase-requestId-propertyResponseCreate VNF$.requestReferences.requestIdrequestId#TestCase#JSONPATHXPATHtrueset-testcase-vnfInstanceId-propertyResponseCreate VNF$.requestReferences.instanceIdvnfInstanceId#TestCase#JSONPATHXPATHtruetransfer-to-create-volumegroups-requestResponseCreate VNF$.requestReferences.instanceIdRequestCreate VolumeGroups$.requestDetails.relatedInstanceList[1].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-update-volumegroups-requestResponseCreate VNF$.requestReferences.instanceIdRequestUpdate VolumeGroups$.requestDetails.relatedInstanceList[1].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-update-vfmodule-requestResponseCreate VNF$.requestReferences.instanceIdRequestUpdate VFModule$.requestDetails.relatedInstanceList[1].relatedInstance.instanceIdJSONPATHJSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter @@ -1360,7 +1360,11 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ${#TestCase#serviceInstanceId} -]]>200No Authorization<xml-fragment/>http://${#Project#host}{"requestDetails": { +]]>200${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#host}{"requestDetails": { + "cloudConfiguration": { + "tenantId": "88a6ca3ee0394ade9403f075db23167e", + "lcpCloudRegionId": "MT" + }, "modelInfo": { "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", "modelName": "VF_DNS::module-1", @@ -1368,10 +1372,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "modelVersion": "1.0", "modelInvariantId": "585822c7-4027-4f84-ba50-e9248606f132" }, - "cloudConfiguration": { - "tenantId": "88a6ca3ee0394ade9403f075db23167e", - "lcpCloudRegionId": "MT" - }, "relatedInstanceList": [ {"relatedInstance": { "modelInfo": { @@ -1381,7 +1381,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "modelVersion": "1.0", "modelInvariantId": "585822c8-4027-4f84-ba50-e9248606f111" }, - "instanceId": "abda8f01-08fc-4d4f-8e57-9eaab06e33e4" + "instanceId": "a82d6977-6493-484f-ae8c-1b2f442e0d82" }}, {"relatedInstance": { "modelInfo": { @@ -1392,19 +1392,19 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "modelCustomizationName": "DNSResource-1", "modelInvariantId": "585822c7-4027-4f84-ba50-e9248606f112" }, - "instanceId": "1ac28783-8268-41b0-a653-36d0d09d0695" + "instanceId": "f90f877a-3c08-43f1-b1eb-e0bd282c0b81" }} ], "requestInfo": { - "source": "VID", "suppressRollback": true, + "source": "VID", "instanceName": "VF_DNS-base-module-1" }, "requestParameters": {"userParams": []} }}http://localhost/ecomp/mso/infra/serviceInstances/v2/3713d5de-942f-41c4-a1b7-08245bc640cc/vnfs/132677e7-8ed2-4a51-9758-9eff2c608d90/vfModules202${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings -serviceInstanceIdvnfInstanceIdset-testcase-vfModuleInstanceId-propertyResponseCreate VFModule$.requestReferences.instanceIdvfModuleInstanceId#TestCase#JSONPATHXPATHtrueset-testcase-requestId-propertyResponseCreate VFModule$.requestReferences.requestIdrequestId#TestCase#JSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +serviceInstanceIdvnfInstanceIdset-testcase-vfModuleInstanceId-propertyResponseCreate VFModule$.requestReferences.instanceIdvfModuleInstanceId#TestCase#JSONPATHXPATHtrueset-testcase-requestId-propertyResponseCreate VFModule$.requestReferences.requestIdrequestId#TestCase#JSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter @@ -1414,7 +1414,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ${#TestCase#serviceInstanceId} -]]>200No Authorization<xml-fragment/>UTF-8http://${#Project#host}{"requestDetails": { +]]>200${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>UTF-8http://${#Project#host}{"requestDetails": { "modelInfo": { "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", "modelName": "VF_DNS::module-1", @@ -1435,7 +1435,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "modelVersion": "1.0", "modelInvariantId": "585822c8-4027-4f84-ba50-e9248606f111" }, - "instanceId": "abda8f01-08fc-4d4f-8e57-9eaab06e33e4" + "instanceId": "a82d6977-6493-484f-ae8c-1b2f442e0d82" }}, {"relatedInstance": { "modelInfo": { @@ -1446,7 +1446,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "modelCustomizationName": "DNSResource-1", "modelInvariantId": "585822c7-4027-4f84-ba50-e9248606f112" }, - "instanceId": "1ac28783-8268-41b0-a653-36d0d09d0695" + "instanceId": "f90f877a-3c08-43f1-b1eb-e0bd282c0b81" }} ], "requestInfo": { @@ -1459,7 +1459,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -set-testcase-requestId-propertyResponseUpdate VFModule$.requestReferences.requestIdrequestId#TestCase#JSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +set-testcase-requestId-propertyResponseUpdate VFModule$.requestReferences.requestIdrequestId#TestCase#JSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter @@ -1469,7 +1469,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ${#TestCase#serviceInstanceId} -]]>200No Authorization<xml-fragment/>UTF-8http://${#Project#host}{"requestDetails": { +]]>200${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>UTF-8http://${#Project#host}{"requestDetails": { "modelInfo":{ "modelCustomizationName":"ebad642f-a0e6-49bd-90a5 1", "modelNameVersionId": "fe6478e5-ea33-3346-ac12-ab121484a3fe", @@ -1490,7 +1490,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -set-testcase-requestId-propertyResponseDelete VFModule$.requestReferences.requestIdrequestId#TestCase#JSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +set-testcase-requestId-propertyResponseDelete VFModule$.requestReferences.requestIdrequestId#TestCase#JSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter @@ -1500,7 +1500,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ${#TestCase#serviceInstanceId} -]]>200No Authorization<xml-fragment/>UTF-8http://${#Project#host}{"requestDetails": { +]]>200${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>UTF-8http://${#Project#host}{"requestDetails": { "modelInfo":{ "modelNameVersionId": "fe6478e4-ea33-3346-ac12-ab121484a3fe", "modelName": "DNSResource", @@ -1520,7 +1520,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" http://localhost/ecomp/mso/infra/serviceInstances/v2/1abf1f1f-513c-4e9a-8294-a0932339a788/vnfs/65833f1d-d2ec-42ef-a316-c44be958acf7202No Authorization -set-testcase-requestId-propertyResponseDelete VNF$.requestReferences.requestIdrequestId#TestCase#JSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +set-testcase-requestId-propertyResponseDelete VNF$.requestReferences.requestIdrequestId#TestCase#JSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter @@ -1530,7 +1530,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ${#TestCase#serviceInstanceId} -]]>200No Authorization<xml-fragment/>UTF-8http://${#Project#host}{"requestDetails": { +]]>200${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>UTF-8http://${#Project#host}{"requestDetails": { "modelInfo":{ "modelCustomizationName":"", "modelType":"service", @@ -1563,7 +1563,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "modelVersion": "1.0", "modelInvariantId": "585822c8-4027-4f84-ba50-e9248606f111" }, - "instanceId": "abda8f01-08fc-4d4f-8e57-9eaab06e33e4" + "instanceId": "a82d6977-6493-484f-ae8c-1b2f442e0d82" }}, {"relatedInstance": { "modelInfo": { @@ -1574,7 +1574,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "modelCustomizationName": "DNSResource-1", "modelInvariantId": "585822c7-4027-4f84-ba50-e9248606f112" }, - "instanceId": "1ac28783-8268-41b0-a653-36d0d09d0695" + "instanceId": "f90f877a-3c08-43f1-b1eb-e0bd282c0b81" }} ], "requestInfo": { @@ -1586,7 +1586,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" }}http://localhost/ecomp/mso/infra/serviceInstances/v2//vnfs//volumeGroups202${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settings -serviceInstanceIdvnfInstanceIdset-testcase-volumeGroupId-propertyResponseCreate VolumeGroups$.requestReferences.instanceIdvomuleGroupInstanceId#TestCase#JSONPATHXPATHtrueset-testcase-requestIdResponseCreate VolumeGroups$.requestReferences.requestIdrequestId#TestCase#JSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +serviceInstanceIdvnfInstanceIdset-testcase-volumeGroupId-propertyResponseCreate VolumeGroups$.requestReferences.instanceIdvomuleGroupInstanceId#TestCase#JSONPATHXPATHtrueset-testcase-requestIdResponseCreate VolumeGroups$.requestReferences.requestIdrequestId#TestCase#JSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter @@ -1596,7 +1596,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ${#TestCase#serviceInstanceId} -]]>200No Authorization<xml-fragment/>http://${#Project#host}{"requestDetails": { +]]>200${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#host}{"requestDetails": { "cloudConfiguration": { "tenantId": "88a6ca3ee0394ade9403f075db23167e", "lcpCloudRegionId": "MT2" @@ -1616,7 +1616,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "modelVersion": "1.0", "modelInvariantId": "585822c8-4027-4f84-ba50-e9248606f111" }, - "instanceId": "abda8f01-08fc-4d4f-8e57-9eaab06e33e4" + "instanceId": "a82d6977-6493-484f-ae8c-1b2f442e0d82" }}, {"relatedInstance": { "modelInfo": { @@ -1627,7 +1627,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "modelCustomizationName": "DNSResource-1", "modelInvariantId": "585822c7-4027-4f84-ba50-e9248606f112" }, - "instanceId": "1ac28783-8268-41b0-a653-36d0d09d0695" + "instanceId": "f90f877a-3c08-43f1-b1eb-e0bd282c0b81" }} ], "requestInfo": { @@ -1639,7 +1639,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -serviceInstanceIdvnfInstanceIdvolumeGroupInstanceIdset-testcase-requestIdResponseUpdate VolumeGroups$.requestReferences.requestIdrequestId#TestCase#JSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +serviceInstanceIdvnfInstanceIdvolumeGroupInstanceIdset-testcase-requestIdResponseUpdate VolumeGroups$.requestReferences.requestIdrequestId#TestCase#JSONPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter @@ -1649,7 +1649,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ${#TestCase#serviceInstanceId} -]]>200No Authorization<xml-fragment/>UTF-8http://${#Project#host}{"requestDetails": { +]]>200${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>UTF-8http://${#Project#host}{"requestDetails": { "modelInfo": { "modelName": "Mog111..mog_psm..module-1", "modelType": "volumeGroup", @@ -1668,14 +1668,14 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <xml-fragment/>UTF-8http://${#Project#host}{"requestDetails": { - "modelInfo": { - "modelName": "CONTRAIL30_BASIC", - "modelType": "network" - }, "cloudConfiguration": { "tenantId": "cff319d50266491fa744b0d493a51ce0", "lcpCloudRegionId": "rdm3" }, + "modelInfo": { + "modelName": "CONTRAIL30_BASIC", + "modelType": "network" + }, "relatedInstanceList": [{"relatedInstance": { "modelInfo": { "modelNameVersionId": "1e34774e-715e-4fd6-bd09-7b654622f35i", @@ -1684,7 +1684,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "modelVersion": "1.0", "modelInvariantId": "585822c8-4027-4f84-ba50-e9248606f111" }, - "instanceId": "abda8f01-08fc-4d4f-8e57-9eaab06e33e4" + "instanceId": "a82d6977-6493-484f-ae8c-1b2f442e0d82" }}], "requestInfo": { "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", @@ -1692,7 +1692,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "instanceName": "MNS-25180-L-06Private_tst_mns_mgmt_net_1" }, "requestParameters": {} -}}http://localhost/ecomp/mso/infra/serviceInstances/v2/serviceInstanceId/networks202${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsset-updateCreateNetworkRequstStatus-requestIdResponseCreate Networks$.requestReferences.requestIdrequestId#TestCase#JSONPATHXQUERYtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +}}http://localhost/ecomp/mso/infra/serviceInstances/v2/serviceInstanceId/networks202${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsset-updateCreateNetworkRequstStatus-requestIdResponseCreate Networks$.requestReferences.requestIdrequestId#TestCase#JSONPATHXQUERYtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter @@ -1702,15 +1702,15 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ${#TestCase#networkId} -]]>200No Authorization<xml-fragment/>UTF-8http://${#Project#host}{"requestDetails": { - "modelInfo": { - "modelName": "CONTRAIL30_BASIC", - "modelType": "network" - }, +]]>200${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>UTF-8http://${#Project#host}{"requestDetails": { "cloudConfiguration": { "tenantId": "cff319d50266491fa744b0d493a51ce0", "lcpCloudRegionId": "rdm3" }, + "modelInfo": { + "modelName": "CONTRAIL30_BASIC", + "modelType": "network" + }, "relatedInstanceList": [{"relatedInstance": { "modelInfo": { "modelNameVersionId": "1e34774e-715e-4fd6-bd09-7b654622f35i", @@ -1719,7 +1719,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" "modelVersion": "1.0", "modelInvariantId": "585822c8-4027-4f84-ba50-e9248606f111" }, - "instanceId": "abda8f01-08fc-4d4f-8e57-9eaab06e33e4" + "instanceId": "a82d6977-6493-484f-ae8c-1b2f442e0d82" }}], "requestInfo": { "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", @@ -1730,7 +1730,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" }}http://localhost/ecomp/mso/infra/serviceInstances/v2/c173e25c-adc4-4e66-9702-24cbd75a2243/networks/925f94f5-7ec6-4d99-a5e1-091c33709b76202No Authorization -set-updateCreateNetworkRequstStatus-requestIdResponseUpdaate Networks$.requestReferences.requestIdrequestId#TestCase#JSONPATHXQUERYtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +set-updateCreateNetworkRequstStatus-requestIdResponseUpdaate Networks$.requestReferences.requestIdrequestId#TestCase#JSONPATHXQUERYtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter @@ -1740,7 +1740,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ${#TestCase#networkId} -]]>200No Authorization<xml-fragment/>UTF-8http://${#Project#host}{"requestDetails": { +]]>200${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>UTF-8http://${#Project#host}{"requestDetails": { "modelInfo":{ "modelType":"network", "modelName":"CONTRAIL30_BASIC", @@ -1780,7 +1780,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "name": "someUserParam", "value": "someValue" - } + } ] } } @@ -1809,7 +1809,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "name": "someUserParam", "value": "someValue" - } + } ] } } @@ -1837,7 +1837,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "name": "someUserParam", "value": "someValue" - } + } ] } } @@ -1865,12 +1865,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "name": "someUserParam", "value": "someValue" - } + } ] } } }http://localhost/ecomp/mso/infra/serviceInstances/v2202 -${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsset-serviceInstanceId-propertyResponseCreate Service 2$.requestReferences.instanceIdserviceInstanceId#TestCase#JSONPATHXQUERYtrueset-requestId-propertyResponseCreate Service 2$.requestReferences.requestIdrequestId#TestCase#JSONPATHXQUERYtruetransfer-to-create-network-urlResponseCreate Service 2$.requestReferences.instanceIdRequestCreate Networks with wrong BPMN script URL$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-create-network-urlResponseCreate Service 2$.requestReferences.instanceIdRequestCreate Networks with no BPMN script$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtrue5000MsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsset-serviceInstanceId-propertyResponseCreate Service 2$.requestReferences.instanceIdserviceInstanceId#TestCase#JSONPATHXQUERYtrueset-requestId-propertyResponseCreate Service 2$.requestReferences.requestIdrequestId#TestCase#JSONPATHXQUERYtruetransfer-to-create-network-urlResponseCreate Service 2$.requestReferences.instanceIdRequestCreate Networks with wrong BPMN script URL$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtruetransfer-to-create-network-urlResponseCreate Service 2$.requestReferences.instanceIdRequestCreate Networks with no BPMN script$.requestDetails.relatedInstanceList[0].relatedInstance.instanceIdJSONPATHJSONPATHtrue5000MsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter @@ -1880,7 +1880,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ${#TestCase#serviceInstanceId} -]]>200No Authorization<xml-fragment/>http://${#Project#host}{ +]]>200${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#host}{ "requestDetails": { "modelInfo": { "modelType": "service", @@ -1904,7 +1904,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" { "name": "someUserParam", "value": "someValue" - } + } ] } } @@ -2094,4 +2094,4 @@ try { } finally { try { if ( con != null ) con.close(); } catch ( Exception ignoreThis ) {} } -requestId76c15633-b6f2-4281-9ba2-73b516734c04serviceInstanceIdf75b1c7d-e878-40a3-8877-bc5605615f4dvnfInstanceId1ac28783-8268-41b0-a653-36d0d09d0695vfModuleInstanceId38b74487-c406-47d7-a9eb-530dd89242ccvomuleGroupInstanceId20e3e2f9-25a3-494e-8108-cafa3ff992f1networkIdebdd074d-ba30-4d44-921c-323cec4e78fchostlocalhost:8080user-infraportalInfraPortalClientpassword-infraportalpassword1$db-driver \ No newline at end of file +requestId1cf0f4b3-8e50-4b14-bc46-37514b5f2cd4serviceInstanceIda82d6977-6493-484f-ae8c-1b2f442e0d82vnfInstanceIdf90f877a-3c08-43f1-b1eb-e0bd282c0b81vfModuleInstanceId38b74487-c406-47d7-a9eb-530dd89242ccvomuleGroupInstanceId20e3e2f9-25a3-494e-8108-cafa3ff992f1networkIdebdd074d-ba30-4d44-921c-323cec4e78fchostlocalhost:8080user-infraportalInfraPortalClientpassword-infraportalpassword1$db-driverdbadapteruserBPELClientdbadapterpasswordpassword1$ \ No newline at end of file diff --git a/packages/arquillian-unit-tests/src/test/resources/SoapUI/MSONetworkAdapter-soapui-project.xml b/packages/arquillian-unit-tests/src/test/resources/SoapUI/MSONetworkAdapter-soapui-project.xml index 27c7fecd7e..f38cf809a9 100644 --- a/packages/arquillian-unit-tests/src/test/resources/SoapUI/MSONetworkAdapter-soapui-project.xml +++ b/packages/arquillian-unit-tests/src/test/resources/SoapUI/MSONetworkAdapter-soapui-project.xml @@ -1,8 +1,8 @@ -file:\C:\Dev\Git\mso-unified\adapters\mso-network-adapter\target\generated-sources\wsdl\NetworkAdapter.wsdl - +file:\C:\Dev\Git\mso-unified\adapters\mso-network-adapter\target\generated-sources\wsdl\NetworkAdapter.wsdl + - + @@ -190,34 +190,34 @@ - - + + - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -300,7 +300,7 @@ -]]>http://schemas.xmlsoap.org/wsdl/REPLACE_WITH_ACTUAL_URL<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter\r +]]>http://schemas.xmlsoap.org/wsdl/REPLACE_WITH_ACTUAL_URL<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter\r \r \r \r @@ -323,7 +323,7 @@ \r \r \r -]]>No AuthorizationUTF-8REPLACE_WITH_ACTUAL_URL\r +]]>No AuthorizationUTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r @@ -340,12 +340,12 @@ \r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL\r +]]>UTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL\r +]]>UTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r @@ -361,7 +361,7 @@ \r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL\r +]]>UTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r @@ -394,7 +394,7 @@ \r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL\r +]]>UTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r @@ -415,7 +415,7 @@ \r \r \r -]]>SEQUENTIALMsoNetworkAdapterImplPortBindingcreateNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter +]]>SEQUENTIALMsoNetworkAdapterImplPortBindingcreateNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter @@ -424,7 +424,7 @@ vlan tete - + titi10 @@ -432,13 +432,13 @@ - + requestIdserviceInstanceId -]]>500CloudSite does not exist in MSO ConfigurationfalsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindingcreateNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter +]]>500CloudSite does not exist in MSO ConfigurationfalsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindingcreateNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter @@ -446,7 +446,7 @@ b0784c65ad104c9ab2df27c1b2e04bd0 vlan - + titi10 @@ -454,13 +454,13 @@ - + requestIdserviceInstanceId -]]>500Create Network: Missing parameters: networkNamefalsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindingcreateNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter +]]>500Create Network: Missing parameters: networkNamefalsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindingcreateNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter @@ -468,7 +468,7 @@ b0784c65ad104c9ab2df27c1b2e04bd0 tata - + titi10 @@ -476,13 +476,13 @@ - + requestIdserviceInstanceId -]]>500<faultstring>CreateNetwork: Unknown Network Type: tata</faultstring>falsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindingdeleteNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter\r +]]>500<faultstring>CreateNetwork: Unknown Network Type: tata</faultstring>falsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindingdeleteNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter\r @@ -500,7 +500,7 @@ ]]>500 -<message>Unknown Network Type: ?</message>falsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindingdeleteNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter\r +[DeleteNetwork] Cloud Site [?] not foundfalsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindingdeleteNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter\r @@ -517,12 +517,12 @@ ]]>500 -<faultstring>Missing mandatory parameter cloudSiteId, tenantId or networkId</faultstring>falsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindinghealthCheck<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter\r +<faultstring>Missing mandatory parameter cloudSiteId, tenantId or networkId</faultstring>falsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindinghealthCheck<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter\r \r \r \r \r -]]>200BPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindingqueryNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter\r +]]>200BPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindingqueryNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter\r \r \r \r @@ -538,7 +538,7 @@ \r \r \r -]]>500CloudSite does not exist in MSO ConfigurationfalsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindingrollbackNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter\r +]]>500CloudSite does not exist in MSO ConfigurationfalsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindingrollbackNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter\r \r \r \r @@ -572,7 +572,7 @@ \r \r \r -]]>500<message>Rollback Network: Unknown Network Type: ?</message>falsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindingupdateNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter\r +]]>500<message>Rollback Network: Unknown Network Type: ?</message>falsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoNetworkAdapterImplPortBindingupdateNetwork<xml-fragment/>UTF-8http://${#Project#host}/networks/NetworkAdapter\r \r \r \r @@ -593,4 +593,4 @@ \r \r \r -]]>500 CloudSite does not exist in MSO ConfigurationfalsefalseBPELClientpassword1$BasicBasicGlobal HTTP Settingshostlocalhost:18080 \ No newline at end of file +]]>500 CloudSite does not exist in MSO ConfigurationfalsefalseBPELClientpassword1$BasicBasicGlobal HTTP Settingshostlocalhost:8080 \ No newline at end of file diff --git a/packages/arquillian-unit-tests/src/test/resources/SoapUI/MSOTenantAdapter-soapui-project.xml b/packages/arquillian-unit-tests/src/test/resources/SoapUI/MSOTenantAdapter-soapui-project.xml index 8e4958047b..f3afbd354d 100644 --- a/packages/arquillian-unit-tests/src/test/resources/SoapUI/MSOTenantAdapter-soapui-project.xml +++ b/packages/arquillian-unit-tests/src/test/resources/SoapUI/MSOTenantAdapter-soapui-project.xml @@ -1,8 +1,8 @@ -file:\C:\Dev\Git\mso\adapters\mso-tenant-adapter\target\generated-sources\wsdl\TenantAdapter.wsdl - +file:\C:\Dev\Git\mso\adapters\mso-tenant-adapter\target\generated-sources\wsdl\TenantAdapter.wsdl + - + @@ -164,29 +164,29 @@ - - - + + + - - - - + + + + - - + + - - - + + + - - - + + + @@ -257,7 +257,7 @@ -]]>http://schemas.xmlsoap.org/wsdl/REPLACE_WITH_ACTUAL_URLUTF-8REPLACE_WITH_ACTUAL_URL\r +]]>http://schemas.xmlsoap.org/wsdl/REPLACE_WITH_ACTUAL_URLUTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r @@ -283,7 +283,7 @@ \r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL\r +]]>UTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r @@ -298,12 +298,12 @@ \r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL\r +]]>UTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL\r +]]>UTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r @@ -318,7 +318,7 @@ \r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL\r +]]>UTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r @@ -338,7 +338,7 @@ \r \r \r -]]>SEQUENTIALMsoTenantAdapterImplPortBindingcreateTenant<xml-fragment/>UTF-8http://${#Project#host}/tenants/TenantAdapter\r +]]>SEQUENTIALMsoTenantAdapterImplPortBindingcreateTenant<xml-fragment/>UTF-8http://${#Project#host}/tenants/TenantAdapter\r \r \r \r @@ -364,7 +364,7 @@ \r \r \r -]]>For input string: "pa"falsefalse${#Project#user-bpel}${#Project#password-bpel}BasicBasicGlobal HTTP SettingsMsoTenantAdapterImplPortBindingdeleteTenant<xml-fragment/>UTF-8http://${#Project#host}/tenants/TenantAdapter\r +]]>failed: Connection refusedfalsefalse${#Project#user-bpel}${#Project#password-bpel}BasicBasicGlobal HTTP SettingsMsoTenantAdapterImplPortBindingdeleteTenant<xml-fragment/>UTF-8http://${#Project#host}/tenants/TenantAdapter\r \r \r \r @@ -379,12 +379,12 @@ \r \r \r -]]>For input string: "pa"falsefalse${#Project#user-bpel}${#Project#password-bpel}BasicBasicGlobal HTTP SettingsMsoTenantAdapterImplPortBindinghealthCheck<xml-fragment/>UTF-8http://${#Project#host}/tenants/TenantAdapter\r +]]>failed: Connection refusedfalsefalse${#Project#user-bpel}${#Project#password-bpel}BasicBasicGlobal HTTP SettingsMsoTenantAdapterImplPortBindinghealthCheck<xml-fragment/>UTF-8http://${#Project#host}/tenants/TenantAdapter\r \r \r \r \r -]]>200${#Project#user-bpel}${#Project#password-bpel}BasicBasicGlobal HTTP SettingsMsoTenantAdapterImplPortBindingqueryTenant<xml-fragment/>UTF-8http://${#Project#host}/tenants/TenantAdapter\r +]]>200${#Project#user-bpel}${#Project#password-bpel}BasicBasicGlobal HTTP SettingsMsoTenantAdapterImplPortBindingqueryTenant<xml-fragment/>UTF-8http://${#Project#host}/tenants/TenantAdapter\r \r \r \r @@ -399,7 +399,7 @@ \r \r \r -]]>For input string: "pa"falsefalse${#Project#user-bpel}${#Project#password-bpel}BasicBasicGlobal HTTP SettingsMsoTenantAdapterImplPortBindingrollbackTenant<xml-fragment/>UTF-8http://${#Project#host}/tenants/TenantAdapter\r +]]>failed: Connection refusedfalsefalse${#Project#user-bpel}${#Project#password-bpel}BasicBasicGlobal HTTP SettingsMsoTenantAdapterImplPortBindingrollbackTenant<xml-fragment/>UTF-8http://${#Project#host}/tenants/TenantAdapter\r \r \r \r @@ -419,4 +419,4 @@ \r \r \r -]]>For input string: "pa"falsefalse${#Project#user-bpel}${#Project#password-bpel}BasicBasicGlobal HTTP Settingshostlocalhost:18080user-bpelBPELClientpassword-bpelpassword1$ \ No newline at end of file +]]>failed: Connection refusedfalsefalse${#Project#user-bpel}${#Project#password-bpel}BasicBasicGlobal HTTP Settingshostlocalhost:18080user-bpelBPELClientpassword-bpelpassword1$ \ No newline at end of file diff --git a/packages/arquillian-unit-tests/src/test/resources/SoapUI/MSOVnfAdapter-soapui-project.xml b/packages/arquillian-unit-tests/src/test/resources/SoapUI/MSOVnfAdapter-soapui-project.xml index ea83a2ab73..4d704d1908 100644 --- a/packages/arquillian-unit-tests/src/test/resources/SoapUI/MSOVnfAdapter-soapui-project.xml +++ b/packages/arquillian-unit-tests/src/test/resources/SoapUI/MSOVnfAdapter-soapui-project.xml @@ -1,8 +1,8 @@ -file:\C:\Dev\Git\mso\adapters\mso-vnf-adapter\target\generated-sources\wsdl\VnfAdapter.wsdl - +file:\C:\Dev\Git\mso\adapters\mso-vnf-adapter\target\generated-sources\wsdl\VnfAdapter.wsdl + - + @@ -244,34 +244,34 @@ - - - - + + + + - - + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -354,7 +354,7 @@ -]]>http://schemas.xmlsoap.org/wsdl/REPLACE_WITH_ACTUAL_URL<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter\r +]]>http://schemas.xmlsoap.org/wsdl/REPLACE_WITH_ACTUAL_URL<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter\r \r \r \r @@ -384,7 +384,7 @@ \r \r \r -]]>BPELClientpassword1$BasicBasicGlobal HTTP SettingsUTF-8REPLACE_WITH_ACTUAL_URL\r +]]>BPELClientpassword1$BasicBasicGlobal HTTP SettingsUTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r @@ -400,12 +400,12 @@ \r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL\r +]]>UTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL\r +]]>UTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r @@ -421,7 +421,7 @@ \r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL\r +]]>UTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r @@ -444,7 +444,7 @@ \r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL\r +]]>UTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r @@ -472,7 +472,7 @@ \r \r \r -]]>SEQUENTIALMsoVnfAdapterImplPortBindingcreateVnf<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter +]]>SEQUENTIALMsoVnfAdapterImplPortBindingcreateVnf<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter @@ -502,7 +502,7 @@ -]]><message>[CreateVFModule] Cloud Site [Toto] not found</message>falsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoVnfAdapterImplPortBindingcreateVnf<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter +]]><message>[CreateVFModule] Cloud Site [Toto] not found</message>falsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoVnfAdapterImplPortBindingcreateVnf<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter @@ -532,7 +532,7 @@ -]]>CreateVFModule:QueryStack:TokenAuth] For input string: "pa"falsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoVnfAdapterImplPortBindingdeleteVnf<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter\r +]]>failed: Connection refusedfalsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoVnfAdapterImplPortBindingdeleteVnf<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter\r \r \r \r @@ -548,12 +548,12 @@ \r \r \r -]]>TokenAuth] For input string: "pa"falsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoVnfAdapterImplPortBindinghealthCheck<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter\r +]]>failed: Connection refusedfalsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoVnfAdapterImplPortBindinghealthCheck<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter\r \r \r \r \r -]]>200BPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoVnfAdapterImplPortBindingqueryVnf<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter\r +]]>200BPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoVnfAdapterImplPortBindingqueryVnf<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter\r \r \r \r @@ -569,7 +569,7 @@ \r \r \r -]]>TokenAuth] For input string: "pa"falsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoVnfAdapterImplPortBindingrollbackVnf<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter\r +]]>failed: Connection refusedfalsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoVnfAdapterImplPortBindingrollbackVnf<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter\r \r \r \r @@ -592,7 +592,7 @@ \r \r \r -]]>TokenAuth] For input string: "pa"falsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoVnfAdapterImplPortBindingupdateVnf<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter\r +]]>failed: Connection refusedfalsefalseBPELClientpassword1$BasicBasicGlobal HTTP SettingsMsoVnfAdapterImplPortBindingupdateVnf<xml-fragment/>UTF-8http://${#Project#host}/vnfs/VnfAdapter\r \r \r \r @@ -620,4 +620,4 @@ \r \r \r -]]>TokenAuth] For input string: "pa"falsefalseBPELClientpassword1$BasicBasicGlobal HTTP Settingshostlocalhost:18080 \ No newline at end of file +]]>failed: Connection refusedfalsefalseBPELClientpassword1$BasicBasicGlobal HTTP Settingshostlocalhost:18080 \ No newline at end of file diff --git a/packages/arquillian-unit-tests/src/test/resources/SoapUI/MsoRequestDB-soapui-project.xml b/packages/arquillian-unit-tests/src/test/resources/SoapUI/MsoRequestDB-soapui-project.xml index 6c39113a94..fd68b22623 100644 --- a/packages/arquillian-unit-tests/src/test/resources/SoapUI/MsoRequestDB-soapui-project.xml +++ b/packages/arquillian-unit-tests/src/test/resources/SoapUI/MsoRequestDB-soapui-project.xml @@ -1,8 +1,8 @@ -file:/RequestsDbAdapter.wsdl - +file:/RequestsDbAdapter.wsdl + - + @@ -136,18 +136,18 @@ - - - + + + - - - + + + - - + + @@ -191,14 +191,14 @@ -]]>http://schemas.xmlsoap.org/wsdl/REPLACE_WITH_ACTUAL_URLUTF-8REPLACE_WITH_ACTUAL_URL\r +]]>http://schemas.xmlsoap.org/wsdl/REPLACE_WITH_ACTUAL_URLUTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r ?\r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL\r +]]>UTF-8REPLACE_WITH_ACTUAL_URL\r \r \r \r @@ -216,15 +216,15 @@ ?\r \r \r -]]>UTF-8REPLACE_WITH_ACTUAL_URL +]]>UTF-8REPLACE_WITH_ACTUAL_URL ? -]]>http://localhost:8080application/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404 502 409v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data<xml-fragment/>http://${#Project#host}]]>http://localhost:8080application/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404 502 409v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data<xml-fragment/>http://${#Project#host} 3d878a8e-51fa-44aa-8cb5-a56ae9352252 @@ -238,12 +238,12 @@ AUSTXAALCP1 276b95b6d2b04e2e830c976eb70c9405 - + -]]>http://localhost/ecomp/mso/v1/services${#Project#user-csi}${#Project#password-csi}BasicBasicGlobal HTTP Settingsrequest-idTEMPLATEapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data*/*200v1:query-response0dataapplication/octet-stream200v1:vnf-request<xml-fragment/>http://${#Project#host} +]]>http://localhost/ecomp/mso/v1/services${#Project#user-csi}${#Project#password-csi}BasicBasicGlobal HTTP Settingsrequest-idTEMPLATEapplication/xmlv1:service-requesttext/html500htmlapplication/xml500 400 503 404v1:service-responseapplication/xml202v1:service-responsetext/html;charset=utf-8401 404 403 405 500html0data0data0data0data0data0data0data0data0data0data0data0data0data0data0data*/*200v1:query-response0dataapplication/octet-stream200v1:vnf-request<xml-fragment/>http://${#Project#host} 155415ab-b4a7-4382-b4c6-d17d950565 FeatureChangeActivateRequest @@ -263,8 +263,8 @@ ST E2E Test50565_13000050565 -]]>http://localhost/ecomp/mso/v1/services/feature${#Project#user-csi}${#Project#password-csi}BasicBasicGlobal HTTP Settingsrequest-idSEQUENTIAL<xml-fragment/>http://${#Project#host}http://localhost/ecomp/mso/v1/services/feature${#Project#user-csi}${#Project#password-csi}BasicBasicGlobal HTTP Settingsrequest-idSEQUENTIAL<xml-fragment/>http://${#Project#host} IntegTestsInfra @@ -278,30 +278,30 @@ AUSTXAALCP1 276b95b6d2b04e2e830c976eb70c9405 - + -]]>http://localhost/ecomp/mso/v1/services500,400<request-status>FAILED</request-status>falsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP SettingsRequestIdResponsePOST VNF infra request - NO BPELdeclare namespace vnf='http://ecomp.att.com/mso/infra/vnf-request/v1'; +]]>http://localhost/ecomp/mso/v1/services500,400<request-status>FAILED</request-status>falsefalse${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP SettingsRequestIdResponsePOST VNF infra request - NO BPELdeclare namespace vnf='http://org.openecomp/mso/infra/vnf-request/v1'; //vnf:vnf-request[1]/vnf:request-info[1]/vnf:request-id[1]RequestupdateInfraRequestdeclare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/'; -declare namespace req='http://com.att.mso/requestsdb'; +declare namespace req='http://org.openecomp.mso/requestsdb'; //soapenv:Envelope/soapenv:Body/req:updateInfraRequest/requestId -trueToGetResponsePOST VNF infra request - NO BPELdeclare namespace vnf='http://ecomp.att.com/mso/infra/vnf-request/v1'; -//vnf:vnf-request[1]/vnf:request-info[1]/vnf:request-id[1]request-idGet Infra requesttrueToSoapGetResponsePOST VNF infra request - NO BPELdeclare namespace vnf='http://ecomp.att.com/mso/infra/vnf-request/v1'; +trueToGetResponsePOST VNF infra request - NO BPELdeclare namespace vnf='http://org.openecomp/mso/infra/vnf-request/v1'; +//vnf:vnf-request[1]/vnf:request-info[1]/vnf:request-id[1]request-idGet Infra requesttrueToSoapGetResponsePOST VNF infra request - NO BPELdeclare namespace vnf='http://org.openecomp/mso/infra/vnf-request/v1'; //vnf:vnf-request[1]/vnf:request-info[1]/vnf:request-id[1]Requestget infra soapdeclare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/'; -declare namespace req='http://com.att.mso/requestsdb'; +declare namespace req='http://org.openecomp.mso/requestsdb'; //soapenv:Envelope/soapenv:Body/req:getInfraRequest/requestId -trueRequestId2ResponsePOST VNF infra request - NO BPELdeclare namespace vnf='http://ecomp.att.com/mso/infra/vnf-request/v1'; +trueRequestId2ResponsePOST VNF infra request - NO BPELdeclare namespace vnf='http://org.openecomp/mso/infra/vnf-request/v1'; //vnf:vnf-request[1]/vnf:request-info[1]/vnf:request-id[1]RequestupdateInfraRequest 2declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/'; -declare namespace req='http://com.att.mso/requestsdb'; +declare namespace req='http://org.openecomp.mso/requestsdb'; //soapenv:Envelope/soapenv:Body/req:updateInfraRequest/requestId -XPATHXPATHtrueToSoapGet2ResponsePOST VNF infra request - NO BPELdeclare namespace vnf='http://ecomp.att.com/mso/infra/vnf-request/v1'; +XPATHXPATHtrueToSoapGet2ResponsePOST VNF infra request - NO BPELdeclare namespace vnf='http://org.openecomp/mso/infra/vnf-request/v1'; //vnf:vnf-request[1]/vnf:request-info[1]/vnf:request-id[1]Requestget infra soap 2declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/'; -declare namespace req='http://com.att.mso/requestsdb'; +declare namespace req='http://org.openecomp.mso/requestsdb'; //soapenv:Envelope/soapenv:Body/req:getInfraRequest/requestId -XPATHXPATHtrueRequestId statusResponsePOST VNF infra request - NO BPELdeclare namespace vnf='http://ecomp.att.com/mso/infra/vnf-request/v1'; +XPATHXPATHtrueRequestId statusResponsePOST VNF infra request - NO BPELdeclare namespace vnf='http://org.openecomp/mso/infra/vnf-request/v1'; //vnf:vnf-request[1]/vnf:request-info[1]/vnf:request-id[1]RequestupdateInfraRequest statusdeclare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/'; -declare namespace req='http://com.att.mso/requestsdb'; +declare namespace req='http://org.openecomp.mso/requestsdb'; //soapenv:Envelope/soapenv:Body/req:updateInfraRequest/requestId -XPATHXPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +XPATHXPATHtrueMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter @@ -310,7 +310,7 @@ declare namespace req='http://com.att.mso/requestsdb'; IN_PROGRESS -]]>200No AuthorizationMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +]]>200${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP SettingsMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter @@ -319,10 +319,10 @@ declare namespace req='http://com.att.mso/requestsdb'; COMPLETE -]]>200No Authorization<xml-fragment/>http://${#Project#host} +]]>200${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settings<xml-fragment/>http://${#Project#host} 155415ab-b4a7-4382-b4c6-d17d950565 FeatureChangeActivateRequest @@ -342,14 +342,14 @@ declare namespace req='http://com.att.mso/requestsdb'; ST E2E Test50565_13000050565 -]]>http://localhost/ecomp/mso/v1/services/feature200<request-status>COMPLETE</request-status>falsefalse(?s).*<request-id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}<\/request-id>(?s).*falsetrue${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsrequest-idMsoRequestsDbAdapterImplPortBindinggetInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +]]>http://localhost/ecomp/mso/v1/services/feature200<request-status>COMPLETE</request-status>falsefalse(?s).*<request-id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}<\/request-id>(?s).*falsetrue${#Project#user-infraportal}${#Project#password-infraportal}BasicBasicGlobal HTTP Settingsrequest-idMsoRequestsDbAdapterImplPortBindinggetInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter 22ae9257-022b-4050-8b31-998034cc49a8 -]]><lastModifiedBy>Arq</lastModifiedBy>falsefalseNo AuthorizationMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +]]><lastModifiedBy>Arq</lastModifiedBy>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP SettingsMsoRequestsDbAdapterImplPortBindingupdateInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter @@ -367,11 +367,11 @@ declare namespace req='http://com.att.mso/requestsdb'; OneSmallStepForMan -]]>200No AuthorizationMsoRequestsDbAdapterImplPortBindinggetInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter +]]>200${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP SettingsMsoRequestsDbAdapterImplPortBindinggetInfraRequest<xml-fragment/>UTF-8http://${#Project#host}/dbadapters/RequestsDbAdapter 22ae9257-022b-4050-8b31-998034cc49a8 -]]><lastModifiedBy>Arq</lastModifiedBy>falsefalseNo Authorizationhostlocalhost:18080user-infraportalInfraPortalClientpassword-infraportalpassword1$ \ No newline at end of file +]]><lastModifiedBy>Arq</lastModifiedBy>falsefalse${#Project#dbadapteruser}${#Project#dbadapterpassword}BasicBasicGlobal HTTP Settingshostlocalhost:18080user-infraportalInfraPortalClientpassword-infraportalpassword1$dbadapteruserBPELClientdbadapterpasswordpassword1$ \ No newline at end of file diff --git a/packages/arquillian-unit-tests/src/test/resources/arquillian.xml b/packages/arquillian-unit-tests/src/test/resources/arquillian.xml index 7606450809..7377d16729 100644 --- a/packages/arquillian-unit-tests/src/test/resources/arquillian.xml +++ b/packages/arquillian-unit-tests/src/test/resources/arquillian.xml @@ -18,7 +18,7 @@ CUBE mso: - image: ecomp/mso-arquillian:${images.version} + image: openecomp/mso-arquillian:${images.version} beforeStop: - copy: from: /opt/jboss/standalone/log/ @@ -45,7 +45,7 @@ - mariadb:mariadb - jacoco-shared:jacoco-shared jacoco-shared: - image: ecomp/jacoco:1.0 + image: openecomp/jacoco:1.0 beforeStop: - copy: from: /shared/jacoco-it.exec diff --git a/packages/arquillian-unit-tests/src/test/resources/docker/mso/mso-docker.json b/packages/arquillian-unit-tests/src/test/resources/docker/mso/mso-docker.json index 994d17ea98..0b2c7aa807 100644 --- a/packages/arquillian-unit-tests/src/test/resources/docker/mso/mso-docker.json +++ b/packages/arquillian-unit-tests/src/test/resources/docker/mso/mso-docker.json @@ -3,11 +3,11 @@ "description": "MSO Docker Images", "chef_type": "environment", "json_class": "Chef::Environment", - "default_attributes": + "default_attributes": { "mso_config_path": "/etc/mso/config.d/", - "mso-api-handler-infra-config": + "mso-api-handler-infra-config": { "bpelURL": "http://mso:8080", "bpelAuth": "786864AA53D0DCD881AED1154230C0C3058D58B9339D2EFB6193A0F0D82530E1", @@ -15,9 +15,9 @@ "camundaAuth": "5119D1AF37F671FC01FFAD2151D93EFB2BBB503E879FD07104D024EDDF118FD1" }, - "asdc-connections": + "asdc-connections": { - "asdc-controller1": + "asdc-controller1": { "user": "user", "consumerGroup": "mso", @@ -33,7 +33,7 @@ "keyStorePath": "" }, - "asdc-controller2": + "asdc-controller2": { "user": "user", "consumerGroup": "mso", @@ -50,9 +50,9 @@ } }, - "mso-sdnc-adapter-config": + "mso-sdnc-adapter-config": { - "sdncurls": + "sdncurls": [ "https://localhost:8443/restconf/operations/L3SDN-API:", "https://localhost:8443/restconf/config/L3SDN-API:", @@ -69,15 +69,15 @@ "sdncconnecttime": "5000" }, - "mso-po-adapter-config": + "mso-po-adapter-config": { - "identity_services": + "identity_services": [ { "dcp_clli": "MT_KEYSTONE", "identity_url": "https://localhost:5000/v2.0", "mso_id": "userid", - "mso_pass": "password", + "mso_pass": "313DECE408AF7759D442D7B06DD9A6AA", "admin_tenant": "service", "member_role": "admin", "tenant_metadata": "true", @@ -89,7 +89,7 @@ "dcp_clli": "MT_KEYSTONE2", "identity_url": "https://localhost:5000/v2.0", "mso_id": "userid", - "mso_pass": "password", + "mso_pass": "313DECE408AF7759D442D7B06DD9A6AA", "admin_tenant": "service", "member_role": "admin", "tenant_metadata": "true", @@ -98,7 +98,7 @@ } ], - "cloud_sites": + "cloud_sites": [ { "id": "MT", @@ -122,12 +122,12 @@ "nwbpelauth": "5119D1AF37F671FC01FFAD2151D93EFB2BBB503E879FD07104D024EDDF118FD1" }, - "mso-bpmn-config": + "mso-bpmn-config": { "urnFileSystemLoadingEnabled": "true" }, - "mso-bpmn-urn-config": + "mso-bpmn-urn-config": { "logDebugAsyncQueryAAICustomer": "false", "logDebugChangeFeatureActivateV1": "false", @@ -172,6 +172,7 @@ "adaptersDbEndpoint": "http://mso:8080/dbadapters/RequestsDbAdapter", "adaptersSdncEndpoint": "http://mso:8080/adapters/SDNCAdapter", "adaptersTenantEndpoint": "http://mso:8080/tenants/TenantAdapter", + "adaptersDbAuth": "6B0E6863FB8EE010AB6F191B3C0489437601E81DC7C86305CB92DB98AFC53D74", "workflowSdncadapterCallback": "http://mso:8080/mso/SDNCAdapterCallbackService", "msoKey": "07a7159d3bf51a0e53be7a8f89699be7", "adaptersPoAuth": "6B0E6863FB8EE010AB6F191B3C0489437601E81DC7C86305CB92DB98AFC53D74", @@ -208,11 +209,11 @@ } }, - "override_attributes": + "override_attributes": { }, - "cookbook_versions": + "cookbook_versions": { "mso-config": "~> 1.0.0" } diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-dns-V1/artifacts/vnf-module-artifact.json b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-dns-V1/artifacts/vnf-module-artifact.json index 91e6ac8a9e..9f51e8314b 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-dns-V1/artifacts/vnf-module-artifact.json +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-dns-V1/artifacts/vnf-module-artifact.json @@ -4,21 +4,27 @@ "vfModuleModelInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f132", "vfModuleModelVersion": "1.0", "vfModuleModelUUID": "1e34774e-715e-4fd5-bd08-7b654622f33e.VF_RI1_DNS::module-1::module-1.group", + "vfModuleModelDescription": "vf Module Description", + "vfModuleModelCustomizationUUID": "585822c7-4027-4f84-ba50-e9248606f132", "isBase": true, "artifacts": [ "Artifact-UUID1", "EnvArtifact-UUID1" - ] + ], + "properties": {"test":"test"} }, { "vfModuleModelName": "VF_RI1_DNS::module-2", "vfModuleModelInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f133", "vfModuleModelVersion": "1.0", "vfModuleModelUUID": "1e34774e-715e-4fd5-bd08-7b654622f33e.VF_RI1_DNS::module-2::module-1.group", + "vfModuleModelDescription": "vf Module Description", + "vfModuleModelCustomizationUUID": "585822c7-4027-4f84-ba50-e9248606f133", "isBase": false, "artifacts": [ "Artifact-UUID2", "EnvArtifact-UUID2" - ] + ], + "properties": {"test":"test"} } ] \ No newline at end of file diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-dns-V1/notif-structure.json b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-dns-V1/notif-structure.json index 63f32cbdd4..ebda7b7aea 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-dns-V1/notif-structure.json +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-dns-V1/notif-structure.json @@ -3,12 +3,12 @@ "serviceInvariantUUID": "585822c8-4027-4f84-ba50-e9248606f111", "serviceUUID": "1e34774e-715e-4fd6-bd09-7b654622f35i", "serviceVersion": "1.0", - "serviceArtifacts": + "serviceArtifacts": [ - + ], - "resources": + "resources": [ { "resourceInstanceName": "DNSResource-1", @@ -17,13 +17,14 @@ "resourceType": "VF", "resourceUUID": "585822c7-4027-4f84-ba50-e9248606f131", "resourceVersion": "1.0", - "artifacts": + "category": "category", + "artifacts": [ { "artifactChecksum": "CheckSum", "artifactDescription": "Meta data for VFModule", "artifactName": "vnf-module-artifact.json", - + "artifactType": "VF_MODULES_METADATA", "artifactURL": "vnf-module-artifact.json", "artifactUUID": "VfArtifact-UUID1", @@ -40,9 +41,9 @@ "artifactUUID": "Artifact-UUID1", "artifactVersion": "1.0", "generatedArtifact": "EnvArtifact-UUID1", - "relatedArtifact": + "relatedArtifact": [ - + ] }, @@ -50,12 +51,12 @@ "artifactChecksum": "CheckSum", "artifactDescription": "BASE VLB ENV file", "artifactName": "base_vlb.env", - + "artifactType": "HEAT_ENV", "artifactURL": "base_vlb.env", "artifactUUID": "EnvArtifact-UUID1", "artifactVersion": "1.0" - + }, { "artifactChecksum": "CheckSum", @@ -67,9 +68,9 @@ "artifactUUID": "Artifact-UUID2", "artifactVersion": "1.0", "generatedArtifact": "EnvArtifact-UUID2", - "relatedArtifact": + "relatedArtifact": [ - + ] }, @@ -77,12 +78,12 @@ "artifactChecksum": "CheckSum", "artifactDescription": "DNS Scaling ENV file", "artifactName": "dnsscaling.env", - + "artifactType": "HEAT_ENV", "artifactURL": "dnsscaling.env", "artifactUUID": "EnvArtifact-UUID2", "artifactVersion": "1.0" - + } ] diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-vfw-V1/artifacts/vnf-module-artifact.json b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-vfw-V1/artifacts/vnf-module-artifact.json index 5a732fcd47..0e45ba6434 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-vfw-V1/artifacts/vnf-module-artifact.json +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-vfw-V1/artifacts/vnf-module-artifact.json @@ -4,10 +4,13 @@ "vfModuleModelInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f134", "vfModuleModelVersion": "1.0", "vfModuleModelUUID": "1e34774e-715e-4fd5-bd08-7b654622f33f.VF_RI1_VFW::module-1::module-1.group", + "vfModuleModelDescription": "vf Module Description", + "vfModuleModelCustomizationUUID": "585822c7-4027-4f84-ba50-e9248606f134", "isBase": true, "artifacts": [ "Artifact-UUID3", "EnvArtifact-UUID3" - ] + ], + "properties": {"test":"test"} } ] \ No newline at end of file diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-vfw-V1/notif-structure.json b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-vfw-V1/notif-structure.json index 63ca36efcb..bec8bedf06 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-vfw-V1/notif-structure.json +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/demo-vfw-V1/notif-structure.json @@ -3,12 +3,12 @@ "serviceInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f112", "serviceUUID": "2e34774e-715e-4fd5-bd09-7b654622f35i", "serviceVersion": "1.0", - "serviceArtifacts": + "serviceArtifacts": [ - + ], - "resources": + "resources": [ { "resourceInstanceName": "VFWResource-1", @@ -17,13 +17,14 @@ "resourceType": "VF", "resourceUUID": "685822c7-4027-4f84-ba50-e9248606f132", "resourceVersion": "1.0", - "artifacts": + "category": "category", + "artifacts": [ { "artifactChecksum": "CheckSum", "artifactDescription": "Meta data for VFModule", "artifactName": "vnf-module-artifact.json", - + "artifactType": "VF_MODULES_METADATA", "artifactURL": "vnf-module-artifact.json", "artifactUUID": "VfArtifact-UUID2", @@ -40,9 +41,9 @@ "artifactUUID": "Artifact-UUID3", "artifactVersion": "1.0", "generatedArtifact": "EnvArtifact-UUID3", - "relatedArtifact": + "relatedArtifact": [ - + ] }, @@ -50,7 +51,7 @@ "artifactChecksum": "CheckSum", "artifactDescription": "base_vfw ENV file", "artifactName": "base_vfw.env", - + "artifactType": "HEAT_ENV", "artifactURL": "base_vfw.env", "artifactUUID": "EnvArtifact-UUID3", diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/notif-without-modules-metadata/notif-structure.json b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/notif-without-modules-metadata/notif-structure.json index 2fb12edba0..622ea3c3f5 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/notif-without-modules-metadata/notif-structure.json +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/notif-without-modules-metadata/notif-structure.json @@ -3,12 +3,12 @@ "serviceInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f132", "serviceUUID": "1e34774e-715e-4fd5-bd09-7b654622f33e", "serviceVersion": "1.0", - "serviceArtifacts": + "serviceArtifacts": [ - + ], - "resources": + "resources": [ { "resourceInstanceName": "wrong-resource-1", @@ -17,9 +17,10 @@ "resourceType": "VF", "resourceUUID": "585822c7-4027-4f84-ba50-e9248606f136", "resourceVersion": "1.0", - "artifacts": + "category": "category", + "artifacts": [ - + { "artifactChecksum": "CheckSum", "artifactDescription": "Nimbus Heat OAM", @@ -30,7 +31,7 @@ "artifactUUID": "Artifact-UUID1", "artifactVersion": "1.0", "generatedArtifact": "EnvArtifact-UUID2", - "relatedArtifact": + "relatedArtifact": [ "NestedArtifact-UUID3" ] @@ -45,7 +46,7 @@ "artifactURL": "hot-nimbus-oam_v1.0.env", "artifactUUID": "EnvArtifact-UUID2", "artifactVersion": "1.0" - + }, { @@ -57,7 +58,7 @@ "artifactURL": "nested-oam_v1.0.yaml", "artifactUUID": "NestedArtifact-UUID3", "artifactVersion": "1.0" - + } ] } diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V1/artifacts/vnf-module-artifact.json b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V1/artifacts/vnf-module-artifact.json index f196467a9c..29aa4838c7 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V1/artifacts/vnf-module-artifact.json +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V1/artifacts/vnf-module-artifact.json @@ -4,11 +4,14 @@ "vfModuleModelInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f131", "vfModuleModelVersion": "1.0", "vfModuleModelUUID": "1e34774e-715e-4fd5-bd08-7b654622f33e.VF_RI2_G6_withArtifacts::module-0.group", + "vfModuleModelDescription": "vf Module Description", + "vfModuleModelCustomizationUUID": "585822c7-4027-4f84-ba50-e9248606f136", "isBase": true, "artifacts": [ "Artifact-UUID1", "EnvArtifact-UUID2", "NestedArtifact-UUID3" - ] + ] , + "properties": {"test":"test"} } ] \ No newline at end of file diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V1/notif-structure.json b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V1/notif-structure.json index 1f5e081f55..64b4b68927 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V1/notif-structure.json +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V1/notif-structure.json @@ -3,12 +3,12 @@ "serviceInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f132", "serviceUUID": "1e34774e-715e-4fd5-bd09-7b654622f33e", "serviceVersion": "1.0", - "serviceArtifacts": + "serviceArtifacts": [ - + ], - "resources": + "resources": [ { "resourceInstanceName": "resource-1", @@ -17,13 +17,14 @@ "resourceType": "VF", "resourceUUID": "585822c7-4027-4f84-ba50-e9248606f136", "resourceVersion": "1.0", - "artifacts": + "category": "category", + "artifacts": [ { "artifactChecksum": "CheckSum", "artifactDescription": "Meta data for VFModule", "artifactName": "vnf-module-artifact.json", - + "artifactType": "VF_MODULES_METADATA", "artifactURL": "vnf-module-artifact.json", "artifactUUID": "VfArtifact-UUID1", @@ -40,19 +41,19 @@ "artifactUUID": "Artifact-UUID1", "artifactVersion": "1.0", "generatedArtifact": "EnvArtifact-UUID2" - + }, { "artifactChecksum": "CheckSum", "artifactDescription": "Nimbus Heat ENV OAM", "artifactName": "hot-nimbus-oam_v1.0.env", - + "artifactType": "HEAT_ENV", "artifactURL": "hot-nimbus-oam_v1.0.env", "artifactUUID": "EnvArtifact-UUID2", "artifactVersion": "1.0" - + }, { @@ -64,7 +65,7 @@ "artifactURL": "nested-oam_v1.0.yaml", "artifactUUID": "NestedArtifact-UUID3", "artifactVersion": "1.0" - + } ] } diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V2/artifacts/vnf-module-artifact.json b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V2/artifacts/vnf-module-artifact.json index f196467a9c..301012e63c 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V2/artifacts/vnf-module-artifact.json +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V2/artifacts/vnf-module-artifact.json @@ -4,11 +4,14 @@ "vfModuleModelInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f131", "vfModuleModelVersion": "1.0", "vfModuleModelUUID": "1e34774e-715e-4fd5-bd08-7b654622f33e.VF_RI2_G6_withArtifacts::module-0.group", + "vfModuleModelDescription": "vf Module Description", + "vfModuleModelCustomizationUUID": "585822c7-4027-4f84-ba50-e9248606f131", "isBase": true, "artifacts": [ "Artifact-UUID1", "EnvArtifact-UUID2", "NestedArtifact-UUID3" - ] + ], + "properties": {"test":"test"} } ] \ No newline at end of file diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V2/notif-structure.json b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V2/notif-structure.json index 0b2b312991..ef9f2565a3 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V2/notif-structure.json +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V2/notif-structure.json @@ -3,12 +3,12 @@ "serviceInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f132", "serviceUUID": "1e34774e-715e-4fd5-bd09-7b654622f33f", "serviceVersion": "2.0", - "serviceArtifacts": + "serviceArtifacts": [ - + ], - "resources": + "resources": [ { "resourceInstanceName": "resource-1", @@ -17,13 +17,14 @@ "resourceType": "VF", "resourceUUID": "585822c7-4027-4f84-ba50-e9248606f136", "resourceVersion": "1.0", - "artifacts": + "category": "category", + "artifacts": [ { "artifactChecksum": "CheckSum", "artifactDescription": "Meta data for VFModule", "artifactName": "vnf-module-artifact.json", - + "artifactType": "VF_MODULES_METADATA", "artifactURL": "vnf-module-artifact.json", "artifactUUID": "VfArtifact-UUID1", @@ -40,7 +41,7 @@ "artifactUUID": "Artifact-UUID1", "artifactVersion": "1.0", "generatedArtifact": "EnvArtifact-UUID2", - "relatedArtifact": + "relatedArtifact": [ "NestedArtifact-UUID3" ] @@ -50,12 +51,12 @@ "artifactChecksum": "CheckSum", "artifactDescription": "Nimbus Heat ENV OAM", "artifactName": "hot-nimbus-oam_v1.0.env", - + "artifactType": "HEAT_ENV", "artifactURL": "hot-nimbus-oam_v1.0.env", "artifactUUID": "EnvArtifact-UUID2", "artifactVersion": "1.0" - + }, { @@ -67,7 +68,7 @@ "artifactURL": "nested-oam_v1.0.yaml", "artifactUUID": "NestedArtifact-UUID3", "artifactVersion": "1.0" - + } ] } diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V3/artifacts/vnf-module-artifact.json b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V3/artifacts/vnf-module-artifact.json index 7f1051d625..50fb1b7f18 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V3/artifacts/vnf-module-artifact.json +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V3/artifacts/vnf-module-artifact.json @@ -4,6 +4,8 @@ "vfModuleModelInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f132", "vfModuleModelVersion": "1.0", "vfModuleModelUUID": "1e34774e-715e-4fd5-bd08-7b654622f33e.VF_RI2_G6_withArtifacts::module-1.group", + "vfModuleModelDescription": "vf Module Description", + "vfModuleModelCustomizationUUID": "585822c7-4027-4f84-ba50-e9248606f132", "isBase": true, "artifacts": [ "Artifact-UUID1", @@ -12,6 +14,7 @@ "ScriptArtifact-UUID1", "VolumeArtifact-UUID1", "VolumeEnvArtifact-UUID1" - ] + ], + "properties": {"test":"test"} } ] \ No newline at end of file diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V3/notif-structure.json b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V3/notif-structure.json index fc017acb5e..c5c6f92a73 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V3/notif-structure.json +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V3/notif-structure.json @@ -3,12 +3,12 @@ "serviceInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f133", "serviceUUID": "1e34774e-715e-4fd5-bd09-7b654622f34g", "serviceVersion": "3.0", - "serviceArtifacts": + "serviceArtifacts": [ - + ], - "resources": + "resources": [ { "resourceInstanceName": "resource-1", @@ -17,13 +17,14 @@ "resourceType": "VF", "resourceUUID": "585822c7-4027-4f84-ba50-e9248606f136", "resourceVersion": "2.0", - "artifacts": + "category": "category", + "artifacts": [ { "artifactChecksum": "CheckSum", "artifactDescription": "Meta data for VFModule", "artifactName": "vnf-module-artifact.json", - + "artifactType": "VF_MODULES_METADATA", "artifactURL": "vnf-module-artifact.json", "artifactUUID": "VfArtifact-UUID2", @@ -40,7 +41,7 @@ "artifactUUID": "Artifact-UUID1", "artifactVersion": "1.0", "generatedArtifact": "EnvArtifact-UUID2", - "relatedArtifact": + "relatedArtifact": [ "NestedArtifact-UUID3", "ScriptArtifact-UUID1" @@ -51,12 +52,12 @@ "artifactChecksum": "CheckSum", "artifactDescription": "Nimbus Heat ENV OAM", "artifactName": "hot-nimbus-oam_v1.0.env", - + "artifactType": "HEAT_ENV", "artifactURL": "hot-nimbus-oam_v1.0.env", "artifactUUID": "EnvArtifact-UUID2", "artifactVersion": "1.0" - + }, { @@ -68,19 +69,19 @@ "artifactURL": "nested-oam_v1.0.yaml", "artifactUUID": "NestedArtifact-UUID3", "artifactVersion": "1.0" - + }, { "artifactChecksum": "CheckSum", "artifactDescription": "Script for OAM", "artifactName": "mount_iso_script.sh", - + "artifactType": "HEAT_ARTIFACT", "artifactURL": "mount_iso_script.sh", "artifactUUID": "ScriptArtifact-UUID1", "artifactVersion": "1.0" - + }, { @@ -93,19 +94,19 @@ "artifactUUID": "VolumeArtifact-UUID1", "artifactVersion": "1.0", "generatedArtifact": "VolumeEnvArtifact-UUID1" - + }, { "artifactChecksum": "CheckSum", "artifactDescription": "Heat Env Vol for OAM", "artifactName": "hot-nimbus-oam-volumes_v1.0.env", - + "artifactType": "HEAT_ENV", "artifactURL": "hot-nimbus-oam-volumes_v1.0.env", "artifactUUID": "VolumeEnvArtifact-UUID1", "artifactVersion": "1.0" - + } ] } diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V4/artifacts/vnf-module-artifact.json b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V4/artifacts/vnf-module-artifact.json index 7f1051d625..50fb1b7f18 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V4/artifacts/vnf-module-artifact.json +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V4/artifacts/vnf-module-artifact.json @@ -4,6 +4,8 @@ "vfModuleModelInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f132", "vfModuleModelVersion": "1.0", "vfModuleModelUUID": "1e34774e-715e-4fd5-bd08-7b654622f33e.VF_RI2_G6_withArtifacts::module-1.group", + "vfModuleModelDescription": "vf Module Description", + "vfModuleModelCustomizationUUID": "585822c7-4027-4f84-ba50-e9248606f132", "isBase": true, "artifacts": [ "Artifact-UUID1", @@ -12,6 +14,7 @@ "ScriptArtifact-UUID1", "VolumeArtifact-UUID1", "VolumeEnvArtifact-UUID1" - ] + ], + "properties": {"test":"test"} } ] \ No newline at end of file diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V4/notif-structure.json b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V4/notif-structure.json index ccf80ce4af..c4b113441f 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V4/notif-structure.json +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V4/notif-structure.json @@ -3,12 +3,12 @@ "serviceInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f134", "serviceUUID": "1e34774e-715e-4fd5-bd09-7b654622f35h", "serviceVersion": "4.0", - "serviceArtifacts": + "serviceArtifacts": [ - + ], - "resources": + "resources": [ { "resourceInstanceName": "resource-1", @@ -17,13 +17,14 @@ "resourceType": "VF", "resourceUUID": "585822c7-4027-4f84-ba50-e9248606f136", "resourceVersion": "2.0", - "artifacts": + "category": "category", + "artifacts": [ { "artifactChecksum": "CheckSum", "artifactDescription": "Meta data for VFModule", "artifactName": "vnf-module-artifact.json", - + "artifactType": "VF_MODULES_METADATA", "artifactURL": "vnf-module-artifact.json", "artifactUUID": "VfArtifact-UUID2", @@ -40,7 +41,7 @@ "artifactUUID": "Artifact-UUID1", "artifactVersion": "1.0", "generatedArtifact": "EnvArtifact-UUID2", - "relatedArtifact": + "relatedArtifact": [ "NestedArtifact-UUID3", "ScriptArtifact-UUID1" @@ -51,12 +52,12 @@ "artifactChecksum": "CheckSum", "artifactDescription": "Nimbus Heat ENV OAM", "artifactName": "hot-nimbus-oam_v1.0.env", - + "artifactType": "HEAT_ENV", "artifactURL": "hot-nimbus-oam_v1.0.env", "artifactUUID": "EnvArtifact-UUID2", "artifactVersion": "1.0" - + }, { @@ -68,19 +69,19 @@ "artifactURL": "nested-oam_v1.0.yaml", "artifactUUID": "NestedArtifact-UUID3", "artifactVersion": "1.0" - + }, { "artifactChecksum": "CheckSum", "artifactDescription": "Script for OAM", "artifactName": "mount_iso_script.sh", - + "artifactType": "HEAT_ARTIFACT", "artifactURL": "mount_iso_script.sh", "artifactUUID": "ScriptArtifact-UUID1", "artifactVersion": "1.0" - + }, { @@ -93,19 +94,19 @@ "artifactUUID": "VolumeArtifact-UUID1", "artifactVersion": "1.0", "generatedArtifact": "VolumeEnvArtifact-UUID1" - + }, { "artifactChecksum": "CheckSum", "artifactDescription": "Heat Env Vol for OAM", "artifactName": "hot-nimbus-oam-volumes_v1.0.env", - + "artifactType": "HEAT_ENV", "artifactURL": "hot-nimbus-oam-volumes_v1.0.env", "artifactUUID": "VolumeEnvArtifact-UUID1", "artifactVersion": "1.0" - + } ] } diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V5/artifacts/vnf-module-artifact.json b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V5/artifacts/vnf-module-artifact.json index 111bf04c7e..70483dcd7f 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V5/artifacts/vnf-module-artifact.json +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V5/artifacts/vnf-module-artifact.json @@ -4,6 +4,8 @@ "vfModuleModelInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f132", "vfModuleModelVersion": "1.0", "vfModuleModelUUID": "1e34774e-715e-4fd5-bd08-7b654622f33e.VF_RI2_G6_withArtifacts::module-1.group", + "vfModuleModelDescription": "vf Module Description", + "vfModuleModelCustomizationUUID": "585822c7-4027-4f84-ba50-e9248606f132", "isBase": true, "artifacts": [ "Artifact-UUID1", @@ -13,17 +15,21 @@ "ScriptArtifact-UUID1", "VolumeArtifact-UUID1", "VolumeEnvArtifact-UUID1" - ] + ], + "properties": {"test":"test"} }, { "vfModuleModelName": "VF_RI2_G91_withArtifacts::module-1", "vfModuleModelInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f169", "vfModuleModelVersion": "1.0", "vfModuleModelUUID": "1e34774e-715e-4fd5-bd08-7b654622f63g.VF_RI2_G9_withArtifacts::module-1.group", + "vfModuleModelDescription": "vf Module Description", + "vfModuleModelCustomizationUUID": "585822c7-4027-4f84-ba50-e9248606f169", "isBase": true, "artifacts": [ "HeatArtifactE2E-UUIDTest" - - ] + + ], + "properties": {"test":"test"} } ] \ No newline at end of file diff --git a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V5/notif-structure.json b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V5/notif-structure.json index 7ae9ff5556..4d4cb97fd2 100644 --- a/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V5/notif-structure.json +++ b/packages/arquillian-unit-tests/src/test/resources/resource-examples/asdc/simpleNotif-V5/notif-structure.json @@ -3,12 +3,12 @@ "serviceInvariantUUID": "585822c7-4027-4f84-ba50-e9248606f134", "serviceUUID": "1e34774e-715e-4fd5-bd09-7b654622f35i", "serviceVersion": "5.0", - "serviceArtifacts": + "serviceArtifacts": [ - + ], - "resources": + "resources": [ { "resourceInstanceName": "resource-1", @@ -17,13 +17,14 @@ "resourceType": "VF", "resourceUUID": "585822c7-4027-4f84-ba50-e9248606f136", "resourceVersion": "3.0", - "artifacts": + "category": "category", + "artifacts": [ { "artifactChecksum": "CheckSum", "artifactDescription": "Meta data for VFModule", "artifactName": "vnf-module-artifact.json", - + "artifactType": "VF_MODULES_METADATA", "artifactURL": "vnf-module-artifact.json", "artifactUUID": "VfArtifact-UUID2", @@ -40,7 +41,7 @@ "artifactUUID": "Artifact-UUID1", "artifactVersion": "1.0", "generatedArtifact": "EnvArtifact-UUID2", - "relatedArtifact": + "relatedArtifact": [ "NestedArtifact-UUID3", "ScriptArtifact-UUID1" @@ -51,12 +52,12 @@ "artifactChecksum": "CheckSum", "artifactDescription": "Nimbus Heat ENV OAM", "artifactName": "hot-nimbus-oam_v1.0.env", - + "artifactType": "HEAT_ENV", "artifactURL": "hot-nimbus-oam_v1.0.env", "artifactUUID": "EnvArtifact-UUID2", "artifactVersion": "1.0" - + }, { @@ -68,9 +69,9 @@ "artifactURL": "nested-oam_v1.0.yaml", "artifactUUID": "NestedArtifact-UUID3", "artifactVersion": "1.0" - + }, - + { "artifactChecksum": "CheckSum", "artifactDescription": "Nested PSM", @@ -80,31 +81,31 @@ "artifactURL": "nested-psm_v1.0.yaml", "artifactUUID": "NestedArtifact-UUID4", "artifactVersion": "1.0" - + }, { "artifactChecksum": "CheckSum", "artifactDescription": "Script for Nimbus", "artifactName": "cloud-nimbus.sh", - + "artifactType": "HEAT_ARTIFACT", "artifactURL": "cloud-nimbus.sh", "artifactUUID": "ScriptNimbusArtifact-UUID1", "artifactVersion": "1.0" - + }, { "artifactChecksum": "CheckSum", "artifactDescription": "Script for OAM", "artifactName": "mount_iso_script.sh", - + "artifactType": "HEAT_ARTIFACT", "artifactURL": "mount_iso_script.sh", "artifactUUID": "ScriptArtifact-UUID1", "artifactVersion": "1.0" - + }, { @@ -117,23 +118,23 @@ "artifactUUID": "VolumeArtifact-UUID1", "artifactVersion": "1.0", "generatedArtifact": "VolumeEnvArtifact-UUID1", - "relatedArtifact": + "relatedArtifact": [ "NestedArtifact-UUID4" ] - + }, { "artifactChecksum": "CheckSum", "artifactDescription": "Heat Env Vol for OAM", "artifactName": "hot-nimbus-oam-volumes_v1.0.env", - + "artifactType": "HEAT_ENV", "artifactURL": "hot-nimbus-oam-volumes_v1.0.env", "artifactUUID": "VolumeEnvArtifact-UUID1", "artifactVersion": "1.0" - + }, { "artifactChecksum": "CheckSum", diff --git a/packages/deliveries/pom.xml b/packages/deliveries/pom.xml index 61236ed5fc..704e22ff60 100644 --- a/packages/deliveries/pom.xml +++ b/packages/deliveries/pom.xml @@ -16,7 +16,7 @@ This project is responsible of the final packages OPENECOMP - MSO - http://www.onap.org/ + http://www.openecomp.org/ @@ -49,7 +49,7 @@ - + posix @@ -76,4 +76,4 @@ - + \ No newline at end of file diff --git a/packages/deliveries/src/main/assembly/war-pack/mso-wars.xml b/packages/deliveries/src/main/assembly/war-pack/mso-wars.xml index d412713a9d..d469d03bed 100644 --- a/packages/deliveries/src/main/assembly/war-pack/mso-wars.xml +++ b/packages/deliveries/src/main/assembly/war-pack/mso-wars.xml @@ -7,9 +7,9 @@ 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. @@ -29,7 +29,7 @@ false - + @@ -72,20 +72,20 @@ - mso-appc-adapter-*.war + mso-requests-db-adapter*.war - ../../adapters/mso-appc-adapter/target/ + ../../adapters/mso-requests-db-adapter/target/ artifacts - mso-requests-db-adapter*.war + mso-catalog-db-adapter*.war - ../../adapters/mso-requests-db-adapter/target/ + ../../adapters/mso-catalog-db-adapter/target/ artifacts - + asdc-controller*.war @@ -93,14 +93,21 @@ ../../asdc-controller/target/ artifacts - + - MSOGammaBPMN*.war + MSOCommonBPMN*.war - ../../bpmn/MSOGammaBPMN/target/ + ../../bpmn/MSOCommonBPMN/target/ artifacts + + + MSOInfrastructureBPMN*.war + + ../../bpmn/MSOInfrastructureBPMN/target/ + artifacts + MSOCockpit*.war @@ -108,7 +115,7 @@ ../../bpmn/MSOCockpit/target/ artifacts - + - + diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml index 58ac368d03..8cd65652dc 100644 --- a/packages/docker/pom.xml +++ b/packages/docker/pom.xml @@ -19,15 +19,18 @@ UTF-8 UTF-8 - ${env.GIT_NO_PROJECT} + i.e: mvn clean install -P docker -Dmso.git.url=https://gerrit.openecomp.org/r--> + ${env.GIT_NO_PROJECT} + master + mso/chef-repo + mso/mso-config ${project.version} ${project.artifactId}-${project.version} - + org.codehaus.groovy.maven gmaven-plugin @@ -56,6 +59,7 @@ + org.apache.maven.plugins maven-scm-plugin @@ -68,9 +72,9 @@ initialize - scm:git:${mso.git.url}/mso/chef-repo + scm:git:${mso.chef.git.url.prefix}/${mso.chef.git.url.suffix.chef.repo} src/main/docker/docker-files/chef-configs/chef-repo - master + ${mso.chef.git.branchname} branch true false @@ -83,9 +87,9 @@ initialize - scm:git:${mso.git.url}/mso/mso-config + scm:git:${mso.chef.git.url.prefix}/${mso.chef.git.url.suffix.chef.config} src/main/docker/docker-files/chef-configs/mso-config - master + ${mso.chef.git.branchname} branch true false @@ -140,8 +144,8 @@ mso-arquillian + ${project.docker.latesttag.version} ${project.version}-STAGING-${maven.build.timestamp} - ${project.docker.latesttag.version} try docker-files @@ -154,8 +158,8 @@ mso + ${project.docker.latesttag.version} ${project.version}-STAGING-${maven.build.timestamp} - ${project.docker.latesttag.version} try docker-files diff --git a/packages/docker/src/main/docker/docker-files/jboss-configs/configuration/application-roles.properties b/packages/docker/src/main/docker/docker-files/jboss-configs/configuration/application-roles.properties index de9b0aac09..cff4865c3d 100644 --- a/packages/docker/src/main/docker/docker-files/jboss-configs/configuration/application-roles.properties +++ b/packages/docker/src/main/docker/docker-files/jboss-configs/configuration/application-roles.properties @@ -29,4 +29,5 @@ InfraPortalClient=InfraPortal-Client MSOClient=MSO-Client sitecontrol=SiteControl-Client MSO=AAIEmul-Client -BPELClient=BPEL-Client \ No newline at end of file +BPELClient=BPEL-Client +SDNCClient=SDNC-Client diff --git a/packages/docker/src/main/docker/docker-files/jboss-configs/configuration/application-users.properties b/packages/docker/src/main/docker/docker-files/jboss-configs/configuration/application-users.properties index a04d22296d..f7b44d4283 100644 --- a/packages/docker/src/main/docker/docker-files/jboss-configs/configuration/application-users.properties +++ b/packages/docker/src/main/docker/docker-files/jboss-configs/configuration/application-users.properties @@ -31,4 +31,5 @@ InfraPortalClient=e5077b432685a94babe332893337f6fc MSOClient=72bc85031ae67afe67014c7663ae1033 sitecontrol=9a3a360d86758f69ec9508725c017335 MSO=a05cb60a04f41f750ce1fc60a2633534 -BPELClient=f2b4ce8ae1964050c0ad7e69bd88fd62 \ No newline at end of file +BPELClient=f2b4ce8ae1964050c0ad7e69bd88fd62 +SDNCClient=3c98dfba582d79948496b319e3edcb4b diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/automated-tests/create_mso_db-tests.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/automated-tests/create_mso_db-tests.sql index e622bf34ee..146ad01605 100644 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/automated-tests/create_mso_db-tests.sql +++ b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/automated-tests/create_mso_db-tests.sql @@ -15,26 +15,35 @@ FLUSH PRIVILEGES; LOCK TABLES `NETWORK_RESOURCE` WRITE; /*!40000 ALTER TABLE `NETWORK_RESOURCE` DISABLE KEYS */; /*!40000 ALTER TABLE `NETWORK_RESOURCE` ENABLE KEYS */; -insert into NETWORK_RESOURCE (id, NETWORK_TYPE, VERSION_STR, ORCHESTRATION_MODE ,DESCRIPTION, TEMPLATE_ID, NEUTRON_NETWORK_TYPE) values -(1, "vlan",'1',"NEUTRON","Cool network",1,"BASIC"); +insert into NETWORK_RESOURCE (id, NETWORK_TYPE, VERSION_STR, ORCHESTRATION_MODE ,DESCRIPTION, TEMPLATE_ID, NEUTRON_NETWORK_TYPE, AIC_VERSION_MIN) values +(1, "vlan",'1',"NEUTRON","Cool network",1,"BASIC","0"); UNLOCK TABLES; LOCK TABLES `NETWORK_RECIPE` WRITE; /*!40000 ALTER TABLE `NETWORK_RECIPE` DISABLE KEYS */; -INSERT INTO `NETWORK_RECIPE`(`NETWORK_TYPE`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`) VALUES +INSERT INTO `NETWORK_RECIPE`(`NETWORK_TYPE`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `NETWORK_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`) VALUES ('vlan','CREATE','1',NULL,'/active-bpel/services/REST/CreateNetwork',NULL,180,NULL), ('vlan','DELETE','1',NULL,'/active-bpel/services/REST/DeleteNetwork',NULL,180,NULL); /*!40000 ALTER TABLE `NETWORK_RECIPE` ENABLE KEYS */; UNLOCK TABLES; +LOCK TABLES `VNF_RECIPE` WRITE; INSERT INTO `VNF_RECIPE`(`ID`, `VNF_TYPE`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TYPE`) VALUES (100,'VPE','CREATE','1','','/active-bpel/services/REST/CreateGenericVNF','',180,'SDN-ETHERNET-INTERNET'), (101,'VPE','DELETE','1','','/active-bpel/services/REST/DeleteGenericVNF','',180,'SDN-ETHERNET-INTERNET'); +UNLOCK TABLES; +LOCK TABLES `VF_MODULE` WRITE; INSERT INTO `VF_MODULE`(`ID`, `TYPE`, `ASDC_SERVICE_MODEL_VERSION`, `MODEL_NAME`, `MODEL_VERSION`, `IS_BASE`, `VNF_RESOURCE_ID`) VALUES -(100,'dns-servicetest/DNSResource-1::VF_DNS::module-1','1.0','VF_DNS::module-1','1.0','1','7'); +(100,'dns-servicetest/DNSResource-1::VF_DNS::module-1','1.0','VF_DNS::module-1','1.0','1','7'), +(101,'dns-servicetest/DNSResource-1::Mog111..mog_psm..module-1','1.0','Mog111..mog_psm..module-1','1.0','1','7'); +UNLOCK TABLES; + +LOCK TABLES `VNF_RESOURCE` WRITE; +INSERT INTO `VNF_RESOURCE`(`ID`, `VNF_TYPE`, `ASDC_SERVICE_MODEL_VERSION`, `ORCHESTRATION_MODE`, `MODEL_VERSION`) VALUES +(100,'dns-servicetest/DNSResource-1','1.0','VF_DNS::module-1','1.0'); +UNLOCK TABLES; -DELETE FROM VNF_RESOURCE; DELETE FROM HEAT_TEMPLATE_PARAMS; DELETE FROM HEAT_TEMPLATE; DELETE FROM HEAT_ENVIRONMENT; diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/default/create_mso_db-default.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/default/create_mso_db-default.sql index e2611b358e..d7fc2b2366 100644 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/default/create_mso_db-default.sql +++ b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/bulkload-files/default/create_mso_db-default.sql @@ -1,6 +1,5 @@ -SOURCE ../../camunda/mysql_engine_7.3.0.sql -SOURCE ../../camunda/mysql_identity_7.3.0.sql -SOURCE ../../camunda/mysql_updates_7.3.0.sql +SOURCE ../../camunda/mariadb_engine_7.6.0.sql +SOURCE ../../camunda/mariadb_identity_7.6.0.sql -- -- Create an admin user automatically for the cockpit @@ -33,6 +32,7 @@ USE `mso_catalog`; SOURCE ../../main-schemas/MySQL-Catalog-schema.sql SOURCE ../../sub-sql-files/catalog_timestamp_mso_db.sql +SOURCE ../../sub-sql-files/catalog_add_constraints.sql LOCK TABLES `NETWORK_RECIPE` WRITE; /*!40000 ALTER TABLE `NETWORK_RECIPE` DISABLE KEYS */; @@ -83,9 +83,9 @@ INSERT INTO `VNF_COMPONENTS_RECIPE` /*!40000 ALTER TABLE `VNF_COMPONENTS_RECIPE` ENABLE KEYS */; UNLOCK TABLES; -INSERT INTO service (id, SERVICE_NAME, VERSION_STR, DESCRIPTION) VALUES ('4', 'VID_DEFAULT', '1.0', 'Default service for VID to use for infra APIH orchestration'); -INSERT INTO service_recipe (SERVICE_ID, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('4', 'createInstance', '1', 'VID_DEFAULT recipe to create service-instance if no custom BPMN flow is found', '/mso/async/services/CreateServiceInstanceInfra', '180'); -INSERT INTO service_recipe (SERVICE_ID, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('4', 'deleteInstance', '1', 'VID_DEFAULT recipe to delete service-instance if no custom BPMN flow is found', '/mso/async/services/DeleteServiceInstanceInfra', '180'); +INSERT INTO service (id, SERVICE_NAME, VERSION_STR, DESCRIPTION, SERVICE_NAME_VERSION_ID) VALUES ('4', 'VID_DEFAULT', '1.0', 'Default service for VID to use for infra APIH orchestration', 'MANUAL_RECORD'); +INSERT INTO service_recipe (SERVICE_ID, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('4', 'createInstance', '1', 'VID_DEFAULT recipe to create service-instance if no custom BPMN flow is found', '/mso/async/services/CreateServiceInstance', '180'); +INSERT INTO service_recipe (SERVICE_ID, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('4', 'deleteInstance', '1', 'VID_DEFAULT recipe to delete service-instance if no custom BPMN flow is found', '/mso/async/services/DelServiceInstance', '180'); INSERT INTO vnf_recipe (VNF_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('VID_DEFAULT', 'createInstance', '1', 'VID_DEFAULT recipe to create VNF if no custom BPMN flow is found', '/mso/async/services/CreateVnfInfra', '180'); INSERT INTO vnf_recipe (VNF_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('VID_DEFAULT', 'deleteInstance', '1', 'VID_DEFAULT recipe to delete VNF if no custom BPMN flow is found', '/mso/async/services/DeleteVnfInfra', '180'); INSERT INTO vnf_components_recipe (VNF_TYPE, VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES (NULL, 'volumeGroup', 'createInstance', '1', 'VID_DEFAULT recipe to create volume-group if no custom BPMN flow is found', '/mso/async/services/CreateVfModuleVolumeInfraV1', '180', 'VID_DEFAULT'); @@ -94,6 +94,6 @@ INSERT INTO vnf_components_recipe (VNF_TYPE, VNF_COMPONENT_TYPE, ACTION, VERSION INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES ('vfModule', 'createInstance', '1', 'VID_DEFAULT recipe to create vf-module if no custom BPMN flow is found', '/mso/async/services/CreateVfModuleInfra', '180', 'VID_DEFAULT'); INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES ('vfModule', 'deleteInstance', '1', 'VID_DEFAULT recipe to delete vf-module if no custom BPMN flow is found', '/mso/async/services/DeleteVfModuleInfra', '180', 'VID_DEFAULT'); INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_ID) VALUES ('vfModule', 'updateInstance', '1', 'VID_DEFAULT recipe to update vf-module if no custom BPMN flow is found', '/mso/async/services/UpdateVfModuleInfra', '180', 'VID_DEFAULT'); -INSERT INTO network_recipe (NETWORK_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('VID_DEFAULT', 'createInstance', '1.0', 'VID_DEFAULT recipe to create network if no custom BPMN flow is found', '/mso/async/services/CreateNetworkInstanceInfra', '180'); +INSERT INTO network_recipe (NETWORK_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('VID_DEFAULT', 'createInstance', '1.0', 'VID_DEFAULT recipe to create network if no custom BPMN flow is found', '/mso/async/services/CreateNetworkInstance', '180'); INSERT INTO network_recipe (NETWORK_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('VID_DEFAULT', 'updateInstance', '1.0', 'VID_DEFAULT recipe to update network if no custom BPMN flow is found', '/mso/async/services/UpdateNetworkInstanceInfra', '180'); -INSERT INTO network_recipe (NETWORK_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('VID_DEFAULT', 'deleteInstance', '1.0', 'VID_DEFAULT recipe to delete network if no custom BPMN flow is found', '/mso/async/services/DeleteNetworkInstanceInfra', '180'); \ No newline at end of file +INSERT INTO network_recipe (NETWORK_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) VALUES ('VID_DEFAULT', 'deleteInstance', '1.0', 'VID_DEFAULT recipe to delete network if no custom BPMN flow is found', '/mso/async/services/DeleteNetworkInstance', '180'); \ No newline at end of file diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_engine_7.6.0.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_engine_7.6.0.sql new file mode 100644 index 0000000000..f40f3dc3de --- /dev/null +++ b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_engine_7.6.0.sql @@ -0,0 +1,1071 @@ +# Start of Statements added for MSO +DROP DATABASE IF EXISTS `camundabpmn`; + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `camundabpmn` /*!40100 DEFAULT CHARACTER SET latin1 */; + +USE `camundabpmn`; + +# DROP USER IF EXISTS 'camunda'; +delete from mysql.user where User='camunda'; +CREATE USER 'camunda'; +GRANT ALL on camundabpmn.* to 'camunda' identified by 'camunda123' with GRANT OPTION; +FLUSH PRIVILEGES; +# End of Statements added for MSO + +create table ACT_GE_PROPERTY ( + NAME_ varchar(64), + VALUE_ varchar(300), + REV_ integer, + primary key (NAME_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +insert into ACT_GE_PROPERTY +values ('schema.version', 'fox', 1); + +insert into ACT_GE_PROPERTY +values ('schema.history', 'create(fox)', 1); + +insert into ACT_GE_PROPERTY +values ('next.dbid', '1', 1); + +insert into ACT_GE_PROPERTY +values ('deployment.lock', '0', 1); + +create table ACT_GE_BYTEARRAY ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + BYTES_ LONGBLOB, + GENERATED_ TINYINT, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RE_DEPLOYMENT ( + ID_ varchar(64), + NAME_ varchar(255), + DEPLOY_TIME_ timestamp(3), + SOURCE_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EXECUTION ( + ID_ varchar(64), + REV_ integer, + PROC_INST_ID_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + SUPER_EXEC_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + IS_ACTIVE_ TINYINT, + IS_CONCURRENT_ TINYINT, + IS_SCOPE_ TINYINT, + IS_EVENT_SCOPE_ TINYINT, + SUSPENSION_STATE_ integer, + CACHED_ENT_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_JOB ( + ID_ varchar(64) NOT NULL, + REV_ integer, + TYPE_ varchar(255) NOT NULL, + LOCK_EXP_TIME_ timestamp(3) NULL, + LOCK_OWNER_ varchar(255), + EXCLUSIVE_ boolean, + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + RETRIES_ integer, + EXCEPTION_STACK_ID_ varchar(64), + EXCEPTION_MSG_ varchar(4000), + DUEDATE_ timestamp(3) NULL, + REPEAT_ varchar(255), + HANDLER_TYPE_ varchar(255), + HANDLER_CFG_ varchar(4000), + DEPLOYMENT_ID_ varchar(64), + SUSPENSION_STATE_ integer NOT NULL DEFAULT 1, + JOB_DEF_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_JOBDEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + JOB_TYPE_ varchar(255) NOT NULL, + JOB_CONFIGURATION_ varchar(255), + SUSPENSION_STATE_ integer, + JOB_PRIORITY_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RE_PROCDEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + HAS_START_FORM_KEY_ TINYINT, + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + VERSION_TAG_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_TASK ( + ID_ varchar(64), + REV_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + TASK_DEF_KEY_ varchar(255), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + DELEGATION_ varchar(64), + PRIORITY_ integer, + CREATE_TIME_ timestamp(3), + DUE_DATE_ datetime(3), + FOLLOW_UP_DATE_ datetime(3), + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_IDENTITYLINK ( + ID_ varchar(64), + REV_ integer, + GROUP_ID_ varchar(255), + TYPE_ varchar(255), + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_VARIABLE ( + ID_ varchar(64) not null, + REV_ integer, + TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + TASK_ID_ varchar(64), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ varchar(4000), + TEXT2_ varchar(4000), + VAR_SCOPE_ varchar(64) not null, + SEQUENCE_COUNTER_ bigint, + IS_CONCURRENT_LOCAL_ TINYINT, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EVENT_SUBSCR ( + ID_ varchar(64) not null, + REV_ integer, + EVENT_TYPE_ varchar(255) not null, + EVENT_NAME_ varchar(255), + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTIVITY_ID_ varchar(64), + CONFIGURATION_ varchar(255), + CREATED_ timestamp(3) not null, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_INCIDENT ( + ID_ varchar(64) not null, + REV_ integer not null, + INCIDENT_TIMESTAMP_ timestamp(3) not null, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + ACTIVITY_ID_ varchar(255), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_AUTHORIZATION ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ integer not null, + GROUP_ID_ varchar(255), + USER_ID_ varchar(255), + RESOURCE_TYPE_ integer not null, + RESOURCE_ID_ varchar(64), + PERMS_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_FILTER ( + ID_ varchar(64) not null, + REV_ integer not null, + RESOURCE_TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + OWNER_ varchar(255), + QUERY_ LONGTEXT not null, + PROPERTIES_ LONGTEXT, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_METER_LOG ( + ID_ varchar(64) not null, + NAME_ varchar(64) not null, + REPORTER_ varchar(255), + VALUE_ bigint, + TIMESTAMP_ timestamp(3), + MILLISECONDS_ bigint DEFAULT 0, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EXT_TASK ( + ID_ varchar(64) not null, + REV_ integer not null, + WORKER_ID_ varchar(255), + TOPIC_NAME_ varchar(255), + RETRIES_ integer, + ERROR_MSG_ varchar(4000), + ERROR_DETAILS_ID_ varchar(64), + LOCK_EXP_TIME_ timestamp(3) NULL, + SUSPENSION_STATE_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + TENANT_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_BATCH ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_CREATED_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + SUSPENSION_STATE_ integer, + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_); +create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_); +create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_); +create index ACT_IDX_TASK_ASSIGNEE on ACT_RU_TASK(ASSIGNEE_); +create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_); +create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_); +create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_); +create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_); +create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_); +create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_); +create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); +create index ACT_IDX_INC_CONFIGURATION on ACT_RU_INCIDENT(CONFIGURATION_); +create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_); +-- CAM-5914 +create index ACT_IDX_JOB_EXECUTION_ID on ACT_RU_JOB(EXECUTION_ID_); +-- this index needs to be limited in mariadb see CAM-6938 +create index ACT_IDX_JOB_HANDLER on ACT_RU_JOB(HANDLER_TYPE_(100),HANDLER_CFG_(155)); +create index ACT_IDX_JOB_PROCINST on ACT_RU_JOB(PROCESS_INSTANCE_ID_); +create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_); +create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_); + +-- new metric milliseconds column +CREATE INDEX ACT_IDX_METER_LOG_MS ON ACT_RU_METER_LOG(MILLISECONDS_); +CREATE INDEX ACT_IDX_METER_LOG_NAME_MS ON ACT_RU_METER_LOG(NAME_, MILLISECONDS_); +CREATE INDEX ACT_IDX_METER_LOG_REPORT ON ACT_RU_METER_LOG(NAME_, REPORTER_, MILLISECONDS_); + +-- old metric timestamp column +CREATE INDEX ACT_IDX_METER_LOG_TIME ON ACT_RU_METER_LOG(TIMESTAMP_); +CREATE INDEX ACT_IDX_METER_LOG ON ACT_RU_METER_LOG(NAME_, TIMESTAMP_); + +create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_); +create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_); +create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_); +create index ACT_IDX_AUTH_GROUP_ID ON ACT_RU_AUTHORIZATION(GROUP_ID_); +create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_); + +alter table ACT_GE_BYTEARRAY + add constraint ACT_FK_BYTEARR_DEPL + foreign key (DEPLOYMENT_ID_) + references ACT_RE_DEPLOYMENT (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade; + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_SUPER + foreign key (SUPER_EXEC_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_TSKASS_TASK + foreign key (TASK_ID_) + references ACT_RU_TASK (ID_); + +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_ATHRZ_PROCEDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF(ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION(ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_BYTEARRAY + foreign key (BYTEARRAY_ID_) + references ACT_GE_BYTEARRAY (ID_); + +alter table ACT_RU_JOB + add constraint ACT_FK_JOB_EXCEPTION + foreign key (EXCEPTION_STACK_ID_) + references ACT_GE_BYTEARRAY (ID_); + +alter table ACT_RU_EVENT_SUBSCR + add constraint ACT_FK_EVENT_EXEC + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION(ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_CAUSE + foreign key (CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_RCAUSE + foreign key (ROOT_CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_ERROR_DETAILS + foreign key (ERROR_DETAILS_ID_) + references ACT_GE_BYTEARRAY (ID_); + +create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_); +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_JOB_DEF + foreign key (JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_USER + unique (USER_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_GROUP + unique (GROUP_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_UNIQ_VARIABLE + unique (VAR_SCOPE_, NAME_); + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_SEED_JOB_DEF + foreign key (SEED_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_MONITOR_JOB_DEF + foreign key (MONITOR_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_JOB_DEF + foreign key (BATCH_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +-- indexes for deadlock problems - https://app.camunda.com/jira/browse/CAM-2567 -- +create index ACT_IDX_INC_CAUSEINCID on ACT_RU_INCIDENT(CAUSE_INCIDENT_ID_); +create index ACT_IDX_INC_EXID on ACT_RU_INCIDENT(EXECUTION_ID_); +create index ACT_IDX_INC_PROCDEFID on ACT_RU_INCIDENT(PROC_DEF_ID_); +create index ACT_IDX_INC_PROCINSTID on ACT_RU_INCIDENT(PROC_INST_ID_); +create index ACT_IDX_INC_ROOTCAUSEINCID on ACT_RU_INCIDENT(ROOT_CAUSE_INCIDENT_ID_); +-- index for deadlock problem - https://app.camunda.com/jira/browse/CAM-4440 -- +create index ACT_IDX_AUTH_RESOURCE_ID on ACT_RU_AUTHORIZATION(RESOURCE_ID_); +-- index to prevent deadlock on fk constraint - https://app.camunda.com/jira/browse/CAM-5440 -- +create index ACT_IDX_EXT_TASK_EXEC on ACT_RU_EXT_TASK(EXECUTION_ID_); + +-- indexes to improve deployment +create index ACT_IDX_BYTEARRAY_NAME on ACT_GE_BYTEARRAY(NAME_); +create index ACT_IDX_DEPLOYMENT_NAME on ACT_RE_DEPLOYMENT(NAME_); +create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_); +create index ACT_IDX_JOBDEF_PROC_DEF_ID ON ACT_RU_JOBDEF(PROC_DEF_ID_); +create index ACT_IDX_JOB_HANDLER_TYPE ON ACT_RU_JOB(HANDLER_TYPE_); +create index ACT_IDX_EVENT_SUBSCR_EVT_NAME ON ACT_RU_EVENT_SUBSCR(EVENT_NAME_); +create index ACT_IDX_PROCDEF_DEPLOYMENT_ID ON ACT_RE_PROCDEF(DEPLOYMENT_ID_); +create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_); +create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); +-- create case definition table -- +create table ACT_RE_CASE_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create case execution table -- +create table ACT_RU_CASE_EXECUTION ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + SUPER_EXEC_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + ACT_ID_ varchar(255), + PREV_STATE_ integer, + CURRENT_STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create case sentry part table -- + +create table ACT_RU_CASE_SENTRY_PART ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + CASE_EXEC_ID_ varchar(64), + SENTRY_ID_ varchar(255), + TYPE_ varchar(255), + SOURCE_CASE_EXEC_ID_ varchar(64), + STANDARD_EVENT_ varchar(255), + SOURCE_ varchar(255), + VARIABLE_EVENT_ varchar(255), + VARIABLE_NAME_ varchar(255), + SATISFIED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create index on business key -- +create index ACT_IDX_CASE_EXEC_BUSKEY on ACT_RU_CASE_EXECUTION(BUSINESS_KEY_); + +-- create foreign key constraints on ACT_RU_CASE_EXECUTION -- +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_) on delete cascade on update cascade; + +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_VARIABLE -- +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +-- create foreign key constraints on ACT_RU_TASK -- +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_CASE_SENTRY_PART -- +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_EXEC + foreign key (CASE_EXEC_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_); +create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_); +-- create decision definition table -- +create table ACT_RE_DECISION_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + DEC_REQ_ID_ varchar(64), + DEC_REQ_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create decision requirements definition table -- +create table ACT_RE_DECISION_REQ_DEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) NOT NULL, + VERSION_ integer NOT NULL, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_RE_DECISION_DEF + add constraint ACT_FK_DEC_REQ + foreign key (DEC_REQ_ID_) + references ACT_RE_DECISION_REQ_DEF(ID_); + +create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_); +create index ACT_IDX_DEC_DEF_REQ_ID on ACT_RE_DECISION_DEF(DEC_REQ_ID_); +create index ACT_IDX_DEC_REQ_DEF_TENANT_ID on ACT_RE_DECISION_REQ_DEF(TENANT_ID_); +create table ACT_HI_PROCINST ( + ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + START_USER_ID_ varchar(255), + START_ACT_ID_ varchar(255), + END_ACT_ID_ varchar(255), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + SUPER_CASE_INSTANCE_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + DELETE_REASON_ varchar(4000), + TENANT_ID_ varchar(64), + STATE_ varchar(255), + primary key (ID_), + unique (PROC_INST_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_ACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + EXECUTION_ID_ varchar(64) not null, + ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + ACT_NAME_ varchar(255), + ACT_TYPE_ varchar(255) not null, + ASSIGNEE_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + ACT_INST_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_TASKINST ( + ID_ varchar(64) not null, + TASK_DEF_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + DELETE_REASON_ varchar(4000), + PRIORITY_ integer, + DUE_DATE_ datetime(3), + FOLLOW_UP_DATE_ datetime(3), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_VARINST ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(100), + REV_ integer, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ varchar(4000), + TEXT2_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_DETAIL ( + ID_ varchar(64) not null, + TYPE_ varchar(255) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + VAR_INST_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(255), + REV_ integer, + TIME_ datetime(3) not null, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ varchar(4000), + TEXT2_ varchar(4000), + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_IDENTITYLINK ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + TYPE_ varchar(255), + USER_ID_ varchar(255), + GROUP_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + OPERATION_TYPE_ varchar(64), + ASSIGNER_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_COMMENT ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TIME_ datetime(3) not null, + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTION_ varchar(255), + MESSAGE_ varchar(4000), + FULL_MSG_ LONGBLOB, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_ATTACHMENT ( + ID_ varchar(64) not null, + REV_ integer, + USER_ID_ varchar(255), + NAME_ varchar(255), + DESCRIPTION_ varchar(4000), + TYPE_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + URL_ varchar(4000), + CONTENT_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_OP_LOG ( + ID_ varchar(64) not null, + DEPLOYMENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + JOB_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + BATCH_ID_ varchar(64), + USER_ID_ varchar(255), + TIMESTAMP_ timestamp(3) not null, + OPERATION_TYPE_ varchar(64), + OPERATION_ID_ varchar(64), + ENTITY_TYPE_ varchar(30), + PROPERTY_ varchar(64), + ORG_VALUE_ varchar(4000), + NEW_VALUE_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_INCIDENT ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CREATE_TIME_ timestamp(3) not null, + END_TIME_ timestamp(3) null, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + ACTIVITY_ID_ varchar(255), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + INCIDENT_STATE_ integer, + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_JOB_LOG ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + JOB_ID_ varchar(64) not null, + JOB_DUEDATE_ timestamp(3) NULL, + JOB_RETRIES_ integer, + JOB_PRIORITY_ bigint NOT NULL DEFAULT 0, + JOB_EXCEPTION_MSG_ varchar(4000), + JOB_EXCEPTION_STACK_ID_ varchar(64), + JOB_STATE_ integer, + JOB_DEF_ID_ varchar(64), + JOB_DEF_TYPE_ varchar(255), + JOB_DEF_CONFIGURATION_ varchar(255), + ACT_ID_ varchar(255), + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_BATCH ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_); +create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_); +create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_); +create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_); + +create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_); +create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_); +create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_); +create index ACT_IDX_HI_ACT_INST_COMP on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_ACT_INST_STATS on ACT_HI_ACTINST(PROC_DEF_ID_, ACT_ID_, END_TIME_, ACT_INST_STATE_); +create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_); +create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); + +create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_); +create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_); + +create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_); +create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_INST on ACT_HI_DETAIL(CASE_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_EXEC on ACT_HI_DETAIL(CASE_EXECUTION_ID_); +create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_); +create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_); +create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_); +create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_); +create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_); + +create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); +create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_); +create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_); + +create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_); +create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_); +create index ACT_IDX_HI_CASEVAR_CASE_INST on ACT_HI_VARINST(CASE_INST_ID_); +create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_); +create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_); + +create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_); +create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_); + +create index ACT_IDX_HI_JOB_LOG_PROCINST on ACT_HI_JOB_LOG(PROCESS_INSTANCE_ID_); +create index ACT_IDX_HI_JOB_LOG_PROCDEF on ACT_HI_JOB_LOG(PROCESS_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_); +create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_); + +create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_); +create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_); +create table ACT_HI_CASEINST ( + ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64) not null, + CREATE_TIME_ datetime(3) not null, + CLOSE_TIME_ datetime(3), + DURATION_ bigint, + STATE_ integer, + CREATE_USER_ID_ varchar(255), + SUPER_CASE_INSTANCE_ID_ varchar(64), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_), + unique (CASE_INST_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_CASEACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + CASE_ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + CASE_ACT_NAME_ varchar(255), + CASE_ACT_TYPE_ varchar(255), + CREATE_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_CAS_I_CLOSE on ACT_HI_CASEINST(CLOSE_TIME_); +create index ACT_IDX_HI_CAS_I_BUSKEY on ACT_HI_CASEINST(BUSINESS_KEY_); +create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_); +create index ACT_IDX_HI_CAS_A_I_CREATE on ACT_HI_CASEACTINST(CREATE_TIME_); +create index ACT_IDX_HI_CAS_A_I_END on ACT_HI_CASEACTINST(END_TIME_); +create index ACT_IDX_HI_CAS_A_I_COMP on ACT_HI_CASEACTINST(CASE_ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_CAS_A_I_CASEINST on ACT_HI_CASEACTINST(CASE_INST_ID_, CASE_ACT_ID_); +create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_); +-- create history decision instance table -- +create table ACT_HI_DECINST ( + ID_ varchar(64) NOT NULL, + DEC_DEF_ID_ varchar(64) NOT NULL, + DEC_DEF_KEY_ varchar(255) NOT NULL, + DEC_DEF_NAME_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + EVAL_TIME_ datetime(3) not null, + COLLECT_VALUE_ double, + USER_ID_ varchar(255), + ROOT_DEC_INST_ID_ varchar(64), + DEC_REQ_ID_ varchar(64), + DEC_REQ_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision input table -- +create table ACT_HI_DEC_IN ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64), + CLAUSE_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ varchar(4000), + TEXT2_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision output table -- +create table ACT_HI_DEC_OUT ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64), + CLAUSE_NAME_ varchar(255), + RULE_ID_ varchar(64), + RULE_ORDER_ integer, + VAR_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ varchar(4000), + TEXT2_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + + +create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_); +create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_); +create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_); +create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_); +create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_); +create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_); +create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_); +create index ACT_IDX_HI_DEC_INST_ROOT_ID on ACT_HI_DECINST(ROOT_DEC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_REQ_ID on ACT_HI_DECINST(DEC_REQ_ID_); +create index ACT_IDX_HI_DEC_INST_REQ_KEY on ACT_HI_DECINST(DEC_REQ_KEY_); + + +create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_); + +create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_); diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_identity_7.6.0.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_identity_7.6.0.sql new file mode 100644 index 0000000000..e4a81e45f4 --- /dev/null +++ b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mariadb_identity_7.6.0.sql @@ -0,0 +1,88 @@ +# Start of statements added for MSO +USE `camundabpmn`; +# End of statements added for MSO + +create table ACT_ID_GROUP ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + TYPE_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_MEMBERSHIP ( + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (USER_ID_, GROUP_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_USER ( + ID_ varchar(64), + REV_ integer, + FIRST_ varchar(255), + LAST_ varchar(255), + EMAIL_ varchar(255), + PWD_ varchar(255), + PICTURE_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_INFO ( + ID_ varchar(64), + REV_ integer, + USER_ID_ varchar(64), + TYPE_ varchar(64), + KEY_ varchar(255), + VALUE_ varchar(255), + PASSWORD_ LONGBLOB, + PARENT_ID_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT_MEMBER ( + ID_ varchar(64) not null, + TENANT_ID_ varchar(64) not null, + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_USER + unique (TENANT_ID_, USER_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_GROUP + unique (TENANT_ID_, GROUP_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB + foreign key (TENANT_ID_) + references ACT_ID_TENANT (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mysql_updates_7.3.0_to_7.6.0.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mysql_updates_7.3.0_to_7.6.0.sql new file mode 100644 index 0000000000..cd607aa059 --- /dev/null +++ b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/camunda/mysql_updates_7.3.0_to_7.6.0.sql @@ -0,0 +1,699 @@ +# MSO updates to the default camunda schema. +USE `camundabpmn`; + +ALTER TABLE ACT_RU_METER_LOG + ADD REPORTER_ varchar(255); + +-- job prioritization -- + +ALTER TABLE ACT_RU_JOB + ADD PRIORITY_ bigint NOT NULL + DEFAULT 0; + +ALTER TABLE ACT_RU_JOBDEF + ADD JOB_PRIORITY_ bigint; + +ALTER TABLE ACT_HI_JOB_LOG + ADD JOB_PRIORITY_ bigint NOT NULL + DEFAULT 0; + +-- create decision definition table -- +create table ACT_RE_DECISION_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create unique constraint on ACT_RE_DECISION_DEF -- +alter table ACT_RE_DECISION_DEF + add constraint ACT_UNIQ_DECISION_DEF + unique (KEY_,VERSION_); + +-- case sentry part source -- + +ALTER TABLE ACT_RU_CASE_SENTRY_PART + ADD SOURCE_ varchar(255); + +-- create history decision instance table -- +create table ACT_HI_DECINST ( + ID_ varchar(64) NOT NULL, + DEC_DEF_ID_ varchar(64) NOT NULL, + DEC_DEF_KEY_ varchar(255) NOT NULL, + DEC_DEF_NAME_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + EVAL_TIME_ datetime not null, + COLLECT_VALUE_ double, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision input table -- +create table ACT_HI_DEC_IN ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64) NOT NULL, + CLAUSE_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision output table -- +create table ACT_HI_DEC_OUT ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64) NOT NULL, + CLAUSE_NAME_ varchar(255), + RULE_ID_ varchar(64) NOT NULL, + RULE_ORDER_ integer, + VAR_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB NULL, + TEXT2_ LONGBLOB NULL, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create indexes for historic decision tables +create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_); +create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_); +create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_); +create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_); +create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_); +create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_); + +create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_); + +create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_); + +-- add grant authorization for group camunda-admin: +INSERT INTO + ACT_RU_AUTHORIZATION (ID_, TYPE_, GROUP_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_, REV_) +VALUES + ('camunda-admin-grant-decision-definition', 1, 'camunda-admin', 10, '*', 2147483647, 1); + +-- external tasks -- + +create table ACT_RU_EXT_TASK ( + ID_ varchar(64) not null, + REV_ integer not null, + WORKER_ID_ varchar(255), + TOPIC_NAME_ varchar(255), + RETRIES_ integer, + ERROR_MSG_ varchar(4000), + LOCK_EXP_TIME_ timestamp NULL, + SUSPENSION_STATE_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_); + +-- deployment -- + +ALTER TABLE ACT_RE_DEPLOYMENT + ADD SOURCE_ varchar(255); + +ALTER TABLE ACT_HI_OP_LOG + ADD DEPLOYMENT_ID_ varchar(64); + +-- job suspension state + +ALTER TABLE ACT_RU_JOB + MODIFY COLUMN SUSPENSION_STATE_ integer + DEFAULT 1; + + -- relevant for jobs created in Camunda 7.0 +UPDATE ACT_RU_JOB + SET SUSPENSION_STATE_ = 1 + WHERE SUSPENSION_STATE_ IS NULL; + +ALTER TABLE ACT_RU_JOB + MODIFY COLUMN SUSPENSION_STATE_ integer + NOT NULL DEFAULT 1; + + +-- mariadb_engine_7.4_patch_7.4.5_to_7.4.6 +-- INCREASE process def key column size https://app.camunda.com/jira/browse/CAM-4328 -- +alter table ACT_RU_JOB + MODIFY COLUMN PROCESS_DEF_KEY_ varchar(255); + +-- mariadb_engine_7.4_to_7.5 +-- set datetime precision -- + +ALTER TABLE ACT_HI_CASEINST + MODIFY COLUMN CREATE_TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_CASEINST + MODIFY COLUMN CLOSE_TIME_ datetime(3); + +ALTER TABLE ACT_HI_CASEACTINST + MODIFY COLUMN CREATE_TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_CASEACTINST + MODIFY COLUMN END_TIME_ datetime(3); + +ALTER TABLE ACT_HI_DECINST + MODIFY COLUMN EVAL_TIME_ datetime(3) not null; + +ALTER TABLE ACT_RU_TASK + MODIFY COLUMN DUE_DATE_ datetime(3); + +ALTER TABLE ACT_RU_TASK + MODIFY COLUMN FOLLOW_UP_DATE_ datetime(3); + +ALTER TABLE ACT_HI_PROCINST + MODIFY COLUMN START_TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_PROCINST + MODIFY COLUMN END_TIME_ datetime(3); + +ALTER TABLE ACT_HI_ACTINST + MODIFY COLUMN START_TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_ACTINST + MODIFY COLUMN END_TIME_ datetime(3); + +ALTER TABLE ACT_HI_TASKINST + MODIFY COLUMN START_TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_TASKINST + MODIFY COLUMN END_TIME_ datetime(3); + +ALTER TABLE ACT_HI_TASKINST + MODIFY COLUMN DUE_DATE_ datetime(3); + +ALTER TABLE ACT_HI_TASKINST + MODIFY COLUMN FOLLOW_UP_DATE_ datetime(3); + +ALTER TABLE ACT_HI_DETAIL + MODIFY COLUMN TIME_ datetime(3) not null; + +ALTER TABLE ACT_HI_COMMENT + MODIFY COLUMN TIME_ datetime(3) not null; + +-- set timestamp precision -- + +ALTER TABLE ACT_RE_DEPLOYMENT + MODIFY COLUMN DEPLOY_TIME_ timestamp(3); + +ALTER TABLE ACT_RU_JOB + MODIFY COLUMN LOCK_EXP_TIME_ timestamp(3) NULL; + +ALTER TABLE ACT_RU_JOB + MODIFY COLUMN DUEDATE_ timestamp(3) NULL; + +ALTER TABLE ACT_RU_TASK + MODIFY COLUMN CREATE_TIME_ timestamp(3); + +ALTER TABLE ACT_RU_EVENT_SUBSCR + MODIFY COLUMN CREATED_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_RU_INCIDENT + MODIFY COLUMN INCIDENT_TIMESTAMP_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_RU_METER_LOG + MODIFY COLUMN TIMESTAMP_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_RU_EXT_TASK + MODIFY COLUMN LOCK_EXP_TIME_ timestamp(3) NULL; + +ALTER TABLE ACT_HI_OP_LOG + MODIFY COLUMN TIMESTAMP_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_HI_INCIDENT + MODIFY COLUMN CREATE_TIME_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_HI_INCIDENT + MODIFY COLUMN END_TIME_ timestamp(3) NULL; + +ALTER TABLE ACT_HI_JOB_LOG + MODIFY COLUMN TIMESTAMP_ timestamp(3) NOT NULL; + +ALTER TABLE ACT_HI_JOB_LOG + MODIFY COLUMN JOB_DUEDATE_ timestamp(3) NULL; + +-- semantic version -- + +ALTER TABLE ACT_RE_PROCDEF + ADD VERSION_TAG_ varchar(64); + +create index ACT_IDX_PROCDEF_VER_TAG on ACT_RE_PROCDEF(VERSION_TAG_); + +-- tenant id -- + +ALTER TABLE ACT_RE_DEPLOYMENT + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_); + +ALTER TABLE ACT_RE_PROCDEF + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_RE_PROCDEF + DROP INDEX ACT_UNIQ_PROCDEF; + +create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_); + +ALTER TABLE ACT_RU_EXECUTION + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_); + +ALTER TABLE ACT_RU_TASK + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_); + +ALTER TABLE ACT_RU_VARIABLE + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_); + +ALTER TABLE ACT_RU_EVENT_SUBSCR + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_); + +ALTER TABLE ACT_RU_JOB + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_); + +ALTER TABLE ACT_RU_JOBDEF + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_); + +ALTER TABLE ACT_RU_INCIDENT + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_RU_IDENTITYLINK + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_); + +ALTER TABLE ACT_RU_EXT_TASK + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_); + +ALTER TABLE ACT_RE_DECISION_DEF + DROP INDEX ACT_UNIQ_DECISION_DEF; + +ALTER TABLE ACT_RE_DECISION_DEF + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_); + +ALTER TABLE ACT_RE_CASE_DEF + DROP INDEX ACT_UNIQ_CASE_DEF; + +ALTER TABLE ACT_RE_CASE_DEF + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_); + +ALTER TABLE ACT_GE_BYTEARRAY + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_RU_CASE_EXECUTION + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_); + +ALTER TABLE ACT_RU_CASE_SENTRY_PART + ADD TENANT_ID_ varchar(64); + +-- user on historic decision instance -- + +ALTER TABLE ACT_HI_DECINST + ADD USER_ID_ varchar(255); + +-- tenant id on history -- + +ALTER TABLE ACT_HI_PROCINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_); + +ALTER TABLE ACT_HI_ACTINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_); + +ALTER TABLE ACT_HI_TASKINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_); + +ALTER TABLE ACT_HI_VARINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_); + +ALTER TABLE ACT_HI_DETAIL + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_); + +ALTER TABLE ACT_HI_INCIDENT + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_); + +ALTER TABLE ACT_HI_JOB_LOG + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_); + +ALTER TABLE ACT_HI_COMMENT + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_HI_ATTACHMENT + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_HI_OP_LOG + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_HI_DEC_IN + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_HI_DEC_OUT + ADD TENANT_ID_ varchar(64); + +ALTER TABLE ACT_HI_DECINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_); + +ALTER TABLE ACT_HI_CASEINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_); + +ALTER TABLE ACT_HI_CASEACTINST + ADD TENANT_ID_ varchar(64); + +create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_); + +-- AUTHORIZATION -- + +-- add grant authorizations for group camunda-admin: +INSERT INTO + ACT_RU_AUTHORIZATION (ID_, TYPE_, GROUP_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_, REV_) +VALUES + ('camunda-admin-grant-tenant', 1, 'camunda-admin', 11, '*', 2147483647, 1), + ('camunda-admin-grant-tenant-membership', 1, 'camunda-admin', 12, '*', 2147483647, 1), + ('camunda-admin-grant-batch', 1, 'camunda-admin', 13, '*', 2147483647, 1); + +-- tenant table + +create table ACT_ID_TENANT ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT_MEMBER ( + ID_ varchar(64) not null, + TENANT_ID_ varchar(64) not null, + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_USER + unique (TENANT_ID_, USER_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_GROUP + unique (TENANT_ID_, GROUP_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB + foreign key (TENANT_ID_) + references ACT_ID_TENANT (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + +-- BATCH -- + +-- remove not null from job definition table -- +alter table ACT_RU_JOBDEF + modify PROC_DEF_ID_ varchar(64), + modify PROC_DEF_KEY_ varchar(255), + modify ACT_ID_ varchar(255); + +create table ACT_RU_BATCH ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_CREATED_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + SUSPENSION_STATE_ integer, + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_BATCH ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_IDENTITYLINK ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + TYPE_ varchar(255), + USER_ID_ varchar(255), + GROUP_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + OPERATION_TYPE_ varchar(64), + ASSIGNER_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); +create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_); + +create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_); + +create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_SEED_JOB_DEF + foreign key (SEED_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_MONITOR_JOB_DEF + foreign key (MONITOR_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_JOB_DEF + foreign key (BATCH_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +-- TASK PRIORITY -- + +ALTER TABLE ACT_RU_EXT_TASK + ADD PRIORITY_ bigint NOT NULL DEFAULT 0; + +create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_); + +-- HI OP PROC INDECIES -- + +create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_); +create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_); + +-- JOB_DEF_ID_ on INCIDENTS -- +ALTER TABLE ACT_RU_INCIDENT + ADD JOB_DEF_ID_ varchar(64); + +create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_); +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_JOB_DEF + foreign key (JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +ALTER TABLE ACT_HI_INCIDENT + ADD JOB_DEF_ID_ varchar(64); + +-- BATCH_ID_ on ACT_HI_OP_LOG -- +ALTER TABLE ACT_HI_OP_LOG + ADD BATCH_ID_ varchar(64); + + -- add indexes on PROC_DEF_KEY_ columns in history tables CAM-6679 +create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_); +create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_); +create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_); +create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_); +create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_); + +-- 7.5.8 to 7.6.2 upgrade +-- AUTHORIZATION -- + +-- add grant authorizations for group camunda-admin: +INSERT INTO + ACT_RU_AUTHORIZATION (ID_, TYPE_, GROUP_ID_, RESOURCE_TYPE_, RESOURCE_ID_, PERMS_, REV_) +VALUES + ('camunda-admin-grant-drd', 1, 'camunda-admin', 14, '*', 2147483647, 1); + +-- decision requirements definition -- + +ALTER TABLE ACT_RE_DECISION_DEF + ADD DEC_REQ_ID_ varchar(64); + +ALTER TABLE ACT_RE_DECISION_DEF + ADD DEC_REQ_KEY_ varchar(255); + +ALTER TABLE ACT_RU_CASE_SENTRY_PART + ADD VARIABLE_EVENT_ varchar(255); + +ALTER TABLE ACT_RU_CASE_SENTRY_PART + ADD VARIABLE_NAME_ varchar(255); + +create table ACT_RE_DECISION_REQ_DEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) NOT NULL, + VERSION_ integer NOT NULL, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;; + +alter table ACT_RE_DECISION_DEF + add constraint ACT_FK_DEC_REQ + foreign key (DEC_REQ_ID_) + references ACT_RE_DECISION_REQ_DEF(ID_); + +create index ACT_IDX_DEC_DEF_REQ_ID on ACT_RE_DECISION_DEF(DEC_REQ_ID_); +create index ACT_IDX_DEC_REQ_DEF_TENANT_ID on ACT_RE_DECISION_REQ_DEF(TENANT_ID_); + +ALTER TABLE ACT_HI_DECINST + ADD ROOT_DEC_INST_ID_ varchar(64); + +ALTER TABLE ACT_HI_DECINST + ADD DEC_REQ_ID_ varchar(64); + +ALTER TABLE ACT_HI_DECINST + ADD DEC_REQ_KEY_ varchar(255); + +create index ACT_IDX_HI_DEC_INST_ROOT_ID on ACT_HI_DECINST(ROOT_DEC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_REQ_ID on ACT_HI_DECINST(DEC_REQ_ID_); +create index ACT_IDX_HI_DEC_INST_REQ_KEY on ACT_HI_DECINST(DEC_REQ_KEY_); + +-- remove not null from ACT_HI_DEC tables -- +alter table ACT_HI_DEC_OUT + modify CLAUSE_ID_ varchar(64), + modify RULE_ID_ varchar(64); + +alter table ACT_HI_DEC_IN + modify CLAUSE_ID_ varchar(64); + +-- CAM-5914 +create index ACT_IDX_JOB_EXECUTION_ID on ACT_RU_JOB(EXECUTION_ID_); + +ALTER TABLE ACT_RU_EXT_TASK + ADD ERROR_DETAILS_ID_ varchar(64); + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_ERROR_DETAILS + foreign key (ERROR_DETAILS_ID_) + references ACT_GE_BYTEARRAY (ID_); + +ALTER TABLE ACT_HI_PROCINST + ADD STATE_ varchar(255); + +update ACT_HI_PROCINST set STATE_ = 'ACTIVE' where END_TIME_ is null; +update ACT_HI_PROCINST set STATE_ = 'COMPLETED' where END_TIME_ is not null; + +-- CAM-6725 +ALTER TABLE ACT_RU_METER_LOG + ADD MILLISECONDS_ bigint DEFAULT 0; + +alter table ACT_RU_METER_LOG + modify TIMESTAMP_ TIMESTAMP(3); + +CREATE INDEX ACT_IDX_METER_LOG_MS ON ACT_RU_METER_LOG(MILLISECONDS_); +CREATE INDEX ACT_IDX_METER_LOG_REPORT ON ACT_RU_METER_LOG(NAME_, REPORTER_, MILLISECONDS_); +CREATE INDEX ACT_IDX_METER_LOG_NAME_MS ON ACT_RU_METER_LOG(NAME_, MILLISECONDS_); + +-- old metric timestamp column +CREATE INDEX ACT_IDX_METER_LOG_TIME ON ACT_RU_METER_LOG(TIMESTAMP_); + +-- CAM-6938 +create index ACT_IDX_JOB_HANDLER on ACT_RU_JOB(HANDLER_TYPE_(100),HANDLER_CFG_(155)); \ No newline at end of file diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/sub-sql-files/catalog_add_constraints.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/sub-sql-files/catalog_add_constraints.sql new file mode 100644 index 0000000000..a5e9834de2 --- /dev/null +++ b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/sub-sql-files/catalog_add_constraints.sql @@ -0,0 +1,45 @@ +USE `mso_catalog`; + +ALTER TABLE `mso_catalog`.`service_to_allotted_resources` + ADD INDEX `fk_service_to_allotted_resources__service_model_uuid_idx` (`SERVICE_MODEL_UUID` ASC), + ADD INDEX `fk_service_to_allotted_resources__allotted_resource_customiz_idx` (`AR_MODEL_CUSTOMIZATION_UUID` ASC), + ADD CONSTRAINT `fk_service_to_allotted_resources__service__service_name_ver_id` + FOREIGN KEY (`SERVICE_MODEL_UUID`) + REFERENCES `mso_catalog`.`service` (`SERVICE_NAME_VERSION_ID`) + ON DELETE CASCADE + ON UPDATE CASCADE, + ADD CONSTRAINT `fk_service_to_allotted_resources__allotted_resource_customizat1` + FOREIGN KEY (`AR_MODEL_CUSTOMIZATION_UUID`) + REFERENCES `mso_catalog`.`allotted_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) + ON DELETE CASCADE + ON UPDATE CASCADE; + + +ALTER TABLE `mso_catalog`.`service_to_networks` + ADD INDEX `fk_service_to_networks__service_model_uuid_idx` (`SERVICE_MODEL_UUID` ASC), + ADD INDEX `fk_service_to_networks__network_resource_customization1_idx` (`NETWORK_MODEL_CUSTOMIZATION_UUID` ASC), + ADD CONSTRAINT `fk_service_to_networks__service__service_name_version_id` + FOREIGN KEY (`SERVICE_MODEL_UUID`) + REFERENCES `mso_catalog`.`service` (`SERVICE_NAME_VERSION_ID`) + ON DELETE CASCADE + ON UPDATE CASCADE, + ADD CONSTRAINT `fk_service_to_networks__network_resource_customization1` + FOREIGN KEY (`NETWORK_MODEL_CUSTOMIZATION_UUID`) + REFERENCES `mso_catalog`.`network_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) + ON DELETE CASCADE + ON UPDATE CASCADE; + + +ALTER TABLE `mso_catalog`.`vf_module` + ADD INDEX `UK_model_customization_uuid__asdc_service_model_version` (`MODEL_CUSTOMIZATION_UUID` ASC, `ASDC_SERVICE_MODEL_VERSION` ASC); + +ALTER TABLE `mso_catalog`.`vnf_resource` + ADD UNIQUE INDEX `UK_model_customization_uuid__asdc_service_model_version` (`MODEL_CUSTOMIZATION_UUID` ASC, `ASDC_SERVICE_MODEL_VERSION` ASC); + +ALTER TABLE `mso_catalog`.`network_resource_customization` + ADD INDEX `fk_network_resource_customization__network_resource_id_idx` (`NETWORK_RESOURCE_ID` ASC), + ADD CONSTRAINT `fk_network_resource_customization__network_resource__id` + FOREIGN KEY (`NETWORK_RESOURCE_ID`) + REFERENCES `mso_catalog`.`network_resource` (`id`) + ON DELETE CASCADE + ON UPDATE CASCADE; \ No newline at end of file diff --git a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/sub-sql-files/catalog_timestamp_mso_db.sql b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/sub-sql-files/catalog_timestamp_mso_db.sql index 12d5d8c112..bc88adcc70 100644 --- a/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/sub-sql-files/catalog_timestamp_mso_db.sql +++ b/packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/sub-sql-files/catalog_timestamp_mso_db.sql @@ -12,3 +12,8 @@ ALTER TABLE HEAT_FILES MODIFY COLUMN CREATION_TIMESTAMP DATETIME DEFAULT CURRENT ALTER TABLE HEAT_TEMPLATE MODIFY COLUMN CREATION_TIMESTAMP DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL; ALTER TABLE VF_MODULE MODIFY COLUMN CREATION_TIMESTAMP datetime DEFAULT CURRENT_TIMESTAMP NOT NULL; ALTER TABLE SERVICE_RECIPE MODIFY COLUMN CREATION_TIMESTAMP datetime DEFAULT CURRENT_TIMESTAMP NOT NULL; +ALTER TABLE NETWORK_RESOURCE_CUSTOMIZATION MODIFY COLUMN CREATION_TIMESTAMP datetime DEFAULT CURRENT_TIMESTAMP NOT NULL; +ALTER TABLE ALLOTTED_RESOURCE_CUSTOMIZATION MODIFY COLUMN CREATION_TIMESTAMP datetime DEFAULT CURRENT_TIMESTAMP NOT NULL; +ALTER TABLE SERVICE_TO_ALLOTTED_RESOURCES MODIFY COLUMN CREATION_TIMESTAMP datetime DEFAULT CURRENT_TIMESTAMP NOT NULL; +ALTER TABLE SERVICE_TO_NETWORKS MODIFY COLUMN CREATION_TIMESTAMP datetime DEFAULT CURRENT_TIMESTAMP NOT NULL; + diff --git a/pom.xml b/pom.xml index 0f0ca27011..4d405462ee 100644 --- a/pom.xml +++ b/pom.xml @@ -38,11 +38,12 @@ 2.19.3-1 + 1.1.0 1.0.4-alpha2 https://nexus.onap.org /content/repositories/snapshots/ /content/repositories/releases/ - /content/sites/site/org/openecomp/mso/${project.version} + /content/sites/site/org/openecomp/mso/${project.version} yyyyMMdd'T'HHmm @@ -198,7 +199,7 @@ org.apache.maven.plugins maven-compiler-plugin - 2.3.2 + 3.6.1 true -Xlint @@ -330,7 +331,7 @@ 4.20 mso-${project.version} - 1.7 + 1.8 @@ -397,13 +398,7 @@ junit junit - 4.11 - test - - - org.evosuite - evosuite-standalone-runtime - ${evosuiteVersion} + 4.12 test diff --git a/project-configs/maven/conf/settings.xml b/project-configs/maven/conf/settings.xml index bab1f18088..67e5fa75bb 100644 --- a/project-configs/maven/conf/settings.xml +++ b/project-configs/maven/conf/settings.xml @@ -154,13 +154,6 @@ under the License. | for inheritance and direct lookup purposes, and must be unique across the set of mirrors. | --> - - - - - - - diff --git a/readme.md b/readme.md index a7791ba870..3f9b4518cc 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,7 @@ # ONAP MSO ---- ---- +---- +---- # Introduction @@ -196,7 +196,7 @@ Header: content-type: application/json +Authorization login/password BPELClient/password1$F - {"createVfModuleRequest":{"messageId":"ec9537bb-c837-477f-86a5-21c717be96f1-1479156376597","skipAAI":true,"notificationUrl":"http://msobpel-app-st.ecomp.cci.att.com:8080/mso/vnfAdapterRestNotify","cloudSiteId":"RACKSPACE","tenantId":"1015548","vnfId":"5259ba4a-cf0d-4791-9c60-9117faa5cdea","vnfType":"vfw-service/VFWResource-1","vnfVersion":"1.0","vfModuleId":"7d8412bb-b288-44ff-92ef-723018f940fc","vfModuleName":"MSO_VFW_TEST","vfModuleType":"VF_RI1_VFW::module-1","volumeGroupId":"","volumeGroupStackId":"","baseVfModuleId":"","baseVfModuleStackId":"","requestType":"","failIfExists":true,"backout":true,"vfModuleParams":{"vf_module_name":"MSO_VFW_TEST","vnf_name":"vfw-service/VFWResource-1","vnf_id":"5259ba4a-cf0d-4791-9c60-9117faa5cdea","vf_module_id":"7d8412bb-b288-44ff-92ef-723018f940fc"},"msoRequest":{"requestId":"ec9537bb-c837-477f-86a5-21c717be96f1","serviceInstanceId":"369cdf85-1b61-41ff-b637-c6b7dd020326"},"synchronous":false}} + {"createVfModuleRequest":{"messageId":"ec9537bb-c837-477f-86a5-21c717be96f1-1479156376597","skipAAI":true,"notificationUrl":"http://bpmnhost:8080/mso/vnfAdapterRestNotify","cloudSiteId":"RACKSPACE","tenantId":"1015548","vnfId":"5259ba4a-cf0d-4791-9c60-9117faa5cdea","vnfType":"vfw-service/VFWResource-1","vnfVersion":"1.0","vfModuleId":"7d8412bb-b288-44ff-92ef-723018f940fc","vfModuleName":"MSO_VFW_TEST","vfModuleType":"VF_RI1_VFW::module-1","volumeGroupId":"","volumeGroupStackId":"","baseVfModuleId":"","baseVfModuleStackId":"","requestType":"","failIfExists":true,"backout":true,"vfModuleParams":{"vf_module_name":"MSO_VFW_TEST","vnf_name":"vfw-service/VFWResource-1","vnf_id":"5259ba4a-cf0d-4791-9c60-9117faa5cdea","vf_module_id":"7d8412bb-b288-44ff-92ef-723018f940fc"},"msoRequest":{"requestId":"ec9537bb-c837-477f-86a5-21c717be96f1","serviceInstanceId":"369cdf85-1b61-41ff-b637-c6b7dd020326"},"synchronous":false}} ``` # Getting Help diff --git a/status-control/pom.xml b/status-control/pom.xml index 458a399f3a..3ed1d5178a 100644 --- a/status-control/pom.xml +++ b/status-control/pom.xml @@ -15,6 +15,12 @@ Contains classes to update and query the MSO status per site + + org.evosuite + evosuite-standalone-runtime + ${evosuiteVersion} + test + org.openecomp.mso common @@ -63,15 +69,5 @@ test - - org.apache.httpcomponents - httpcore - - - - org.apache.httpcomponents - httpclient - - \ No newline at end of file diff --git a/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java b/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java index 03e807ae5a..e0e712cd48 100644 --- a/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java +++ b/status-control/src/main/java/org/openecomp/mso/HealthCheckUtils.java @@ -7,9 +7,9 @@ * 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. @@ -59,11 +59,13 @@ public class HealthCheckUtils { .entity (NOT_FOUND) .build (); - public enum NodeType {APIH, RA}; + public enum NodeType {APIH, RA, BPMN}; public boolean catalogDBCheck (MsoLogger subMsoLogger, long startTime) { - try (CatalogDatabase catalogDB = new CatalogDatabase ()) { + try { + CatalogDatabase catalogDB = new CatalogDatabase (); catalogDB.healthCheck (); + catalogDB.close(); } catch (Exception e) { subMsoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Failed to check catalog database", e); subMsoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, "Exception during healthcheck"); @@ -129,12 +131,14 @@ public class HealthCheckUtils { if (null != requestId) { finalUrl = finalUrl + "?requestId=" + requestId; } - try (CloseableHttpClient client = getHttpClient()) { + try { HttpResponse response; + CloseableHttpClient client = getHttpClient (); HttpGet get = new HttpGet(finalUrl); msoLogger.debug("Get url is: " + finalUrl); response = client.execute(get); msoLogger.debug("Get response is: " + response); + client.close (); //shut down the connection if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { msoLogger.debug("verifyLocalHealth - Successfully communicate with APIH/BPMN/RA"); return true; @@ -206,6 +210,13 @@ public class HealthCheckUtils { return false; } apis = apiList.split(","); + } else if (NodeType.BPMN.equals (type)){ + String apiList = topologyProp.getProperty("camunda-healthcheck-urn", null); + if (null == apiList) { + msoLogger.error (MessageEnum.GENERAL_EXCEPTION_ARG, "Not able to get jra-healthcheck-urn parameter", "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Not able to get jra-healthcheck-urn parameter"); + return false; + } + apis = apiList.split(","); } else { msoLogger.error (MessageEnum.GENERAL_EXCEPTION_ARG, "Unknown NodeType:" + type, "", "HealthCheck", MsoLogger.ErrorCode.DataError, "Unknown NodeType:" + type); return false; @@ -236,7 +247,7 @@ public class HealthCheckUtils { String apihLB = topologyProp.getProperty("apih-load-balancer", null); String apihApi = topologyProp.getProperty("apih-nodehealthcheck-urn", null); String bpmnLB= topologyProp.getProperty("camunda-load-balancer", null); - String bpmnApi = topologyProp.getProperty("camunda-healthcheck-urn", null); + String bpmnApi = topologyProp.getProperty("camunda-nodehealthcheck-urn", null); String jraLB = topologyProp.getProperty("jra-load-balancer", null); String jraApi = topologyProp.getProperty("jra-nodehealthcheck-urn", null); @@ -285,4 +296,4 @@ public class HealthCheckUtils { return "http://" + ip + ":" + port + url; } } -} +} \ No newline at end of file diff --git a/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java b/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java index 712cdb2ce6..6077e202b2 100644 --- a/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java +++ b/status-control/src/test/java/org/openecomp/mso/HealthCheckUtilsTest.java @@ -229,14 +229,12 @@ public class HealthCheckUtilsTest { assertTrue (utils.verifyGlobalHealthCheck (true, null)); - // mising server-port parameter + // mising server-camunda parameter MsoJavaProperties newProperties1 = new MsoJavaProperties(); Mockito.when(utils.loadTopologyProperties()).thenReturn(newProperties1); newProperties1.setProperty("apih-load-balancer", ip1); newProperties1.setProperty("apih-nodehealthcheck-urn",apihUrl1); - newProperties1.setProperty("camunda-load-balancer",ip1); - newProperties1.setProperty("camunda-nodehealthcheck-urn",bpmnUrl1); newProperties1.setProperty("jra-load-balancer",ip1); newProperties1.setProperty("jra-nodehealthcheck-urn",raUrl1); @@ -247,11 +245,11 @@ public class HealthCheckUtilsTest { Mockito.when(utils.loadTopologyProperties()).thenReturn(newProperties2); newProperties2.setProperty("server-port", port); - newProperties1.setProperty("apih-nodehealthcheck-urn",apihUrl1); - newProperties1.setProperty("camunda-load-balancer",ip1); - newProperties1.setProperty("camunda-nodehealthcheck-urn",bpmnUrl1); - newProperties1.setProperty("jra-load-balancer",ip1); - newProperties1.setProperty("jra-nodehealthcheck-urn",raUrl1); + newProperties2.setProperty("apih-nodehealthcheck-urn",apihUrl1); + newProperties2.setProperty("camunda-load-balancer",ip1); + newProperties2.setProperty("camunda-nodehealthcheck-urn",bpmnUrl1); + newProperties2.setProperty("jra-load-balancer",ip1); + newProperties2.setProperty("jra-nodehealthcheck-urn",raUrl1); assertFalse (utils.verifyGlobalHealthCheck (true, null)); @@ -260,11 +258,11 @@ public class HealthCheckUtilsTest { Mockito.when(utils.loadTopologyProperties()).thenReturn(newProperties3); newProperties3.setProperty("server-port", port); - newProperties1.setProperty("apih-load-balancer", ip1); - newProperties1.setProperty("apih-nodehealthcheck-urn",apihUrl1); - newProperties1.setProperty("camunda-load-balancer",ip1); - newProperties1.setProperty("camunda-nodehealthcheck-urn",bpmnUrl1); - newProperties1.setProperty("jra-load-balancer",ip1); + newProperties3.setProperty("apih-load-balancer", ip1); + newProperties3.setProperty("apih-nodehealthcheck-urn",apihUrl1); + newProperties3.setProperty("camunda-load-balancer",ip1); + newProperties3.setProperty("camunda-nodehealthcheck-urn",bpmnUrl1); + newProperties3.setProperty("jra-load-balancer",ip1); newProperties3.setProperty("jra-server-list",ip1); assertFalse (utils.verifyGlobalHealthCheck (true, null)); @@ -297,4 +295,4 @@ public class HealthCheckUtilsTest { } return null; } -} +} \ No newline at end of file -- 2.16.6