aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--adapters/mso-adapter-utils/pom.xml2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java37
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java10
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java63
-rw-r--r--adapters/mso-adapter-utils/src/test/resources/application-test.yaml1
-rw-r--r--adapters/mso-adapters-rest-interface/pom.xml2
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/StackInfo.java17
-rw-r--r--adapters/mso-catalog-db-adapter/pom.xml2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceArtifact.java118
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java85
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java8
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceProxyCustomization.java124
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5__AddServiceArtifact.sql30
-rw-r--r--adapters/mso-nssmf-adapter/pom.xml150
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/MSONssmfApplication.java32
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/RequestDbConfig.java68
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/WebSecurityConfig.java37
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/exceptions/ApplicationException.java66
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientPropertiesImpl.java69
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientProvider.java34
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProvider.java32
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java66
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/ErrorResponse.java63
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenRequest.java54
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenResponse.java44
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/HttpMethod.java41
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/JobStatus.java42
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfAdapterRest.java205
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfInfo.java94
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfManager.java541
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/RestResponse.java92
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/RestUtil.java307
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/TrustAllHostNameVerifier.java32
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/NssmfAdapterUtil.java94
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties1
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/application.yaml61
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/nssmf.jksbin0 -> 1386 bytes
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/nssmf.p12bin0 -> 1616 bytes
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.jksbin0 -> 1386 bytes
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.p12bin0 -> 1616 bytes
-rw-r--r--adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java392
-rw-r--r--adapters/mso-openstack-adapters/pom.xml2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java11
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java29
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java16
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java22
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java23
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java7
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java14
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java19
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java11
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java11
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/application-test.yaml4
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml2
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java33
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java15
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java41
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/OrchestrationTaskRepositoryCustomController.java62
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java2
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.1.1__Add_Instance_NFVO_Mapping_Table.sql12
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.2.1__Add_PNF_Column_Infra_Requests_archive_tables.sql4
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.2__Add_PNF_Column_Infra_Requests_archive_tables.sql2
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.3.1__AddResourceStatusMessageColumn.sql4
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.3__Add_Columns_Tenant_Name_Product_Family_Name.sql7
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.1__Add_Orchestration_Task_Table.sql12
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java28
-rw-r--r--adapters/mso-sdnc-adapter/pom.xml2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java1
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java4
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java84
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java2
-rw-r--r--adapters/mso-ve-vnfm-adapter/pom.xml10
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java53
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/EsrId.java45
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java9
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java2
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java44
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java110
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java4
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java5
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java41
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java41
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscribeSender.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSender.java)38
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java43
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java98
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml17
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java6
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java39
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java57
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java (renamed from adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSenderTest.java)21
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java69
-rw-r--r--adapters/mso-vfc-adapter/pom.xml2
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/constant/CommonConstant.java18
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AddPnfData.java68
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AddressRange.java33
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedNs.java40
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedPnf.java67
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedSap.java49
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedVirtualLink.java49
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnf.java78
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnffg.java40
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRule.java51
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ChangedInfo.java33
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CivicAddressElement.java33
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolData.java33
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolInfo.java31
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CreateNsRequest.java53
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtCpInfo.java27
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfo.java33
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtManagedVirtualLinkInfo.java57
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfo.java42
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/InstantiateNsRequest.java207
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/InstantiatedVnfInfo.java117
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/IpAddresses.java63
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressData.java35
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/Link.java24
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/Links.java78
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraints.java33
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/Mask.java47
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoData.java80
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NfpInfo.java89
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NfpRule.java108
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsCpHandle.java69
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsInstance.java166
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsInstanceLinks.java82
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsLcmOpOcc.java125
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsLinkPortInfo.java47
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsScaleInfo.java37
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsVirtualLinkInfo.java57
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ParamsForVnf.java35
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpData.java44
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpInfo.java48
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PnfInfo.java74
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PortRange.java37
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ProblemDetails.java62
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ResourceChanges.java71
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ResourceHandle.java51
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/SapData.java56
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/SapInfo.java68
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfInstance.java156
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfInstanceData.java33
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfLinkPortInfo.java46
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfLocationConstraint.java33
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfScaleInfo.java38
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfVirtualLinkResourceInfo.java76
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfcCpInfo.java65
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfcResourceInfo.java85
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnffgInfo.java87
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java47
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005.java620
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java2
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java192
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AddPnfDataTest.java189
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AddressRangeTest.java39
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedNsTest.java40
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedPnfTest.java69
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedSapTest.java49
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVirtualLinkTest.java49
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnfTest.java69
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnffgTest.java39
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRuleTest.java283
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ChangedInfoTest.java39
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CivicAddressElementTest.java39
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CpProtocolDataTest.java39
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CreateNsRequestTest.java49
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfoTest.java40
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfoTest.java49
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/InstantiateNsRequestTest.java413
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/IpAddressesTest.java188
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressDataTest.java158
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LinkTest.java29
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LinksTest.java89
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintsTest.java40
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoDataTest.java90
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsLcmOpOccTest.java142
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ParamsForVnfTest.java41
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/PnfExtCpDataTest.java168
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ProblemDetailsTest.java69
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResourceChangesTest.java773
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResourceHandleTest.java59
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/SapDataTest.java179
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VnfInstanceDataTest.java39
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VnfLocationConstraintTest.java39
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005Test.java221
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java8
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/aainfvoResponse.json10
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json64
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/createNsSol005Response.json210
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/json/lcmOperRsp.json7
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml20
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/ETSI-Catalog-Notification-API.json119
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml25
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json8
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFPackageManagement-API.json85
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java4
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/AbstractPkgNotificationConverter.java56
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/PkgChangeNotificationConverter.java79
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/PkgOnboardingNotificationConverter.java69
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java60
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java11
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java29
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java64
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java68
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationManager.java137
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationServiceProvider.java51
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationServiceProviderFactory.java67
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java102
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthTokenResponse.java56
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java80
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/TlsNotificationServiceProvider.java56
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java82
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java6
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java18
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/AuthenticationTypeNotSupportedException.java44
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/ConversionFailedException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/SubscriptionRequestConversionException.java)9
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/EtsiSubscriptionNotificationControllerExceptionHandler.java112
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/NotificationTypeNotSupportedException.java44
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/Sol003PackageManagementControllerExceptionHandler.java12
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java595
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java195
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/requests/SubscriptionRequest.json45
-rw-r--r--adapters/mso-vnfm-adapter/pom.xml2
-rw-r--r--adapters/pom.xml3
-rw-r--r--adapters/so-appc-orchestrator/pom.xml4
-rw-r--r--asdc-controller/pom.xml2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java21
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java55
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java77
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java219
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java38
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java9
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java27
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/ErrorCode.java50
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboadingJobStatus.java63
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingJob.java49
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingJobDescriptor.java74
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingRequest.java54
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogServiceProvider.java112
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiResourcePackageProcessor.java175
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/HttpRestServiceProviderConfiguration.java55
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/JobStatus.java60
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SdcBasicHttpConfigurationProvider.java60
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SdcResourceProvider.java96
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SslBasedHttpClientConfiguration.java93
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/EtsiCatalogManagerRequestFailureException.java40
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/SOL004ResourcePackageFailureException.java40
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/SOL004ResourcePackageProcessingException.java34
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java21
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java37
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java22
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java203
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/util/ZipParser.java67
-rw-r--r--asdc-controller/src/main/resources/resource-examples/resource_Extvl.csarbin2638 -> 3328 bytes
-rw-r--r--asdc-controller/src/main/resources/resource-examples/service-ServiceFdnt-csar-0904-2.csarbin42061 -> 44650 bytes
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java6
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/SdcNotificationWithSol004PackageTest.java358
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java22
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java4
-rw-r--r--asdc-controller/src/test/resources/application-test.yaml8
-rw-r--r--asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-VfZrdm5bpxmc02092017Service-csar.csarbin97110 -> 109898 bytes
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VENDOR_LICENSE/vendor-license-model.xml1
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VF_LICENSE/vf-license-model.xml1
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/vgw6.csarbin0 -> 43363 bytes
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vgw/SDC_RESOURCE_CSAR/vgw_sdc_resource.csarbin0 -> 117852 bytes
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vgw/VENDOR_LICENSE/vendor-license-model.xml1
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vgw/VF_LICENSE/vf-license-model.xml1
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vgw/dmaap-notification-message.json66
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error-package-exists.json20
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error.json20
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-successful.json27
-rw-r--r--asdc-controller/src/test/resources/resource-examples/vgw/service-Vgwservicev1-csar.csarbin0 -> 122078 bytes
-rw-r--r--asdc-controller/src/test/resources/schema.sql28
-rw-r--r--bpmn/MSOCommonBPMN/pom.xml108
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy13
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy21
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtil.groovy119
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java46
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java266
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java171
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/CDSRequestProvider.java76
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java79
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java73
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ExtractServiceFromUserParameters.java53
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/GeneratePayloadForCds.java153
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java53
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PnfCDSRequestProvider.java78
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ServiceCDSRequestProvider.java89
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java121
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java106
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/PayloadGenerationException.java39
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/SDNCLcmPropertiesImpl.java125
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SDNCConstants.java50
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmActionConstants.java28
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java81
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilderException.java (renamed from common/src/main/java/org/onap/so/logger/ErrorCode.java)22
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClient.java90
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilder.java87
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmProperties.java49
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClient.java67
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmActionIdentifiers.java97
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmCommonHeader.java97
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequest.java97
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponse.java97
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmFlags.java64
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmInput.java75
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmOutput.java64
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequest.java42
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponse.java42
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmStatus.java53
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayload.java64
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayload.java66
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/SwToBeDownloadedElement.java75
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayload.java96
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayload.java96
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy9
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtilTest.groovy78
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java13
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java330
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java27
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java205
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java127
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/GeneratePayloadForCdsTest.java342
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/PnfCDSRequestProviderTest.java139
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ServiceCDSRequestProviderTest.java62
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java80
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VnfCDSRequestProviderTest.java104
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java139
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilderTest.java53
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClientTest.java93
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmBeanTest.java78
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequestTest.java67
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponseTest.java67
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmInputTest.java67
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmOutputTest.java84
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequestTest.java54
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponseTest.java54
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayloadTest.java52
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java82
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/LcmBasePayloadTest.java42
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayloadTest.java56
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayloadTest.java56
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json5
-rw-r--r--bpmn/MSOCoreBPMN/pom.xml2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceArtifact.java119
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInfo.java97
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceProxy.java78
-rw-r--r--bpmn/mso-infrastructure-bpmn/pom.xml2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java4
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java6
-rw-r--r--bpmn/pom.xml4
-rw-r--r--bpmn/so-bpmn-building-blocks/pom.xml2
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigDeployVnfBB.bpmn4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/pom.xml100
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy127
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy438
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy587
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy333
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy678
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy109
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy513
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy460
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy259
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy338
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy771
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy210
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy230
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy524
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy22
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy824
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy308
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy320
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy463
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy14
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/NfSoftwareUpgradeDispatcher.java168
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/UpdatePnfEntryInAai.java65
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java14
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationServiceTest.groovy224
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceServiceTest.groovy118
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatusTest.groovy344
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationServiceTest.groovy456
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy162
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy308
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy171
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationServiceTest.groovy196
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy258
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy460
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/NfSoftwareUpgradeDispatcherTest.java182
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/UpdatePnfEntryInAaiTest.java91
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/pom.xml2
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateCommunicationService.bpmn486
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn372
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn8
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCommunicationService.bpmn635
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn805
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCommunicationService.bpmn523
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn332
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn202
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn273
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/CheckServiceProcessStatus.bpmn225
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn361
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn364
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateCommunicationService.bpmn115
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn103
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn338
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn254
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteSliceService.bpmn205
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoSendCommandToNSSMF.bpmn344
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/HandleOrchestrationTask.bpmn90
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java68
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSWUPDownloadTest.java230
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java236
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/resources/request/PNFSoftwareUpgradeTest.json54
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PNFSoftwareUpgradeTest.json26
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PNFSoftwareUpgradeTest_catalogdb.json39
-rw-r--r--bpmn/so-bpmn-tasks/pom.xml20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java233
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java78
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/LcmControllerDE.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/PnfConfigCdsControllerDE.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/CdsControllerDE.java)18
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/common/SoPropertyConstants.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SDNCLcmPayloadBuilder.java153
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java225
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java92
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java166
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDE.java91
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ExternalTicketTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java256
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java116
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java77
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java38
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java69
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/ControllerExecutionDETestIT.java142
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/PnfConfigCdsControllerDETest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/CdsControllerDETest.java)48
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SDNCLcmPayloadBuilderTest.java135
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDETest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBBTest.java197
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java156
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDETest.java139
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java202
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java124
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java5
-rw-r--r--cloudify-client/pom.xml2
-rw-r--r--common/pom.xml6
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/ActDeActNssi.java51
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java109
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AllocateCnNssi.java110
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AllocateTnNssi.java109
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java61
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java120
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/CreateCnNssi.java89
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java91
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/EsrInfo.java48
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/JobStatusRequest.java70
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/JobStatusResponse.java37
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NSSI.java60
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NetworkType.java58
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NewNsst.java47
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java47
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssiActDeActRequest.java47
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssiAllocateRequest.java67
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssiCreateRequest.java47
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssiDeAllocateRequest.java47
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java47
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssiTerminateRequest.java47
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssiUpdateRequest.java47
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssiUpdateRequestById.java47
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssmiReqInfo.java57
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssmiResInfo.java47
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/PerfReq.java48
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbbList.java82
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllcList.java135
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/PnfErrorList.java47
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/ResourceSharingLevel.java56
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java85
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/ResponseHistory.java94
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/ServiceProfile.java50
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParams.java413
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/TerminateNssi.java59
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java48
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/UeMobilityLevel.java60
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/UpdateCnNssi.java119
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/UpdateCnNssiById.java89
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/UpdateSliceProfile.java101
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/VnfErrorList.java47
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIClient.java8
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectBase.java7
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java74
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectType.java68
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java16
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java2
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java5
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java9
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java9
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIBaseResourceUri.java29
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIPluralResourceUri.java9
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java60
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimplePluralUri.java68
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java98
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java51
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java24
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java23
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/NodesPluralUri.java19
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/NodesSingleUri.java21
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java27
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java24
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java18
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectBase.java9
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java5
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java3
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java135
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java45
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java4
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java8
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java39
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java16
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java26
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java5
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleBaseUri.java237
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimplePluralUri.java77
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java239
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java13
-rw-r--r--common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java2
-rw-r--r--common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java25
-rw-r--r--common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java75
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java7
-rw-r--r--common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java32
-rw-r--r--common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java62
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java12
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java16
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java18
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java14
-rw-r--r--common/src/main/java/org/onap/so/utils/CryptoUtils.java2
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java2
-rw-r--r--common/src/main/java/org/onap/so/utils/XmlMarshaller.java2
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java8
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java11
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java107
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java4
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIURITest.java4
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java3
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java2
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java18
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java49
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java12
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java2
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java4
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java45
-rw-r--r--common/src/test/java/org/onap/so/logger/ScheduledTasksMDCSetupTest.java83
-rw-r--r--cxf-logging/pom.xml2
-rw-r--r--deployment-configs/pom.xml2
-rw-r--r--deployment-configs/src/main/resources/logger/logback-spring.xml2
-rw-r--r--mso-api-handlers/mso-api-handler-common/pom.xml2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java14
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/pom.xml6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java158
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java58
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java79
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java300
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java120
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2ESliceServiceActivateRequest.java23
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java21
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java13
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java51
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java192
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java108
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json63
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/ServiceFromAAI.json4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfWorkflows_Response.json41
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql6
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/pom.xml2
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java15
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InstanceNfvoMappingRepository.java28
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OrchestrationTaskTest.java75
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java45
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql24
-rw-r--r--mso-api-handlers/mso-requests-db/pom.xml2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java21
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java60
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InstanceNfvoMapping.java123
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java42
-rw-r--r--mso-api-handlers/pom.xml2
-rw-r--r--mso-catalog-db/pom.xml2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java14
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceArtifact.java168
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java106
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java12
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java33
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java6
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java49
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java16
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java10
-rw-r--r--packages/docker/pom.xml75
-rw-r--r--packages/docker/src/main/docker/docker-files/Dockerfile.so-app20
-rw-r--r--packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image5
-rw-r--r--packages/docker/src/main/docker/docker-files/certs/org.onap.so.jksbin3582 -> 0 bytes
-rw-r--r--packages/docker/src/main/docker/docker-files/certs/org.onap.so.keyfile27
-rw-r--r--packages/docker/src/main/docker/docker-files/certs/org.onap.so.trust.jksbin1413 -> 0 bytes
-rw-r--r--packages/docker/src/main/docker/docker-files/scripts/.gitattributes5
-rwxr-xr-x[-rw-r--r--]packages/docker/src/main/docker/docker-files/scripts/start-app.sh4
-rw-r--r--packages/pom.xml2
-rw-r--r--pom.xml54
-rw-r--r--so-monitoring/pom.xml2
-rw-r--r--so-monitoring/so-monitoring-handler/pom.xml2
-rw-r--r--so-monitoring/so-monitoring-service/pom.xml2
-rw-r--r--so-monitoring/so-monitoring-ui/pom.xml2
-rw-r--r--so-simulator/pom.xml15
-rw-r--r--version.properties4
796 files changed, 48609 insertions, 3950 deletions
diff --git a/.gitignore b/.gitignore
index 8eeea7a8cc..79d2c94622 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,8 @@ target
**/.buildpath
**/.factorypath
**/.springBeans
+**/.project
+**/.classpath
.idea
.checkstyle
.DS_Store
diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml
index aa9a1cea9e..b8dec73f80 100644
--- a/adapters/mso-adapter-utils/pom.xml
+++ b/adapters/mso-adapter-utils/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-adapter-utils</artifactId>
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
index 9042095e84..446c725e48 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
@@ -85,7 +85,7 @@ import org.onap.so.config.beans.PoConfig;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
import org.onap.so.db.catalog.beans.HeatTemplateParam;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.exceptions.MsoAdapterException;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
index 8696648441..50ebcc66ee 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
@@ -37,7 +37,7 @@ import org.onap.so.config.beans.PoConfig;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.ServerType;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.exceptions.MsoAdapterException;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index f06d2a2452..f5464645d6 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -52,7 +52,7 @@ import org.onap.so.db.catalog.beans.HeatTemplateParam;
import org.onap.so.db.request.beans.CloudApiRequests;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.CreateStackRequest;
import org.onap.so.openstack.beans.HeatStatus;
@@ -70,6 +70,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+import org.springframework.web.client.HttpClientErrorException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Strings;
@@ -101,8 +102,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
private static final String CREATE_IN_PROGRESS = "CREATE_IN_PROGRESS";
- private static final String DELETE_STACK = "DeleteStack";
-
protected static final String HEAT_ERROR = "HeatError";
protected static final String CREATE_STACK = "CreateStack";
@@ -115,14 +114,14 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
private Environment environment;
@Autowired
- RequestsDbClient requestDBClient;
-
- @Autowired
StackStatusHandler statusHandler;
@Autowired
NovaClientImpl novaClient;
+ @Autowired
+ RequestsDbClient requestDBClient;
+
private static final Logger logger = LoggerFactory.getLogger(MsoHeatUtils.class);
// Properties names and variables (with default values)
@@ -182,6 +181,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
CreateStackParam createStack = createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes,
environment, nestedTemplates, heatFiles);
Stack currentStack = queryHeatStack(stackName, cloudSiteId, tenantId);
+ boolean operationPerformed = false;
if (currentStack != null) {
logger.debug("Existing Stack found with Status: {} ", currentStack.getStackStatus());
if (CREATE_COMPLETE.equals(currentStack.getStackStatus())) {
@@ -220,8 +220,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
currentStack =
queryHeatStack(currentStack.getStackName() + "/" + currentStack.getId(), cloudSiteId, tenantId);
}
+ operationPerformed = true;
}
- return new StackInfoMapper(currentStack).map();
+ StackInfo stackInfo = new StackInfoMapper(currentStack).map();
+ stackInfo.setOperationPerformed(operationPerformed);
+ return stackInfo;
}
/**
@@ -497,14 +500,17 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
public StackInfo deleteStack(String tenantId, String cloudOwner, String cloudSiteId, String stackName,
boolean pollForCompletion, int timeoutMinutes) throws MsoException {
Stack currentStack = queryHeatStack(stackName, cloudSiteId, tenantId);
+ StackInfo stackInfo = null;
if (currentStack == null || DELETE_COMPLETE.equals(currentStack.getStackStatus())) {
- return new StackInfo(stackName, HeatStatus.NOTFOUND);
+ stackInfo = new StackInfo(stackName, HeatStatus.NOTFOUND);
+ stackInfo.setOperationPerformed(false);
} else {
currentStack = deleteStack(currentStack, timeoutMinutes, cloudSiteId, tenantId);
- StackInfo stackInfo = new StackInfoMapper(currentStack).map();
+ stackInfo = new StackInfoMapper(currentStack).map();
stackInfo.setName(stackName);
- return stackInfo;
+ stackInfo.setOperationPerformed(true);
}
+ return stackInfo;
}
/**
@@ -1182,4 +1188,15 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
}
}
+ public void updateResourceStatus(String requestId, String resourceStatusMessage) {
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setRequestId(requestId);
+ request.setResourceStatusMessage(resourceStatusMessage);
+ try {
+ requestDBClient.patchInfraActiveRequests(request);
+ } catch (HttpClientErrorException e) {
+ logger.warn("Unable to update active request resource status");
+ }
+ }
+
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java
index 684fe98bf3..f001565baf 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java
@@ -29,7 +29,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.StackInfo;
import org.onap.so.openstack.exceptions.MsoException;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
index f74a3f5f53..b875c2c8bb 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
@@ -29,7 +29,7 @@ import java.util.Optional;
import org.onap.so.cloud.authentication.AuthenticationMethodFactory;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.MsoTenant;
import org.onap.so.openstack.exceptions.MsoAdapterException;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
index ca0180ae4b..1df5fe36ab 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
@@ -43,7 +43,7 @@ import org.onap.so.adapters.vdu.VduStatus;
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
import org.onap.so.client.RestClient;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
@@ -81,7 +81,9 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
private static final Integer DEFAULT_MSB_PORT = 80;
private static final String DEFAULT_MSB_IP = "127.0.0.1";
+ private static final String DEFAULT_MSB_SCHEME = "http";
private static final String ONAP_IP = "ONAP_IP";
+ private static final String MSB_SCHEME = "MSB_SCHEME";
private final HttpClientFactory httpClientFactory = new HttpClientFactory();
@Autowired
@@ -795,10 +797,14 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
msbIp = environment.getProperty("mso.msb-ip", DEFAULT_MSB_IP);
}
Integer msbPort = environment.getProperty("mso.msb-port", Integer.class, DEFAULT_MSB_PORT);
+ String msbScheme = System.getenv().get(MSB_SCHEME);
+ if (null == msbScheme || msbScheme.isEmpty()) {
+ msbScheme = environment.getProperty("mso.msb-scheme", DEFAULT_MSB_SCHEME);
+ }
String path = "/api/multicloud/v1/" + cloudOwner + "/" + cloudSiteId + "/infra_workload";
- String endpoint = UriBuilder.fromPath(path).host(msbIp).port(msbPort).scheme("http").build().toString();
+ String endpoint = UriBuilder.fromPath(path).host(msbIp).port(msbPort).scheme(msbScheme).build().toString();
if (workloadId != null) {
String middlepart = null;
if (isName) {
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
index 44fc620b07..3e28e5c45a 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
@@ -35,7 +35,7 @@ import org.onap.so.cloud.authentication.ServiceEndpointNotFoundException;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.ServerType;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.NetworkInfo;
import org.onap.so.openstack.exceptions.MsoAdapterException;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java
index 7f0f6e4a8b..4dc139f37d 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java
@@ -26,14 +26,20 @@ import org.onap.so.openstack.exceptions.MsoException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.woorea.openstack.base.client.Entity;
+import com.woorea.openstack.base.client.HttpMethod;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.nova.Nova;
import com.woorea.openstack.nova.model.Flavor;
import com.woorea.openstack.nova.model.Flavors;
import com.woorea.openstack.nova.model.HostAggregate;
import com.woorea.openstack.nova.model.HostAggregates;
+import com.woorea.openstack.nova.model.Hypervisors;
import com.woorea.openstack.nova.model.QuotaSet;
import com.woorea.openstack.nova.model.Server;
+import com.woorea.openstack.nova.model.VolumeAttachment;
@Component
@@ -216,4 +222,61 @@ public class NovaClientImpl extends MsoCommonUtils {
throw new NovaClientException("Error building Nova Client", e);
}
}
+
+ public void postActionToServer(String cloudSiteId, String tenantId, String id, String request)
+ throws NovaClientException {
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode actualObj = mapper.readTree(request);
+ Entity<JsonNode> openstackEntity = new Entity<>(actualObj, "application/json");
+ CharSequence actionPath = "/servers/" + id + "/action";
+ Nova novaClient = getNovaClient(cloudSiteId, tenantId);
+ OpenStackRequest<Void> OSRequest =
+ new OpenStackRequest<>(novaClient, HttpMethod.POST, actionPath, openstackEntity, Void.class);
+ executeAndRecordOpenstackRequest(OSRequest, false);
+ } catch (Exception e) {
+ logger.error("Error building Nova Client", e);
+ throw new NovaClientException("Error building Nova Client", e);
+ }
+ }
+
+ public void attachVolume(String cloudSiteId, String tenantId, String serverId, VolumeAttachment volumeAttachment)
+ throws NovaClientException {
+ Nova novaClient;
+ try {
+ novaClient = getNovaClient(cloudSiteId, tenantId);
+ OpenStackRequest<Void> request = novaClient.servers().attachVolume(serverId, volumeAttachment.getVolumeId(),
+ volumeAttachment.getDevice());
+ executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Nova Client", e);
+ throw new NovaClientException("Error building Nova Client", e);
+ }
+ }
+
+ public void detachVolume(String cloudSiteId, String tenantId, String serverId, String volumeId)
+ throws NovaClientException {
+ Nova novaClient;
+ try {
+ novaClient = getNovaClient(cloudSiteId, tenantId);
+ OpenStackRequest<Void> request = novaClient.servers().detachVolume(serverId, volumeId);
+ executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Nova Client", e);
+ throw new NovaClientException("Error building Nova Client", e);
+ }
+ }
+
+ public Hypervisors getHypervisorDetails(String cloudSiteId, String tenantId) throws NovaClientException {
+ Nova novaClient;
+ try {
+ novaClient = getNovaClient(cloudSiteId, tenantId);
+ OpenStackRequest<Hypervisors> request = novaClient.hypervisors().listDetail();
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Nova Client", e);
+ throw new NovaClientException("Error building Nova Client", e);
+ }
+ }
+
}
diff --git a/adapters/mso-adapter-utils/src/test/resources/application-test.yaml b/adapters/mso-adapter-utils/src/test/resources/application-test.yaml
index 32a4db6b80..117d616cd4 100644
--- a/adapters/mso-adapter-utils/src/test/resources/application-test.yaml
+++ b/adapters/mso-adapter-utils/src/test/resources/application-test.yaml
@@ -53,6 +53,7 @@ mso:
logPath: logs
msb-ip: localhost
msb-port: ${wiremock.server.port}
+ msb-scheme: http
catalog:
db:
spring:
diff --git a/adapters/mso-adapters-rest-interface/pom.xml b/adapters/mso-adapters-rest-interface/pom.xml
index 5f987e61ce..584c47fea6 100644
--- a/adapters/mso-adapters-rest-interface/pom.xml
+++ b/adapters/mso-adapters-rest-interface/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-adapters-rest-interface</artifactId>
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/StackInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/StackInfo.java
index 76d3667632..7e2071525d 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/StackInfo.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/StackInfo.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,7 +26,7 @@ import java.util.Map;
/*
* This Java bean class relays Heat stack status information to ActiveVOS processes.
- *
+ *
* This bean is returned by all Heat-specific adapter operations (create, query, delete)
*/
@@ -36,6 +36,7 @@ public class StackInfo {
private String canonicalName = "";
private HeatStatus status = HeatStatus.UNKNOWN;
private String statusMessage = "";
+ private boolean operationPerformed;
private Map<String, Object> outputs = new HashMap<>();
private Map<String, Object> parameters = new HashMap<>();
@@ -106,5 +107,15 @@ public class StackInfo {
this.parameters = parameters;
}
+ public boolean isOperationPerformed() {
+ return operationPerformed;
+ }
+
+ public void setOperationPerformed(boolean operationPerformed) {
+ this.operationPerformed = operationPerformed;
+ }
+
+
+
}
diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml
index 9745935925..bcc523ab98 100644
--- a/adapters/mso-catalog-db-adapter/pom.xml
+++ b/adapters/mso-catalog-db-adapter/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceArtifact.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceArtifact.java
new file mode 100644
index 0000000000..ce39b9713a
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceArtifact.java
@@ -0,0 +1,118 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.adapters.catalogdb.catalogrest;
+
+import org.onap.so.db.catalog.beans.ServiceArtifact;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@XmlRootElement(name = "serviceArtifacts")
+public class QueryServiceArtifact extends CatalogQuery {
+
+ protected static Logger logger = LoggerFactory.getLogger(QueryServiceArtifact.class);
+
+ private List<ServiceArtifact> serviceArtifactList;
+
+ private static final String TEMPLATE = "\t{\n" + "\t\t\"artifactUUID\" : <ARTIFACT_UUID>,\n"
+ + "\t\t\"name\" : <NAME>,\n" + "\t\t\"version\" : <VERSION>,\n"
+ + "\t\t\"checksum\" : <CHECKSUM>,\n" + "\t\t\"type\" : <TYPE>,\n"
+ + "\t\t\"content\" : <CONTENT>,\n" + "\t\t\"description\" : <DESCRIPTION>\n" + "\t}";
+
+ public QueryServiceArtifact() {
+ super();
+ serviceArtifactList = new ArrayList<>();
+ }
+
+ public QueryServiceArtifact(List<ServiceArtifact> alist) {
+ serviceArtifactList = new ArrayList<>();
+ for (ServiceArtifact o : alist) {
+ if (logger.isDebugEnabled())
+ logger.debug(o.toString());
+ serviceArtifactList.add(o);
+ }
+ }
+
+ public List<ServiceArtifact> getServiceArtifact() {
+ return this.serviceArtifactList;
+ }
+
+ public void setServiceArtifact(List<ServiceArtifact> a) {
+ this.serviceArtifactList = a;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ boolean first = true;
+ int i = 1;
+ for (ServiceArtifact o : serviceArtifactList) {
+ sb.append(i).append("\t");
+ if (!first)
+ sb.append("\n");
+ first = false;
+ sb.append(o);
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public String JSON2(boolean isArray, boolean isEmbed) {
+ StringBuilder sb = new StringBuilder();
+ if (!isEmbed && isArray)
+ sb.append("{ ");
+ if (isArray)
+ sb.append("\"serviceArtifact\": [");
+ Map<String, String> valueMap = new HashMap<>();
+ String sep = "";
+ boolean first = true;
+
+ for (ServiceArtifact o : serviceArtifactList) {
+ if (first)
+ sb.append("\n");
+ first = false;
+
+ boolean vrNull = o == null;
+
+ put(valueMap, "ARTIFACT_UUID", vrNull ? null : o.getArtifactUUID());
+ put(valueMap, "TYPE", vrNull ? null : o.getType());
+ put(valueMap, "NAME", vrNull ? null : o.getName());
+ put(valueMap, "VERSION", vrNull ? null : o.getVersion());
+ put(valueMap, "DESCRIPTION", vrNull ? null : o.getDescription());
+ put(valueMap, "CONTENT", vrNull ? null : o.getContent());
+ put(valueMap, "CHECKSUM", vrNull ? null : o.getChecksum());
+ sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
+ sep = ",\n";
+ }
+ if (!first)
+ sb.append("\n");
+ if (isArray)
+ sb.append("]");
+ if (!isEmbed && isArray)
+ sb.append("}");
+ return sb.toString();
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java
new file mode 100644
index 0000000000..6c1c81c6ef
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.adapters.catalogdb.catalogrest;
+
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.HashMap;
+import java.util.Map;
+
+@XmlRootElement(name = "serviceInfo")
+public class QueryServiceInfo extends CatalogQuery {
+
+ protected static Logger logger = LoggerFactory.getLogger(QueryServiceInfo.class);
+
+ private ServiceInfo serviceInfo;
+
+ private static final String TEMPLATE =
+ "\n" + "\t{" + "\t\t\"id\" : <ID>,\n" + "\t\t\"serviceInput\" : <SERVICE_INPUT>,\n"
+ + "\t\"serviceProperties\" : <SERVICE_PROPERTIES>,\n" + "<_SERVICEARTIFACT_>\n";
+
+
+ public QueryServiceInfo() {
+ super();
+ this.serviceInfo = new ServiceInfo();
+ }
+
+ public QueryServiceInfo(ServiceInfo serviceInfo) {
+ this.serviceInfo = serviceInfo;
+ }
+
+ public ServiceInfo getServiceInfo() {
+ return this.serviceInfo;
+ }
+
+ public void setServiceInfo(ServiceInfo serviceInfo) {
+ this.serviceInfo = serviceInfo;
+ }
+
+ @Override
+ public String toString() {
+
+ return serviceInfo.toString();
+ }
+
+ @Override
+ public String JSON2(boolean isArray, boolean isEmbed) {
+ if (serviceInfo == null) {
+ return "\"serviceInfo\": null";
+ }
+ StringBuilder sb = new StringBuilder();
+ sb.append("\"serviceInfo\": ");
+ sb.append("\n");
+ Map<String, String> valueMap = new HashMap<>();
+ Service service = serviceInfo.getService();
+ put(valueMap, "ID", null == serviceInfo ? null : serviceInfo.getId());
+ put(valueMap, "SERVICE_INPUT", null == serviceInfo ? null : serviceInfo.getServiceInput());
+ put(valueMap, "SERVICE_PROPERTIES", null == serviceInfo ? null : serviceInfo.getServiceProperties());
+ String subitem = new QueryServiceArtifact(service.getServiceArtifactList()).JSON2(true, true);
+ valueMap.put("_SERVICEARTIFACT_", subitem.replaceAll("(?m)^", "\t\t"));
+ sb.append(this.setTemplate(TEMPLATE, valueMap));
+ sb.append("}");
+ return sb.toString();
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
index 0eb7d0418e..d5aa472c8d 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
@@ -40,7 +40,7 @@ public class QueryServiceMacroHolder extends CatalogQuery {
+ "\t\"serviceType\" : <SERVICE_TYPE>,\n" + "\t\"serviceRole\" : <SERVICE_ROLE>,\n"
+ "\t\"environmentContext\" : <ENVIRONMENT_CONTEXT>,\n" + "\t\"resourceOrder\" : <RESOURCE_ORDER>,\n"
+ "\t\"workloadContext\" : <WORKLOAD_CONTEXT>,\n" + "<_SERVICEVNFS_>,\n" + "<_SERVICENETWORKS_>,\n"
- + "<_SERVICEALLOTTEDRESOURCES_>\n" + "\t}}";
+ + "<_SERVICEINFO_>,\n" + "<_SERVICEPROXY_>,\n" + "<_SERVICEALLOTTEDRESOURCES_>\n" + "\t}}";
public QueryServiceMacroHolder() {
super();
@@ -94,6 +94,12 @@ public class QueryServiceMacroHolder extends CatalogQuery {
subitem = new QueryAllottedResourceCustomization(service.getAllottedCustomizations()).JSON2(true, true);
valueMap.put("_SERVICEALLOTTEDRESOURCES_", subitem.replaceAll(LINE_BEGINNING, "\t"));
+ subitem = new QueryServiceInfo(serviceMacroHolder.getServiceInfo()).JSON2(true, true);
+ valueMap.put("_SERVICEINFO_", subitem.replaceAll(LINE_BEGINNING, "\t"));
+
+ subitem = new QueryServiceProxyCustomization(service.getServiceProxyCustomizations()).JSON2(true, true);
+ valueMap.put("_SERVICEPROXY_", subitem.replaceAll(LINE_BEGINNING, "\t"));
+
buf.append(this.setTemplate(TEMPLATE, valueMap));
return buf.toString();
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceProxyCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceProxyCustomization.java
new file mode 100644
index 0000000000..94cf304120
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceProxyCustomization.java
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.adapters.catalogdb.catalogrest;
+
+import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@XmlRootElement(name = "serviceProxyCustomizations")
+public class QueryServiceProxyCustomization extends CatalogQuery {
+
+ protected static Logger logger = LoggerFactory.getLogger(QueryServiceProxyCustomization.class);
+
+ private List<ServiceProxyResourceCustomization> serviceProxyResourceCustomizationList;
+
+ private static final String TEMPLATE =
+ "\t{\n" + "\t\t\"modelInfo\" : {\n" + "\t\t\t\"modelName\" : <MODEL_NAME>,\n"
+ + "\t\t\t\"modelUuid\" : <MODEL_UUID>,\n"
+ + "\t\t\t\"modelInvariantUuid\" : <MODEL_INVARIANT_UUID>,\n"
+ + "\t\t\t\"modelVersion\" : <MODEL_VERSION>,\n"
+ + "\t\t\t\"modelCustomizationUuid\" : <MODEL_CUSTOMIZATION_UUID>,\n"
+ + "\t\t\t\"modelInstanceName\" : <MODEL_INSTANCE_NAME>\n" + "\t},\n"
+ + "\t\t\"toscaNodeType\" : <TOSCA_NODE_TYPE>,\n"
+ + "\t\t\"description\" : <DESCRIPTION>,\n"
+ + "\t\t\"sourceModelUuid\" : <SOURCE_SERVICE_MODEL_UUID>\n" + "\t}";
+
+ public QueryServiceProxyCustomization() {
+ super();
+ this.serviceProxyResourceCustomizationList = new ArrayList<>();
+ }
+
+ public QueryServiceProxyCustomization(
+ List<ServiceProxyResourceCustomization> serviceProxyResourceCustomizationList) {
+ this.serviceProxyResourceCustomizationList = serviceProxyResourceCustomizationList;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+
+ boolean first = true;
+ int i = 1;
+ for (ServiceProxyResourceCustomization o : serviceProxyResourceCustomizationList) {
+ sb.append(i).append("\t");
+ if (!first)
+ sb.append("\n");
+
+ first = false;
+ sb.append(o);
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public String JSON2(boolean isArray, boolean isEmbed) {
+ StringBuilder sb = new StringBuilder();
+ if (!isEmbed && isArray)
+ sb.append("{ ");
+ if (isArray)
+ sb.append("\"serviceProxy\": [");
+ Map<String, String> valueMap = new HashMap<>();
+ String sep = "";
+ boolean first = true;
+
+ if (this.serviceProxyResourceCustomizationList != null) {
+ for (ServiceProxyResourceCustomization o : serviceProxyResourceCustomizationList) {
+ if (first)
+ sb.append("\n");
+
+ first = false;
+
+ boolean arNull = o == null;
+
+ put(valueMap, "MODEL_CUSTOMIZATION_UUID", arNull ? null : o.getModelCustomizationUUID());
+ put(valueMap, "MODEL_INSTANCE_NAME", arNull ? null : o.getModelInstanceName());
+ put(valueMap, "MODEL_UUID", arNull ? null : o.getModelUUID());
+ put(valueMap, "MODEL_INVARIANT_UUID", arNull ? null : o.getModelInvariantUUID());
+ put(valueMap, "MODEL_VERSION", arNull ? null : o.getModelVersion());
+ put(valueMap, "MODEL_NAME", arNull ? null : o.getModelName());
+ put(valueMap, "TOSCA_NODE_TYPE", arNull ? null : o.getToscaNodeType());
+ put(valueMap, "DESCRIPTION", arNull ? null : o.getDescription());
+ put(valueMap, "SOURCE_SERVICE_MODEL_UUID", (String) (arNull ? null
+ : o.getSourceService() == null ? null : o.getSourceService().getModelUUID()));
+
+ sb.append(sep).append(this.setTemplate(TEMPLATE, valueMap));
+ sep = ",\n";
+ }
+ }
+ if (!first)
+ sb.append("\n");
+
+ if (isArray)
+ sb.append("]");
+
+ if (!isEmbed && isArray)
+ sb.append("}");
+
+ return sb.toString();
+ }
+
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5__AddServiceArtifact.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5__AddServiceArtifact.sql
new file mode 100644
index 0000000000..d32c4666c5
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.5__AddServiceArtifact.sql
@@ -0,0 +1,30 @@
+use catalogdb;
+
+CREATE TABLE IF NOT EXISTS `service_info` (
+ `ID` int (11) AUTO_INCREMENT,
+ `SERVICE_INPUT` varchar (5000),
+ `SERVICE_PROPERTIES` varchar (5000),
+ PRIMARY KEY (`ID`)
+)ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `service_artifact`(
+ `ARTIFACT_UUID` varchar (200) NOT NULL,
+ `TYPE` varchar (200) NOT NULL,
+ `NAME` varchar (200) NOT NULL,
+ `VERSION` varchar (200) NOT NULL,
+ `DESCRIPTION` varchar (200) DEFAULT NULL,
+ `CONTENT` LONGTEXT DEFAULT NULL,
+ `CHECKSUM` varchar (200) DEFAULT NULL,
+ `CREATION_TIMESTAMP` DATETIME DEFAULT CURRENT_TIMESTAMP,
+ `SERVICE_MODEL_UUID` varchar (200) NOT NULL,
+ PRIMARY KEY (`ARTIFACT_UUID`),
+ CONSTRAINT `fk_service_artifact_service_info1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+)ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `service_to_service_info` (
+ `SERVICE_MODEL_UUID` varchar (200) NOT NULL,
+ `SERVICE_INFO_ID` INT (11) NOT NULL,
+ PRIMARY KEY (`SERVICE_MODEL_UUID`,`SERVICE_INFO_ID`),
+ CONSTRAINT `fk_service_to_service_info__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_service_to_service_info__service_info1` FOREIGN KEY (`SERVICE_INFO_ID`) REFERENCES `service_info` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE
+) \ No newline at end of file
diff --git a/adapters/mso-nssmf-adapter/pom.xml b/adapters/mso-nssmf-adapter/pom.xml
new file mode 100644
index 0000000000..3e9c2fe6d7
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/pom.xml
@@ -0,0 +1,150 @@
+<!--
+ ~*
+ ~============LICENSE_START=======================================================
+ ~* ONAP - SO
+ ~*================================================================================
+ ~* Copyright (C) 2020 Huawei Technologies Co., Ltd. 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=========================================================
+ ~*/
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onap.so</groupId>
+ <artifactId>adapters</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-nssmf-adapter</artifactId>
+ <packaging>jar</packaging>
+ <name>mso-nssmf-adapter</name>
+ <description>Web service endpoint for nssmf operations</description>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${springboot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <build>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+ <mainClass>org.onap.so.adapters.nssmf.MSONssmfApplication</mainClass>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jdbc</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jdbc</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-spring-boot-starter-jaxws</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
+ <version>${cxf.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-requests-db</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-requests-db-repositories</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>ch.vorburger.mariaDB4j</groupId>
+ <artifactId>mariaDB4j</artifactId>
+ <version>2.2.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-configuration-processor</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>3.14.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.18.2</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/MSONssmfApplication.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/MSONssmfApplication.java
new file mode 100644
index 0000000000..cd011e6437
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/MSONssmfApplication.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication(scanBasePackages = {"org.onap.so"})
+public class MSONssmfApplication {
+
+ public static void main(String... args) {
+ SpringApplication.run(MSONssmfApplication.class, args);
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/RequestDbConfig.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/RequestDbConfig.java
new file mode 100644
index 0000000000..484f7624aa
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/RequestDbConfig.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf;
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.jdbc.DataSourceBuilder;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@Profile({"!test"})
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(entityManagerFactoryRef = "requestEntityManagerFactory",
+ transactionManagerRef = "requestTransactionManager", basePackages = {"org.onap.so.db.request.data.repository"})
+public class RequestDbConfig {
+
+ @Primary
+ @Bean(name = "requestDataSource")
+ @ConfigurationProperties(prefix = "spring.datasource")
+ public DataSource dataSource() {
+ return DataSourceBuilder.create().build();
+ }
+
+ @Primary
+ @Bean(name = "requestEntityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder,
+ @Qualifier("requestDataSource") DataSource dataSource) {
+ return builder.dataSource(dataSource).packages("org.onap.so.db.request.beans").persistenceUnit("requestDB")
+ .build();
+ }
+
+ @Primary
+ @Bean(name = "requestTransactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("requestEntityManagerFactory") EntityManagerFactory entityManagerFactory) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
+
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/WebSecurityConfig.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/WebSecurityConfig.java
new file mode 100644
index 0000000000..1522ca9c6d
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/WebSecurityConfig.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+
+@EnableWebSecurity
+@Configuration
+public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http.csrf().disable();
+ }
+
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/exceptions/ApplicationException.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/exceptions/ApplicationException.java
new file mode 100644
index 0000000000..f63ba356a1
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/exceptions/ApplicationException.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.exceptions;
+
+import org.onap.so.adapters.nssmf.model.ErrorResponse;
+import org.springframework.http.ResponseEntity;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.marshal;
+
+public class ApplicationException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ private int errorCode;
+
+ private String errorMsg;
+
+ public ApplicationException(int errorCode, String errorMsg) {
+ this.errorCode = errorCode;
+ this.errorMsg = errorMsg;
+ }
+
+ public int getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(int errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public String getErrorMsg() {
+ return errorMsg;
+ }
+
+ public void setErrorMsg(String errorMsg) {
+ this.errorMsg = errorMsg;
+ }
+
+ public ResponseEntity buildErrorResponse() {
+ String message;
+ try {
+ ErrorResponse err = new ErrorResponse(errorCode, errorMsg);
+ message = marshal(err);
+ } catch (ApplicationException e) {
+ return ResponseEntity.status(500).body("Internal Server Error");
+ }
+ return ResponseEntity.status(errorCode).body(message);
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientPropertiesImpl.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientPropertiesImpl.java
new file mode 100644
index 0000000000..3333c64cd8
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientPropertiesImpl.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.extclients.aai;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.onap.so.client.aai.AAIProperties;
+import org.onap.so.client.aai.AAIVersion;
+import org.onap.so.spring.SpringContextHelper;
+import org.springframework.context.ApplicationContext;
+
+public class AaiClientPropertiesImpl implements AAIProperties {
+
+ private final String endpoint;
+
+ private final String encryptedBasicAuth;
+
+ private final String encrytptionKey;
+
+ public AaiClientPropertiesImpl() {
+ final ApplicationContext context = SpringContextHelper.getAppContext();
+ this.endpoint = context.getEnvironment().getProperty("aai.endpoint");
+ this.encryptedBasicAuth = context.getEnvironment().getProperty("aai.auth");
+ this.encrytptionKey = context.getEnvironment().getProperty("mso.key");
+ }
+
+ @Override
+ public AAIVersion getDefaultVersion() {
+ return AAIVersion.LATEST;
+ }
+
+ @Override
+ public String getAuth() {
+ return encryptedBasicAuth;
+ }
+
+ @Override
+ public String getKey() {
+ return encrytptionKey;
+ }
+
+ @Override
+ public URL getEndpoint() throws MalformedURLException {
+ return new URL(endpoint);
+ }
+
+ @Override
+ public String getSystemName() {
+ return "MSO";
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientProvider.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientProvider.java
new file mode 100644
index 0000000000..48e3ef1666
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientProvider.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.extclients.aai;
+
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class AaiClientProvider {
+
+ @Bean
+ public AAIResourcesClient getAaiClient() {
+ return new AAIResourcesClient();
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProvider.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProvider.java
new file mode 100644
index 0000000000..c737ba6440
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProvider.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.extclients.aai;
+
+import org.onap.aai.domain.yang.EsrSystemInfoList;
+import org.onap.aai.domain.yang.EsrThirdpartySdncList;
+
+public interface AaiServiceProvider {
+
+ EsrThirdpartySdncList invokeGetThirdPartySdncList();
+
+ EsrSystemInfoList invokeGetThirdPartySdncEsrSystemInfo(String sdncId);
+
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java
new file mode 100644
index 0000000000..f8422e2a8f
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.extclients.aai;
+
+
+import org.onap.aai.domain.yang.EsrSystemInfoList;
+import org.onap.aai.domain.yang.EsrThirdpartySdncList;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AaiServiceProviderImpl implements AaiServiceProvider {
+
+ private static final Logger logger = LoggerFactory.getLogger(AaiServiceProviderImpl.class);
+
+ private final AaiClientProvider aaiClientProvider;
+
+ @Autowired
+ public AaiServiceProviderImpl(final AaiClientProvider aaiClientProvider) {
+ this.aaiClientProvider = aaiClientProvider;
+ }
+
+ @Override
+ public EsrThirdpartySdncList invokeGetThirdPartySdncList() {
+ return aaiClientProvider.getAaiClient()
+ .get(EsrThirdpartySdncList.class, AAIUriFactory.createResourceUri(AAIObjectType.THIRDPARTY_SDNC_LIST))
+ .orElseGet(() -> {
+ logger.debug("No VNFMs in AAI");
+ return null;
+ });
+ }
+
+ @Override
+ public EsrSystemInfoList invokeGetThirdPartySdncEsrSystemInfo(String sdncId) {
+ return aaiClientProvider.getAaiClient()
+ .get(EsrSystemInfoList.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.THIRDPARTY_SDNC_SYSTEM_INFO_LIST, sdncId))
+ .orElseGet(() -> {
+ logger.debug("VNFM not found in AAI");
+ return null;
+ });
+ }
+
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/ErrorResponse.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/ErrorResponse.java
new file mode 100644
index 0000000000..188349c0bf
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/ErrorResponse.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.model;
+
+public class ErrorResponse {
+
+ private int status;
+
+ private String error;
+
+ private String message;
+
+ public ErrorResponse(int status, String message) {
+ this.status = status;
+ this.message = message;
+ this.error = "Bad Request";
+ }
+
+ public int getStatus() {
+ return status;
+ }
+
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ public String getError() {
+ if (status == 500) {
+ this.error = "Internal Server Error";
+ }
+ return error;
+ }
+
+ public void setError(String error) {
+ this.error = error;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenRequest.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenRequest.java
new file mode 100644
index 0000000000..3590c683e6
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenRequest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.model;
+
+public class TokenRequest {
+
+ private String grantType;
+
+ private String userName;
+
+ private String value;
+
+ public String getGrantType() {
+ return grantType;
+ }
+
+ public void setGrantType(String grantType) {
+ this.grantType = grantType;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenResponse.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenResponse.java
new file mode 100644
index 0000000000..8007075e04
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/model/TokenResponse.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.model;
+
+public class TokenResponse {
+
+ private String accessToken;
+
+ private int expires;
+
+ public String getAccessToken() {
+ return accessToken;
+ }
+
+ public void setAccessToken(String accessToken) {
+ this.accessToken = accessToken;
+ }
+
+ public int getExpires() {
+ return expires;
+ }
+
+ public void setExpires(int expires) {
+ this.expires = expires;
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/HttpMethod.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/HttpMethod.java
new file mode 100644
index 0000000000..f6abd98794
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/HttpMethod.java
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.rest;
+
+public enum HttpMethod {
+ GET, POST, PUT, DELETE, PATCH;
+
+ public static HttpMethod fromString(String s) {
+ if (s == null)
+ return null;
+ if (("get").equalsIgnoreCase(s))
+ return GET;
+ if (("post").equalsIgnoreCase(s))
+ return POST;
+ if (("put").equalsIgnoreCase(s))
+ return PUT;
+ if (("delete").equalsIgnoreCase(s))
+ return DELETE;
+ if (("patch").equalsIgnoreCase(s))
+ return PATCH;
+ throw new IllegalArgumentException("Invalid value for HTTP Method: " + s);
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/JobStatus.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/JobStatus.java
new file mode 100644
index 0000000000..f2e651fd6e
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/JobStatus.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.rest;
+
+import org.onap.so.adapters.nssmf.exceptions.ApplicationException;
+
+
+public enum JobStatus {
+ STARTED, PROCESSING, FINISHED, ERROR;
+
+ public static JobStatus fromString(String s) throws ApplicationException {
+ if (s == null)
+ return null;
+ if (("started").equalsIgnoreCase(s))
+ return STARTED;
+ if (("processing").equalsIgnoreCase(s))
+ return PROCESSING;
+ if (("finished").equalsIgnoreCase(s))
+ return FINISHED;
+ if (("error").equalsIgnoreCase(s))
+ return ERROR;
+ throw new ApplicationException(500, "Invalid value for Job " + "Status: " + s);
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfAdapterRest.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfAdapterRest.java
new file mode 100644
index 0000000000..d8e1e36058
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfAdapterRest.java
@@ -0,0 +1,205 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.rest;
+
+import org.onap.so.adapters.nssmf.exceptions.ApplicationException;
+import org.onap.so.beans.nsmf.JobStatusRequest;
+import org.onap.so.beans.nsmf.NssiActDeActRequest;
+import org.onap.so.beans.nsmf.NssiAllocateRequest;
+import org.onap.so.beans.nsmf.NssiCreateRequest;
+import org.onap.so.beans.nsmf.NssiDeAllocateRequest;
+import org.onap.so.beans.nsmf.NssiTerminateRequest;
+import org.onap.so.beans.nsmf.NssiUpdateRequest;
+import org.onap.so.beans.nsmf.NssiUpdateRequestById;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.assertObjectNotNull;
+
+@Controller
+@RequestMapping(value = "/api/rest/provMns/v1", produces = {APPLICATION_JSON}, consumes = {APPLICATION_JSON})
+public class NssmfAdapterRest {
+
+ private static final Logger logger = LoggerFactory.getLogger(NssmfAdapterRest.class);
+
+ @Autowired
+ private NssmfManager nssmfMgr;
+
+ @PostMapping(value = "/NSS/SliceProfiles")
+ public ResponseEntity allocateNssi(@RequestBody NssiAllocateRequest allocate) {
+ try {
+ logger.info("Nssmi allocate request is invoked");
+ assertObjectNotNull(allocate);
+ RestResponse rsp = getNssmfMgr().allocateNssi(allocate);
+ return buildResponse(rsp);
+ } catch (ApplicationException e) {
+ return e.buildErrorResponse();
+ }
+ }
+
+ @PostMapping(value = "/NSS/nssi")
+ public ResponseEntity createNssi(@RequestBody NssiCreateRequest create) {
+ try {
+ logger.info("Nssmf create request is invoked");
+ assertObjectNotNull(create);
+ RestResponse rsp = getNssmfMgr().createNssi(create);
+ return buildResponse(rsp);
+ } catch (ApplicationException e) {
+ return e.buildErrorResponse();
+ }
+ }
+
+ @PostMapping(value = "/NSS/SliceProfiles/{sliceProfileId}")
+ public ResponseEntity deAllocateNssi(@RequestBody NssiDeAllocateRequest deAllocate,
+ @PathVariable("sliceProfileId") final String sliceId) {
+ try {
+ logger.info("Nssmf deallocate request is invoked");
+ assertObjectNotNull(deAllocate);
+ RestResponse rsp = getNssmfMgr().deAllocateNssi(deAllocate, sliceId);
+ return buildResponse(rsp);
+ } catch (ApplicationException e) {
+ return e.buildErrorResponse();
+ }
+ }
+
+ @PostMapping(value = "/NSS/nssi/{nssiId}")
+ public ResponseEntity terminateNssi(@RequestBody NssiTerminateRequest terminate,
+ @PathVariable("nssiId") String nssiId) {
+ try {
+ logger.info("Nssmf terminate request is invoked");
+ assertObjectNotNull(terminate);
+ RestResponse rsp = getNssmfMgr().terminateNssi(terminate, nssiId);
+ return buildResponse(rsp);
+ } catch (ApplicationException e) {
+ return e.buildErrorResponse();
+ }
+ }
+
+ @PutMapping(value = "/NSS/SliceProfiles/{sliceProfileId}")
+ public ResponseEntity modifyNssi(@RequestBody NssiUpdateRequest update,
+ @PathVariable("sliceProfileId") String sliceId) {
+ try {
+ logger.info("Nssmf modify request is invoked");
+ assertObjectNotNull(update);
+ RestResponse rsp = getNssmfMgr().updateNssi(update, sliceId);
+ return buildResponse(rsp);
+ } catch (ApplicationException e) {
+ return e.buildErrorResponse();
+ }
+ }
+
+ @PutMapping(value = "/NSS/nssi/{nssiId}")
+ public ResponseEntity modifyNssiById(@RequestBody NssiUpdateRequestById updateById,
+ @PathVariable("nssiId") String nssiId) {
+ try {
+ logger.info("Nssmf modify by ID request is invoked");
+ assertObjectNotNull(updateById);
+ RestResponse rsp = getNssmfMgr().updateNssiById(updateById, nssiId);
+ return buildResponse(rsp);
+ } catch (ApplicationException e) {
+ return e.buildErrorResponse();
+ }
+ }
+
+ @PostMapping(value = "/NSS/{snssai}/activation")
+ public ResponseEntity activateNssi(@RequestBody NssiActDeActRequest activate,
+ @PathVariable("snssai") String snssai) {
+ try {
+ logger.info("Nssmf activate request is invoked");
+ assertObjectNotNull(activate);
+ RestResponse rsp = getNssmfMgr().activateNssi(activate, snssai);
+ return buildResponse(rsp);
+ } catch (ApplicationException e) {
+ return e.buildErrorResponse();
+ }
+ }
+
+ @PostMapping(value = "/NSS/{snssai}/deactivation")
+ public ResponseEntity deactivateNssi(@RequestBody NssiActDeActRequest deActivate,
+ @PathVariable("snssai") String snssai) {
+ try {
+ logger.info("Nssmf activate request is invoked");
+ assertObjectNotNull(deActivate);
+ RestResponse rsp = getNssmfMgr().deActivateNssi(deActivate, snssai);
+ return buildResponse(rsp);
+ } catch (ApplicationException e) {
+ return e.buildErrorResponse();
+ }
+ }
+
+ @PostMapping(value = "/NSS/jobs/{jobId}")
+ public ResponseEntity queryJobStatus(@RequestBody JobStatusRequest jobStatusReq,
+ @PathVariable("jobId") String jobId) {
+ try {
+ logger.info("Nssmf query job status request is invoked");
+ assertObjectNotNull(jobStatusReq);
+ RestResponse rsp = getNssmfMgr().queryJobStatus(jobStatusReq, jobId);
+ return buildResponse(rsp);
+ } catch (ApplicationException e) {
+ return e.buildErrorResponse();
+ }
+ }
+
+ @GetMapping(value = "/vendor/{vendorName}/type/{networkType}/NSS" + "/SliceProfiles/{sliceProfileId}")
+ public ResponseEntity queryNssi(@PathVariable("vendorName") String vendorName,
+ @PathVariable("networktype") String networkType, @PathVariable("sliceProfileId") String sliceId) {
+ try {
+ logger.info("Nssmf query nssi request is invoked");
+ RestResponse rsp = getNssmfMgr().queryNssi(vendorName, networkType, sliceId);
+ return buildResponse(rsp);
+ } catch (ApplicationException e) {
+ return e.buildErrorResponse();
+ }
+ }
+
+ @GetMapping(value = "/vendor/{vendorName}/type/{networkType}/NSS/nssi" + "/{nssiId}")
+ public ResponseEntity queryNssiById(@PathVariable("vendorName") String vendorName,
+ @PathVariable("networkTtype") String networkType, @PathVariable("nssiId") String nssiId) {
+ try {
+ logger.info("Nssmf query nssi by ID request is invoked");
+ RestResponse rsp = getNssmfMgr().queryNssiById(vendorName, networkType, nssiId);
+ return buildResponse(rsp);
+ } catch (ApplicationException e) {
+ return e.buildErrorResponse();
+ }
+ }
+
+ public void setNssmfMgr(NssmfManager nssmfMgr) {
+ this.nssmfMgr = nssmfMgr;
+ }
+
+ public NssmfManager getNssmfMgr() {
+ return nssmfMgr;
+ }
+
+ private ResponseEntity buildResponse(RestResponse rsp) {
+ return ResponseEntity.status(rsp.getStatus()).body(rsp.getResponseContent());
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfInfo.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfInfo.java
new file mode 100644
index 0000000000..6306643a97
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfInfo.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.rest;
+
+public class NssmfInfo {
+
+ private String url;
+
+ private String ipAddress;
+
+ private String port;
+
+ private String insecure;
+
+ private String cacert;
+
+ private String userName;
+
+ private String password;
+
+ public String getInsecure() {
+ return insecure;
+ }
+
+ public void setInsecure(String insecure) {
+ this.insecure = insecure;
+ }
+
+ public String getCacert() {
+ return cacert;
+ }
+
+ public void setCacert(String cacert) {
+ this.cacert = cacert;
+ }
+
+ public String getIpAddress() {
+ return ipAddress;
+ }
+
+ public void setIpAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+
+ public String getPort() {
+ return port;
+ }
+
+ public void setPort(String port) {
+ this.port = port;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfManager.java
new file mode 100644
index 0000000000..0e25729610
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/NssmfManager.java
@@ -0,0 +1,541 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.rest;
+
+import org.onap.so.adapters.nssmf.exceptions.ApplicationException;
+import org.onap.so.beans.nsmf.ActDeActNssi;
+import org.onap.so.beans.nsmf.AllocateAnNssi;
+import org.onap.so.beans.nsmf.AllocateCnNssi;
+import org.onap.so.beans.nsmf.AllocateTnNssi;
+import org.onap.so.beans.nsmf.CreateCnNssi;
+import org.onap.so.beans.nsmf.DeAllocateNssi;
+import org.onap.so.beans.nsmf.EsrInfo;
+import org.onap.so.beans.nsmf.JobStatusRequest;
+import org.onap.so.beans.nsmf.JobStatusResponse;
+import org.onap.so.beans.nsmf.NetworkType;
+import org.onap.so.beans.nsmf.NssiActDeActRequest;
+import org.onap.so.beans.nsmf.NssiAllocateRequest;
+import org.onap.so.beans.nsmf.NssiCreateRequest;
+import org.onap.so.beans.nsmf.NssiDeAllocateRequest;
+import org.onap.so.beans.nsmf.NssiResponse;
+import org.onap.so.beans.nsmf.NssiTerminateRequest;
+import org.onap.so.beans.nsmf.NssiUpdateRequest;
+import org.onap.so.beans.nsmf.NssiUpdateRequestById;
+import org.onap.so.beans.nsmf.ResponseDescriptor;
+import org.onap.so.beans.nsmf.TerminateNssi;
+import org.onap.so.beans.nsmf.UpdateCnNssi;
+import org.onap.so.beans.nsmf.UpdateCnNssiById;
+import org.onap.so.db.request.beans.ResourceOperationStatus;
+import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Primary;
+import org.springframework.data.domain.Example;
+import org.springframework.stereotype.Component;
+import static java.lang.String.valueOf;
+import static org.onap.so.adapters.nssmf.rest.HttpMethod.DELETE;
+import static org.onap.so.adapters.nssmf.rest.HttpMethod.GET;
+import static org.onap.so.adapters.nssmf.rest.HttpMethod.POST;
+import static org.onap.so.adapters.nssmf.rest.HttpMethod.PUT;
+import static org.onap.so.adapters.nssmf.rest.JobStatus.ERROR;
+import static org.onap.so.adapters.nssmf.rest.JobStatus.FINISHED;
+import static org.onap.so.adapters.nssmf.rest.JobStatus.PROCESSING;
+import static org.onap.so.adapters.nssmf.rest.JobStatus.STARTED;
+import static org.onap.so.adapters.nssmf.rest.JobStatus.fromString;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.StatusDesc.ACTIVATE_NSS_SUCCESS;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.StatusDesc.ALLOCATE_NSS_SUCCESS;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.StatusDesc.CREATE_NSS_SUCCESS;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.StatusDesc.DEACTIVATE_NSS_SUCCESS;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.StatusDesc.DEALLOCATE_NSS_SUCCESS;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.StatusDesc.QUERY_JOB_STATUS_FAILED;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.StatusDesc.QUERY_JOB_STATUS_SUCCESS;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.assertObjectNotNull;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.marshal;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.unMarshal;
+import static org.onap.so.beans.nsmf.ActDeActNssi.ACT_URL;
+import static org.onap.so.beans.nsmf.ActDeActNssi.DE_ACT_URL;
+
+@Component
+@Primary
+public class NssmfManager {
+
+ private static final Logger logger = LoggerFactory.getLogger(NssmfManager.class);
+
+ public final static String QUERY = "/api/rest/provMns/v1/NSS" + "/SliceProfiles/{sliceProfileId}";
+
+ public final static String QUERY_BY_ID = "/api/rest/provMns/v1/NSS/nssi" + "/{nssiId}";
+
+ @Autowired
+ private ResourceOperationStatusRepository rscOperStatusRepo;
+
+ @Autowired
+ private RestUtil restUtil;
+
+
+ public RestResponse allocateNssi(NssiAllocateRequest nssmiAllocate) throws ApplicationException {
+
+ assertObjectNotNull(nssmiAllocate.getEsrInfo());
+ assertObjectNotNull(nssmiAllocate.getEsrInfo().getNetworkType());
+ assertObjectNotNull(nssmiAllocate.getEsrInfo().getVendor());
+
+ String nsiId = null;
+ String allocateReq = null;
+ String allocateUrl = null;
+ logger.info("Allocate Nssi for " + nssmiAllocate.getEsrInfo().getNetworkType() + " Network has begun");
+
+ switch (nssmiAllocate.getEsrInfo().getNetworkType()) {
+
+ case CORE:
+ AllocateCnNssi cn = nssmiAllocate.getAllocateCnNssi();
+ assertObjectNotNull(cn);
+ assertObjectNotNull(cn.getNsiInfo());
+ assertObjectNotNull(cn.getNsiInfo().getNsiId());
+ nsiId = cn.getNsiInfo().getNsiId();
+ assertObjectNotNull(nsiId);
+ allocateReq = marshal(cn);
+ allocateUrl = AllocateCnNssi.URL;
+ break;
+
+ case ACCESS:
+ AllocateAnNssi an = nssmiAllocate.getAllocateAnNssi();
+ assertObjectNotNull(an);
+ assertObjectNotNull(an.getNsiInfo());
+ assertObjectNotNull(an.getNsiInfo().getNsiId());
+ nsiId = an.getNsiInfo().getNsiId();
+ assertObjectNotNull(nsiId);
+ allocateReq = marshal(an);
+ allocateUrl = AllocateAnNssi.URL;
+ break;
+
+ case TRANSPORT:
+ AllocateTnNssi tn = nssmiAllocate.getAllocateTnNssi();
+ assertObjectNotNull(tn);
+ assertObjectNotNull(tn.getNsiInfo());
+ assertObjectNotNull(tn.getNsiInfo().getNsiId());
+ nsiId = tn.getNsiInfo().getNsiId();
+ allocateReq = marshal(tn);
+ allocateUrl = AllocateTnNssi.URL;
+ break;
+
+ }
+ RestResponse rsp = restUtil.sendRequest(allocateUrl, POST, allocateReq, nssmiAllocate.getEsrInfo());
+ assertObjectNotNull(rsp);
+
+ if (valueOf(rsp.getStatus()).startsWith("2")) {
+ NssiResponse allocateRes = unMarshal(rsp.getResponseContent(), NssiResponse.class);
+
+ ResourceOperationStatus status =
+ new ResourceOperationStatus(allocateRes.getNssiId(), allocateRes.getJobId(), nsiId);
+ logger.info("save segment and operaton info -> begin");
+ updateDbStatus(status, rsp.getStatus(), STARTED, ALLOCATE_NSS_SUCCESS);
+ logger.info("save segment and operation info -> end");
+ }
+ return rsp;
+ }
+
+ public RestResponse createNssi(NssiCreateRequest nssiCreate) throws ApplicationException {
+
+ assertObjectNotNull(nssiCreate.getEsrInfo());
+ assertObjectNotNull(nssiCreate.getEsrInfo().getNetworkType());
+ assertObjectNotNull(nssiCreate.getEsrInfo().getVendor());
+
+ String nsiId = null;
+ String createReq = null;
+ String createUrl = null;
+ logger.info("Create Nssi for " + nssiCreate.getEsrInfo().getNetworkType() + " Network has begun");
+
+ switch (nssiCreate.getEsrInfo().getNetworkType()) {
+ case CORE:
+ CreateCnNssi cn = nssiCreate.getCreateCnNssi();
+ nsiId = cn.getNsiInfo().getNsiId();
+ assertObjectNotNull(nsiId);
+ createReq = marshal(cn);
+ createUrl = AllocateCnNssi.URL;
+ break;
+
+ case ACCESS:
+ case TRANSPORT:
+ throw new ApplicationException(1, "Create Nssi doesn't " + "support the Network type:"
+ + nssiCreate.getEsrInfo().getNetworkType());
+ }
+ RestResponse rsp = restUtil.sendRequest(createUrl, POST, createReq, nssiCreate.getEsrInfo());
+ assertObjectNotNull(rsp);
+
+ if (valueOf(rsp.getStatus()).startsWith("2")) {
+ NssiResponse allocateRes = unMarshal(rsp.getResponseContent(), NssiResponse.class);
+
+ ResourceOperationStatus status =
+ new ResourceOperationStatus(allocateRes.getNssiId(), allocateRes.getJobId(), nsiId);
+ logger.info("save segment and operaton info -> begin");
+ updateDbStatus(status, rsp.getStatus(), STARTED, CREATE_NSS_SUCCESS);
+ logger.info("save segment and operaton info -> end");
+ }
+ return rsp;
+ }
+
+ public RestResponse deAllocateNssi(NssiDeAllocateRequest nssiDeallocate, String sliceId)
+ throws ApplicationException {
+
+ assertObjectNotNull(nssiDeallocate.getEsrInfo());
+ assertObjectNotNull(nssiDeallocate.getEsrInfo().getNetworkType());
+ assertObjectNotNull(nssiDeallocate.getEsrInfo().getVendor());
+
+ DeAllocateNssi deAllocate = nssiDeallocate.getDeAllocateNssi();
+
+ assertObjectNotNull(sliceId);
+ assertObjectNotNull(deAllocate.getNssiId());
+ assertObjectNotNull(deAllocate.getNsiId());
+
+ String deallocateUrl = formTnAndAnUrl(nssiDeallocate.getEsrInfo(), DeAllocateNssi.URL, sliceId);
+ String deAllocateReq = marshal(deAllocate);
+
+ logger.info("Deallocate Nssi has begun");
+
+ RestResponse rsp = restUtil.sendRequest(deallocateUrl, DELETE, deAllocateReq, nssiDeallocate.getEsrInfo());
+ assertObjectNotNull(rsp);
+
+ if (valueOf(rsp.getStatus()).startsWith("2")) {
+ NssiResponse res = unMarshal(rsp.getResponseContent(), NssiResponse.class);
+
+ ResourceOperationStatus status =
+ new ResourceOperationStatus(deAllocate.getNssiId(), res.getJobId(), deAllocate.getNsiId());
+ logger.info("save segment and operaton info -> begin");
+ updateDbStatus(status, rsp.getStatus(), STARTED, DEALLOCATE_NSS_SUCCESS);
+ logger.info("save segment and operaton info -> end");
+ }
+ return rsp;
+ }
+
+ private String formTnAndAnUrl(EsrInfo esrInfo, String origUrl, String variable) {
+
+ origUrl = formatUrl(origUrl, variable);
+ String[] val;
+
+ switch (esrInfo.getNetworkType()) {
+
+ case TRANSPORT:
+ val = origUrl.split("v1");
+ return val[0] + "v1/tn" + val[1];
+
+ case ACCESS:
+ val = origUrl.split("v1");
+ return val[0] + "v1/an" + val[1];
+
+ case CORE:
+ return origUrl;
+ }
+ return origUrl;
+ }
+
+ private String formatUrl(String origUrl, String variable) {
+
+ if (variable != null) {
+ origUrl = String.format(origUrl, variable);
+ }
+ return origUrl;
+ }
+
+
+ public RestResponse terminateNssi(NssiTerminateRequest nssiTerminate, String nssiId) throws ApplicationException {
+
+ assertObjectNotNull(nssiTerminate.getEsrInfo());
+ assertObjectNotNull(nssiTerminate.getEsrInfo().getNetworkType());
+ assertObjectNotNull(nssiTerminate.getEsrInfo().getVendor());
+
+ TerminateNssi terminate = nssiTerminate.getTerminateNssi();
+
+ assertObjectNotNull(nssiId);
+ assertObjectNotNull(terminate.getNsiId());
+
+ logger.info("Terminate Nssi has begun");
+
+ String terminateUrl = formTnAndAnUrl(nssiTerminate.getEsrInfo(), TerminateNssi.URL, nssiId);
+ String terminateReq = marshal(terminate);
+
+ RestResponse rsp = restUtil.sendRequest(terminateUrl, DELETE, terminateReq, nssiTerminate.getEsrInfo());
+ assertObjectNotNull(rsp);
+
+ if (valueOf(rsp.getStatus()).startsWith("2")) {
+ NssiResponse res = unMarshal(rsp.getResponseContent(), NssiResponse.class);
+
+ ResourceOperationStatus status = new ResourceOperationStatus(nssiId, res.getJobId(), terminate.getNsiId());
+ logger.info("save segment and operaton info -> begin");
+ updateDbStatus(status, rsp.getStatus(), STARTED, DEALLOCATE_NSS_SUCCESS);
+ logger.info("save segment and operaton info -> end");
+ }
+ return rsp;
+ }
+
+ public RestResponse activateNssi(NssiActDeActRequest nssiActivate, String snssai) throws ApplicationException {
+
+ assertObjectNotNull(nssiActivate.getEsrInfo());
+ assertObjectNotNull(nssiActivate.getEsrInfo().getNetworkType());
+ assertObjectNotNull(nssiActivate.getEsrInfo().getVendor());
+
+ ActDeActNssi activate = nssiActivate.getActDeActNssi();
+
+ assertObjectNotNull(snssai);
+ assertObjectNotNull(activate.getNssiId());
+ assertObjectNotNull(activate.getNsiId());
+
+ logger.info("Activate Nssi has begun");
+
+ String activateUrl = formTnAndAnUrl(nssiActivate.getEsrInfo(), ACT_URL, snssai);
+ String activateReq = marshal(activate);
+
+ RestResponse rsp = restUtil.sendRequest(activateUrl, PUT, activateReq, nssiActivate.getEsrInfo());
+ assertObjectNotNull(rsp);
+
+ if (valueOf(rsp.getStatus()).startsWith("2")) {
+ NssiResponse activateRes = unMarshal(rsp.getResponseContent(), NssiResponse.class);
+
+ ResourceOperationStatus status =
+ new ResourceOperationStatus(activate.getNssiId(), activateRes.getJobId(), activate.getNsiId());
+ logger.info("save segment and operaton info -> begin");
+ updateDbStatus(status, rsp.getStatus(), STARTED, ACTIVATE_NSS_SUCCESS);
+ logger.info("save segment and operaton info -> end");
+ }
+ return rsp;
+ }
+
+ public RestResponse deActivateNssi(NssiActDeActRequest nssiDeActivate, String snssai) throws ApplicationException {
+
+ assertObjectNotNull(nssiDeActivate.getEsrInfo());
+ assertObjectNotNull(nssiDeActivate.getEsrInfo().getNetworkType());
+ assertObjectNotNull(nssiDeActivate.getEsrInfo().getVendor());
+
+ logger.info("Deactivate Nssi has begun");
+
+ ActDeActNssi deActivate = nssiDeActivate.getActDeActNssi();
+
+ assertObjectNotNull(snssai);
+ assertObjectNotNull(deActivate.getNssiId());
+ assertObjectNotNull(deActivate.getNsiId());
+
+ String deActivateUrl = formTnAndAnUrl(nssiDeActivate.getEsrInfo(), DE_ACT_URL, snssai);
+ String deActivateReq = marshal(deActivate);
+
+ RestResponse rsp = restUtil.sendRequest(deActivateUrl, PUT, deActivateReq, nssiDeActivate.getEsrInfo());
+ assertObjectNotNull(rsp);
+
+ if (valueOf(rsp.getStatus()).startsWith("2")) {
+ NssiResponse deActivateRes = unMarshal(rsp.getResponseContent(), NssiResponse.class);
+
+ ResourceOperationStatus status = new ResourceOperationStatus(deActivate.getNssiId(),
+ deActivateRes.getJobId(), deActivate.getNsiId());
+ logger.info("save segment and operaton info -> begin");
+ updateDbStatus(status, rsp.getStatus(), STARTED, DEACTIVATE_NSS_SUCCESS);
+ logger.info("save segment and operaton info -> end");
+ }
+ return rsp;
+ }
+
+ public RestResponse queryJobStatus(JobStatusRequest jobReq, String jobId) throws ApplicationException {
+
+ assertObjectNotNull(jobReq.getEsrInfo());
+ assertObjectNotNull(jobReq.getEsrInfo().getNetworkType());
+ assertObjectNotNull(jobReq.getEsrInfo().getVendor());
+ assertObjectNotNull(jobId);
+ assertObjectNotNull(jobReq.getNssiId());
+ assertObjectNotNull(jobReq.getNsiId());
+
+ logger.info("Query job status has begun");
+
+ ResourceOperationStatus status = new ResourceOperationStatus(jobReq.getNssiId(), jobId, jobReq.getNsiId());
+ status = rscOperStatusRepo.findOne(Example.of(status))
+ .orElseThrow(() -> new ApplicationException(404, "Cannot Find Operation Status"));
+
+ String statusUrl = formatUrl(JobStatusRequest.URL, jobId);
+ if (jobReq.getResponseId() != null) {
+ statusUrl = statusUrl + "?responseId=" + jobReq.getResponseId();
+ }
+
+ RestResponse rsp = restUtil.sendRequest(statusUrl, GET, "", jobReq.getEsrInfo());
+ assertObjectNotNull(rsp);
+
+ if (!valueOf(rsp.getStatus()).startsWith("2")) {
+ updateDbStatus(status, rsp.getStatus(), ERROR, QUERY_JOB_STATUS_FAILED);
+ throw new ApplicationException(500, QUERY_JOB_STATUS_FAILED);
+ }
+
+ ResponseDescriptor rspDesc =
+ unMarshal(rsp.getResponseContent(), JobStatusResponse.class).getResponseDescriptor();
+ logger.info("save segment and operaton info -> begin");
+ updateRequestDbJobStatus(rspDesc, status, rsp);
+ logger.info("save segment and operaton info -> end");
+ return rsp;
+ }
+
+
+ public RestResponse updateNssi(NssiUpdateRequest nssiUpdate, String sliceId) throws ApplicationException {
+
+ assertObjectNotNull(nssiUpdate.getEsrInfo());
+ assertObjectNotNull(nssiUpdate.getEsrInfo().getNetworkType());
+ assertObjectNotNull(nssiUpdate.getEsrInfo().getVendor());
+ assertObjectNotNull(sliceId);
+
+ String nsiId = null;
+ String nssiId = null;
+ String updateReq = null;
+ String updateUrl = null;
+ logger.info("Update Nssi for " + nssiUpdate.getEsrInfo().getNetworkType() + " Network has begun");
+
+ switch (nssiUpdate.getEsrInfo().getNetworkType()) {
+ case CORE:
+ UpdateCnNssi cn = nssiUpdate.getUpdateCnNssi();
+ nsiId = cn.getNsiInfo().getNsiId();
+ nssiId = cn.getNssiId();
+ assertObjectNotNull(nsiId);
+ assertObjectNotNull(nssiId);
+ updateReq = marshal(cn);
+ updateUrl = formatUrl(UpdateCnNssi.URL, sliceId);
+ break;
+
+ case ACCESS:
+ case TRANSPORT:
+ throw new ApplicationException(1, "Update Nssi doesn't " + "support the Network type:"
+ + nssiUpdate.getEsrInfo().getNetworkType());
+ }
+
+ RestResponse rsp = restUtil.sendRequest(updateUrl, PUT, updateReq, nssiUpdate.getEsrInfo());
+ assertObjectNotNull(rsp);
+
+ if (valueOf(rsp.getStatus()).startsWith("2")) {
+ NssiResponse allocateRes = unMarshal(rsp.getResponseContent(), NssiResponse.class);
+
+ ResourceOperationStatus status = new ResourceOperationStatus(nssiId, allocateRes.getJobId(), nsiId);
+ logger.info("save segment and operaton info -> begin");
+ updateDbStatus(status, rsp.getStatus(), STARTED, ALLOCATE_NSS_SUCCESS);
+ logger.info("save segment and operaton info -> end");
+ }
+ return rsp;
+ }
+
+ public RestResponse updateNssiById(NssiUpdateRequestById nssiUpdateById, String nssiId)
+ throws ApplicationException {
+
+ assertObjectNotNull(nssiUpdateById.getEsrInfo());
+ assertObjectNotNull(nssiUpdateById.getEsrInfo().getNetworkType());
+ assertObjectNotNull(nssiUpdateById.getEsrInfo().getVendor());
+ assertObjectNotNull(nssiId);
+
+ String nsiId = null;
+ String updateReq = null;
+ String updateUrl = null;
+ logger.info("Update Nssi by ID for " + nssiUpdateById.getEsrInfo().getNetworkType() + " Network has begun");
+
+ switch (nssiUpdateById.getEsrInfo().getNetworkType()) {
+ case CORE:
+ UpdateCnNssiById cn = nssiUpdateById.getUpdateCnNssiById();
+ nsiId = cn.getNsiInfo().getNsiId();
+ assertObjectNotNull(nsiId);
+ updateReq = marshal(cn);
+ updateUrl = formatUrl(UpdateCnNssiById.URL, nssiId);
+ break;
+
+ case ACCESS:
+ case TRANSPORT:
+ throw new ApplicationException(1, "Update Nssi doesn't " + "support the Network type:"
+ + nssiUpdateById.getEsrInfo().getNetworkType());
+ }
+
+ RestResponse rsp = restUtil.sendRequest(updateUrl, PUT, updateReq, nssiUpdateById.getEsrInfo());
+ assertObjectNotNull(rsp);
+
+ if (valueOf(rsp.getStatus()).startsWith("2")) {
+ NssiResponse allocateRes = unMarshal(rsp.getResponseContent(), NssiResponse.class);
+
+ ResourceOperationStatus status = new ResourceOperationStatus(nssiId, allocateRes.getJobId(), nsiId);
+ logger.info("save segment and operaton info -> begin");
+ updateDbStatus(status, rsp.getStatus(), STARTED, ALLOCATE_NSS_SUCCESS);
+ logger.info("save segment and operaton info -> end");
+ }
+ return rsp;
+ }
+
+ public RestResponse queryNssi(String vendor, String type, String sliceId) throws ApplicationException {
+
+ logger.info("Query Nssi has begun");
+ String getUrl = formatUrl(QUERY, sliceId);
+ EsrInfo esr = new EsrInfo();
+ esr.setVendor(vendor);
+ esr.setNetworkType(NetworkType.valueOf(type));
+ RestResponse rsp = restUtil.sendRequest(getUrl, GET, "", esr);
+ assertObjectNotNull(rsp);
+ return rsp;
+ }
+
+ public RestResponse queryNssiById(String vendor, String type, String nssiId) throws ApplicationException {
+
+ logger.info("Query Nssi by ID has begun");
+ String getUrl = formatUrl(QUERY_BY_ID, nssiId);
+ EsrInfo esr = new EsrInfo();
+ esr.setVendor(vendor);
+ esr.setNetworkType(NetworkType.valueOf(type));
+ RestResponse rsp = restUtil.sendRequest(getUrl, GET, "", esr);
+ assertObjectNotNull(rsp);
+ return rsp;
+ }
+
+ private void updateRequestDbJobStatus(ResponseDescriptor rspDesc, ResourceOperationStatus status, RestResponse rsp)
+ throws ApplicationException {
+
+ switch (fromString(rspDesc.getStatus())) {
+
+ case STARTED:
+ updateDbStatus(status, rsp.getStatus(), STARTED, QUERY_JOB_STATUS_SUCCESS);
+ break;
+
+ case ERROR:
+ updateDbStatus(status, rsp.getStatus(), ERROR, QUERY_JOB_STATUS_FAILED);
+ throw new ApplicationException(500, QUERY_JOB_STATUS_FAILED);
+
+ case FINISHED:
+ if (rspDesc.getProgress() == 100) {
+ updateDbStatus(status, rsp.getStatus(), FINISHED, QUERY_JOB_STATUS_SUCCESS);
+ }
+ break;
+
+ case PROCESSING:
+ updateDbStatus(status, rsp.getStatus(), PROCESSING, QUERY_JOB_STATUS_SUCCESS);
+ break;
+ }
+ }
+
+ private void updateDbStatus(ResourceOperationStatus status, int rspStatus, JobStatus jobStatus,
+ String description) {
+ status.setErrorCode(valueOf(rspStatus));
+ status.setStatus(jobStatus.toString());
+ status.setStatusDescription(description);
+ logger.info("Updating DB status");
+ rscOperStatusRepo.save(status);
+ logger.info("Updating successful");
+ }
+
+ public void setRscOperStatusRepo(ResourceOperationStatusRepository rscOperStatusRepo) {
+ this.rscOperStatusRepo = rscOperStatusRepo;
+ }
+
+ public void setRestUtil(RestUtil restUtil) {
+ this.restUtil = restUtil;
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/RestResponse.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/RestResponse.java
new file mode 100644
index 0000000000..cc047e45c7
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/RestResponse.java
@@ -0,0 +1,92 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.rest;
+
+import java.util.Map;
+
+public class RestResponse {
+
+ // the response content
+ private String responseContent;
+
+ // the response status
+ private int status;
+
+ // the response header
+ private Map<String, String> respHeaderMap;
+
+ public RestResponse() {
+ this.status = -1;
+
+ this.respHeaderMap = null;
+ }
+
+ public int getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ public Map<String, String> getRespHeaderMap() {
+ return this.respHeaderMap;
+ }
+
+ public void setRespHeaderMap(Map<String, String> header) {
+ this.respHeaderMap = header;
+ }
+
+ public int getRespHeaderInt(String key) {
+ if (this.respHeaderMap != null) {
+ String result = this.respHeaderMap.get(key);
+ if (result != null) {
+ return Integer.parseInt(result);
+ }
+ }
+ return -1;
+ }
+
+ public long getRespHeaderLong(String key) {
+ if (this.respHeaderMap != null) {
+ String result = this.respHeaderMap.get(key);
+ if (result != null) {
+ return Long.parseLong(result);
+ }
+ }
+ return -1L;
+ }
+
+ public String getRespHeaderStr(String key) {
+ if (this.respHeaderMap != null) {
+ return this.respHeaderMap.get(key);
+ }
+ return null;
+ }
+
+ public String getResponseContent() {
+ return this.responseContent;
+ }
+
+ public void setResponseContent(String responseString) {
+ this.responseContent = responseString;
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/RestUtil.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/RestUtil.java
new file mode 100644
index 0000000000..dcc6f5ba72
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/RestUtil.java
@@ -0,0 +1,307 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.rest;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import javax.ws.rs.core.UriBuilder;
+import java.net.SocketTimeoutException;
+import java.net.URI;
+import org.apache.http.Header;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.conn.ConnectTimeoutException;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicHeader;
+import org.apache.http.util.EntityUtils;
+import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.aai.domain.yang.EsrSystemInfoList;
+import org.onap.aai.domain.yang.EsrThirdpartySdnc;
+import org.onap.aai.domain.yang.EsrThirdpartySdncList;
+import org.onap.so.adapters.nssmf.exceptions.ApplicationException;
+import org.onap.so.adapters.nssmf.extclients.aai.AaiServiceProvider;
+import org.onap.so.adapters.nssmf.model.TokenRequest;
+import org.onap.so.adapters.nssmf.model.TokenResponse;
+import org.onap.so.beans.nsmf.EsrInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import static org.apache.http.entity.ContentType.APPLICATION_JSON;
+import static org.onap.so.adapters.nssmf.rest.HttpMethod.POST;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.BAD_REQUEST;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.marshal;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.unMarshal;
+import static org.onap.logging.filter.base.ErrorCode.AvailabilityError;
+import static org.onap.so.logger.LoggingAnchor.FOUR;
+import static org.onap.so.logger.MessageEnum.RA_NS_EXC;
+
+@Component
+public class RestUtil {
+
+ private static final Logger logger = LoggerFactory.getLogger(RestUtil.class);
+
+ private static final int DEFAULT_TIME_OUT = 60000;
+
+ private static final String NSSMI_ADAPTER = "NSSMI Adapter";
+
+ private static final String TOKEN_URL = "/api/rest/securityManagement/v1" + "/oauth/token";
+
+ @Autowired
+ private AaiServiceProvider aaiSvcProv;
+
+
+ public NssmfInfo getNssmfHost(EsrInfo esrInfo) throws ApplicationException {
+ EsrThirdpartySdncList sdncList = aaiSvcProv.invokeGetThirdPartySdncList();
+ if (sdncList != null && sdncList.getEsrThirdpartySdnc() != null) {
+ for (EsrThirdpartySdnc sdncEsr : sdncList.getEsrThirdpartySdnc()) {
+
+ EsrSystemInfoList sysInfoList =
+ aaiSvcProv.invokeGetThirdPartySdncEsrSystemInfo(sdncEsr.getThirdpartySdncId());
+
+ if (sysInfoList != null && sysInfoList.getEsrSystemInfo() != null) {
+ for (EsrSystemInfo esr : sysInfoList.getEsrSystemInfo()) {
+ if (esr != null && esr.getType().equals(esrInfo.getNetworkType().getNetworkType())
+ && esr.getVendor().equals(esrInfo.getVendor())) {
+ logger.info("Found an entry with vendor name " + esrInfo.getVendor() + " and network type "
+ + esrInfo.getNetworkType() + " in ESR.");
+ NssmfInfo nssmfInfo = new NssmfInfo();
+ nssmfInfo.setIpAddress(esr.getIpAddress());
+ nssmfInfo.setPort(esr.getPort());
+ nssmfInfo.setCacert(esr.getSslCacert());
+ nssmfInfo.setUserName(esr.getUserName());
+ nssmfInfo.setPassword(esr.getPassword());
+ String endPoint = UriBuilder.fromPath("").host(esr.getIpAddress())
+ .port(Integer.valueOf(esr.getPort())).scheme("https").build().toString();
+ nssmfInfo.setUrl(endPoint);
+ return nssmfInfo;
+ }
+ }
+ }
+
+ }
+ }
+
+ throw new ApplicationException(BAD_REQUEST, "ESR information is improper");
+ }
+
+ public RestResponse sendRequest(String url, HttpMethod methodType, String content, EsrInfo esrInfo)
+ throws ApplicationException {
+
+ NssmfInfo nssmfInfo = getNssmfHost(esrInfo);
+
+ TokenRequest req = new TokenRequest();
+ req.setGrantType("password");
+ req.setUserName(nssmfInfo.getUserName());
+ req.setValue(nssmfInfo.getPassword());
+
+ String tokenReq = marshal(req);
+
+ logger.info("Sending token request to NSSMF: " + tokenReq);
+ RestResponse tokenRes = send(nssmfInfo.getUrl() + TOKEN_URL, POST, tokenReq, null);
+
+ TokenResponse res = unMarshal(tokenRes.getResponseContent(), TokenResponse.class);
+ String token = res.getAccessToken();
+ Header header = new BasicHeader("X-Auth-Token", token);
+ String nssmfUrl = nssmfInfo.getUrl() + url;
+ return send(nssmfUrl, methodType, content, header);
+ }
+
+ private RestResponse send(String url, HttpMethod methodType, String content, Header header) {
+
+ HttpRequestBase req = null;
+ HttpResponse res = null;
+
+ logger.debug("Beginning to send message {}: {}", methodType, url);
+
+ try {
+ int timeout = DEFAULT_TIME_OUT;
+
+ RequestConfig config = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
+ .setConnectionRequestTimeout(timeout).build();
+ logger.debug("Sending request to NSSMF: " + content);
+ req = getHttpReq(url, methodType, header, config, content);
+ res = getHttpsClient().execute(req);
+
+ String resContent = null;
+ if (res.getEntity() != null) {
+ resContent = EntityUtils.toString(res.getEntity(), "UTF-8");
+ }
+
+ int statusCode = res.getStatusLine().getStatusCode();
+ String statusMessage = res.getStatusLine().getReasonPhrase();
+ logger.info("NSSMF Response: {} {}", statusCode,
+ statusMessage + (resContent == null ? "" : System.lineSeparator() + resContent));
+
+ if (res.getStatusLine().getStatusCode() >= 300) {
+ String errMsg = "{\n \"errorCode\": " + res.getStatusLine().getStatusCode()
+ + "\n \"errorDescription\": " + statusMessage + "\n}";
+ logError(errMsg);
+ return createResponse(statusCode, errMsg);
+ }
+ if (null != req) {
+ req.reset();
+ } else {
+ logger.debug("method is NULL:");
+ }
+ req = null;
+
+ return createResponse(statusCode, resContent);
+
+ } catch (SocketTimeoutException | ConnectTimeoutException e) {
+ String errMsg = "Request to NSSMF timed out";
+ logError(errMsg, e);
+ return createResponse(408, errMsg);
+ } catch (Exception e) {
+ String errMsg = "Error processing request to NSSMF";
+ logError(errMsg, e);
+ return createResponse(500, errMsg);
+ } finally {
+ if (res != null) {
+ try {
+ EntityUtils.consume(res.getEntity());
+ } catch (Exception e) {
+ logger.debug("Exception :", e);
+ }
+ }
+ if (req != null) {
+ try {
+ req.reset();
+ } catch (Exception e) {
+ logger.debug("Exception :", e);
+ }
+ }
+ }
+ }
+
+ private RestResponse createResponse(int statusCode, String errMsg) {
+ RestResponse restResponse = new RestResponse();
+ restResponse.setStatus(statusCode);
+ restResponse.setResponseContent(errMsg);
+ return restResponse;
+ }
+
+ private HttpRequestBase getHttpReq(String url, HttpMethod method, Header header, RequestConfig config,
+ String content) throws ApplicationException {
+ HttpRequestBase base = null;
+ switch (method) {
+ case POST:
+ HttpPost post = new HttpPost(url);
+ post.setEntity(new StringEntity(content, APPLICATION_JSON));
+ base = post;
+ break;
+
+ case GET:
+ base = new HttpGet(url);
+ break;
+
+ case PUT:
+ HttpPut put = new HttpPut(url);
+ put.setEntity(new StringEntity(content, APPLICATION_JSON));
+ base = put;
+ break;
+
+ case PATCH:
+ break;
+
+ case DELETE:
+ HttpDeleteWithBody delete = new HttpDeleteWithBody(url);
+ if (content != null) {
+ delete.setEntity(new StringEntity(content, APPLICATION_JSON));
+ }
+ base = delete;
+ break;
+
+ }
+ base.setConfig(config);
+ if (header != null) {
+ base.setHeader(header);
+ }
+ return base;
+ }
+
+ class HttpDeleteWithBody extends HttpEntityEnclosingRequestBase {
+ public static final String METHOD_NAME = "DELETE";
+
+ public String getMethod() {
+ return METHOD_NAME;
+ }
+
+ public HttpDeleteWithBody(final String uri) {
+ super();
+ setURI(URI.create(uri));
+ }
+
+ public HttpDeleteWithBody(final URI uri) {
+ super();
+ setURI(uri);
+ }
+
+ public HttpDeleteWithBody() {
+ super();
+ }
+ }
+
+
+ public HttpClient getHttpsClient() {
+
+ TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
+ public java.security.cert.X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+
+ public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {}
+
+ public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {}
+ }};
+
+ // Install the all-trusting trust manager
+ try {
+ SSLContext sc = SSLContext.getInstance("SSL");
+ sc.init(null, trustAllCerts, new java.security.SecureRandom());
+ // HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
+
+ SSLConnectionSocketFactory sslsf =
+ new SSLConnectionSocketFactory(sc, new String[] {"TLSv1"}, null, new TrustAllHostNameVerifier());
+ return HttpClients.custom().setSSLSocketFactory(sslsf).build();
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ private static void logError(String errMsg, Throwable t) {
+ logger.error(FOUR, RA_NS_EXC.toString(), NSSMI_ADAPTER, AvailabilityError.getValue(), errMsg, t);
+ }
+
+ private static void logError(String errMsg) {
+ logger.error(FOUR, RA_NS_EXC.toString(), NSSMI_ADAPTER, AvailabilityError.toString(), errMsg);
+ }
+}
+
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/TrustAllHostNameVerifier.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/TrustAllHostNameVerifier.java
new file mode 100644
index 0000000000..254186bda8
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/rest/TrustAllHostNameVerifier.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.rest;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLSession;
+
+public class TrustAllHostNameVerifier implements HostnameVerifier {
+
+ public boolean verify(String hostname, SSLSession session) {
+ return true;
+ }
+
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/NssmfAdapterUtil.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/NssmfAdapterUtil.java
new file mode 100644
index 0000000000..3a7c2f19df
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/util/NssmfAdapterUtil.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf.util;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import org.onap.so.adapters.nssmf.exceptions.ApplicationException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.onap.logging.filter.base.ErrorCode;
+import static org.onap.so.logger.LoggingAnchor.THREE;
+import static org.onap.so.logger.MessageEnum.RA_NS_EXC;
+
+public class NssmfAdapterUtil {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(NssmfAdapterUtil.class);
+
+ public static final int BAD_REQUEST = 400;
+
+ private static final String UNMARSHAL_FAIL_MSG = "Failed to unmarshal json";
+
+ private static final String MARSHAL_FAIL_MSG = "Failed to marshal object";
+
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
+ public static class StatusDesc {
+
+ public static final String ALLOCATE_NSS_SUCCESS = "Allocating nss is " + "successful";
+
+ public static final String CREATE_NSS_SUCCESS = "Creating nss is " + "successful";
+
+ public static final String DEALLOCATE_NSS_SUCCESS = "Deallocate nss " + "is successful";
+
+ public static final String ACTIVATE_NSS_SUCCESS = "Activate nss " + "is successful";
+
+ public static final String DEACTIVATE_NSS_SUCCESS = "Deactivate nss " + "is successful";
+
+ public static final String QUERY_JOB_STATUS_FAILED = "Query job " + "status failed";
+
+ public static final String QUERY_JOB_STATUS_SUCCESS = "Query job " + "status is successful";
+
+ private StatusDesc() {
+
+ }
+ }
+
+ private NssmfAdapterUtil() {
+
+ }
+
+ public static void assertObjectNotNull(Object object) throws ApplicationException {
+ if (null == object) {
+ LOGGER.error("Object is null.");
+ throw new ApplicationException(BAD_REQUEST, "An object is null.");
+ }
+ }
+
+ public static <T> T unMarshal(String jsonstr, Class<T> type) throws ApplicationException {
+ try {
+ return MAPPER.readValue(jsonstr, type);
+ } catch (IOException e) {
+ LOGGER.error(THREE, RA_NS_EXC.toString(), ErrorCode.BusinessProcessError.getValue(), UNMARSHAL_FAIL_MSG, e);
+ throw new ApplicationException(BAD_REQUEST, UNMARSHAL_FAIL_MSG);
+ }
+ }
+
+ public static String marshal(Object srcObj) throws ApplicationException {
+ try {
+ return MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(srcObj);
+ } catch (IOException e) {
+ LOGGER.error(THREE, RA_NS_EXC.toString(), ErrorCode.BusinessProcessError.getValue(), MARSHAL_FAIL_MSG, e);
+ throw new ApplicationException(BAD_REQUEST, MARSHAL_FAIL_MSG);
+ }
+ }
+
+}
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties b/adapters/mso-nssmf-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
new file mode 100644
index 0000000000..f93ec63f37
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
@@ -0,0 +1 @@
+org.onap.so.adapters.nssmf.extclients.aai.AaiClientPropertiesImpl \ No newline at end of file
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/application.yaml b/adapters/mso-nssmf-adapter/src/main/resources/application.yaml
new file mode 100644
index 0000000000..cb2f04d7ec
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/resources/application.yaml
@@ -0,0 +1,61 @@
+#
+# ============LICENSE_START=======================================================
+# ONAP - SO
+# ================================================================================
+# Copyright (C) 2020 Huawei Technologies Co., Ltd. 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=========================================================
+#/
+aai:
+ auth: 2A11B07DB6214A839394AA1EC5844695F5114FC407FF5422625FB00175A3DCB8A1FF745F22867EFA72D5369D599BBD88DA8BED4233CF5586
+ endpoint: https://aai.onap:30233
+logging:
+ path: logs
+
+spring:
+ datasource:
+ driver-class-name: org.mariadb.jdbc.Driver
+ jdbcUrl: jdbc:mariadb://192.168.235.44:30444/requestdb
+ username: root
+ password: secretpassword
+
+ jpa:
+ show-sql: false
+ hibernate:
+ dialect: org.hibernate.dialect.MySQL5Dialect
+ ddl-auto: validate
+ naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
+ enable-lazy-load-no-trans: true
+server:
+ port: 8080
+ tomcat:
+ max-threads: 50
+
+mso:
+ key: 07a7159d3bf51a0e53be7a8f89699be7
+ site-name: localSite
+ logPath: ./logs/nssmf
+ msb-ip: msb-iag.{{ include "common.namespace" . }}
+ msb-port: 80
+ adapters:
+ requestDb:
+ endpoint: https://so-request-db-adapter.{{ include "common.namespace" . }}:8083
+ auth: Basic YnBlbDpwYXNzd29yZDEk
+
+#Actuator
+management:
+ security:
+ enabled: false
+ basic:
+ enabled: false \ No newline at end of file
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/nssmf.jks b/adapters/mso-nssmf-adapter/src/main/resources/nssmf.jks
new file mode 100644
index 0000000000..2ecce5bd3d
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/resources/nssmf.jks
Binary files differ
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/nssmf.p12 b/adapters/mso-nssmf-adapter/src/main/resources/nssmf.p12
new file mode 100644
index 0000000000..25e7fbfca9
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/resources/nssmf.p12
Binary files differ
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.jks b/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.jks
new file mode 100644
index 0000000000..f7cd9e8f86
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.jks
Binary files differ
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.p12 b/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.p12
new file mode 100644
index 0000000000..1927b1f13f
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.p12
Binary files differ
diff --git a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java
new file mode 100644
index 0000000000..5bfd39096c
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java
@@ -0,0 +1,392 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.adapters.nssmf;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.LinkedList;
+import java.util.List;
+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.client.methods.HttpRequestBase;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+import org.onap.so.adapters.nssmf.model.TokenResponse;
+import org.onap.so.adapters.nssmf.rest.HttpMethod;
+import org.onap.so.adapters.nssmf.rest.NssmfAdapterRest;
+import org.onap.so.adapters.nssmf.rest.NssmfInfo;
+import org.onap.so.adapters.nssmf.rest.NssmfManager;
+import org.onap.so.adapters.nssmf.rest.RestUtil;
+import org.onap.so.beans.nsmf.ActDeActNssi;
+import org.onap.so.beans.nsmf.AllocateCnNssi;
+import org.onap.so.beans.nsmf.CnSliceProfile;
+import org.onap.so.beans.nsmf.DeAllocateNssi;
+import org.onap.so.beans.nsmf.EsrInfo;
+import org.onap.so.beans.nsmf.JobStatusRequest;
+import org.onap.so.beans.nsmf.NsiInfo;
+import org.onap.so.beans.nsmf.NssiActDeActRequest;
+import org.onap.so.beans.nsmf.NssiAllocateRequest;
+import org.onap.so.beans.nsmf.NssiDeAllocateRequest;
+import org.onap.so.beans.nsmf.NssiResponse;
+import org.onap.so.beans.nsmf.PerfReq;
+import org.onap.so.beans.nsmf.PerfReqEmbbList;
+import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.junit4.SpringRunner;
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.marshal;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.unMarshal;
+import static org.onap.so.beans.nsmf.NetworkType.CORE;
+import static org.onap.so.beans.nsmf.ResourceSharingLevel.NON_SHARED;
+
+@RunWith(SpringRunner.class)
+public class NssmfAdapterRestTest {
+
+ private final static String ALLOCATE = "{\n" + " \"esrInfo\" : {\n" + " \"vendor\" : \"huawei\",\n"
+ + " \"networkType\" : \"cn\"\n" + " },\n" + " \"allocateCnNssi\" : {\n"
+ + " \"nssiId\" : \"NSST-C-001-HDBNJ-NSSMF-01-A-ZX\",\n" + " \"nssiName\" : \"eMBB-001\",\n"
+ + " \"sliceProfile\" : {\n" + " \"snssaiList\" : [ \"001-100001\" ],\n"
+ + " \"sliceProfileId\" : \"ab9af40f13f721b5f13539d87484098\",\n"
+ + " \"plmnIdList\" : [ \"460-00\", \"460-01\" ],\n" + " \"perfReq\" : {\n"
+ + " \"perfReqEmbbList\" : [ {\n" + " \"activityFactor\" : 50\n" + " } ]\n"
+ + " },\n" + " \"maxNumberofUEs\" : 200,\n"
+ + " \"coverageAreaTAList\" : [ \"1\", \"2\", \"3\" ],\n" + " \"latency\" : 6,\n"
+ + " \"resourceSharingLevel\" : \"non-shared\"\n" + " },\n" + " \"scriptName\" : \"CN1\",\n"
+ + " \"nsiInfo\" : {\n" + " \"nsiName\" : \"eMBB-001\",\n"
+ + " \"nsiId\" : \"NSI-M-001-HDBNJ-NSMF-01-A-ZX\"\n" + " }\n" + " }\n" + "}";
+
+ private NssmfManager nssmfMgr;
+
+ @Mock
+ private ResourceOperationStatusRepository rscOperStatusRepo;
+
+ @Mock
+ private RestUtil restUtil;
+
+ @Mock
+ private NssmfAdapterRest nssmfRest;
+
+ @Mock
+ private HttpResponse tokenResponse;
+
+ @Mock
+ private HttpEntity tokenEntity;
+
+ @Mock
+ private HttpResponse commonResponse;
+
+ @Mock
+ private HttpEntity commonEntity;
+
+ @Mock
+ private StatusLine statusLine;
+
+ @Mock
+ private HttpClient httpClient;
+
+ private InputStream postStream;
+
+ private InputStream tokenStream;
+
+ @Before
+ public void setUp() {
+ initMocks(this);
+ nssmfMgr = new NssmfManager();
+ nssmfMgr.setRestUtil(restUtil);
+ nssmfMgr.setRscOperStatusRepo(rscOperStatusRepo);
+ }
+
+ private void createCommonMock(int statusCode, NssmfInfo nssmf) throws Exception {
+ when(nssmfRest.getNssmfMgr()).thenReturn(nssmfMgr);
+ when(nssmfRest.allocateNssi(any(NssiAllocateRequest.class))).thenCallRealMethod();
+ when(nssmfRest.deAllocateNssi(any(NssiDeAllocateRequest.class), any(String.class))).thenCallRealMethod();
+ when(nssmfRest.activateNssi(any(NssiActDeActRequest.class), any(String.class))).thenCallRealMethod();
+ when(nssmfRest.deactivateNssi(any(NssiActDeActRequest.class), any(String.class))).thenCallRealMethod();
+
+ when(nssmfRest.queryJobStatus(any(JobStatusRequest.class), any(String.class))).thenCallRealMethod();
+ when(restUtil.sendRequest(any(String.class), any(HttpMethod.class), any(String.class), any(EsrInfo.class)))
+ .thenCallRealMethod();
+ when(restUtil.getHttpsClient()).thenReturn(httpClient);
+
+ when(statusLine.getStatusCode()).thenReturn(200);
+ when(restUtil.getNssmfHost(any(EsrInfo.class))).thenReturn(nssmf);
+
+ when(tokenResponse.getEntity()).thenReturn(tokenEntity);
+ when(tokenResponse.getStatusLine()).thenReturn(statusLine);
+ when(tokenEntity.getContent()).thenReturn(tokenStream);
+
+ when(commonResponse.getEntity()).thenReturn(commonEntity);
+ when(commonResponse.getStatusLine()).thenReturn(statusLine);
+ when(commonEntity.getContent()).thenReturn(postStream);
+
+ Answer<HttpResponse> answer = new Answer<HttpResponse>() {
+
+ public HttpResponse answer(InvocationOnMock invocation) throws Throwable {
+ Object[] arguments = invocation.getArguments();
+ if (arguments != null && arguments.length == 1 && arguments[0] != null) {
+
+ HttpRequestBase base = (HttpRequestBase) arguments[0];
+ if (base.getURI().toString().endsWith("/oauth/token")) {
+ return tokenResponse;
+ } else {
+ return commonResponse;
+ }
+ }
+ return commonResponse;
+ }
+ };
+ doAnswer(answer).when(httpClient).execute(any(HttpRequestBase.class));
+ }
+
+ @Test
+ public void testNssiAllocate() throws Exception {
+ NssmfInfo nssmf = new NssmfInfo();
+ nssmf.setUserName("nssmf-user");
+ nssmf.setPassword("nssmf-pass");
+ nssmf.setPort("8080");
+ nssmf.setIpAddress("127.0.0.1");
+
+ NssiResponse nssiRes = new NssiResponse();
+ nssiRes.setJobId("4b45d919816ccaa2b762df5120f72067");
+ nssiRes.setNssiId("NSSI-C-001-HDBNJ-NSSMF-01-A-ZX");
+
+ TokenResponse token = new TokenResponse();
+ token.setAccessToken("7512eb3feb5249eca5ddd742fedddd39");
+ token.setExpires(1800);
+
+ postStream = new ByteArrayInputStream(marshal(nssiRes).getBytes(UTF_8));
+ tokenStream = new ByteArrayInputStream(marshal(token).getBytes(UTF_8));
+
+ createCommonMock(200, nssmf);
+ // assertEquals(prettyPrint(allocateNssi()), ALLOCATE);
+ ResponseEntity res = nssmfRest.allocateNssi(allocateNssi());
+ assertNotNull(res);
+ assertNotNull(res.getBody());
+ NssiResponse allRes = unMarshal(res.getBody().toString(), NssiResponse.class);
+ assertEquals(allRes.getJobId(), "4b45d919816ccaa2b762df5120f72067");
+ assertEquals(allRes.getNssiId(), "NSSI-C-001-HDBNJ-NSSMF-01-A-ZX");
+ }
+
+ @Test
+ public void testNssiDeAllocate() throws Exception {
+ NssmfInfo nssmf = new NssmfInfo();
+ nssmf.setUserName("nssmf-user");
+ nssmf.setPassword("nssmf-pass");
+ nssmf.setPort("8080");
+ nssmf.setIpAddress("127.0.0.1");
+
+ NssiResponse nssiRes = new NssiResponse();
+ nssiRes.setJobId("4b45d919816ccaa2b762df5120f72067");
+
+ TokenResponse token = new TokenResponse();
+ token.setAccessToken("7512eb3feb5249eca5ddd742fedddd39");
+ token.setExpires(1800);
+
+ postStream = new ByteArrayInputStream(marshal(nssiRes).getBytes(UTF_8));
+ tokenStream = new ByteArrayInputStream(marshal(token).getBytes(UTF_8));
+
+ createCommonMock(200, nssmf);
+ ResponseEntity res = nssmfRest.deAllocateNssi(deAllocateNssi(), "ab9af40f13f721b5f13539d87484098");
+ assertNotNull(res);
+ assertNotNull(res.getBody());
+ NssiResponse allRes = unMarshal(res.getBody().toString(), NssiResponse.class);
+ assertEquals(allRes.getJobId(), "4b45d919816ccaa2b762df5120f72067");
+ }
+
+ @Test
+ public void testNssiActivate() throws Exception {
+ NssmfInfo nssmf = new NssmfInfo();
+ nssmf.setUserName("nssmf-user");
+ nssmf.setPassword("nssmf-pass");
+ nssmf.setPort("8080");
+ nssmf.setIpAddress("127.0.0.1");
+
+ NssiResponse nssiRes = new NssiResponse();
+ nssiRes.setJobId("4b45d919816ccaa2b762df5120f72067");
+
+ TokenResponse token = new TokenResponse();
+ token.setAccessToken("7512eb3feb5249eca5ddd742fedddd39");
+ token.setExpires(1800);
+
+ postStream = new ByteArrayInputStream(marshal(nssiRes).getBytes(UTF_8));
+ tokenStream = new ByteArrayInputStream(marshal(token).getBytes(UTF_8));
+
+ createCommonMock(200, nssmf);
+ ResponseEntity res = nssmfRest.activateNssi(activateNssi(), "001-100001");
+ assertNotNull(res);
+ assertNotNull(res.getBody());
+ NssiResponse allRes = unMarshal(res.getBody().toString(), NssiResponse.class);
+ assertEquals(allRes.getJobId(), "4b45d919816ccaa2b762df5120f72067");
+ }
+
+ @Test
+ public void testNssiDeActivate() throws Exception {
+ NssmfInfo nssmf = new NssmfInfo();
+ nssmf.setUserName("nssmf-user");
+ nssmf.setPassword("nssmf-pass");
+ nssmf.setPort("8080");
+ nssmf.setIpAddress("127.0.0.1");
+
+ NssiResponse nssiRes = new NssiResponse();
+ nssiRes.setJobId("4b45d919816ccaa2b762df5120f72067");
+
+ TokenResponse token = new TokenResponse();
+ token.setAccessToken("7512eb3feb5249eca5ddd742fedddd39");
+ token.setExpires(1800);
+
+ postStream = new ByteArrayInputStream(marshal(nssiRes).getBytes(UTF_8));
+ tokenStream = new ByteArrayInputStream(marshal(token).getBytes(UTF_8));
+
+ createCommonMock(200, nssmf);
+ ResponseEntity res = nssmfRest.deactivateNssi(deActivateNssi(), "001-100001");
+ assertNotNull(res);
+ assertNotNull(res.getBody());
+ NssiResponse allRes = unMarshal(res.getBody().toString(), NssiResponse.class);
+ assertEquals(allRes.getJobId(), "4b45d919816ccaa2b762df5120f72067");
+ }
+
+ @Test
+ public void testAllocateJsonSerDeSer() throws Exception {
+ assertEquals(marshal(allocateNssi()), ALLOCATE);
+ NssiAllocateRequest all = unMarshal(ALLOCATE, NssiAllocateRequest.class);
+ assertNotNull(all);
+ assertNotNull(all.getAllocateCnNssi());
+ assertNotNull(all.getAllocateCnNssi().getSliceProfile());
+ assertEquals(all.getAllocateCnNssi().getSliceProfile().getResourceSharingLevel(), NON_SHARED);
+ assertNotNull(all.getAllocateCnNssi().getSliceProfile().getPerfReq());
+ assertNotNull(all.getAllocateCnNssi().getSliceProfile().getPerfReq().getPerfReqEmbbList());
+ PerfReqEmbbList embb =
+ all.getAllocateCnNssi().getSliceProfile().getPerfReq().getPerfReqEmbbList().iterator().next();
+ assertNotNull(embb);
+ assertEquals(embb.getActivityFactor(), 50);
+ }
+
+ public NssiAllocateRequest allocateNssi() throws Exception {
+ CnSliceProfile sP = new CnSliceProfile();
+ List<String> sns = new LinkedList<>();
+ sns.add("001-100001");
+ List<String> plmn = new LinkedList<>();
+ plmn.add("460-00");
+ plmn.add("460-01");
+ PerfReqEmbbList embb = new PerfReqEmbbList();
+ embb.setActivityFactor(50);
+ List<PerfReqEmbbList> embbList = new LinkedList<>();
+ embbList.add(embb);
+ PerfReq perfReq = new PerfReq();
+ perfReq.setPerfReqEmbbList(embbList);
+ List<String> taList = new LinkedList<>();
+ taList.add("1");
+ taList.add("2");
+ taList.add("3");
+ sP.setSnssaiList(sns);
+ sP.setSliceProfileId("ab9af40f13f721b5f13539d87484098");
+ sP.setPlmnIdList(plmn);
+ sP.setPerfReq(perfReq);
+ sP.setMaxNumberofUEs(200);
+ sP.setCoverageAreaTAList(taList);
+ sP.setLatency(6);
+ sP.setResourceSharingLevel(NON_SHARED);
+ NsiInfo nsiInfo = new NsiInfo();
+ nsiInfo.setNsiId("NSI-M-001-HDBNJ-NSMF-01-A-ZX");
+ nsiInfo.setNsiName("eMBB-001");
+ AllocateCnNssi cnNssi = new AllocateCnNssi();
+ cnNssi.setNssiId("NSST-C-001-HDBNJ-NSSMF-01-A-ZX");
+ cnNssi.setNssiName("eMBB-001");
+ cnNssi.setScriptName("CN1");
+ cnNssi.setSliceProfile(sP);
+ cnNssi.setNsiInfo(nsiInfo);
+ EsrInfo esrInfo = new EsrInfo();
+ esrInfo.setVendor("huawei");
+ esrInfo.setNetworkType(CORE);
+ NssiAllocateRequest allocate = new NssiAllocateRequest();
+ allocate.setAllocateCnNssi(cnNssi);
+ allocate.setEsrInfo(esrInfo);
+ return allocate;
+ }
+
+ public NssiDeAllocateRequest deAllocateNssi() throws Exception {
+ DeAllocateNssi deAllocateNssi = new DeAllocateNssi();
+ deAllocateNssi.setTerminateNssiOption(0);
+ List<String> snssai = new LinkedList<>();
+ snssai.add("001-100001");
+ deAllocateNssi.setNsiId("NSI-M-001-HDBNJ-NSMF-01-A-ZX");
+ deAllocateNssi.setNssiId("NSSI-C-001-HDBNJ-NSSMF-01-A-ZX");
+ deAllocateNssi.setScriptName("CN1");
+ deAllocateNssi.setSnssaiList(snssai);
+ EsrInfo esrInfo = new EsrInfo();
+ esrInfo.setVendor("huawei");
+ esrInfo.setNetworkType(CORE);
+ NssiDeAllocateRequest deAllocate = new NssiDeAllocateRequest();
+ deAllocate.setDeAllocateNssi(deAllocateNssi);
+ deAllocate.setEsrInfo(esrInfo);
+ return deAllocate;
+ }
+
+ public NssiActDeActRequest activateNssi() throws Exception {
+ EsrInfo esrInfo = new EsrInfo();
+ esrInfo.setVendor("huawei");
+ esrInfo.setNetworkType(CORE);
+ ActDeActNssi act = new ActDeActNssi();
+ act.setNsiId("NSI-M-001-HDBNJ-NSMF-01-A-ZX");
+ act.setNssiId("NSSI-C-001-HDBNJ-NSSMF-01-A-ZX");
+ NssiActDeActRequest actReq = new NssiActDeActRequest();
+ actReq.setActDeActNssi(act);
+ actReq.setEsrInfo(esrInfo);
+ return actReq;
+ }
+
+ public NssiActDeActRequest deActivateNssi() throws Exception {
+ EsrInfo esrInfo = new EsrInfo();
+ esrInfo.setVendor("huawei");
+ esrInfo.setNetworkType(CORE);
+ ActDeActNssi deAct = new ActDeActNssi();
+ deAct.setNsiId("NSI-M-001-HDBNJ-NSMF-01-A-ZX");
+ deAct.setNssiId("NSSI-C-001-HDBNJ-NSSMF-01-A-ZX");
+ NssiActDeActRequest deActReq = new NssiActDeActRequest();
+ deActReq.setActDeActNssi(deAct);
+ deActReq.setEsrInfo(esrInfo);
+ return deActReq;
+ }
+
+ public String queryJobStatusNssi() throws Exception {
+ EsrInfo esrInfo = new EsrInfo();
+ esrInfo.setVendor("huawei");
+ esrInfo.setNetworkType(CORE);
+
+ JobStatusRequest jobStatus = new JobStatusRequest();
+ jobStatus.setEsrInfo(esrInfo);
+ jobStatus.setNsiId("NSI-M-001-HDBNJ-NSMF-01-A-ZX");
+ jobStatus.setNssiId("NSSI-C-001-HDBNJ-NSSMF-01-A-ZX");
+ return marshal(jobStatus);
+ }
+}
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index f0c066aa05..a668b42106 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>mso-openstack-adapters</artifactId>
<packaging>jar</packaging>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
index 35008b6120..585e001f1a 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
@@ -24,9 +24,13 @@ import java.util.List;
import java.util.Optional;
import java.util.Set;
import org.onap.aai.domain.yang.LInterface;
+import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
@@ -53,11 +57,12 @@ public class AuditVServer extends AbstractAudit {
public Optional<AAIObjectAuditList> auditVserversThroughRelationships(String genericVnfId, String vfModuleName) {
AAIObjectAuditList auditList = new AAIObjectAuditList();
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, genericVnfId)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, genericVnfId)
.queryParam("vf-module-name", vfModuleName);
- if (getAaiClient().get(uri).getRelationships().isPresent()) {
+ Optional<AAIResultWrapper> wrapper = getAaiClient().getFirstWrapper(VfModules.class, VfModule.class, uri);
+ if (wrapper.isPresent() && wrapper.get().getRelationships().isPresent()) {
List<AAIResourceUri> relatedVservers =
- getAaiClient().get(uri).getRelationships().get().getRelatedUris(AAIObjectType.VSERVER);
+ wrapper.get().getRelationships().get().getRelatedUris(AAIObjectType.VSERVER);
if (!relatedVservers.isEmpty()) {
relatedVservers.forEach(vserverUri -> {
Optional<Vserver> vserver = getAaiClient().get(vserverUri).asBean(Vserver.class);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java
index 9d7eafbf82..214cebb338 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java
@@ -26,7 +26,7 @@ package org.onap.so.adapters.network;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java
index 25667efc71..ba4e93fa93 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java
@@ -27,7 +27,7 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.ArrayList;
import java.util.List;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HostRoute;
import org.onap.so.openstack.beans.Pool;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
index e95e9a3a83..8d75212f4e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
@@ -46,7 +46,7 @@ import org.onap.so.adapters.network.async.client.QueryNetworkNotification;
import org.onap.so.adapters.network.async.client.UpdateNetworkNotification;
import org.onap.so.adapters.network.exceptions.NetworkException;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.NetworkRollback;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index ef04ee9c13..257374fdb2 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
@@ -47,7 +47,7 @@ import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationReposi
import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
@@ -92,6 +92,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private static final String NEUTRON_MODE = "NEUTRON";
private static final String CLOUD_OWNER = "CloudOwner";
private static final String LOG_DEBUG_MSG = "Got Network definition from Catalog: {}";
+ private static final String NETWORK_EXIST_STATUS_MESSAGE =
+ "The network was found to already exist, thus no new network was created in the cloud via this request";
+ private static final String NETWORK_CREATED_STATUS_MESSAGE =
+ "The new network was successfully created in the cloud";
+ private static final String NETWORK_NOT_EXIST_STATUS_MESSAGE =
+ "The network as not found, thus no network was deleted in the cloud via this request";
+ private static final String NETWORK_DELETED_STATUS_MESSAGE = "The network was successfully deleted in the cloud";
private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class);
@@ -225,7 +232,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// See if the Network already exists (by name)
NetworkInfo netInfo = null;
- long queryNetworkStarttime = System.currentTimeMillis();
try {
netInfo = neutron.queryNetwork(networkName, tenantId, cloudSiteId);
} catch (MsoException me) {
@@ -254,10 +260,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
logger.warn("{} {} Found Existing network, status={} for Neutron mode ",
MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(), netInfo.getStatus());
}
+ heat.updateResourceStatus(msoRequest.getRequestId(), NETWORK_EXIST_STATUS_MESSAGE);
return;
}
- long createNetworkStarttime = System.currentTimeMillis();
try {
netInfo = neutron.createNetwork(cloudSiteId, tenantId, neutronNetworkType, networkName,
physicalNetworkName, vlans);
@@ -360,6 +366,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(), heatStack.getStatus(),
networkName, cloudSiteId, tenantId);
}
+ heat.updateResourceStatus(msoRequest.getRequestId(), NETWORK_EXIST_STATUS_MESSAGE);
return;
}
@@ -473,6 +480,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
networkRollback.setNetworkCreated(true);
networkRollback.setNetworkType(networkType);
+ try {
+ heat.updateResourceStatus(msoRequest.getRequestId(), NETWORK_CREATED_STATUS_MESSAGE);
+ } catch (Exception e) {
+ logger.warn("Exception while updating infra active request", e);
+ }
+
logger.debug("Network {} successfully created via HEAT", networkName);
}
@@ -1055,8 +1068,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
} else {
try {
- heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true, timeoutMinutes);
- networkDeleted.value = true;
+ StackInfo stack = heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true, timeoutMinutes);
+ networkDeleted.value = stack.isOperationPerformed();
} catch (MsoException me) {
me.addContext("DeleteNetwork");
logger.error("{} {} Delete Network (heat): {} in {}/{} ", MessageEnum.RA_DELETE_NETWORK_EXC,
@@ -1064,6 +1077,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
throw new NetworkException(me);
}
}
+ try {
+ heat.updateResourceStatus(msoRequest.getRequestId(),
+ networkDeleted.value ? NETWORK_DELETED_STATUS_MESSAGE : NETWORK_NOT_EXIST_STATUS_MESSAGE);
+ } catch (Exception e) {
+ logger.warn("Exception while updating infra active request", e);
+ }
}
/**
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
index 0c37837880..09356d02c8 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
@@ -62,7 +62,7 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.adapters.vnf.BpelRestClient;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.NetworkRollback;
import org.onap.so.openstack.beans.NetworkStatus;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java
index 04b90b444f..4b02595074 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java
@@ -33,7 +33,7 @@ import org.onap.so.adapters.tenant.exceptions.TenantAlreadyExists;
import org.onap.so.adapters.tenant.exceptions.TenantException;
import org.onap.so.adapters.tenantrest.TenantRollback;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.MsoTenant;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
index 662ce33022..5b0370b25e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
@@ -37,7 +37,7 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.utils.CryptoUtils;
import org.slf4j.Logger;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
index e925e6037c..68d1bebc51 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
@@ -44,7 +44,7 @@ import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify;
import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify_Service;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.VnfRollback;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
index 65d5523709..32e88d8cad 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
@@ -53,7 +53,7 @@ import org.onap.so.entity.MsoRequest;
import org.onap.so.heatbridge.HeatBridgeApi;
import org.onap.so.heatbridge.HeatBridgeException;
import org.onap.so.heatbridge.HeatBridgeImpl;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
@@ -109,6 +109,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
private static final String USER_ERROR = "USER ERROR";
private static final String VERSION_MIN = "VersionMin";
private static final String VERSION_MAX = "VersionMax";
+ private static final String VF_EXIST_STATUS_MESSAGE =
+ "The vf module was found to already exist, thus no new vf module was created in the cloud via this request";
+ private static final String VF_CREATED_STATUS_MESSAGE = "The new vf module was successfully created in the cloud";
+ private static final String VF_NOT_EXIST_STATUS_MESSAGE =
+ "The vf module was not, thus no vf module was deleted in the cloud via this request";
+ private static final String VF_DELETED_STATUS_MESSAGE = "The vf module was successfully deleted in the cloud";
@Autowired
private VFModuleCustomizationRepository vfModuleCustomRepo;
@@ -1046,6 +1052,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
heatStack = msoHeatUtils.createStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, null,
template, goldenInputs, true, heatTemplate.getTimeoutMinutes(), newEnvironmentString,
nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(), failIfExists);
+
+ msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
+ heatStack.isOperationPerformed() ? VF_EXIST_STATUS_MESSAGE : VF_CREATED_STATUS_MESSAGE);
} else {
throw new MsoHeatNotFoundException();
}
@@ -1125,7 +1134,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
try {
- msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, timeoutMinutes);
+ StackInfo stackInfo =
+ msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, timeoutMinutes);
+ msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
+ stackInfo.isOperationPerformed() ? VF_DELETED_STATUS_MESSAGE : VF_NOT_EXIST_STATUS_MESSAGE);
} catch (MsoException me) {
me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
index abaf881ba5..ba837a9718 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
@@ -52,7 +52,7 @@ import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.MsoTenant;
import org.onap.so.openstack.beans.VnfRollback;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
index b1f4055b3b..0ecfd15dde 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
@@ -65,7 +65,7 @@ import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
index 0fb11ebbf3..0836f69ba7 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
@@ -56,7 +56,7 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse;
import org.onap.so.adapters.vnfrest.VfModuleRollback;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
index fcb570f3f5..18ed9872a0 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
@@ -55,7 +55,7 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse;
import org.onap.so.adapters.vnfrest.VfModuleRollback;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java
index c9e046ca43..7e12735e05 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java
@@ -56,7 +56,7 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
import org.onap.so.adapters.vnfrest.VolumeGroupExceptionResponse;
import org.onap.so.adapters.vnfrest.VolumeGroupRollback;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
index 2b7234aca6..cfddbba34e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
@@ -55,7 +55,7 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
import org.onap.so.adapters.vnfrest.VolumeGroupExceptionResponse;
import org.onap.so.adapters.vnfrest.VolumeGroupRollback;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index e2022c9a6e..6d3b0ab680 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -76,7 +76,7 @@ import org.onap.so.heatbridge.helpers.AaiHelper;
import org.onap.so.heatbridge.openstack.api.OpenstackClient;
import org.onap.so.heatbridge.openstack.factory.OpenstackClientFactoryImpl;
import org.onap.so.heatbridge.utils.HeatBridgeUtils;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.openstack4j.model.compute.Server;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
index 3d9a128318..8e71ec46b0 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
@@ -22,17 +22,12 @@ package org.onap.so.adapters.audit;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashSet;
-import java.util.List;
import java.util.Optional;
import java.util.Set;
-import java.util.stream.Stream;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -43,9 +38,8 @@ import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
-import org.onap.aai.domain.yang.Relationship;
-import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
@@ -60,8 +54,6 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.woorea.openstack.heat.model.Resource;
-import com.woorea.openstack.heat.model.Resources;
@RunWith(MockitoJUnitRunner.Silent.class)
public class AuditVServerTest extends AuditVServer {
@@ -399,9 +391,9 @@ public class AuditVServerTest extends AuditVServer {
AAIResultWrapper wrapper = new AAIResultWrapper(vfModule);
- doReturn(wrapper).when(aaiResourcesMock)
- .get(AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId")
- .queryParam("vf-module-name", "vfModuleName"));
+ doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class,
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId").queryParam("vf-module-name",
+ "vfModuleName"));
Optional<AAIObjectAuditList> auditList =
auditNova.auditVserversThroughRelationships("genericVnfId", "vfModuleName");
@@ -417,9 +409,9 @@ public class AuditVServerTest extends AuditVServer {
AAIResultWrapper wrapper = new AAIResultWrapper(vfModule);
AAIResultWrapper vserverWrapper = new AAIResultWrapper(new Vserver());
- doReturn(wrapper).when(aaiResourcesMock)
- .get(AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId")
- .queryParam("vf-module-name", "vfModuleName"));
+ doReturn(Optional.of(wrapper)).when(aaiResourcesMock).getFirstWrapper(VfModules.class, VfModule.class,
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "genericVnfId").queryParam("vf-module-name",
+ "vfModuleName"));
doReturn(vserverWrapper).when(aaiResourcesMock).get(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER,
"cloud-owner", "cloud-region-id", "tenant-id", "VUSCHGA1"));
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
index add1918748..284067a766 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.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,9 @@
package org.onap.so.adapters.network;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.patch;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.junit.Assert.assertEquals;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteNeutronNetwork;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteStack_200;
@@ -52,6 +55,7 @@ import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.util.UriComponentsBuilder;
+import com.github.tomakehurst.wiremock.WireMockServer;
public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@@ -112,6 +116,8 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameAlreadyExistNeutronMode() throws IOException {
+ mockUpdateRequestDb(wireMockServer, "9733c8d1-2668-4e5f-8b51-2cacc9b662c0");
+
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
mockOpenStackGetAllNeutronNetworks_200(wireMockServer, "OpenstackGetNeutronNetworks.json");
@@ -140,6 +146,8 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameHeatMode() throws IOException {
+ mockUpdateRequestDb(wireMockServer, "9733c8d1-2668-4e5f-8b51-2cacc9b662c0");
+
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
mockOpenStackGetStack_404(wireMockServer, "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId");
@@ -158,6 +166,8 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameAlreadyExistHeatMode() throws IOException {
+ mockUpdateRequestDb(wireMockServer, "9733c8d1-2668-4e5f-8b51-2cacc9b662c0");
+
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json");
@@ -236,6 +246,8 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void deleteNetworkHeatModeSuccess() throws IOException {
+ mockUpdateRequestDb(wireMockServer, "5a29d907-b8c7-47bf-85f3-3940c0cce0f7");
+
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_DeleteComplete.json");
@@ -292,6 +304,8 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void deleteNetworkNeureonMode() throws IOException {
+ mockUpdateRequestDb(wireMockServer, "5a29d907-b8c7-47bf-85f3-3940c0cce0f7");
+
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", NETWORK_ID, HttpStatus.SC_OK);
@@ -506,4 +520,9 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
String input = new String(Files.readAllBytes(Paths.get(JsonInput)));
return input;
}
+
+ public static void mockUpdateRequestDb(WireMockServer wireMockServer, String requestId) throws IOException {
+ wireMockServer.stubFor(patch(urlPathEqualTo("/infraActiveRequests/" + requestId))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
+ }
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java
index 727f18902a..00961a16b9 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.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,6 +22,7 @@ package org.onap.so.adapters.network;
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.patch;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.onap.so.bpmn.mock.StubOpenStack.getBodyFromFile;
@@ -41,6 +42,7 @@ import org.onap.so.entity.MsoRequest;
import org.onap.so.openstack.beans.NetworkRollback;
import org.onap.so.openstack.beans.Subnet;
import org.springframework.beans.factory.annotation.Autowired;
+import com.github.tomakehurst.wiremock.WireMockServer;
public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
@Autowired
@@ -263,4 +265,5 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
false, new ArrayList<>(), new HashMap<String, String>(), "messageId", new MsoRequest(),
"http://localhost:" + wireMockPort + "/notificationUrl");
}
+
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
index a058378425..9fc2aba948 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
@@ -23,6 +23,7 @@ package org.onap.so.adapters.vnf;
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.patch;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.mockito.Mockito.when;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
@@ -30,6 +31,7 @@ import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackGetWithResponse;
+import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -53,6 +55,7 @@ import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.stubbing.Scenario;
@@ -73,6 +76,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
public void createVnfTest() throws Exception {
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
mockOpenStackGetStackVfModule_200(wireMockServer);
+ mockUpdateRequestDb(wireMockServer, "12345");
MsoRequest msoRequest = getMsoRequest();
@@ -88,6 +92,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
public void createVnfTest_NullFailIfExists() throws Exception {
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
mockOpenStackGetStackVfModule_200(wireMockServer);
+ mockUpdateRequestDb(wireMockServer, "12345");
MsoRequest msoRequest = getMsoRequest();
@@ -117,6 +122,8 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
.inScenario("HeatStatusFailure").whenScenarioStateIs("HeatStackFailed")
.willSetStateTo("HeatStackSuccess"));
+ mockUpdateRequestDb(wireMockServer, "12345");
+
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
@@ -133,6 +140,8 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
public void createVnfTest_HeatStatusCreated() throws Exception {
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
mockOpenStackGetStackVfModule_200(wireMockServer);
+ mockUpdateRequestDb(wireMockServer, "12345");
+
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
@@ -516,5 +525,10 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
return vfModuleCustomization;
}
+ public static void mockUpdateRequestDb(WireMockServer wireMockServer, String requestId) throws IOException {
+ wireMockServer.stubFor(patch(urlPathEqualTo("/infraActiveRequests/" + requestId))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
+ }
+
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java
index 5a8524fd73..9655e90e46 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.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,6 +22,8 @@ package org.onap.so.adapters.vnf;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
+import com.github.tomakehurst.wiremock.WireMockServer;
+import org.apache.http.HttpStatus;
import org.json.JSONException;
import org.junit.Ignore;
import org.junit.Test;
@@ -49,6 +51,9 @@ import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.patch;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
@@ -112,6 +117,8 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
mockOpenStackGetStackVfModule_200(wireMockServer);
+ mockUpdateRequestDb(wireMockServer, "62265093-277d-4388-9ba6-449838ade586");
+
headers.add("Accept", MediaType.APPLICATION_JSON);
HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers);
@@ -208,6 +215,8 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
mockOpenStackGetStackVfModule_200(wireMockServer);
+ mockUpdateRequestDb(wireMockServer, "62265093-277d-4388-9ba6-449838ade586");
+
headers.add("Accept", MediaType.APPLICATION_JSON);
HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers);
@@ -342,6 +351,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer);
+ mockUpdateRequestDb(wireMockServer, "62265093-277d-4388-9ba6-449838ade586");
headers.add("Accept", MediaType.APPLICATION_JSON);
HttpEntity<DeleteVfModuleRequest> entity = new HttpEntity<DeleteVfModuleRequest>(request, headers);
@@ -539,4 +549,9 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
return request;
}
+
+ public static void mockUpdateRequestDb(WireMockServer wireMockServer, String requestId) throws IOException {
+ wireMockServer.stubFor(patch(urlPathEqualTo("/infraActiveRequests/" + requestId))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
+ }
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java
index 523a6903cc..c2e2b567f1 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.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,7 @@
package org.onap.so.adapters.vnf;
+import org.apache.http.HttpStatus;
import org.junit.Test;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
@@ -37,6 +38,9 @@ import org.springframework.http.ResponseEntity;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import java.io.IOException;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.patch;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.junit.Assert.assertEquals;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackWithBody_200;
@@ -50,6 +54,9 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon {
@Test
public void testCreateVNFVolumes() throws IOException {
+ wireMockServer.stubFor(patch(urlPathEqualTo("/infraActiveRequests/62265093-277d-4388-9ba6-449838ade586"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
+
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
mockOpenStackPostStacks_200(wireMockServer);
mockOpenStackGetStackVfModule_200(wireMockServer);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java
index fb4bec69ed..6fd9f02cfe 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.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,7 @@
package org.onap.so.adapters.vnf;
+import org.apache.http.HttpStatus;
import org.junit.Test;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
@@ -37,6 +38,9 @@ import org.springframework.http.ResponseEntity;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import java.io.IOException;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.patch;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.junit.Assert.assertEquals;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackWithBody_200;
@@ -52,6 +56,9 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon {
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
mockOpenStackPostStacks_200(wireMockServer);
mockOpenStackGetStackVfModule_200(wireMockServer);
+ wireMockServer.stubFor(patch(urlPathEqualTo("/infraActiveRequests/62265093-277d-4388-9ba6-449838ade586"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK)));
+
CreateVolumeGroupRequest request = buildCreateVfModuleRequest();
HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
index 20fd812ab9..42955c35c9 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
+++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
@@ -61,11 +61,15 @@ ssl-enable: false
tomcat:
max-threads: 50
mso:
+ adapters:
+ requestDb:
+ endpoint: http://localhost:${wiremock.server.port}
audit:
lock-time: 240000
logPath: logs
msb-ip: localhost
msb-port: ${wiremock.server.port}
+ msb-scheme: http
catalog:
db:
spring:
diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml
index 366a207d60..2354272756 100644
--- a/adapters/mso-requests-db-adapter/pom.xml
+++ b/adapters/mso-requests-db-adapter/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
index 3deabb3ce1..9f48144eb8 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java
@@ -10,9 +10,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,19 +27,15 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
-import org.onap.logging.filter.base.ONAPComponents;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.db.request.beans.ArchivedInfraRequests;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.data.repository.ArchivedInfraRequestsRepository;
import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
-import org.onap.so.logger.ErrorCode;
-import org.onap.so.logger.LoggingAnchor;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.ScheduledTasksMDCSetup;
+import org.onap.logging.filter.base.ErrorCode;
+import org.onap.logging.filter.base.ScheduledLogging;
+import org.onap.logging.filter.base.ScheduledTaskException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.PageRequest;
@@ -56,8 +52,6 @@ public class ArchiveInfraRequestsScheduler {
private InfraActiveRequestsRepository infraActiveRepo;
@Autowired
private ArchivedInfraRequestsRepository archivedInfraRepo;
- @Autowired
- private ScheduledTasksMDCSetup scheduledMDCSetup;
@Value("${mso.infra-requests.archived.period}")
@@ -65,11 +59,13 @@ public class ArchiveInfraRequestsScheduler {
/**
* Runs the scheduler nightly [Seconds] [Minutes] [Hours] [Day of month] [Month] [Day of week] [Year]
+ *
+ * @throws ScheduledTaskException
*/
+ @ScheduledLogging
@Scheduled(cron = "0 0 1 * * ?")
@SchedulerLock(name = "archiveInfraRequestsScheduler")
- public void infraRequestsScheduledTask() {
- scheduledMDCSetup.mdcSetup(ONAPComponents.REQUEST_DB, "infraRequestsScheduledTask");
+ public void infraRequestsScheduledTask() throws ScheduledTaskException {
logger.debug("Start of archiveInfraRequestsScheduler");
Date currentDate = new Date();
@@ -97,10 +93,9 @@ public class ArchiveInfraRequestsScheduler {
} while (!requestsByStartTime.isEmpty());
logger.debug("End of archiveInfraRequestsScheduler");
- scheduledMDCSetup.exitAndClearMDC();
}
- protected void archiveInfraRequests(List<InfraActiveRequests> requests) {
+ protected void archiveInfraRequests(List<InfraActiveRequests> requests) throws ScheduledTaskException {
List<ArchivedInfraRequests> newArchivedReqs = new ArrayList<>();
List<InfraActiveRequests> oldInfraReqs = new ArrayList<>();
@@ -145,14 +140,14 @@ public class ArchiveInfraRequestsScheduler {
archivedInfra.setVnfType(iar.getVnfType());
archivedInfra.setVolumeGroupId(iar.getVolumeGroupId());
archivedInfra.setVolumeGroupName(iar.getVolumeGroupName());
+ archivedInfra.setProductFamilyName(iar.getProductFamilyName());
+ archivedInfra.setTenantName(iar.getTenantName());
+ archivedInfra.setResourceStatusMessage(iar.getResourceStatusMessage());
newArchivedReqs.add(archivedInfra);
oldInfraReqs.add(iar);
} catch (Exception e) {
- scheduledMDCSetup.errorMDCSetup(ErrorCode.UnknownError, e.getMessage());
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString());
- logger.error(LoggingAnchor.TWO, MessageEnum.RA_GENERAL_EXCEPTION.toString(),
- ErrorCode.UnknownError.getValue(), e);
+ throw new ScheduledTaskException(ErrorCode.UnknownError, e.getMessage(), e);
}
}
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java
index 110fc6c03e..84ff054a7c 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java
@@ -26,6 +26,7 @@ import javax.jws.WebService;
import javax.xml.bind.annotation.XmlElement;
import org.onap.so.adapters.requestsdb.exceptions.MsoRequestsDbException;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.beans.InstanceNfvoMapping;
import org.onap.so.db.request.beans.ResourceOperationStatus;
/**
@@ -55,6 +56,20 @@ public interface MsoRequestsDbAdapter {
throws MsoRequestsDbException;
@WebMethod
+ public void setInstanceNfvoMappingRepository(
+ @WebParam(name = "instanceId") @XmlElement(required = true) String instanceId,
+ @WebParam(name = "nfvoName") @XmlElement(required = true) String nfvoName,
+ @WebParam(name = "endpoint") @XmlElement(required = true) String endpoint,
+ @WebParam(name = "username") @XmlElement(required = true) String username,
+ @WebParam(name = "password") @XmlElement(required = true) String password,
+ @WebParam(name = "apiRoot") @XmlElement(required = false) String apiRoot) throws MsoRequestsDbException;
+
+ @WebMethod
+ public InstanceNfvoMapping getInstanceNfvoMapping(
+ @WebParam(name = "instanceId") @XmlElement(required = true) String instanceId)
+ 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/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
index 085a255948..b262cb21cb 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
@@ -31,13 +31,15 @@ import org.onap.so.adapters.requestsdb.exceptions.MsoRequestsDbException;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.OperationStatus;
import org.onap.so.db.request.beans.ResourceOperationStatus;
+import org.onap.so.db.request.beans.InstanceNfvoMapping;
import org.onap.so.db.request.beans.ResourceOperationStatusId;
import org.onap.so.db.request.beans.SiteStatus;
import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
import org.onap.so.db.request.data.repository.OperationStatusRepository;
import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
import org.onap.so.db.request.data.repository.SiteStatusRepository;
-import org.onap.so.logger.ErrorCode;
+import org.onap.so.db.request.data.repository.InstanceNfvoMappingRepository;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.requestsdb.RequestsDbConstant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,6 +61,9 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
private InfraActiveRequestsRepository infraActive;
@Autowired
+ private InstanceNfvoMappingRepository instanceNfvoMappingRepository;
+
+ @Autowired
private SiteStatusRepository siteRepo;
@Autowired
@@ -69,6 +74,40 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
@Transactional
@Override
+ public void setInstanceNfvoMappingRepository(String instanceId, String nfvoName, String endpoint, String username,
+ String password, String apiRoot) {
+ InstanceNfvoMapping instanceNfvoMapping = new InstanceNfvoMapping();
+ if (apiRoot != null) {
+ instanceNfvoMapping.setApiRoot(apiRoot);
+ }
+ if (endpoint != null) {
+ instanceNfvoMapping.setEndpoint(endpoint);
+ }
+ if (instanceId != null) {
+ instanceNfvoMapping.setInstanceId(instanceId);
+ }
+ if (nfvoName != null) {
+ instanceNfvoMapping.setNfvoName(nfvoName);
+ }
+ if (username != null) {
+ instanceNfvoMapping.setUsername(username);
+ }
+ if (password != null) {
+ instanceNfvoMapping.setPassword(password);
+ }
+
+ instanceNfvoMappingRepository.save(instanceNfvoMapping);
+ }
+
+ @Transactional
+ @Override
+ public InstanceNfvoMapping getInstanceNfvoMapping(String instanceId) {
+ InstanceNfvoMapping instanceNfvoMapping = instanceNfvoMappingRepository.findOneByInstanceId(instanceId);
+ return instanceNfvoMapping;
+ }
+
+ @Transactional
+ @Override
public void updateInfraRequest(String requestId, String lastModifiedBy, String statusMessage, String responseBody,
RequestStatusType requestStatus, String progress, String vnfOutputs, String serviceInstanceId,
String networkId, String vnfId, String vfModuleId, String volumeGroupId, String serviceInstanceName,
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/OrchestrationTaskRepositoryCustomController.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/OrchestrationTaskRepositoryCustomController.java
new file mode 100644
index 0000000000..e32d90b137
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/OrchestrationTaskRepositoryCustomController.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.onap.so.adapters.requestsdb;
+
+import org.onap.so.adapters.requestsdb.exceptions.MsoRequestsDbException;
+import org.onap.so.db.request.beans.OrchestrationTask;
+import org.onap.so.db.request.data.repository.OrchestrationTaskRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import java.util.List;
+
+@RestController
+public class OrchestrationTaskRepositoryCustomController {
+
+ @Autowired
+ private OrchestrationTaskRepository orchestrationTaskRepository;
+
+ @RequestMapping(method = RequestMethod.GET, value = "/orchestrationTask")
+ public List<OrchestrationTask> getAllOrchestrationTask() {
+ return orchestrationTaskRepository.findAll();
+ }
+
+ @RequestMapping(method = RequestMethod.GET, value = "/orchestrationTask/{taskId}")
+ public OrchestrationTask getOrchestrationTask(@PathVariable("taskId") String taskId) throws MsoRequestsDbException {
+ return orchestrationTaskRepository.findById(taskId)
+ .orElseThrow(() -> new MsoRequestsDbException("orchestration task not found: " + taskId));
+ }
+
+ @RequestMapping(method = RequestMethod.POST, value = "/orchestrationTask/")
+ public OrchestrationTask createOrchestrationTask(@RequestBody OrchestrationTask orchestrationTask) {
+ return orchestrationTaskRepository.save(orchestrationTask);
+ }
+
+ @RequestMapping(method = RequestMethod.PUT, value = "/orchestrationTask/{taskId}")
+ public OrchestrationTask updateOrchestrationTask(@PathVariable("taskId") String taskId,
+ @RequestBody OrchestrationTask orchestrationTask) throws MsoRequestsDbException {
+ return orchestrationTaskRepository.save(orchestrationTask);
+ }
+
+ @RequestMapping(method = RequestMethod.DELETE, value = "/orchestrationTask/{taskId}")
+ public void deleteOrchestrationTask(@PathVariable("taskId") String taskId) {
+ orchestrationTaskRepository.deleteById(taskId);
+ }
+}
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java
index 27580977b8..e1e629008d 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java
@@ -24,7 +24,7 @@ package org.onap.so.adapters.requestsdb.exceptions;
import javax.xml.ws.WebFault;
import org.onap.so.exceptions.MSOException;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
/**
* This class simply extends Exception (without addition additional functionality) to provide an identifier for
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.1.1__Add_Instance_NFVO_Mapping_Table.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.1.1__Add_Instance_NFVO_Mapping_Table.sql
new file mode 100644
index 0000000000..165a9b33f8
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.1.1__Add_Instance_NFVO_Mapping_Table.sql
@@ -0,0 +1,12 @@
+use requestdb;
+
+CREATE TABLE `instance_nfvo_mapping` (
+ `INSTANCE_ID` varchar(256) NOT NULL,
+ `NFVO_NAME` varchar(256) DEFAULT NULL,
+ `ENDPOINT` varchar(256) DEFAULT NULL,
+ `USERNAME` varchar(256) DEFAULT NULL,
+ `PASSWORD` varchar(256) DEFAULT NULL,
+ `API_ROOT` varchar(256) DEFAULT NULL,
+ `JOB_ID` varchar(256) DEFAULT NULL,
+ PRIMARY KEY (`INSTANCE_ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.2.1__Add_PNF_Column_Infra_Requests_archive_tables.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.2.1__Add_PNF_Column_Infra_Requests_archive_tables.sql
new file mode 100644
index 0000000000..8c042dcbaf
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.2.1__Add_PNF_Column_Infra_Requests_archive_tables.sql
@@ -0,0 +1,4 @@
+use requestdb;
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS PNF_NAME varchar(45);
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS PNF_NAME varchar(45);
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.2__Add_PNF_Column_Infra_Requests_archive_tables.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.2__Add_PNF_Column_Infra_Requests_archive_tables.sql
index dbdc925dae..d82e666855 100644
--- a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.2__Add_PNF_Column_Infra_Requests_archive_tables.sql
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.2__Add_PNF_Column_Infra_Requests_archive_tables.sql
@@ -1,4 +1,4 @@
use requestdb;
ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS PNF_ID varchar(45);
-ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS PNF_ID varchar(45); \ No newline at end of file
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS PNF_ID varchar(45);
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.3.1__AddResourceStatusMessageColumn.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.3.1__AddResourceStatusMessageColumn.sql
new file mode 100644
index 0000000000..f388a185f5
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.3.1__AddResourceStatusMessageColumn.sql
@@ -0,0 +1,4 @@
+use requestdb;
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS RESOURCE_STATUS_MESSAGE longtext;
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS RESOURCE_STATUS_MESSAGE longtext; \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.3__Add_Columns_Tenant_Name_Product_Family_Name.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.3__Add_Columns_Tenant_Name_Product_Family_Name.sql
new file mode 100644
index 0000000000..a79b1a86c1
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V7.3__Add_Columns_Tenant_Name_Product_Family_Name.sql
@@ -0,0 +1,7 @@
+use requestdb;
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS TENANT_NAME varchar(200);
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS TENANT_NAME varchar(200);
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS PRODUCT_FAMILY_NAME varchar(200);
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS PRODUCT_FAMILY_NAME varchar(200); \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.1__Add_Orchestration_Task_Table.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.1__Add_Orchestration_Task_Table.sql
new file mode 100644
index 0000000000..0d7cb7a62b
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.1__Add_Orchestration_Task_Table.sql
@@ -0,0 +1,12 @@
+USE `requestdb`;
+
+CREATE TABLE `orchestration_task` (
+ `TASK_ID` varchar(200) NOT NULL,
+ `REQUEST_ID` varchar(200) NOT NULL,
+ `NAME` varchar(200) NOT NULL,
+ `CREATED_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `STATUS` varchar(200) NOT NULL,
+ `IS_MANUAL` varchar(20) NOT NULL,
+ `PARAMS` varchar(20000) DEFAULT NULL,
+ PRIMARY KEY (`TASK_ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
index fef9dbc22c..9ded5b4b79 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
@@ -39,8 +39,10 @@ import org.onap.so.adapters.requestsdb.exceptions.MsoRequestsDbException;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.OperationStatus;
import org.onap.so.db.request.beans.ResourceOperationStatus;
+import org.onap.so.db.request.beans.InstanceNfvoMapping;
import org.onap.so.db.request.data.repository.OperationStatusRepository;
import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
+import org.onap.so.db.request.data.repository.InstanceNfvoMappingRepository;
import org.onap.so.requestsdb.RequestsDbConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.server.LocalServerPort;
@@ -58,6 +60,9 @@ public class MSORequestDBImplTest extends RequestsAdapterBase {
@Autowired
private ResourceOperationStatusRepository resourceOperationStatusRepo;
+ @Autowired
+ private InstanceNfvoMappingRepository instanceNfvoMappingRepository;
+
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -257,6 +262,29 @@ public class MSORequestDBImplTest extends RequestsAdapterBase {
}
@Test
+ public void setInstanceNfvoMappingRepository() throws MsoRequestsDbException {
+ InstanceNfvoMapping instanceNfvoMapping = new InstanceNfvoMapping();
+ String instanceId = "9b9f02c0-298b-458a-bc9c-be3692e4f354";
+ String nfvoName = "testNFVO";
+ String endpoint = "http://127.0.0.1:80/";
+ String username = "admin";
+ String password = "admin";
+ String apiRoot = "v1";
+
+ instanceNfvoMapping.setApiRoot(apiRoot);
+ instanceNfvoMapping.setEndpoint(endpoint);
+ instanceNfvoMapping.setInstanceId(instanceId);
+ instanceNfvoMapping.setNfvoName(nfvoName);
+ instanceNfvoMapping.setUsername(username);
+ instanceNfvoMapping.setPassword(password);
+
+ dbAdapter.setInstanceNfvoMappingRepository(instanceId, nfvoName, endpoint, username, password, apiRoot);
+ InstanceNfvoMapping dbInstNfvoMap = dbAdapter.getInstanceNfvoMapping(instanceId);
+ assertThat(dbInstNfvoMap, sameBeanAs(instanceNfvoMapping));
+ }
+
+
+ @Test
public void updateServiceOperation() throws MsoRequestsDbException {
String serviceId = "serviceid";
String operationId = "operationid";
diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml
index 07c8ed5eab..7fd1aa62d4 100644
--- a/adapters/mso-sdnc-adapter/pom.xml
+++ b/adapters/mso-sdnc-adapter/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>mso-sdnc-adapter</artifactId>
<properties>
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
index b96a564b1a..f8daf69965 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
@@ -31,7 +31,7 @@ import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
import org.onap.so.logger.LoggingAnchor;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
index 577b550be6..3de95b338b 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
@@ -32,7 +32,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.onap.so.logger.LoggingAnchor;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
index 87620743d7..978cd44b56 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
@@ -30,7 +30,7 @@ import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
import org.onap.so.logger.LoggingAnchor;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java
index 294dccdb90..da0fcd3d04 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java
@@ -42,6 +42,7 @@ public interface Constants {
public static final String REQUEST_TUNABLES = "org.onap.so.adapters.sdnc";
public static final String MSO_ACTION_LCM = "lcm";
+ public static final String MSO_ACTION_MDONS = "opticalservice";
public static final String LCM_API_VER = "2.00";
public static final int LCM_FLAGS_TTL = 65000;
public static final String LCM_ORIGINATOR_ID = "MSO";
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
index b15831ff03..0535b3de2d 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
@@ -24,7 +24,7 @@
package org.onap.so.adapters.sdnc.impl;
import org.onap.so.logger.LoggingAnchor;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
index 2b023f4c15..7c35be02a4 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
@@ -29,7 +29,7 @@ import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.sdnc.SDNCAdapterPortType;
import org.onap.so.adapters.sdnc.SDNCAdapterRequest;
import org.onap.so.adapters.sdnc.SDNCAdapterResponse;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
index bcd1db7929..b8977f05d8 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
@@ -46,7 +46,7 @@ import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.onap.so.logger.LoggingAnchor;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.utils.CryptoUtils;
import org.onap.so.adapters.sdnc.SDNCAdapterRequest;
import org.onap.so.adapters.sdnc.client.CallbackHeader;
@@ -112,6 +112,8 @@ public class SDNCRestClient {
Document reqDoc = node.getOwnerDocument();
if (Constants.MSO_ACTION_LCM.equals(msoAction)) {
sdncReqBody = Utils.genSdncLcmReq(reqDoc, rt);
+ } else if (Constants.MSO_ACTION_MDONS.equals(msoAction)) {
+ sdncReqBody = Utils.genOpticalSdncReq(reqDoc, rt);
} else {
sdncReqBody = Utils.genSdncReq(reqDoc, rt);
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
index 56c38f8891..f52ebcab9b 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
@@ -34,7 +34,7 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.onap.so.logger.LoggingAnchor;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,10 +42,13 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import org.json.XML;
+import org.json.JSONObject;
public class Utils {
private static Logger logger = LoggerFactory.getLogger(Utils.class);
+ private static int MSOJsonIndentFactor = 3;
private Utils() {}
@@ -230,6 +233,85 @@ public class Utils {
return null;
}
+ public static String genOpticalSdncReq(Document reqDoc, RequestTunables rt) {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+
+ // NewDoc for output
+ // Root
+ Document newdoc = db.newDocument();
+ Element root = newdoc.createElementNS(rt.getNamespace(), "input");
+ newdoc.appendChild(root);
+ // RequestData
+ NodeList nodes = reqDoc.getDocumentElement().getChildNodes();
+ for (int i = 0; i < nodes.getLength(); i++) {
+ Node n = nodes.item(i);
+ Node newNode = newdoc.importNode(n, true);
+ root.appendChild(newNode);
+ }
+ String req = domToStr(newdoc);
+ String s = xml2json(req, true);
+ logger.debug("Formatted SdncReq:\n", s);
+ return s;
+
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ERROR_CREATE_SDNC_REQUEST.toString(), "SDNC",
+ ErrorCode.BusinessProcessError.getValue(), "Exception in genOpticalSdncReq", e);
+ }
+ return null;
+ }
+
+ /**
+ * Uses the JSONObject static method to convert a XML doc to JSON.
+ *
+ * @param xml String containing the XML doc
+ * @param pretty flag to determine if the output should be formatted
+ * @return String containing the JSON translation
+ */
+ public static String xml2json(String xml, boolean pretty) {
+ try {
+ // name spaces cause problems, so just remove them
+ JSONObject jsonObj = XML.toJSONObject(removeNamespaces(xml));
+ if (!pretty) {
+ return jsonObj.toString();
+ } else {
+ // add an indent to make it 'pretty'
+ return jsonObj.toString(MSOJsonIndentFactor);
+ }
+ } catch (Exception e) {
+ logger.debug("xml2json(): unable to parse xml and convert to json. Exception was: {}", e.toString(), e);
+ return null;
+ }
+ }
+
+ /**
+ * Removes namespaces and namespace declarations from an XML document.
+ *
+ * @param xml the XML document
+ * @return a possibly modified document
+ */
+ public static String removeNamespaces(Object xml) {
+ if (xml == null) {
+ logger.debug("removeNamespaces input object is null , returning null");
+ return null;
+ }
+
+ String text = String.valueOf(xml);
+
+ // remove xmlns declaration
+ text = text.replaceAll("xmlns.*?(\"|\').*?(\"|\')", "");
+ // remove opening tag prefix
+ text = text.replaceAll("(<)(\\w+:)(.*?>)", "$1$3");
+ // remove closing tags prefix
+ text = text.replaceAll("(</)(\\w+:)(.*?>)", "$1$3");
+ // remove extra spaces left when xmlns declarations are removed
+ text = text.replaceAll("\\s+>", ">");
+
+ return text;
+ }
+
+
public static String genMsoFailResp(SDNCResponse resp) {
try {
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
index 631be2f9ff..62f45f88b1 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
@@ -28,7 +28,7 @@ import java.net.URI;
import javax.xml.bind.DatatypeConverter;
import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.adapters.sdnc.impl.Constants;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
index 979238fe2f..776251a20b 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
@@ -26,7 +26,7 @@ package org.onap.so.adapters.sdnc.sdncrest;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.sdnc.exception.SDNCAdapterException;
import org.onap.so.adapters.sdnc.impl.Constants;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
index e184bbd110..431e9db87b 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
@@ -51,7 +51,7 @@ import org.apache.http.util.EntityUtils;
import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.adapters.sdncrest.SDNCErrorCommon;
import org.onap.so.adapters.sdncrest.SDNCResponseCommon;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
index 50c8a089df..305abe2762 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
@@ -38,7 +38,7 @@ import org.onap.so.adapters.sdncrest.RequestInformation;
import org.onap.so.adapters.sdncrest.SDNCResponseCommon;
import org.onap.so.adapters.sdncrest.SDNCServiceError;
import org.onap.so.adapters.sdncrest.SDNCServiceRequest;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
index 5f80c20b97..9f7760a0d8 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
@@ -33,7 +33,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.sdnc.impl.Constants;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/adapters/mso-ve-vnfm-adapter/pom.xml b/adapters/mso-ve-vnfm-adapter/pom.xml
index 4472956eb7..3d054d9eca 100644
--- a/adapters/mso-ve-vnfm-adapter/pom.xml
+++ b/adapters/mso-ve-vnfm-adapter/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>
@@ -30,6 +30,10 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
+ <groupId>org.springframework.retry</groupId>
+ <artifactId>spring-retry</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-vnfm-adapter-ext-clients</artifactId>
<version>${project.version}</version>
@@ -52,6 +56,10 @@
<artifactId>jersey-hk2</artifactId>
</dependency>
<dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
index 188b6718f2..9b2a8c3d62 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
@@ -20,13 +20,18 @@
package org.onap.so.adapters.vevnfm.aai;
+import java.util.Collections;
+import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
+import org.apache.logging.log4j.util.Strings;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.aai.domain.yang.EsrVnfmList;
+import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.entities.uri.Depth;
import org.slf4j.Logger;
@@ -40,43 +45,59 @@ public class AaiConnection {
private static final int FIRST_INDEX = 0;
- public EsrSystemInfo receiveVnfm() {
+ private static void isValid(final List<EsrSystemInfo> infos) throws VeVnfmException {
+ if (infos == null || infos.isEmpty() || Strings.isBlank(infos.get(FIRST_INDEX).getServiceUrl())) {
+ throw new VeVnfmException("No 'url' field in VNFM info");
+ }
+ }
+
+ public List<EsrSystemInfo> receiveVnfm() throws VeVnfmException {
+ List<EsrSystemInfo> infos;
+
+ try {
+ infos = receiveVnfmInternal();
+ } catch (Exception e) {
+ throw new VeVnfmException(e);
+ }
+
+ isValid(infos);
+
+ return infos;
+ }
+
+ private List<EsrSystemInfo> receiveVnfmInternal() {
final AAIResourcesClient resourcesClient = new AAIResourcesClient();
- final Optional<EsrVnfmList> response =
- resourcesClient.get(EsrVnfmList.class, AAIUriFactory.createResourceUri(AAIObjectType.VNFM_LIST));
+ final AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VNFM_LIST);
+ final Optional<EsrVnfmList> response = resourcesClient.get(EsrVnfmList.class, resourceUri);
if (response.isPresent()) {
final EsrVnfmList esrVnfmList = response.get();
logger.info("The VNFM replied with: {}", esrVnfmList);
final List<EsrVnfm> esrVnfm = esrVnfmList.getEsrVnfm();
- if (esrVnfm.isEmpty()) {
- return null;
+ final List<EsrSystemInfo> infos = new LinkedList<>();
+
+ for (final EsrVnfm vnfm : esrVnfm) {
+ final String vnfmId = vnfm.getVnfmId();
+ infos.addAll(receiveVnfmServiceUrl(resourcesClient, vnfmId));
}
- final String vnfmId = esrVnfm.get(FIRST_INDEX).getVnfmId();
- return receiveVnfmServiceUrl(resourcesClient, vnfmId);
+ return infos;
}
return null;
}
- private EsrSystemInfo receiveVnfmServiceUrl(final AAIResourcesClient resourcesClient, final String vnfmId) {
+ private List<EsrSystemInfo> receiveVnfmServiceUrl(final AAIResourcesClient resourcesClient, final String vnfmId) {
final Optional<EsrVnfm> response = resourcesClient.get(EsrVnfm.class,
AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId).depth(Depth.ONE));
if (response.isPresent()) {
final EsrVnfm esrVnfm = response.get();
logger.info("The VNFM replied with: {}", esrVnfm);
- final List<EsrSystemInfo> esrSystemInfo = esrVnfm.getEsrSystemInfoList().getEsrSystemInfo();
-
- if (esrSystemInfo.isEmpty()) {
- return null;
- }
-
- return esrSystemInfo.get(FIRST_INDEX);
+ return esrVnfm.getEsrSystemInfoList().getEsrSystemInfo();
}
- return null;
+ return Collections.emptyList();
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/EsrId.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/EsrId.java
new file mode 100644
index 0000000000..13ff2b6397
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/EsrId.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SO
+ * ================================================================================
+ * Copyright (C) 2020 Samsung. 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.onap.so.adapters.vevnfm.aai;
+
+import org.onap.aai.domain.yang.EsrSystemInfo;
+
+public class EsrId {
+
+ private EsrSystemInfo info;
+ private String id;
+
+ public EsrSystemInfo getInfo() {
+ return info;
+ }
+
+ public void setInfo(final EsrSystemInfo info) {
+ this.info = info;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(final String id) {
+ this.id = id;
+ }
+}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java
index f7b7283c59..c033fc3f96 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java
@@ -20,7 +20,10 @@
package org.onap.so.adapters.vevnfm.configuration;
+import java.util.List;
+import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.so.adapters.vevnfm.service.StartupService;
+import org.onap.so.adapters.vevnfm.service.SubscriptionScheduler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.annotation.Configuration;
@@ -39,10 +42,14 @@ public class StartupConfiguration {
@Autowired
private StartupService startupService;
+ @Autowired
+ private SubscriptionScheduler subscriptionScheduler;
+
@EventListener(ApplicationReadyEvent.class)
public void onApplicationReadyEvent() throws Exception {
if (!environment.acceptsProfiles(Profiles.of(TEST_PROFILE))) {
- startupService.run();
+ final List<EsrSystemInfo> infos = startupService.receiveVnfm();
+ subscriptionScheduler.setInfos(infos);
}
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java
index 1882b4e183..cb324c32a9 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java
@@ -38,7 +38,7 @@ public class NotificationController {
@Autowired
private DmaapService dmaapService;
- @PostMapping("${notification.url}")
+ @PostMapping("${vnfm.notification}")
public ResponseEntity receiveNotification(@RequestBody final VnfLcmOperationOccurrenceNotification notification) {
logger.info("Notification received {}", notification);
dmaapService.send(notification);
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java
new file mode 100644
index 0000000000..ceabb8a020
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SO
+ * ================================================================================
+ * Copyright (C) 2020 Samsung. 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.onap.so.adapters.vevnfm.event;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class AaiEvent {
+
+ private final boolean vserverIsClosedLoopDisabled;
+ private final String genericVnfVnfId;
+
+ public AaiEvent(final boolean cld, final String id) {
+ this.vserverIsClosedLoopDisabled = cld;
+ this.genericVnfVnfId = id;
+ }
+
+ @JsonProperty("vserver.is-closed-loop-disabled")
+ public boolean isVserverIsClosedLoopDisabled() {
+ return vserverIsClosedLoopDisabled;
+ }
+
+ @JsonProperty("generic-vnf.vnf-id")
+ public String getGenericVnfVnfId() {
+ return genericVnfVnfId;
+ }
+}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java
new file mode 100644
index 0000000000..dc0c5502dd
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java
@@ -0,0 +1,110 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SO
+ * ================================================================================
+ * Copyright (C) 2020 Samsung. 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.onap.so.adapters.vevnfm.event;
+
+import static java.time.temporal.ChronoField.INSTANT_SECONDS;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.time.Instant;
+import java.util.UUID;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification;
+
+public class DmaapEvent {
+
+ public static final String MSERVICE = "microservice.stringmatcher";
+ public static final String ONSET = "ONSET";
+ public static final String VNF = "VNF";
+ public static final String VNFID = "generic-vnf.vnf-id";
+ public static final String ETSI = "ETSI";
+
+ private final String closedLoopControlName;
+ private final long closedLoopAlarmStart;
+ private final String closedLoopEventClient;
+ private final String closedLoopEventStatus;
+ private final String requestId;
+ private final String targetType;
+ private final String target;
+ private final AaiEvent aaiEvent;
+ private final String from;
+ private final String version;
+ private final VnfLcmOperationOccurrenceNotification etsiLcmEvent;
+
+ public DmaapEvent(final String closedLoopControlName, final String version,
+ final VnfLcmOperationOccurrenceNotification etsiLcmEvent) {
+ this.closedLoopControlName = closedLoopControlName;
+ this.closedLoopAlarmStart = Instant.now().getLong(INSTANT_SECONDS);
+ this.closedLoopEventClient = MSERVICE;
+ this.closedLoopEventStatus = ONSET;
+ this.requestId = UUID.randomUUID().toString();
+ this.targetType = VNF;
+ this.target = VNFID;
+ this.aaiEvent = new AaiEvent(false, etsiLcmEvent.getId());
+ this.from = ETSI;
+ this.version = version;
+ this.etsiLcmEvent = etsiLcmEvent;
+ }
+
+ public String getClosedLoopControlName() {
+ return closedLoopControlName;
+ }
+
+ public long getClosedLoopAlarmStart() {
+ return closedLoopAlarmStart;
+ }
+
+ public String getClosedLoopEventClient() {
+ return closedLoopEventClient;
+ }
+
+ public String getClosedLoopEventStatus() {
+ return closedLoopEventStatus;
+ }
+
+ @JsonProperty("requestID")
+ public String getRequestId() {
+ return requestId;
+ }
+
+ @JsonProperty("target_type")
+ public String getTargetType() {
+ return targetType;
+ }
+
+ public String getTarget() {
+ return target;
+ }
+
+ @JsonProperty("AAI")
+ public AaiEvent getAaiEvent() {
+ return aaiEvent;
+ }
+
+ public String getFrom() {
+ return from;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public VnfLcmOperationOccurrenceNotification getEtsiLcmEvent() {
+ return etsiLcmEvent;
+ }
+}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java
index abd9ff9d33..a0c1c1e9db 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java
@@ -25,4 +25,8 @@ public class VeVnfmException extends Exception {
public VeVnfmException(final String message) {
super(message);
}
+
+ public VeVnfmException(final Throwable cause) {
+ super(cause);
+ }
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
index 251e0c426b..838a67d115 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
@@ -20,11 +20,16 @@
package org.onap.so.adapters.vevnfm.provider;
+import org.apache.logging.log4j.util.Strings;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
public class AuthorizationHeadersProvider extends BasicHttpHeadersProvider {
public void addAuthorization(final String authorization) {
+ if (Strings.isBlank(authorization)) {
+ return;
+ }
+
getHttpHeaders().set(AUTHORIZATION_HEADER, authorization);
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java
index 59397cead3..c685ae815a 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java
@@ -1,5 +1,26 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SO
+ * ================================================================================
+ * Copyright (C) 2020 Samsung. 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.onap.so.adapters.vevnfm.service;
+import org.onap.so.adapters.vevnfm.event.DmaapEvent;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.slf4j.Logger;
@@ -21,16 +42,26 @@ public class DmaapService {
@Value("${dmaap.topic}")
private String topic;
+ @Value("${dmaap.closed-loop.control.name}")
+ private String closedLoopControlName;
+
+ @Value("${dmaap.version}")
+ private String version;
+
@Autowired
private HttpRestServiceProvider restProvider;
public void send(final VnfLcmOperationOccurrenceNotification notification) {
- final ResponseEntity<String> response = restProvider.postHttpRequest(notification, getUrl(), String.class);
-
- final HttpStatus statusCode = response.getStatusCode();
- final String body = response.getBody();
+ try {
+ final DmaapEvent event = new DmaapEvent(closedLoopControlName, version, notification);
+ final ResponseEntity<String> response = restProvider.postHttpRequest(event, getUrl(), String.class);
+ final HttpStatus statusCode = response.getStatusCode();
+ final String body = response.getBody();
- logger.info("The DMaaP replied with the code {} and the body {}", statusCode, body);
+ logger.info("The DMaaP replied with the code {} and the body {}", statusCode, body);
+ } catch (Exception e) {
+ logger.warn("An issue connecting to DMaaP", e);
+ }
}
private String getUrl() {
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
index dfbafa223c..92906ef35c 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
@@ -20,35 +20,44 @@
package org.onap.so.adapters.vevnfm.service;
-import org.apache.logging.log4j.util.Strings;
+import java.util.Collections;
+import java.util.List;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.so.adapters.vevnfm.aai.AaiConnection;
import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.retry.annotation.Backoff;
+import org.springframework.retry.annotation.EnableRetry;
+import org.springframework.retry.annotation.Recover;
+import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
@Service
+@EnableRetry
public class StartupService {
- @Autowired
- private AaiConnection aaiConnection;
+ private static final Logger logger = LoggerFactory.getLogger(StartupService.class);
+
+ @Value("${vnfm.default-endpoint}")
+ private String vnfmDefaultEndpoint;
@Autowired
- private SubscriberService subscriberService;
+ private AaiConnection aaiConnection;
- private static void isValid(final EsrSystemInfo info) throws VeVnfmException {
- if (Strings.isBlank(info.getServiceUrl())) {
- throw new VeVnfmException("No 'url' field in VNFM info");
- }
+ @Retryable(value = {Exception.class}, maxAttempts = 5, backoff = @Backoff(delay = 5000, multiplier = 2))
+ public List<EsrSystemInfo> receiveVnfm() throws VeVnfmException {
+ return aaiConnection.receiveVnfm();
}
- public void run() throws Exception {
- final EsrSystemInfo info = aaiConnection.receiveVnfm();
- isValid(info);
- final boolean done = subscriberService.subscribe(info);
-
- if (!done) {
- throw new VeVnfmException("Could not subscribe to VNFM");
- }
+ @Recover
+ public List<EsrSystemInfo> recoverReceiveVnfm(final Throwable t) {
+ logger.warn("Connection to AAI failed");
+ final EsrSystemInfo info = new EsrSystemInfo();
+ info.setServiceUrl(vnfmDefaultEndpoint);
+ logger.warn("This EsrSystemInfo is used by default: {}", info);
+ return Collections.singletonList(info);
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSender.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscribeSender.java
index 8fdfb41d26..d01c3c8f66 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSender.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscribeSender.java
@@ -18,9 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vevnfm.subscription;
+package org.onap.so.adapters.vevnfm.service;
+import com.fasterxml.jackson.annotation.JsonProperty;
import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.slf4j.Logger;
@@ -29,11 +31,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import lombok.ToString;
-@Component
+@Service
public class SubscribeSender {
+ public static final String SLASH = "/";
+
private static final Logger logger = LoggerFactory.getLogger(SubscribeSender.class);
@Value("${vnfm.subscription}")
@@ -42,18 +47,37 @@ public class SubscribeSender {
@Autowired
private HttpRestServiceProvider restProvider;
- public boolean send(final EsrSystemInfo info, final LccnSubscriptionRequest request) {
- final ResponseEntity<String> response = restProvider.postHttpRequest(request, getUrl(info), String.class);
+ public String send(final EsrSystemInfo info, final LccnSubscriptionRequest request) throws VeVnfmException {
+ final ResponseEntity<SubscribeToManoResponse> response =
+ restProvider.postHttpRequest(request, getUrl(info), SubscribeToManoResponse.class);
final HttpStatus statusCode = response.getStatusCode();
- final String body = response.getBody();
+ final SubscribeToManoResponse body = response.getBody();
logger.info("The VNFM replied with the code {} and the body {}", statusCode, body);
- return HttpStatus.CREATED == statusCode;
+ if (HttpStatus.CREATED != statusCode) {
+ throw new VeVnfmException("The status code was different than " + HttpStatus.CREATED);
+ }
+
+ return body.id;
+ }
+
+ public boolean check(final EsrSystemInfo info, final String id) {
+ final ResponseEntity<SubscribeToManoResponse> response =
+ restProvider.getHttpResponse(getUrl(info) + SLASH + id, SubscribeToManoResponse.class);
+ return response.getBody() != null && response.getBody().id.equals(id);
}
private String getUrl(final EsrSystemInfo info) {
return info.getServiceUrl() + vnfmSubscription;
}
+
+ @ToString
+ static class SubscribeToManoResponse {
+ @JsonProperty("id")
+ String id;
+ @JsonProperty("callbackUri")
+ String callbackUri;
+ }
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
index eefd9ba93b..9760584d7a 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
@@ -22,9 +22,10 @@ package org.onap.so.adapters.vevnfm.service;
import com.squareup.okhttp.Credentials;
import java.util.Collections;
+import org.apache.logging.log4j.util.Strings;
import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
import org.onap.so.adapters.vevnfm.provider.AuthorizationHeadersProvider;
-import org.onap.so.adapters.vevnfm.subscription.SubscribeSender;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthentication;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsBasic;
@@ -35,16 +36,11 @@ import org.springframework.stereotype.Service;
@Service
public class SubscriberService {
- private static final char COLON = ':';
+ @Value("${vevnfmadapter.endpoint}")
+ private String endpoint;
- @Value("${system.url}")
- private String systemUrl;
-
- @Value("${server.port}")
- private String serverPort;
-
- @Value("${notification.url}")
- private String notificationUrl;
+ @Value("${vnfm.notification}")
+ private String notification;
@Value("${spring.security.usercredentials[0].username}")
private String username;
@@ -59,19 +55,40 @@ public class SubscriberService {
private SubscribeSender sender;
private static String getAuthorization(final EsrSystemInfo info) {
- return Credentials.basic(info.getUserName(), info.getPassword());
+ if (info == null) {
+ return null;
+ }
+
+ final String userName = info.getUserName();
+
+ if (Strings.isBlank(userName)) {
+ return null;
+ }
+
+ final String password = info.getPassword();
+ return Credentials.basic(userName, password);
}
- public boolean subscribe(final EsrSystemInfo info) {
+ public String subscribe(final EsrSystemInfo info) throws VeVnfmException {
try {
headersProvider.addAuthorization(getAuthorization(info));
final LccnSubscriptionRequest request = createRequest();
return sender.send(info, request);
+ } catch (Exception e) {
+ throw new VeVnfmException(e);
} finally {
headersProvider.removeAuthorization();
}
}
+ public boolean checkSubscription(final EsrSystemInfo info, final String id) throws VeVnfmException {
+ try {
+ return sender.check(info, id);
+ } catch (Exception e) {
+ throw new VeVnfmException(e);
+ }
+ }
+
private LccnSubscriptionRequest createRequest() {
final LccnSubscriptionRequest request = new LccnSubscriptionRequest();
request.callbackUri(getCallbackUri());
@@ -87,6 +104,6 @@ public class SubscriberService {
}
private String getCallbackUri() {
- return systemUrl + COLON + serverPort + notificationUrl;
+ return endpoint + notification;
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java
new file mode 100644
index 0000000000..d9f3acc3df
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SO
+ * ================================================================================
+ * Copyright (C) 2020 Samsung. 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.onap.so.adapters.vevnfm.service;
+
+import java.util.LinkedList;
+import java.util.List;
+import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.so.adapters.vevnfm.aai.EsrId;
+import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+
+@Service
+@EnableScheduling
+public class SubscriptionScheduler {
+
+ private static final Logger logger = LoggerFactory.getLogger(SubscriptionScheduler.class);
+
+ @Autowired
+ private SubscriberService subscriberService;
+
+ private List<EsrId> esrIds;
+
+ public void setInfos(final List<EsrSystemInfo> infos) {
+ esrIds = new LinkedList<>();
+
+ for (final EsrSystemInfo info : infos) {
+ final EsrId esrId = new EsrId();
+ esrId.setInfo(info);
+ esrIds.add(esrId);
+ }
+ }
+
+ List<EsrId> getEsrIds() {
+ return esrIds;
+ }
+
+ @Scheduled(fixedRate = 5000, initialDelay = 2000)
+ void subscribeTask() throws VeVnfmException {
+ if (isEsrIdsValid()) {
+ for (final EsrId esrId : esrIds) {
+ singleSubscribe(esrId);
+ }
+ }
+ }
+
+ @Scheduled(fixedRate = 20000)
+ void checkSubscribeTask() throws VeVnfmException {
+ if (isEsrIdsValid()) {
+ for (final EsrId esrId : esrIds) {
+ singleCheckSubscription(esrId);
+ }
+ }
+ }
+
+ private boolean isEsrIdsValid() {
+ return esrIds != null && !esrIds.isEmpty();
+ }
+
+ private void singleSubscribe(final EsrId esrId) throws VeVnfmException {
+ if (esrId.getId() == null) {
+ logger.info("Single subscribe task");
+ esrId.setId(subscriberService.subscribe(esrId.getInfo()));
+ }
+ }
+
+ private void singleCheckSubscription(final EsrId esrId) throws VeVnfmException {
+ if (esrId.getId() != null) {
+ logger.info("Checking subscription: {}", esrId.getId());
+ if (!subscriberService.checkSubscription(esrId.getInfo(), esrId.getId())) {
+ logger.info("Subscription {} not available", esrId.getId());
+ esrId.setId(null);
+ }
+ }
+ }
+}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml b/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
index 35871c51ac..a2a33bfb5c 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
@@ -15,13 +15,10 @@
# limitations under the License.
server:
- port: 8080
+ port: 9098
-system:
- url: http://localhost
-
-notification:
- url: /lcm/v1/vnf/instances/notifications
+vevnfmadapter:
+ endpoint: http://so-ve-vnfm-adapter.onap:9098
mso:
key: 07a7159d3bf51a0e53be7a8f89699be7
@@ -31,11 +28,17 @@ aai:
auth: 75C4483F9C05E2C33A8602635FA532397EC44AB667A2B64DED4FEE08DD932F2E3C1FEE
vnfm:
+ default-endpoint: https://so-vnfm-simulator.onap:9093
subscription: /vnflcm/v1/subscriptions
+ notification: /lcm/v1/vnf/instances/notifications
dmaap:
- endpoint: http://message-router:30227
+ endpoint: http://message-router.onap:30227
topic: /events/unauthenticated.DCAE_CL_OUTPUT
+ closed-loop:
+ control:
+ name: ClosedLoopControlName
+ version: 1.0.2
spring:
security:
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java
index 57638a165a..974e6ec544 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java
@@ -53,8 +53,8 @@ public class NotificationControllerTest {
private static final String MINIMAL_JSON_CONTENT = "{}";
private static final int ZERO = 0;
- @Value("${notification.url}")
- private String notificationUrl;
+ @Value("${vnfm.notification}")
+ private String notification;
@Autowired
private WebApplicationContext webApplicationContext;
@@ -74,7 +74,7 @@ public class NotificationControllerTest {
@Test
public void testReceiveNotification() throws Exception {
// given
- final MockHttpServletRequestBuilder request = MockMvcRequestBuilders.post(notificationUrl)
+ final MockHttpServletRequestBuilder request = MockMvcRequestBuilders.post(notification)
.contentType(MediaType.APPLICATION_JSON).content(MINIMAL_JSON_CONTENT);
mockRestServer.expect(once(), anything()).andRespond(withSuccess());
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java
index 64503ddfc2..f9ae427086 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java
@@ -28,6 +28,8 @@ import org.springframework.http.HttpHeaders;
public class AuthorizationHeadersProviderTest {
private static final String AUTHORIZATION_EXAMPLE = "authorization";
+ private static final String BLANK_EXAMPLE = "\t\n";
+ private static final String EMPTY = "";
private final AuthorizationHeadersProvider provider = new AuthorizationHeadersProvider();
@@ -44,4 +46,41 @@ public class AuthorizationHeadersProviderTest {
assertEquals(size, headers.size());
assertFalse(headers.containsKey(AUTHORIZATION_HEADER));
}
+
+ @Test
+ public void testBlankAuthorization() {
+ final HttpHeaders headers = provider.getHttpHeaders();
+ final int size = headers.size();
+
+ provider.addAuthorization(BLANK_EXAMPLE);
+ assertEquals(size, headers.size());
+ }
+
+ @Test
+ public void testEmptyAuthorization() {
+ final HttpHeaders headers = provider.getHttpHeaders();
+ final int size = headers.size();
+
+ provider.addAuthorization(EMPTY);
+ assertEquals(size, headers.size());
+ }
+
+ @Test
+ public void testNullAuthorization() {
+ final HttpHeaders headers = provider.getHttpHeaders();
+ final int size = headers.size();
+
+ provider.addAuthorization(null);
+ assertEquals(size, headers.size());
+ }
+
+ @Test
+ public void testRemoveAuthorization() {
+ final HttpHeaders headers = provider.getHttpHeaders();
+ final int size = headers.size();
+
+ provider.removeAuthorization();
+ provider.removeAuthorization();
+ assertEquals(size, headers.size());
+ }
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java
index 0f9c23e261..9b18cf96dc 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java
@@ -20,7 +20,11 @@
package org.onap.so.adapters.vevnfm.service;
-import static org.mockito.Mockito.*;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import java.util.Collections;
+import java.util.List;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -30,62 +34,35 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.so.adapters.vevnfm.aai.AaiConnection;
-import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
@RunWith(MockitoJUnitRunner.class)
public class StartupServiceTest {
- @Mock
- private AaiConnection aaiConnection;
+ private static final String URL = "rt";
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
@Mock
- private SubscriberService subscriberService;
+ private AaiConnection aaiConnection;
@InjectMocks
private StartupService startupService;
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
@Test
public void testSuccess() throws Exception {
// given
final EsrSystemInfo info = new EsrSystemInfo();
- info.setServiceUrl("lh");
- when(aaiConnection.receiveVnfm()).thenReturn(info);
- when(subscriberService.subscribe(info)).thenReturn(true);
-
- // when
- startupService.run();
-
- // then
- verify(aaiConnection, times(1)).receiveVnfm();
- verify(subscriberService, times(1)).subscribe(info);
- }
-
- @Test
- public void testFailureAai() throws Exception {
- // given
- final EsrSystemInfo info = new EsrSystemInfo();
- when(aaiConnection.receiveVnfm()).thenReturn(info);
+ info.setServiceUrl(URL);
+ final List<EsrSystemInfo> infos = Collections.singletonList(info);
- thrown.expect(VeVnfmException.class);
+ when(aaiConnection.receiveVnfm()).thenReturn(infos);
// when
- startupService.run();
- }
+ final List<EsrSystemInfo> systemInfo = startupService.receiveVnfm();
- @Test
- public void testFailureSubscriber() throws Exception {
- // given
- final EsrSystemInfo info = new EsrSystemInfo();
- info.setServiceUrl("lh");
- when(aaiConnection.receiveVnfm()).thenReturn(info);
- when(subscriberService.subscribe(info)).thenReturn(false);
-
- thrown.expect(VeVnfmException.class);
-
- // when
- startupService.run();
+ // then
+ verify(aaiConnection).receiveVnfm();
+ assertEquals(infos, systemInfo);
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSenderTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java
index d1fda0eee6..b7f1f982a2 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/subscription/SubscribeSenderTest.java
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java
@@ -18,9 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vevnfm.subscription;
+package org.onap.so.adapters.vevnfm.service;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
+import static org.onap.so.adapters.vevnfm.service.SubscribeSender.SLASH;
import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
import static org.springframework.test.web.client.ExpectedCount.once;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.*;
@@ -33,6 +34,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.so.adapters.vevnfm.configuration.StartupConfiguration;
+import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -50,8 +52,9 @@ import org.springframework.web.client.RestTemplate;
@ActiveProfiles(StartupConfiguration.TEST_PROFILE)
public class SubscribeSenderTest {
- private static final String SLASH = "/";
- private static final String MINIMAL_JSON_CONTENT = "{}";
+ private static final String URL = "lh";
+ private static final String ID = "1a2s3d4f";
+ private static final String JSON = "{\"id\":\"" + ID + "\"}";
private static final Gson GSON;
@@ -78,22 +81,22 @@ public class SubscribeSenderTest {
}
@Test
- public void testSuccess() {
+ public void testSuccess() throws VeVnfmException {
// given
final EsrSystemInfo info = new EsrSystemInfo();
- info.setServiceUrl("lh");
+ info.setServiceUrl(URL);
final LccnSubscriptionRequest request = new LccnSubscriptionRequest();
mockRestServer.expect(once(), requestTo(SLASH + info.getServiceUrl() + vnfmSubscription))
.andExpect(header(CONTENT_TYPE, CoreMatchers.containsString(MediaType.APPLICATION_JSON_VALUE)))
.andExpect(method(HttpMethod.POST)).andExpect(content().json(GSON.toJson(request)))
- .andRespond(withStatus(HttpStatus.CREATED).body(MINIMAL_JSON_CONTENT));
+ .andRespond(withStatus(HttpStatus.CREATED).body(JSON).contentType(MediaType.APPLICATION_JSON));
// when
- final boolean done = sender.send(info, request);
+ final String id = sender.send(info, request);
// then
- assertTrue(done);
mockRestServer.verify();
+ assertEquals(ID, id);
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java
new file mode 100644
index 0000000000..d3da7c86ec
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SO
+ * ================================================================================
+ * Copyright (C) 2020 Samsung. 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.onap.so.adapters.vevnfm.service;
+
+import static org.junit.Assert.assertNull;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import java.util.Collections;
+import java.util.List;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.EsrSystemInfo;
+
+@RunWith(MockitoJUnitRunner.class)
+public class SubscriptionSchedulerTest {
+
+ private static final String URL = "url";
+ private static final String ID = "id044";
+
+ @Mock
+ private SubscriberService subscriberService;
+
+ @InjectMocks
+ private SubscriptionScheduler subscriptionScheduler;
+
+ @Test
+ public void testFullScenario() throws Exception {
+ // given
+ final EsrSystemInfo info = new EsrSystemInfo();
+ info.setServiceUrl(URL);
+ final List<EsrSystemInfo> infos = Collections.singletonList(info);
+
+ when(subscriberService.subscribe(eq(info))).thenReturn(ID);
+ when(subscriberService.checkSubscription(eq(info), eq(ID))).thenReturn(false);
+
+ // when
+ subscriptionScheduler.setInfos(infos);
+ subscriptionScheduler.subscribeTask();
+ subscriptionScheduler.checkSubscribeTask();
+
+ // then
+ verify(subscriberService).subscribe(info);
+ verify(subscriberService).checkSubscription(info, ID);
+
+ assertNull(subscriptionScheduler.getEsrIds().get(0).getId());
+ }
+}
diff --git a/adapters/mso-vfc-adapter/pom.xml b/adapters/mso-vfc-adapter/pom.xml
index 09dd512629..451831f966 100644
--- a/adapters/mso-vfc-adapter/pom.xml
+++ b/adapters/mso-vfc-adapter/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-vfc-adapter</artifactId>
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/constant/CommonConstant.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/constant/CommonConstant.java
index 04c6749b61..51a0fc0c97 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/constant/CommonConstant.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/constant/CommonConstant.java
@@ -33,17 +33,32 @@ public class CommonConstant {
public static final String STR_EMPTY = "";
public static final String NFVO_CREATE_URL = "/api/nslcm/v1/ns";
+ public static final String SOL005_NFVO_CREATE_URL = "/api/nslcm/v1/ns_instances";
public static final String NFVO_INSTANTIATE_URL = "/api/nslcm/v1/ns/%s/instantiate";
+ public static final String SOL005_NFVO_INSTANTIATE_URL = "/api/nslcm/v1/ns_instances/%s/instantiate";
public static final String NFVO_TERMINATE_URL = "/api/nslcm/v1/ns/%s/terminate";
+ public static final String SOL005_NFVO_TERMINATE_URL = "/api/nslcm/v1/ns_instances/%s/terminate";
public static final String NFVO_DELETE_URL = "/api/nslcm/v1/ns/%s";
+ public static final String SOL005_NFVO_DELETE_URL = "/api/nslcm/v1/ns_instances/%s";
public static final String NFVO_QUERY_URL = "/api/nslcm/v1/jobs/%s";
+ public static final String SOL005_NFVO_QUERY_URL = "/api/nslcm/v1/ns_lcm_op_occs/%s";
public static final String NFVO_SCALE_URL = "/api/nslcm/v1/ns/%s/scale";
+ public enum operationState {
+ PROCESSING, COMPLETED, PARTIALLY_COMPLETED, FAILED_TEMP, FAILED, ROLLING_BACK, ROLLED_BACK
+ }
+ public enum lcmOperationType {
+ INSTANTIATE, SCALE, UPDATE, TERMINATE, HEAL
+ };
+ public enum cancelMode {
+ GRACEFUL, FORCEFUL
+ };
+
/**
*
* <br>
@@ -107,8 +122,11 @@ public class CommonConstant {
public static final String DESC = "description";
public static final String NS_INSTANCE_ID = "nsInstanceId";
+ public static final String SOL005_NS_INSTANCE_ID = "id";
+
public static final String JOB_ID = "jobId";
+ public static final String JOB_URI = "Location";
public static final String ADDITIONAL_PARAM_FOR_NS = "additionalParamForNs";
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AddPnfData.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AddPnfData.java
new file mode 100644
index 0000000000..d312501fd7
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AddPnfData.java
@@ -0,0 +1,68 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+
+package org.onap.so.adapters.vfc.model;
+
+import java.util.List;
+
+public class AddPnfData {
+ private String pnfId;
+ private String pnfName;
+ private String pnfdId;
+ private String pnfProfileId;
+ private List<PnfExtCpData> cpData;
+
+ /***
+ *
+ * @return id of pnf
+ */
+ public String getPnfId() {
+ return pnfId;
+ }
+
+ public void setPnfId(String pnfId) {
+ this.pnfId = pnfId;
+ }
+
+ public String getPnfName() {
+ return pnfName;
+ }
+
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
+ }
+
+ public String getPnfdId() {
+ return pnfdId;
+ }
+
+ public void setPnfdId(String pnfdId) {
+ this.pnfdId = pnfdId;
+ }
+
+ public String getPnfProfileId() {
+ return pnfProfileId;
+ }
+
+ public void setPnfProfileId(String pnfProfileId) {
+ this.pnfProfileId = pnfProfileId;
+ }
+
+ public List<PnfExtCpData> getCpData() {
+ return cpData;
+ }
+
+ public void setCpData(List<PnfExtCpData> cpData) {
+ this.cpData = cpData;
+ }
+}
+
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AddressRange.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AddressRange.java
new file mode 100644
index 0000000000..9f357a549d
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AddressRange.java
@@ -0,0 +1,33 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class AddressRange {
+ private String minAddress;
+ private String maxAddress;
+
+ public String getMinAddress() {
+ return minAddress;
+ }
+
+ public void setMinAddress(String minAddress) {
+ this.minAddress = minAddress;
+ }
+
+ public String getMaxAddress() {
+ return maxAddress;
+ }
+
+ public void setMaxAddress(String maxAddress) {
+ this.maxAddress = maxAddress;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedNs.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedNs.java
new file mode 100644
index 0000000000..fa502f3962
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedNs.java
@@ -0,0 +1,40 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class AffectedNs {
+ private String nsInstanceId;
+ private String nsdId;
+
+ private enum changeType {
+ ADD, REMOVE, INSTANTIATE, TERMINATE, SCALE, UPDATE, HEAL
+ }
+ private enum changeResult {
+ COMPLETED, ROLLED_BACK, FAILED, PARTIALLY_COMPLETED
+ }
+
+ public String getNsInstanceId() {
+ return nsInstanceId;
+ }
+
+ public void setNsInstanceId(String nsInstanceId) {
+ this.nsInstanceId = nsInstanceId;
+ }
+
+ public String getNsdId() {
+ return nsdId;
+ }
+
+ public void setNsdId(String nsdId) {
+ this.nsdId = nsdId;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedPnf.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedPnf.java
new file mode 100644
index 0000000000..9d98e1c256
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedPnf.java
@@ -0,0 +1,67 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class AffectedPnf {
+ private String pnfid;
+ private String pnfdid;
+ private String pnfProfileId;
+ private String pnfName;
+ private String cpInstanceId;
+
+ private enum changeType {
+ ADD, REMOVE, MODIFY
+ }
+ private enum changeResult {
+ COMPLETED, ROLLED_BACK, FAILED
+ }
+
+ public String getPnfid() {
+ return pnfid;
+ }
+
+ public void setPnfid(String pnfid) {
+ this.pnfid = pnfid;
+ }
+
+ public String getPnfdid() {
+ return pnfdid;
+ }
+
+ public void setPnfdid(String pnfdid) {
+ this.pnfdid = pnfdid;
+ }
+
+ public String getPnfProfileId() {
+ return pnfProfileId;
+ }
+
+ public void setPnfProfileId(String pnfProfileId) {
+ this.pnfProfileId = pnfProfileId;
+ }
+
+ public String getPnfName() {
+ return pnfName;
+ }
+
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
+ }
+
+ public String getCpInstanceId() {
+ return cpInstanceId;
+ }
+
+ public void setCpInstanceId(String cpInstanceId) {
+ this.cpInstanceId = cpInstanceId;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedSap.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedSap.java
new file mode 100644
index 0000000000..62f4f92fa9
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedSap.java
@@ -0,0 +1,49 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class AffectedSap {
+ private String sapInstanceId;
+ private String sapdId;
+ private String sapName;
+
+ private enum changeType {
+ ADD, REMOVE, MODIFY
+ }
+ private enum changeResult {
+ COMPLETED, ROLLED_BACK, FAILED
+ }
+
+ public String getSapInstanceId() {
+ return sapInstanceId;
+ }
+
+ public void setSapInstanceId(String sapInstanceId) {
+ this.sapInstanceId = sapInstanceId;
+ }
+
+ public String getSapdId() {
+ return sapdId;
+ }
+
+ public void setSapdId(String sapdId) {
+ this.sapdId = sapdId;
+ }
+
+ public String getSapName() {
+ return sapName;
+ }
+
+ public void setSapName(String sapName) {
+ this.sapName = sapName;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedVirtualLink.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedVirtualLink.java
new file mode 100644
index 0000000000..ecaa1c5d3b
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedVirtualLink.java
@@ -0,0 +1,49 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class AffectedVirtualLink {
+ private String nsVirtualLinkInstanceId;
+ private String nsVirtualLinkDescId;
+ private String vlProfileId;
+
+ private enum changeType {
+ ADD, DELETE, MODIFY, ADD_LINK_PORT, REMOVE_LINK_PORT
+ };
+ private enum changeResult {
+ COMPLETED, ROLLED_BACK, FAILED
+ }
+
+ public String getNsVirtualLinkInstanceId() {
+ return nsVirtualLinkInstanceId;
+ }
+
+ public void setNsVirtualLinkInstanceId(String nsVirtualLinkInstanceId) {
+ this.nsVirtualLinkInstanceId = nsVirtualLinkInstanceId;
+ }
+
+ public String getNsVirtualLinkDescId() {
+ return nsVirtualLinkDescId;
+ }
+
+ public void setNsVirtualLinkDescId(String nsVirtualLinkDescId) {
+ this.nsVirtualLinkDescId = nsVirtualLinkDescId;
+ }
+
+ public String getVlProfileId() {
+ return vlProfileId;
+ }
+
+ public void setVlProfileId(String vlProfileId) {
+ this.vlProfileId = vlProfileId;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnf.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnf.java
new file mode 100644
index 0000000000..6463c7a129
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnf.java
@@ -0,0 +1,78 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class AffectedVnf {
+ private String vnfInstanceId;
+ private String vnfdId;
+ private String vnfProfileId;
+ private String vnfName;
+
+ private enum changeType {
+ ADD,
+ REMOVE,
+ INSTANTIATE,
+ TERMINATE,
+ SCALE,
+ CHANGE_FLAVOUR,
+ HEAL,
+ OPERATE,
+ MODIFY_INFORMATION,
+ CHANGE_EXTERNAL_VNF_CONNECTIVITY
+ };
+ private enum changeResult {
+ COMPLETED, ROLLED_BACK, FAILED
+ }
+
+ private ChangedInfo changedInfo;
+
+
+ public String getVnfInstanceId() {
+ return vnfInstanceId;
+ }
+
+ public void setVnfInstanceId(String vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
+
+ public String getVnfdId() {
+ return vnfdId;
+ }
+
+ public void setVnfdId(String vnfdId) {
+ this.vnfdId = vnfdId;
+ }
+
+ public String getVnfProfileId() {
+ return vnfProfileId;
+ }
+
+ public void setVnfProfileId(String vnfProfileId) {
+ this.vnfProfileId = vnfProfileId;
+ }
+
+ public String getVnfName() {
+ return vnfName;
+ }
+
+ public void setVnfName(String vnfName) {
+ this.vnfName = vnfName;
+ }
+
+ public ChangedInfo getChangedInfo() {
+ return changedInfo;
+ }
+
+ public void setChangedInfo(ChangedInfo changedInfo) {
+ this.changedInfo = changedInfo;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnffg.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnffg.java
new file mode 100644
index 0000000000..04e9481190
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffectedVnffg.java
@@ -0,0 +1,40 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class AffectedVnffg {
+ private String vnffgInstanceId;
+ private String vnffgdId;
+
+ private enum changeType {
+ ADD, REMOVE, MODIFY
+ }
+ private enum changeResult {
+ COMPLETED, ROLLED_BACK, FAILED
+ }
+
+ public String getVnffgInstanceId() {
+ return vnffgInstanceId;
+ }
+
+ public void setVnffgInstanceId(String vnffgInstanceId) {
+ this.vnffgInstanceId = vnffgInstanceId;
+ }
+
+ public String getVnffgdId() {
+ return vnffgdId;
+ }
+
+ public void setVnffgdId(String vnffgdId) {
+ this.vnffgdId = vnffgdId;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRule.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRule.java
new file mode 100644
index 0000000000..7f019bcf40
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRule.java
@@ -0,0 +1,51 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import java.util.List;
+
+public class AffinityOrAntiAffinityRule {
+ private String vnfdId;
+ private List<String> vnfProfileId;
+ private List<String> vnfInstanceId;
+
+ private enum affinityOrAntiAffiinty {
+ AFFINITY, ANTI_AFFIINTY
+ };
+ private enum scope {
+ NFVI_POP, ZONE, ZONE_GROUP, NFVI_NODE
+ };
+
+ public String getVnfdId() {
+ return vnfdId;
+ }
+
+ public void setVnfdId(String vnfdId) {
+ this.vnfdId = vnfdId;
+ }
+
+ public List<String> getVnfProfileId() {
+ return vnfProfileId;
+ }
+
+ public void setVnfProfileId(List<String> vnfProfileId) {
+ this.vnfProfileId = vnfProfileId;
+ }
+
+ public List<String> getVnfInstanceId() {
+ return vnfInstanceId;
+ }
+
+ public void setVnfInstanceId(List<String> vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ChangedInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ChangedInfo.java
new file mode 100644
index 0000000000..5de6cbf139
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ChangedInfo.java
@@ -0,0 +1,33 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class ChangedInfo {
+ private ModifyVnfInfoData changedVnfInfo;
+ private ExtVirtualLinkInfo changedExtConnectivity;
+
+ public ModifyVnfInfoData getChangedVnfInfo() {
+ return changedVnfInfo;
+ }
+
+ public void setChangedVnfInfo(ModifyVnfInfoData changedVnfInfo) {
+ this.changedVnfInfo = changedVnfInfo;
+ }
+
+ public ExtVirtualLinkInfo getChangedExtConnectivity() {
+ return changedExtConnectivity;
+ }
+
+ public void setChangedExtConnectivity(ExtVirtualLinkInfo changedExtConnectivity) {
+ this.changedExtConnectivity = changedExtConnectivity;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CivicAddressElement.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CivicAddressElement.java
new file mode 100644
index 0000000000..2a63d39be0
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CivicAddressElement.java
@@ -0,0 +1,33 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class CivicAddressElement {
+ private int caType;
+ private String caValue;
+
+ public int getCaType() {
+ return caType;
+ }
+
+ public void setCaType(int caType) {
+ this.caType = caType;
+ }
+
+ public String getCaValue() {
+ return caValue;
+ }
+
+ public void setCaValue(String caValue) {
+ this.caValue = caValue;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolData.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolData.java
new file mode 100644
index 0000000000..27272ea22a
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolData.java
@@ -0,0 +1,33 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class CpProtocolData {
+ private String layerProtocol;
+ private IpOverEthernetAddressData ipOverEthernet;
+
+ public String getLayerProtocol() {
+ return layerProtocol;
+ }
+
+ public void setLayerProtocol(String layerProtocol) {
+ this.layerProtocol = layerProtocol;
+ }
+
+ public IpOverEthernetAddressData getIpOverEthernet() {
+ return ipOverEthernet;
+ }
+
+ public void setIpOverEthernet(IpOverEthernetAddressData ipOverEthernet) {
+ this.ipOverEthernet = ipOverEthernet;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolInfo.java
new file mode 100644
index 0000000000..5f1191efe9
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CpProtocolInfo.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+
+public class CpProtocolInfo {
+ @NotNull
+ private enum layerProtocol {
+ IP_OVER_ETHERNET
+ };
+
+ private IpOverEthernetAddressData ipOverEthernet;
+
+ public IpOverEthernetAddressData getIpOverEthernet() {
+ return ipOverEthernet;
+ }
+
+ public void setIpOverEthernet(IpOverEthernetAddressData ipOverEthernet) {
+ this.ipOverEthernet = ipOverEthernet;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CreateNsRequest.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CreateNsRequest.java
new file mode 100644
index 0000000000..878ce60ba1
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CreateNsRequest.java
@@ -0,0 +1,53 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class CreateNsRequest {
+
+ String nsdId;
+
+ String nsName;
+
+ String nsDescription;
+
+
+ public String getNsdId() {
+ return nsdId;
+ }
+
+ public void setNsdId(String nsdId) {
+ this.nsdId = nsdId;
+ }
+
+ public String getNsDescription() {
+ return nsDescription;
+ }
+
+ public void setNsDescription(String nsDescription) {
+ this.nsDescription = nsDescription;
+ }
+
+ /**
+ * @return Returns the nsName.
+ */
+ public String getNsName() {
+ return nsName;
+ }
+
+ /**
+ * @param nsName The nsName to set.
+ */
+ public void setNsName(String nsName) {
+ this.nsName = nsName;
+ }
+
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtCpInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtCpInfo.java
new file mode 100644
index 0000000000..63ca66bd43
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtCpInfo.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+public class ExtCpInfo {
+ @NotNull
+ private String id;
+ @NotNull
+ private String cpdId;
+ private List<CpProtocolData> cpProtocolInfo;
+ private List<String> extLinkPortId;
+
+
+
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfo.java
new file mode 100644
index 0000000000..a1ab3fdb97
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfo.java
@@ -0,0 +1,33 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class ExtLinkPortInfo {
+ private String id;
+ private ResourceHandle resourceHandle;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public ResourceHandle getResourceHandle() {
+ return resourceHandle;
+ }
+
+ public void setResourceHandle(ResourceHandle resourceHandle) {
+ this.resourceHandle = resourceHandle;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtManagedVirtualLinkInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtManagedVirtualLinkInfo.java
new file mode 100644
index 0000000000..3f643a8330
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtManagedVirtualLinkInfo.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+public class ExtManagedVirtualLinkInfo {
+ @NotNull
+ private String id;
+ @NotNull
+ private String vnfVirtualLinkDescId;
+ @NotNull
+ private ResourceHandle networkResource;
+ private List<VnfLinkPortInfo> vnfLinkPorts;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getVnfVirtualLinkDescId() {
+ return vnfVirtualLinkDescId;
+ }
+
+ public void setVnfVirtualLinkDescId(String vnfVirtualLinkDescId) {
+ this.vnfVirtualLinkDescId = vnfVirtualLinkDescId;
+ }
+
+ public ResourceHandle getNetworkResource() {
+ return networkResource;
+ }
+
+ public void setNetworkResource(ResourceHandle networkResource) {
+ this.networkResource = networkResource;
+ }
+
+ public List<VnfLinkPortInfo> getVnfLinkPorts() {
+ return vnfLinkPorts;
+ }
+
+ public void setVnfLinkPorts(List<VnfLinkPortInfo> vnfLinkPorts) {
+ this.vnfLinkPorts = vnfLinkPorts;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfo.java
new file mode 100644
index 0000000000..ce7d1cfe6d
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfo.java
@@ -0,0 +1,42 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class ExtVirtualLinkInfo {
+ private String id;
+ private ResourceHandle resourceHandle;
+ private ExtLinkPortInfo extLinkPorts;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public ResourceHandle getResourceHandle() {
+ return resourceHandle;
+ }
+
+ public void setResourceHandle(ResourceHandle resourceHandle) {
+ this.resourceHandle = resourceHandle;
+ }
+
+ public ExtLinkPortInfo getExtLinkPorts() {
+ return extLinkPorts;
+ }
+
+ public void setExtLinkPorts(ExtLinkPortInfo extLinkPorts) {
+ this.extLinkPorts = extLinkPorts;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/InstantiateNsRequest.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/InstantiateNsRequest.java
new file mode 100644
index 0000000000..ff0730a527
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/InstantiateNsRequest.java
@@ -0,0 +1,207 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class InstantiateNsRequest {
+
+ private String nsFlavourId;
+ private List<SapData> sapData;
+ private List<AddPnfData> addpnfData;
+ private List<VnfInstanceData> vnfInstanceData;
+ private List<String> nestedNsInstanceId;
+ private List<VnfLocationConstraint> localizationLanguage;
+ private Map<String, Object> aditionalParamsForNs;
+ private List<ParamsForVnf> additionalParamsForVnf;
+ private String startTime;
+ private String nsInstantiationLevelId;
+ private List<AffinityOrAntiAffinityRule> additionalAffinityOrAntiAffiniityRule;
+
+ /***
+ *
+ * @return nsFlavourId
+ */
+ public String getNsFlavourId() {
+ return nsFlavourId;
+ }
+
+ /***
+ *
+ * @param nsFlavourId
+ */
+ public void setNsFlavourId(String nsFlavourId) {
+ this.nsFlavourId = nsFlavourId;
+ }
+
+ /***
+ *
+ * @return
+ */
+ public List<SapData> getSapData() {
+ return sapData;
+ }
+
+ /***
+ *
+ * @param sapData
+ */
+ public void setSapData(List<SapData> sapData) {
+ this.sapData = sapData;
+ }
+
+ /***
+ *
+ * @return
+ */
+ public List<AddPnfData> getAddpnfData() {
+ return addpnfData;
+ }
+
+ /***
+ *
+ * @param addpnfData
+ */
+ public void setAddpnfData(List<AddPnfData> addpnfData) {
+ this.addpnfData = addpnfData;
+ }
+
+ /***
+ *
+ * @return
+ */
+ public List<VnfInstanceData> getVnfInstanceData() {
+ return vnfInstanceData;
+ }
+
+ /***
+ *
+ * @param vnfInstanceData
+ */
+ public void setVnfInstanceData(List<VnfInstanceData> vnfInstanceData) {
+ this.vnfInstanceData = vnfInstanceData;
+ }
+
+ /***
+ *
+ * @return
+ */
+ public List<String> getNestedNsInstanceId() {
+ return nestedNsInstanceId;
+ }
+
+ /***
+ *
+ * @param nestedNsInstanceId
+ */
+ public void setNestedNsInstanceId(List<String> nestedNsInstanceId) {
+ this.nestedNsInstanceId = nestedNsInstanceId;
+ }
+
+ /***
+ *
+ * @return
+ */
+ public List<VnfLocationConstraint> getLocalizationLanguage() {
+ return localizationLanguage;
+ }
+
+ /***
+ *
+ * @param localizationLanguage
+ */
+ public void setLocalizationLanguage(List<VnfLocationConstraint> localizationLanguage) {
+ this.localizationLanguage = localizationLanguage;
+ }
+
+ /***
+ *
+ * @return
+ */
+ public Map<String, Object> getAditionalParamsForNs() {
+ return aditionalParamsForNs;
+ }
+
+ /***
+ *
+ * @param aditionalParamsForNs
+ */
+ public void setAditionalParamsForNs(Map<String, Object> aditionalParamsForNs) {
+ this.aditionalParamsForNs = aditionalParamsForNs;
+ }
+
+ /***
+ *
+ * @return
+ */
+ public List<ParamsForVnf> getAdditionalParamsForVnf() {
+ return additionalParamsForVnf;
+ }
+
+ /***
+ *
+ * @param additionalParamsForVnf
+ */
+ public void setAdditionalParamsForVnf(List<ParamsForVnf> additionalParamsForVnf) {
+ this.additionalParamsForVnf = additionalParamsForVnf;
+ }
+
+ /***
+ *
+ * @return
+ */
+ public String getStartTime() {
+ return startTime;
+ }
+
+ /***
+ *
+ * @param startTime
+ */
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+
+ /***
+ *
+ * @return
+ */
+ public String getNsInstantiationLevelId() {
+ return nsInstantiationLevelId;
+ }
+
+ /***
+ *
+ * @param nsInstantiationLevelId
+ */
+ public void setNsInstantiationLevelId(String nsInstantiationLevelId) {
+ this.nsInstantiationLevelId = nsInstantiationLevelId;
+ }
+
+ /***
+ *
+ * @return
+ */
+ public List<AffinityOrAntiAffinityRule> getAdditionalAffinityOrAntiAffiniityRule() {
+ return additionalAffinityOrAntiAffiniityRule;
+ }
+
+ /***
+ *
+ * @param additionalAffinityOrAntiAffiniityRule
+ */
+ public void setAdditionalAffinityOrAntiAffiniityRule(
+ List<AffinityOrAntiAffinityRule> additionalAffinityOrAntiAffiniityRule) {
+ this.additionalAffinityOrAntiAffiniityRule = additionalAffinityOrAntiAffiniityRule;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/InstantiatedVnfInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/InstantiatedVnfInfo.java
new file mode 100644
index 0000000000..83a8a56756
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/InstantiatedVnfInfo.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+import java.util.Map;
+
+public class InstantiatedVnfInfo {
+ @NotNull
+ private String flavourId;
+ @NotNull
+ private String vnfState;
+ private List<VnfScaleInfo> vnfScaleInfos;
+ @NotNull
+ private List<ExtCpInfo> extCpInfo;
+ private List<ExtVirtualLinkInfo> extVirtualLinkInfo;
+ private List<ExtManagedVirtualLinkInfo> extManagedVirtualLinkInfo;
+ // Defination of MonitoringParameter is not there in ETSI document
+ // considering as String
+ private List<String> monitoringParameters;
+ private String localizationLanguage;
+
+ private List<VnfcResourceInfo> vnfcResourceInfo;
+ // Defination of VirtualStorageResourceInfo is not there in ETSI document
+ // considering as String
+ private List<String> virtualStorageResourceInfo;
+
+ public String getFlavourId() {
+ return flavourId;
+ }
+
+ public void setFlavourId(String flavourId) {
+ this.flavourId = flavourId;
+ }
+
+ public String getVnfState() {
+ return vnfState;
+ }
+
+ public void setVnfState(String vnfState) {
+ this.vnfState = vnfState;
+ }
+
+ public List<VnfScaleInfo> getVnfScaleInfos() {
+ return vnfScaleInfos;
+ }
+
+ public void setVnfScaleInfos(List<VnfScaleInfo> vnfScaleInfos) {
+ this.vnfScaleInfos = vnfScaleInfos;
+ }
+
+ public List<ExtCpInfo> getExtCpInfo() {
+ return extCpInfo;
+ }
+
+ public void setExtCpInfo(List<ExtCpInfo> extCpInfo) {
+ this.extCpInfo = extCpInfo;
+ }
+
+ public List<ExtVirtualLinkInfo> getExtVirtualLinkInfo() {
+ return extVirtualLinkInfo;
+ }
+
+ public void setExtVirtualLinkInfo(List<ExtVirtualLinkInfo> extVirtualLinkInfo) {
+ this.extVirtualLinkInfo = extVirtualLinkInfo;
+ }
+
+ public List<ExtManagedVirtualLinkInfo> getExtManagedVirtualLinkInfo() {
+ return extManagedVirtualLinkInfo;
+ }
+
+ public void setExtManagedVirtualLinkInfo(List<ExtManagedVirtualLinkInfo> extManagedVirtualLinkInfo) {
+ this.extManagedVirtualLinkInfo = extManagedVirtualLinkInfo;
+ }
+
+ public List<String> getMonitoringParameters() {
+ return monitoringParameters;
+ }
+
+ public void setMonitoringParameters(List<String> monitoringParameters) {
+ this.monitoringParameters = monitoringParameters;
+ }
+
+ public String getLocalizationLanguage() {
+ return localizationLanguage;
+ }
+
+ public void setLocalizationLanguage(String localizationLanguage) {
+ this.localizationLanguage = localizationLanguage;
+ }
+
+ public List<VnfcResourceInfo> getVnfcResourceInfo() {
+ return vnfcResourceInfo;
+ }
+
+ public void setVnfcResourceInfo(List<VnfcResourceInfo> vnfcResourceInfo) {
+ this.vnfcResourceInfo = vnfcResourceInfo;
+ }
+
+ public List<String> getVirtualStorageResourceInfo() {
+ return virtualStorageResourceInfo;
+ }
+
+ public void setVirtualStorageResourceInfo(List<String> virtualStorageResourceInfo) {
+ this.virtualStorageResourceInfo = virtualStorageResourceInfo;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/IpAddresses.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/IpAddresses.java
new file mode 100644
index 0000000000..32c5571d96
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/IpAddresses.java
@@ -0,0 +1,63 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import java.util.List;
+
+public class IpAddresses {
+ private String type;
+ private List<String> fixedAddresses;
+ private int numDynamicAddresses;
+ private AddressRange addressRange;
+ private String subnetId;
+
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public List<String> getFixedAddresses() {
+ return fixedAddresses;
+ }
+
+ public void setFixedAddresses(List<String> fixedAddresses) {
+ this.fixedAddresses = fixedAddresses;
+ }
+
+ public int getNumDynamicAddresses() {
+ return numDynamicAddresses;
+ }
+
+ public void setNumDynamicAddresses(int numDynamicAddresses) {
+ this.numDynamicAddresses = numDynamicAddresses;
+ }
+
+ public AddressRange getAddressRange() {
+ return addressRange;
+ }
+
+ public void setAddressRange(AddressRange addressRange) {
+ this.addressRange = addressRange;
+ }
+
+ public String getSubnetId() {
+ return subnetId;
+ }
+
+ public void setSubnetId(String subnetId) {
+ this.subnetId = subnetId;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressData.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressData.java
new file mode 100644
index 0000000000..48529e5f76
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressData.java
@@ -0,0 +1,35 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import java.util.List;
+
+public class IpOverEthernetAddressData {
+ private String macAddress;
+ private List<IpAddresses> ipAddresses;
+
+ public String getMacAddress() {
+ return macAddress;
+ }
+
+ public void setMacAddress(String macAddress) {
+ this.macAddress = macAddress;
+ }
+
+ public List<IpAddresses> getIpAddresses() {
+ return ipAddresses;
+ }
+
+ public void setIpAddresses(List<IpAddresses> ipAddresses) {
+ this.ipAddresses = ipAddresses;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/Link.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/Link.java
new file mode 100644
index 0000000000..2459346826
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/Link.java
@@ -0,0 +1,24 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class Link {
+ private String href;
+
+ public String getHref() {
+ return href;
+ }
+
+ public void setHref(String href) {
+ this.href = href;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/Links.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/Links.java
new file mode 100644
index 0000000000..8ad8f000c1
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/Links.java
@@ -0,0 +1,78 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class Links {
+ private Link self;
+ private Link nsInstance;
+ private Link cancel;
+ private Link retry;
+ private Link rollback;
+ private Link continues;
+ private Link fail;
+
+ public Link getSelf() {
+ return self;
+ }
+
+ public void setSelf(Link self) {
+ this.self = self;
+ }
+
+ public Link getNsInstance() {
+ return nsInstance;
+ }
+
+ public void setNsInstance(Link nsInstance) {
+ this.nsInstance = nsInstance;
+ }
+
+ public Link getCancel() {
+ return cancel;
+ }
+
+ public void setCancel(Link cancel) {
+ this.cancel = cancel;
+ }
+
+ public Link getRetry() {
+ return retry;
+ }
+
+ public void setRetry(Link retry) {
+ this.retry = retry;
+ }
+
+ public Link getRollback() {
+ return rollback;
+ }
+
+ public void setRollback(Link rollback) {
+ this.rollback = rollback;
+ }
+
+ public Link getContinues() {
+ return continues;
+ }
+
+ public void setContinues(Link continues) {
+ this.continues = continues;
+ }
+
+ public Link getFail() {
+ return fail;
+ }
+
+ public void setFail(Link fail) {
+ this.fail = fail;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraints.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraints.java
new file mode 100644
index 0000000000..b636d49edf
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraints.java
@@ -0,0 +1,33 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class LocationConstraints {
+ private String countryCode;
+ private CivicAddressElement civicAddressElement;
+
+ public String getCountryCode() {
+ return countryCode;
+ }
+
+ public void setCountryCode(String countryCode) {
+ this.countryCode = countryCode;
+ }
+
+ public CivicAddressElement getCivicAddressElement() {
+ return civicAddressElement;
+ }
+
+ public void setCivicAddressElement(CivicAddressElement civicAddressElement) {
+ this.civicAddressElement = civicAddressElement;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/Mask.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/Mask.java
new file mode 100644
index 0000000000..352f47e19f
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/Mask.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+
+public class Mask {
+ @NotNull
+ private int startingPoint;
+ @NotNull
+ private int length;
+ @NotNull
+ private String value;
+
+ public int getStartingPoint() {
+ return startingPoint;
+ }
+
+ public void setStartingPoint(int startingPoint) {
+ this.startingPoint = startingPoint;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ public void setLength(int length) {
+ this.length = length;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoData.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoData.java
new file mode 100644
index 0000000000..55ab21e8e2
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoData.java
@@ -0,0 +1,80 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import java.util.Map;
+
+public class ModifyVnfInfoData {
+ private String vnfInstanceId;
+ private String vnfInstanceName;
+ private String vnfInstanceDescription;
+ private String vnfPkgId;
+ private Map<String, Object> vnfConfigurableProperties;
+ private Map<String, Object> Metadata;
+ private Map<String, Object> Extensions;
+
+ public String getVnfInstanceId() {
+ return vnfInstanceId;
+ }
+
+ public void setVnfInstanceId(String vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
+
+ public String getVnfInstanceName() {
+ return vnfInstanceName;
+ }
+
+ public void setVnfInstanceName(String vnfInstanceName) {
+ this.vnfInstanceName = vnfInstanceName;
+ }
+
+ public String getVnfInstanceDescription() {
+ return vnfInstanceDescription;
+ }
+
+ public void setVnfInstanceDescription(String vnfInstanceDescription) {
+ this.vnfInstanceDescription = vnfInstanceDescription;
+ }
+
+ public String getVnfPkgId() {
+ return vnfPkgId;
+ }
+
+ public void setVnfPkgId(String vnfPkgId) {
+ this.vnfPkgId = vnfPkgId;
+ }
+
+ public Map<String, Object> getVnfConfigurableProperties() {
+ return vnfConfigurableProperties;
+ }
+
+ public void setVnfConfigurableProperties(Map<String, Object> vnfConfigurableProperties) {
+ this.vnfConfigurableProperties = vnfConfigurableProperties;
+ }
+
+ public Map<String, Object> getMetadata() {
+ return Metadata;
+ }
+
+ public void setMetadata(Map<String, Object> metadata) {
+ Metadata = metadata;
+ }
+
+ public Map<String, Object> getExtensions() {
+ return Extensions;
+ }
+
+ public void setExtensions(Map<String, Object> extensions) {
+ Extensions = extensions;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NfpInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NfpInfo.java
new file mode 100644
index 0000000000..a6e3963725
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NfpInfo.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+public class NfpInfo {
+ @NotNull
+ private String id;
+ private String nfpdId;
+ private String nfpName;
+ private String description;
+ @NotNull
+ private List<NsCpHandle> nscpHandle;
+ private int totalCp;
+ @NotNull
+ private NfpRule nfpRule;
+
+ @NotNull
+ private enum nfpState {
+ ENABLED, DISABLED
+ };
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getNfpdId() {
+ return nfpdId;
+ }
+
+ public void setNfpdId(String nfpdId) {
+ this.nfpdId = nfpdId;
+ }
+
+ public String getNfpName() {
+ return nfpName;
+ }
+
+ public void setNfpName(String nfpName) {
+ this.nfpName = nfpName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public List<NsCpHandle> getNscpHandle() {
+ return nscpHandle;
+ }
+
+ public void setNscpHandle(List<NsCpHandle> nscpHandle) {
+ this.nscpHandle = nscpHandle;
+ }
+
+ public int getTotalCp() {
+ return totalCp;
+ }
+
+ public void setTotalCp(int totalCp) {
+ this.totalCp = totalCp;
+ }
+
+ public NfpRule getNfpRule() {
+ return nfpRule;
+ }
+
+ public void setNfpRule(NfpRule nfpRule) {
+ this.nfpRule = nfpRule;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NfpRule.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NfpRule.java
new file mode 100644
index 0000000000..b4f684a3e2
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NfpRule.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import java.util.List;
+
+public class NfpRule {
+ private String etherDestinationAddress;
+ private String etherSourceAddress;
+
+ private enum etherType {
+ IPV4, IPV6
+ };
+
+ private List<String> vlanTag;
+
+ private enum protocol {
+ TCP, UDP, ICMP
+ }
+
+ private String dscp;
+ private PortRange sourcePortRange;
+ private PortRange destinationPortRange;
+ private String sourceIpAddressPrefix;
+ private String destinationIpAddressPrefix;
+ private List<Mask> extendedCriteria;
+
+ public String getEtherDestinationAddress() {
+ return etherDestinationAddress;
+ }
+
+ public void setEtherDestinationAddress(String etherDestinationAddress) {
+ this.etherDestinationAddress = etherDestinationAddress;
+ }
+
+ public String getEtherSourceAddress() {
+ return etherSourceAddress;
+ }
+
+ public void setEtherSourceAddress(String etherSourceAddress) {
+ this.etherSourceAddress = etherSourceAddress;
+ }
+
+ public List<String> getVlanTag() {
+ return vlanTag;
+ }
+
+ public void setVlanTag(List<String> vlanTag) {
+ this.vlanTag = vlanTag;
+ }
+
+ public String getDscp() {
+ return dscp;
+ }
+
+ public void setDscp(String dscp) {
+ this.dscp = dscp;
+ }
+
+ public PortRange getSourcePortRange() {
+ return sourcePortRange;
+ }
+
+ public void setSourcePortRange(PortRange sourcePortRange) {
+ this.sourcePortRange = sourcePortRange;
+ }
+
+ public PortRange getDestinationPortRange() {
+ return destinationPortRange;
+ }
+
+ public void setDestinationPortRange(PortRange destinationPortRange) {
+ this.destinationPortRange = destinationPortRange;
+ }
+
+ public String getSourceIpAddressPrefix() {
+ return sourceIpAddressPrefix;
+ }
+
+ public void setSourceIpAddressPrefix(String sourceIpAddressPrefix) {
+ this.sourceIpAddressPrefix = sourceIpAddressPrefix;
+ }
+
+ public String getDestinationIpAddressPrefix() {
+ return destinationIpAddressPrefix;
+ }
+
+ public void setDestinationIpAddressPrefix(String destinationIpAddressPrefix) {
+ this.destinationIpAddressPrefix = destinationIpAddressPrefix;
+ }
+
+ public List<Mask> getExtendedCriteria() {
+ return extendedCriteria;
+ }
+
+ public void setExtendedCriteria(List<Mask> extendedCriteria) {
+ this.extendedCriteria = extendedCriteria;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsCpHandle.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsCpHandle.java
new file mode 100644
index 0000000000..326488fb76
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsCpHandle.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class NsCpHandle {
+ private String vnfInstanceId;
+ private String vnfExtCpInstanceId;
+ private String pnfInfoId;
+ private String pnfExtCpInstanceId;
+ private String nsInstanceId;
+ private String nsSapInstanceId;
+
+ public String getVnfInstanceId() {
+ return vnfInstanceId;
+ }
+
+ public void setVnfInstanceId(String vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
+
+ public String getVnfExtCpInstanceId() {
+ return vnfExtCpInstanceId;
+ }
+
+ public void setVnfExtCpInstanceId(String vnfExtCpInstanceId) {
+ this.vnfExtCpInstanceId = vnfExtCpInstanceId;
+ }
+
+ public String getPnfInfoId() {
+ return pnfInfoId;
+ }
+
+ public void setPnfInfoId(String pnfInfoId) {
+ this.pnfInfoId = pnfInfoId;
+ }
+
+ public String getPnfExtCpInstanceId() {
+ return pnfExtCpInstanceId;
+ }
+
+ public void setPnfExtCpInstanceId(String pnfExtCpInstanceId) {
+ this.pnfExtCpInstanceId = pnfExtCpInstanceId;
+ }
+
+ public String getNsInstanceId() {
+ return nsInstanceId;
+ }
+
+ public void setNsInstanceId(String nsInstanceId) {
+ this.nsInstanceId = nsInstanceId;
+ }
+
+ public String getNsSapInstanceId() {
+ return nsSapInstanceId;
+ }
+
+ public void setNsSapInstanceId(String nsSapInstanceId) {
+ this.nsSapInstanceId = nsSapInstanceId;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsInstance.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsInstance.java
new file mode 100644
index 0000000000..d2d4b4e772
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsInstance.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+public class NsInstance {
+ @NotNull
+ private String id;
+ @NotNull
+ private String nsInstanceName;
+ @NotNull
+ private String nsInstanceDescription;
+ @NotNull
+ private String nsdId;
+ @NotNull
+ private String nsdInfoId;
+ private String flavourId;
+ private List<VnfInstance> vnfInstance;
+ private List<PnfInfo> pnfInfo;
+ private List<NsVirtualLinkInfo> virtualLinkInfo;
+ private List<VnffgInfo> vnffgInfo;
+ private List<SapInfo> sapInfo;
+ private List<String> nestedNsInstanceId;
+
+ @NotNull
+ private enum nsState {
+ NOT_INSTANTIATED, INSTANTIATED
+ };
+
+ private List<NsScaleInfo> nsScaleStatus;
+ private List<AffinityOrAntiAffinityRule> additionalAffinityOrAntiAffinityRule;
+ @NotNull
+ private NsInstanceLinks _links;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getNsInstanceName() {
+ return nsInstanceName;
+ }
+
+ public void setNsInstanceName(String nsInstanceName) {
+ this.nsInstanceName = nsInstanceName;
+ }
+
+ public String getNsInstanceDescription() {
+ return nsInstanceDescription;
+ }
+
+ public void setNsInstanceDescription(String nsInstanceDescription) {
+ this.nsInstanceDescription = nsInstanceDescription;
+ }
+
+ public String getNsdId() {
+ return nsdId;
+ }
+
+ public void setNsdId(String nsdId) {
+ this.nsdId = nsdId;
+ }
+
+ public String getNsdInfoId() {
+ return nsdInfoId;
+ }
+
+ public void setNsdInfoId(String nsdInfoId) {
+ this.nsdInfoId = nsdInfoId;
+ }
+
+ public String getFlavourId() {
+ return flavourId;
+ }
+
+ public void setFlavourId(String flavourId) {
+ this.flavourId = flavourId;
+ }
+
+ public List<VnfInstance> getVnfInstance() {
+ return vnfInstance;
+ }
+
+ public void setVnfInstance(List<VnfInstance> vnfInstance) {
+ this.vnfInstance = vnfInstance;
+ }
+
+ public List<PnfInfo> getPnfInfo() {
+ return pnfInfo;
+ }
+
+ public void setPnfInfo(List<PnfInfo> pnfInfo) {
+ this.pnfInfo = pnfInfo;
+ }
+
+ public List<NsVirtualLinkInfo> getVirtualLinkInfo() {
+ return virtualLinkInfo;
+ }
+
+ public void setVirtualLinkInfo(List<NsVirtualLinkInfo> virtualLinkInfo) {
+ this.virtualLinkInfo = virtualLinkInfo;
+ }
+
+ public List<VnffgInfo> getVnffgInfo() {
+ return vnffgInfo;
+ }
+
+ public void setVnffgInfo(List<VnffgInfo> vnffgInfo) {
+ this.vnffgInfo = vnffgInfo;
+ }
+
+ public List<SapInfo> getSapInfo() {
+ return sapInfo;
+ }
+
+ public void setSapInfo(List<SapInfo> sapInfo) {
+ this.sapInfo = sapInfo;
+ }
+
+ public List<String> getNestedNsInstanceId() {
+ return nestedNsInstanceId;
+ }
+
+ public void setNestedNsInstanceId(List<String> nestedNsInstanceId) {
+ this.nestedNsInstanceId = nestedNsInstanceId;
+ }
+
+ public List<NsScaleInfo> getNsScaleStatus() {
+ return nsScaleStatus;
+ }
+
+ public void setNsScaleStatus(List<NsScaleInfo> nsScaleStatus) {
+ this.nsScaleStatus = nsScaleStatus;
+ }
+
+ public List<AffinityOrAntiAffinityRule> getAdditionalAffinityOrAntiAffinityRule() {
+ return additionalAffinityOrAntiAffinityRule;
+ }
+
+ public void setAdditionalAffinityOrAntiAffinityRule(
+ List<AffinityOrAntiAffinityRule> additionalAffinityOrAntiAffinityRule) {
+ this.additionalAffinityOrAntiAffinityRule = additionalAffinityOrAntiAffinityRule;
+ }
+
+ public NsInstanceLinks get_links() {
+ return _links;
+ }
+
+ public void set_links(NsInstanceLinks _links) {
+ this._links = _links;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsInstanceLinks.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsInstanceLinks.java
new file mode 100644
index 0000000000..08b3c63c08
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsInstanceLinks.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+public class NsInstanceLinks {
+ @NotNull
+ private Link self;
+ private List<Link> nestedNsInstances;
+ private Link instantiate;
+ private Link terminate;
+ private Link update;
+ private Link scale;
+ private Link heal;
+
+ public Link getSelf() {
+ return self;
+ }
+
+ public void setSelf(Link self) {
+ this.self = self;
+ }
+
+ public List<Link> getNestedNsInstances() {
+ return nestedNsInstances;
+ }
+
+ public void setNestedNsInstances(List<Link> nestedNsInstances) {
+ this.nestedNsInstances = nestedNsInstances;
+ }
+
+ public Link getInstantiate() {
+ return instantiate;
+ }
+
+ public void setInstantiate(Link instantiate) {
+ this.instantiate = instantiate;
+ }
+
+ public Link getTerminate() {
+ return terminate;
+ }
+
+ public void setTerminate(Link terminate) {
+ this.terminate = terminate;
+ }
+
+ public Link getUpdate() {
+ return update;
+ }
+
+ public void setUpdate(Link update) {
+ this.update = update;
+ }
+
+ public Link getScale() {
+ return scale;
+ }
+
+ public void setScale(Link scale) {
+ this.scale = scale;
+ }
+
+ public Link getHeal() {
+ return heal;
+ }
+
+ public void setHeal(Link heal) {
+ this.heal = heal;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsLcmOpOcc.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsLcmOpOcc.java
new file mode 100644
index 0000000000..559b1f7ba7
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsLcmOpOcc.java
@@ -0,0 +1,125 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.onap.so.adapters.vfc.constant.CommonConstant;
+
+public class NsLcmOpOcc {
+ private String id;
+ private CommonConstant.operationState operationState;
+ private String statusEnteredTime;
+ private String nsInstanceId;
+ private CommonConstant.lcmOperationType lcmOperationType;
+ private String startTime;
+ private Boolean isAutomaticInvocation;
+ private String operationParams;
+ private Boolean isCancelPending;
+ private CommonConstant.cancelMode cancelMode;
+ private ProblemDetails error;
+ private Links links;
+
+ public CommonConstant.lcmOperationType getLcmOperationType() {
+ return lcmOperationType;
+ }
+
+ public void setLcmOperationType(CommonConstant.lcmOperationType lcmOperationType) {
+ this.lcmOperationType = lcmOperationType;
+ }
+
+ public CommonConstant.cancelMode getCancelMode() {
+ return cancelMode;
+ }
+
+ public void setCancelMode(CommonConstant.cancelMode cancelMode) {
+ this.cancelMode = cancelMode;
+ }
+
+ public CommonConstant.operationState getOperationState() {
+ return operationState;
+ }
+
+ public void setOperationState(CommonConstant.operationState operationState) {
+ this.operationState = operationState;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getStatusEnteredTime() {
+ return statusEnteredTime;
+ }
+
+ public void setStatusEnteredTime(String statusEnteredTime) {
+ this.statusEnteredTime = statusEnteredTime;
+ }
+
+ public String getNsInstanceId() {
+ return nsInstanceId;
+ }
+
+ public void setNsInstanceId(String nsInstanceId) {
+ this.nsInstanceId = nsInstanceId;
+ }
+
+ public String getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(String startTime) {
+ this.startTime = startTime;
+ }
+
+ public Boolean getAutomaticInvocation() {
+ return isAutomaticInvocation;
+ }
+
+ public void setAutomaticInvocation(Boolean automaticInvocation) {
+ isAutomaticInvocation = automaticInvocation;
+ }
+
+ public String getOperationParams() {
+ return operationParams;
+ }
+
+ public void setOperationParams(String operationParams) {
+ this.operationParams = operationParams;
+ }
+
+ public Boolean getCancelPending() {
+ return isCancelPending;
+ }
+
+ public void setCancelPending(Boolean cancelPending) {
+ isCancelPending = cancelPending;
+ }
+
+ public ProblemDetails getError() {
+ return error;
+ }
+
+ public void setError(ProblemDetails error) {
+ this.error = error;
+ }
+
+ public Links getLinks() {
+ return links;
+ }
+
+ public void setLinks(Links links) {
+ this.links = links;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsLinkPortInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsLinkPortInfo.java
new file mode 100644
index 0000000000..20c8972c98
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsLinkPortInfo.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+public class NsLinkPortInfo {
+ @NotNull
+ private String id;
+ @NotNull
+ private ResourceHandle resourceHandle;
+ private NsCpHandle nsCpHandle;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public ResourceHandle getResourceHandle() {
+ return resourceHandle;
+ }
+
+ public void setResourceHandle(ResourceHandle resourceHandle) {
+ this.resourceHandle = resourceHandle;
+ }
+
+ public NsCpHandle getNsCpHandle() {
+ return nsCpHandle;
+ }
+
+ public void setNsCpHandle(NsCpHandle nsCpHandle) {
+ this.nsCpHandle = nsCpHandle;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsScaleInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsScaleInfo.java
new file mode 100644
index 0000000000..59acf564c2
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsScaleInfo.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+
+public class NsScaleInfo {
+ @NotNull
+ private String nsScalingAspectId;
+ @NotNull
+ private String nsScaleLevelId;
+
+ public String getNsScalingAspectId() {
+ return nsScalingAspectId;
+ }
+
+ public void setNsScalingAspectId(String nsScalingAspectId) {
+ this.nsScalingAspectId = nsScalingAspectId;
+ }
+
+ public String getNsScaleLevelId() {
+ return nsScaleLevelId;
+ }
+
+ public void setNsScaleLevelId(String nsScaleLevelId) {
+ this.nsScaleLevelId = nsScaleLevelId;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsVirtualLinkInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsVirtualLinkInfo.java
new file mode 100644
index 0000000000..ed2debd2e6
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsVirtualLinkInfo.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+public class NsVirtualLinkInfo {
+ @NotNull
+ private String id;
+ @NotNull
+ private String nsVirtualLinkDescId;
+ @NotNull
+ private List<ResourceHandle> resourceHandle;
+ private List<NsLinkPortInfo> linkPort;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getNsVirtualLinkDescId() {
+ return nsVirtualLinkDescId;
+ }
+
+ public void setNsVirtualLinkDescId(String nsVirtualLinkDescId) {
+ this.nsVirtualLinkDescId = nsVirtualLinkDescId;
+ }
+
+ public List<ResourceHandle> getResourceHandle() {
+ return resourceHandle;
+ }
+
+ public void setResourceHandle(List<ResourceHandle> resourceHandle) {
+ this.resourceHandle = resourceHandle;
+ }
+
+ public List<NsLinkPortInfo> getLinkPort() {
+ return linkPort;
+ }
+
+ public void setLinkPort(List<NsLinkPortInfo> linkPort) {
+ this.linkPort = linkPort;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ParamsForVnf.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ParamsForVnf.java
new file mode 100644
index 0000000000..b7324e50fe
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ParamsForVnf.java
@@ -0,0 +1,35 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import java.util.Map;
+
+public class ParamsForVnf {
+ private String vnfProfileId;
+ private Map<String, Object> additionalParams;
+
+ public String getVnfProfileId() {
+ return vnfProfileId;
+ }
+
+ public void setVnfProfileId(String vnfProfileId) {
+ this.vnfProfileId = vnfProfileId;
+ }
+
+ public Map<String, Object> getAdditionalParams() {
+ return additionalParams;
+ }
+
+ public void setAdditionalParams(Map<String, Object> additionalParams) {
+ this.additionalParams = additionalParams;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpData.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpData.java
new file mode 100644
index 0000000000..d5d091fcb1
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpData.java
@@ -0,0 +1,44 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import java.util.List;
+
+public class PnfExtCpData {
+ private String cpInstanceI16;
+ private String cpdId;
+ private List<CpProtocolData> cpProtocolData;
+
+ public String getCpInstanceI16() {
+ return cpInstanceI16;
+ }
+
+ public void setCpInstanceI16(String cpInstanceI16) {
+ this.cpInstanceI16 = cpInstanceI16;
+ }
+
+ public String getCpdId() {
+ return cpdId;
+ }
+
+ public void setCpdId(String cpdId) {
+ this.cpdId = cpdId;
+ }
+
+ public List<CpProtocolData> getCpProtocolData() {
+ return cpProtocolData;
+ }
+
+ public void setCpProtocolData(List<CpProtocolData> cpProtocolData) {
+ this.cpProtocolData = cpProtocolData;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpInfo.java
new file mode 100644
index 0000000000..402cb83147
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PnfExtCpInfo.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+public class PnfExtCpInfo {
+ @NotNull
+ private String cpInstanceId;
+ @NotNull
+ private String cpdId;
+ @NotNull
+ private List<CpProtocolData> cpProtocolData;
+
+ public String getCpInstanceI16() {
+ return cpInstanceId;
+ }
+
+ public void setCpInstanceI16(String cpInstanceI16) {
+ this.cpInstanceId = cpInstanceI16;
+ }
+
+ public String getCpdId() {
+ return cpdId;
+ }
+
+ public void setCpdId(String cpdId) {
+ this.cpdId = cpdId;
+ }
+
+ public List<CpProtocolData> getCpProtocolData() {
+ return cpProtocolData;
+ }
+
+ public void setCpProtocolData(List<CpProtocolData> cpProtocolData) {
+ this.cpProtocolData = cpProtocolData;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PnfInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PnfInfo.java
new file mode 100644
index 0000000000..a1cc11bd0c
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PnfInfo.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+public class PnfInfo {
+
+ @NotNull
+ private String pnfId;
+ @NotNull
+ private String pnfName;
+ @NotNull
+ private String pnfdId;
+ @NotNull
+ private String pnfdInfoId;
+ @NotNull
+ private String pnfProfileId;
+ private List<PnfExtCpData> cpData;
+
+ /***
+ *
+ * @return id of pnf
+ */
+ public String getPnfId() {
+ return pnfId;
+ }
+
+ public void setPnfId(String pnfId) {
+ this.pnfId = pnfId;
+ }
+
+ public String getPnfName() {
+ return pnfName;
+ }
+
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
+ }
+
+ public String getPnfdId() {
+ return pnfdId;
+ }
+
+ public void setPnfdId(String pnfdId) {
+ this.pnfdId = pnfdId;
+ }
+
+ public String getPnfProfileId() {
+ return pnfProfileId;
+ }
+
+ public void setPnfProfileId(String pnfProfileId) {
+ this.pnfProfileId = pnfProfileId;
+ }
+
+ public List<PnfExtCpData> getCpData() {
+ return cpData;
+ }
+
+ public void setCpData(List<PnfExtCpData> cpData) {
+ this.cpData = cpData;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PortRange.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PortRange.java
new file mode 100644
index 0000000000..8318a8ccff
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/PortRange.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+
+public class PortRange {
+ @NotNull
+ private int lowerPort;
+ @NotNull
+ private int upperPort;
+
+ public int getLowerPort() {
+ return lowerPort;
+ }
+
+ public void setLowerPort(int lowerPort) {
+ this.lowerPort = lowerPort;
+ }
+
+ public int getUpperPort() {
+ return upperPort;
+ }
+
+ public void setUpperPort(int upperPort) {
+ this.upperPort = upperPort;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ProblemDetails.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ProblemDetails.java
new file mode 100644
index 0000000000..efaa5de7a8
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ProblemDetails.java
@@ -0,0 +1,62 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class ProblemDetails {
+ private String type;
+ private String title;
+ private int status;
+ private String detail;
+ private String instance;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public int getStatus() {
+ return status;
+ }
+
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ public String getDetail() {
+ return detail;
+ }
+
+ public void setDetail(String detail) {
+ this.detail = detail;
+ }
+
+ public String getInstance() {
+ return instance;
+ }
+
+ public void setInstance(String instance) {
+ this.instance = instance;
+ }
+
+
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ResourceChanges.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ResourceChanges.java
new file mode 100644
index 0000000000..062a6aa32a
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ResourceChanges.java
@@ -0,0 +1,71 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import java.util.List;
+
+public class ResourceChanges {
+ private List<AffectedVnf> affectedVnfs;
+ private List<AffectedPnf> affectedPnfs;
+ private List<AffectedVirtualLink> affectedVls;
+ private List<AffectedVnffg> affectedVnffgs;
+ private List<AffectedNs> affectedNss;
+ private List<AffectedSap> affectedSaps;
+
+ public List<AffectedVnf> getAffectedVnfs() {
+ return affectedVnfs;
+ }
+
+ public void setAffectedVnfs(List<AffectedVnf> affectedVnfs) {
+ this.affectedVnfs = affectedVnfs;
+ }
+
+ public List<AffectedPnf> getAffectedPnfs() {
+ return affectedPnfs;
+ }
+
+ public void setAffectedPnfs(List<AffectedPnf> affectedPnfs) {
+ this.affectedPnfs = affectedPnfs;
+ }
+
+ public List<AffectedVirtualLink> getAffectedVls() {
+ return affectedVls;
+ }
+
+ public void setAffectedVls(List<AffectedVirtualLink> affectedVls) {
+ this.affectedVls = affectedVls;
+ }
+
+ public List<AffectedVnffg> getAffectedVnffgs() {
+ return affectedVnffgs;
+ }
+
+ public void setAffectedVnffgs(List<AffectedVnffg> affectedVnffgs) {
+ this.affectedVnffgs = affectedVnffgs;
+ }
+
+ public List<AffectedNs> getAffectedNss() {
+ return affectedNss;
+ }
+
+ public void setAffectedNss(List<AffectedNs> affectedNss) {
+ this.affectedNss = affectedNss;
+ }
+
+ public List<AffectedSap> getAffectedSaps() {
+ return affectedSaps;
+ }
+
+ public void setAffectedSaps(List<AffectedSap> affectedSaps) {
+ this.affectedSaps = affectedSaps;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ResourceHandle.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ResourceHandle.java
new file mode 100644
index 0000000000..fbfecaa007
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ResourceHandle.java
@@ -0,0 +1,51 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class ResourceHandle {
+ private String vimId;
+ private String resourceProviderId;
+ private String resourceId;
+ private String vimLevelResourceType;
+
+ public String getVimId() {
+ return vimId;
+ }
+
+ public void setVimId(String vimId) {
+ this.vimId = vimId;
+ }
+
+ public String getResourceProviderId() {
+ return resourceProviderId;
+ }
+
+ public void setResourceProviderId(String resourceProviderId) {
+ this.resourceProviderId = resourceProviderId;
+ }
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public String getVimLevelResourceType() {
+ return vimLevelResourceType;
+ }
+
+ public void setVimLevelResourceType(String vimLevelResourceType) {
+ this.vimLevelResourceType = vimLevelResourceType;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/SapData.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/SapData.java
new file mode 100644
index 0000000000..d8e96e22f5
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/SapData.java
@@ -0,0 +1,56 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import java.util.List;
+
+public class SapData {
+ private String sapdId;
+ private String sapName;
+ private String description;
+ private List<CpProtocolData> sapProtocolData;
+
+ public String getSapdId() {
+ return sapdId;
+ }
+
+ public void setSapdId(String sapdId) {
+ this.sapdId = sapdId;
+ }
+
+ public String getSapName() {
+ return sapName;
+ }
+
+ public void setSapName(String sapName) {
+ this.sapName = sapName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public List<CpProtocolData> getSapProtocolData() {
+ return sapProtocolData;
+ }
+
+ public void setSapProtocolData(List<CpProtocolData> sapProtocolData) {
+ this.sapProtocolData = sapProtocolData;
+ }
+
+
+
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/SapInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/SapInfo.java
new file mode 100644
index 0000000000..182aceb127
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/SapInfo.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+public class SapInfo {
+ @NotNull
+ private String id;
+ @NotNull
+ private String sapdId;
+ @NotNull
+ private String sapName;
+ @NotNull
+ private String description;
+ @NotNull
+ private List<CpProtocolInfo> sapProtocolInfo;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getSapdId() {
+ return sapdId;
+ }
+
+ public void setSapdId(String sapdId) {
+ this.sapdId = sapdId;
+ }
+
+ public String getSapName() {
+ return sapName;
+ }
+
+ public void setSapName(String sapName) {
+ this.sapName = sapName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public List<CpProtocolInfo> getSapProtocolInfo() {
+ return sapProtocolInfo;
+ }
+
+ public void setSapProtocolInfo(List<CpProtocolInfo> sapProtocolInfo) {
+ this.sapProtocolInfo = sapProtocolInfo;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfInstance.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfInstance.java
new file mode 100644
index 0000000000..ccd6532ee0
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfInstance.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.Map;
+
+public class VnfInstance {
+ @NotNull
+ private String id;
+ private String vnfInstanceName;
+ private String vnfInstanceDescription;
+ @NotNull
+ private String vnfdId;
+ @NotNull
+ private String vnfProvider;
+ @NotNull
+ private String vnfProductName;
+ @NotNull
+ private String vnfSoftwareVersion;
+ @NotNull
+ private String vnfdVersion;
+ @NotNull
+ private String vnfPkgId;
+ private Map<String, Object> vnfConfigurableProperties;
+ private String vimId;
+
+ private enum instantiationState {
+ NOT_INSTANTIATED, INSTANTIATED
+ };
+
+ private InstantiatedVnfInfo instantiatedVnfInfo;
+ private Map<String, Object> metadata;
+ private Map<String, Object> extensions;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getVnfInstanceName() {
+ return vnfInstanceName;
+ }
+
+ public void setVnfInstanceName(String vnfInstanceName) {
+ this.vnfInstanceName = vnfInstanceName;
+ }
+
+ public String getVnfInstanceDescription() {
+ return vnfInstanceDescription;
+ }
+
+ public void setVnfInstanceDescription(String vnfInstanceDescription) {
+ this.vnfInstanceDescription = vnfInstanceDescription;
+ }
+
+ public String getVnfdId() {
+ return vnfdId;
+ }
+
+ public void setVnfdId(String vnfdId) {
+ this.vnfdId = vnfdId;
+ }
+
+ public String getVnfProvider() {
+ return vnfProvider;
+ }
+
+ public void setVnfProvider(String vnfProvider) {
+ this.vnfProvider = vnfProvider;
+ }
+
+ public String getVnfProductName() {
+ return vnfProductName;
+ }
+
+ public void setVnfProductName(String vnfProductName) {
+ this.vnfProductName = vnfProductName;
+ }
+
+ public String getVnfSoftwareVersion() {
+ return vnfSoftwareVersion;
+ }
+
+ public void setVnfSoftwareVersion(String vnfSoftwareVersion) {
+ this.vnfSoftwareVersion = vnfSoftwareVersion;
+ }
+
+ public String getVnfdVersion() {
+ return vnfdVersion;
+ }
+
+ public void setVnfdVersion(String vnfdVersion) {
+ this.vnfdVersion = vnfdVersion;
+ }
+
+ public String getVnfPkgId() {
+ return vnfPkgId;
+ }
+
+ public void setVnfPkgId(String vnfPkgId) {
+ this.vnfPkgId = vnfPkgId;
+ }
+
+ public Map<String, Object> getVnfConfigurableProperties() {
+ return vnfConfigurableProperties;
+ }
+
+ public void setVnfConfigurableProperties(Map<String, Object> vnfConfigurableProperties) {
+ this.vnfConfigurableProperties = vnfConfigurableProperties;
+ }
+
+ public String getVimId() {
+ return vimId;
+ }
+
+ public void setVimId(String vimId) {
+ this.vimId = vimId;
+ }
+
+ public InstantiatedVnfInfo getInstantiatedVnfInfo() {
+ return instantiatedVnfInfo;
+ }
+
+ public void setInstantiatedVnfInfo(InstantiatedVnfInfo instantiatedVnfInfo) {
+ this.instantiatedVnfInfo = instantiatedVnfInfo;
+ }
+
+ public Map<String, Object> getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(Map<String, Object> metadata) {
+ this.metadata = metadata;
+ }
+
+ public Map<String, Object> getExtensions() {
+ return extensions;
+ }
+
+ public void setExtensions(Map<String, Object> extensions) {
+ this.extensions = extensions;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfInstanceData.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfInstanceData.java
new file mode 100644
index 0000000000..83345fcb4c
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfInstanceData.java
@@ -0,0 +1,33 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class VnfInstanceData {
+ private String vnfInstanceId;
+ private String vnfProfileId;
+
+ public String getVnfInstanceId() {
+ return vnfInstanceId;
+ }
+
+ public void setVnfInstanceId(String vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
+
+ public String getVnfProfileId() {
+ return vnfProfileId;
+ }
+
+ public void setVnfProfileId(String vnfProfileId) {
+ this.vnfProfileId = vnfProfileId;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfLinkPortInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfLinkPortInfo.java
new file mode 100644
index 0000000000..0b09d066fa
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfLinkPortInfo.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+
+public class VnfLinkPortInfo {
+ @NotNull
+ private String id;
+ @NotNull
+ private ResourceHandle resourceHandle;
+ private String cpInstanceId;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public ResourceHandle getResourceHandle() {
+ return resourceHandle;
+ }
+
+ public void setResourceHandle(ResourceHandle resourceHandle) {
+ this.resourceHandle = resourceHandle;
+ }
+
+ public String getCpInstanceId() {
+ return cpInstanceId;
+ }
+
+ public void setCpInstanceId(String cpInstanceId) {
+ this.cpInstanceId = cpInstanceId;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfLocationConstraint.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfLocationConstraint.java
new file mode 100644
index 0000000000..5db3060b88
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfLocationConstraint.java
@@ -0,0 +1,33 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+public class VnfLocationConstraint {
+ private String vnfProfileId;
+ private LocationConstraint locationConstraints;
+
+ public String getVnfProfileId() {
+ return vnfProfileId;
+ }
+
+ public void setVnfProfileId(String vnfProfileId) {
+ this.vnfProfileId = vnfProfileId;
+ }
+
+ public LocationConstraint getLocationConstraints() {
+ return locationConstraints;
+ }
+
+ public void setLocationConstraints(LocationConstraint locationConstraints) {
+ this.locationConstraints = locationConstraints;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfScaleInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfScaleInfo.java
new file mode 100644
index 0000000000..e702edc821
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfScaleInfo.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+
+public class VnfScaleInfo {
+ @NotNull
+ private String aspectlId;
+ @NotNull
+ private int scaleLevel;
+
+ public String getAspectlId() {
+ return aspectlId;
+ }
+
+ public void setAspectlId(String aspectlId) {
+ this.aspectlId = aspectlId;
+ }
+
+ public int getScaleLevel() {
+ return scaleLevel;
+ }
+
+ public void setScaleLevel(int scaleLevel) {
+ this.scaleLevel = scaleLevel;
+ }
+
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfVirtualLinkResourceInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfVirtualLinkResourceInfo.java
new file mode 100644
index 0000000000..9f41a383fc
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfVirtualLinkResourceInfo.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+import java.util.Map;
+
+public class VnfVirtualLinkResourceInfo {
+ @NotNull
+ private String id;
+ @NotNull
+ private String virtualLinkDescId;
+ @NotNull
+ private ResourceHandle networkResource;
+ private String reservationId;
+ private List<VnfLinkPortInfo> vnfLinkPorts;
+ Map<String, Object> metadata;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getVirtualLinkDescId() {
+ return virtualLinkDescId;
+ }
+
+ public void setVirtualLinkDescId(String virtualLinkDescId) {
+ this.virtualLinkDescId = virtualLinkDescId;
+ }
+
+ public ResourceHandle getNetworkResource() {
+ return networkResource;
+ }
+
+ public void setNetworkResource(ResourceHandle networkResource) {
+ this.networkResource = networkResource;
+ }
+
+ public String getReservationId() {
+ return reservationId;
+ }
+
+ public void setReservationId(String reservationId) {
+ this.reservationId = reservationId;
+ }
+
+ public List<VnfLinkPortInfo> getVnfLinkPorts() {
+ return vnfLinkPorts;
+ }
+
+ public void setVnfLinkPorts(List<VnfLinkPortInfo> vnfLinkPorts) {
+ this.vnfLinkPorts = vnfLinkPorts;
+ }
+
+ public Map<String, Object> getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(Map<String, Object> metadata) {
+ this.metadata = metadata;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfcCpInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfcCpInfo.java
new file mode 100644
index 0000000000..ec629effd2
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfcCpInfo.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+public class VnfcCpInfo {
+ @NotNull
+ private String id;
+ @NotNull
+ private String cpdId;
+ private String vnfExtCpId;
+ private List<CpProtocolInfo> cpProtocolInfo;
+ private String vnfLinkPortId;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getCpdId() {
+ return cpdId;
+ }
+
+ public void setCpdId(String cpdId) {
+ this.cpdId = cpdId;
+ }
+
+ public String getVnfExtCpId() {
+ return vnfExtCpId;
+ }
+
+ public void setVnfExtCpId(String vnfExtCpId) {
+ this.vnfExtCpId = vnfExtCpId;
+ }
+
+ public List<CpProtocolInfo> getCpProtocolInfo() {
+ return cpProtocolInfo;
+ }
+
+ public void setCpProtocolInfo(List<CpProtocolInfo> cpProtocolInfo) {
+ this.cpProtocolInfo = cpProtocolInfo;
+ }
+
+ public String getVnfLinkPortId() {
+ return vnfLinkPortId;
+ }
+
+ public void setVnfLinkPortId(String vnfLinkPortId) {
+ this.vnfLinkPortId = vnfLinkPortId;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfcResourceInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfcResourceInfo.java
new file mode 100644
index 0000000000..1f7aa67b8d
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnfcResourceInfo.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+import java.util.Map;
+
+public class VnfcResourceInfo {
+ @NotNull
+ private String id;
+ @NotNull
+ private String vduId;
+ @NotNull
+ private ResourceHandle computeResource;
+ private List<String> storageResourceIds;
+ private String reservationId;
+ private List<VnfcCpInfo> vnfcCpInfo;
+ private Map<String, Object> metadata;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getVduId() {
+ return vduId;
+ }
+
+ public void setVduId(String vduId) {
+ this.vduId = vduId;
+ }
+
+ public ResourceHandle getComputeResource() {
+ return computeResource;
+ }
+
+ public void setComputeResource(ResourceHandle computeResource) {
+ this.computeResource = computeResource;
+ }
+
+ public List<String> getStorageResourceIds() {
+ return storageResourceIds;
+ }
+
+ public void setStorageResourceIds(List<String> storageResourceIds) {
+ this.storageResourceIds = storageResourceIds;
+ }
+
+ public String getReservationId() {
+ return reservationId;
+ }
+
+ public void setReservationId(String reservationId) {
+ this.reservationId = reservationId;
+ }
+
+ public List<VnfcCpInfo> getVnfcCpInfo() {
+ return vnfcCpInfo;
+ }
+
+ public void setVnfcCpInfo(List<VnfcCpInfo> vnfcCpInfo) {
+ this.vnfcCpInfo = vnfcCpInfo;
+ }
+
+ public Map<String, Object> getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(Map<String, Object> metadata) {
+ this.metadata = metadata;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnffgInfo.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnffgInfo.java
new file mode 100644
index 0000000000..c02d5177db
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VnffgInfo.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+public class VnffgInfo {
+ @NotNull
+ private String id;
+ @NotNull
+ private String vnffgdId;
+ @NotNull
+ private List<String> vnfInstanceId;
+ private String pnfInfoId;
+ @NotNull
+ private List<String> nsVirtualLinkInfoId;
+ @NotNull
+ private List<NsCpHandle> nsCpHandle;
+ @NotNull
+ private List<NfpInfo> nfpInfo;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getVnffgdId() {
+ return vnffgdId;
+ }
+
+ public void setVnffgdId(String vnffgdId) {
+ this.vnffgdId = vnffgdId;
+ }
+
+ public List<String> getVnfInstanceId() {
+ return vnfInstanceId;
+ }
+
+ public void setVnfInstanceId(List<String> vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
+
+ public String getPnfInfoId() {
+ return pnfInfoId;
+ }
+
+ public void setPnfInfoId(String pnfInfoId) {
+ this.pnfInfoId = pnfInfoId;
+ }
+
+ public List<String> getNsVirtualLinkInfoId() {
+ return nsVirtualLinkInfoId;
+ }
+
+ public void setNsVirtualLinkInfoId(List<String> nsVirtualLinkInfoId) {
+ this.nsVirtualLinkInfoId = nsVirtualLinkInfoId;
+ }
+
+ public List<NsCpHandle> getNsCpHandle() {
+ return nsCpHandle;
+ }
+
+ public void setNsCpHandle(List<NsCpHandle> nsCpHandle) {
+ this.nsCpHandle = nsCpHandle;
+ }
+
+ public List<NfpInfo> getNfpInfo() {
+ return nfpInfo;
+ }
+
+ public void setNfpInfo(List<NfpInfo> nfpInfo) {
+ this.nfpInfo = nfpInfo;
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java
index bb9ae69f51..5a89c04a5a 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java
@@ -37,6 +37,8 @@ import org.onap.so.adapters.vfc.model.NsOperationKey;
import org.onap.so.adapters.vfc.model.RestfulResponse;
import org.onap.so.adapters.vfc.util.JsonUtil;
import org.onap.so.adapters.vfc.util.ValidateUtil;
+import org.onap.so.db.request.beans.InstanceNfvoMapping;
+import org.onap.so.db.request.data.repository.InstanceNfvoMappingRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -58,7 +60,12 @@ public class VfcAdapterRest {
private static final String REQUEST_DEBUG_MSG = "body from request is {}";
private static final String APPLICATION_EXCEPTION = "ApplicationException: ";
@Autowired
+ private VfcManagerSol005 vfcManagerSol005;
+
+ @Autowired
private VfcManager driverMgr;
+ @Autowired
+ private InstanceNfvoMappingRepository instanceNfvoMappingRepository;
public VfcAdapterRest() {
@@ -80,7 +87,13 @@ public class VfcAdapterRest {
ValidateUtil.assertObjectNotNull(data);
logger.debug(REQUEST_DEBUG_MSG + data);
NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class);
- RestfulResponse rsp = driverMgr.createNs(nsInput);
+ RestfulResponse rsp;
+ if (nsInput.getNsParameters().getAdditionalParamForNs().containsKey("isSol005Interface")) {
+ rsp = vfcManagerSol005.createNs(nsInput);
+ } else {
+ rsp = driverMgr.createNs(nsInput);
+ }
+
return buildResponse(rsp);
} catch (ApplicationException e) {
logger.debug(APPLICATION_EXCEPTION, e);
@@ -106,7 +119,13 @@ public class VfcAdapterRest {
ValidateUtil.assertObjectNotNull(data);
logger.debug(REQUEST_DEBUG_MSG + data);
NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class);
- RestfulResponse rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId);
+ RestfulResponse rsp;
+ InstanceNfvoMapping instanceNfvoMapping = instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId);
+ if (instanceNfvoMapping != null) {
+ rsp = vfcManagerSol005.deleteNs(nsOperationKey, nsInstanceId);
+ } else {
+ rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId);
+ }
return buildResponse(rsp);
} catch (ApplicationException e) {
logger.debug(APPLICATION_EXCEPTION, e);
@@ -131,7 +150,13 @@ public class VfcAdapterRest {
ValidateUtil.assertObjectNotNull(data);
logger.debug(REQUEST_DEBUG_MSG + data);
NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class);
- RestfulResponse rsp = driverMgr.getNsProgress(nsOperationKey, jobId);
+ RestfulResponse rsp;
+ InstanceNfvoMapping instanceNfvoMapping = instanceNfvoMappingRepository.findOneByJobId(jobId);
+ if (instanceNfvoMapping != null) {
+ rsp = vfcManagerSol005.getNsProgress(nsOperationKey, jobId);
+ } else {
+ rsp = driverMgr.getNsProgress(nsOperationKey, jobId);
+ }
return buildResponse(rsp);
} catch (ApplicationException e) {
logger.debug(APPLICATION_EXCEPTION, e);
@@ -156,7 +181,12 @@ public class VfcAdapterRest {
ValidateUtil.assertObjectNotNull(data);
logger.debug(REQUEST_DEBUG_MSG + data);
NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class);
- RestfulResponse rsp = driverMgr.instantiateNs(nsInstanceId, nsInput);
+ RestfulResponse rsp;
+ if (nsInput.getNsParameters().getAdditionalParamForNs().containsKey("isSol005Interface")) {
+ rsp = vfcManagerSol005.instantiateNs(nsInstanceId, nsInput);
+ } else {
+ rsp = driverMgr.instantiateNs(nsInstanceId, nsInput);
+ }
return buildResponse(rsp);
} catch (ApplicationException e) {
logger.debug(APPLICATION_EXCEPTION, e);
@@ -181,7 +211,14 @@ public class VfcAdapterRest {
ValidateUtil.assertObjectNotNull(data);
logger.debug(REQUEST_DEBUG_MSG + data);
NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class);
- RestfulResponse rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId);
+ RestfulResponse rsp;
+ InstanceNfvoMapping instanceNfvoMapping = instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId);
+ if (instanceNfvoMapping != null) {
+ rsp = vfcManagerSol005.terminateNs(nsOperationKey, nsInstanceId);
+ } else {
+ rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId);
+ }
+
return buildResponse(rsp);
} catch (ApplicationException e) {
logger.debug(APPLICATION_EXCEPTION, e);
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005.java
new file mode 100644
index 0000000000..9033becf8a
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005.java
@@ -0,0 +1,620 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.rest;
+
+import java.time.LocalDateTime;
+import java.util.*;
+import org.onap.so.adapters.vfc.constant.CommonConstant;
+import org.onap.so.adapters.vfc.constant.CommonConstant.Step;
+import org.onap.so.adapters.vfc.constant.DriverExceptionID;
+import org.onap.so.adapters.vfc.constant.HttpCode;
+import org.onap.so.adapters.vfc.exceptions.ApplicationException;
+import org.onap.so.adapters.vfc.model.*;
+import org.onap.so.adapters.vfc.util.JsonUtil;
+import org.onap.so.adapters.vfc.util.RestfulUtil;
+import org.onap.so.adapters.vfc.util.ValidateUtil;
+import org.onap.so.db.request.beans.InstanceNfvoMapping;
+import org.onap.so.db.request.beans.OperationStatus;
+import org.onap.so.db.request.beans.ResourceOperationStatus;
+import org.onap.so.db.request.data.repository.InstanceNfvoMappingRepository;
+import org.onap.so.db.request.data.repository.OperationStatusRepository;
+import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
+import org.onap.so.requestsdb.RequestsDbConstant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Primary;
+import org.springframework.data.domain.Example;
+import org.springframework.stereotype.Component;
+
+/**
+ * VF-C Manager <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-08-28
+ */
+@Component
+@Primary
+public class VfcManagerSol005 {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(VfcManagerSol005.class);
+
+ /**
+ * nfvo url map
+ */
+ private Map<String, String> nfvoUrlMap;
+
+ @Autowired
+ private ResourceOperationStatusRepository resourceOperationStatusRepository;
+
+ @Autowired
+ private RestfulUtil restfulUtil;
+
+ @Autowired
+ private OperationStatusRepository operationStatusRepository;
+
+ @Autowired
+ private InstanceNfvoMappingRepository instanceNfvoMappingRepository;
+
+ private InstanceNfvoMapping instanceNfvoMapping = new InstanceNfvoMapping();
+
+ public VfcManagerSol005() {
+ nfvoUrlMap = new HashMap<>();
+ nfvoUrlMap.put(Step.CREATE, CommonConstant.SOL005_NFVO_CREATE_URL);
+ nfvoUrlMap.put(Step.INSTANTIATE, CommonConstant.SOL005_NFVO_INSTANTIATE_URL);
+ nfvoUrlMap.put(Step.TERMINATE, CommonConstant.SOL005_NFVO_TERMINATE_URL);
+ nfvoUrlMap.put(Step.DELETE, CommonConstant.SOL005_NFVO_DELETE_URL);
+ nfvoUrlMap.put(Step.QUERY, CommonConstant.SOL005_NFVO_QUERY_URL);
+ nfvoUrlMap.put(Step.SCALE, CommonConstant.NFVO_SCALE_URL);
+ }
+
+ /**
+ * create network service <br>
+ *
+ * @param segInput input parameters for current node from http request
+ * @return
+ * @since ONAP Dubilin Release
+ */
+ public RestfulResponse createNs(NSResourceInputParameter segInput) throws ApplicationException {
+
+ Map<String, String> nfvoDetails;
+ // Step1: get service template by node type
+ String nsdId = segInput.getNsServiceModelUUID();
+ // nsdId for NFVO is "id" in the response, while for SDNO is "servcice template id"
+ LOGGER.info("serviceTemplateId is {}, id is {}", nsdId, nsdId);
+
+
+ LOGGER.info("SOL005 create ns -> begin");
+ // Step2: Prepare url and method type
+ String url = getUrl(null, CommonConstant.Step.CREATE);
+ String methodType = CommonConstant.MethodType.POST;
+
+ // Step3: Prepare restful parameters and options
+ CreateNsRequest createNsRequest = new CreateNsRequest();
+ createNsRequest.setNsDescription(segInput.getNsServiceDescription());
+ createNsRequest.setNsdId(segInput.getNsServiceModelUUID());
+ createNsRequest.setNsName(segInput.getNsServiceName());
+
+ String createReq = JsonUtil.marshal(createNsRequest);
+ RestfulResponse aaiRestfulResponse = null;
+ NsParameters nsParameters = segInput.getNsParameters();
+ if (nsParameters.getAdditionalParamForNs().containsKey("orchestrator")) {
+ if (nsParameters.getAdditionalParamForNs().get("orchestrator") != null) {
+ String nfvo = nsParameters.getAdditionalParamForNs().get("nfvo").toString();
+ aaiRestfulResponse = restfulUtil.getNfvoFromAAI(nfvo);
+ nfvoDetails = JsonUtil.unMarshal(aaiRestfulResponse.getResponseContent(), Map.class);
+ url = nfvoDetails.get("url") + nfvoDetails.get("api-root") + url;
+
+ }
+ } else {
+ LOGGER.error("Nfvo not present in AAI");
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_CREATE_NS);
+ }
+
+
+ // Prepare request header for createNs request.
+ Map<String, String> requestHeader = new HashMap<>();
+ requestHeader.put("GLOBALCUSTOMERID", segInput.getNsOperationKey().getGlobalSubscriberId());
+ requestHeader.put("SERVICETYPE", segInput.getNsOperationKey().getServiceType());
+
+ // Step4: Call NFVO or SDNO lcm to create ns
+ LOGGER.info("Request Payload for CreateNs: " + createReq);
+
+ RestfulResponse createRsp = restfulUtil.send(url, methodType, createReq, requestHeader);
+ ValidateUtil.assertObjectNotNull(createRsp);
+ LOGGER.info("create ns response status is : {}", createRsp.getStatus());
+ LOGGER.info("create ns response content is : {}", createRsp.getResponseContent());
+
+ // Step 5: save resource operation information
+ ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(),
+ segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID());
+ status.setStatus(RequestsDbConstant.Status.PROCESSING);
+ status = resourceOperationStatusRepository.save(status);
+ if (!HttpCode.isSucess(createRsp.getStatus())) {
+ LOGGER.error("update segment operation status : fail to create ns");
+ status.setProgress("40");
+ status.setStatusDescription("NS not created");
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setErrorCode(String.valueOf(createRsp.getStatus()));
+ resourceOperationStatusRepository.save(status);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_CREATE_NS);
+ }
+ // TODO: Capture all the content of the response. Currently fetching ID value alone.
+ // Should be converted into the NsInstance.class
+ @SuppressWarnings("unchecked")
+ Map<String, String> rsp = JsonUtil.unMarshal(createRsp.getResponseContent(), Map.class);
+ String nsInstanceId = rsp.get(CommonConstant.SOL005_NS_INSTANCE_ID);
+ if (ValidateUtil.isStrEmpty(nsInstanceId)) {
+ LOGGER.error("Invalid instanceId from create operation");
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.INVALID_RESPONSEE_FROM_CREATE_OPERATION);
+ }
+
+ nfvoDetails = JsonUtil.unMarshal(aaiRestfulResponse.getResponseContent(), Map.class);
+ instanceNfvoMapping.setInstanceId(nsInstanceId);
+ instanceNfvoMapping.setPassword(nfvoDetails.get("password"));
+ instanceNfvoMapping.setUsername(nfvoDetails.get("userName"));
+ instanceNfvoMapping.setNfvoName(nfvoDetails.get("nfvoId"));
+ instanceNfvoMapping.setEndpoint(nfvoDetails.get("url"));
+ instanceNfvoMapping.setApiRoot(nfvoDetails.get("api-root"));
+ instanceNfvoMappingRepository.save(instanceNfvoMapping);
+ LOGGER.info("create ns -> end");
+ LOGGER.info("save segment and operaton info -> begin");
+ // Step 6: add relation between service and NS
+ AaiUtil.addRelation(segInput.getNsOperationKey().getGlobalSubscriberId(),
+ segInput.getNsOperationKey().getServiceType(), segInput.getNsOperationKey().getServiceId(),
+ nsInstanceId);
+ LOGGER.info("save segment and operation info -> end");
+ return createRsp;
+ }
+
+ /**
+ * delete network service <br>
+ *
+ * @param nsOperationKey The operation key of the NS resource
+ * @param nsInstanceId The NS instance id
+ * @return
+ * @since ONAP Dublin Release
+ */
+ public RestfulResponse deleteNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException {
+ LOGGER.info("SOL005 delete ns -> begin");
+ // Step1: prepare url and methodType
+ String url = getUrl(nsInstanceId, CommonConstant.Step.DELETE);
+ String methodType = CommonConstant.MethodType.DELETE;
+
+ // Step2: prepare restful parameters and options
+ RestfulResponse deleteRsp = restfulUtil.send(url, methodType, "");
+ ValidateUtil.assertObjectNotNull(deleteRsp);
+ LOGGER.info("delete ns response status is : {}", deleteRsp.getStatus());
+ LOGGER.info("delete ns response content is : {}", deleteRsp.getResponseContent());
+ LOGGER.info("delete ns -> end");
+
+ ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(),
+ nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
+ if (!HttpCode.isSucess(deleteRsp.getStatus())) {
+ LOGGER.error("fail to delete ns");
+
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setErrorCode(String.valueOf(deleteRsp.getStatus()));
+ status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
+ resourceOperationStatusRepository.save(status);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_DELETE_NS);
+ }
+
+ // Step3: remove relation info between service and ns
+ AaiUtil.removeRelation(nsOperationKey.getGlobalSubscriberId(), nsOperationKey.getServiceType(),
+ nsOperationKey.getServiceId(), nsInstanceId);
+ LOGGER.info("delete segment information -> end");
+
+ // Step4: update service segment operation status
+ status.setStatus(RequestsDbConstant.Status.FINISHED);
+ status.setErrorCode(String.valueOf(deleteRsp.getStatus()));
+ status.setProgress("100");
+ status.setStatusDescription("VFC resource deletion finished");
+ resourceOperationStatusRepository.save(status);
+ LOGGER.info("update segment operaton status for delete -> end");
+
+ return deleteRsp;
+
+ }
+
+ /**
+ * instantiate network service <br>
+ *
+ * @param nsInstanceId The NS instance id
+ * @param segInput input parameters for current node from http request
+ * @return
+ * @since ONAP Dublin Release
+ */
+ public RestfulResponse instantiateNs(String nsInstanceId, NSResourceInputParameter segInput)
+ throws ApplicationException {
+ // Call the NFVO or SDNO service to instantiate service
+ LOGGER.info("SOL005 instantiate ns -> begin");
+
+ // Step1: Prepare restful parameters and options
+ InstantiateNsRequest instantiateNsRequest = new InstantiateNsRequest();
+
+ NsInstantiateReq oRequest = new NsInstantiateReq();
+ oRequest.setNsInstanceId(nsInstanceId);
+ NsParameters nsParameters = segInput.getNsParameters();
+
+ ArrayList<VnfLocationConstraint> vnfLocationConstraints = new ArrayList<VnfLocationConstraint>();
+ for (LocationConstraint locationConstraint : nsParameters.getLocationConstraints()) {
+ VnfLocationConstraint vnfLocationConstraint = new VnfLocationConstraint();
+ vnfLocationConstraint.setVnfProfileId(locationConstraint.getVnfProfileId());
+ vnfLocationConstraint.setLocationConstraints(null);
+ vnfLocationConstraints.add(vnfLocationConstraint);
+
+ }
+ instantiateNsRequest.setAditionalParamsForNs(nsParameters.getAdditionalParamForNs());
+ // Setting FlavourID which is a mandatory paramater to default
+ // as UUI is not sending this parameter to so
+ instantiateNsRequest.setNsFlavourId("default");
+ String instReq = JsonUtil.marshal(instantiateNsRequest);
+ LOGGER.info("Request Payload for InstantiateNs: " + instReq);
+ // Step2: prepare url and
+ String url = getUrl(nsInstanceId, CommonConstant.Step.INSTANTIATE);
+ String methodType = CommonConstant.MethodType.POST;
+ instanceNfvoMapping = instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId);
+
+ if (instanceNfvoMapping != null) {
+
+ url = instanceNfvoMapping.getEndpoint() + instanceNfvoMapping.getApiRoot() + url;
+
+ } else {
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_INSTANTIATE_NS);
+
+ }
+ // Step3: prepare restful parameters and options
+ Map<String, String> reqBody = new HashMap<>();
+ reqBody.put("terminationTime", LocalDateTime.now().toString());
+ RestfulResponse instRsp = restfulUtil.send(url, methodType, instReq);
+ ResourceOperationStatus status = new ResourceOperationStatus(segInput.getNsOperationKey().getServiceId(),
+ segInput.getNsOperationKey().getOperationId(), segInput.getNsOperationKey().getNodeTemplateUUID());
+ ValidateUtil.assertObjectNotNull(instRsp);
+ if (!HttpCode.isSucess(instRsp.getStatus())) {
+ LOGGER.error("update segment operation status : fail to instantiate ns");
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setErrorCode(String.valueOf(instRsp.getStatus()));
+ status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED);
+ resourceOperationStatusRepository.save(status);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_INSTANTIATE_NS);
+ }
+ LOGGER.info("instantiate ns response status is : {}", instRsp.getStatus());
+ LOGGER.info("response payload is {}", instRsp.getResponseContent());
+ String jobId = null;
+ if (instRsp.getStatus() == 202) {
+ String jobUri = instRsp.getRespHeaderStr(CommonConstant.JOB_URI);
+ LOGGER.info("JOB URI" + jobUri);
+ jobId = jobUri.split("/")[4];
+ if (ValidateUtil.isStrEmpty(jobId)) {
+ LOGGER.error("Invalid jobId from instantiate operation");
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setErrorCode(String.valueOf(instRsp.getStatus()));
+ status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED);
+ resourceOperationStatusRepository.save(status);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION);
+ }
+
+ } else if (instRsp.getStatus() > 400 && instRsp.getStatus() < 600) {
+ LOGGER.error("ERROR while executing instantiateNs request");
+ ProblemDetails problemDetails = JsonUtil.unMarshal(instRsp.getResponseContent(), ProblemDetails.class);
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setErrorCode(String.valueOf(instRsp.getStatus()));
+ status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED + problemDetails.getDetail());
+ resourceOperationStatusRepository.save(status);
+ if (instRsp.getStatus() == 406) {
+ throw new ApplicationException(HttpCode.NOT_ACCEPTABLE, DriverExceptionID.FAIL_TO_INSTANTIATE_NS);
+ } else if (instRsp.getStatus() == 400) {
+ throw new ApplicationException(HttpCode.BAD_REQUEST, DriverExceptionID.FAIL_TO_INSTANTIATE_NS);
+ } else if (instRsp.getStatus() == 404) {
+ throw new ApplicationException(HttpCode.NOT_FOUND, DriverExceptionID.FAIL_TO_INSTANTIATE_NS);
+ } else if (instRsp.getStatus() == 409) {
+ LOGGER.error("The operation cannot be executed currently,\n"
+ + "due to a conflict with the state of the resource");
+ throw new ApplicationException(HttpCode.RESPOND_CONFLICT, DriverExceptionID.FAIL_TO_INSTANTIATE_NS);
+ } else if (instRsp.getStatus() == 500) {
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.FAIL_TO_INSTANTIATE_NS);
+ } else {
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.FAIL_TO_INSTANTIATE_NS);
+ }
+
+ }
+ LOGGER.info("Job id is " + jobId);
+ LOGGER.info("Nfvo Details" + instanceNfvoMapping.toString());
+ LOGGER.info("instantiate ns -> end");
+ // Step 3: update segment operation job id
+ LOGGER.info("update resource operation status job id -> begin");
+ status.setJobId(jobId);
+ status.setProgress("100");
+ status.setStatusDescription("NS initiation completed.");
+ resourceOperationStatusRepository.save(status);
+ instanceNfvoMapping.setJobId(jobId);
+ instanceNfvoMappingRepository.save(instanceNfvoMapping);
+ LOGGER.info("update segment operation job id -> end" + instanceNfvoMapping.toString());
+ return instRsp;
+ }
+
+ /**
+ * terminate network service <br>
+ *
+ * @param nsOperationKey The operation key for NS resource
+ * @param nsInstanceId The NS instance id
+ * @return
+ * @since ONAP Dublin Release
+ */
+ public RestfulResponse terminateNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException {
+ // Step1: save segment operation info for delete process
+ LOGGER.info("save segment operation for delete process");
+ ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(),
+ nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
+ status.setStatus(RequestsDbConstant.Status.PROCESSING);
+ resourceOperationStatusRepository.save(status);
+
+ LOGGER.info("SOL005 terminate ns -> begin");
+ // Step2: prepare url and method type
+ String url = getUrl(nsInstanceId, CommonConstant.Step.TERMINATE);
+ String methodType = CommonConstant.MethodType.POST;
+
+ instanceNfvoMapping = instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId);
+
+ if (instanceNfvoMapping != null) {
+
+ url = instanceNfvoMapping.getEndpoint() + instanceNfvoMapping.getApiRoot() + url;
+
+ } else {
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS);
+ }
+ // Step3: prepare restful parameters and options
+ Map<String, String> reqBody = new HashMap<>();
+ reqBody.put("terminationTime", LocalDateTime.now().toString());
+
+ // Step4: Call the NFVO or SDNO service to terminate service
+ LOGGER.info("request body for terminate NS" + JsonUtil.marshal(reqBody));
+ RestfulResponse terminateRsp = restfulUtil.send(url, methodType, JsonUtil.marshal(reqBody));
+ ValidateUtil.assertObjectNotNull(terminateRsp);
+ LOGGER.info("terminate ns response status is : {}", terminateRsp.getStatus());
+ LOGGER.info("terminate ns response content is : {}", terminateRsp.getResponseContent());
+ // Step 3: update segment operation
+ if (!HttpCode.isSucess(terminateRsp.getStatus())) {
+ LOGGER.error("fail to terminate ns");
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setErrorCode(String.valueOf(terminateRsp.getStatus()));
+ status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
+ resourceOperationStatusRepository.save(status);
+
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS);
+ }
+ // @SuppressWarnings("unchecked")
+ String jobId = null;
+ Map<String, String> rsp = new HashMap<>();
+ if (terminateRsp.getStatus() == 202) {
+ String jobUri = terminateRsp.getRespHeaderStr(CommonConstant.JOB_URI);
+ jobId = jobUri.split("/")[4];
+ jobId.split("/");
+ if (ValidateUtil.isStrEmpty(jobId)) {
+ LOGGER.error("Invalid jobId from instantiate operation");
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setErrorCode(String.valueOf(terminateRsp.getStatus()));
+ status.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED);
+ resourceOperationStatusRepository.save(status);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION);
+ }
+ rsp.put(CommonConstant.JOB_ID, jobId);
+ LOGGER.info("terminate ns -> end");
+ LOGGER.info("update segment job id -> begin");
+ status.setProgress("60");
+ status.setStatusDescription("NS is termination completed");
+ status.setJobId(jobId);
+ resourceOperationStatusRepository.save(status);
+ LOGGER.info("update segment job id -> end");
+ } else if (terminateRsp.getStatus() > 400 && terminateRsp.getStatus() < 600) {
+ LOGGER.error("ERROR while executing instantiateNs request");
+ ProblemDetails problemDetails = JsonUtil.unMarshal(terminateRsp.getResponseContent(), ProblemDetails.class);
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setErrorCode(String.valueOf(terminateRsp.getStatus()));
+ status.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED + problemDetails.getDetail());
+ resourceOperationStatusRepository.save(status);
+ if (terminateRsp.getStatus() == 406) {
+ throw new ApplicationException(HttpCode.NOT_ACCEPTABLE, DriverExceptionID.FAIL_TO_TERMINATE_NS);
+ } else if (terminateRsp.getStatus() == 400) {
+ throw new ApplicationException(HttpCode.BAD_REQUEST, DriverExceptionID.FAIL_TO_TERMINATE_NS);
+ } else if (terminateRsp.getStatus() == 404) {
+ throw new ApplicationException(HttpCode.NOT_FOUND, DriverExceptionID.FAIL_TO_TERMINATE_NS);
+ } else if (terminateRsp.getStatus() == 409) {
+ LOGGER.error("The operation cannot be executed currently,\n"
+ + "due to a conflict with the state of the resource");
+ throw new ApplicationException(HttpCode.RESPOND_CONFLICT, DriverExceptionID.FAIL_TO_TERMINATE_NS);
+ } else if (terminateRsp.getStatus() == 500) {
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS);
+ } else {
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS);
+ }
+
+ }
+ instanceNfvoMapping.setJobId(jobId);
+ instanceNfvoMappingRepository.save(instanceNfvoMapping);
+ terminateRsp.setResponseContent(rsp.toString());
+ return terminateRsp;
+ }
+
+ /**
+ * get ns progress by job Id <br>
+ *
+ * @param nsOperationKey The OperationKey for NS resource
+ * @param jobId the job id
+ * @return
+ * @since ONAP Dublin Release
+ */
+ public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) throws ApplicationException {
+
+ ValidateUtil.assertObjectNotNull(jobId);
+ // Step 1: query the current resource operation status
+ ResourceOperationStatus status = new ResourceOperationStatus(nsOperationKey.getServiceId(),
+ nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
+ // status = resourceOperationStatusRepository.findOne(Example.of(status))
+ // .orElseThrow(() -> new ApplicationException(404, "Cannot Find Operation Status"));
+
+ // Get NFVO details
+ instanceNfvoMapping = instanceNfvoMappingRepository.findOneByJobId(jobId);
+
+ // Step 2: start query
+ LOGGER.info("SOL005 query ns status -> begin");
+ String url = getUrl(jobId, CommonConstant.Step.QUERY);
+ String methodType = CommonConstant.MethodType.GET;
+ if (instanceNfvoMapping != null) {
+
+ url = instanceNfvoMapping.getEndpoint() + instanceNfvoMapping.getApiRoot() + url;
+
+ } else {
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS);
+ }
+
+ // prepare restful parameters and options
+ RestfulResponse rsp = restfulUtil.send(url, methodType, "");
+ ValidateUtil.assertObjectNotNull(rsp);
+ LOGGER.info("query ns progress response status is : {}", rsp.getStatus());
+ LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent());
+ // Step 3:check the response staus
+ if (!HttpCode.isSucess(rsp.getStatus())) {
+ LOGGER.info("fail to query job status");
+ ProblemDetails problemDetails = JsonUtil.unMarshal(rsp.getResponseContent(), ProblemDetails.class);
+ status.setErrorCode(String.valueOf(rsp.getStatus()));
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED + problemDetails.getDetail());
+ resourceOperationStatusRepository.save(status);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS);
+ }
+ // Step 4: Process Network Service Instantiate Response
+ NsLcmOpOcc nsProgress = JsonUtil.unMarshal(rsp.getResponseContent(), NsLcmOpOcc.class);
+ if (CommonConstant.operationState.FAILED.equals(nsProgress.getOperationState())) {
+ LOGGER.info("NS instantiate fails");
+ status.setErrorCode(String.valueOf(rsp.getStatus()));
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setStatusDescription(
+ CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED + nsProgress.getError().getDetail());
+ resourceOperationStatusRepository.save(status);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS);
+ }
+ // Step 5: update segment operation progress
+
+ if (nsProgress.getOperationState().equals(CommonConstant.operationState.PROCESSING)) {
+ status.setProgress("40");
+ status.setStatus(RequestsDbConstant.Status.PROCESSING);
+ status.setStatusDescription("NS operation is in progress");
+ resourceOperationStatusRepository.save(status);
+ updateOperationStatusBasedOnResourceStatus(status);
+ } else if (nsProgress.getOperationState().equals(CommonConstant.operationState.PARTIALLY_COMPLETED)) {
+ status.setProgress("60");
+ status.setStatus(RequestsDbConstant.Status.PROCESSING);
+ status.setStatusDescription("NS operation is partially completed");
+ resourceOperationStatusRepository.save(status);
+ } else if (nsProgress.getOperationState().equals(CommonConstant.operationState.COMPLETED)) {
+ status.setStatus(RequestsDbConstant.Status.FINISHED);
+ status.setProgress("100");
+ status.setStatusDescription("NS operation is Completed");
+ resourceOperationStatusRepository.save(status);
+ updateOperationStatusBasedOnResourceStatus(status);
+
+ } else if (nsProgress.getOperationState().equals(CommonConstant.operationState.FAILED)
+ || nsProgress.getOperationState().equals(CommonConstant.operationState.FAILED_TEMP)) {
+ status.setStatus(RequestsDbConstant.Status.ERROR);
+ status.setProgress("0");
+ status.setStatusDescription("NS operation Failed");
+ resourceOperationStatusRepository.save(status);
+ updateOperationStatusBasedOnResourceStatus(status);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR);
+ } else {
+ LOGGER.error("unexcepted response status");
+
+ }
+ return rsp;
+ }
+
+ /**
+ * get url for the operation <br>
+ *
+ * @param variable variable should be put in the url
+ * @param step step of the operation (terminate,query,delete)
+ * @return
+ * @since ONAP Dublin Release
+ */
+ private String getUrl(String variable, String step) {
+
+ String url;
+ String originalUrl;
+ originalUrl = nfvoUrlMap.get(step);
+ url = String.format(originalUrl, variable);
+ return url;
+
+ }
+
+ private void updateOperationStatusBasedOnResourceStatus(ResourceOperationStatus operStatus) {
+ String serviceId = operStatus.getServiceId();
+ String operationId = operStatus.getOperationId();
+
+ LOGGER.debug("Request database - update Operation Status Based On Resource Operation Status with service Id: "
+ + "{}, operationId: {}", serviceId, operationId);
+
+ List<ResourceOperationStatus> lstResourceStatus =
+ resourceOperationStatusRepository.findByServiceIdAndOperationId(serviceId, operationId);
+ if (lstResourceStatus == null) {
+ LOGGER.error("Unable to retrieve resourceOperStatus Object by ServiceId: {} operationId: {}", serviceId,
+ operationId);
+ return;
+ }
+
+ // count the total progress
+ int resourceCount = lstResourceStatus.size();
+ int progress = 0;
+ boolean isFinished = true;
+ for (ResourceOperationStatus lstResourceStatu : lstResourceStatus) {
+ progress = progress + Integer.valueOf(lstResourceStatu.getProgress()) / resourceCount;
+ if (RequestsDbConstant.Status.PROCESSING.equals(lstResourceStatu.getStatus())) {
+ isFinished = false;
+ }
+ }
+
+ OperationStatus serviceOperStatus =
+ operationStatusRepository.findOneByServiceIdAndOperationId(serviceId, operationId);
+ if (serviceOperStatus == null) {
+ String error = "Entity not found. Unable to retrieve OperationStatus Object ServiceId: " + serviceId
+ + " operationId: " + operationId;
+ LOGGER.error(error);
+
+ serviceOperStatus = new OperationStatus();
+ serviceOperStatus.setOperationId(operationId);
+ serviceOperStatus.setServiceId(serviceId);
+ }
+
+ progress = progress > 100 ? 100 : progress;
+ serviceOperStatus.setProgress(String.valueOf(progress));
+ serviceOperStatus.setOperationContent(operStatus.getStatusDescription());
+ // if current resource failed. service failed.
+ if (RequestsDbConstant.Status.ERROR.equals(operStatus.getStatus())) {
+ serviceOperStatus.setResult(RequestsDbConstant.Status.ERROR);
+ serviceOperStatus.setReason(operStatus.getStatusDescription());
+ } else if (isFinished) {
+ // if finished
+ serviceOperStatus.setResult(RequestsDbConstant.Status.FINISHED);
+ serviceOperStatus.setProgress(RequestsDbConstant.Progress.ONE_HUNDRED);
+ }
+
+ operationStatusRepository.save(serviceOperStatus);
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
index 5b50f776cc..04109bd89d 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java
@@ -27,7 +27,7 @@ import java.io.IOException;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.vfc.constant.HttpCode;
import org.onap.so.adapters.vfc.exceptions.ApplicationException;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.type.TypeReference;
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
index 647fcafa66..a708c2641c 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java
@@ -26,8 +26,13 @@ package org.onap.so.adapters.vfc.util;
import java.net.HttpURLConnection;
import java.net.SocketTimeoutException;
+import java.util.Base64;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import javax.ws.rs.core.UriBuilder;
import org.onap.so.logger.LoggingAnchor;
+import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
@@ -42,7 +47,7 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.onap.so.adapters.vfc.model.RestfulResponse;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -102,9 +107,10 @@ public class RestfulUtil {
}
- public RestfulResponse send(String url, String methodType, String content) {
- String msbUrl = getMsbHost() + url;
- logger.debug("Begin to sent message {}: {}", methodType, msbUrl);
+
+ public RestfulResponse send(String msbUrl, String methodType, String content, Map<String, String> requestHeader) {
+ // String msbUrl = getMsbHost() + url;
+ logger.debug("Begin to sent message " + methodType + ": " + msbUrl);
HttpRequestBase method = null;
HttpResponse httpResponse = null;
@@ -115,9 +121,14 @@ public class RestfulUtil {
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
.setConnectionRequestTimeout(timeout).build();
+ HttpClient client = HttpClientBuilder.create().build();
+
if ("POST".equalsIgnoreCase(methodType)) {
HttpPost httpPost = new HttpPost(msbUrl);
httpPost.setConfig(requestConfig);
+ for (String key : requestHeader.keySet()) {
+ httpPost.setHeader(key, requestHeader.get(key));
+ }
httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
method = httpPost;
} else if ("PUT".equalsIgnoreCase(methodType)) {
@@ -135,11 +146,24 @@ public class RestfulUtil {
method = httpDelete;
}
- httpResponse = client.execute(method);
+ // now VFC have no auth
+ // 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);
+ httpResponse = client.execute(method);
+ Map<String, String> responseHeader = new HashMap<>();
String responseContent = null;
if (httpResponse.getEntity() != null) {
responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
+ Header[] httpResponseAllHeaders = httpResponse.getAllHeaders();
+ for (Header header : httpResponseAllHeaders) {
+ responseHeader.put(header.getName(), header.getValue());
+
+ }
}
int statusCode = httpResponse.getStatusLine().getStatusCode();
@@ -163,7 +187,115 @@ public class RestfulUtil {
}
method = null;
- return createResponse(statusCode, responseContent);
+ return createResponse(statusCode, responseContent, responseHeader);
+
+ } catch (SocketTimeoutException | ConnectTimeoutException e) {
+ String errMsg = "Request to VFC timed out";
+ logError(errMsg, e);
+ return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
+
+ } catch (Exception e) {
+ String errMsg = "Error processing request to VFC";
+ logError(errMsg, e);
+ return createResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg);
+
+ } finally {
+ if (httpResponse != null) {
+ try {
+ EntityUtils.consume(httpResponse.getEntity());
+ } catch (Exception e) {
+ logger.debug("Exception :", e);
+ }
+ }
+
+ if (method != null) {
+ try {
+ method.reset();
+ } catch (Exception e) {
+ logger.debug("Exception :", e);
+ }
+ }
+ }
+ }
+
+ public RestfulResponse send(String msbUrl, String methodType, String content) {
+ if (!msbUrl.contains("http")) {
+ msbUrl = getMsbHost() + msbUrl;
+ }
+ // String msbUrl = getMsbHost() + url;
+ logger.debug("Begin to sent message " + methodType + ": " + msbUrl);
+
+ HttpRequestBase method = null;
+ HttpResponse httpResponse = null;
+
+ try {
+ int timeout = DEFAULT_TIME_OUT;
+
+ RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
+ .setConnectionRequestTimeout(timeout).build();
+
+ if ("POST".equalsIgnoreCase(methodType)) {
+ HttpPost httpPost = new HttpPost(msbUrl);
+ httpPost.setConfig(requestConfig);
+ httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
+ method = httpPost;
+ } else if ("PUT".equalsIgnoreCase(methodType)) {
+ HttpPut httpPut = new HttpPut(msbUrl);
+ httpPut.setConfig(requestConfig);
+ httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
+ method = httpPut;
+ } else if ("GET".equalsIgnoreCase(methodType)) {
+ HttpGet httpGet = new HttpGet(msbUrl);
+ httpGet.setConfig(requestConfig);
+ method = httpGet;
+ } else if ("DELETE".equalsIgnoreCase(methodType)) {
+ HttpDelete httpDelete = new HttpDelete(msbUrl);
+ httpDelete.setConfig(requestConfig);
+ method = httpDelete;
+ }
+
+ // now VFC have no auth
+ // 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);
+
+ httpResponse = client.execute(method);
+ Map<String, String> responseHeader = new HashMap<>();
+ String responseContent = null;
+ if (httpResponse.getEntity() != null) {
+ responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
+ Header[] httpResponseAllHeaders = httpResponse.getAllHeaders();
+ for (Header header : httpResponseAllHeaders) {
+ responseHeader.put(header.getName(), header.getValue());
+
+ }
+ }
+
+ int statusCode = httpResponse.getStatusLine().getStatusCode();
+ String statusMessage = httpResponse.getStatusLine().getReasonPhrase();
+
+ logger.debug("VFC Response: " + statusCode + " " + statusMessage
+ + (responseContent == null ? "" : System.lineSeparator() + responseContent));
+
+ if (httpResponse.getStatusLine().getStatusCode() >= 300) {
+ String errMsg = "VFC returned " + statusCode + " " + statusMessage;
+ logError(errMsg);
+ return createResponse(statusCode, errMsg);
+ }
+
+ httpResponse = null;
+
+ if (null != method) {
+ method.reset();
+ } else {
+ logger.debug("method is NULL:");
+ }
+
+ method = null;
+ return createResponse(statusCode, responseContent, responseHeader);
} catch (SocketTimeoutException | ConnectTimeoutException e) {
String errMsg = "Request to VFC timed out";
@@ -194,6 +326,46 @@ public class RestfulUtil {
}
}
+ public RestfulResponse getNfvoFromAAI(String nfvo) {
+ HttpRequestBase method = null;
+ HttpResponse httpResponse = null;
+ String endPoint = getMsbHost() + "/api/aai-esr-server/v1/nfvos/" + nfvo;
+ logger.info("Endpoint URL" + endPoint);
+ RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(DEFAULT_TIME_OUT)
+ .setConnectTimeout(DEFAULT_TIME_OUT).setConnectionRequestTimeout(DEFAULT_TIME_OUT).build();
+ HttpClient client = HttpClientBuilder.create().build();
+ HttpGet httpGet = new HttpGet(endPoint);
+ httpGet.setConfig(requestConfig);
+ String encoding = Base64.getEncoder().encodeToString(("AAI:AAI").getBytes());
+ httpGet.setHeader("Authorization", "Basic " + encoding);
+ method = httpGet;
+ String responseContent = null;
+ Map<String, String> responseHeader = null;
+ try {
+ httpResponse = client.execute(method);
+ if (httpResponse.getEntity() != null) {
+ responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
+ }
+
+ int statusCode = httpResponse.getStatusLine().getStatusCode();
+ String statusMessage = httpResponse.getStatusLine().getReasonPhrase();
+
+ logger.debug("AAI Response: " + statusCode + " " + statusMessage
+ + (responseContent == null ? "" : System.lineSeparator() + responseContent));
+
+ if (httpResponse.getStatusLine().getStatusCode() >= 300) {
+ String errMsg = "AAI returned " + statusCode + " " + statusMessage;
+ logError(errMsg);
+ return createResponse(statusCode, errMsg);
+ }
+ } catch (Exception e) {
+ String errMsg = "Error processing request to AAI";
+ logError(errMsg, e);
+ return createResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg);
+ }
+ return createResponse(200, responseContent);
+ }
+
private static void logError(String errMsg, Throwable t) {
logger.error(LoggingAnchor.FOUR, MessageEnum.RA_NS_EXC.toString(), VFC_ADAPTER,
ErrorCode.AvailabilityError.getValue(), errMsg, t);
@@ -211,4 +383,12 @@ public class RestfulUtil {
return rsp;
}
+ private static RestfulResponse createResponse(int statusCode, String content, Map<String, String> responseHeader) {
+ RestfulResponse rsp = new RestfulResponse();
+ rsp.setStatus(statusCode);
+ rsp.setRespHeaderMap(responseHeader);
+ rsp.setResponseContent(content);
+ return rsp;
+ }
+
}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AddPnfDataTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AddPnfDataTest.java
new file mode 100644
index 0000000000..1fedac9cc9
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AddPnfDataTest.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import static org.junit.Assert.*;
+
+public class AddPnfDataTest {
+ AddPnfData pnfData = new AddPnfData();
+
+ @Test
+ public void getPnfId() {
+ pnfData.getPnfId();
+ }
+
+
+ @Test
+ public void setPnfId() {
+ pnfData.setPnfId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getPnfName() {
+ pnfData.getPnfName();
+ }
+
+ @Test
+ public void setPnfName() {
+ pnfData.setPnfName("Router");
+ }
+
+ @Test
+ public void getPnfdId() {
+ pnfData.getPnfdId();
+ }
+
+ @Test
+ public void setPnfdId() {
+ pnfData.setPnfdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getPnfProfileId() {
+ pnfData.getPnfProfileId();
+ }
+
+ @Test
+ public void setPnfProfileId() {
+ pnfData.setPnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getCpData() {
+ pnfData.getCpData();
+ }
+
+ @Test
+ public void setCpData() {
+ pnfData.setCpData(new List<PnfExtCpData>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<PnfExtCpData> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(PnfExtCpData pnfExtCpData) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends PnfExtCpData> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends PnfExtCpData> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public PnfExtCpData get(int index) {
+ return null;
+ }
+
+ @Override
+ public PnfExtCpData set(int index, PnfExtCpData element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, PnfExtCpData element) {
+
+ }
+
+ @Override
+ public PnfExtCpData remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<PnfExtCpData> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<PnfExtCpData> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<PnfExtCpData> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AddressRangeTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AddressRangeTest.java
new file mode 100644
index 0000000000..9444efd4c5
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AddressRangeTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class AddressRangeTest {
+ AddressRange addressRange = new AddressRange();
+
+ @Test
+ public void getMinAddress() {
+ addressRange.getMinAddress();
+ }
+
+ @Test
+ public void setMinAddress() {
+ addressRange.setMinAddress("192.168.10.10");
+ }
+
+ @Test
+ public void getMaxAddress() {
+ addressRange.getMaxAddress();
+ }
+
+ @Test
+ public void setMaxAddress() {
+ addressRange.setMaxAddress("192.168.10.10");
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedNsTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedNsTest.java
new file mode 100644
index 0000000000..06c52e2e52
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedNsTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class AffectedNsTest {
+
+ AffectedNs affectedNs = new AffectedNs();
+
+ @Test
+ public void getNsInstanceId() {
+ affectedNs.getNsInstanceId();
+ }
+
+ @Test
+ public void setNsInstanceId() {
+ affectedNs.setNsInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getNsdId() {
+ affectedNs.getNsdId();
+ }
+
+ @Test
+ public void setNsdId() {
+ affectedNs.setNsdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedPnfTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedPnfTest.java
new file mode 100644
index 0000000000..beecbe0675
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedPnfTest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class AffectedPnfTest {
+ AffectedPnf affectedPnf = new AffectedPnf();
+
+ @Test
+ public void getPnfid() {
+ affectedPnf.getPnfid();
+ }
+
+ @Test
+ public void setPnfid() {
+ affectedPnf.setPnfid("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getPnfdid() {
+ affectedPnf.getPnfdid();
+ }
+
+ @Test
+ public void setPnfdid() {
+ affectedPnf.setPnfdid("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getPnfProfileId() {
+ affectedPnf.getPnfProfileId();
+ }
+
+ @Test
+ public void setPnfProfileId() {
+ affectedPnf.setPnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getPnfName() {
+ affectedPnf.getPnfName();
+ }
+
+ @Test
+ public void setPnfName() {
+ affectedPnf.setPnfName("Router");
+ }
+
+ @Test
+ public void getCpInstanceId() {
+ affectedPnf.getCpInstanceId();
+ }
+
+ @Test
+ public void setCpInstanceId() {
+ affectedPnf.setCpInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedSapTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedSapTest.java
new file mode 100644
index 0000000000..b96fe32836
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedSapTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class AffectedSapTest {
+ AffectedSap affectedSap = new AffectedSap();
+
+ @Test
+ public void getSapInstanceId() {
+ affectedSap.getSapInstanceId();
+ }
+
+ @Test
+ public void setSapInstanceId() {
+ affectedSap.setSapInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getSapdId() {
+ affectedSap.getSapdId();
+ }
+
+ @Test
+ public void setSapdId() {
+ affectedSap.setSapdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getSapName() {
+ affectedSap.getSapName();
+ }
+
+ @Test
+ public void setSapName() {
+ affectedSap.setSapName("Dummy SAP");
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVirtualLinkTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVirtualLinkTest.java
new file mode 100644
index 0000000000..dbc6d0811f
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVirtualLinkTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class AffectedVirtualLinkTest {
+ AffectedVirtualLink affectedVirtualLink = new AffectedVirtualLink();
+
+ @Test
+ public void getNsVirtualLinkInstanceId() {
+ affectedVirtualLink.getNsVirtualLinkInstanceId();
+ }
+
+ @Test
+ public void setNsVirtualLinkInstanceId() {
+ affectedVirtualLink.setNsVirtualLinkInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getNsVirtualLinkDescId() {
+ affectedVirtualLink.getNsVirtualLinkDescId();
+ }
+
+ @Test
+ public void setNsVirtualLinkDescId() {
+ affectedVirtualLink.setNsVirtualLinkDescId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getVlProfileId() {
+ affectedVirtualLink.getVlProfileId();
+ }
+
+ @Test
+ public void setVlProfileId() {
+ affectedVirtualLink.setVlProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnfTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnfTest.java
new file mode 100644
index 0000000000..810f32d005
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnfTest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class AffectedVnfTest {
+ AffectedVnf affectedVnf = new AffectedVnf();
+
+ @Test
+ public void getVnfInstanceId() {
+ affectedVnf.getVnfInstanceId();
+ }
+
+ @Test
+ public void setVnfInstanceId() {
+ affectedVnf.setVnfInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getVnfdId() {
+ affectedVnf.getVnfdId();
+ }
+
+ @Test
+ public void setVnfdId() {
+ affectedVnf.setVnfdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getVnfProfileId() {
+ affectedVnf.getVnfProfileId();
+ }
+
+ @Test
+ public void setVnfProfileId() {
+ affectedVnf.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getVnfName() {
+ affectedVnf.getVnfName();
+ }
+
+ @Test
+ public void setVnfName() {
+ affectedVnf.setVnfName("Dummy Vnf Name");
+ }
+
+ @Test
+ public void getChangedInfo() {
+ affectedVnf.getChangedInfo();
+ }
+
+ @Test
+ public void setChangedInfo() {
+ affectedVnf.setChangedInfo(new ChangedInfo());
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnffgTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnffgTest.java
new file mode 100644
index 0000000000..0d5670133d
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffectedVnffgTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class AffectedVnffgTest {
+ AffectedVnffg affectedVnffg = new AffectedVnffg();
+
+ @Test
+ public void getVnffgInstanceId() {
+ affectedVnffg.getVnffgInstanceId();
+ }
+
+ @Test
+ public void setVnffgInstanceId() {
+ affectedVnffg.setVnffgInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getVnffgdId() {
+ affectedVnffg.getVnffgdId();
+ }
+
+ @Test
+ public void setVnffgdId() {
+ affectedVnffg.setVnffgdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRuleTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRuleTest.java
new file mode 100644
index 0000000000..99a40e4ee1
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/AffinityOrAntiAffinityRuleTest.java
@@ -0,0 +1,283 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import static org.junit.Assert.*;
+
+public class AffinityOrAntiAffinityRuleTest {
+ AffinityOrAntiAffinityRule affinityOrAntiAffinityRule = new AffinityOrAntiAffinityRule();
+
+ @Test
+ public void getVnfdId() {
+ affinityOrAntiAffinityRule.getVnfdId();
+ }
+
+ @Test
+ public void setVnfdId() {
+ affinityOrAntiAffinityRule.setVnfdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getVnfProfileId() {
+ affinityOrAntiAffinityRule.getVnfProfileId();
+ }
+
+ @Test
+ public void setVnfProfileId() {
+ affinityOrAntiAffinityRule.setVnfProfileId(new List<String>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<String> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(String s) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends String> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends String> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public String get(int index) {
+ return null;
+ }
+
+ @Override
+ public String set(int index, String element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, String element) {
+
+ }
+
+ @Override
+ public String remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<String> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<String> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<String> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+
+ @Test
+ public void getVnfInstanceId() {
+ affinityOrAntiAffinityRule.getVnfInstanceId();
+ }
+
+ @Test
+ public void setVnfInstanceId() {
+ affinityOrAntiAffinityRule.setVnfInstanceId(new List<String>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<String> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(String s) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends String> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends String> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public String get(int index) {
+ return null;
+ }
+
+ @Override
+ public String set(int index, String element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, String element) {
+
+ }
+
+ @Override
+ public String remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<String> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<String> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<String> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ChangedInfoTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ChangedInfoTest.java
new file mode 100644
index 0000000000..41077fbe67
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ChangedInfoTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class ChangedInfoTest {
+ ChangedInfo changedInfo = new ChangedInfo();
+
+ @Test
+ public void getChangedVnfInfo() {
+ changedInfo.getChangedVnfInfo();
+ }
+
+ @Test
+ public void setChangedVnfInfo() {
+ changedInfo.setChangedVnfInfo(new ModifyVnfInfoData());
+ }
+
+ @Test
+ public void getChangedExtConnectivity() {
+ changedInfo.getChangedExtConnectivity();
+ }
+
+ @Test
+ public void setChangedExtConnectivity() {
+ changedInfo.setChangedExtConnectivity(new ExtVirtualLinkInfo());
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CivicAddressElementTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CivicAddressElementTest.java
new file mode 100644
index 0000000000..e9c011b86a
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CivicAddressElementTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class CivicAddressElementTest {
+ CivicAddressElement civicAddressElement = new CivicAddressElement();
+
+ @Test
+ public void getCaType() {
+ civicAddressElement.getCaType();
+ }
+
+ @Test
+ public void setCaType() {
+ civicAddressElement.setCaType(12);
+ }
+
+ @Test
+ public void getCaValue() {
+ civicAddressElement.getCaValue();
+ }
+
+ @Test
+ public void setCaValue() {
+ civicAddressElement.setCaValue("Dummy Ca value");
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CpProtocolDataTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CpProtocolDataTest.java
new file mode 100644
index 0000000000..e47d02c926
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CpProtocolDataTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class CpProtocolDataTest {
+ CpProtocolData cpProtocolData = new CpProtocolData();
+
+ @Test
+ public void getLayerProtocol() {
+ cpProtocolData.getLayerProtocol();
+ }
+
+ @Test
+ public void setLayerProtocol() {
+ cpProtocolData.setLayerProtocol("BGP");
+ }
+
+ @Test
+ public void getIpOverEthernet() {
+ cpProtocolData.getIpOverEthernet();
+ }
+
+ @Test
+ public void setIpOverEthernet() {
+ cpProtocolData.setIpOverEthernet(new IpOverEthernetAddressData());
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CreateNsRequestTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CreateNsRequestTest.java
new file mode 100644
index 0000000000..a2a6ae4fe1
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CreateNsRequestTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class CreateNsRequestTest {
+ CreateNsRequest createNsRequest = new CreateNsRequest();
+
+ @Test
+ public void getNsdId() {
+ createNsRequest.getNsdId();
+ }
+
+ @Test
+ public void setNsdId() {
+ createNsRequest.setNsdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getNsDescription() {
+ createNsRequest.getNsDescription();
+ }
+
+ @Test
+ public void setNsDescription() {
+ createNsRequest.setNsDescription("Dummy description");
+ }
+
+ @Test
+ public void getNsName() {
+ createNsRequest.getNsName();
+ }
+
+ @Test
+ public void setNsName() {
+ createNsRequest.setNsName("Dummy Name");
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfoTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfoTest.java
new file mode 100644
index 0000000000..92cec88b34
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ExtLinkPortInfoTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class ExtLinkPortInfoTest {
+
+ ExtLinkPortInfo extLinkPortInfo = new ExtLinkPortInfo();
+
+ @Test
+ public void getId() {
+ extLinkPortInfo.getId();
+ }
+
+ @Test
+ public void setId() {
+ extLinkPortInfo.setId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getResourceHandle() {
+ extLinkPortInfo.getResourceHandle();
+ }
+
+ @Test
+ public void setResourceHandle() {
+ extLinkPortInfo.setResourceHandle(new ResourceHandle());
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfoTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfoTest.java
new file mode 100644
index 0000000000..c455b36a46
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ExtVirtualLinkInfoTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class ExtVirtualLinkInfoTest {
+ ExtVirtualLinkInfo extVirtualLinkInfo = new ExtVirtualLinkInfo();
+
+ @Test
+ public void getId() {
+ extVirtualLinkInfo.getId();
+ }
+
+ @Test
+ public void setId() {
+ extVirtualLinkInfo.setId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getResourceHandle() {
+ extVirtualLinkInfo.getResourceHandle();
+ }
+
+ @Test
+ public void setResourceHandle() {
+ extVirtualLinkInfo.setResourceHandle(new ResourceHandle());
+ }
+
+ @Test
+ public void getExtLinkPorts() {
+ extVirtualLinkInfo.getExtLinkPorts();
+ }
+
+ @Test
+ public void setExtLinkPorts() {
+ extVirtualLinkInfo.setExtLinkPorts(new ExtLinkPortInfo());
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/InstantiateNsRequestTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/InstantiateNsRequestTest.java
new file mode 100644
index 0000000000..f27b041690
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/InstantiateNsRequestTest.java
@@ -0,0 +1,413 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import static org.junit.Assert.*;
+
+public class InstantiateNsRequestTest {
+ InstantiateNsRequest instantiateNsRequest = new InstantiateNsRequest();
+
+ @Test
+ public void getNsFlavourId() {
+ instantiateNsRequest.getNsFlavourId();
+ }
+
+ @Test
+ public void setNsFlavourId() {
+ instantiateNsRequest.setNsFlavourId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getSapData() {
+ instantiateNsRequest.getSapData();
+ }
+
+ @Test
+ public void setSapData() {
+ instantiateNsRequest.setSapData(new List<SapData>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<SapData> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(SapData sapData) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends SapData> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends SapData> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public SapData get(int index) {
+ return null;
+ }
+
+ @Override
+ public SapData set(int index, SapData element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, SapData element) {
+
+ }
+
+ @Override
+ public SapData remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<SapData> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<SapData> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<SapData> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+
+ @Test
+ public void getAddpnfData() {
+ instantiateNsRequest.getAddpnfData();
+ }
+
+ @Test
+ public void setAddpnfData() {
+ instantiateNsRequest.setAddpnfData(new List<AddPnfData>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<AddPnfData> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(AddPnfData addPnfData) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends AddPnfData> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends AddPnfData> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public AddPnfData get(int index) {
+ return null;
+ }
+
+ @Override
+ public AddPnfData set(int index, AddPnfData element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, AddPnfData element) {
+
+ }
+
+ @Override
+ public AddPnfData remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<AddPnfData> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<AddPnfData> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<AddPnfData> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+
+ @Test
+ public void getVnfInstanceData() {
+ instantiateNsRequest.getVnfInstanceData();
+ }
+
+ @Test
+ public void setVnfInstanceData() {
+ instantiateNsRequest.setVnfInstanceData(new List<VnfInstanceData>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<VnfInstanceData> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(VnfInstanceData vnfInstanceData) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends VnfInstanceData> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends VnfInstanceData> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public VnfInstanceData get(int index) {
+ return null;
+ }
+
+ @Override
+ public VnfInstanceData set(int index, VnfInstanceData element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, VnfInstanceData element) {
+
+ }
+
+ @Override
+ public VnfInstanceData remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<VnfInstanceData> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<VnfInstanceData> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<VnfInstanceData> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+
+ @Test
+ public void getNestedNsInstanceId() {
+ instantiateNsRequest.getNestedNsInstanceId();
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/IpAddressesTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/IpAddressesTest.java
new file mode 100644
index 0000000000..edf6346bca
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/IpAddressesTest.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import static org.junit.Assert.*;
+
+public class IpAddressesTest {
+ IpAddresses ipAddresses = new IpAddresses();
+
+ @Test
+ public void getType() {
+ ipAddresses.getType();
+ }
+
+ @Test
+ public void setType() {
+ ipAddresses.setType("Dummy Type");
+ }
+
+ @Test
+ public void getFixedAddresses() {
+ ipAddresses.getFixedAddresses();
+ }
+
+ @Test
+ public void setFixedAddresses() {
+ ipAddresses.setFixedAddresses(new List<String>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<String> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(String s) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends String> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends String> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public String get(int index) {
+ return null;
+ }
+
+ @Override
+ public String set(int index, String element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, String element) {
+
+ }
+
+ @Override
+ public String remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<String> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<String> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<String> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+
+ @Test
+ public void getNumDynamicAddresses() {
+ ipAddresses.getNumDynamicAddresses();
+ }
+
+ @Test
+ public void setNumDynamicAddresses() {
+ ipAddresses.setNumDynamicAddresses(5);
+ }
+
+ @Test
+ public void getAddressRange() {
+ ipAddresses.getAddressRange();
+ }
+
+ @Test
+ public void setAddressRange() {
+ ipAddresses.setAddressRange(new AddressRange());
+ }
+
+ @Test
+ public void getSubnetId() {
+ ipAddresses.getSubnetId();
+ }
+
+ @Test
+ public void setSubnetId() {
+ ipAddresses.setSubnetId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressDataTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressDataTest.java
new file mode 100644
index 0000000000..0088cdc50b
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/IpOverEthernetAddressDataTest.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import static org.junit.Assert.*;
+
+public class IpOverEthernetAddressDataTest {
+ IpOverEthernetAddressData ipOverEthernetAddressData = new IpOverEthernetAddressData();
+
+ @Test
+ public void getMacAddress() {
+ ipOverEthernetAddressData.getMacAddress();
+ }
+
+ @Test
+ public void setMacAddress() {
+ ipOverEthernetAddressData.setMacAddress("4e:86:9f:62:c1:bf");
+ }
+
+ @Test
+ public void getIpAddresses() {
+ ipOverEthernetAddressData.getIpAddresses();
+ }
+
+ @Test
+ public void setIpAddresses() {
+ ipOverEthernetAddressData.setIpAddresses(new List<IpAddresses>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<IpAddresses> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(IpAddresses ipAddresses) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends IpAddresses> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends IpAddresses> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public IpAddresses get(int index) {
+ return null;
+ }
+
+ @Override
+ public IpAddresses set(int index, IpAddresses element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, IpAddresses element) {
+
+ }
+
+ @Override
+ public IpAddresses remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<IpAddresses> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<IpAddresses> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<IpAddresses> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LinkTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LinkTest.java
new file mode 100644
index 0000000000..e447c85ee7
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LinkTest.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class LinkTest {
+ Link link = new Link();
+
+ @Test
+ public void getHref() {
+ link.getHref();
+ }
+
+ @Test
+ public void setHref() {
+ link.setHref("dummy href");
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LinksTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LinksTest.java
new file mode 100644
index 0000000000..aef87c47b1
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LinksTest.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class LinksTest {
+ Links links = new Links();
+
+ @Test
+ public void getSelf() {
+ links.getSelf();
+ }
+
+ @Test
+ public void setSelf() {
+ links.setSelf(new Link());
+ }
+
+ @Test
+ public void getNsInstance() {
+ links.getNsInstance();
+ }
+
+ @Test
+ public void setNsInstance() {
+ links.setNsInstance(new Link());
+ }
+
+ @Test
+ public void getCancel() {
+ links.getCancel();
+ }
+
+ @Test
+ public void setCancel() {
+ links.setCancel(new Link());
+ }
+
+ @Test
+ public void getRetry() {
+ links.getRetry();
+ }
+
+ @Test
+ public void setRetry() {
+ links.setRetry(new Link());
+ }
+
+ @Test
+ public void getRollback() {
+ links.getRollback();
+ }
+
+ @Test
+ public void setRollback() {
+ links.setRollback(new Link());
+ }
+
+ @Test
+ public void getContinues() {
+ links.getContinues();
+ }
+
+ @Test
+ public void setContinues() {
+ links.setContinues(new Link());
+ }
+
+ @Test
+ public void getFail() {
+ links.getFail();
+ }
+
+ @Test
+ public void setFail() {
+ links.setFail(new Link());
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintsTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintsTest.java
new file mode 100644
index 0000000000..e68b12a626
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintsTest.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class LocationConstraintsTest {
+ LocationConstraints locationConstraints = new LocationConstraints();
+
+ @Test
+ public void getCountryCode() {
+ locationConstraints.getCountryCode();
+ }
+
+ @Test
+ public void setCountryCode() {
+ locationConstraints.setCountryCode("IND");
+
+ }
+
+ @Test
+ public void getCivicAddressElement() {
+ locationConstraints.getCivicAddressElement();
+ }
+
+ @Test
+ public void setCivicAddressElement() {
+ locationConstraints.setCivicAddressElement(new CivicAddressElement());
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoDataTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoDataTest.java
new file mode 100644
index 0000000000..c300923857
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ModifyVnfInfoDataTest.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import java.util.HashMap;
+import static org.junit.Assert.*;
+
+public class ModifyVnfInfoDataTest {
+ ModifyVnfInfoData modifyVnfInfoData = new ModifyVnfInfoData();
+
+ @Test
+ public void getVnfInstanceId() {
+ modifyVnfInfoData.getVnfInstanceId();
+ }
+
+ @Test
+ public void setVnfInstanceId() {
+ modifyVnfInfoData.setVnfInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getVnfInstanceName() {
+ modifyVnfInfoData.getVnfInstanceName();
+ }
+
+ @Test
+ public void setVnfInstanceName() {
+ modifyVnfInfoData.setVnfInstanceName("Dummy vnfInstanceName");
+ }
+
+ @Test
+ public void getVnfInstanceDescription() {
+ modifyVnfInfoData.getVnfInstanceDescription();
+ }
+
+ @Test
+ public void setVnfInstanceDescription() {
+ modifyVnfInfoData.setVnfInstanceDescription("Dummy vnfInstanceDescription");
+ }
+
+ @Test
+ public void getVnfPkgId() {
+ modifyVnfInfoData.getVnfPkgId();
+ }
+
+ @Test
+ public void setVnfPkgId() {
+ modifyVnfInfoData.setVnfPkgId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getVnfConfigurableProperties() {
+ modifyVnfInfoData.getVnfConfigurableProperties();
+ }
+
+ @Test
+ public void setVnfConfigurableProperties() {
+ modifyVnfInfoData.setVnfConfigurableProperties(new HashMap<>());
+ }
+
+ @Test
+ public void getMetadata() {
+ modifyVnfInfoData.getMetadata();
+ }
+
+ @Test
+ public void setMetadata() {
+ modifyVnfInfoData.setMetadata(new HashMap<>());
+ }
+
+ @Test
+ public void getExtensions() {
+ modifyVnfInfoData.getExtensions();
+ }
+
+ @Test
+ public void setExtensions() {
+ modifyVnfInfoData.setExtensions(new HashMap<>());
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsLcmOpOccTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsLcmOpOccTest.java
new file mode 100644
index 0000000000..f5d485a8c7
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsLcmOpOccTest.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import org.onap.so.adapters.vfc.constant.CommonConstant;
+import java.time.LocalDateTime;
+import java.util.Date;
+import static org.junit.Assert.*;
+
+public class NsLcmOpOccTest {
+ NsLcmOpOcc nsLcmOpOcc = new NsLcmOpOcc();
+
+ @Test
+ public void getLcmOperationType() {
+ nsLcmOpOcc.getLcmOperationType();
+ }
+
+ @Test
+ public void setLcmOperationType() {
+ nsLcmOpOcc.setLcmOperationType(CommonConstant.lcmOperationType.INSTANTIATE);
+ }
+
+ @Test
+ public void getCancelMode() {
+ nsLcmOpOcc.getCancelMode();
+ }
+
+ @Test
+ public void setCancelMode() {
+ nsLcmOpOcc.setCancelMode(CommonConstant.cancelMode.GRACEFUL);
+ }
+
+ @Test
+ public void getOperationState() {
+ nsLcmOpOcc.getOperationState();
+ }
+
+ @Test
+ public void setOperationState() {
+ nsLcmOpOcc.setOperationState(CommonConstant.operationState.COMPLETED);
+ }
+
+ @Test
+ public void getId() {
+ nsLcmOpOcc.getId();
+ }
+
+ @Test
+ public void setId() {
+ nsLcmOpOcc.setId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getStatusEnteredTime() {
+ nsLcmOpOcc.getStatusEnteredTime();
+ }
+
+ @Test
+ public void setStatusEnteredTime() {
+ nsLcmOpOcc.setStatusEnteredTime(LocalDateTime.now().toString());
+ }
+
+ @Test
+ public void getNsInstanceId() {
+ nsLcmOpOcc.getNsInstanceId();
+ }
+
+ @Test
+ public void setNsInstanceId() {
+ nsLcmOpOcc.setNsInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getStartTime() {
+ nsLcmOpOcc.getStartTime();
+ }
+
+ @Test
+ public void setStartTime() {
+ nsLcmOpOcc.setStartTime(LocalDateTime.now().toString());
+ }
+
+ @Test
+ public void getAutomaticInvocation() {
+ nsLcmOpOcc.getAutomaticInvocation();
+ }
+
+ @Test
+ public void setAutomaticInvocation() {
+ nsLcmOpOcc.setAutomaticInvocation(true);
+ }
+
+ @Test
+ public void getOperationParams() {
+ nsLcmOpOcc.getOperationParams();
+ }
+
+ @Test
+ public void setOperationParams() {
+ nsLcmOpOcc.setOperationParams("Dummy operationParams");
+ }
+
+ @Test
+ public void getCancelPending() {
+ nsLcmOpOcc.getCancelPending();
+ }
+
+ @Test
+ public void setCancelPending() {
+ nsLcmOpOcc.setCancelPending(true);
+ }
+
+ @Test
+ public void getError() {
+ nsLcmOpOcc.getError();
+ }
+
+ @Test
+ public void setError() {
+ nsLcmOpOcc.setError(new ProblemDetails());
+ }
+
+ @Test
+ public void getLinks() {
+ nsLcmOpOcc.getLinks();
+ }
+
+ @Test
+ public void setLinks() {
+ nsLcmOpOcc.setLinks(new Links());
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ParamsForVnfTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ParamsForVnfTest.java
new file mode 100644
index 0000000000..e0455b0728
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ParamsForVnfTest.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import java.util.HashMap;
+import static org.junit.Assert.*;
+
+public class ParamsForVnfTest {
+
+ ParamsForVnf paramsForVnf = new ParamsForVnf();
+
+ @Test
+ public void getVnfProfileId() {
+ paramsForVnf.getVnfProfileId();
+ }
+
+ @Test
+ public void setVnfProfileId() {
+ paramsForVnf.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getAdditionalParams() {
+ paramsForVnf.getAdditionalParams();
+ }
+
+ @Test
+ public void setAdditionalParams() {
+ paramsForVnf.setAdditionalParams(new HashMap<>());
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/PnfExtCpDataTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/PnfExtCpDataTest.java
new file mode 100644
index 0000000000..c586c7eb65
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/PnfExtCpDataTest.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import static org.junit.Assert.*;
+
+public class PnfExtCpDataTest {
+ PnfExtCpData pnfExtCpData = new PnfExtCpData();
+
+ @Test
+ public void getCpInstanceI16() {
+ pnfExtCpData.getCpInstanceI16();
+ }
+
+ @Test
+ public void setCpInstanceI16() {
+ pnfExtCpData.setCpInstanceI16("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getCpdId() {
+ pnfExtCpData.getCpdId();
+ }
+
+ @Test
+ public void setCpdId() {
+ pnfExtCpData.setCpdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getCpProtocolData() {
+ pnfExtCpData.getCpProtocolData();
+ }
+
+ @Test
+ public void setCpProtocolData() {
+ pnfExtCpData.setCpProtocolData(new List<CpProtocolData>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<CpProtocolData> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(CpProtocolData cpProtocolData) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends CpProtocolData> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends CpProtocolData> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public CpProtocolData get(int index) {
+ return null;
+ }
+
+ @Override
+ public CpProtocolData set(int index, CpProtocolData element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, CpProtocolData element) {
+
+ }
+
+ @Override
+ public CpProtocolData remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<CpProtocolData> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<CpProtocolData> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<CpProtocolData> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ProblemDetailsTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ProblemDetailsTest.java
new file mode 100644
index 0000000000..ddea6cca40
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ProblemDetailsTest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class ProblemDetailsTest {
+ ProblemDetails problemDetails = new ProblemDetails();
+
+ @Test
+ public void getType() {
+ problemDetails.getType();
+ }
+
+ @Test
+ public void setType() {
+ problemDetails.setType("Dummy Type");
+ }
+
+ @Test
+ public void getTitle() {
+ problemDetails.getTitle();
+ }
+
+ @Test
+ public void setTitle() {
+ problemDetails.setTitle("Dummy Title");
+ }
+
+ @Test
+ public void getStatus() {
+ problemDetails.getStatus();
+ }
+
+ @Test
+ public void setStatus() {
+ problemDetails.setStatus(200);
+ }
+
+ @Test
+ public void getDetail() {
+ problemDetails.getDetail();
+ }
+
+ @Test
+ public void setDetail() {
+ problemDetails.setTitle("Dummy Title");
+ }
+
+ @Test
+ public void getInstance() {
+ problemDetails.getInstance();
+ }
+
+ @Test
+ public void setInstance() {
+ problemDetails.setInstance("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResourceChangesTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResourceChangesTest.java
new file mode 100644
index 0000000000..9c4a0295e6
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResourceChangesTest.java
@@ -0,0 +1,773 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import static org.junit.Assert.*;
+
+public class ResourceChangesTest {
+ ResourceChanges resourceChanges = new ResourceChanges();
+
+ @Test
+ public void getAffectedVnfs() {
+ resourceChanges.getAffectedVnfs();
+ }
+
+ @Test
+ public void setAffectedVnfs() {
+ resourceChanges.setAffectedVnfs(new List<AffectedVnf>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<AffectedVnf> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(AffectedVnf affectedVnf) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends AffectedVnf> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends AffectedVnf> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public AffectedVnf get(int index) {
+ return null;
+ }
+
+ @Override
+ public AffectedVnf set(int index, AffectedVnf element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, AffectedVnf element) {
+
+ }
+
+ @Override
+ public AffectedVnf remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<AffectedVnf> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<AffectedVnf> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<AffectedVnf> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+
+ @Test
+ public void getAffectedPnfs() {
+ resourceChanges.getAffectedPnfs();
+ }
+
+ @Test
+ public void setAffectedPnfs() {
+ resourceChanges.setAffectedPnfs(new List<AffectedPnf>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<AffectedPnf> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(AffectedPnf affectedPnf) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends AffectedPnf> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends AffectedPnf> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public AffectedPnf get(int index) {
+ return null;
+ }
+
+ @Override
+ public AffectedPnf set(int index, AffectedPnf element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, AffectedPnf element) {
+
+ }
+
+ @Override
+ public AffectedPnf remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<AffectedPnf> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<AffectedPnf> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<AffectedPnf> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+
+ @Test
+ public void getAffectedVls() {
+ resourceChanges.getAffectedVls();
+ }
+
+ @Test
+ public void setAffectedVls() {
+ resourceChanges.setAffectedVls(new List<AffectedVirtualLink>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<AffectedVirtualLink> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(AffectedVirtualLink affectedVirtualLink) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends AffectedVirtualLink> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends AffectedVirtualLink> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public AffectedVirtualLink get(int index) {
+ return null;
+ }
+
+ @Override
+ public AffectedVirtualLink set(int index, AffectedVirtualLink element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, AffectedVirtualLink element) {
+
+ }
+
+ @Override
+ public AffectedVirtualLink remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<AffectedVirtualLink> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<AffectedVirtualLink> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<AffectedVirtualLink> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+
+ @Test
+ public void getAffectedVnffgs() {
+ resourceChanges.getAffectedVnffgs();
+ }
+
+ @Test
+ public void setAffectedVnffgs() {
+ resourceChanges.setAffectedVnffgs(new List<AffectedVnffg>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<AffectedVnffg> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(AffectedVnffg affectedVnffg) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends AffectedVnffg> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends AffectedVnffg> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public AffectedVnffg get(int index) {
+ return null;
+ }
+
+ @Override
+ public AffectedVnffg set(int index, AffectedVnffg element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, AffectedVnffg element) {
+
+ }
+
+ @Override
+ public AffectedVnffg remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<AffectedVnffg> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<AffectedVnffg> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<AffectedVnffg> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+
+ @Test
+ public void getAffectedNss() {
+ resourceChanges.getAffectedNss();
+ }
+
+ @Test
+ public void setAffectedNss() {
+ resourceChanges.setAffectedNss(new List<AffectedNs>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<AffectedNs> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(AffectedNs affectedNs) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends AffectedNs> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends AffectedNs> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public AffectedNs get(int index) {
+ return null;
+ }
+
+ @Override
+ public AffectedNs set(int index, AffectedNs element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, AffectedNs element) {
+
+ }
+
+ @Override
+ public AffectedNs remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<AffectedNs> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<AffectedNs> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<AffectedNs> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+
+ @Test
+ public void getAffectedSaps() {
+ resourceChanges.getAffectedSaps();
+ }
+
+ @Test
+ public void setAffectedSaps() {
+ resourceChanges.setAffectedSaps(new List<AffectedSap>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<AffectedSap> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(AffectedSap affectedSap) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends AffectedSap> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends AffectedSap> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public AffectedSap get(int index) {
+ return null;
+ }
+
+ @Override
+ public AffectedSap set(int index, AffectedSap element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, AffectedSap element) {
+
+ }
+
+ @Override
+ public AffectedSap remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<AffectedSap> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<AffectedSap> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<AffectedSap> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResourceHandleTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResourceHandleTest.java
new file mode 100644
index 0000000000..6390c5afbd
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResourceHandleTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class ResourceHandleTest {
+ ResourceHandle resourceHandle = new ResourceHandle();
+
+ @Test
+ public void getVimId() {
+ resourceHandle.getVimId();
+ }
+
+ @Test
+ public void setVimId() {
+ resourceHandle.setVimId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getResourceProviderId() {
+ resourceHandle.getResourceProviderId();
+ }
+
+ @Test
+ public void setResourceProviderId() {
+ resourceHandle.setResourceProviderId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getResourceId() {
+ resourceHandle.getResourceId();
+ }
+
+ @Test
+ public void setResourceId() {
+ resourceHandle.setResourceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getVimLevelResourceType() {
+ resourceHandle.getVimLevelResourceType();
+ }
+
+ @Test
+ public void setVimLevelResourceType() {
+ resourceHandle.setVimLevelResourceType("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/SapDataTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/SapDataTest.java
new file mode 100644
index 0000000000..2a455994b8
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/SapDataTest.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import static org.junit.Assert.*;
+
+public class SapDataTest {
+
+ SapData sapData = new SapData();
+
+ @Test
+ public void getSapdId() {
+ sapData.getSapdId();
+ }
+
+ @Test
+ public void setSapdId() {
+ sapData.setSapdId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getSapName() {
+ sapData.getSapName();
+ }
+
+ @Test
+ public void setSapName() {
+ sapData.setSapName("Dummy SapName");
+ }
+
+ @Test
+ public void getDescription() {
+ sapData.getDescription();
+ }
+
+ @Test
+ public void setDescription() {
+ sapData.setDescription("Dummy Description");
+ }
+
+ @Test
+ public void getSapProtocolData() {
+ sapData.getSapProtocolData();
+ }
+
+ @Test
+ public void setSapProtocolData() {
+ sapData.setSapProtocolData(new List<CpProtocolData>() {
+ @Override
+ public int size() {
+ return 0;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<CpProtocolData> iterator() {
+ return null;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[0];
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ return null;
+ }
+
+ @Override
+ public boolean add(CpProtocolData cpProtocolData) {
+ return false;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends CpProtocolData> c) {
+ return false;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends CpProtocolData> c) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ return false;
+ }
+
+ @Override
+ public void clear() {
+
+ }
+
+ @Override
+ public CpProtocolData get(int index) {
+ return null;
+ }
+
+ @Override
+ public CpProtocolData set(int index, CpProtocolData element) {
+ return null;
+ }
+
+ @Override
+ public void add(int index, CpProtocolData element) {
+
+ }
+
+ @Override
+ public CpProtocolData remove(int index) {
+ return null;
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ return 0;
+ }
+
+ @Override
+ public ListIterator<CpProtocolData> listIterator() {
+ return null;
+ }
+
+ @Override
+ public ListIterator<CpProtocolData> listIterator(int index) {
+ return null;
+ }
+
+ @Override
+ public List<CpProtocolData> subList(int fromIndex, int toIndex) {
+ return null;
+ }
+ });
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VnfInstanceDataTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VnfInstanceDataTest.java
new file mode 100644
index 0000000000..b9bdfe3f6e
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VnfInstanceDataTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class VnfInstanceDataTest {
+ VnfInstanceData vnfInstanceData = new VnfInstanceData();
+
+ @Test
+ public void getVnfInstanceId() {
+ vnfInstanceData.getVnfInstanceId();
+ }
+
+ @Test
+ public void setVnfInstanceId() {
+ vnfInstanceData.setVnfInstanceId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getVnfProfileId() {
+ vnfInstanceData.getVnfProfileId();
+ }
+
+ @Test
+ public void setVnfProfileId() {
+ vnfInstanceData.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VnfLocationConstraintTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VnfLocationConstraintTest.java
new file mode 100644
index 0000000000..b8f9b8e3e2
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VnfLocationConstraintTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.model;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class VnfLocationConstraintTest {
+ VnfLocationConstraint vnfLocationConstraint = new VnfLocationConstraint();
+
+ @Test
+ public void getVnfProfileId() {
+ vnfLocationConstraint.getVnfProfileId();
+ }
+
+ @Test
+ public void setVnfProfileId() {
+ vnfLocationConstraint.setVnfProfileId("c9f0a95e-dea0-4698-96e5-5a79bc5a233d");
+ }
+
+ @Test
+ public void getLocationConstraints() {
+ vnfLocationConstraint.getLocationConstraints();
+ }
+
+ @Test
+ public void setLocationConstraints() {
+ vnfLocationConstraint.setLocationConstraints(new LocationConstraint());
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005Test.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005Test.java
new file mode 100644
index 0000000000..799283ddb4
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/VfcManagerSol005Test.java
@@ -0,0 +1,221 @@
+/*
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.adapters.vfc.rest;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.so.adapters.vfc.exceptions.ApplicationException;
+import org.onap.so.adapters.vfc.model.NSResourceInputParameter;
+import org.onap.so.adapters.vfc.model.RestfulResponse;
+import org.onap.so.adapters.vfc.util.JsonUtil;
+import org.onap.so.adapters.vfc.util.RestfulUtil;
+import org.onap.so.db.request.beans.InstanceNfvoMapping;
+import org.onap.so.db.request.beans.OperationStatus;
+import org.onap.so.db.request.beans.ResourceOperationStatus;
+import org.onap.so.db.request.data.repository.InstanceNfvoMappingRepository;
+import org.onap.so.db.request.data.repository.OperationStatusRepository;
+import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
+import org.springframework.test.context.junit4.SpringRunner;
+import java.io.File;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import static org.mockito.Mockito.when;
+
+@RunWith(SpringRunner.class)
+public class VfcManagerSol005Test {
+ @InjectMocks
+ VfcManagerSol005 vfcManagerSol005;
+
+ @Mock
+ InstanceNfvoMappingRepository instanceNfvoMappingRepository;
+
+ @Mock
+ ResourceOperationStatusRepository resourceOperationStatusRepository;
+
+ @Mock
+ OperationStatusRepository operationStatusRepository;
+
+ @Mock
+ RestfulUtil restfulUtil;
+
+ OperationStatus operationStatus = new OperationStatus();
+
+ InstanceNfvoMapping instanceNfvoMapping = new InstanceNfvoMapping();
+ RestfulResponse restfulResponse = new RestfulResponse();
+ RestfulResponse vfcrestfulResponse = new RestfulResponse();
+ NSResourceInputParameter nsResourceInputParameter = new NSResourceInputParameter();
+ ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus();
+
+ @Test
+ public void createNs() throws ApplicationException, Exception {
+ restfulResponse.setStatus(200);
+ ClassLoader classLoader = ClassLoader.getSystemClassLoader();
+
+ File file = new File(classLoader.getResource("json/createNsReq.json").getFile());
+ String content = new String(Files.readAllBytes(file.toPath())).replace("\n", "");
+ nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class);
+ file = new File(classLoader.getResource("json/aainfvoResponse.json").getFile());
+ content = new String(Files.readAllBytes(file.toPath())).replace("\n", "");
+ restfulResponse.setResponseContent(content);
+ // restfulResponse.setResponseContent("{\"nfvoId\":\"6ee79fe2-9579-475a-9bb9-20cf4358a19e\",\"name\":\"external_nfvo\",\"api-root\":\"xyz\",\"vendor\":\"vz\",\"version\":\"v1.0\",\"url\":\"http://sample.com/\",\"userName\":\"admin\",\"password\":\"sacjnasnc\"}");
+ file = new File(classLoader.getResource("json/createNsSol005Response.json").getFile());
+ content = new String(Files.readAllBytes(file.toPath())).replace("\n", "");
+ vfcrestfulResponse.setStatus(202);
+ vfcrestfulResponse.setResponseContent(content);
+ // vfcrestfulResponse.setResponseContent("{\"_links\": {\"heal\": {\"href\": \"\"}, \"instantiate\": {\"href\":
+ // \"\"}, \"nestedNsInstances\": {\"href\": \"\"}, \"scale\": {\"href\": \"\"}, \"self\": {\"href\": \"\"},
+ // \"terminate\": {\"href\": \"\"}, \"update\": {\"href\": \"\"}}, \"additionalAffinityOrAntiAffiniityRule\":
+ // [{\"Scope\": \"\", \"affinityOrAntiAffiinty\": \"\", \"vnfInstanceId\": [], \"vnfProfileId\": [], \"vnfdId\":
+ // []}], \"flavourId\": \"\", \"id\": \"c9f0a95e-dea0-4698-96e5-5a79bc5a233d\", \"nestedNsInstanceId\": [],
+ // \"nsInstanceDescription\": \"\", \"nsInstanceName\": \"\", \"nsScaleStatus\": [{\"nsScaleLevelId\": \"\",
+ // \"nsScalingAspectId\": \"\"}], \"nsState\": \"\", \"nsdId\": \"\", \"nsdInfoId\": \"\", \"pnfInfo\":
+ // [{\"cpInfo\": [{\"cpInstanceId\": \"\", \"cpProtocolData\": {\"ipOverEthernet\": {\"ipAddresses\":
+ // {\"addressRange\": {\"maxAddress\": \"\", \"minAddress\": \"\"}, \"fixedAddresses\": \"\",
+ // \"numDynamicAddresses\": 1, \"subnetId\": \"\", \"type\": \"\"}, \"macAddress\": {}}, \"layerProtocol\":
+ // \"IP_OVER_ETHERNET\"}, \"cpdId\": \"\"}], \"pnfId\": \"\", \"pnfName\": \"\", \"pnfProfileId\": \"\",
+ // \"pnfdId\": \"\", \"pnfdInfoId\": \"\"}], \"sapInfo\": [{\"description\": \"\", \"id\": \"\", \"sapName\":
+ // \"\", \"sapProtocolInfo\": {\"ipOverEthernet\": {\"ipAddresses\": {\"addressRange\": {\"maxAddress\": \"\",
+ // \"minAddress\": \"\"}, \"fixedAddresses\": \"\", \"numDynamicAddresses\": 1, \"subnetId\": \"\", \"type\":
+ // \"\"}, \"macAddress\": \"\"}, \"layerProtocol\": \"IP_OVER_ETHERNET\"}, \"sapdId\": \"\"}],
+ // \"virtualLinkInfo\": [{\"id\": \"\", \"linkPort\": [{\"id\": \"\", \"resourceHandle\": {\"resourceId\": \"\",
+ // \"resourceProviderId\": \"\", \"vimId\": \"\", \"vimLevelResourceType\": \"\"}}], \"nsVirtualLinkDescId\":
+ // \"\", \"resourceHandle\": [{\"resourceId\": \"\", \"resourceProviderId\": \"\", \"vimId\": \"\",
+ // \"vimLevelResourceType\": \"\"}]}], \"vnfInstance\": [{\"vnfInstanceId\": \"\", \"vnfProfileId\": \"\"}],
+ // \"vnffgInfo\": [{\"id\": \"\", \"nfpInfo\": [{\"description\": \"\", \"id\": \"\", \"nfpName\": \"\",
+ // \"nfpRule\": {\"destinationIpAddressPrefix\": \"\", \"destinationPortRange\": \"\", \"dscp\": \"\",
+ // \"etherDestinationAddress\": \"\", \"etherSourceAddress\": \"\", \"etherType\": \"\", \"extendedCriteria\":
+ // [{\"length\": 1, \"startingPoint\": 1, \"value\": \"\"}], \"protocol\": \"\", \"sourceIpAddressPrefix\":
+ // \"\", \"sourcePortRange\": \"\", \"vlanTag\": []}, \"nfpState\": \"\", \"nfpdId\": \"\", \"nscpHandle\":
+ // [{\"nsInstanceId\": \"\", \"nsSapInstanceId\": \"\", \"pnfExtCpInstanceId\": \"\", \"pnfInfoId\": \"\",
+ // \"vnfExtCpInstanceId\": \"\", \"vnfInstanceId\": \"\"}], \"totalCp\": 1}], \"nsCpHandle\":
+ // [{\"nsInstanceId\": \"\", \"nsSapInstanceId\": \"\", \"pnfExtCpInstanceId\": \"\", \"pnfInfoId\": \"\",
+ // \"vnfExtCpInstanceId\": \"\", \"vnfInstanceId\": \"\"}], \"nsVirtualLinkInfoId\": [], \"pnfInfoId\": [],
+ // \"vnfInstanceId\": [], \"vnffgdId\": \"\"}]}");
+
+ resourceOperationStatus.setStatus("processing");
+ resourceOperationStatus.setOperationId(nsResourceInputParameter.getNsOperationKey().getOperationId());
+ resourceOperationStatus.setServiceId(nsResourceInputParameter.getNsOperationKey().getServiceId());
+ resourceOperationStatus
+ .setResourceTemplateUUID(nsResourceInputParameter.getNsOperationKey().getNodeTemplateUUID());
+ when(instanceNfvoMappingRepository.save(instanceNfvoMapping)).thenReturn(instanceNfvoMapping);
+ when(restfulUtil.getNfvoFromAAI("b1bb0ce7-2222-4fa7-95ed-4840d70a1101")).thenReturn(restfulResponse);
+ when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyMap()))
+ .thenReturn(vfcrestfulResponse);
+ when(resourceOperationStatusRepository.save(resourceOperationStatus)).thenReturn(resourceOperationStatus);
+ vfcManagerSol005.createNs(nsResourceInputParameter);
+
+ }
+
+ @Test
+ public void terminateNs() throws Exception {
+ instanceNfvoMapping.setInstanceId("b1bb0ce7-2222-4fa7-95ed-4840d70a1101");
+ instanceNfvoMapping.setPassword("sacjnasnc");
+ instanceNfvoMapping.setUsername("admin");
+ instanceNfvoMapping.setNfvoName("external_nfvo");
+ instanceNfvoMapping.setEndpoint("http://sample.com/");
+ instanceNfvoMapping.setApiRoot("xyz");
+ String nsInstanceId = "c9f0a95e-dea0-4698-96e5-5a79bc5a233d";
+ ClassLoader classLoader = ClassLoader.getSystemClassLoader();
+ File file = new File(classLoader.getResource("json/createNsReq.json").getFile());
+ String content = new String(Files.readAllBytes(file.toPath())).replace("\n", "");
+ nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class);
+ Map<String, String> header = new HashMap<>();
+ header.put("Location", "http://192.168.10.57:5000/ns_lcm_op_ops/12204a12-7da2-4ddf-8c2f-992a1a1acebf");
+ vfcrestfulResponse.setStatus(202);
+ vfcrestfulResponse.setResponseContent(null);
+ vfcrestfulResponse.setRespHeaderMap(header);
+ when(instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId)).thenReturn(instanceNfvoMapping);
+ when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(vfcrestfulResponse);
+ vfcManagerSol005.terminateNs(nsResourceInputParameter.getNsOperationKey(), nsInstanceId);
+ }
+
+ @Test
+ public void getNsProgress() throws Exception {
+ String jobId = "12204a12-7da2-4ddf-8c2f-992a1a1acebf";
+ instanceNfvoMapping.setInstanceId("b1bb0ce7-2222-4fa7-95ed-4840d70a1101");
+ instanceNfvoMapping.setPassword("sacjnasnc");
+ instanceNfvoMapping.setUsername("admin");
+ instanceNfvoMapping.setNfvoName("external_nfvo");
+ instanceNfvoMapping.setEndpoint("http://sample.com/");
+ instanceNfvoMapping.setApiRoot("xyz");
+ instanceNfvoMapping.setJobId(jobId);
+ ClassLoader classLoader = ClassLoader.getSystemClassLoader();
+ File file = new File(classLoader.getResource("json/createNsReq.json").getFile());
+ String content = new String(Files.readAllBytes(file.toPath())).replace("\n", "");
+ nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class);
+ operationStatus.setProgress("40");
+ operationStatus.setServiceId(nsResourceInputParameter.getNsOperationKey().getServiceId());
+ operationStatus.setOperationId(nsResourceInputParameter.getNsOperationKey().getOperationId());
+ ResourceOperationStatus resourceOperationStatus =
+ new ResourceOperationStatus(nsResourceInputParameter.getNsOperationKey().getServiceId(),
+ nsResourceInputParameter.getNsOperationKey().getOperationId(),
+ nsResourceInputParameter.getNsOperationKey().getNodeTemplateUUID());
+ file = new File(classLoader.getResource("json/lcmOperRsp.json").getFile());
+ content = new String(Files.readAllBytes(file.toPath())).replace("\n", "");
+ vfcrestfulResponse.setStatus(202);
+ vfcrestfulResponse.setResponseContent(content);
+ List<ResourceOperationStatus> resourceOperationStatuses = new ArrayList<>();
+ resourceOperationStatuses.add(resourceOperationStatus);
+ when(instanceNfvoMappingRepository.findOneByJobId(jobId)).thenReturn(instanceNfvoMapping);
+ when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(vfcrestfulResponse);
+ when(operationStatusRepository.findOneByServiceIdAndOperationId(
+ nsResourceInputParameter.getNsOperationKey().getServiceId(),
+ nsResourceInputParameter.getNsOperationKey().getOperationId())).thenReturn(operationStatus);
+ when(resourceOperationStatusRepository.findByServiceIdAndOperationId(
+ nsResourceInputParameter.getNsOperationKey().getServiceId(),
+ nsResourceInputParameter.getNsOperationKey().getOperationId())).thenReturn(resourceOperationStatuses);
+ when(operationStatusRepository.save(operationStatus)).thenReturn(operationStatus);
+ vfcManagerSol005.getNsProgress(nsResourceInputParameter.getNsOperationKey(), jobId);
+
+ }
+
+ @Test
+ public void instantiateNs() throws Exception {
+ String nsInstanceId = "c9f0a95e-dea0-4698-96e5-5a79bc5a233d";
+ ClassLoader classLoader = ClassLoader.getSystemClassLoader();
+ File file = new File(classLoader.getResource("json/createNsReq.json").getFile());
+ String content = new String(Files.readAllBytes(file.toPath())).replace("\n", "");
+ nsResourceInputParameter = JsonUtil.unMarshal(content, NSResourceInputParameter.class);
+ instanceNfvoMapping.setInstanceId("b1bb0ce7-2222-4fa7-95ed-4840d70a1101");
+ instanceNfvoMapping.setPassword("sacjnasnc");
+ instanceNfvoMapping.setUsername("admin");
+ instanceNfvoMapping.setNfvoName("external_nfvo");
+ instanceNfvoMapping.setEndpoint("http://sample.com/");
+ instanceNfvoMapping.setApiRoot("xyz");
+ resourceOperationStatus.setStatus("processing");
+ resourceOperationStatus.setOperationId(nsResourceInputParameter.getNsOperationKey().getOperationId());
+ resourceOperationStatus.setServiceId(nsResourceInputParameter.getNsOperationKey().getServiceId());
+ resourceOperationStatus
+ .setResourceTemplateUUID(nsResourceInputParameter.getNsOperationKey().getNodeTemplateUUID());
+ Map<String, String> header = new HashMap<>();
+ header.put("Location", "http://192.168.10.57:5000/ns_lcm_op_ops/12204a12-7da2-4ddf-8c2f-992a1a1acebf");
+ vfcrestfulResponse.setStatus(202);
+ vfcrestfulResponse.setResponseContent(null);
+ vfcrestfulResponse.setRespHeaderMap(header);
+ when(instanceNfvoMappingRepository.findOneByInstanceId(nsInstanceId)).thenReturn(instanceNfvoMapping);
+ when(restfulUtil.send(Mockito.anyString(), Mockito.anyString(), Mockito.anyString()))
+ .thenReturn(vfcrestfulResponse);
+ when(resourceOperationStatusRepository.save(resourceOperationStatus)).thenReturn(resourceOperationStatus);
+ when(instanceNfvoMappingRepository.save(instanceNfvoMapping)).thenReturn(instanceNfvoMapping);
+ vfcManagerSol005.instantiateNs(nsInstanceId, nsResourceInputParameter);
+
+ }
+}
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java
index c388016ab4..4b6baa5cf4 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/util/RestfulUtilTest.java
@@ -22,6 +22,8 @@ package org.onap.so.adapters.vfc.util;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
+import org.apache.http.Header;
+import org.apache.http.message.BasicHeader;
import org.apache.http.StatusLine;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
@@ -59,21 +61,27 @@ public class RestfulUtilTest {
private HttpEntity httpEntity;
private HttpResponse httpResponse;
private StatusLine statusLine;
+ private Header httpResponseHeader;
@Before
public void setUp() {
httpEntity = mock(HttpEntity.class);
httpResponse = mock(HttpResponse.class);
statusLine = mock(StatusLine.class);
+ httpResponseHeader = mock(Header.class);
}
private void sendInit() throws IOException {
+ Header[] headerList = new BasicHeader[2];
+ headerList[0] = new BasicHeader("Content-Type", "application/json");
+ headerList[1] = new BasicHeader("cache-control", "no-cache");
doReturn("https://testHost/").when(restfulUtil).getMsbHost();
when(statusLine.getStatusCode()).thenReturn(HttpStatus.OK.value());
when(httpResponse.getStatusLine()).thenReturn(statusLine);
when(httpResponse.getEntity()).thenReturn(httpEntity);
+ when(httpResponse.getAllHeaders()).thenReturn(headerList);
}
@Test
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/aainfvoResponse.json b/adapters/mso-vfc-adapter/src/test/resources/json/aainfvoResponse.json
new file mode 100644
index 0000000000..35047a9c21
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/aainfvoResponse.json
@@ -0,0 +1,10 @@
+{
+ "nfvoId":"6ee79fe2-9579-475a-9bb9-20cf4358a19e",
+ "name":"external_nfvo",
+ "api-root":"xyz",
+ "vendor":"vz",
+ "version":"v1.0",
+ "url":"http://sample.com/",
+ "userName":"admin",
+ "password":"sacjnasnc"
+} \ No newline at end of file
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json b/adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json
index 047c81081e..aec8ae809d 100644
--- a/adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/createNsReq.json
@@ -1,32 +1,56 @@
{
- "nsServiceName":"vIMS",
- "nsServiceDescription":"vIMS NS",
+ "nsServiceName":"vcpe_e2e_vnf_test2",
+ "nsServiceDescription":"null",
+ "nsServiceModelUUID":"c9f0a95e-dea0-4698-96e5-5a79bc5a233d",
"nsOperationKey":{
- "globalSubscriberId":"9b9f02c0-298b-458a-bc9c-be3692e4f350",
- "serviceType":"service",
- "serviceId":"9b9f02c0-298b-458a-bc9c-be3692e4f351",
- "operationId":"9b9f02c0-298b-458a-bc9c-be3692e4f352",
- "nodeTemplateUUID":"9b9f02c0-298b-458a-bc9c-be3692e4f353"
+ "globalSubscriberId":"Demonstration",
+ "serviceType":"vCPE",
+ "serviceId":"996fadbb-e806-4a19-b0e5-3454ad6ac29e",
+ "operationId":"1f1dd6b2-b027-4008-a9df-3b6c8274fb24",
+ "nodeTemplateUUID":"4d3a835c-29c8-4a63-83a4-50de5f7ffe16"
},
"nsParameters":{
"locationConstraints":[
{
- "vnfProfileId":"zte-CSCF-1.0",
"locationConstraints":{
- "vimId":"1"
- }
+ "vimId":"CloudOwner_regionOne"
+ },
+ "vnfProfileId":"b1bb0ce7-2222-4fa7-95ed-4840d70a1101"
+ },
+ {
+ "locationConstraints":{
+ "vimId":"CloudOwner_regionOne"
+ },
+ "vnfProfileId":"0408f076-e6c0-4c82-9940-272fddbb82de"
+ },
+ {
+ "locationConstraints":{
+ "vimId":"CloudOwner_regionOne"
+ },
+ "vnfProfileId":"b1bb0ce7-2222-4fa7-95ed-4840d70a1100"
+ },
+ {
+ "locationConstraints":{
+ "vimId":"CloudOwner_regionOne"
+ },
+ "vnfProfileId":"b1bb0ce7-2222-4fa7-95ed-4840d70a1102"
+ },
+ {
+ "locationConstraints":{
+ "vimId":"CloudOwner_regionOne"
+ },
+ "vnfProfileId":"3fca3543-07f5-492f-812c-ed462e4f94f4"
}
],
"additionalParamForNs":{
- "externalDataNetworkName":"Flow_out_net",
- "m6000_mng_ip":"192.168.20.2",
- "externalCompanyFtpDataNetworkName":"Flow_out_net",
- "externalPluginManageNetworkName":"plugin_net_2014",
- "externalManageNetworkName":"mng_net_2017",
- "sfc_data_network":"sfc_data_net_2016",
- "NatIpRange":"210.1.1.10-210.1.1.20",
- "location":"4050083f-465f-4838-af1e-47a545222ad0",
- "sdncontroller":"9b9f02c0-298b-458a-bc9c-be3692e4f35e"
+ "orchestrator":"",
+ "nfvo":"b1bb0ce7-2222-4fa7-95ed-4840d70a1101",
+ "nf_naming":"true",
+ "multi_stage_design":"false",
+ "availability_zone_max_count":"1",
+ "xyz":"123",
+ "nsd0_providing_service_invariant_uuid":"12204a12-7da2-4ddf-8c2f-992a1a1acebf",
+ "nsd0_providing_service_uuid":"5791dbeb-19d4-43e8-bf44-5b327ccf6bca"
}
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/createNsSol005Response.json b/adapters/mso-vfc-adapter/src/test/resources/json/createNsSol005Response.json
new file mode 100644
index 0000000000..938969a87f
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/createNsSol005Response.json
@@ -0,0 +1,210 @@
+{
+ "_links":{
+ "heal":{
+ "href":""
+ },
+ "instantiate":{
+ "href":""
+ },
+ "nestedNsInstances":{
+ "href":""
+ },
+ "scale":{
+ "href":""
+ },
+ "self":{
+ "href":""
+ },
+ "terminate":{
+ "href":""
+ },
+ "update":{
+ "href":""
+ }
+ },
+ "additionalAffinityOrAntiAffiniityRule":[
+ {
+ "Scope":"",
+ "affinityOrAntiAffiinty":"",
+ "vnfInstanceId":[
+
+ ],
+ "vnfProfileId":[
+
+ ],
+ "vnfdId":[
+
+ ]
+ }
+ ],
+ "flavourId":"",
+ "id":"c9f0a95e-dea0-4698-96e5-5a79bc5a233d",
+ "nestedNsInstanceId":[
+
+ ],
+ "nsInstanceDescription":"",
+ "nsInstanceName":"",
+ "nsScaleStatus":[
+ {
+ "nsScaleLevelId":"",
+ "nsScalingAspectId":""
+ }
+ ],
+ "nsState":"",
+ "nsdId":"",
+ "nsdInfoId":"",
+ "pnfInfo":[
+ {
+ "cpInfo":[
+ {
+ "cpInstanceId":"",
+ "cpProtocolData":{
+ "ipOverEthernet":{
+ "ipAddresses":{
+ "addressRange":{
+ "maxAddress":"",
+ "minAddress":""
+ },
+ "fixedAddresses":"",
+ "numDynamicAddresses":1,
+ "subnetId":"",
+ "type":""
+ },
+ "macAddress":{
+
+ }
+ },
+ "layerProtocol":"IP_OVER_ETHERNET"
+ },
+ "cpdId":""
+ }
+ ],
+ "pnfId":"",
+ "pnfName":"",
+ "pnfProfileId":"",
+ "pnfdId":"",
+ "pnfdInfoId":""
+ }
+ ],
+ "sapInfo":[
+ {
+ "description":"",
+ "id":"",
+ "sapName":"",
+ "sapProtocolInfo":{
+ "ipOverEthernet":{
+ "ipAddresses":{
+ "addressRange":{
+ "maxAddress":"",
+ "minAddress":""
+ },
+ "fixedAddresses":"",
+ "numDynamicAddresses":1,
+ "subnetId":"",
+ "type":""
+ },
+ "macAddress":""
+ },
+ "layerProtocol":"IP_OVER_ETHERNET"
+ },
+ "sapdId":""
+ }
+ ],
+ "virtualLinkInfo":[
+ {
+ "id":"",
+ "linkPort":[
+ {
+ "id":"",
+ "resourceHandle":{
+ "resourceId":"",
+ "resourceProviderId":"",
+ "vimId":"",
+ "vimLevelResourceType":""
+ }
+ }
+ ],
+ "nsVirtualLinkDescId":"",
+ "resourceHandle":[
+ {
+ "resourceId":"",
+ "resourceProviderId":"",
+ "vimId":"",
+ "vimLevelResourceType":""
+ }
+ ]
+ }
+ ],
+ "vnfInstance":[
+ {
+ "vnfInstanceId":"",
+ "vnfProfileId":""
+ }
+ ],
+ "vnffgInfo":[
+ {
+ "id":"",
+ "nfpInfo":[
+ {
+ "description":"",
+ "id":"",
+ "nfpName":"",
+ "nfpRule":{
+ "destinationIpAddressPrefix":"",
+ "destinationPortRange":"",
+ "dscp":"",
+ "etherDestinationAddress":"",
+ "etherSourceAddress":"",
+ "etherType":"",
+ "extendedCriteria":[
+ {
+ "length":1,
+ "startingPoint":1,
+ "value":""
+ }
+ ],
+ "protocol":"",
+ "sourceIpAddressPrefix":"",
+ "sourcePortRange":"",
+ "vlanTag":[
+
+ ]
+ },
+ "nfpState":"",
+ "nfpdId":"",
+ "nscpHandle":[
+ {
+ "nsInstanceId":"",
+ "nsSapInstanceId":"",
+ "pnfExtCpInstanceId":"",
+ "pnfInfoId":"",
+ "vnfExtCpInstanceId":"",
+ "vnfInstanceId":""
+ }
+ ],
+ "totalCp":1
+ }
+ ],
+ "nsCpHandle":[
+ {
+ "nsInstanceId":"",
+ "nsSapInstanceId":"",
+ "pnfExtCpInstanceId":"",
+ "pnfInfoId":"",
+ "vnfExtCpInstanceId":"",
+ "vnfInstanceId":""
+ }
+ ],
+ "nsVirtualLinkInfoId":[
+
+ ],
+ "pnfInfoId":[
+
+ ],
+ "vnfInstanceId":[
+
+ ],
+ "vnffgdId":""
+ }
+ ]
+} \ No newline at end of file
diff --git a/adapters/mso-vfc-adapter/src/test/resources/json/lcmOperRsp.json b/adapters/mso-vfc-adapter/src/test/resources/json/lcmOperRsp.json
new file mode 100644
index 0000000000..111afc1a7c
--- /dev/null
+++ b/adapters/mso-vfc-adapter/src/test/resources/json/lcmOperRsp.json
@@ -0,0 +1,7 @@
+{
+ "id":"12204a12-7da2-4ddf-8c2f-992a1a1acebf",
+ "lcmOperationType":"INSTANTIATE",
+ "nsInstanceId":"c9f0a95e-dea0-4698-96e5-5a79bc5a233d",
+ "operationState":"PROCESSING",
+ "statusEnteredTime":"Time"
+} \ No newline at end of file
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
index bf293e5f4b..977541cc16 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-vnfm-adapter</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>mso-vnfm-adapter-api</artifactId>
<properties>
@@ -91,6 +91,24 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.basedir}/target/generated-sources/vnfmadapter/src/gen/java/main</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<dependencies>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/ETSI-Catalog-Notification-API.json b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/ETSI-Catalog-Notification-API.json
index 6f9b2c3bbe..6db54435d2 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/ETSI-Catalog-Notification-API.json
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/ETSI-Catalog-Notification-API.json
@@ -6,18 +6,26 @@
"version": "v1"
},
"host": "127.0.0.1:8000",
- "schemes": ["http"],
+ "schemes": [
+ "http"
+ ],
"basePath": "/",
- "consumes": ["application/json"],
- "produces": ["application/json"],
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
"securityDefinitions": {
"Basic": {
"type": "basic"
}
},
- "security": [{
- "Basic": []
- }],
+ "security": [
+ {
+ "Basic": []
+ }
+ ],
"paths": {
"/URI-is-provided-by-the-client-when-creating-the-subscription-VnfPackageChangeNotification": {
"get": {
@@ -35,25 +43,31 @@
}
}
},
- "tags": ["VNF Package Management interface"]
+ "tags": [
+ "VNF Package Management interface"
+ ]
},
"post": {
"operationId": "URI-is-provided-by-the-client-when-creating-the-subscription-VnfPackageChangeNotification_create",
"description": "",
- "parameters": [{
- "name": "data",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/PkgChangeNotification"
+ "parameters": [
+ {
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/PkgChangeNotification"
+ }
}
- }],
+ ],
"responses": {
"204": {
"description": ""
}
},
- "tags": ["VNF Package Management interface"]
+ "tags": [
+ "VNF Package Management interface"
+ ]
},
"parameters": []
},
@@ -73,25 +87,31 @@
}
}
},
- "tags": ["VNF Package Management interface"]
+ "tags": [
+ "VNF Package Management interface"
+ ]
},
"post": {
"operationId": "URI-is-provided-by-the-client-when-creating-the-subscription-VnfPackageOnboardingNotification_create",
"description": "",
- "parameters": [{
- "name": "data",
- "in": "body",
- "required": true,
- "schema": {
- "$ref": "#/definitions/PkgOnboardingNotification"
+ "parameters": [
+ {
+ "name": "data",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/PkgOnboardingNotification"
+ }
}
- }],
+ ],
"responses": {
"204": {
"description": ""
}
},
- "tags": ["VNF Package Management interface"]
+ "tags": [
+ "VNF Package Management interface"
+ ]
},
"parameters": []
}
@@ -100,7 +120,9 @@
"NOTIFICATION_LINKSERIALIZER": {
"title": "Vnfpackage",
"description": "Link to the resource representing the VNF package to which the notified change applies.",
- "required": ["href"],
+ "required": [
+ "href"
+ ],
"type": "object",
"properties": {
"href": {
@@ -125,7 +147,16 @@
}
},
"PkgChangeNotification": {
- "required": ["id", "notificationType", "timeStamp", "subscriptionId", "vnfPkgId", "changeType", "vnfdId", "_links"],
+ "required": [
+ "id",
+ "notificationType",
+ "timeStamp",
+ "subscriptionId",
+ "vnfPkgId",
+ "changeType",
+ "vnfdId",
+ "_links"
+ ],
"type": "object",
"properties": {
"id": {
@@ -138,7 +169,9 @@
"title": "Notificationtype",
"description": "Discriminator for the different notification types.",
"type": "string",
- "enum": ["VnfPackageChangeNotification"]
+ "enum": [
+ "VnfPackageChangeNotification"
+ ]
},
"timeStamp": {
"title": "Timestamp",
@@ -156,19 +189,25 @@
"title": "Vnfpkgid",
"description": "Identifier of the VNF package.",
"type": "string",
- "format": "uuid"
+ "minLength": 1
},
"changeType": {
"title": "Changetype",
"description": "The type of change of the VNF package.",
"type": "string",
- "enum": ["OP_STATE_CHANGE", "PKG_DELETE"]
+ "enum": [
+ "OP_STATE_CHANGE",
+ "PKG_DELETE"
+ ]
},
"operationalState": {
"title": "Operationalstate",
"description": "New operational state of the VNF package.",
"type": "string",
- "enum": ["ENABLED", "DISABLED"]
+ "enum": [
+ "ENABLED",
+ "DISABLED"
+ ]
},
"vnfdId": {
"title": "Vnfdid",
@@ -182,7 +221,15 @@
}
},
"PkgOnboardingNotification": {
- "required": ["id", "notificationType", "subscriptionId", "timeStamp", "vnfPkgId", "vnfdId", "_links"],
+ "required": [
+ "id",
+ "notificationType",
+ "subscriptionId",
+ "timeStamp",
+ "vnfPkgId",
+ "vnfdId",
+ "_links"
+ ],
"type": "object",
"properties": {
"id": {
@@ -195,7 +242,9 @@
"title": "Notificationtype",
"description": "Discriminator for the different notification types.",
"type": "string",
- "enum": ["VnfPackageOnboardingNotification"]
+ "enum": [
+ "VnfPackageOnboardingNotification"
+ ]
},
"subscriptionId": {
"title": "Subscriptionid",
@@ -213,13 +262,13 @@
"title": "Vnfpkgid",
"description": "Identifier of the VNF package.",
"type": "string",
- "format": "uuid"
+ "minLength": 1
},
"vnfdId": {
"title": "Vnfdid",
"description": "This identifier, which is managed by the VNF provider, identifies the VNF package and the VNFD in a globally unique way.",
"type": "string",
- "format": "uuid"
+ "minLength": 1
},
"_links": {
"$ref": "#/definitions/PkgmLinks"
@@ -227,4 +276,4 @@
}
}
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
index 8e2cfd2be4..dacd5d96b6 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-vnfm-adapter</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>mso-vnfm-adapter-ext-clients</artifactId>
<properties>
@@ -132,6 +132,29 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.basedir}/target/generated-sources/etsicatalog/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/sol003-vnf-packagemanagement/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/sol003-vnf-grant/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/sol003-vnf-lcn/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/sol003-vnf-lcm/src/gen/java/main</source>
+
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json
index 3c5ec49b80..35a8c2bd3d 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json
@@ -5,7 +5,7 @@
"description": "\n\nThe `swagger-ui` view can be found [here](/api/catalog/v1/swagger).\nThe `ReDoc` view can be found [here](/api/catalog/v1/redoc).\nThe swagger YAML document can be found [here](/api/catalog/v1/swagger.yaml).\nThe swagger JSON document can be found [here](/api/catalog/v1/swagger.json).",
"version": "v1"
},
- "host": "127.0.0.1:8000",
+ "host": "127.0.0.1:8806",
"schemes": ["http"],
"basePath": "/",
"consumes": ["application/json"],
@@ -2641,7 +2641,7 @@
"inputs": {
"title": "Inputs",
"description": "Inputs",
- "type": "string"
+ "type": "object"
}
}
},
@@ -2652,7 +2652,7 @@
"model": {
"title": "Model",
"description": "Model",
- "type": "string"
+ "type": "object"
}
}
},
@@ -2825,7 +2825,7 @@
"required": ["callbackUri"],
"type": "object",
"properties": {
- "filters": {
+ "filter": {
"$ref": "#/definitions/PkgmNotificationsFilter"
},
"callbackUri": {
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFPackageManagement-API.json b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFPackageManagement-API.json
index 1f4a8ac306..17d81f44c1 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFPackageManagement-API.json
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFPackageManagement-API.json
@@ -1187,8 +1187,14 @@
"DISABLED"
]
},
- "usageState": {
- "description": "- IN_USE: VNF instances instantiated from this VNF package exist. - NOT_IN_USE: No existing VNF instance is instantiated from this VNF package.\n"
+ "usageState":
+ {
+ "description": "- IN_USE: VNF instances instantiated from this VNF package exist. - NOT_IN_USE: No existing VNF instance is instantiated from this VNF package.\n",
+ "type": "string",
+ "enum": [
+ "IN_USE",
+ "NOT_IN_USE"
+ ]
},
"userDefinedData": {
"description": "This type represents a list of key-value pairs. The order of the pairs in the list is not significant. In JSON, a set of key- value pairs is represented as an object. It shall comply with the provisions defined in clause 4 of IETF RFC 7159.\n",
@@ -2024,8 +2030,14 @@
"DISABLED"
]
},
- "usageState": {
- "description": "- IN_USE: VNF instances instantiated from this VNF package exist. - NOT_IN_USE: No existing VNF instance is instantiated from this VNF package.\n"
+ "usageState":
+ {
+ "description": "- IN_USE: VNF instances instantiated from this VNF package exist. - NOT_IN_USE: No existing VNF instance is instantiated from this VNF package.\n",
+ "type": "string",
+ "enum": [
+ "IN_USE",
+ "NOT_IN_USE"
+ ]
},
"userDefinedData": {
"description": "This type represents a list of key-value pairs. The order of the pairs in the list is not significant. In JSON, a set of key- value pairs is represented as an object. It shall comply with the provisions defined in clause 4 of IETF RFC 7159.\n",
@@ -4572,16 +4584,31 @@
"type": "string"
}
},
- "operationalState": {
+ "operationalState":
+ {
"description": "- ENABLED: The VNF package is enabled, i.e. it can be used for instantiation of new VNF instances.\n- DISABLED: The VNF package is disabled, i.e. it cannot be used for further VNF instantiation requests (unless and until the VNF package\n is re-enabled).\n",
- "type": "string",
- "enum": [
- "ENABLED",
- "DISABLED"
- ]
+ "type": "array",
+ "items":
+ {
+ "type": "string",
+ "enum": [
+ "ENABLED",
+ "DISABLED"
+ ]
+ }
},
- "usageState": {
- "description": "- IN_USE: VNF instances instantiated from this VNF package exist. - NOT_IN_USE: No existing VNF instance is instantiated from this VNF package.\n"
+ "usageState":
+ {
+ "description": "- IN_USE: VNF instances instantiated from this VNF package exist. - NOT_IN_USE: No existing VNF instance is instantiated from this VNF package.\n",
+ "type": "array",
+ "items":
+ {
+ "type": "string",
+ "enum": [
+ "IN_USE",
+ "NOT_IN_USE"
+ ]
+ }
}
}
},
@@ -4803,18 +4830,32 @@
"type": "string"
}
},
- "operationalState": {
+ "operationalState":
+ {
"description": "- ENABLED: The VNF package is enabled, i.e. it can be used for instantiation of new VNF instances.\n- DISABLED: The VNF package is disabled, i.e. it cannot be used for further VNF instantiation requests (unless and until the VNF package\n is re-enabled).\n",
- "type": "string",
- "enum": [
- "ENABLED",
- "DISABLED"
- ]
+ "type": "array",
+ "items":
+ {
+ "type": "string",
+ "enum": [
+ "ENABLED",
+ "DISABLED"
+ ]
+ }
},
- "usageState": {
- "description": "- IN_USE: VNF instances instantiated from this VNF package exist. - NOT_IN_USE: No existing VNF instance is instantiated from this VNF package.\n"
- }
- }
+ "usageState":
+ {
+ "description": "- IN_USE: VNF instances instantiated from this VNF package exist. - NOT_IN_USE: No existing VNF instance is instantiated from this VNF package.\n",
+ "type": "array",
+ "items":
+ {
+ "type": "string",
+ "enum": [
+ "IN_USE",
+ "NOT_IN_USE"
+ ]
+ }
+ } }
},
"callbackUri": {
"description": "String formatted according to IETF RFC 3986.\n",
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
index bc491a6fc5..66b1d2e12e 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-vnfm-adapter</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>mso-vnfm-etsi-adapter</artifactId>
<properties>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
index 61d5adf9d8..87e8bb4d57 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
@@ -23,6 +23,8 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.util.ArrayList;
import java.util.Collection;
+import org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003.PkgChangeNotificationConverter;
+import org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003.PkgOnboardingNotificationConverter;
import org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003.VnfPkgInfoConverter;
import org.onap.so.adapters.vnfmadapter.converters.sol003.etsicatalog.PkgmSubscriptionRequestConverter;
import org.onap.so.adapters.vnfmadapter.oauth.OAuth2AccessTokenAdapter;
@@ -46,6 +48,8 @@ public class MessageConverterConfiguration {
final DefaultConversionService service = new DefaultConversionService();
service.addConverter(new VnfPkgInfoConverter());
service.addConverter(new PkgmSubscriptionRequestConverter());
+ service.addConverter(new PkgChangeNotificationConverter());
+ service.addConverter(new PkgOnboardingNotificationConverter());
return service;
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/AbstractPkgNotificationConverter.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/AbstractPkgNotificationConverter.java
new file mode 100644
index 0000000000..e1c43098f8
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/AbstractPkgNotificationConverter.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003;
+
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.notification.model.PkgmLinks;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.notification.model.URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinks;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.notification.model.URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinksVnfPackage;
+
+/**
+ * A base class that can be extended by classes for converting Etsi Catalog Manager Pkg Notification classes. Provides
+ * common methods that will be useful to those classes.
+ *
+ * @author andrew.a.lamb@est.tech
+ */
+abstract public class AbstractPkgNotificationConverter {
+
+ protected URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinks convert(
+ final PkgmLinks pkgmLinks) {
+ final URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinksVnfPackage linksVnfPackage =
+ new URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinksVnfPackage();
+ if (pkgmLinks.getVnfPackage() != null) {
+ linksVnfPackage.setHref(pkgmLinks.getVnfPackage().getHref());
+ }
+
+ final URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinksVnfPackage linksSubscription =
+ new URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinksVnfPackage();
+ if (pkgmLinks.getSubscription() != null) {
+ linksSubscription.setHref(pkgmLinks.getSubscription().getHref());
+ }
+
+ final URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinks links =
+ new URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinks();
+ links.setVnfPackage(linksVnfPackage);
+ links.setSubscription(linksSubscription);
+ return links;
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/PkgChangeNotificationConverter.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/PkgChangeNotificationConverter.java
new file mode 100644
index 0000000000..8c4168632b
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/PkgChangeNotificationConverter.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003;
+
+import static org.slf4j.LoggerFactory.getLogger;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.notification.model.PkgChangeNotification;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.notification.model.VnfPackageChangeNotification;
+import org.slf4j.Logger;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.stereotype.Service;
+
+/**
+ * Converter to convert from an Etsi Catalog Manager {@link PkgChangeNotification} Object to its equivalent SOL003
+ * {@link VnfPackageChangeNotification} Object
+ *
+ * @author andrew.a.lamb@est.tech
+ */
+@Service
+public class PkgChangeNotificationConverter extends AbstractPkgNotificationConverter
+ implements Converter<PkgChangeNotification, VnfPackageChangeNotification> {
+ private static final Logger logger = getLogger(PkgChangeNotificationConverter.class);
+
+ /**
+ * Convert a {@link PkgChangeNotification} Object to an {@link VnfPackageChangeNotification} Object
+ *
+ * @param pkgChangeNotification The PkgChangeNotification Object to Convert
+ * @return The Converted VnfPackageChangeNotification Object
+ */
+ @Override
+ public VnfPackageChangeNotification convert(final PkgChangeNotification pkgChangeNotification) {
+ logger.info("Converting PkgChangeNotification\n{}", pkgChangeNotification.toString());
+ final VnfPackageChangeNotification vnfPackageChangeNotification = new VnfPackageChangeNotification();
+ vnfPackageChangeNotification.setId(pkgChangeNotification.getId());
+
+ if (pkgChangeNotification.getNotificationType() != null) {
+ vnfPackageChangeNotification.setNotificationType(VnfPackageChangeNotification.NotificationTypeEnum
+ .fromValue(pkgChangeNotification.getNotificationType().getValue()));
+ }
+
+ vnfPackageChangeNotification.setSubscriptionId(pkgChangeNotification.getSubscriptionId());
+ vnfPackageChangeNotification.setTimeStamp(pkgChangeNotification.getTimeStamp());
+ vnfPackageChangeNotification.setVnfPkgId(pkgChangeNotification.getVnfPkgId());
+
+ vnfPackageChangeNotification.setVnfdId(pkgChangeNotification.getVnfdId());
+
+ if (pkgChangeNotification.getChangeType() != null) {
+ vnfPackageChangeNotification.setChangeType(VnfPackageChangeNotification.ChangeTypeEnum
+ .fromValue(pkgChangeNotification.getChangeType().getValue()));
+ }
+
+ if (pkgChangeNotification.getOperationalState() != null) {
+ vnfPackageChangeNotification.setOperationalState(VnfPackageChangeNotification.OperationalStateEnum
+ .fromValue(pkgChangeNotification.getOperationalState().getValue()));
+ }
+
+ vnfPackageChangeNotification.setLinks(convert((pkgChangeNotification.getLinks())));
+
+ return vnfPackageChangeNotification;
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/PkgOnboardingNotificationConverter.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/PkgOnboardingNotificationConverter.java
new file mode 100644
index 0000000000..836acb6d36
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/PkgOnboardingNotificationConverter.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003;
+
+import static org.slf4j.LoggerFactory.getLogger;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.notification.model.PkgOnboardingNotification;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.notification.model.VnfPackageOnboardingNotification;
+import org.slf4j.Logger;
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.stereotype.Service;
+
+/**
+ * Converter to convert from an Etsi Catalog Manager {@link PkgOnboardingNotification} Object to its equivalent SOL003
+ * {@link VnfPackageOnboardingNotification} Object
+ *
+ * @author andrew.a.lamb@est.tech
+ */
+@Service
+public class PkgOnboardingNotificationConverter extends AbstractPkgNotificationConverter
+ implements Converter<PkgOnboardingNotification, VnfPackageOnboardingNotification> {
+ private static final Logger logger = getLogger(PkgOnboardingNotificationConverter.class);
+
+ /**
+ * Convert a {@link PkgOnboardingNotification} Object to an {@link VnfPackageOnboardingNotification} Object
+ *
+ * @param pkgOnboardingNotification The PkgOnboardingNotification Object to Convert
+ * @return The Converted VnfPackageOnboardingNotification Object
+ */
+ @Override
+ public VnfPackageOnboardingNotification convert(final PkgOnboardingNotification pkgOnboardingNotification) {
+ logger.info("Converting PkgChangeNotification\n{}", pkgOnboardingNotification.toString());
+ final VnfPackageOnboardingNotification vnfPackageOnboardingNotification =
+ new VnfPackageOnboardingNotification();
+ vnfPackageOnboardingNotification.setId(pkgOnboardingNotification.getId());
+
+ if (pkgOnboardingNotification.getNotificationType() != null) {
+ vnfPackageOnboardingNotification.setNotificationType(VnfPackageOnboardingNotification.NotificationTypeEnum
+ .fromValue(pkgOnboardingNotification.getNotificationType().getValue()));
+ }
+
+ vnfPackageOnboardingNotification.setSubscriptionId(pkgOnboardingNotification.getSubscriptionId());
+ vnfPackageOnboardingNotification.setTimeStamp(pkgOnboardingNotification.getTimeStamp());
+ vnfPackageOnboardingNotification.setVnfPkgId(pkgOnboardingNotification.getVnfPkgId());
+ vnfPackageOnboardingNotification.setVnfdId(pkgOnboardingNotification.getVnfdId());
+
+ vnfPackageOnboardingNotification.setLinks(convert((pkgOnboardingNotification.getLinks())));
+
+ return vnfPackageOnboardingNotification;
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java
index d0fd4c9e7c..caefe71993 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java
@@ -21,16 +21,16 @@
package org.onap.so.adapters.vnfmadapter.converters.sol003.etsicatalog;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.Version;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfProducts;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfProductsProviders;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.PkgmSubscriptionRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilter;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilter.NotificationTypesEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilter.OperationalStateEnum;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilter1;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilter1.NotificationTypesEnum;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilter1.OperationalStateEnum;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilter1.UsageStateEnum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilterVersions;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilterVnfProducts;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilterVnfProductsFromProviders;
@@ -50,19 +50,19 @@ public class PkgmSubscriptionRequestConverter implements
@Override
public org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest convert(
- PkgmSubscriptionRequest pkgmSubscriptionRequest) {
+ final PkgmSubscriptionRequest pkgmSubscriptionRequest) {
final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest =
new org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest();
etsiCatalogManagerSubscriptionRequest
- .setFilters(getPkgmNotificationsFilter(pkgmSubscriptionRequest.getFilter()));
+ .setFilter(getPkgmNotificationsFilter(pkgmSubscriptionRequest.getFilter()));
return etsiCatalogManagerSubscriptionRequest;
}
private org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter getPkgmNotificationsFilter(
- final SubscriptionsFilter sol003SubscriptionsFilter) {
+ final SubscriptionsFilter1 sol003SubscriptionsFilter) {
final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter etsiCatalogManagerFilters =
new org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter();
@@ -81,19 +81,40 @@ public class PkgmSubscriptionRequestConverter implements
etsiCatalogManagerFilters
.setOperationalState(getOperationalState(sol003SubscriptionsFilter.getOperationalState()));
- etsiCatalogManagerFilters.setUsageState(null);
+ etsiCatalogManagerFilters.setUsageState(getUsageState(sol003SubscriptionsFilter.getUsageState()));
return etsiCatalogManagerFilters;
}
- // TODO 'operationalState' in the Sol003 Swagger is type 'OperationalStateEnum'. The ETSI Catalog Manager Swagger
- // 'operationalState' is type 'List<OperationalStateEnum>'. This method needs to be updated once swagger is updated.
+
+ private List<org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.UsageStateEnum> getUsageState(
+ final List<UsageStateEnum> usageStates) {
+ if (usageStates != null) {
+ final List<org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.UsageStateEnum> etsiCatalogUsageStates =
+ new ArrayList<>();
+ usageStates.stream().forEach(state -> {
+ etsiCatalogUsageStates.add(
+ org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.UsageStateEnum
+ .fromValue(state.getValue()));
+ });
+ return etsiCatalogUsageStates;
+ }
+ return Collections.emptyList();
+ }
+
+
private List<org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.OperationalStateEnum> getOperationalState(
- final OperationalStateEnum operationalState) {
- if (operationalState != null) {
- return Arrays.asList(
- org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.OperationalStateEnum
- .fromValue(operationalState.getValue()));
+ final List<OperationalStateEnum> operationalStates) {
+ if (operationalStates != null) {
+ final List<org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.OperationalStateEnum> etsiCatalogOperationalStates =
+ new ArrayList<>();
+ operationalStates.forEach(state -> {
+ etsiCatalogOperationalStates.add(
+ org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.OperationalStateEnum
+ .fromValue(state.getValue()));
+ });
+
+ return etsiCatalogOperationalStates;
}
return Collections.emptyList();
}
@@ -104,6 +125,7 @@ public class PkgmSubscriptionRequestConverter implements
vnfPkgId.forEach(type -> {
etsiCatalogManagerVnfPkgId.add(type);
});
+ return etsiCatalogManagerVnfPkgId;
}
return Collections.emptyList();
}
@@ -114,6 +136,7 @@ public class PkgmSubscriptionRequestConverter implements
vnfdId.forEach(type -> {
etsiCatalogManagerVnfdId.add(type);
});
+ return etsiCatalogManagerVnfdId;
}
return Collections.emptyList();
}
@@ -147,7 +170,7 @@ public class PkgmSubscriptionRequestConverter implements
private List<Version> getVersion(final List<SubscriptionsFilterVersions> sol003FilterVersions) {
if (sol003FilterVersions != null && !sol003FilterVersions.isEmpty()) {
- List<Version> etsiCatalogVersionList = new ArrayList<>();
+ final List<Version> etsiCatalogVersionList = new ArrayList<>();
sol003FilterVersions.forEach(vnfFilterVersion -> {
etsiCatalogVersionList.add(new Version().vnfSoftwareVersion(vnfFilterVersion.getVnfSoftwareVersion())
.vnfdVersions(vnfFilterVersion.getVnfdVersions()));
@@ -161,11 +184,12 @@ public class PkgmSubscriptionRequestConverter implements
final List<NotificationTypesEnum> notificationTypes) {
if (notificationTypes != null && !notificationTypes.isEmpty()) {
- final List<org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.NotificationTypesEnum> etsiCatalogManagerNotificationTypes =
+ final List<org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.NotificationTypesEnum> etsiCatalogNotificationTypes =
new ArrayList<>();
- notificationTypes.forEach(type -> etsiCatalogManagerNotificationTypes.add(
+ notificationTypes.forEach(type -> etsiCatalogNotificationTypes.add(
org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.NotificationTypesEnum
.fromValue(type.getValue())));
+ return etsiCatalogNotificationTypes;
}
return Collections.emptyList();
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java
index e0eed159c2..0dcc49eeac 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java
@@ -21,6 +21,7 @@
package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
import java.util.Optional;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.NsdmSubscription;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscription;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2001;
@@ -81,10 +82,18 @@ public interface EtsiCatalogServiceProvider {
final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest);
/**
+ * Get the Subscription from ETSI Catalog.
+ *
+ * @param subscriptionId Subscription ID
+ * @return The Subscription {@link NsdmSubscription} from ETSI Catalog
+ */
+ Optional<NsdmSubscription> getSubscription(final String subscriptionId);
+
+ /**
* DELETE the SubscriptionRequest Object.
*
* @return A Boolean representing if the delete was successful or not.
*/
- Boolean deleteSubscription(final String subscriptionId);
+ boolean deleteSubscription(final String subscriptionId);
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
index 73ec7053a7..30d084629c 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
@@ -21,11 +21,13 @@
package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
import java.util.Optional;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.NsdmSubscription;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscription;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPkgInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2001;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.EtsiCatalogManagerBadRequestException;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.EtsiCatalogManagerRequestFailureException;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.SubscriptionNotFoundException;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfPkgBadRequestException;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfPkgConflictException;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfPkgNotFoundException;
@@ -204,7 +206,8 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
}
}
- public Boolean deleteSubscription(final String subscriptionId) {
+ @Override
+ public boolean deleteSubscription(final String subscriptionId) {
try {
final ResponseEntity<Void> responseEntity = httpServiceProvider
.deleteHttpRequest(etsiCatalogUrlProvider.getSubscriptionUrl() + "/" + subscriptionId, Void.class);
@@ -216,6 +219,10 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
}
logger.error("Unexpected Status Code Received on deleteSubscription: {}", responseEntity.getStatusCode());
return false;
+ } catch (final HttpResouceNotFoundException resouceNotFoundException) {
+ final String message = "Unable to find subscription in ETSI Catalog Manager using id: " + subscriptionId;
+ logger.error(message);
+ throw new SubscriptionNotFoundException(message);
} catch (final InvalidRestRequestException invalidRestRequestException) {
logger.error("Caught InvalidRestRequestException on deleteSubscription call to ETSI Catalog Manager.",
invalidRestRequestException);
@@ -224,7 +231,27 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
}
}
+ @Override
+ public Optional<NsdmSubscription> getSubscription(final String subscriptionId) {
+ try {
+ final ResponseEntity<NsdmSubscription> responseEntity = httpServiceProvider.getHttpResponse(
+ etsiCatalogUrlProvider.getSubscriptionUrl() + "/" + subscriptionId, NsdmSubscription.class);
+ if (responseEntity.getStatusCode().is2xxSuccessful()) {
+ logger.debug("Found subscription with ID: {} in ETSI Catalog Manager", subscriptionId);
+ return Optional.ofNullable(responseEntity.getBody());
+ }
+ logger.error("Unexpected Status Code Received on getting subscription from ETSI Catalog Manager: {}",
+ responseEntity.getStatusCode());
+ } catch (final HttpResouceNotFoundException resouceNotFoundException) {
+ logger.error("Unable to find subscription in ETSI Catalog Manager using id: {}", subscriptionId);
+ return Optional.empty();
+ } catch (final RestProcessingException | InvalidRestRequestException exception) {
+ logger.error("Unable to query ETSI Catalog Manager for subscription using id: {}", subscriptionId,
+ exception);
+ }
+ throw new EtsiCatalogManagerRequestFailureException("Internal Server Error Occurred.");
+ }
private Optional<byte[]> requestVnfElement(final String vnfPkgId, final String vnfRequestUrl,
final String vnfRequestName) {
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java
new file mode 100644
index 0000000000..86ca59cffe
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+
+import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import java.nio.charset.StandardCharsets;
+import org.apache.commons.codec.binary.Base64;
+import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
+import org.onap.so.configuration.rest.HttpHeadersProvider;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.onap.so.rest.service.HttpRestServiceProviderImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * A base class that can be extended by classes for providing notification services. Provides common methods that will
+ * be useful to those classes.
+ *
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ */
+public abstract class AbstractNotificationServiceProvider {
+
+ @Autowired
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE)
+ private RestTemplate restTemplate;
+
+ protected HttpRestServiceProvider getHttpRestServiceProvider(final HttpHeadersProvider httpHeadersProvider) {
+ final HttpRestServiceProvider httpRestServiceProvider =
+ new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider);
+ return httpRestServiceProvider;
+ }
+
+ protected BasicHttpHeadersProvider getBasicHttpHeadersProviderWithBasicAuth(final String username,
+ final String password) {
+ final byte[] encodedAuth = getBasicAuth(username, password);
+ final String authHeader = "Basic " + new String(encodedAuth);
+ return new BasicHttpHeadersProvider(authHeader);
+ }
+
+ protected byte[] getBasicAuth(final String username, final String password) {
+ final String auth = username + ":" + password;
+ return Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1));
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java
new file mode 100644
index 0000000000..6f9d94e9de
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+
+import static org.slf4j.LoggerFactory.getLogger;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsAuthentication;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsAuthentication.AuthTypeEnum;
+import org.onap.so.configuration.rest.HttpHeadersProvider;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.slf4j.Logger;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+/**
+ * Implementation of a NotificationServiceProvider which supports Basic Authentication
+ *
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ */
+@Service
+public class BasicAuthNotificationServiceProvider extends AbstractNotificationServiceProvider
+ implements NotificationServiceProvider {
+
+ private static final Logger logger = getLogger(BasicAuthNotificationServiceProvider.class);
+
+ @Override
+ public boolean send(final Object notification, final SubscriptionsAuthentication subscriptionsAuthentication,
+ final String callbackUri) {
+ logger.info("Sending notification to uri: {}", callbackUri);
+ final HttpHeadersProvider httpHeadersProvider =
+ getBasicHttpHeadersProviderWithBasicAuth(subscriptionsAuthentication.getParamsBasic().getUserName(),
+ subscriptionsAuthentication.getParamsBasic().getPassword());
+ final HttpRestServiceProvider httpRestServiceProvider = getHttpRestServiceProvider(httpHeadersProvider);
+
+ final ResponseEntity<Void> responseEntity =
+ httpRestServiceProvider.postHttpRequest(notification, callbackUri, Void.class);
+ if (responseEntity.getStatusCode().is2xxSuccessful()) {
+ logger.info("Notification sent successfully.");
+ return true;
+ }
+
+ logger.error("Failed to send notification.");
+ return false;
+ }
+
+ @Override
+ public AuthTypeEnum getAuthType() {
+ return AuthTypeEnum.BASIC;
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationManager.java
new file mode 100644
index 0000000000..c1051d1c9d
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationManager.java
@@ -0,0 +1,137 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+
+import static org.slf4j.LoggerFactory.getLogger;
+import java.util.List;
+import java.util.Optional;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.notification.model.PkgChangeNotification;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.notification.model.PkgOnboardingNotification;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.PkgmSubscriptionRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsAuthentication;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsAuthentication.AuthTypeEnum;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.notification.model.VnfPackageChangeNotification;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.notification.model.VnfPackageOnboardingNotification;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.AuthenticationTypeNotSupportedException;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.ConversionFailedException;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.NotificationTypeNotSupportedException;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.SubscriptionNotFoundException;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.convert.ConversionService;
+import org.springframework.stereotype.Service;
+
+/**
+ * Manages package management subscription notifications to the VNFMs
+ *
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ *
+ */
+@Service
+public class NotificationManager {
+
+ private static final Logger logger = getLogger(NotificationManager.class);
+ private final ConversionService conversionService;
+ private final SubscriptionManager subscriptionManager;
+ private final NotificationServiceProviderFactory notificationServiceProviderFactory;
+
+ @Autowired
+ public NotificationManager(final SubscriptionManager subscriptionManager, final ConversionService conversionService,
+ final NotificationServiceProviderFactory notificationServiceProviderFactory) {
+ this.subscriptionManager = subscriptionManager;
+ this.conversionService = conversionService;
+ this.notificationServiceProviderFactory = notificationServiceProviderFactory;
+ }
+
+ /**
+ * Process a subscription notification. Checks for a subscription request stored in the adapter and if there is, it
+ * sends the notification to the subscribed vnfm.
+ *
+ * @param notification the notification to send to the vnfm
+ * @param subscriptionId the id of the subscription request
+ * @return true if the notification is successfully sent
+ */
+ public boolean processSubscriptionNotification(final Object notification, final String subscriptionId) {
+ final Optional<PkgmSubscriptionRequest> optionalSubscription =
+ subscriptionManager.getSubscriptionRequest(subscriptionId);
+ if (optionalSubscription.isPresent()) {
+ final PkgmSubscriptionRequest subscriptionRequest = optionalSubscription.get();
+ return notifyVnfm(subscriptionRequest, notification);
+ }
+ final String errorMessage = "No subscription found with subscriptionId " + subscriptionId
+ + ". Unable to forward notification to subscriber.";
+ logger.error(errorMessage);
+ throw new SubscriptionNotFoundException(errorMessage);
+ }
+
+ private boolean notifyVnfm(final PkgmSubscriptionRequest subscriptionRequest, final Object notification) {
+ if (!(notification instanceof PkgOnboardingNotification) && !(notification instanceof PkgChangeNotification)) {
+ final String errorMessage =
+ "An error occurred. Notification type not supported for: " + notification.getClass();
+ logger.error(errorMessage);
+ throw new NotificationTypeNotSupportedException(errorMessage);
+ }
+
+ final SubscriptionsAuthentication subscriptionsAuthentication = subscriptionRequest.getAuthentication();
+ final AuthTypeEnum authType = getAuthType(subscriptionsAuthentication.getAuthType());
+ final NotificationServiceProvider sender = notificationServiceProviderFactory.getNotificationSender(authType);
+
+ final Object vnfmNotificationObject = convertEtsiCatalogNotification(notification);
+
+ if (sender.send(vnfmNotificationObject, subscriptionsAuthentication, subscriptionRequest.getCallbackUri())) {
+ logger.info("Notification delivered successfully {}", notification);
+ return true;
+ }
+
+ logger.error("Failed to deliver notification.");
+ return false;
+ }
+
+ private SubscriptionsAuthentication.AuthTypeEnum getAuthType(final List<AuthTypeEnum> authTypes) {
+ if (authTypes.contains(SubscriptionsAuthentication.AuthTypeEnum.TLS_CERT)) {
+ return SubscriptionsAuthentication.AuthTypeEnum.TLS_CERT;
+ }
+ if (authTypes.contains(SubscriptionsAuthentication.AuthTypeEnum.OAUTH2_CLIENT_CREDENTIALS)) {
+ return SubscriptionsAuthentication.AuthTypeEnum.OAUTH2_CLIENT_CREDENTIALS;
+ }
+ if (authTypes.contains(SubscriptionsAuthentication.AuthTypeEnum.BASIC)) {
+ return SubscriptionsAuthentication.AuthTypeEnum.BASIC;
+ }
+ final String errorMessage =
+ "An error occurred. No supported authentication type provided in subscription request.";
+ logger.error(errorMessage);
+ throw new AuthenticationTypeNotSupportedException(errorMessage);
+ }
+
+ private Object convertEtsiCatalogNotification(final Object etsiCatalogNotification) {
+ logger.info("Converting notification:\n {}", etsiCatalogNotification);
+ if (conversionService.canConvert(etsiCatalogNotification.getClass(), VnfPackageOnboardingNotification.class)) {
+ return conversionService.convert(etsiCatalogNotification, VnfPackageOnboardingNotification.class);
+ } else if (conversionService.canConvert(etsiCatalogNotification.getClass(),
+ VnfPackageChangeNotification.class)) {
+ return conversionService.convert(etsiCatalogNotification, VnfPackageChangeNotification.class);
+ }
+ final String errorMessage = "An error occurred. Unable to convert provided notification object.";
+ logger.error(errorMessage + "\n" + etsiCatalogNotification);
+ throw new ConversionFailedException(errorMessage);
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationServiceProvider.java
new file mode 100644
index 0000000000..2be80eec75
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationServiceProvider.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsAuthentication;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsAuthentication.AuthTypeEnum;
+
+/**
+ * Interface which lays out requirements for a Notification Service Provider
+ *
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ */
+public interface NotificationServiceProvider {
+
+ /**
+ * Method to send a notification to a uri, given the subscription authentication
+ *
+ * @param notification The notification to send
+ * @param subscriptionsAuthentication Object containing the authentication details
+ * @param callbackUri The uri to send the notification to
+ * @return true if notification is delivered successfully, otherwise false
+ */
+ boolean send(final Object notification, final SubscriptionsAuthentication subscriptionsAuthentication,
+ final String callbackUri);
+
+ /**
+ * Method to get the supported authorization type of the service provider
+ *
+ * @return the supported AuthTypeEnum
+ */
+ AuthTypeEnum getAuthType();
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationServiceProviderFactory.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationServiceProviderFactory.java
new file mode 100644
index 0000000000..ab67afed82
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationServiceProviderFactory.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+
+import static org.slf4j.LoggerFactory.getLogger;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsAuthentication.AuthTypeEnum;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.AuthenticationTypeNotSupportedException;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * Factory to provide a notification services
+ *
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ */
+@Component
+public class NotificationServiceProviderFactory {
+
+ private static final Logger logger = getLogger(NotificationServiceProviderFactory.class);
+ private static final Map<AuthTypeEnum, NotificationServiceProvider> CACHE = new HashMap<>();
+
+ @Autowired
+ public NotificationServiceProviderFactory(final List<NotificationServiceProvider> services) {
+ for (final NotificationServiceProvider notificationServiceProvider : services) {
+ logger.debug("Adding {} of type {} to cache", notificationServiceProvider.getClass().getCanonicalName(),
+ notificationServiceProvider.getAuthType());
+ CACHE.put(notificationServiceProvider.getAuthType(), notificationServiceProvider);
+ }
+ }
+
+ /**
+ * Get a notification service for a given authorization type
+ *
+ * @param type the type of authentication required
+ * @return the notification service
+ */
+ public NotificationServiceProvider getNotificationSender(final AuthTypeEnum type) {
+ final NotificationServiceProvider service = CACHE.get(type);
+ if (service == null) {
+ throw new AuthenticationTypeNotSupportedException("Unknown type: " + type);
+ }
+ return service;
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java
new file mode 100644
index 0000000000..496fb083cf
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+
+import static org.slf4j.LoggerFactory.getLogger;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsAuthentication;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsAuthentication.AuthTypeEnum;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.InternalServerErrorException;
+import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
+import org.onap.so.configuration.rest.HttpHeadersProvider;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.slf4j.Logger;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ *
+ */
+@Service
+public class OAuthNotificationServiceProvider extends AbstractNotificationServiceProvider
+ implements NotificationServiceProvider {
+
+ private static final Logger logger = getLogger(OAuthNotificationServiceProvider.class);
+
+ @Override
+ public boolean send(final Object notification, final SubscriptionsAuthentication subscriptionsAuthentication,
+ final String callbackUri) {
+ logger.info("Sending notification to uri: {}", callbackUri);
+ final String token = getAccessToken(subscriptionsAuthentication);
+
+ if (token == null) {
+ return false;
+ }
+
+ final HttpHeadersProvider httpHeadersProvider = getHttpHeadersProvider(token);
+ final HttpRestServiceProvider httpRestServiceProvider = getHttpRestServiceProvider(httpHeadersProvider);
+ final ResponseEntity<Void> responseEntity =
+ httpRestServiceProvider.postHttpRequest(notification, callbackUri, Void.class);
+ if (responseEntity.getStatusCode().is2xxSuccessful()) {
+ logger.info("Notification sent successfully.");
+ return true;
+ }
+
+ logger.error("Failed to send notification.");
+ return false;
+ }
+
+ @Override
+ public AuthTypeEnum getAuthType() {
+ return AuthTypeEnum.OAUTH2_CLIENT_CREDENTIALS;
+ }
+
+ private BasicHttpHeadersProvider getHttpHeadersProvider(final String token) {
+ final String authHeader = "Bearer " + token;
+ return new BasicHttpHeadersProvider(authHeader);
+ }
+
+ private String getAccessToken(final SubscriptionsAuthentication subscriptionsAuthentication) {
+ logger.info("Requesting Access Token.");
+
+ final String tokenEndpoint = subscriptionsAuthentication.getParamsOauth2ClientCredentials().getTokenEndpoint();
+
+ final HttpHeadersProvider httpHeadersProvider = getBasicHttpHeadersProviderWithBasicAuth(
+ subscriptionsAuthentication.getParamsOauth2ClientCredentials().getClientId(),
+ subscriptionsAuthentication.getParamsOauth2ClientCredentials().getClientPassword());
+
+ final HttpRestServiceProvider httpRestServiceProvider = getHttpRestServiceProvider(httpHeadersProvider);
+ final ResponseEntity<OAuthTokenResponse> responseEntity =
+ httpRestServiceProvider.postHttpRequest(null, tokenEndpoint, OAuthTokenResponse.class);
+ if (responseEntity.getStatusCode().is2xxSuccessful()) {
+ if (responseEntity.getBody() != null) {
+ logger.info("Returning Access Token.");
+ return responseEntity.getBody().getAccessToken();
+ }
+ }
+
+ final String errorMessage = "An error occurred. Unable to retrieve OAuth Token from VNFM for notification.";
+ logger.error(errorMessage);
+ throw new InternalServerErrorException(errorMessage);
+ }
+
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthTokenResponse.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthTokenResponse.java
new file mode 100644
index 0000000000..146641cc7c
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthTokenResponse.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+
+import java.io.Serializable;
+import javax.xml.bind.annotation.XmlElement;
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ */
+public class OAuthTokenResponse implements Serializable {
+
+ private static final long serialVersionUID = -6455742984985959926L;
+
+ @XmlElement(name = "access_token")
+ @SerializedName("access_token")
+ private String accessToken;
+
+ /**
+ * Get the Accees Token
+ *
+ * @return the Access Token
+ */
+ public String getAccessToken() {
+ return accessToken;
+ }
+
+ /**
+ * Set the Access Token
+ *
+ * @param accessToken
+ */
+ public void setAccessToken(final String accessToken) {
+ this.accessToken = accessToken;
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
index efe747deae..a23eb6c3e3 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
@@ -32,19 +32,20 @@ import java.util.Optional;
import org.onap.so.adapters.vnfmadapter.Constants;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.BasicAuth;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.NsdmSubscription;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscription;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2002;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse201;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.PkgmSubscriptionRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsLinks;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesLinksSelf;
import org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement.cache.PackageManagementCacheServiceProvider;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.ConversionFailedException;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.InternalServerErrorException;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.SubscriptionRequestConversionException;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.SubscriptionNotFoundException;
import org.onap.so.utils.CryptoUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.core.convert.ConversionException;
import org.springframework.core.convert.ConversionService;
import org.springframework.stereotype.Service;
@@ -65,7 +66,6 @@ public class SubscriptionManager {
private final String msoKeyString;
private final String vnfmAdapterAuth;
-
@Autowired
public SubscriptionManager(final PackageManagementCacheServiceProvider packageManagementCacheServiceProvider,
final ConversionService conversionService, final EtsiCatalogServiceProvider etsiCatalogServiceProvider,
@@ -80,7 +80,7 @@ public class SubscriptionManager {
this.msoKeyString = msoKeyString;
}
- public Optional<InlineResponse2002> createSubscription(final PkgmSubscriptionRequest pkgmSubscriptionRequest)
+ public Optional<InlineResponse201> createSubscription(final PkgmSubscriptionRequest pkgmSubscriptionRequest)
throws GeneralSecurityException {
final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest =
@@ -90,32 +90,44 @@ public class SubscriptionManager {
etsiCatalogServiceProvider.postSubscription(etsiCatalogManagerSubscriptionRequest);
if (optionalEtsiCatalogManagerSubscription.isPresent()) {
- PkgmSubscription etsiCatalogManagerSubscription = optionalEtsiCatalogManagerSubscription.get();
+ final PkgmSubscription etsiCatalogManagerSubscription = optionalEtsiCatalogManagerSubscription.get();
logger.debug("postPkgmSubscriptionRequest Response SubscriptionId: {}",
Objects.requireNonNull(etsiCatalogManagerSubscription.getId()));
final String subscriptionId = etsiCatalogManagerSubscription.getId();
packageManagementCacheServiceProvider.addSubscription(subscriptionId, pkgmSubscriptionRequest);
- final InlineResponse2002 response2002 = new InlineResponse2002();
- response2002.setId(subscriptionId);
- response2002.setFilter(pkgmSubscriptionRequest.getFilter());
- response2002.setCallbackUri(getSubscriptionUri(subscriptionId).toString());
- response2002.setLinks(new SubscriptionsLinks()
+ final InlineResponse201 response = new InlineResponse201();
+ response.setId(subscriptionId);
+ response.setFilter(pkgmSubscriptionRequest.getFilter());
+ response.setCallbackUri(getSubscriptionUri(subscriptionId).toString());
+ response.setLinks(new SubscriptionsLinks()
.self(new VnfPackagesLinksSelf().href(getSubscriptionUri(subscriptionId).toString())));
- return Optional.of(response2002);
+ return Optional.of(response);
}
throw new InternalServerErrorException(
"Received empty response from POST to ETSI Catalog Manager Subscription Endpoint.");
}
-
public Optional<String> getSubscriptionId(final PkgmSubscriptionRequest pkgmSubscriptionRequest) {
return packageManagementCacheServiceProvider.getSubscriptionId(pkgmSubscriptionRequest);
}
- public Optional<InlineResponse2002> getSubscription(final String subscriptionId) {
+ public Optional<InlineResponse201> getSubscription(final String subscriptionId) {
+
+ logger.debug("Checking if subscrition with id: {} exists in ETSI Catalog Manager", subscriptionId);
+ final Optional<NsdmSubscription> etsiCatalogSubscriptionOption =
+ etsiCatalogServiceProvider.getSubscription(subscriptionId);
+
+ if (!etsiCatalogSubscriptionOption.isPresent()) {
+ logger.debug("Unable to find subscription in ETSI Catalog Manager using id: {}", subscriptionId);
+ if (packageManagementCacheServiceProvider.getSubscription(subscriptionId).isPresent()) {
+ logger.debug("will remove subcription with id: {} from local cache", subscriptionId);
+ packageManagementCacheServiceProvider.deleteSubscription(subscriptionId);
+ }
+ }
+
final Optional<PkgmSubscriptionRequest> optional =
packageManagementCacheServiceProvider.getSubscription(subscriptionId);
if (optional.isPresent()) {
@@ -125,17 +137,29 @@ public class SubscriptionManager {
return Optional.empty();
}
- public List<InlineResponse2002> getSubscriptions() {
+ public List<InlineResponse201> getSubscriptions() {
final Map<String, PkgmSubscriptionRequest> subscriptions =
packageManagementCacheServiceProvider.getSubscriptions();
- final List<InlineResponse2002> response = new ArrayList<>();
- subscriptions.forEach((key, value) -> response.add(getInlineResponse2002(key, value)));
+ final List<InlineResponse201> response = new ArrayList<>();
+ subscriptions.forEach((key, value) -> {
+ final Optional<InlineResponse201> optional = getSubscription(key);
+ if (optional.isPresent()) {
+ response.add(optional.get());
+ }
+ });
return response;
}
public boolean deleteSubscription(final String subscriptionId) {
- if (getSubscription(subscriptionId).isPresent()) {
- if (etsiCatalogServiceProvider.deleteSubscription(subscriptionId)) {
+ if (packageManagementCacheServiceProvider.getSubscription(subscriptionId).isPresent()) {
+ try {
+ if (etsiCatalogServiceProvider.deleteSubscription(subscriptionId)) {
+ return packageManagementCacheServiceProvider.deleteSubscription(subscriptionId);
+ }
+ } catch (final SubscriptionNotFoundException subscriptionNotFoundException) {
+ logger.error(
+ "Unable to find subscription in ETSI Catalog Manager using id: {} will delete it from local cache",
+ subscriptionId);
return packageManagementCacheServiceProvider.deleteSubscription(subscriptionId);
}
}
@@ -147,23 +171,27 @@ public class SubscriptionManager {
vnfmAdapterEndpoint + Constants.PACKAGE_MANAGEMENT_BASE_URL + "/subscriptions/" + subscriptionId);
}
- private InlineResponse2002 getInlineResponse2002(final String id, final PkgmSubscriptionRequest subscription) {
- return new InlineResponse2002().id(id).filter(subscription.getFilter())
+ public Optional<PkgmSubscriptionRequest> getSubscriptionRequest(final String subscriptionId) {
+ return packageManagementCacheServiceProvider.getSubscription(subscriptionId);
+ }
+
+ private InlineResponse201 getInlineResponse2002(final String id, final PkgmSubscriptionRequest subscription) {
+ return new InlineResponse201().id(id).filter(subscription.getFilter())
.callbackUri(subscription.getCallbackUri());
}
private org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest buildEtsiCatalogManagerPkgmSubscriptionRequest(
- PkgmSubscriptionRequest pkgmSubscriptionRequest) throws GeneralSecurityException {
+ final PkgmSubscriptionRequest pkgmSubscriptionRequest) throws GeneralSecurityException {
final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest;
try {
etsiCatalogManagerSubscriptionRequest = conversionService.convert(pkgmSubscriptionRequest,
org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest.class);
- } catch (ConversionException conversionException) {
+ } catch (final org.springframework.core.convert.ConversionException conversionException) {
logger.error(conversionException.getMessage());
- throw new SubscriptionRequestConversionException(
+ throw new ConversionFailedException(
"Could not convert Sol003 PkgmSubscriptionRequest to ETSI-Catalog Manager PkgmSubscriptionRequest");
- } catch (Exception exception) {
+ } catch (final Exception exception) {
logger.error(exception.getMessage());
throw new InternalServerErrorException(
"Could not convert Sol003 PkgmSubscriptionRequest to ETSI-Catalog Manager PkgmSubscriptionRequest");
@@ -182,7 +210,7 @@ public class SubscriptionManager {
.addAuthTypeItem(BASIC).paramsBasic(new BasicAuth().userName(username).password(password)));
return etsiCatalogManagerSubscriptionRequest;
}
- throw new SubscriptionRequestConversionException(
+ throw new ConversionFailedException(
"Failed to convert Sol003 PkgmSubscriptionRequest to ETSI-Catalog Manager PkgmSubscriptionRequest");
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/TlsNotificationServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/TlsNotificationServiceProvider.java
new file mode 100644
index 0000000000..c9babbd345
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/TlsNotificationServiceProvider.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+
+import static org.slf4j.LoggerFactory.getLogger;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsAuthentication;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsAuthentication.AuthTypeEnum;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.AuthenticationTypeNotSupportedException;
+import org.slf4j.Logger;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ */
+@Service
+public class TlsNotificationServiceProvider extends AbstractNotificationServiceProvider
+ implements NotificationServiceProvider {
+
+ private static final Logger logger = getLogger(TlsNotificationServiceProvider.class);
+
+ @Override
+ public boolean send(final Object notification, final SubscriptionsAuthentication subscriptionsAuthentication,
+ final String callbackUri) {
+ final String errorMessage = "An error occurred. Authentication type "
+ + subscriptionsAuthentication.getAuthType().toString() + " not currently supported.";
+ logger.error(errorMessage);
+ throw new AuthenticationTypeNotSupportedException(errorMessage);
+ }
+
+
+ @Override
+ public AuthTypeEnum getAuthType() {
+ return AuthTypeEnum.TLS_CERT;
+ }
+
+
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java
index b4004b083d..a97f04bcc8 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java
@@ -22,28 +22,110 @@ package org.onap.so.adapters.vnfmadapter.rest;
import static org.onap.so.adapters.vnfmadapter.Constants.ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL;
import static org.slf4j.LoggerFactory.getLogger;
+import java.util.AbstractMap;
+import java.util.Map.Entry;
import javax.ws.rs.core.MediaType;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.notification.model.PkgChangeNotification;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.notification.model.PkgOnboardingNotification;
+import org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement.NotificationManager;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.InternalServerErrorException;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.NotificationTypeNotSupportedException;
import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
/**
* This controller handles the ETSI Subscription Notification Endpoints.
*
* @author Ronan Kenny (ronan.kenny@est.tech)
* @author Gareth Roper (gareth.roper@est.tech)
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
*/
@Controller
@RequestMapping(value = ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL)
public class EtsiSubscriptionNotificationController {
private static final Logger logger = getLogger(EtsiSubscriptionNotificationController.class);
+ private final NotificationManager notificationManager;
+ private final Gson gson;
+
+ @Autowired
+ public EtsiSubscriptionNotificationController(final NotificationManager notificationManager) {
+ this.notificationManager = notificationManager;
+ this.gson = new GsonBuilder().create();
+ }
@GetMapping(value = "/notification")
public ResponseEntity<Void> testSubscriptionNotificationEndPoint() {
logger.debug("Testing Notification Endpoint");
return ResponseEntity.noContent().build();
}
+
+ /**
+ * POST notification on to subscriber.
+ *
+ * @param notification The notification to send.
+ * @return Response Code: 204 No Content if Successful, ProblemDetails Object if not.
+ */
+ @PostMapping(value = "/notification", consumes = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON)
+ public ResponseEntity<?> postSubscriptionNotification(@RequestBody final String notification) {
+ logger.info("Posting subscription notification \n{}", notification);
+
+ final Entry<String, Object> notificationObject = getNotificationObject(notification);
+ if (notificationManager.processSubscriptionNotification(notificationObject.getValue(),
+ notificationObject.getKey())) {
+ logger.info("Notification Delivered Successfully");
+ return ResponseEntity.noContent().build();
+ }
+ final String errorMessage = "An error occurred. Sending of notification to VNFM failed.";
+ logger.error(errorMessage);
+ throw new InternalServerErrorException(errorMessage);
+ }
+
+ private Entry<String, Object> getNotificationObject(final String notification) {
+ final String notificationType = getNotificationType(notification);
+ if (PkgOnboardingNotification.NotificationTypeEnum.VNFPACKAGEONBOARDINGNOTIFICATION.getValue()
+ .equals(notificationType)) {
+ final PkgOnboardingNotification pkgOnboardingNotification =
+ gson.fromJson(notification, PkgOnboardingNotification.class);
+ logger.info("Onboarding notification received:\n{}", pkgOnboardingNotification);
+ return new AbstractMap.SimpleEntry<>(pkgOnboardingNotification.getSubscriptionId(),
+ pkgOnboardingNotification);
+ }
+ if (PkgChangeNotification.NotificationTypeEnum.VNFPACKAGECHANGENOTIFICATION.getValue()
+ .equals(notificationType)) {
+ final PkgChangeNotification pkgChangeNotification =
+ gson.fromJson(notification, PkgChangeNotification.class);
+ logger.info("Change notification received:\n{}", pkgChangeNotification);
+ return new AbstractMap.SimpleEntry<>(pkgChangeNotification.getSubscriptionId(), pkgChangeNotification);
+
+ }
+
+ final String errorMessage = "An error occurred. Notification type not supported for: " + notificationType;
+ logger.error(errorMessage);
+ throw new NotificationTypeNotSupportedException(errorMessage);
+
+ }
+
+ private String getNotificationType(final String notification) {
+ try {
+ final JsonParser parser = new JsonParser();
+ final JsonObject element = (JsonObject) parser.parse(notification);
+ return element.get("notificationType").getAsString();
+ } catch (final Exception e) {
+ logger.error("An error occurred processing notificiation: {}", e.getMessage());
+ }
+ throw new NotificationTypeNotSupportedException(
+ "Unable to parse notification type in object \n" + notification);
+ }
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java
index 3ead98fce2..21b20b0134 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java
@@ -50,8 +50,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
@RequestMapping(value = BASE_URL, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
public class Sol003GrantController {
- private static final String SEPARATOR = "_";
- private static final String VIM_TYPE = "OPENSTACK";
private static final Logger logger = LoggerFactory.getLogger(Sol003GrantController.class);
public final AaiServiceProvider aaiServiceProvider;
public final AaiHelper aaiHelper;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java
index cce7241757..f1d20c65ef 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java
@@ -109,19 +109,19 @@ public class Sol003PackageManagementController {
*/
@GetMapping(value = "/vnf_packages/{vnfPkgId}/vnfd",
produces = {MediaType.TEXT_PLAIN, APPLICATION_ZIP, MediaType.APPLICATION_JSON})
- public ResponseEntity<byte[]> getVnfPackageVnfd(@PathVariable("vnfPkgId") final String vnfPkgId) {
+ public ResponseEntity<?> getVnfPackageVnfd(@PathVariable("vnfPkgId") final String vnfPkgId) {
logger.info(LOG_REQUEST_RECEIVED, "getVnfPackageVnfd Endpoint Invoked with VNF Package ID: ", vnfPkgId);
final Optional<byte[]> response = etsiCatalogServiceProvider.getVnfPackageVnfd(vnfPkgId);
if (response.isPresent()) {
logger.info(LOG_REQUEST_RECEIVED, "getVnfPackageVnfd Response: ", HttpStatus.OK);
- return new ResponseEntity(response.get(), HttpStatus.OK);
+ return new ResponseEntity<>(response.get(), HttpStatus.OK);
}
final String errorMessage = "An error occurred, a null response was received by the\n"
+ " Sol003PackageManagementController from the EtsiCatalogManager using the GET \"vnfd\" \n"
+ "endpoint.";
logger.error(errorMessage);
- return new ResponseEntity(new ProblemDetails().detail(errorMessage), HttpStatus.INTERNAL_SERVER_ERROR);
+ return new ResponseEntity<>(new ProblemDetails().detail(errorMessage), HttpStatus.INTERNAL_SERVER_ERROR);
}
/**
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java
index 6db3797f9b..515e317496 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java
@@ -28,7 +28,7 @@ import java.util.List;
import java.util.Optional;
import javax.ws.rs.core.MediaType;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.ProblemDetails;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2002;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse201;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.PkgmSubscriptionRequest;
import org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement.SubscriptionManager;
import org.slf4j.Logger;
@@ -92,15 +92,15 @@ public class Sol003PackageManagementSubscriptionController {
}
logger.debug("No duplicate Subscription exists, continuing with POST.");
- final Optional<InlineResponse2002> optionalInlineResponse2002 =
+ final Optional<InlineResponse201> optionalInlineResponse =
subscriptionManager.createSubscription(pkgmSubscriptionRequest);
- if (optionalInlineResponse2002.isPresent()) {
- InlineResponse2002 inlineResponse2002 = optionalInlineResponse2002.get();
- final URI subscriptionUri = subscriptionManager.getSubscriptionUri(inlineResponse2002.getId());
+ if (optionalInlineResponse.isPresent()) {
+ InlineResponse201 inlineResponse = optionalInlineResponse.get();
+ final URI subscriptionUri = subscriptionManager.getSubscriptionUri(inlineResponse.getId());
final HttpHeaders headers = createLocationHeader(subscriptionUri);
logger.debug("Sending response with uri {} ", subscriptionUri);
- return new ResponseEntity<>(inlineResponse2002, headers, HttpStatus.CREATED);
+ return new ResponseEntity<>(inlineResponse, headers, HttpStatus.CREATED);
}
final String errorMessage = "A null response was received during the postSubscriptionRequest call.";
logger.error(errorMessage);
@@ -113,9 +113,9 @@ public class Sol003PackageManagementSubscriptionController {
* @return All of the current active subscriptions. Object: List<InlineResponse2002> Response Code: 200 OK
*/
@GetMapping(value = "/subscriptions")
- public ResponseEntity<List<InlineResponse2002>> getSubscriptions() {
+ public ResponseEntity<List<InlineResponse201>> getSubscriptions() {
logger.info(LOG_REQUEST_RECEIVED, " getSubscriptions.");
- List<InlineResponse2002> subscriptionsList = subscriptionManager.getSubscriptions();
+ List<InlineResponse201> subscriptionsList = subscriptionManager.getSubscriptions();
return new ResponseEntity<>(subscriptionsList, HttpStatus.OK);
}
@@ -128,7 +128,7 @@ public class Sol003PackageManagementSubscriptionController {
@GetMapping(value = "/subscriptions/{subscriptionId}")
public ResponseEntity<?> getSubscription(@PathVariable("subscriptionId") final String subscriptionId) {
logger.info(LOG_REQUEST_RECEIVED, " Getting Subscription: ", subscriptionId);
- final Optional<InlineResponse2002> optional = subscriptionManager.getSubscription(subscriptionId);
+ final Optional<InlineResponse201> optional = subscriptionManager.getSubscription(subscriptionId);
if (optional.isPresent()) {
logger.debug("Return subscription with id {} and body {}", subscriptionId, optional);
return new ResponseEntity<>(optional.get(), HttpStatus.OK);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/AuthenticationTypeNotSupportedException.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/AuthenticationTypeNotSupportedException.java
new file mode 100644
index 0000000000..303420f1e8
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/AuthenticationTypeNotSupportedException.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.ResponseStatus;
+
+/**
+ * Exception for an unsupported authentication type
+ *
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ */
+@ResponseStatus(code = HttpStatus.INTERNAL_SERVER_ERROR)
+public class AuthenticationTypeNotSupportedException extends RuntimeException {
+
+ private static final long serialVersionUID = 2939423208362066902L;
+
+ public AuthenticationTypeNotSupportedException(final String message) {
+ super(message);
+ }
+
+ @Override
+ public synchronized Throwable fillInStackTrace() {
+ return this;
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/SubscriptionRequestConversionException.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/ConversionFailedException.java
index daa544f928..e19a53d1dc 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/SubscriptionRequestConversionException.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/ConversionFailedException.java
@@ -23,16 +23,17 @@ import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
/**
- * Exception for an ETSI Catalog Manager Request Failure
+ * Exception for Conversion Failures
*
- * @author gareth.roper@est.tech
+ * @author Gareth Roper (gareth.roper@est.tech)
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
*/
@ResponseStatus(code = HttpStatus.INTERNAL_SERVER_ERROR)
-public class SubscriptionRequestConversionException extends RuntimeException {
+public class ConversionFailedException extends RuntimeException {
private static final long serialVersionUID = 45898561453196895L;
- public SubscriptionRequestConversionException(final String message) {
+ public ConversionFailedException(final String message) {
super(message);
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/EtsiSubscriptionNotificationControllerExceptionHandler.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/EtsiSubscriptionNotificationControllerExceptionHandler.java
new file mode 100644
index 0000000000..e8e1ce35b9
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/EtsiSubscriptionNotificationControllerExceptionHandler.java
@@ -0,0 +1,112 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+
+import static org.slf4j.LoggerFactory.getLogger;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.ProblemDetails;
+import org.onap.so.adapters.vnfmadapter.rest.EtsiSubscriptionNotificationController;
+import org.onap.so.rest.exceptions.HttpResouceNotFoundException;
+import org.onap.so.rest.exceptions.InvalidRestRequestException;
+import org.onap.so.rest.exceptions.RestProcessingException;
+import org.slf4j.Logger;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+
+/**
+ * Exception Handler for the Etsi Subscription Notification Controller {@link EtsiSubscriptionNotificationController
+ * EtsiSubscriptionNotificationController}
+ *
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ */
+@ControllerAdvice(assignableTypes = EtsiSubscriptionNotificationController.class)
+public class EtsiSubscriptionNotificationControllerExceptionHandler {
+
+ private static final Logger logger = getLogger(EtsiSubscriptionNotificationControllerExceptionHandler.class);
+
+ @ExceptionHandler(InvalidRestRequestException.class)
+ public ResponseEntity<ProblemDetails> handleInvalidRestRequestException(
+ final InvalidRestRequestException invalidRestRequestException) {
+ final String errorMessage = "An error occurred. Sending of notification to VNFM failed with response: "
+ + HttpStatus.BAD_REQUEST + ".\n" + invalidRestRequestException.getMessage();
+ logger.error(errorMessage);
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new ProblemDetails().detail(errorMessage));
+ }
+
+ @ExceptionHandler(HttpResouceNotFoundException.class)
+ public ResponseEntity<ProblemDetails> handleHttpResourceNotFoundException(
+ final HttpResouceNotFoundException httpResourceNotFoundException) {
+ final String errorMessage = "An error occurred. Sending of notification to VNFM failed with response: "
+ + HttpStatus.NOT_FOUND + ".\n" + httpResourceNotFoundException.getMessage();
+ logger.error(errorMessage);
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new ProblemDetails().detail(errorMessage));
+ }
+
+ @ExceptionHandler(RestProcessingException.class)
+ public ResponseEntity<ProblemDetails> handleRestProcessingException(
+ final RestProcessingException restProcessingException) {
+ final String errorMessage = "An error occurred. Sending of notification to VNFM failed with response: "
+ + restProcessingException.getStatusCode() + ".\n" + restProcessingException.getMessage();
+ logger.error(errorMessage);
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new ProblemDetails().detail(errorMessage));
+ }
+
+ @ExceptionHandler(InternalServerErrorException.class)
+ public ResponseEntity<ProblemDetails> handleInternalServerErrorException(
+ final InternalServerErrorException internalServerErrorException) {
+ logger.error(internalServerErrorException.getMessage());
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
+ .body(new ProblemDetails().detail(internalServerErrorException.getMessage()));
+ }
+
+ @ExceptionHandler(AuthenticationTypeNotSupportedException.class)
+ public ResponseEntity<ProblemDetails> handleAuthenticationTypeNotSupportedException(
+ final AuthenticationTypeNotSupportedException authenticationTypeNotSupportedException) {
+ logger.error(authenticationTypeNotSupportedException.getMessage());
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
+ .body(new ProblemDetails().detail(authenticationTypeNotSupportedException.getMessage()));
+ }
+
+ @ExceptionHandler(ConversionFailedException.class)
+ public ResponseEntity<ProblemDetails> handleConversionFailedException(
+ final ConversionFailedException conversionFailedException) {
+ logger.error(conversionFailedException.getMessage());
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
+ .body(new ProblemDetails().detail(conversionFailedException.getMessage()));
+ }
+
+ @ExceptionHandler(NotificationTypeNotSupportedException.class)
+ public ResponseEntity<ProblemDetails> handleNotificationTypeNotSupportedException(
+ final NotificationTypeNotSupportedException notificationTypeNotSupportedException) {
+ logger.error(notificationTypeNotSupportedException.getMessage());
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
+ .body(new ProblemDetails().detail(notificationTypeNotSupportedException.getMessage()));
+ }
+
+ @ExceptionHandler(SubscriptionNotFoundException.class)
+ public ResponseEntity<ProblemDetails> handleSubscriptionNotFoundException(
+ final SubscriptionNotFoundException subscriptionNotFoundException) {
+ logger.error(subscriptionNotFoundException.getMessage());
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
+ .body(new ProblemDetails().detail(subscriptionNotFoundException.getMessage()));
+ }
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/NotificationTypeNotSupportedException.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/NotificationTypeNotSupportedException.java
new file mode 100644
index 0000000000..dcc98864aa
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/NotificationTypeNotSupportedException.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.ResponseStatus;
+
+/**
+ * Exception for an unsupported notification type
+ *
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ */
+@ResponseStatus(code = HttpStatus.INTERNAL_SERVER_ERROR)
+public class NotificationTypeNotSupportedException extends RuntimeException {
+
+ private static final long serialVersionUID = 2939423208362066902L;
+
+ public NotificationTypeNotSupportedException(final String message) {
+ super(message);
+ }
+
+ @Override
+ public synchronized Throwable fillInStackTrace() {
+ return this;
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/Sol003PackageManagementControllerExceptionHandler.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/Sol003PackageManagementControllerExceptionHandler.java
index da8b0cbff2..8091f35da6 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/Sol003PackageManagementControllerExceptionHandler.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/Sol003PackageManagementControllerExceptionHandler.java
@@ -22,10 +22,6 @@ package org.onap.so.adapters.vnfmadapter.rest.exceptions;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.ProblemDetails;
import org.onap.so.adapters.vnfmadapter.rest.Sol003PackageManagementController;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.EtsiCatalogManagerRequestFailureException;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfPkgBadRequestException;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfPkgConflictException;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfPkgNotFoundException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
@@ -64,11 +60,11 @@ public class Sol003PackageManagementControllerExceptionHandler {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(problemDetails);
}
- @ExceptionHandler(SubscriptionRequestConversionException.class)
- public ResponseEntity<ProblemDetails> handleSubscriptionRequestConversionException(
- final SubscriptionRequestConversionException subscriptionRequestConversionException) {
+ @ExceptionHandler(ConversionFailedException.class)
+ public ResponseEntity<ProblemDetails> handleConversionFailedException(
+ final ConversionFailedException conversionFailedException) {
final ProblemDetails problemDetails = new ProblemDetails();
- problemDetails.setDetail(subscriptionRequestConversionException.getMessage());
+ problemDetails.setDetail(conversionFailedException.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(problemDetails);
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java
new file mode 100644
index 0000000000..322251e753
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java
@@ -0,0 +1,595 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.rest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.onap.so.adapters.vnfmadapter.Constants.ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL;
+import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import static org.springframework.test.annotation.DirtiesContext.ClassMode.BEFORE_CLASS;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.*;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.vnfmadapter.Constants;
+import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.ProblemDetails;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.notification.model.NOTIFICATIONLINKSERIALIZER;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.notification.model.PkgChangeNotification;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.notification.model.PkgOnboardingNotification;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.notification.model.PkgmLinks;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.PkgmSubscriptionRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsAuthentication;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsAuthenticationParamsBasic;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsAuthenticationParamsOauth2ClientCredentials;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.notification.model.VnfPackageChangeNotification;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.notification.model.VnfPackageOnboardingNotification;
+import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.cache.Cache;
+import org.springframework.cache.CacheManager;
+import org.springframework.http.*;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.client.MockRestServiceServer;
+import org.springframework.web.client.RestTemplate;
+import org.threeten.bp.LocalDateTime;
+import org.threeten.bp.OffsetDateTime;
+import org.threeten.bp.ZoneOffset;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+
+/**
+ * @author Andrew Lamb (andrew.a.lamb@est.tech)
+ *
+ */
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+@DirtiesContext(classMode = BEFORE_CLASS)
+public class EtsiSubscriptionNotificationControllerTest {
+
+ @LocalServerPort
+ private int port;
+
+ private static final URI CALLBACK_URI = URI.create("http://test_callback_uri/notification");
+ private static final String TOKEN_ENDPOINT = "http://test_token_endpoint_uri/";
+ private static final String TOKEN = "dXNlcm5hbWU6cGFzc3dvcmQ=......";
+ private static final String JSON_TOKEN = "{\"access_token\":\"" + TOKEN + "\"}";
+ private static final String LOCALHOST_URL = "http://localhost:";
+ private static final String NOTIFICATION_BASE_URL =
+ ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL + "/notification";
+ private static final String USERNAME = "username";
+ private static final String PASSWORD = "password";
+ private static final String EXPECTED_BASIC_AUTHORIZATION = "Basic dXNlcm5hbWU6cGFzc3dvcmQ=";
+ private static final String EXPECTED_OAUTH_AUTHORIZATION = "Bearer " + TOKEN;
+ private static final String NOTIFICATION_ID = "NOTIFICATION_ID";
+ private static final String SUBSCRIPTION_ID = "SUBSCRIPTION_ID";
+ private static final OffsetDateTime TIMESTAMP =
+ OffsetDateTime.of(LocalDateTime.of(2020, 1, 1, 1, 1, 1, 1), ZoneOffset.ofHours(1));
+ private static final String VNFPKG_ID = UUID.randomUUID().toString();
+ private static final String VNFD_ID = UUID.randomUUID().toString();
+
+ private BasicHttpHeadersProvider basicHttpHeadersProvider;
+ private final Gson gson = new GsonBuilder().create();;
+
+ @Autowired
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE)
+ private RestTemplate restTemplate;
+ private MockRestServiceServer mockRestServer;
+
+ @Autowired
+ private TestRestTemplate testRestTemplate;
+
+ @Autowired
+ private CacheManager cacheServiceProvider;
+ private Cache cache;
+
+ @Before
+ public void setUp() {
+ mockRestServer = MockRestServiceServer.bindTo(restTemplate).build();
+ basicHttpHeadersProvider = new BasicHttpHeadersProvider();
+ cache = cacheServiceProvider.getCache(Constants.PACKAGE_MANAGEMENT_SUBSCRIPTION_CACHE);
+ cache.clear();
+ }
+
+ @After
+ public void tearDown() {
+ cache.clear();
+ }
+
+ @Test
+ public void testSubscriptionNotificationEndPoint_ReturnsNoContent() {
+ final ResponseEntity<?> response = sendHttpGet(NOTIFICATION_BASE_URL);
+ assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode());
+ }
+
+ @Test
+ public void testOnboardingNotificationSentOnToVnfmCallbackUri_SubscriptionRequestInCache_Success() {
+ final PkgmSubscriptionRequest subscriptionRequest =
+ buildPkgmSubscriptionRequest(SubscriptionsAuthentication.AuthTypeEnum.BASIC);
+ cache.put(SUBSCRIPTION_ID, subscriptionRequest);
+ final PkgOnboardingNotification notification = buildPkgOnboardingNotification();
+ final String notificationString = gson.toJson(notification);
+
+ mockRestServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
+ .andExpect(jsonPath("$.id").value(NOTIFICATION_ID))
+ .andExpect(jsonPath("$.notificationType")
+ .value(VnfPackageOnboardingNotification.NotificationTypeEnum.VNFPACKAGEONBOARDINGNOTIFICATION
+ .toString()))
+ .andExpect(jsonPath("$.subscriptionId").value(SUBSCRIPTION_ID))
+ .andExpect(jsonPath("$.timeStamp").value(TIMESTAMP.toString()))
+ .andExpect(jsonPath("$.vnfPkgId").value(VNFPKG_ID.toString()))
+ .andExpect(jsonPath("$.vnfdId").value(VNFD_ID.toString()))
+ .andExpect(jsonPath("$._links").value(buildPkgmLinks()))
+ .andExpect(header("Authorization", EXPECTED_BASIC_AUTHORIZATION)).andRespond(withSuccess());
+
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode());
+ }
+
+ @Test
+ public void testOnboardingNotificationNotSentOnToVnfmCallbackUri_SubscriptionRequestNotInCache_Fail() {
+ final PkgOnboardingNotification notification = buildPkgOnboardingNotification();
+ final String notificationString = gson.toJson(notification);
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+ assertTrue(response.getBody() instanceof ProblemDetails);
+
+ final ProblemDetails problemDetails = (ProblemDetails) response.getBody();
+ final String errorMessage = "No subscription found with subscriptionId " + SUBSCRIPTION_ID
+ + ". Unable to forward notification to subscriber.";
+
+ assertEquals(errorMessage, problemDetails.getDetail());
+ }
+
+ @Test
+ public void testOnboardingNotificationSentOnToVnfmCallbackUri_BadRequestResponseFromCallbackUri_Fail() {
+ final PkgmSubscriptionRequest subscriptionRequest =
+ buildPkgmSubscriptionRequest(SubscriptionsAuthentication.AuthTypeEnum.BASIC);
+ cache.put(SUBSCRIPTION_ID, subscriptionRequest);
+ final PkgOnboardingNotification notification = buildPkgOnboardingNotification();
+ final String notificationString = gson.toJson(notification);
+
+ mockRestServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
+ .andRespond(withStatus(HttpStatus.BAD_REQUEST));
+
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+ assertTrue(response.getBody() instanceof ProblemDetails);
+
+ final ProblemDetails problemDetails = (ProblemDetails) response.getBody();
+ final String errorMessage = "An error occurred. Sending of notification to VNFM failed with response: "
+ + HttpStatus.BAD_REQUEST + ".\n" + "No result found for given url: " + CALLBACK_URI;
+
+ assertEquals(errorMessage, problemDetails.getDetail());
+ }
+
+ @Test
+ public void testOnboardingNotificationSentOnToVnfmCallbackUri_301MovedPermanentlyResponseFromCallbackUri_Fail() {
+ final PkgmSubscriptionRequest subscriptionRequest =
+ buildPkgmSubscriptionRequest(SubscriptionsAuthentication.AuthTypeEnum.BASIC);
+ cache.put(SUBSCRIPTION_ID, subscriptionRequest);
+ final PkgOnboardingNotification notification = buildPkgOnboardingNotification();
+ final String notificationString = gson.toJson(notification);
+
+ mockRestServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
+ .andRespond(withStatus(HttpStatus.MOVED_PERMANENTLY));
+
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+ assertTrue(response.getBody() instanceof ProblemDetails);
+
+ final ProblemDetails problemDetails = (ProblemDetails) response.getBody();
+ final String errorMessage = "An error occurred. Sending of notification to VNFM failed.";
+
+ assertEquals(errorMessage, problemDetails.getDetail());
+ }
+
+ @Test
+ public void testOnboardingNotificationSentOnToVnfmCallbackUri_NotFoundResponseFromCallbackUri_Fail() {
+ final PkgmSubscriptionRequest subscriptionRequest =
+ buildPkgmSubscriptionRequest(SubscriptionsAuthentication.AuthTypeEnum.BASIC);
+ cache.put(SUBSCRIPTION_ID, subscriptionRequest);
+ final PkgOnboardingNotification notification = buildPkgOnboardingNotification();
+ final String notificationString = gson.toJson(notification);
+
+ mockRestServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
+ .andRespond(withStatus(HttpStatus.NOT_FOUND));
+
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+ assertTrue(response.getBody() instanceof ProblemDetails);
+
+ final ProblemDetails problemDetails = (ProblemDetails) response.getBody();
+ final String errorMessage = "An error occurred. Sending of notification to VNFM failed with response: "
+ + HttpStatus.NOT_FOUND + ".\n" + "No result found for given url: " + CALLBACK_URI;
+
+ assertEquals(errorMessage, problemDetails.getDetail());
+ }
+
+ @Test
+ public void testOnboardingNotificationSentOnToVnfmCallbackUri_InternalServerErrorResponseFromCallbackUri_Fail() {
+ final PkgmSubscriptionRequest subscriptionRequest =
+ buildPkgmSubscriptionRequest(SubscriptionsAuthentication.AuthTypeEnum.BASIC);
+ cache.put(SUBSCRIPTION_ID, subscriptionRequest);
+ final PkgOnboardingNotification notification = buildPkgOnboardingNotification();
+ final String notificationString = gson.toJson(notification);
+
+ mockRestServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
+ .andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR));
+
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+ assertTrue(response.getBody() instanceof ProblemDetails);
+
+ final ProblemDetails problemDetails = (ProblemDetails) response.getBody();
+ final String errorMessage = "An error occurred. Sending of notification to VNFM failed with response: "
+ + HttpStatus.INTERNAL_SERVER_ERROR.value() + ".\n" + "Unable to invoke HTTP POST using URL: "
+ + CALLBACK_URI;
+
+ assertEquals(errorMessage, problemDetails.getDetail());
+ }
+
+ @Test
+ public void testChangeNotificationSentOnToVnfmCallbackUri_SubscriptionRequestInCache_Success() {
+ final PkgmSubscriptionRequest subscriptionRequest =
+ buildPkgmSubscriptionRequest(SubscriptionsAuthentication.AuthTypeEnum.BASIC);
+ cache.put(SUBSCRIPTION_ID, subscriptionRequest);
+ final PkgChangeNotification notification = buildPkgChangeNotification();
+ final String notificationString = gson.toJson(notification);
+
+ mockRestServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
+ .andExpect(jsonPath("$.id").value(NOTIFICATION_ID))
+ .andExpect(jsonPath("$.notificationType").value(
+ VnfPackageChangeNotification.NotificationTypeEnum.VNFPACKAGECHANGENOTIFICATION.toString()))
+ .andExpect(jsonPath("$.subscriptionId").value(SUBSCRIPTION_ID))
+ .andExpect(jsonPath("$.timeStamp").value(TIMESTAMP.toString()))
+ .andExpect(jsonPath("$.vnfPkgId").value(VNFPKG_ID.toString()))
+ .andExpect(jsonPath("$.vnfdId").value(VNFD_ID.toString()))
+ .andExpect(
+ jsonPath("$.changeType").value(PkgChangeNotification.ChangeTypeEnum.OP_STATE_CHANGE.toString()))
+ .andExpect(jsonPath("$.operationalState")
+ .value(PkgChangeNotification.OperationalStateEnum.ENABLED.toString()))
+ .andExpect(jsonPath("$._links").value(buildPkgmLinks()))
+ .andExpect(header("Authorization", EXPECTED_BASIC_AUTHORIZATION)).andRespond(withSuccess());
+
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode());
+ }
+
+ @Test
+ public void testChangeNotificationNotSentOnToVnfmCallbackUri_SubscriptionRequestNotInCache_Fail() {
+ final PkgChangeNotification notification = buildPkgChangeNotification();
+ final String notificationString = gson.toJson(notification);
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+ assertTrue(response.getBody() instanceof ProblemDetails);
+
+ final ProblemDetails problemDetails = (ProblemDetails) response.getBody();
+ final String errorMessage = "No subscription found with subscriptionId " + SUBSCRIPTION_ID
+ + ". Unable to forward notification to subscriber.";
+
+ assertEquals(errorMessage, problemDetails.getDetail());
+ }
+
+ @Test
+ public void testChangeNotificationSentOnToVnfmCallbackUri_BadRequestResponseFromCallbackUri_Fail() {
+ final PkgmSubscriptionRequest subscriptionRequest =
+ buildPkgmSubscriptionRequest(SubscriptionsAuthentication.AuthTypeEnum.BASIC);
+ cache.put(SUBSCRIPTION_ID, subscriptionRequest);
+ final PkgChangeNotification notification = buildPkgChangeNotification();
+ final String notificationString = gson.toJson(notification);
+
+ mockRestServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
+ .andRespond(withStatus(HttpStatus.BAD_REQUEST));
+
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+ assertTrue(response.getBody() instanceof ProblemDetails);
+
+ final ProblemDetails problemDetails = (ProblemDetails) response.getBody();
+ final String errorMessage = "An error occurred. Sending of notification to VNFM failed with response: "
+ + HttpStatus.BAD_REQUEST + ".\n" + "No result found for given url: " + CALLBACK_URI;
+
+ assertEquals(errorMessage, problemDetails.getDetail());
+ }
+
+ @Test
+ public void testChangeNotificationSentOnToVnfmCallbackUri_NotFoundResponseFromCallbackUri_Fail() {
+ final PkgmSubscriptionRequest subscriptionRequest =
+ buildPkgmSubscriptionRequest(SubscriptionsAuthentication.AuthTypeEnum.BASIC);
+ cache.put(SUBSCRIPTION_ID, subscriptionRequest);
+ final PkgChangeNotification notification = buildPkgChangeNotification();
+ final String notificationString = gson.toJson(notification);
+
+ mockRestServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
+ .andRespond(withStatus(HttpStatus.NOT_FOUND));
+
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+ assertTrue(response.getBody() instanceof ProblemDetails);
+
+ final ProblemDetails problemDetails = (ProblemDetails) response.getBody();
+ final String errorMessage = "An error occurred. Sending of notification to VNFM failed with response: "
+ + HttpStatus.NOT_FOUND + ".\n" + "No result found for given url: " + CALLBACK_URI;
+
+ assertEquals(errorMessage, problemDetails.getDetail());
+ }
+
+ @Test
+ public void testChangeNotificationSentOnToVnfmCallbackUri_InternalServerErrorResponseFromCallbackUri_Fail() {
+ final PkgmSubscriptionRequest subscriptionRequest =
+ buildPkgmSubscriptionRequest(SubscriptionsAuthentication.AuthTypeEnum.BASIC);
+ cache.put(SUBSCRIPTION_ID, subscriptionRequest);
+ final PkgChangeNotification notification = buildPkgChangeNotification();
+ final String notificationString = gson.toJson(notification);
+
+ mockRestServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
+ .andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR));
+
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+ assertTrue(response.getBody() instanceof ProblemDetails);
+
+ final ProblemDetails problemDetails = (ProblemDetails) response.getBody();
+ final String errorMessage = "An error occurred. Sending of notification to VNFM failed with response: "
+ + HttpStatus.INTERNAL_SERVER_ERROR.value() + ".\n" + "Unable to invoke HTTP POST using URL: "
+ + CALLBACK_URI;
+
+ assertEquals(errorMessage, problemDetails.getDetail());
+ }
+
+ @Test
+ public void testNotificationSentOnToVnfm_BasicAuthUserPasswordAuthorized_Success() {
+ final PkgmSubscriptionRequest subscriptionRequest =
+ buildPkgmSubscriptionRequest(SubscriptionsAuthentication.AuthTypeEnum.BASIC);
+ cache.put(SUBSCRIPTION_ID, subscriptionRequest);
+ final PkgOnboardingNotification notification = buildPkgOnboardingNotification();
+ final String notificationString = gson.toJson(notification);
+
+ mockRestServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
+ .andExpect(jsonPath("$.id").value(NOTIFICATION_ID))
+ .andExpect(jsonPath("$.notificationType")
+ .value(VnfPackageOnboardingNotification.NotificationTypeEnum.VNFPACKAGEONBOARDINGNOTIFICATION
+ .toString()))
+ .andExpect(jsonPath("$.subscriptionId").value(SUBSCRIPTION_ID))
+ .andExpect(jsonPath("$.timeStamp").value(TIMESTAMP.toString()))
+ .andExpect(jsonPath("$.vnfPkgId").value(VNFPKG_ID.toString()))
+ .andExpect(jsonPath("$.vnfdId").value(VNFD_ID.toString()))
+ .andExpect(jsonPath("$._links").value(buildPkgmLinks()))
+ .andExpect(header("Authorization", EXPECTED_BASIC_AUTHORIZATION)).andRespond(withSuccess());
+
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode());
+ }
+
+ @Test
+ public void testNotificationSentOnToVnfm_BasicAuthUserPasswordNotAuthorized_Fail() {
+ final PkgmSubscriptionRequest subscriptionRequest =
+ buildPkgmSubscriptionRequest(SubscriptionsAuthentication.AuthTypeEnum.BASIC);
+ cache.put(SUBSCRIPTION_ID, subscriptionRequest);
+ final PkgChangeNotification notification = buildPkgChangeNotification();
+ final String notificationString = gson.toJson(notification);
+
+ mockRestServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
+ .andExpect(header("Authorization", EXPECTED_BASIC_AUTHORIZATION))
+ .andRespond(withStatus(HttpStatus.UNAUTHORIZED));
+
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+ assertTrue(response.getBody() instanceof ProblemDetails);
+
+ final ProblemDetails problemDetails = (ProblemDetails) response.getBody();
+ final String errorMessage = "An error occurred. Sending of notification to VNFM failed with response: "
+ + HttpStatus.UNAUTHORIZED.value() + ".\n" + "Unable to invoke HTTP POST using URL: " + CALLBACK_URI;
+
+ assertEquals(errorMessage, problemDetails.getDetail());
+ }
+
+ @Test
+ public void testNotificationSentOnToVnfm_OAuthAuthorized_Success() {
+ final PkgmSubscriptionRequest subscriptionRequest =
+ buildPkgmSubscriptionRequest(SubscriptionsAuthentication.AuthTypeEnum.OAUTH2_CLIENT_CREDENTIALS);
+ cache.put(SUBSCRIPTION_ID, subscriptionRequest);
+ final PkgChangeNotification notification = buildPkgChangeNotification();
+ final String notificationString = gson.toJson(notification);
+
+ mockRestServer.expect(requestTo(TOKEN_ENDPOINT)).andExpect(method(HttpMethod.POST))
+ .andExpect(header("Authorization", EXPECTED_BASIC_AUTHORIZATION))
+ .andRespond(withSuccess(JSON_TOKEN, MediaType.APPLICATION_JSON));
+
+ mockRestServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
+ .andExpect(header("Authorization", EXPECTED_OAUTH_AUTHORIZATION))
+ .andExpect(jsonPath("$.id").value(NOTIFICATION_ID))
+ .andExpect(jsonPath("$.notificationType").value(
+ VnfPackageChangeNotification.NotificationTypeEnum.VNFPACKAGECHANGENOTIFICATION.toString()))
+ .andExpect(jsonPath("$.subscriptionId").value(SUBSCRIPTION_ID))
+ .andExpect(jsonPath("$.timeStamp").value(TIMESTAMP.toString()))
+ .andExpect(jsonPath("$.vnfPkgId").value(VNFPKG_ID.toString()))
+ .andExpect(jsonPath("$.vnfdId").value(VNFD_ID.toString()))
+ .andExpect(
+ jsonPath("$.changeType").value(PkgChangeNotification.ChangeTypeEnum.OP_STATE_CHANGE.toString()))
+ .andExpect(jsonPath("$.operationalState")
+ .value(PkgChangeNotification.OperationalStateEnum.ENABLED.toString()))
+ .andExpect(jsonPath("$._links").value(buildPkgmLinks())).andRespond(withSuccess());
+
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode());
+ }
+
+ @Test
+ public void testNotificationSentOnToVnfm_OAuthTokenNotReceived_Fail() {
+ final PkgmSubscriptionRequest subscriptionRequest =
+ buildPkgmSubscriptionRequest(SubscriptionsAuthentication.AuthTypeEnum.OAUTH2_CLIENT_CREDENTIALS);
+ cache.put(SUBSCRIPTION_ID, subscriptionRequest);
+ final PkgChangeNotification notification = buildPkgChangeNotification();
+ final String notificationString = gson.toJson(notification);
+
+ mockRestServer.expect(requestTo(TOKEN_ENDPOINT)).andExpect(method(HttpMethod.POST))
+ .andExpect(header("Authorization", EXPECTED_BASIC_AUTHORIZATION)).andRespond(withSuccess());
+
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+ assertTrue(response.getBody() instanceof ProblemDetails);
+
+ final ProblemDetails problemDetails = (ProblemDetails) response.getBody();
+ final String errorMessage = "An error occurred. Unable to retrieve OAuth Token from VNFM for notification.";
+
+ assertEquals(errorMessage, problemDetails.getDetail());
+ }
+
+ @Test
+ public void testNotificationSentOnToVnfm_TLSCertNotYetSupported_Fail() {
+ final PkgmSubscriptionRequest subscriptionRequest =
+ buildPkgmSubscriptionRequest(SubscriptionsAuthentication.AuthTypeEnum.TLS_CERT);
+ cache.put(SUBSCRIPTION_ID, subscriptionRequest);
+ final PkgChangeNotification notification = buildPkgChangeNotification();
+ final String notificationString = gson.toJson(notification);
+
+ final ResponseEntity<?> response = sendHttpPost(notificationString);
+
+ assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
+ assertTrue(response.getBody() instanceof ProblemDetails);
+
+ final ProblemDetails problemDetails = (ProblemDetails) response.getBody();
+ final String errorMessage = "An error occurred. Authentication type "
+ + subscriptionRequest.getAuthentication().getAuthType().toString() + " not currently supported.";
+
+ assertEquals(errorMessage, problemDetails.getDetail());
+ }
+
+ private PkgOnboardingNotification buildPkgOnboardingNotification() {
+ final PkgOnboardingNotification notification = new PkgOnboardingNotification();
+ notification.setId(NOTIFICATION_ID);
+ notification
+ .setNotificationType(PkgOnboardingNotification.NotificationTypeEnum.VNFPACKAGEONBOARDINGNOTIFICATION);
+ notification.setSubscriptionId(SUBSCRIPTION_ID);
+ notification.setTimeStamp(TIMESTAMP);
+ notification.setVnfPkgId(VNFPKG_ID);
+ notification.setVnfdId(VNFD_ID);
+ notification.setLinks(buildPkgmLinks());
+ return notification;
+ }
+
+ private PkgChangeNotification buildPkgChangeNotification() {
+ final PkgChangeNotification notification = new PkgChangeNotification();
+ notification.setId(NOTIFICATION_ID);
+ notification.setNotificationType(PkgChangeNotification.NotificationTypeEnum.VNFPACKAGECHANGENOTIFICATION);
+ notification.setSubscriptionId(SUBSCRIPTION_ID);
+ notification.setTimeStamp(TIMESTAMP);
+ notification.setVnfPkgId(VNFPKG_ID);
+ notification.setVnfdId(VNFD_ID);
+ notification.setChangeType(PkgChangeNotification.ChangeTypeEnum.OP_STATE_CHANGE);
+ notification.setOperationalState(PkgChangeNotification.OperationalStateEnum.ENABLED);
+ notification.setLinks(buildPkgmLinks());
+ return notification;
+ }
+
+ private PkgmLinks buildPkgmLinks() {
+ final PkgmLinks pkgmLinks = new PkgmLinks();
+
+ final NOTIFICATIONLINKSERIALIZER subscriptionLinkSerializer = new NOTIFICATIONLINKSERIALIZER();
+ subscriptionLinkSerializer.setHref("subscription_href");
+ pkgmLinks.setSubscription(subscriptionLinkSerializer);
+
+ final NOTIFICATIONLINKSERIALIZER vnfPackageLinkSerializer = new NOTIFICATIONLINKSERIALIZER();
+ vnfPackageLinkSerializer.setHref("vnf_package_href");
+ pkgmLinks.setVnfPackage(vnfPackageLinkSerializer);
+
+ return pkgmLinks;
+ }
+
+ private PkgmSubscriptionRequest buildPkgmSubscriptionRequest(
+ final SubscriptionsAuthentication.AuthTypeEnum authTypeEnum) {
+ final PkgmSubscriptionRequest subscriptionRequest = new PkgmSubscriptionRequest();
+ subscriptionRequest.setCallbackUri(CALLBACK_URI.toString());
+ subscriptionRequest.setAuthentication(buildSubscriptionsAuthentication(authTypeEnum));
+ return subscriptionRequest;
+ }
+
+ // TODO update for auth types other than basicAuth
+ private SubscriptionsAuthentication buildSubscriptionsAuthentication(
+ final SubscriptionsAuthentication.AuthTypeEnum authTypeEnum) {
+ final SubscriptionsAuthentication subscriptionsAuthentication = new SubscriptionsAuthentication();
+ final List<SubscriptionsAuthentication.AuthTypeEnum> authTypes = new ArrayList<>();
+ authTypes.add(authTypeEnum);
+ subscriptionsAuthentication.setAuthType(authTypes);
+ if (authTypeEnum == SubscriptionsAuthentication.AuthTypeEnum.TLS_CERT) {
+ // TODO: remove basic params and code for TLS
+ final SubscriptionsAuthenticationParamsBasic basicParams =
+ new SubscriptionsAuthenticationParamsBasic().userName(USERNAME).password(PASSWORD);
+ subscriptionsAuthentication.setParamsBasic(basicParams);
+ } else if (authTypeEnum == SubscriptionsAuthentication.AuthTypeEnum.OAUTH2_CLIENT_CREDENTIALS) {
+ final SubscriptionsAuthenticationParamsOauth2ClientCredentials oathParams =
+ new SubscriptionsAuthenticationParamsOauth2ClientCredentials().clientId(USERNAME)
+ .clientPassword(PASSWORD).tokenEndpoint(TOKEN_ENDPOINT);
+ subscriptionsAuthentication.setParamsOauth2ClientCredentials(oathParams);
+ } else {
+ final SubscriptionsAuthenticationParamsBasic basicParams =
+ new SubscriptionsAuthenticationParamsBasic().userName(USERNAME).password(PASSWORD);
+ subscriptionsAuthentication.setParamsBasic(basicParams);
+ }
+
+ return subscriptionsAuthentication;
+ }
+
+ private <T> ResponseEntity<ProblemDetails> sendHttpPost(final T notification) {
+ final String testURL = LOCALHOST_URL + port + NOTIFICATION_BASE_URL;
+ final HttpEntity<?> request = new HttpEntity<>(notification, basicHttpHeadersProvider.getHttpHeaders());
+ return testRestTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.POST, request,
+ ProblemDetails.class);
+ }
+
+ private ResponseEntity<Void> sendHttpGet(final String url) {
+ final String testURL = LOCALHOST_URL + port + url;
+ final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
+ return testRestTemplate.withBasicAuth("test", "test").exchange(testURL, HttpMethod.GET, request, Void.class);
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
index c776e55ff0..a2828b1f9f 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
@@ -24,40 +24,54 @@ import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
import static org.onap.so.adapters.vnfmadapter.Constants.PACKAGE_MANAGEMENT_BASE_URL;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
-import com.google.gson.Gson;
+import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.adapters.vnfmadapter.Constants;
import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.BasicAuth;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.LinkSelf;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.NsdmSubscription;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscription;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.ProblemDetails;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.SubscriptionAuthentication;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.Version;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfProducts;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfProductsProviders;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2002;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse201;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.PkgmSubscriptionRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsAuthentication;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilter;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilter.NotificationTypesEnum;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilter1;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilterVnfProductsFromProviders;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsLinks;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesLinksSelf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.http.HttpHeaders;
@@ -68,7 +82,9 @@ import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.client.MockRestServiceServer;
+import org.springframework.test.web.client.match.MockRestRequestMatchers;
import org.springframework.web.client.RestTemplate;
+import com.google.gson.Gson;
/**
* @author Ronan Kenny (ronan.kenny@est.tech)
@@ -81,33 +97,50 @@ public class Sol003PackageManagementSubscriptionControllerTest {
private final Gson gson = new Gson();
private final URI msbEndpoint = URI.create("http://msb-iag.onap:80/api/vnfpkgm/v1/subscriptions");
+ private static final String _NOTIFICATION_CALLBACK_URI =
+ "https://so-vnfm-adapter.onap:30406" + Constants.ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL;
+ private static final String LOCALHOST_URL = "http://localhost:";
+
@Autowired
@Qualifier(CONFIGURABLE_REST_TEMPLATE)
- private RestTemplate testRestTemplate;
- private MockRestServiceServer mockRestServer;
+ private RestTemplate restTemplate;
+ private MockRestServiceServer mockRestServiceServer;
@Autowired
private CacheManager cacheServiceProvider;
@Autowired
private Sol003PackageManagementSubscriptionController sol003PackageManagementSubscriptionController;
+ @Autowired
+ private TestRestTemplate testRestTemplate;
+
+ @LocalServerPort
+ private int port;
+
+ private static final String ID = UUID.randomUUID().toString();
+
@Before
public void setUp() {
- mockRestServer = MockRestServiceServer.bindTo(testRestTemplate).build();
+ mockRestServiceServer = MockRestServiceServer.bindTo(restTemplate).build();
final Cache cache = cacheServiceProvider.getCache(Constants.PACKAGE_MANAGEMENT_SUBSCRIPTION_CACHE);
cache.clear();
}
+ @After
+ public void after() {
+ mockRestServiceServer.reset();
+ }
+
@Test
public void testSuccessPostSubscription() throws GeneralSecurityException, URISyntaxException {
final PkgmSubscriptionRequest pkgmSubscriptionRequest = postSubscriptionForTest();
- final ResponseEntity<InlineResponse2002> response =
- (ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
+ final ResponseEntity<InlineResponse201> response =
+ (ResponseEntity<InlineResponse201>) sol003PackageManagementSubscriptionController
.postSubscriptionRequest(pkgmSubscriptionRequest);
final HttpHeaders headers = buildHttpHeaders(Objects.requireNonNull(response.getBody()).getCallbackUri());
- SubscriptionsLinks subscriptionsLinks = new SubscriptionsLinks();
- VnfPackagesLinksSelf vnfPackagesLinksSelf = new VnfPackagesLinksSelf();
+ final SubscriptionsLinks subscriptionsLinks = new SubscriptionsLinks();
+ final VnfPackagesLinksSelf vnfPackagesLinksSelf = new VnfPackagesLinksSelf();
vnfPackagesLinksSelf.setHref("https://so-vnfm-adapter.onap:30406" + PACKAGE_MANAGEMENT_BASE_URL
+ "/subscriptions/" + response.getBody().getId());
subscriptionsLinks.setSelf(vnfPackagesLinksSelf);
@@ -140,22 +173,28 @@ public class Sol003PackageManagementSubscriptionControllerTest {
@Test
public void testSuccessGetSubscriptionWithSubscriptionId() throws GeneralSecurityException, URISyntaxException {
+
final PkgmSubscriptionRequest pkgmSubscriptionRequest = postSubscriptionForTest();
- final ResponseEntity<InlineResponse2002> response =
- (ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
+ mockRestServiceServer.expect(requestTo(msbEndpoint + "/" + ID)).andExpect(method(HttpMethod.GET))
+ .andRespond(withSuccess(gson.toJson(new NsdmSubscription().id(ID)), MediaType.APPLICATION_JSON));
+
+ final ResponseEntity<InlineResponse201> response =
+ (ResponseEntity<InlineResponse201>) sol003PackageManagementSubscriptionController
.postSubscriptionRequest(pkgmSubscriptionRequest);
final String subscriptionId = response.getBody().getId();
- final ResponseEntity<InlineResponse2002> response2002 =
- (ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
+
+
+ final ResponseEntity<InlineResponse201> responseEntity =
+ (ResponseEntity<InlineResponse201>) sol003PackageManagementSubscriptionController
.getSubscription(subscriptionId);
final HttpHeaders headers = buildHttpHeaders(response.getBody().getCallbackUri());
assertEquals(response.getBody().getFilter(), pkgmSubscriptionRequest.getFilter());
assertEquals(response.getHeaders(), headers);
- assertEquals(HttpStatus.OK, response2002.getStatusCode());
+ assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
assertEquals(pkgmSubscriptionRequest.getFilter(), response.getBody().getFilter());
// Ensure CallBackUri is set to new URI
assertNotEquals(pkgmSubscriptionRequest.getCallbackUri(), response.getBody().getCallbackUri());
@@ -163,10 +202,12 @@ public class Sol003PackageManagementSubscriptionControllerTest {
@Test
public void testFailGetSubscriptionWithInvalidSubscriptionId() {
- final ResponseEntity<InlineResponse2002> response =
- (ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
- .getSubscription("invalidSubscriptionId");
+ final String invalidId = "invalidSubscriptionId";
+ mockRestServiceServer.expect(requestTo(msbEndpoint + "/" + invalidId)).andExpect(method(HttpMethod.GET))
+ .andRespond(withStatus(HttpStatus.NOT_FOUND));
+ final ResponseEntity<?> response = sol003PackageManagementSubscriptionController.getSubscription(invalidId);
assertEquals(HttpStatus.NOT_FOUND, response.getStatusCode());
+ assertTrue(response.getBody() instanceof ProblemDetails);
}
@Test
@@ -174,18 +215,20 @@ public class Sol003PackageManagementSubscriptionControllerTest {
final PkgmSubscription pkgmSubscription = buildPkgmSubscription();
final PkgmSubscriptionRequest pkgmSubscriptionRequest = buildPkgmSubscriptionRequest();
- mockRestServer.expect(requestTo(msbEndpoint)).andExpect(method(HttpMethod.POST))
+ mockRestServiceServer.expect(requestTo(msbEndpoint)).andExpect(method(HttpMethod.POST))
.andRespond(withSuccess(gson.toJson(pkgmSubscription), MediaType.APPLICATION_JSON));
+ mockRestServiceServer.expect(requestTo(msbEndpoint + "/" + ID)).andExpect(method(HttpMethod.GET))
+ .andRespond(withSuccess(gson.toJson(new NsdmSubscription().id(ID)), MediaType.APPLICATION_JSON));
sol003PackageManagementSubscriptionController.postSubscriptionRequest(pkgmSubscriptionRequest);
- ResponseEntity<List<InlineResponse2002>> response =
+ final ResponseEntity<List<InlineResponse201>> response =
sol003PackageManagementSubscriptionController.getSubscriptions();
- List<InlineResponse2002> subscriptionsList = response.getBody();
+ final List<InlineResponse201> subscriptionsList = response.getBody();
assertEquals(Objects.requireNonNull(response.getBody()).get(0).getFilter(),
pkgmSubscriptionRequest.getFilter());
- assert (subscriptionsList != null);
+ assertNotNull(subscriptionsList != null);
assertNotEquals('0', subscriptionsList.size());
assertEquals(HttpStatus.OK, response.getStatusCode());
}
@@ -196,10 +239,14 @@ public class Sol003PackageManagementSubscriptionControllerTest {
final PkgmSubscription pkgmSubscription = buildPkgmSubscription();
final String subscriptionId = pkgmSubscription.getId();
- mockRestServer.expect(requestTo(msbEndpoint)).andExpect(method(HttpMethod.POST))
+ mockRestServiceServer.expect(requestTo(msbEndpoint)).andExpect(method(HttpMethod.POST))
.andRespond(withSuccess(gson.toJson(pkgmSubscription), MediaType.APPLICATION_JSON));
- mockRestServer.expect(requestTo(msbEndpoint + "/" + subscriptionId)).andExpect(method(HttpMethod.DELETE))
+
+ mockRestServiceServer.expect(requestTo(msbEndpoint + "/" + subscriptionId)).andExpect(method(HttpMethod.DELETE))
.andRespond(withStatus(HttpStatus.NO_CONTENT));
+ mockRestServiceServer.expect(requestTo(msbEndpoint + "/" + subscriptionId)).andExpect(method(HttpMethod.GET))
+ .andRespond(withSuccess(gson.toJson(new NsdmSubscription().id(subscriptionId)),
+ MediaType.APPLICATION_JSON));
final ResponseEntity<InlineResponse2002> responsePost =
(ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
@@ -218,15 +265,82 @@ public class Sol003PackageManagementSubscriptionControllerTest {
}
@Test
+ public void testDeleteSubscription_SubscripitonNotFoundInEtsiCatalogManager_SubscriptionDeletedFromLocalCache()
+ throws GeneralSecurityException {
+ final PkgmSubscriptionRequest pkgmSubscriptionRequest = buildPkgmSubscriptionRequest();
+ final PkgmSubscription pkgmSubscription = buildPkgmSubscription();
+
+ mockRestServiceServer.expect(requestTo(msbEndpoint)).andExpect(method(HttpMethod.POST))
+ .andRespond(withSuccess(gson.toJson(pkgmSubscription), MediaType.APPLICATION_JSON));
+
+ mockRestServiceServer.expect(requestTo(msbEndpoint + "/" + ID)).andExpect(method(HttpMethod.DELETE))
+ .andRespond(withStatus(HttpStatus.NOT_FOUND));
+
+ final ResponseEntity<InlineResponse2002> responsePost =
+ (ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
+ .postSubscriptionRequest(pkgmSubscriptionRequest);
+
+ final Cache cache = cacheServiceProvider.getCache(Constants.PACKAGE_MANAGEMENT_SUBSCRIPTION_CACHE);
+ assertNotNull(cache.get(ID));
+
+ final ResponseEntity responseDelete = sol003PackageManagementSubscriptionController.deleteSubscription(ID);
+
+ assertEquals(HttpStatus.NO_CONTENT, responseDelete.getStatusCode());
+ assertNull(cache.get(ID));
+
+ }
+
+ @Test
public void testFailDeleteSubscriptionWithInvalidSubscriptionId() throws URISyntaxException, InterruptedException {
final ResponseEntity<Void> responseDelete = (ResponseEntity<Void>) sol003PackageManagementSubscriptionController
.deleteSubscription("invalidSubscriptionId");
assertEquals(HttpStatus.NOT_FOUND, responseDelete.getStatusCode());
}
+
+ @Test
+ public void testSuccessPostSubscriptionWithValidNotificationTypes() throws Exception {
+
+ final String file = getAbsolutePath("src/test/resources/requests/SubscriptionRequest.json");
+ final String json = new String(Files.readAllBytes(Paths.get(file)));
+ final PkgmSubscriptionRequest request = gson.fromJson(json, PkgmSubscriptionRequest.class);
+
+ mockRestServiceServer.expect(requestTo(msbEndpoint)).andExpect(method(HttpMethod.POST))
+ .andExpect(MockRestRequestMatchers.content().json(gson.toJson(getEtsiCatalogPkgmSubscriptionRequest())))
+ .andRespond(withSuccess(gson.toJson(buildPkgmSubscription()), MediaType.APPLICATION_JSON));
+
+
+ final ResponseEntity<InlineResponse201> responseEntity = testRestTemplate.postForEntity(
+ LOCALHOST_URL + port + Constants.PACKAGE_MANAGEMENT_BASE_URL + "/subscriptions", request,
+ InlineResponse201.class);
+
+ assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode());
+ assertTrue(responseEntity.hasBody());
+ final InlineResponse201 actual = responseEntity.getBody();
+ assertEquals(ID, actual.getId());
+
+
+ }
+
+ private org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest getEtsiCatalogPkgmSubscriptionRequest() {
+ return new org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest()
+ .filter(new PkgmNotificationsFilter()
+ .addNotificationTypesItem(
+ PkgmNotificationsFilter.NotificationTypesEnum.VNFPACKAGEONBOARDINGNOTIFICATION)
+ .addVnfdIdItem("VNFDID").addVnfPkgIdItem("VNFPKGID")
+ .addOperationalStateItem(PkgmNotificationsFilter.OperationalStateEnum.ENABLED)
+ .addVnfProductsFromProvidersItem(new VnfProductsProviders().vnfProvider("EST")
+ .addVnfProductsItem(new VnfProducts().vnfProductName("VnfProducts")
+ .addVersionsItem(new Version().vnfSoftwareVersion("vnfSoftwareVersion")
+ .addVnfdVersionsItem("version1")))))
+ .callbackUri(_NOTIFICATION_CALLBACK_URI).authentication(
+ new SubscriptionAuthentication().addAuthTypeItem(SubscriptionAuthentication.AuthTypeEnum.BASIC)
+ .paramsBasic(new BasicAuth().userName("vnfm").password("password1$")));
+ }
+
private PkgmSubscriptionRequest buildPkgmSubscriptionRequest() {
final PkgmSubscriptionRequest pkgmSubscriptionRequest = new PkgmSubscriptionRequest();
- final SubscriptionsFilter sub = buildSubscriptionsFilter();
+ final SubscriptionsFilter1 sub = buildSubscriptionsFilter();
final SubscriptionsAuthentication auth = new SubscriptionsAuthentication();
pkgmSubscriptionRequest.setFilter(sub);
pkgmSubscriptionRequest.setCallbackUri(msbEndpoint.toString());
@@ -234,11 +348,11 @@ public class Sol003PackageManagementSubscriptionControllerTest {
return pkgmSubscriptionRequest;
}
- private SubscriptionsFilter buildSubscriptionsFilter() {
- final SubscriptionsFilter sub = new SubscriptionsFilter();
- final List<String> vnfdIdList = new ArrayList();
- final List<String> vnfPkgIdList = new ArrayList();
- final List<NotificationTypesEnum> notificationTypes = new ArrayList<>();
+ private SubscriptionsFilter1 buildSubscriptionsFilter() {
+ final SubscriptionsFilter1 sub = new SubscriptionsFilter1();
+ final List<String> vnfdIdList = new ArrayList<>();
+ final List<String> vnfPkgIdList = new ArrayList<>();
+ final List<SubscriptionsFilter1.NotificationTypesEnum> notificationTypes = new ArrayList<>();
final SubscriptionsFilterVnfProductsFromProviders subscriptionsFilterVnfProductsFromProviders =
new SubscriptionsFilterVnfProductsFromProviders();
final List<SubscriptionsFilterVnfProductsFromProviders> vnfProductsFromProviders = new ArrayList<>();
@@ -252,11 +366,11 @@ public class Sol003PackageManagementSubscriptionControllerTest {
}
private PkgmSubscription buildPkgmSubscription() {
- PkgmSubscription pkgmSubscription = new PkgmSubscription();
- PkgmNotificationsFilter pkgmNotificationsFilter = new PkgmNotificationsFilter();
- LinkSelf linkSelf = new LinkSelf();
- String id = UUID.randomUUID().toString();
- pkgmSubscription.setId(id);
+ final PkgmSubscription pkgmSubscription = new PkgmSubscription();
+ final PkgmNotificationsFilter pkgmNotificationsFilter = new PkgmNotificationsFilter();
+ final LinkSelf linkSelf = new LinkSelf();
+
+ pkgmSubscription.setId(ID);
pkgmSubscription.setCallbackUri(msbEndpoint + "/" + pkgmSubscription.getId().toString());
pkgmSubscription.setFilter(pkgmNotificationsFilter);
pkgmSubscription.setLinks(linkSelf);
@@ -267,16 +381,21 @@ public class Sol003PackageManagementSubscriptionControllerTest {
final PkgmSubscriptionRequest pkgmSubscriptionRequest = buildPkgmSubscriptionRequest();
final PkgmSubscription pkgmSubscription = buildPkgmSubscription();
- mockRestServer.expect(requestTo(msbEndpoint)).andExpect(method(HttpMethod.POST))
+ mockRestServiceServer.expect(requestTo(msbEndpoint)).andExpect(method(HttpMethod.POST))
.andRespond(withSuccess(gson.toJson(pkgmSubscription), MediaType.APPLICATION_JSON));
return pkgmSubscriptionRequest;
}
- private HttpHeaders buildHttpHeaders(String uri) throws URISyntaxException {
+ private HttpHeaders buildHttpHeaders(final String uri) throws URISyntaxException {
final HttpHeaders headers = new HttpHeaders();
- URI myUri = new URI(uri);
+ final URI myUri = new URI(uri);
headers.setLocation(myUri);
return headers;
}
+ private String getAbsolutePath(final String path) {
+ final File file = new File(path);
+ return file.getAbsolutePath();
+ }
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/requests/SubscriptionRequest.json b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/requests/SubscriptionRequest.json
new file mode 100644
index 0000000000..c38466f8e5
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/requests/SubscriptionRequest.json
@@ -0,0 +1,45 @@
+{
+ "filter":
+ {
+ "notificationTypes": [
+ "VnfPackageOnboardingNotification"
+ ],
+ "vnfProductsFromProviders": [
+ {
+ "vnfProvider": "EST",
+ "vnfProducts": [
+ {
+ "vnfProductName": "VnfProducts",
+ "versions": [
+ {
+ "vnfSoftwareVersion": "vnfSoftwareVersion",
+ "vnfdVersions": [
+ "version1"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "vnfdId": [
+ "VNFDID"
+ ],
+ "vnfPkgId": [
+ "VNFPKGID"
+ ],
+ "operationalState": ["ENABLED"]
+ },
+ "callbackUri": "http://so-vnfm-adapter:9093/api/vnfpkgm/v1/subscriptions",
+ "authentication":
+ {
+ "authType": [
+ "BASIC"
+ ],
+ "paramsBasic":
+ {
+ "userName": "vnfm",
+ "password": "vnfm"
+ }
+ }
+}
diff --git a/adapters/mso-vnfm-adapter/pom.xml b/adapters/mso-vnfm-adapter/pom.xml
index 962b3b4fb7..3e295aa184 100644
--- a/adapters/mso-vnfm-adapter/pom.xml
+++ b/adapters/mso-vnfm-adapter/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-vnfm-adapter</artifactId>
diff --git a/adapters/pom.xml b/adapters/pom.xml
index b96c3744c3..5d382fd4dd 100644
--- a/adapters/pom.xml
+++ b/adapters/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>adapters</artifactId>
@@ -23,6 +23,7 @@
<module>mso-openstack-adapters</module>
<module>mso-vnfm-adapter</module>
<module>mso-ve-vnfm-adapter</module>
+ <module>mso-nssmf-adapter</module>
<module>so-appc-orchestrator</module>
</modules>
diff --git a/adapters/so-appc-orchestrator/pom.xml b/adapters/so-appc-orchestrator/pom.xml
index 717bcee3fc..66dcc4dd30 100644
--- a/adapters/so-appc-orchestrator/pom.xml
+++ b/adapters/so-appc-orchestrator/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>adapters</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.adapters</groupId>
@@ -14,7 +14,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
- <appc.client.version>1.6.0-SNAPSHOT</appc.client.version>
+ <appc.client.version>1.7.1-SNAPSHOT</appc.client.version>
</properties>
<name>so-appc-orchestrator</name>
<description>MSO APPC-C Orchestrator</description>
diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml
index 6ae05896df..1059e89da9 100644
--- a/asdc-controller/pom.xml
+++ b/asdc-controller/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so</groupId>
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
index ecffb683ca..fe166f7942 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
@@ -24,15 +24,13 @@ package org.onap.so.asdc;
import java.security.SecureRandom;
import javax.annotation.PreDestroy;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.asdc.client.ASDCController;
import org.onap.so.asdc.client.exceptions.ASDCControllerException;
-import org.onap.so.logger.ErrorCode;
-import org.onap.so.logger.ScheduledTasksMDCSetup;
-import org.onap.so.utils.Components;
+import org.onap.logging.filter.base.ErrorCode;
+import org.onap.logging.filter.base.ScheduledLogging;
+import org.onap.logging.filter.base.ScheduledTaskException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
@@ -47,16 +45,13 @@ public class ASDCControllerSingleton {
private final ASDCController asdcController;
@Autowired
- private ScheduledTasksMDCSetup scheduledMDCSetup;
-
- @Autowired
public ASDCControllerSingleton(final ASDCController asdcController) {
this.asdcController = asdcController;
}
+ @ScheduledLogging
@Scheduled(fixedRate = 50000)
- public void periodicControllerTask() {
- scheduledMDCSetup.mdcSetup(Components.ASDC_CONTROLLER, "periodicControllerTask");
+ public void periodicControllerTask() throws ScheduledTaskException {
try {
final int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE);
asdcController.setControllerName("mso-controller" + randomNumber);
@@ -66,11 +61,9 @@ public class ASDCControllerSingleton {
asdcController.initASDC();
}
} catch (final ASDCControllerException controllerException) {
- scheduledMDCSetup.errorMDCSetup(ErrorCode.UnknownError, controllerException.getMessage());
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString());
- logger.error("Exception occurred", controllerException);
+ throw new ScheduledTaskException(ErrorCode.UnknownError, controllerException.getMessage(),
+ controllerException);
}
- scheduledMDCSetup.exitAndClearMDC();
}
@PreDestroy
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
index 06887f1253..a48e1770f0 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
@@ -4,12 +4,15 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in 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 +32,6 @@ import org.onap.so.asdc.activity.beans.ActivitySpec;
import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse;
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
-import org.onap.so.logger.LoggingAnchor;
import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -53,8 +55,6 @@ public class ActivitySpecsActions {
return null;
}
- String activitySpecId = null;
-
try {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(Include.NON_NULL);
@@ -71,30 +71,34 @@ public class ActivitySpecsActions {
int statusCode = response.getStatus();
if (statusCode == HttpStatus.SC_UNPROCESSABLE_ENTITY) {
logger.warn(LoggingAnchor.THREE, "ActivitySpec", activitySpec.getName(), "already exists in SDC");
- } else if (statusCode != HttpStatus.SC_OK && statusCode != HttpStatus.SC_CREATED) {
+ return null;
+ }
+ if (statusCode != HttpStatus.SC_OK && statusCode != HttpStatus.SC_CREATED) {
logger.warn(LoggingAnchor.THREE, "Error creating activity spec", activitySpec.getName(), statusCode);
- } else {
- if (response.getEntity() != null) {
- ActivitySpecCreateResponse activitySpecCreateResponse =
- response.readEntity(ActivitySpecCreateResponse.class);
- if (activitySpecCreateResponse != null) {
- activitySpecId = activitySpecCreateResponse.getId();
- } else {
- logger.warn(LoggingAnchor.TWO, "Unable to read activity spec", activitySpec.getName());
- }
- } else {
- logger.warn(LoggingAnchor.TWO, "No activity spec response returned", activitySpec.getName());
- }
+ return null;
+ }
+
+ if (response.getEntity() == null) {
+ logger.warn(LoggingAnchor.TWO, "No activity spec response returned", activitySpec.getName());
+ return null;
}
+ ActivitySpecCreateResponse activitySpecCreateResponse =
+ response.readEntity(ActivitySpecCreateResponse.class);
+ if (activitySpecCreateResponse == null) {
+ logger.warn(LoggingAnchor.TWO, "Unable to read activity spec", activitySpec.getName());
+ return null;
+ }
+ return activitySpecCreateResponse.getId();
+
+
} catch (Exception e) {
logger.warn(LoggingAnchor.TWO, "Exception creating activitySpec", e);
}
- return activitySpecId;
+ return null;
}
public boolean certifyActivitySpec(String hostname, String activitySpecId) {
- boolean certificationResult = false;
if (activitySpecId == null) {
return false;
}
@@ -114,16 +118,19 @@ public class ActivitySpecsActions {
if (statusCode == HttpStatus.SC_UNPROCESSABLE_ENTITY) {
logger.warn(LoggingAnchor.THREE, "ActivitySpec with id", activitySpecId, "is already certified in SDC");
- } else if (statusCode != HttpStatus.SC_OK) {
+ return false;
+ }
+ if (statusCode != HttpStatus.SC_OK) {
logger.warn(LoggingAnchor.THREE, "Error certifying activity", activitySpecId, statusCode);
- } else {
- certificationResult = true;
+ return false;
}
+ return true;
+
} catch (Exception e) {
logger.warn(LoggingAnchor.TWO, "Exception certifying activitySpec", e);
+ return false;
}
- return certificationResult;
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
index e53b792a74..df8e828a16 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -74,17 +76,19 @@ public class DeployActivitySpecs {
logger.debug("{} {}", "Attempting to create activity ", activitySpecFromCatalog.getName());
ActivitySpec activitySpec = mapActivitySpecFromCatalogToSdc(activitySpecFromCatalog);
String activitySpecId = activitySpecsActions.createActivitySpec(hostname, activitySpec);
- if (activitySpecId != null) {
- logger.info(LoggingAnchor.TWO, "Successfully created activitySpec", activitySpec.getName());
- boolean certificationResult = activitySpecsActions.certifyActivitySpec(hostname, activitySpecId);
- if (certificationResult) {
- logger.info(LoggingAnchor.TWO, "Successfully certified activitySpec", activitySpec.getName());
- } else {
- logger.info(LoggingAnchor.TWO, "Failed to certify activitySpec", activitySpec.getName());
- }
- } else {
+ if (activitySpecId == null) {
logger.info(LoggingAnchor.TWO, "Failed to create activitySpec", activitySpec.getName());
+ continue;
+ }
+
+ logger.info(LoggingAnchor.TWO, "Successfully created activitySpec", activitySpec.getName());
+ boolean certificationResult = activitySpecsActions.certifyActivitySpec(hostname, activitySpecId);
+ if (!certificationResult) {
+ logger.info(LoggingAnchor.TWO, "Failed to certify activitySpec", activitySpec.getName());
+ continue;
}
+
+ logger.info(LoggingAnchor.TWO, "Successfully certified activitySpec", activitySpec.getName());
}
}
@@ -120,46 +124,41 @@ public class DeployActivitySpecs {
List<Input> inputs = new ArrayList<>();
List<Output> outputs = new ArrayList<>();
for (ActivitySpecActivitySpecParameters activitySpecParam : activitySpecActivitySpecParameters) {
- if (activitySpecParam != null) {
- if (activitySpecParam.getActivitySpecParameters() != null) {
- ActivitySpecParameters activitySpecParameters = activitySpecParam.getActivitySpecParameters();
- if (activitySpecParameters != null) {
- if (activitySpecParameters.getDirection().equals(DIRECTION_INPUT)) {
- Input input = new Input();
- input.setName(activitySpecParameters.getName());
- input.setType(activitySpecParameters.getType());
- inputs.add(input);
- } else if (activitySpecParameters.getDirection().equals(DIRECTION_OUTPUT)) {
- Output output = new Output();
- output.setName(activitySpecParameters.getName());
- output.setType(activitySpecParameters.getType());
- outputs.add(output);
- }
- }
- }
+ if (activitySpecParam == null || activitySpecParam.getActivitySpecParameters() == null) {
+ continue;
+ }
+ ActivitySpecParameters activitySpecParameters = activitySpecParam.getActivitySpecParameters();
+
+ if (activitySpecParameters.getDirection().equals(DIRECTION_INPUT)) {
+ Input input = new Input();
+ input.setName(activitySpecParameters.getName());
+ input.setType(activitySpecParameters.getType());
+ inputs.add(input);
+ continue;
+ }
+ if (activitySpecParameters.getDirection().equals(DIRECTION_OUTPUT)) {
+ Output output = new Output();
+ output.setName(activitySpecParameters.getName());
+ output.setType(activitySpecParameters.getType());
+ outputs.add(output);
}
}
activitySpec.setInputs(inputs);
activitySpec.setOutputs(outputs);
- return;
}
public boolean checkHttpServerUp(String host) {
- URL url = null;
- boolean isUp = false;
-
- int responseCode = 0;
try {
- url = new URL(host);
+ URL url = new URL(host);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setConnectTimeout(5000);
- responseCode = connection.getResponseCode();
+ int responseCode = connection.getResponseCode();
+ if (responseCode == HttpStatus.SC_OK || responseCode == HttpStatus.SC_NOT_FOUND) {
+ return true;
+ }
} catch (Exception e) {
logger.warn("Exception on connecting to SDC WFD endpoint: ", e);
}
- if (responseCode == HttpStatus.SC_OK || responseCode == HttpStatus.SC_NOT_FOUND) {
- isUp = true;
- }
- return isUp;
+ return false;
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index f64adfd760..ad96e1be4b 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -7,6 +7,8 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -33,9 +35,13 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import java.util.List;
import java.util.Optional;
+import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
+import org.onap.sdc.toscaparser.api.elements.Metadata;
+import org.onap.so.asdc.util.ZipParser;
import org.onap.so.logger.LoggingAnchor;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.sdc.api.IDistributionClient;
@@ -68,7 +74,7 @@ import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -162,12 +168,7 @@ public class ASDCController {
break;
case IDLE:
- if (this.nbOfNotificationsOngoing > 1) {
- --this.nbOfNotificationsOngoing;
- } else {
- this.nbOfNotificationsOngoing = 0;
- this.controllerStatus = newControllerStatus;
- }
+ changeOnStatusIDLE(newControllerStatus);
break;
default:
@@ -177,6 +178,15 @@ public class ASDCController {
}
}
+ private void changeOnStatusIDLE(ASDCControllerStatus newControllerStatus) {
+ if (this.nbOfNotificationsOngoing > 1) {
+ --this.nbOfNotificationsOngoing;
+ } else {
+ this.nbOfNotificationsOngoing = 0;
+ this.controllerStatus = newControllerStatus;
+ }
+ }
+
public ASDCControllerStatus getControllerStatus() {
return this.controllerStatus;
}
@@ -296,13 +306,12 @@ public class ASDCController {
protected void notifyErrorToAsdc(INotificationData iNotif, ToscaResourceStructure toscaResourceStructure,
DistributionStatusEnum deployStatus, VfResourceStructure resourceStructure, String errorMessage) {
// do csar lever first
- this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deployStatus, errorMessage);
+ this.sendCsarDeployNotification(resourceStructure, toscaResourceStructure, deployStatus, errorMessage);
// at resource level
for (IResourceInstance resource : iNotif.getResources()) {
resourceStructure = new VfResourceStructure(iNotif, resource);
errorMessage = String.format("Resource with UUID: %s already exists", resource.getResourceUUID());
- this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deployStatus,
- errorMessage);
+ this.sendCsarDeployNotification(resourceStructure, toscaResourceStructure, deployStatus, errorMessage);
}
}
@@ -363,8 +372,7 @@ public class ASDCController {
if (DistributionActionResultEnum.SUCCESS.equals(downloadResult.getDistributionActionResult())) {
logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_ARTIFACT_DOWNLOAD_SUC.toString(),
- artifact.getArtifactURL(), artifact.getArtifactUUID(),
- String.valueOf(downloadResult.getArtifactPayload().length));
+ artifact.getArtifactURL(), artifact.getArtifactUUID(), downloadResult.getArtifactPayload().length);
} else {
logger.error(LoggingAnchor.SEVEN, MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
@@ -447,7 +455,7 @@ public class ASDCController {
}
}
- protected void sendCsarDeployNotification(INotificationData iNotif, ResourceStructure resourceStructure,
+ protected void sendCsarDeployNotification(ResourceStructure resourceStructure,
ToscaResourceStructure toscaResourceStructure, DistributionStatusEnum statusEnum, String errorReason) {
IArtifactInfo csarArtifact = toscaResourceStructure.getToscaArtifact();
@@ -471,8 +479,8 @@ public class ASDCController {
} catch (ArtifactInstallerException e) {
logger.info(LoggingAnchor.SIX, MessageEnum.ASDC_ARTIFACT_DOWNLOAD_FAIL.toString(),
resourceStructure.getResourceInstance().getResourceName(),
- resourceStructure.getResourceInstance().getResourceUUID(),
- String.valueOf(resourceStructure.getNumberOfResources()), "ASDC", "deployResourceStructure");
+ resourceStructure.getResourceInstance().getResourceUUID(), resourceStructure.getNumberOfResources(),
+ "ASDC", "deployResourceStructure");
sendDeployNotificationsForResource(resourceStructure, DistributionStatusEnum.DEPLOY_ERROR, e.getMessage());
throw e;
}
@@ -480,8 +488,8 @@ public class ASDCController {
if (resourceStructure.isDeployedSuccessfully() || toscaResourceStructure.isDeployedSuccessfully()) {
logger.info(LoggingAnchor.SIX, MessageEnum.ASDC_ARTIFACT_DEPLOY_SUC.toString(),
resourceStructure.getResourceInstance().getResourceName(),
- resourceStructure.getResourceInstance().getResourceUUID(),
- String.valueOf(resourceStructure.getNumberOfResources()), "ASDC", "deployResourceStructure");
+ resourceStructure.getResourceInstance().getResourceUUID(), resourceStructure.getNumberOfResources(),
+ "ASDC", "deployResourceStructure");
sendDeployNotificationsForResource(resourceStructure, DistributionStatusEnum.DEPLOY_OK, null);
}
@@ -509,26 +517,10 @@ public class ASDCController {
try {
IDistributionStatusMessage message =
new DistributionStatusMessage(artifactURL, consumerID, distributionID, status, timestamp);
-
- switch (notificationType) {
- case DOWNLOAD:
- if (errorReason != null) {
- this.distributionClient.sendDownloadStatus(message, errorReason);
- } else {
- this.distributionClient.sendDownloadStatus(message);
- }
-
- break;
- case DEPLOY:
- if (errorReason != null) {
- this.distributionClient.sendDeploymentStatus(message, errorReason);
- } else {
- this.distributionClient.sendDeploymentStatus(message);
- }
-
- break;
- default:
- break;
+ if (errorReason != null) {
+ sendNotificationWithMessageAndErrorReason(notificationType, errorReason, message);
+ } else {
+ sendNotificationWithMessage(notificationType, message);
}
} catch (RuntimeException e) {
logger.warn(LoggingAnchor.FIVE, MessageEnum.ASDC_SEND_NOTIF_ASDC_EXEC.toString(), "ASDC",
@@ -537,6 +529,33 @@ public class ASDCController {
}
}
+ private void sendNotificationWithMessage(NotificationType notificationType, IDistributionStatusMessage message) {
+ switch (notificationType) {
+ case DOWNLOAD:
+ this.distributionClient.sendDownloadStatus(message);
+ break;
+ case DEPLOY:
+ this.distributionClient.sendDeploymentStatus(message);
+ break;
+ default:
+ break;
+ }
+ }
+
+ private void sendNotificationWithMessageAndErrorReason(NotificationType notificationType, String errorReason,
+ IDistributionStatusMessage message) {
+ switch (notificationType) {
+ case DOWNLOAD:
+ this.distributionClient.sendDownloadStatus(message, errorReason);
+ break;
+ case DEPLOY:
+ this.distributionClient.sendDeploymentStatus(message, errorReason);
+ break;
+ default:
+ break;
+ }
+ }
+
protected void sendFinalDistributionStatus(String distributionID, DistributionStatusEnum status,
String errorReason) {
@@ -587,8 +606,8 @@ public class ASDCController {
for (IResourceInstance resource : iNotif.getResources()) {
noOfArtifacts += resource.getArtifacts().size();
}
- logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF.toString(),
- String.valueOf(noOfArtifacts), iNotif.getServiceUUID(), "ASDC");
+ logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF.toString(), noOfArtifacts,
+ iNotif.getServiceUUID(), "ASDC");
try {
if (iNotif.getDistributionID() != null && !iNotif.getDistributionID().isEmpty()) {
@@ -733,7 +752,8 @@ public class ASDCController {
if (isCsarAlreadyDeployed(iNotif, toscaResourceStructure)) {
return;
}
-
+ // process NsstResource
+ this.processNsstNotification(iNotif, toscaResourceStructure);
for (IResourceInstance resource : iNotif.getResources()) {
String resourceType = resource.getResourceType();
@@ -741,21 +761,11 @@ public class ASDCController {
logger.info("Processing Resource Type: {}, Model UUID: {}", resourceType, resource.getResourceUUID());
- if ("VF".equals(resourceType)) {
- resourceStructure = new VfResourceStructure(iNotif, resource);
- } else if ("PNF".equals(resourceType)) {
- resourceStructure = new PnfResourceStructure(iNotif, resource);
- } else {
- // There are cases where the Service has no VF resources, those are handled here
- logger.info("No resources found for Service: {}", iNotif.getServiceUUID());
- resourceStructure = new VfResourceStructure(iNotif, new ResourceInstance());
- resourceStructure.setResourceType(ResourceType.OTHER);
- }
+ resourceStructure = getResourceStructure(iNotif, resource, resourceType);
try {
if (!this.checkResourceAlreadyDeployed(resourceStructure, serviceDeployed)) {
-
logger.debug("Processing Resource Type: " + resourceType + " and Model UUID: "
+ resourceStructure.getResourceInstance().getResourceUUID());
@@ -765,25 +775,27 @@ public class ASDCController {
for (IArtifactInfo artifact : resource.getArtifacts()) {
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(((VfResourceStructure) resourceStructure)
- .decodeVfModuleArtifact(resultArtifact.getArtifactPayload())));
- }
- if (!ASDCConfiguration.WORKFLOW.equals(artifact.getArtifactType())) {
- resourceStructure.addArtifactToStructure(distributionClient, artifact,
- resultArtifact);
- } else {
- writeArtifactToFile(artifact, resultArtifact);
- logger.debug(
- "Adding workflow artifact to structure: " + artifact.getArtifactName());
- resourceStructure.addWorkflowArtifactToStructure(artifact, resultArtifact);
- }
+ if (resultArtifact == null) {
+ continue;
}
+
+ if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifact.getArtifactType())) {
+ logger.debug("VF_MODULE_ARTIFACT: "
+ + new String(resultArtifact.getArtifactPayload(), StandardCharsets.UTF_8));
+ logger.debug(ASDCNotificationLogging
+ .dumpVfModuleMetaDataList(((VfResourceStructure) resourceStructure)
+ .decodeVfModuleArtifact(resultArtifact.getArtifactPayload())));
+ }
+ if (!ASDCConfiguration.WORKFLOW.equals(artifact.getArtifactType())) {
+ resourceStructure.addArtifactToStructure(distributionClient, artifact,
+ resultArtifact);
+ } else {
+ writeArtifactToFile(artifact, resultArtifact);
+ logger.debug(
+ "Adding workflow artifact to structure: " + artifact.getArtifactName());
+ resourceStructure.addWorkflowArtifactToStructure(artifact, resultArtifact);
+ }
+
}
// Deploy VF resource and artifacts
@@ -817,8 +829,7 @@ public class ASDCController {
}
}
- this.sendCsarDeployNotification(iNotif, resourceStructure, toscaResourceStructure, deployStatus,
- errorMessage);
+ this.sendCsarDeployNotification(resourceStructure, toscaResourceStructure, deployStatus, errorMessage);
} catch (ASDCDownloadException | UnsupportedEncodingException e) {
logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
@@ -827,6 +838,20 @@ public class ASDCController {
}
}
+ private ResourceStructure getResourceStructure(INotificationData iNotif, IResourceInstance resource,
+ String resourceType) {
+ if ("VF".equals(resourceType)) {
+ return new VfResourceStructure(iNotif, resource);
+ }
+ if ("PNF".equals(resourceType)) {
+ return new PnfResourceStructure(iNotif, resource);
+ }
+ logger.info("No resources found for Service: {}", iNotif.getServiceUUID());
+ ResourceStructure resourceStructure = new VfResourceStructure(iNotif, new ResourceInstance());
+ resourceStructure.setResourceType(ResourceType.OTHER);
+ return resourceStructure;
+ }
+
private String getMsoConfigPath() {
String msoConfigPath = System.getProperty("mso.config.path");
if (msoConfigPath == null) {
@@ -893,6 +918,23 @@ public class ASDCController {
"processCsarServiceArtifacts", ErrorCode.BusinessProcessError.getValue(),
"Exception in processCsarServiceArtifacts", e);
}
+ } else if (artifact.getArtifactType().equals(ASDCConfiguration.OTHER)) {
+ try {
+ IDistributionClientDownloadResult resultArtifact =
+ this.downloadTheArtifact(artifact, iNotif.getDistributionID());
+
+ writeArtifactToFile(artifact, resultArtifact);
+
+ toscaResourceStructure.setToscaArtifact(artifact);
+
+ toscaResourceStructure.setServiceVersion(iNotif.getServiceVersion());
+
+ } catch (ASDCDownloadException e) {
+ logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception caught during processCsarServiceArtifacts", "ASDC",
+ "processCsarServiceArtifacts", ErrorCode.BusinessProcessError.getValue(),
+ "Exception in processCsarServiceArtifacts", e);
+ }
}
@@ -900,7 +942,6 @@ public class ASDCController {
}
-
/**
* @return the address of the ASDC we are connected to.
*/
@@ -920,4 +961,38 @@ public class ASDCController {
}
return UNKNOWN;
}
+
+ private void processNsstNotification(INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) {
+ Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata();
+ try {
+ if (serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY).equalsIgnoreCase("NSST")) {
+
+ String artifactContent = null;
+ List<IArtifactInfo> serviceArtifacts = iNotif.getServiceArtifacts();
+ Optional<IArtifactInfo> artifactOpt = serviceArtifacts.stream()
+ .filter(e -> e.getArtifactType().equalsIgnoreCase("OTHER")).findFirst();
+ if (artifactOpt.isPresent()) {
+ IArtifactInfo artifactInfo = artifactOpt.get();
+ logger.debug("Ready to parse this serviceArtifactUUID: " + artifactInfo.getArtifactUUID());
+ String filePath = Paths.get(getMsoConfigPath(), "ASDC", artifactInfo.getArtifactVersion(),
+ artifactInfo.getArtifactName()).normalize().toString();
+ ZipParser zipParserInstance = ZipParser.getInstance();
+ artifactContent = zipParserInstance.parseJsonForZip(filePath);
+ logger.debug(
+ "serviceArtifact parsing success! serviceArtifactUUID: " + artifactInfo.getArtifactUUID());
+ } else {
+ logger.debug("serviceArtifact is null");
+ }
+ ResourceStructure resourceStructure = new VfResourceStructure(iNotif, new ResourceInstance());
+ resourceStructure.setResourceType(ResourceType.OTHER);
+ toscaInstaller.installTheNsstService(toscaResourceStructure, (VfResourceStructure) resourceStructure,
+ artifactContent);
+ }
+ } catch (IOException e) {
+ logger.error("serviceArtifact parse failure for service uuid: "
+ + serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
+ } catch (Exception e) {
+ logger.error("error NSST process resource failure ", e);
+ }
+ }
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java
index d0f86c722e..d59984bb52 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCStatusCallBack.java
@@ -6,12 +6,14 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in 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,21 +54,25 @@ public final class ASDCStatusCallBack implements IStatusCallback {
try {
- if (iStatus.getStatus() != null) {
- if (iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_OK)
- || iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_ERROR)) {
- WatchdogDistributionStatus watchdogDistributionStatus = watchdogDistributionStatusRepository
- .findById(iStatus.getDistributionID()).orElseGet(() -> null);
- if (watchdogDistributionStatus == null) {
- watchdogDistributionStatus = new WatchdogDistributionStatus();
- watchdogDistributionStatus.setDistributionId(iStatus.getDistributionID());
- watchdogDistributionStatusRepository.save(watchdogDistributionStatus);
- }
- logger.debug(event);
- toscaInstaller.installTheComponentStatus(iStatus);
-
- }
+ if (iStatus.getStatus() == null) {
+ logger.info("Missing status on Status Object. ");
+ return;
+ }
+ if (!iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_OK)
+ && !iStatus.getStatus().equals(DistributionStatusEnum.COMPONENT_DONE_ERROR)) {
+ logger.info("Status is not 'Component Done OK' or 'Component Done Error'");
+ return;
}
+ WatchdogDistributionStatus watchdogDistributionStatus =
+ watchdogDistributionStatusRepository.findById(iStatus.getDistributionID()).orElseGet(() -> null);
+ if (watchdogDistributionStatus == null) {
+ watchdogDistributionStatus = new WatchdogDistributionStatus();
+ watchdogDistributionStatus.setDistributionId(iStatus.getDistributionID());
+ watchdogDistributionStatusRepository.save(watchdogDistributionStatus);
+ }
+ logger.debug(event);
+ toscaInstaller.installTheComponentStatus(iStatus);
+
} catch (ArtifactInstallerException e) {
logger.error("Error in ASDCStatusCallback {}", e.getMessage(), e);
logger.debug("Error in ASDCStatusCallback {}", e.getMessage());
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java
index 13cace404e..0a1b1c531e 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/FinalDistributionStatusMessage.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in 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,7 +39,6 @@ public class FinalDistributionStatusMessage implements IFinalDistrStatusMessage
public FinalDistributionStatusMessage(String distributionId, final DistributionStatusEnum distributionStatusEnum,
final long timestampL, String consumerId) {
- // componentName = componentname;
consumerID = consumerId;
distributionID = distributionId;
status = distributionStatusEnum;
@@ -68,6 +69,7 @@ public class FinalDistributionStatusMessage implements IFinalDistrStatusMessage
this.timestamp = timestamp;
}
+ @Override
public String getComponentName() {
return componentName;
}
@@ -76,6 +78,7 @@ public class FinalDistributionStatusMessage implements IFinalDistrStatusMessage
this.componentName = componentName;
}
+ @Override
public String getConsumerID() {
return consumerID;
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java
index 7bd9c752a4..34f21ab813 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/emulators/JsonStatusData.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -50,43 +52,37 @@ public class JsonStatusData implements IStatusData {
@Override
public String getDistributionID() {
- // return (String)this.attributesMap.get("distributionID");
return "35120a87-1f82-4276-9735-f6de5a244d65";
}
@Override
public String getConsumerID() {
- // return (String)this.attributesMap.get("consumerID");
return "mso.123456";
}
@Override
public String getComponentName() {
- // return (String)this.attributesMap.get("componentName");
return "SDN-C";
}
@Override
public Long getTimestamp() {
- // return (String)this.attributesMap.get("timestamp");
return null;
}
@Override
public String getArtifactURL() {
- // return (String)this.attributesMap.get("artifactURL");
return "/sdc/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml";
}
@Override
public DistributionStatusEnum getStatus() {
- // return (DistributionStatusEnum)this.attributesMap.get(DistributionStatusEnum.DEPLOY_OK);
return DistributionStatusEnum.COMPONENT_DONE_OK;
}
/**
* Method instantiate a INotificationData implementation from a JSON file.
- *
+ *
* @param notifFilePath The file path in String
* @return A JsonNotificationData instance
* @throws IOException in case of the file is not readable or not accessible
@@ -96,19 +92,6 @@ public class JsonStatusData implements IStatusData {
InputStream is = Thread.currentThread().getContextClassLoader()
.getResourceAsStream(notifFilePath + "status-structure.json");
- // String fileLocation = System.getProperty("mso.config.path") + "notif-structure.json";
-
- // String source = fileLocation;
- // InputStream is = IOUtils.toInputStream(source, "UTF-8");
-
- // String myString = IOUtils.toString(is, "UTF-8");
-
-
- // System.out.println(myString);
-
- if (is == null) {
- // throw new FileExistsException("Resource Path does not exist: "+notifFilePath);
- }
return mapper.readValue(is, JsonStatusData.class);
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
index a9d06d8e82..42778507f0 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
@@ -36,7 +36,7 @@ import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator;
import org.onap.so.asdc.client.test.emulators.JsonStatusData;
import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/ErrorCode.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/ErrorCode.java
new file mode 100644
index 0000000000..1714e24a27
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/ErrorCode.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.etsi.pkg.processor;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public enum ErrorCode {
+
+ NORMAL("0"), PACKAGE_EXIST("1"), CATALOG_EXCEPTION("2"), SYSTEM_ERROR("3"), UNKNOWN("-1");
+
+ private String code;
+
+ private ErrorCode(final String code) {
+ this.code = code;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public static ErrorCode getErrorCode(final String code) {
+ for (final ErrorCode errorCode : ErrorCode.values()) {
+ if (errorCode.getCode().equalsIgnoreCase(code)) {
+ return errorCode;
+ }
+
+ }
+ return UNKNOWN;
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboadingJobStatus.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboadingJobStatus.java
new file mode 100644
index 0000000000..772f81a7fe
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboadingJobStatus.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.etsi.pkg.processor;
+
+import java.io.Serializable;
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class EtsiCatalogPackageOnboadingJobStatus implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @XmlElement(name = "jobId")
+ private String jobId;
+
+ @XmlElement(name = "responseDescriptor")
+ private EtsiCatalogPackageOnboardingJobDescriptor responseDescriptor;
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(final String jobId) {
+ this.jobId = jobId;
+ }
+
+ public EtsiCatalogPackageOnboardingJobDescriptor getResponseDescriptor() {
+ return responseDescriptor;
+ }
+
+ public void setResponseDescriptor(final EtsiCatalogPackageOnboardingJobDescriptor responseDescriptor) {
+ this.responseDescriptor = responseDescriptor;
+ }
+
+ @Override
+ public String toString() {
+ return "EtsiCatalogPackageOnboadingJobStatus [jobId=" + jobId + ", responseDescriptor=" + responseDescriptor
+ + "]";
+ }
+
+
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingJob.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingJob.java
new file mode 100644
index 0000000000..0c7bba6751
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingJob.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.etsi.pkg.processor;
+
+import java.io.Serializable;
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class EtsiCatalogPackageOnboardingJob implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @XmlElement(name = "jobId")
+ private String jobId;
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(final String jobId) {
+ this.jobId = jobId;
+ }
+
+ @Override
+ public String toString() {
+ return "EtsiCatalogPackageOnboardingJob [jobId=" + jobId + "]";
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingJobDescriptor.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingJobDescriptor.java
new file mode 100644
index 0000000000..b0c07d6f24
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingJobDescriptor.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.etsi.pkg.processor;
+
+import java.io.Serializable;
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class EtsiCatalogPackageOnboardingJobDescriptor implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @XmlElement(name = "status")
+ private String status;
+
+ @XmlElement(name = "statusDescription")
+ private String statusDescription;
+
+ @XmlElement(name = "errorCode")
+ private String errorCode;
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(final String status) {
+ this.status = status;
+ }
+
+ public String getStatusDescription() {
+ return statusDescription;
+ }
+
+ public void setStatusDescription(final String statusDescription) {
+ this.statusDescription = statusDescription;
+ }
+
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(final String errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ @Override
+ public String toString() {
+ return "EtsiCatalogPackageOnboardingJobDescriptor [status=" + status + ", statusDescription="
+ + statusDescription + ", errorCode=" + errorCode + "]";
+ }
+
+
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingRequest.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingRequest.java
new file mode 100644
index 0000000000..79fd1398a0
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogPackageOnboardingRequest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.etsi.pkg.processor;
+
+import java.io.Serializable;
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class EtsiCatalogPackageOnboardingRequest implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @XmlElement(name = "csarId")
+ private String csarId;
+
+ public EtsiCatalogPackageOnboardingRequest csarId(final String csarId) {
+ this.csarId = csarId;
+ return this;
+ }
+
+ public String getCsarId() {
+ return csarId;
+ }
+
+ public void setCsarId(final String csarId) {
+ this.csarId = csarId;
+ }
+
+ @Override
+ public String toString() {
+ return "EtsiCatalogPackageOnboardingRequest [csarId=" + csarId + "]";
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogServiceProvider.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogServiceProvider.java
new file mode 100644
index 0000000000..f6a303291f
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiCatalogServiceProvider.java
@@ -0,0 +1,112 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.etsi.pkg.processor;
+
+import static org.onap.so.asdc.etsi.pkg.processor.HttpRestServiceProviderConfiguration.ETSI_CATALOG_HTTP_REST_SERVICE_PROVIDER_BEAN;
+import org.onap.so.asdc.etsi.pkg.processor.exceptions.EtsiCatalogManagerRequestFailureException;
+import org.onap.so.rest.exceptions.InvalidRestRequestException;
+import org.onap.so.rest.exceptions.RestProcessingException;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Service
+public class EtsiCatalogServiceProvider {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(EtsiCatalogServiceProvider.class);
+
+ private final HttpRestServiceProvider httpServiceProvider;
+
+ @Value("${etsi-catalog-manager.endpoint:http://modeling-etsicatalog.onap:8806/api/catalog/v1}")
+ private String etsiCatalogManagerEndpoint;
+
+ @Autowired
+ public EtsiCatalogServiceProvider(
+ @Qualifier(ETSI_CATALOG_HTTP_REST_SERVICE_PROVIDER_BEAN) final HttpRestServiceProvider httpServiceProvider) {
+ this.httpServiceProvider = httpServiceProvider;
+ }
+
+ public EtsiCatalogPackageOnboardingJob onBoardResource(
+ final EtsiCatalogPackageOnboardingRequest packageOnboardingRequest) {
+ try {
+ final String url = etsiCatalogManagerEndpoint + "/vnfpackages";
+ final ResponseEntity<EtsiCatalogPackageOnboardingJob> responseEntity = httpServiceProvider.postHttpRequest(
+ packageOnboardingRequest, url, getHeaders(), EtsiCatalogPackageOnboardingJob.class);
+
+ if (responseEntity.getStatusCode().is2xxSuccessful()) {
+ if (responseEntity.hasBody()) {
+ return responseEntity.getBody();
+ }
+ LOGGER.error("Received response without body");
+ }
+ final String message = "Unexpected status code received " + responseEntity.getStatusCode();
+ LOGGER.error(message);
+ throw new EtsiCatalogManagerRequestFailureException(message);
+
+ } catch (final InvalidRestRequestException | RestProcessingException exception) {
+ final String message = "Unable to process onboarding request";
+ LOGGER.error(message, exception);
+ throw new EtsiCatalogManagerRequestFailureException(message);
+ }
+
+ }
+
+ public EtsiCatalogPackageOnboadingJobStatus getJobStatus(final String jobId) {
+ try {
+ final String url = etsiCatalogManagerEndpoint + "/jobs/" + jobId;
+
+ final ResponseEntity<EtsiCatalogPackageOnboadingJobStatus> responseEntity =
+ httpServiceProvider.getHttpResponse(url, getHeaders(), EtsiCatalogPackageOnboadingJobStatus.class);
+
+ if (responseEntity.getStatusCode().is2xxSuccessful()) {
+ if (responseEntity.hasBody()) {
+ return responseEntity.getBody();
+ }
+ LOGGER.error("Received response without body");
+ }
+ final String message =
+ "Unexpected status code received while getting job status " + responseEntity.getStatusCode();
+ LOGGER.error(message);
+ throw new EtsiCatalogManagerRequestFailureException(message);
+ } catch (final InvalidRestRequestException | RestProcessingException exception) {
+ final String message = "Unable to get job status";
+ LOGGER.error(message, exception);
+ throw new EtsiCatalogManagerRequestFailureException(message);
+ }
+
+ }
+
+ private HttpHeaders getHeaders() {
+ final HttpHeaders headers = new HttpHeaders();
+ headers.setContentType(MediaType.APPLICATION_JSON);
+ return headers;
+ }
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiResourcePackageProcessor.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiResourcePackageProcessor.java
new file mode 100644
index 0000000000..bb7197b7a4
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/EtsiResourcePackageProcessor.java
@@ -0,0 +1,175 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.etsi.pkg.processor;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.time.Instant;
+import java.util.Optional;
+import java.util.concurrent.TimeUnit;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import org.onap.so.asdc.etsi.pkg.processor.exceptions.SOL004ResourcePackageFailureException;
+import org.onap.so.asdc.etsi.pkg.processor.exceptions.SOL004ResourcePackageProcessingException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import com.google.common.collect.ImmutableSet;
+
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Service
+public class EtsiResourcePackageProcessor {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(EtsiResourcePackageProcessor.class);
+ private static final String ONBOARDED_PACKAGE_DIR_PATH = "Artifacts/Deployment/ONBOARDED_PACKAGE";
+ private final SdcResourceProvider sdcResourceProvider;
+ private final EtsiCatalogServiceProvider catalogServiceProvider;
+ private static final int SLEEP_TIME_IN_SECONDS = 5;
+
+ private static final ImmutableSet<JobStatus> JOB_FINISHED_STATES =
+ ImmutableSet.of(JobStatus.FINISHED, JobStatus.ERROR, JobStatus.TIMEOUT);
+
+ @Value("${etsi-catalog-manager.rest.timeoutInSeconds:300}")
+ private int timeOutInSeconds;
+
+ @Autowired
+ public EtsiResourcePackageProcessor(final SdcResourceProvider sdcResourceProvider,
+ final EtsiCatalogServiceProvider catalogServiceProvider) {
+ this.sdcResourceProvider = sdcResourceProvider;
+ this.catalogServiceProvider = catalogServiceProvider;
+ }
+
+ public void processPackageIfExists(final String vnfUuid) {
+ LOGGER.debug("Processing vnf with UUID: {} ", vnfUuid);
+ try {
+ final Optional<byte[]> optional = sdcResourceProvider.getVnfResource(vnfUuid);
+ if (optional.isPresent()) {
+ final byte[] resourceContent = optional.get();
+
+ if (containsOnBoardedSol004Package(resourceContent)) {
+ final EtsiCatalogPackageOnboardingJob onboardingJob = catalogServiceProvider
+ .onBoardResource(new EtsiCatalogPackageOnboardingRequest().csarId(vnfUuid));
+ LOGGER.debug("Successfully created job with id: {} to onboard vnf with UUID: {}",
+ onboardingJob.getJobId(), vnfUuid);
+
+ if (onboardingJob.getJobId() == null) {
+ throw new SOL004ResourcePackageFailureException(
+ "Received invalid jobId " + onboardingJob.getJobId());
+ }
+
+ final Optional<EtsiCatalogPackageOnboadingJobStatus> jobStatusOptional =
+ waitForJobToFinish(onboardingJob);
+
+ if (!jobStatusOptional.isPresent()) {
+ final String message = "Job status timeout reached failed to onboard vnf with UUID: " + vnfUuid;
+ LOGGER.debug(message, vnfUuid);
+ throw new SOL004ResourcePackageFailureException(message);
+ }
+
+ final EtsiCatalogPackageOnboadingJobStatus onboadingJobStatus = jobStatusOptional.get();
+ final JobStatus jobStatus = getJobStatus(onboadingJobStatus);
+ final ErrorCode errorCode = getErrorCode(onboadingJobStatus);
+
+ LOGGER.debug("Final job status: {}, error code: {}", jobStatus, errorCode);
+ if (!JobStatus.FINISHED.equals(jobStatus) && !ErrorCode.PACKAGE_EXIST.equals(errorCode)) {
+ final String message = "Failed to onboard vnf with UUID: " + vnfUuid + " job status: "
+ + jobStatus + " errorCode: " + errorCode;
+ LOGGER.debug(message, vnfUuid);
+ throw new SOL004ResourcePackageFailureException(message);
+ }
+ LOGGER.debug("Successfully onboarded package in ETSI catalog .. ");
+ }
+
+ }
+ } catch (final Exception exception) {
+ final String message = "Unable to process resource received from SDC";
+ LOGGER.error(message, exception);
+ throw new SOL004ResourcePackageProcessingException(message, exception);
+ }
+
+ }
+
+ private Optional<EtsiCatalogPackageOnboadingJobStatus> waitForJobToFinish(
+ final EtsiCatalogPackageOnboardingJob onboardingJob) throws InterruptedException {
+ JobStatus currentJobStatus = null;
+ final long startTimeInMillis = System.currentTimeMillis();
+ final long timeOutTime = startTimeInMillis + TimeUnit.SECONDS.toMillis(timeOutInSeconds);
+
+ LOGGER.debug("Will wait till {} for {} job to finish", Instant.ofEpochMilli(timeOutTime).toString(),
+ onboardingJob.getJobId());
+
+ while (timeOutTime > System.currentTimeMillis()) {
+
+ final EtsiCatalogPackageOnboadingJobStatus onboadingJobStatus =
+ catalogServiceProvider.getJobStatus(onboardingJob.getJobId());
+ LOGGER.debug("Current job status {} ", onboadingJobStatus);
+
+ currentJobStatus = getJobStatus(onboadingJobStatus);
+ if (JOB_FINISHED_STATES.contains(currentJobStatus)) {
+ return Optional.of(onboadingJobStatus);
+ }
+
+ LOGGER.debug("Onboarding not finished yet, will try again in {} seconds", SLEEP_TIME_IN_SECONDS);
+ TimeUnit.SECONDS.sleep(SLEEP_TIME_IN_SECONDS);
+
+ }
+ LOGGER.warn("Timeout current job status: {}", currentJobStatus);
+ return Optional.empty();
+ }
+
+ private boolean containsOnBoardedSol004Package(final byte[] resourceContent) throws IOException {
+ try (final ZipInputStream zipStream = new ZipInputStream(new ByteArrayInputStream(resourceContent))) {
+ ZipEntry entry;
+ while ((entry = zipStream.getNextEntry()) != null) {
+ if (entry.getName() != null && entry.getName().contains(ONBOARDED_PACKAGE_DIR_PATH)) {
+ LOGGER.debug("Found entry: {} that contains {} in name", entry.getName(),
+ ONBOARDED_PACKAGE_DIR_PATH);
+ return true;
+ }
+ }
+
+ }
+ LOGGER.debug("Unable to find {} dir in downloaded package", ONBOARDED_PACKAGE_DIR_PATH);
+ return false;
+ }
+
+ private JobStatus getJobStatus(final EtsiCatalogPackageOnboadingJobStatus onboadingJobStatus) {
+ if (onboadingJobStatus.getResponseDescriptor() != null) {
+ return JobStatus.getJobStatus(onboadingJobStatus.getResponseDescriptor().getStatus());
+ }
+ LOGGER.warn("Found null ResponseDescriptor {}", onboadingJobStatus);
+ return JobStatus.UNKNOWN;
+ }
+
+ private ErrorCode getErrorCode(final EtsiCatalogPackageOnboadingJobStatus onboadingJobStatus) {
+ if (onboadingJobStatus.getResponseDescriptor() != null) {
+ return ErrorCode.getErrorCode(onboadingJobStatus.getResponseDescriptor().getErrorCode());
+ }
+ LOGGER.warn("Found null ResponseDescriptor {}", onboadingJobStatus);
+ return ErrorCode.UNKNOWN;
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/HttpRestServiceProviderConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/HttpRestServiceProviderConfiguration.java
new file mode 100644
index 0000000000..1afda0d29f
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/HttpRestServiceProviderConfiguration.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.etsi.pkg.processor;
+
+import static org.onap.so.asdc.etsi.pkg.processor.SslBasedHttpClientConfiguration.SSL_BASED_CONFIGURABLE_REST_TEMPLATE;
+import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.onap.so.rest.service.HttpRestServiceProviderImpl;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Configuration
+public class HttpRestServiceProviderConfiguration {
+
+ public static final String ETSI_CATALOG_HTTP_REST_SERVICE_PROVIDER_BEAN = "etsiCatalogHttpRestServiceProviderBean";
+ public static final String SDC_HTTP_REST_SERVICE_PROVIDER_BEAN = "sdcHttpRestServiceProviderBean";
+
+ @Bean
+ @Qualifier(ETSI_CATALOG_HTTP_REST_SERVICE_PROVIDER_BEAN)
+ public HttpRestServiceProvider etsiCataloghttpRestServiceProvider(
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE) final RestTemplate restTemplate) {
+ return new HttpRestServiceProviderImpl(restTemplate);
+ }
+
+ @Bean
+ @Qualifier(SDC_HTTP_REST_SERVICE_PROVIDER_BEAN)
+ public HttpRestServiceProvider sdchttpRestServiceProvider(
+ @Qualifier(SSL_BASED_CONFIGURABLE_REST_TEMPLATE) final RestTemplate restTemplate) {
+ return new HttpRestServiceProviderImpl(restTemplate);
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/JobStatus.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/JobStatus.java
new file mode 100644
index 0000000000..cf09b15539
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/JobStatus.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.etsi.pkg.processor;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public enum JobStatus {
+
+ STARTED("started"),
+ TIMEOUT("timeout"),
+ FINISHED("finished"),
+ PARTLY_FINISHED("partly_finished"),
+ PROCESSING("processing"),
+ ERROR("error"),
+ UNKNOWN("unknown");
+
+ private String value;
+
+ private JobStatus(final String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public String toString() {
+ return this.value;
+ }
+
+ public static JobStatus getJobStatus(final String jobStatus) {
+ for (final JobStatus status : JobStatus.values()) {
+ if (status.getValue().equalsIgnoreCase(jobStatus)) {
+ return status;
+ }
+ }
+ return JobStatus.UNKNOWN;
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SdcBasicHttpConfigurationProvider.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SdcBasicHttpConfigurationProvider.java
new file mode 100644
index 0000000000..19375e265f
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SdcBasicHttpConfigurationProvider.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.etsi.pkg.processor;
+
+import java.nio.charset.StandardCharsets;
+import java.security.GeneralSecurityException;
+import org.apache.commons.codec.binary.Base64;
+import org.onap.so.utils.CryptoUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Configuration
+public class SdcBasicHttpConfigurationProvider {
+
+ @Value("${sdc.endpoint:https://sdc-be.onap:8443}")
+ private String endPoint;
+
+ @Value("${sdc.username:mso}")
+ private String username;
+
+ @Value(value = "${sdc.password:76966BDD3C7414A03F7037264FF2E6C8EEC6C28F2B67F2840A1ED857C0260FEE731D73F47F828E5527125D29FD25D3E0DE39EE44C058906BF1657DE77BF897EECA93BDC07FA64F}")
+ private String password;
+
+ @Value(value = "${sdc.key:566B754875657232314F5548556D3665}")
+ private String key;
+
+
+ public String getBasicAuthorization() throws GeneralSecurityException {
+ final String auth = username + ":" + CryptoUtils.decrypt(password, key);
+ final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(StandardCharsets.ISO_8859_1));
+ return "Basic " + new String(encodedAuth);
+ }
+
+ public String getEndPoint() {
+ return endPoint;
+ }
+
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SdcResourceProvider.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SdcResourceProvider.java
new file mode 100644
index 0000000000..0cd0aba9c3
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SdcResourceProvider.java
@@ -0,0 +1,96 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.etsi.pkg.processor;
+
+import static org.onap.so.asdc.etsi.pkg.processor.HttpRestServiceProviderConfiguration.SDC_HTTP_REST_SERVICE_PROVIDER_BEAN;
+import static org.springframework.http.HttpHeaders.ACCEPT;
+import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM_VALUE;
+import java.security.GeneralSecurityException;
+import java.util.Optional;
+import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Service
+public class SdcResourceProvider {
+ private final static Logger LOGGER = LoggerFactory.getLogger(SdcResourceProvider.class);
+
+ private static final String SERVICE_NAME = "SO-SDC-CONTROLLER";
+
+ private final HttpRestServiceProvider httpRestServiceProvider;
+
+ private final SdcBasicHttpConfigurationProvider sdcBasicHttpConfigurationProvider;
+
+ @Autowired
+ public SdcResourceProvider(
+ @Qualifier(SDC_HTTP_REST_SERVICE_PROVIDER_BEAN) final HttpRestServiceProvider httpRestServiceProvider,
+ final SdcBasicHttpConfigurationProvider sdcBasicHttpConfigurationProvider) {
+ this.httpRestServiceProvider = httpRestServiceProvider;
+ this.sdcBasicHttpConfigurationProvider = sdcBasicHttpConfigurationProvider;
+ }
+
+ public Optional<byte[]> getVnfResource(final String resourceId) {
+ LOGGER.debug("Will get resource from SDC using resource id: {}", resourceId);
+ try {
+ final HttpHeaders headers = getHttpHeaders();
+ headers.add(ACCEPT, APPLICATION_OCTET_STREAM_VALUE);
+ final String url = getSdcResourceEndPoint(resourceId);
+ LOGGER.debug("will invoke url: {} to get resource ", url);
+ final ResponseEntity<byte[]> responseEntity =
+ httpRestServiceProvider.getHttpResponse(url, headers, byte[].class);
+
+ if (responseEntity.getStatusCode().is2xxSuccessful()) {
+ if (responseEntity.hasBody()) {
+ return Optional.of(responseEntity.getBody());
+ }
+ LOGGER.error("Received response without body");
+ }
+ LOGGER.error("Unexpected Status code received : {}", responseEntity.getStatusCode());
+ return Optional.empty();
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to get {} resource from SDC", resourceId, exception);
+ return Optional.empty();
+ }
+ }
+
+ private String getSdcResourceEndPoint(final String resourceId) {
+ return sdcBasicHttpConfigurationProvider.getEndPoint() + "/sdc/v1/catalog/resources/" + resourceId
+ + "/toscaModel";
+ }
+
+
+ private HttpHeaders getHttpHeaders() throws GeneralSecurityException {
+ final HttpHeaders headers = new HttpHeaders();
+ headers.add(HttpHeaders.AUTHORIZATION, sdcBasicHttpConfigurationProvider.getBasicAuthorization());
+ headers.add("X-ECOMP-InstanceID", SERVICE_NAME);
+ headers.add("X-FromAppId", SERVICE_NAME);
+ return headers;
+ }
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SslBasedHttpClientConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SslBasedHttpClientConfiguration.java
new file mode 100644
index 0000000000..88c21524e9
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/SslBasedHttpClientConfiguration.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.etsi.pkg.processor;
+
+import java.security.NoSuchAlgorithmException;
+import java.util.concurrent.TimeUnit;
+import javax.net.ssl.SSLContext;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
+import org.onap.logging.filter.spring.SpringClientPayloadFilter;
+import org.onap.so.configuration.rest.HttpClientConnectionConfiguration;
+import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.client.BufferingClientHttpRequestFactory;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+@Configuration
+public class SslBasedHttpClientConfiguration {
+ private final static Logger LOGGER = LoggerFactory.getLogger(EtsiResourcePackageProcessor.class);
+
+
+ public static final String SSL_BASED_CONFIGURABLE_REST_TEMPLATE = "sslBasedConfigurableRestTemplate";
+ private final HttpClientConnectionConfiguration clientConnectionConfiguration;
+
+ @Autowired
+ public SslBasedHttpClientConfiguration(final HttpClientConnectionConfiguration clientConnectionConfiguration) {
+ this.clientConnectionConfiguration = clientConnectionConfiguration;
+ }
+
+ @Bean
+ @Qualifier(SSL_BASED_CONFIGURABLE_REST_TEMPLATE)
+ public RestTemplate sslBasedConfigurableRestTemplate() {
+ final RestTemplate restTemplate =
+ new RestTemplate(new BufferingClientHttpRequestFactory(httpComponentsClientHttpRequestFactory()));
+ restTemplate.getInterceptors().add(new SOSpringClientFilter());
+ restTemplate.getInterceptors().add((new SpringClientPayloadFilter()));
+ return restTemplate;
+ }
+
+ private HttpComponentsClientHttpRequestFactory httpComponentsClientHttpRequestFactory() {
+ try {
+ LOGGER.debug("Setting up HttpComponentsClientHttpRequestFactory with default SSL Context");
+ return new HttpComponentsClientHttpRequestFactory(HttpClientBuilder.create()
+ .setConnectionManager(getConnectionManager())
+ .setMaxConnPerRoute(clientConnectionConfiguration.getMaxConnectionsPerRoute())
+ .setMaxConnTotal(clientConnectionConfiguration.getMaxConnections())
+ .setDefaultRequestConfig(getRequestConfig()).setSSLContext(SSLContext.getDefault()).build());
+
+ } catch (final NoSuchAlgorithmException exception) {
+ LOGGER.error("Failed to create HttpComponentsClientHttpRequestFactory with default SSL Context", exception);
+ throw new RuntimeException(exception);
+ }
+ }
+
+ private PoolingHttpClientConnectionManager getConnectionManager() {
+ return new PoolingHttpClientConnectionManager(clientConnectionConfiguration.getTimeToLiveInMins(),
+ TimeUnit.MINUTES);
+ }
+
+ private RequestConfig getRequestConfig() {
+ return RequestConfig.custom().setSocketTimeout(clientConnectionConfiguration.getSocketTimeOutInMiliSeconds())
+ .setConnectTimeout(clientConnectionConfiguration.getConnectionTimeOutInMilliSeconds()).build();
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/EtsiCatalogManagerRequestFailureException.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/EtsiCatalogManagerRequestFailureException.java
new file mode 100644
index 0000000000..4f2e5039d7
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/EtsiCatalogManagerRequestFailureException.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.etsi.pkg.processor.exceptions;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class EtsiCatalogManagerRequestFailureException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public EtsiCatalogManagerRequestFailureException(final String message) {
+ super(message);
+ }
+
+ @Override
+ public synchronized Throwable fillInStackTrace() {
+ return this;
+ }
+
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/SOL004ResourcePackageFailureException.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/SOL004ResourcePackageFailureException.java
new file mode 100644
index 0000000000..8e05a50f32
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/SOL004ResourcePackageFailureException.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.etsi.pkg.processor.exceptions;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class SOL004ResourcePackageFailureException extends RuntimeException {
+
+ private static final long serialVersionUID = 5834657185124807797L;
+
+ public SOL004ResourcePackageFailureException(final String message) {
+ super(message);
+
+ }
+
+ @Override
+ public synchronized Throwable fillInStackTrace() {
+ return this;
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/SOL004ResourcePackageProcessingException.java b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/SOL004ResourcePackageProcessingException.java
new file mode 100644
index 0000000000..0e9f1ea9dc
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/etsi/pkg/processor/exceptions/SOL004ResourcePackageProcessingException.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.etsi.pkg.processor.exceptions;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class SOL004ResourcePackageProcessingException extends RuntimeException {
+
+ private static final long serialVersionUID = 4860501744379116092L;
+
+ public SOL004ResourcePackageProcessingException(final String message, final Throwable cause) {
+ super(message, cause);
+
+ }
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
index dcb49478f4..04d4b0c2dc 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
@@ -50,7 +50,7 @@ import org.onap.so.db.catalog.beans.ToscaCsar;
import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java
index 36d6ab96c0..11c1cc33cf 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleStructure.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -25,8 +27,6 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import org.onap.sdc.api.notification.IVfModuleMetadata;
-import org.onap.so.asdc.client.ASDCConfiguration;
import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
import org.onap.so.db.catalog.beans.VfModule;
@@ -73,23 +73,6 @@ public final class VfModuleStructure {
}
}
- public List<VfModuleArtifact> getOrderedArtifactList() {
-
- List<VfModuleArtifact> artifactsList = new LinkedList<>();
-
- artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT));
- artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_ENV));
- artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_VOL));
-
- artifactsList.addAll((artifactsMap.get(ASDCConfiguration.HEAT_NESTED)));
-
- artifactsList.addAll((artifactsMap.get(ASDCConfiguration.HEAT_ARTIFACT)));
-
- artifactsList.addAll(artifactsMap.get(ASDCConfiguration.HEAT_VOL));
-
- return null;
- }
-
public IVfModuleData getVfModuleMetadata() {
return vfModuleMetadata;
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
index f954fe0c5a..f5b0e17cf5 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
@@ -7,6 +7,8 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -77,39 +79,38 @@ public class VfResourceStructure extends ResourceStructure {
private Service catalogService;
- public VfResourceStructure(INotificationData notificationdata, IResourceInstance resourceinstance) {
- super(notificationdata, resourceinstance);
+ public VfResourceStructure(INotificationData notificationData, IResourceInstance resourceInstance) {
+ super(notificationData, resourceInstance);
this.resourceType = ResourceType.VF_RESOURCE;
vfModulesStructureList = new LinkedList<>();
vfModulesMetadataList = new ArrayList<>();
}
- public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactinfo,
+ public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactInfo,
IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException {
- this.addArtifactToStructure(distributionClient, artifactinfo, clientResult, null);
+ this.addArtifactToStructure(artifactInfo, clientResult, null);
}
- public void addArtifactToStructure(IDistributionClient distributionClient, IArtifactInfo artifactinfo,
- IDistributionClientDownloadResult clientResult, String modifiedHeatTemplate)
- throws UnsupportedEncodingException {
- VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactinfo, clientResult, modifiedHeatTemplate);
- addArtifactByType(artifactinfo, clientResult, vfModuleArtifact);
- if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifactinfo.getArtifactType())) {
+ public void addArtifactToStructure(IArtifactInfo artifactInfo, IDistributionClientDownloadResult clientResult,
+ String modifiedHeatTemplate) throws UnsupportedEncodingException {
+ VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactInfo, clientResult, modifiedHeatTemplate);
+ addArtifactByType(artifactInfo, clientResult, vfModuleArtifact);
+ if (ASDCConfiguration.VF_MODULES_METADATA.equals(artifactInfo.getArtifactType())) {
logger.debug("VF_MODULE_ARTIFACT: " + new String(clientResult.getArtifactPayload(), "UTF-8"));
logger.debug(ASDCNotificationLogging.dumpVfModuleMetaDataList(vfModulesMetadataList));
}
}
- public void addWorkflowArtifactToStructure(IArtifactInfo artifactinfo,
+ public void addWorkflowArtifactToStructure(IArtifactInfo artifactInfo,
IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException {
- WorkflowArtifact workflowArtifact = new WorkflowArtifact(artifactinfo, clientResult);
- workflowArtifactsMapByUUID.put(artifactinfo.getArtifactUUID(), workflowArtifact);
+ WorkflowArtifact workflowArtifact = new WorkflowArtifact(artifactInfo, clientResult);
+ workflowArtifactsMapByUUID.put(artifactInfo.getArtifactUUID(), workflowArtifact);
}
- protected void addArtifactByType(IArtifactInfo artifactinfo, IDistributionClientDownloadResult clientResult,
+ protected void addArtifactByType(IArtifactInfo artifactInfo, IDistributionClientDownloadResult clientResult,
VfModuleArtifact vfModuleArtifact) {
- switch (artifactinfo.getArtifactType()) {
+ switch (artifactInfo.getArtifactType()) {
case ASDCConfiguration.HEAT:
case ASDCConfiguration.HEAT_ENV:
case ASDCConfiguration.HEAT_VOL:
@@ -118,7 +119,7 @@ public class VfResourceStructure extends ResourceStructure {
case ASDCConfiguration.HEAT_NET:
case ASDCConfiguration.OTHER:
case ASDCConfiguration.CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT:
- artifactsMapByUUID.put(artifactinfo.getArtifactUUID(), vfModuleArtifact);
+ artifactsMapByUUID.put(artifactInfo.getArtifactUUID(), vfModuleArtifact);
break;
case ASDCConfiguration.VF_MODULES_METADATA:
vfModulesMetadataList = this.decodeVfModuleArtifact(clientResult.getArtifactPayload());
@@ -196,9 +197,7 @@ public class VfResourceStructure extends ResourceStructure {
public List<IVfModuleData> decodeVfModuleArtifact(byte[] arg0) {
try {
- List<IVfModuleData> listVFModuleMetaData =
- new ObjectMapper().readValue(arg0, new TypeReference<List<VfModuleMetaData>>() {});
- return listVFModuleMetaData;
+ return new ObjectMapper().readValue(arg0, new TypeReference<List<VfModuleMetaData>>() {});
} catch (JsonParseException e) {
logger.debug("JsonParseException : ", e);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
index 195aa7e302..4253521dff 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
@@ -6,6 +6,8 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -27,6 +29,7 @@ import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Enumeration;
@@ -47,7 +50,7 @@ import org.apache.http.entity.mime.content.ByteArrayBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.HttpClientBuilder;
import org.onap.so.asdc.client.ASDCConfiguration;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -107,18 +110,15 @@ public class BpmnInstaller {
logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), csarFilePath,
ex.getMessage(), ErrorCode.DataError.getValue(), "ASDC reading CSAR with workflows failed");
}
- return;
}
public boolean containsWorkflows(String csarFilePath) {
- boolean workflowsInCsar = false;
try (ZipFile zipFile = new ZipFile(csarFilePath)) {
Enumeration<? extends ZipEntry> zipEntries = zipFile.entries();
while (zipEntries.hasMoreElements()) {
String fileName = zipEntries.nextElement().getName();
if (fileName.endsWith(BPMN_SUFFIX)) {
- workflowsInCsar = true;
- break;
+ return true;
}
}
} catch (Exception e) {
@@ -126,10 +126,11 @@ public class BpmnInstaller {
logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_CHECK_EXC.toString(), csarFilePath,
e.getMessage(), ErrorCode.DataError.getValue(), "ASDC Unable to check CSAR entries");
}
- return workflowsInCsar;
+ return false;
}
- protected HttpResponse sendDeploymentRequest(String bpmnFileName, String version) throws Exception {
+ protected HttpResponse sendDeploymentRequest(String bpmnFileName, String version)
+ throws IOException, URISyntaxException {
HttpClient client = HttpClientBuilder.create().build();
URI deploymentUri = new URI(this.env.getProperty(CAMUNDA_URL) + CREATE_DEPLOYMENT_PATH);
HttpPost post = new HttpPost(deploymentUri);
@@ -141,7 +142,7 @@ public class BpmnInstaller {
return client.execute(post);
}
- protected HttpEntity buildMimeMultipart(String bpmnFileName, String version) throws Exception {
+ protected HttpEntity buildMimeMultipart(String bpmnFileName, String version) throws IOException {
FileInputStream bpmnFileStream = new FileInputStream(
Paths.get(getMsoConfigPath(), "ASDC", version, bpmnFileName).normalize().toString());
@@ -182,17 +183,14 @@ public class BpmnInstaller {
return requestEntity;
}
- /* protected void extractBpmnFileFromCsar(ZipInputStream zipIn, String fileName) throws IOException */
protected void extractBpmnFileFromCsar(ZipInputStream zipIn, String fileName) {
String filePath = Paths.get(System.getProperty("mso.config.path"), "ASDC", fileName).normalize().toString();
- /* BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filePath)); */
try (BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filePath))) {
byte[] bytesIn = new byte[4096];
- int read = 0;
+ int read;
while ((read = zipIn.read(bytesIn)) != -1) {
outputStream.write(bytesIn, 0, read);
}
- /* outputStream.close(); */
} catch (IOException e) {
logger.error("Unable to open file.", e);
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
index ef4dfa24aa..1f111ba7a0 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
@@ -40,7 +40,7 @@ import org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence;
import org.onap.so.db.catalog.data.repository.ActivitySpecRepository;
import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
import org.onap.so.db.catalog.data.repository.WorkflowRepository;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index 240bb83862..423c1a7ed6 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -39,7 +39,6 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
-import org.onap.so.logger.LoggingAnchor;
import org.hibernate.exception.ConstraintViolationException;
import org.hibernate.exception.LockAcquisitionException;
import org.onap.sdc.api.notification.IArtifactInfo;
@@ -55,6 +54,7 @@ import org.onap.sdc.tosca.parser.enums.EntityTemplateType;
import org.onap.sdc.tosca.parser.enums.SdcTypes;
import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
import org.onap.sdc.toscaparser.api.CapabilityAssignment;
+import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.Property;
import org.onap.sdc.toscaparser.api.RequirementAssignment;
import org.onap.sdc.toscaparser.api.elements.Metadata;
@@ -63,6 +63,7 @@ import org.onap.sdc.toscaparser.api.parameters.Input;
import org.onap.sdc.utils.DistributionStatusEnum;
import org.onap.so.asdc.client.ASDCConfiguration;
import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
+import org.onap.so.asdc.etsi.pkg.processor.EtsiResourcePackageProcessor;
import org.onap.so.asdc.installer.ASDCElementInfo;
import org.onap.so.asdc.installer.BigDecimalVersion;
import org.onap.so.asdc.installer.IVfModuleData;
@@ -74,72 +75,16 @@ import org.onap.so.asdc.installer.VfModuleStructure;
import org.onap.so.asdc.installer.VfResourceStructure;
import org.onap.so.asdc.installer.bpmn.WorkflowResource;
import org.onap.so.asdc.util.YamlEditor;
-import org.onap.so.db.catalog.beans.AllottedResource;
-import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
-import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
-import org.onap.so.db.catalog.beans.CollectionResource;
-import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
-import org.onap.so.db.catalog.beans.ConfigurationResource;
-import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
-import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
-import org.onap.so.db.catalog.beans.CvnfcCustomization;
-import org.onap.so.db.catalog.beans.HeatEnvironment;
-import org.onap.so.db.catalog.beans.HeatFiles;
-import org.onap.so.db.catalog.beans.HeatTemplate;
-import org.onap.so.db.catalog.beans.HeatTemplateParam;
-import org.onap.so.db.catalog.beans.InstanceGroup;
-import org.onap.so.db.catalog.beans.InstanceGroupType;
-import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
-import org.onap.so.db.catalog.beans.NetworkInstanceGroup;
-import org.onap.so.db.catalog.beans.NetworkResource;
-import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
-import org.onap.so.db.catalog.beans.PnfResource;
-import org.onap.so.db.catalog.beans.PnfResourceCustomization;
-import org.onap.so.db.catalog.beans.Service;
-import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
-import org.onap.so.db.catalog.beans.SubType;
-import org.onap.so.db.catalog.beans.TempNetworkHeatTemplateLookup;
-import org.onap.so.db.catalog.beans.ToscaCsar;
-import org.onap.so.db.catalog.beans.VFCInstanceGroup;
-import org.onap.so.db.catalog.beans.VfModule;
-import org.onap.so.db.catalog.beans.VfModuleCustomization;
-import org.onap.so.db.catalog.beans.VnfResource;
-import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.db.catalog.beans.VnfcCustomization;
-import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
-import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
-import org.onap.so.db.catalog.data.repository.CollectionResourceCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.CollectionResourceRepository;
-import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.ConfigurationResourceRepository;
-import org.onap.so.db.catalog.data.repository.CvnfcConfigurationCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.CvnfcCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.ExternalServiceToInternalServiceRepository;
-import org.onap.so.db.catalog.data.repository.HeatEnvironmentRepository;
-import org.onap.so.db.catalog.data.repository.HeatFilesRepository;
-import org.onap.so.db.catalog.data.repository.HeatTemplateRepository;
-import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
-import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
-import org.onap.so.db.catalog.data.repository.PnfCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.PnfResourceRepository;
-import org.onap.so.db.catalog.data.repository.ServiceProxyResourceCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.ServiceRepository;
-import org.onap.so.db.catalog.data.repository.TempNetworkHeatTemplateRepository;
-import org.onap.so.db.catalog.data.repository.ToscaCsarRepository;
-import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.VFModuleRepository;
-import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
-import org.onap.so.db.catalog.data.repository.VnfcCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository;
+import org.onap.so.db.catalog.beans.*;
+import org.onap.so.db.catalog.data.repository.*;
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
import org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -147,9 +92,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.springframework.util.CollectionUtils;
@Component
public class ToscaResourceInstaller {
@@ -271,8 +216,14 @@ public class ToscaResourceInstaller {
protected PnfCustomizationRepository pnfCustomizationRepository;
@Autowired
+ protected ServiceInfoRepository serviceInfoRepository;
+
+ @Autowired
protected WorkflowResource workflowResource;
+ @Autowired
+ protected EtsiResourcePackageProcessor etsiResourcePackageProcessor;
+
protected static final Logger logger = LoggerFactory.getLogger(ToscaResourceInstaller.class);
public boolean isCsarAlreadyDeployed(ToscaResourceStructure toscaResourceStructure)
@@ -442,6 +393,7 @@ public class ToscaResourceInstaller {
createToscaCsar(toscaResourceStruct);
createService(toscaResourceStruct, vfResourceStruct);
Service service = toscaResourceStruct.getCatalogService();
+ ServiceInfo serviceInfo = createServiceInfo(toscaResourceStruct, service);
List<IEntityDetails> vfEntityList = getEntityDetails(toscaResourceStruct,
EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
@@ -456,6 +408,8 @@ public class ToscaResourceInstaller {
if (ALLOTTED_RESOURCE.equalsIgnoreCase(category)) {
arEntityDetails.add(vfEntityDetails);
}
+ final String vnfUuid = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID);
+ etsiResourcePackageProcessor.processPackageIfExists(vnfUuid);
processVfModules(vfEntityDetails, toscaResourceStruct, vfResourceStructure, service, metadata);
}
@@ -469,8 +423,9 @@ public class ToscaResourceInstaller {
processServiceProxyAndConfiguration(toscaResourceStruct, service);
logger.info("Saving Service: {} ", service.getModelName());
- service = serviceRepo.save(service);
- correlateConfigCustomResources(service);
+ ServiceInfo serviceResult = serviceInfoRepository.save(serviceInfo);
+ Service resultService = serviceResult.getService();
+ correlateConfigCustomResources(resultService);
workflowResource.processWorkflows(vfResourceStructure);
@@ -1342,6 +1297,9 @@ public class ToscaResourceInstaller {
heatTemplate.setParameters(heatParam);
vfModuleArtifact.setHeatTemplate(heatTemplate);
} else {
+ if (vfModuleArtifact.getArtifactInfo().getArtifactTimeout() != null) {
+ existingHeatTemplate.setTimeoutMinutes(vfModuleArtifact.getArtifactInfo().getArtifactTimeout());
+ }
vfModuleArtifact.setHeatTemplate(existingHeatTemplate);
}
}
@@ -2907,5 +2865,122 @@ public class ToscaResourceInstaller {
return new Timestamp(new Date().getTime());
}
+ private String getServiceInput(ToscaResourceStructure toscaResourceStructure) {
+ String serviceInput = null;
+
+ List<Object> serviceInputList;
+ ISdcCsarHelper sdcCsarHelper = toscaResourceStructure.getSdcCsarHelper();
+ List<Input> serviceInputs = sdcCsarHelper.getServiceInputs();
+ if (!serviceInputs.isEmpty()) {
+ serviceInputList = new ArrayList<>();
+ serviceInputs.forEach(input -> {
+ Map<String, Object> serviceInputMap = new HashMap<>();
+ serviceInputMap.put("name", input.getName());
+ serviceInputMap.put("type", input.getType());
+ serviceInputMap.put("default", input.getDefault() == null ? "" : input.getDefault());
+ serviceInputMap.put("required", input.isRequired());
+ serviceInputList.add(serviceInputMap);
+
+ });
+ ObjectMapper objectMapper = new ObjectMapper();
+ try {
+ serviceInput = objectMapper.writeValueAsString(serviceInputList);
+ serviceInput = serviceInput.replace("\"", "\\\"");
+ } catch (JsonProcessingException e) {
+ logger.error("service input could not be deserialized for service uuid: "
+ + sdcCsarHelper.getServiceMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ }
+ } else {
+ logger.debug("serviceInput is null");
+ }
+ return serviceInput;
+ }
+
+ @Transactional(rollbackFor = {ArtifactInstallerException.class})
+ public void installTheNsstService(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStruct,
+ String artifactContent) {
+ createToscaCsar(toscaResourceStruct);
+ createService(toscaResourceStruct, vfResourceStruct);
+ Service service = toscaResourceStruct.getCatalogService();
+ ServiceInfo serviceInfo = createServiceInfo(toscaResourceStruct, service);
+ createServiceArtifact(service, vfResourceStruct, artifactContent);
+ serviceInfoRepository.save(serviceInfo);
+ }
+
+ private void createServiceArtifact(Service service, VfResourceStructure vfResourceStruct, String artifactContent) {
+ List<ServiceArtifact> serviceArtifactList = new ArrayList<>();
+ ServiceArtifact serviceArtifact;
+ List<IArtifactInfo> artifactInfoList = vfResourceStruct.getNotification().getServiceArtifacts().stream()
+ .filter(artifact -> artifact.getArtifactType().equalsIgnoreCase("OTHER")).collect(Collectors.toList());
+ for (IArtifactInfo artifactInfo : artifactInfoList) {
+ serviceArtifact = new ServiceArtifact();
+ serviceArtifact.setArtifactUUID(artifactInfo.getArtifactUUID());
+ serviceArtifact.setName(artifactInfo.getArtifactName());
+ serviceArtifact.setType(artifactInfo.getArtifactType());
+ serviceArtifact.setVersion(artifactInfo.getArtifactVersion());
+ serviceArtifact.setDescription(artifactInfo.getArtifactDescription());
+ serviceArtifact.setChecksum(artifactInfo.getArtifactChecksum());
+ serviceArtifact.setContent(artifactContent);
+ serviceArtifact.setService(service);
+ serviceArtifactList.add(serviceArtifact);
+ }
+ service.setServiceArtifactList(serviceArtifactList);
+ }
+
+ private ServiceInfo createServiceInfo(ToscaResourceStructure toscaResourceStruct, Service service) {
+ ServiceInfo serviceInfo = new ServiceInfo();
+ String serviceInput = getServiceInput(toscaResourceStruct);
+ serviceInfo.setServiceInput(serviceInput);
+
+ String serviceProperties = getServiceProperties(toscaResourceStruct);
+ serviceInfo.setServiceProperties(serviceProperties);
+
+ serviceInfo.setService(service);
+ return serviceInfo;
+ }
+
+ private String getServiceProperties(ToscaResourceStructure toscaResourceStruct) {
+ String propertiesJson = null;
+ ObjectMapper objectMapper = new ObjectMapper();
+ ISdcCsarHelper helper = toscaResourceStruct.getSdcCsarHelper();
+ String typeName = helper.getServiceSubstitutionMappingsTypeName();
+ Optional<NodeTemplate> nodeTemplate = helper.getServiceNodeTemplates().stream().findAny();
+ List<Object> serviceProperties = new ArrayList<>();
+ Map<String, Object> servicePropertiesMap;
+ if (nodeTemplate.isPresent()) {
+ LinkedHashMap<String, Object> customDef = nodeTemplate.get().getCustomDef();
+ Optional<String> machKey =
+ customDef.keySet().stream().filter(key -> key.equalsIgnoreCase(typeName)).findFirst();
+ if (machKey.isPresent()) {
+ Object obj = customDef.get(machKey.get());
+ try {
+ if (obj instanceof Map) {
+ Object properties = ((HashMap) obj).get("properties");
+ if (null != properties) {
+ for (Object propertyName : ((Map) properties).keySet()) {
+ servicePropertiesMap = new HashMap<>();
+ servicePropertiesMap.put("name", propertyName);
+ Object object = ((Map) properties).get(propertyName);
+ for (Object entry : ((Map) object).entrySet()) {
+ servicePropertiesMap.put((String) ((Map.Entry) entry).getKey(),
+ ((Map.Entry) entry).getValue());
+ }
+ servicePropertiesMap.remove("description");
+ serviceProperties.add(servicePropertiesMap);
+ }
+ propertiesJson = objectMapper.writeValueAsString(serviceProperties);
+ propertiesJson = propertiesJson.replace("\"", "\\\"");
+ }
+ }
+ } catch (JsonProcessingException e) {
+ logger.error("serviceProperties could not be deserialized for service uuid: "
+ + nodeTemplate.get().getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ }
+ }
+ } else {
+ logger.debug("ServiceNodeTemplates is null");
+ }
+ return propertiesJson;
+ }
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/ZipParser.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/ZipParser.java
new file mode 100644
index 0000000000..c2f04dca7b
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/ZipParser.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.asdc.util;
+
+import java.io.*;
+import java.nio.charset.Charset;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+
+public class ZipParser {
+
+ private static volatile ZipParser instance;
+
+ public static ZipParser getInstance() {
+ if (instance == null) {
+ synchronized (ZipParser.class) {
+ if (instance == null) {
+ instance = new ZipParser();
+ }
+ }
+ }
+ return instance;
+ }
+
+ public String parseJsonForZip(String path) throws IOException {
+ ZipFile zf = new ZipFile(path);
+ InputStream in = new BufferedInputStream(new FileInputStream(path));
+ Charset cs = Charset.forName("utf-8");
+ ZipInputStream zin = new ZipInputStream(in, cs);
+ ZipEntry ze;
+ String artifactContent = null;
+ while ((ze = zin.getNextEntry()) != null) {
+ if (ze.toString().endsWith("json")) {
+ StringBuilder jsonStr = new StringBuilder();
+ BufferedReader br = new BufferedReader(new InputStreamReader(zf.getInputStream(ze)));
+ String line;
+ while ((line = br.readLine()) != null) {
+ jsonStr.append(line);
+ }
+ br.close();
+ artifactContent = jsonStr.toString().replace("\"", "\\\"").replaceAll("\\s", "");
+ }
+ }
+ zin.closeEntry();
+ return artifactContent;
+ }
+
+}
diff --git a/asdc-controller/src/main/resources/resource-examples/resource_Extvl.csar b/asdc-controller/src/main/resources/resource-examples/resource_Extvl.csar
index bd35b0ab60..20ce62b8de 100644
--- a/asdc-controller/src/main/resources/resource-examples/resource_Extvl.csar
+++ b/asdc-controller/src/main/resources/resource-examples/resource_Extvl.csar
Binary files differ
diff --git a/asdc-controller/src/main/resources/resource-examples/service-ServiceFdnt-csar-0904-2.csar b/asdc-controller/src/main/resources/resource-examples/service-ServiceFdnt-csar-0904-2.csar
index 29d30f8023..dd0115b716 100644
--- a/asdc-controller/src/main/resources/resource-examples/service-ServiceFdnt-csar-0904-2.csar
+++ b/asdc-controller/src/main/resources/resource-examples/service-ServiceFdnt-csar-0904-2.csar
Binary files differ
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java b/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java
index e25de9c3d4..1a2e385121 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java
@@ -31,12 +31,14 @@ import org.springframework.context.annotation.Profile;
@SpringBootApplication
@Profile("test")
-@ComponentScan(basePackages = {"org.onap.so.asdc", "org.onap.so.security"},
+@ComponentScan(
+ basePackages = {"org.onap.so.asdc", "org.onap.so.security", "org.onap.so.rest.service",
+ "org.onap.so.configuration.rest", "org.onap.so.client"},
excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class),
@Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class),
@Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class)})
public class TestApplication {
- public static void main(String... args) {
+ public static void main(final String... args) {
SpringApplication.run(TestApplication.class, args);
System.getProperties().setProperty("mso.db", "MARIADB");
System.getProperties().setProperty("server.name", "Springboot");
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/SdcNotificationWithSol004PackageTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/SdcNotificationWithSol004PackageTest.java
new file mode 100644
index 0000000000..cb5bd0f51a
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/SdcNotificationWithSol004PackageTest.java
@@ -0,0 +1,358 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.asdc.client;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.ok;
+import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.verify;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_ERROR;
+import static org.onap.sdc.utils.DistributionStatusEnum.COMPONENT_DONE_OK;
+import static org.springframework.http.HttpHeaders.ACCEPT;
+import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM_VALUE;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.asdc.BaseTest;
+import org.onap.so.asdc.client.exceptions.ASDCControllerException;
+import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator;
+import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
+import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
+import org.onap.so.db.request.beans.WatchdogComponentDistributionStatusId;
+import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import com.google.gson.GsonBuilder;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class SdcNotificationWithSol004PackageTest extends BaseTest {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(SdcNotificationWithSol004PackageTest.class);
+ private static final String ETSI_CATALOG_PACKAGE_ONBOARDING_URL = "/api/catalog/v1/vnfpackages";
+ private static final String COMPONENT_NAME = "SO";
+ private static final String CSAR_ID = "8f0b72e1-b6d6-42b6-a808-c60b17f04d7a";
+ private static final String SDC_GET_RESOURCE_URL = "/sdc/v1/catalog/resources/" + CSAR_ID + "/toscaModel";
+ private static final String ETSI_CATALOG_PACKAGE_ONBOARDING_REQUEST = "{\"csarId\": \"" + CSAR_ID + "\"}";
+ private static final String DISTRIBUTION_ID = "35f20eb9-238a-4cc2-96dc-0a08f71bc209";
+ private static final String VGW_RESOURCE_PATH = "src/test/resources/resource-examples/vgw";
+ private static final String SERVICE_UUID = "e051ff77-fb79-451c-8457-1cbf94e4db8f";
+ private static final String SERVICE_INVARIANT_UUID = "c2ce924f-0aa1-4777-9b42-c0fec006a883";
+ private static final String JOB_ID = "57c13120-0a03-4d2e-837a-7c41d61e4a30";
+ private static final String ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL = "/api/catalog/v1/jobs/" + JOB_ID;
+ private static final String ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_RESPONSE = "{\"jobId\": \"" + JOB_ID + "\"}";
+
+ @Autowired
+ private ASDCController asdcController;
+
+ private DistributionClientEmulator distributionClient;
+
+ @Autowired
+ private WatchdogComponentDistributionStatusRepository watchdogComponentDistributionStatusRepository;
+
+ @Autowired
+ protected ServiceRepository serviceRepository;
+
+ @Before
+ public void setUp() {
+ distributionClient = new DistributionClientEmulator();
+ distributionClient.setResourcePath(getAbsolutePath(VGW_RESOURCE_PATH));
+ asdcController.setDistributionClient(distributionClient);
+ try {
+ asdcController.initASDC();
+ } catch (final ASDCControllerException controllerException) {
+ LOGGER.error(controllerException.getMessage(), controllerException);
+ fail(controllerException.getMessage());
+ }
+ }
+
+ @After
+ public void shutDown() {
+ try {
+ if (serviceRepository.existsById(SERVICE_UUID)) {
+ LOGGER.debug("Deleting existing service using {} ", SERVICE_UUID);
+ serviceRepository.deleteById(SERVICE_UUID);
+ }
+
+ final WatchdogComponentDistributionStatusId distributionId = new WatchdogComponentDistributionStatusId();
+ distributionId.setDistributionId(DISTRIBUTION_ID);
+ distributionId.setComponentName(COMPONENT_NAME);
+ if (watchdogComponentDistributionStatusRepository.existsById(distributionId)) {
+ LOGGER.debug("Deleting existing WatchdogComponentDistributionStatus using {} ", distributionId);
+ watchdogComponentDistributionStatusRepository.deleteById(distributionId);
+ }
+ asdcController.closeASDC();
+ } catch (final ASDCControllerException asdcControllerException) {
+ LOGGER.error(asdcControllerException.getMessage(), asdcControllerException);
+ fail(asdcControllerException.getMessage());
+ }
+ }
+
+ @Test
+ public void testTreatNotification_vgwServiceContainingSol004Package_successfullyOnboard() throws IOException {
+ initMockAaiServer(SERVICE_UUID, SERVICE_INVARIANT_UUID);
+
+ wireMockServer.stubFor(get(SDC_GET_RESOURCE_URL)
+ .willReturn(aResponse().withBody(getFileContent(
+ Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), "SDC_RESOURCE_CSAR", "vgw_sdc_resource.csar"))))
+ .withHeader(ACCEPT, equalTo(APPLICATION_OCTET_STREAM_VALUE)));
+
+ wireMockServer.stubFor(post(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL))
+ .willReturn(okJson(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_RESPONSE)));
+
+ wireMockServer.stubFor(get(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL))
+ .willReturn(okJson(new String(getFileContent(Paths.get(getAbsolutePath(VGW_RESOURCE_PATH),
+ "etsi-catalog-package-onboading-job-status-successful.json"))))));
+
+ asdcController.treatNotification(getNotificationDataImplObject());
+
+ final List<WatchdogComponentDistributionStatus> distributionList =
+ watchdogComponentDistributionStatusRepository.findByDistributionId(DISTRIBUTION_ID);
+ assertNotNull(distributionList);
+ assertEquals(1, distributionList.size());
+ final WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0);
+ assertEquals(COMPONENT_DONE_OK.toString(), distributionStatus.getComponentDistributionStatus());
+ assertEquals(COMPONENT_NAME, distributionStatus.getComponentName());
+
+ verify(postRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL))
+ .withRequestBody(equalToJson(ETSI_CATALOG_PACKAGE_ONBOARDING_REQUEST)));
+
+ verify(getRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL)));
+ }
+
+ @Test
+ public void testTreatNotification_vgwServiceUnableToGeSdcResource_successfullyOnboard() throws IOException {
+ initMockAaiServer(SERVICE_UUID, SERVICE_INVARIANT_UUID);
+
+ wireMockServer
+ .stubFor(get(SDC_GET_RESOURCE_URL).willReturn(aResponse().withStatus(HttpStatus.NOT_FOUND.value()))
+ .withHeader(ACCEPT, equalTo(APPLICATION_OCTET_STREAM_VALUE)));
+
+ asdcController.treatNotification(getNotificationDataImplObject());
+
+ final List<WatchdogComponentDistributionStatus> distributionList =
+ watchdogComponentDistributionStatusRepository.findByDistributionId(DISTRIBUTION_ID);
+ assertNotNull(distributionList);
+ assertEquals(1, distributionList.size());
+ final WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0);
+ assertEquals(COMPONENT_DONE_OK.toString(), distributionStatus.getComponentDistributionStatus());
+ assertEquals(COMPONENT_NAME, distributionStatus.getComponentName());
+ }
+
+ @Test
+ public void testTreatNotification_vgwServiceContainingNonEtsiSdcResource_successfullyOnboard() throws IOException {
+
+ initMockAaiServer(SERVICE_UUID, SERVICE_INVARIANT_UUID);
+
+ wireMockServer.stubFor(get(SDC_GET_RESOURCE_URL)
+ .willReturn(aResponse().withBody(getFileContent(
+ Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), "service-Vgwservicev1-csar.csar"))))
+ .withHeader(ACCEPT, equalTo(APPLICATION_OCTET_STREAM_VALUE)));
+
+ asdcController.treatNotification(getNotificationDataImplObject());
+
+ final List<WatchdogComponentDistributionStatus> distributionList =
+ watchdogComponentDistributionStatusRepository.findByDistributionId(DISTRIBUTION_ID);
+ assertNotNull(distributionList);
+ assertEquals(1, distributionList.size());
+ final WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0);
+ assertEquals(COMPONENT_DONE_OK.toString(), distributionStatus.getComponentDistributionStatus());
+ assertEquals(COMPONENT_NAME, distributionStatus.getComponentName());
+
+ }
+
+ @Test
+ public void testTreatNotification_vgwServiceContainingSol004Package_onnboardRequestToEtsiCatalogReturnsBadGatway_distributionStatusError()
+ throws IOException {
+ initMockAaiServer(SERVICE_UUID, SERVICE_INVARIANT_UUID);
+
+ wireMockServer.stubFor(get(SDC_GET_RESOURCE_URL)
+ .willReturn(aResponse().withBody(getFileContent(
+ Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), "SDC_RESOURCE_CSAR", "vgw_sdc_resource.csar"))))
+ .withHeader(ACCEPT, equalTo(APPLICATION_OCTET_STREAM_VALUE)));
+
+ wireMockServer.stubFor(post(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL))
+ .willReturn(aResponse().withStatus(HttpStatus.BAD_GATEWAY.value())));
+
+ asdcController.treatNotification(getNotificationDataImplObject());
+
+ final List<WatchdogComponentDistributionStatus> distributionList =
+ watchdogComponentDistributionStatusRepository.findByDistributionId(DISTRIBUTION_ID);
+ assertNotNull(distributionList);
+ assertEquals(1, distributionList.size());
+ final WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0);
+ assertEquals(COMPONENT_DONE_ERROR.toString(), distributionStatus.getComponentDistributionStatus());
+ assertEquals(COMPONENT_NAME, distributionStatus.getComponentName());
+
+ verify(postRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL))
+ .withRequestBody(equalToJson(ETSI_CATALOG_PACKAGE_ONBOARDING_REQUEST)));
+
+ }
+
+ @Test
+ public void testTreatNotification_vgwServiceContainingSol004Package_getJobStatusReturnsBadGatway_distributionStatusError()
+ throws IOException {
+ initMockAaiServer(SERVICE_UUID, SERVICE_INVARIANT_UUID);
+
+ wireMockServer.stubFor(get(SDC_GET_RESOURCE_URL)
+ .willReturn(aResponse().withBody(getFileContent(
+ Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), "SDC_RESOURCE_CSAR", "vgw_sdc_resource.csar"))))
+ .withHeader(ACCEPT, equalTo(APPLICATION_OCTET_STREAM_VALUE)));
+
+ wireMockServer.stubFor(post(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL))
+ .willReturn(okJson(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_RESPONSE)));
+
+ wireMockServer.stubFor(get(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL))
+ .willReturn(aResponse().withStatus(HttpStatus.BAD_GATEWAY.value())));
+
+ asdcController.treatNotification(getNotificationDataImplObject());
+
+ final List<WatchdogComponentDistributionStatus> distributionList =
+ watchdogComponentDistributionStatusRepository.findByDistributionId(DISTRIBUTION_ID);
+ assertNotNull(distributionList);
+ assertEquals(1, distributionList.size());
+ final WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0);
+ assertEquals(COMPONENT_DONE_ERROR.toString(), distributionStatus.getComponentDistributionStatus());
+ assertEquals(COMPONENT_NAME, distributionStatus.getComponentName());
+
+ verify(postRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL))
+ .withRequestBody(equalToJson(ETSI_CATALOG_PACKAGE_ONBOARDING_REQUEST)));
+
+ verify(getRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL)));
+
+ }
+
+ @Test
+ public void testTreatNotification_vgwServiceContainingSol004Package_getJobStatusBodyWithStatusError_distributionStatusError()
+ throws IOException {
+
+ initMockAaiServer(SERVICE_UUID, SERVICE_INVARIANT_UUID);
+
+ wireMockServer.stubFor(get(SDC_GET_RESOURCE_URL)
+ .willReturn(aResponse().withBody(getFileContent(
+ Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), "SDC_RESOURCE_CSAR", "vgw_sdc_resource.csar"))))
+ .withHeader(ACCEPT, equalTo(APPLICATION_OCTET_STREAM_VALUE)));
+
+ wireMockServer.stubFor(post(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL))
+ .willReturn(okJson(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_RESPONSE)));
+
+ wireMockServer.stubFor(get(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL))
+ .willReturn(okJson(new String(getFileContent(Paths.get(getAbsolutePath(VGW_RESOURCE_PATH),
+ "etsi-catalog-package-onboading-job-status-error.json"))))));
+
+ asdcController.treatNotification(getNotificationDataImplObject());
+
+ final List<WatchdogComponentDistributionStatus> distributionList =
+ watchdogComponentDistributionStatusRepository.findByDistributionId(DISTRIBUTION_ID);
+ assertNotNull(distributionList);
+ assertEquals(1, distributionList.size());
+ final WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0);
+ assertEquals(COMPONENT_DONE_ERROR.toString(), distributionStatus.getComponentDistributionStatus());
+ assertEquals(COMPONENT_NAME, distributionStatus.getComponentName());
+
+ verify(postRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL))
+ .withRequestBody(equalToJson(ETSI_CATALOG_PACKAGE_ONBOARDING_REQUEST)));
+
+ verify(getRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL)));
+
+
+ }
+
+ @Test
+ public void testTreatNotification_vgwServiceContainingSol004PackageAndPackageAlreadyExistsInEtsiCatalog_successfullyOnboard()
+ throws IOException {
+ initMockAaiServer(SERVICE_UUID, SERVICE_INVARIANT_UUID);
+
+ wireMockServer.stubFor(get(SDC_GET_RESOURCE_URL)
+ .willReturn(aResponse().withBody(getFileContent(
+ Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), "SDC_RESOURCE_CSAR", "vgw_sdc_resource.csar"))))
+ .withHeader(ACCEPT, equalTo(APPLICATION_OCTET_STREAM_VALUE)));
+
+ wireMockServer.stubFor(post(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL))
+ .willReturn(okJson(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_RESPONSE)));
+
+ wireMockServer.stubFor(get(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL))
+ .willReturn(okJson(new String(getFileContent(Paths.get(getAbsolutePath(VGW_RESOURCE_PATH),
+ "etsi-catalog-package-onboading-job-status-error-package-exists.json"))))));
+
+ asdcController.treatNotification(getNotificationDataImplObject());
+
+ final List<WatchdogComponentDistributionStatus> distributionList =
+ watchdogComponentDistributionStatusRepository.findByDistributionId(DISTRIBUTION_ID);
+ assertNotNull(distributionList);
+ assertEquals(1, distributionList.size());
+ final WatchdogComponentDistributionStatus distributionStatus = distributionList.get(0);
+ assertEquals(COMPONENT_DONE_OK.toString(), distributionStatus.getComponentDistributionStatus());
+ assertEquals(COMPONENT_NAME, distributionStatus.getComponentName());
+
+ verify(postRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_URL))
+ .withRequestBody(equalToJson(ETSI_CATALOG_PACKAGE_ONBOARDING_REQUEST)));
+
+ verify(getRequestedFor(urlEqualTo(ETSI_CATALOG_PACKAGE_ONBOARDING_JOB_STATUS_URL)));
+ }
+
+
+ private byte[] getFileContent(final Path path) throws IOException {
+ return Files.readAllBytes(path);
+ }
+
+ private NotificationDataImpl getNotificationDataImplObject() throws IOException {
+ final Path filePath = Paths.get(getAbsolutePath(VGW_RESOURCE_PATH), "dmaap-notification-message.json");
+ final byte[] bytes = Files.readAllBytes(filePath);
+
+ return new GsonBuilder().setPrettyPrinting().create().fromJson(new String(bytes), NotificationDataImpl.class);
+ }
+
+ /**
+ * Mock the AAI using wireshark.
+ */
+ private void initMockAaiServer(final String serviceUuid, final String serviceInvariantUuid) {
+ final String modelEndpoint = "/aai/v19/service-design-and-creation/models/model/" + serviceInvariantUuid
+ + "/model-vers/model-ver/" + serviceUuid + "?depth=0";
+
+ wireMockServer.stubFor(post(urlEqualTo(modelEndpoint)).willReturn(ok()));
+ }
+
+ private String getAbsolutePath(final String path) {
+ final File file = new File(path);
+ return file.getAbsolutePath();
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
index c25c4c2828..b8a2d01b49 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
@@ -75,19 +75,8 @@ import org.onap.so.asdc.installer.ToscaResourceStructure;
import org.onap.so.asdc.installer.VfModuleStructure;
import org.onap.so.asdc.installer.VfResourceStructure;
import org.onap.so.asdc.installer.bpmn.WorkflowResource;
-import org.onap.so.db.catalog.beans.ConfigurationResource;
-import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
-import org.onap.so.db.catalog.beans.Service;
-import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;
-import org.onap.so.db.catalog.beans.ToscaCsar;
-import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
-import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
-import org.onap.so.db.catalog.data.repository.ServiceRepository;
-import org.onap.so.db.catalog.data.repository.ToscaCsarRepository;
-import org.onap.so.db.catalog.data.repository.VFModuleRepository;
-import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
-import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository;
+import org.onap.so.db.catalog.beans.*;
+import org.onap.so.db.catalog.data.repository.*;
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.springframework.beans.factory.annotation.Autowired;
@@ -325,8 +314,6 @@ public class ToscaResourceInstallerTest extends BaseTest {
notificationData.setServiceUUID("serviceUUID1");
notificationData.setWorkloadContext("workloadContext1");
-
-
String serviceType = "test-type1";
String serviceRole = "test-role1";
String category = "Network L3+";
@@ -356,6 +343,7 @@ public class ToscaResourceInstallerTest extends BaseTest {
doReturn(resourceCustomizationUUID).when(metadata).getValue("vfModuleModelCustomizationUUID");
ServiceRepository serviceRepo = spy(ServiceRepository.class);
+ ServiceInfoRepository serviceInfoRepo = spy(ServiceInfoRepository.class);
VnfResourceRepository vnfRepo = spy(VnfResourceRepository.class);
doReturn(null).when(vnfRepo).findResourceByModelUUID(uuid);
@@ -366,6 +354,7 @@ public class ToscaResourceInstallerTest extends BaseTest {
WorkflowResource workflowResource = spy(WorkflowResource.class);
ReflectionTestUtils.setField(toscaInstaller, "serviceRepo", serviceRepo);
+ ReflectionTestUtils.setField(toscaInstaller, "serviceInfoRepository", serviceInfoRepo);
ReflectionTestUtils.setField(toscaInstaller, "vnfRepo", vnfRepo);
ReflectionTestUtils.setField(toscaInstaller, "vfModuleRepo", vfModuleRepo);
ReflectionTestUtils.setField(toscaInstaller, "instanceGroupRepo", instanceGroupRepo);
@@ -436,7 +425,10 @@ public class ToscaResourceInstallerTest extends BaseTest {
assertNotNull(service);
service.setModelVersion("1.0");
+ ServiceInfo serviceInfo = new ServiceInfo();
+ serviceInfo.setService(service);
doReturn(service).when(serviceRepo).save(service);
+ doReturn(serviceInfo).when(serviceInfoRepo).save(any(ServiceInfo.class));
WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository =
spy(WatchdogComponentDistributionStatusRepository.class);
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java b/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java
index 53d163a5bc..02c0f2dbf7 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/utils/ASDCLoggingVisitorImpl.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/asdc-controller/src/test/resources/application-test.yaml b/asdc-controller/src/test/resources/application-test.yaml
index 9fa20550db..60cd2d9f2a 100644
--- a/asdc-controller/src/test/resources/application-test.yaml
+++ b/asdc-controller/src/test/resources/application-test.yaml
@@ -102,3 +102,11 @@ mso:
endpoint: http://localhost:${wiremock.server.port}
config:
defaultpath: src/test/resources
+
+sdc:
+ endpoint: http://localhost:${wiremock.server.port}
+
+etsi-catalog-manager:
+ endpoint: http://localhost:${wiremock.server.port}/api/catalog/v1
+ rest:
+ timeoutInSeconds: 5
diff --git a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-VfZrdm5bpxmc02092017Service-csar.csar b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-VfZrdm5bpxmc02092017Service-csar.csar
index 4c906aba38..817b83135d 100644
--- a/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-VfZrdm5bpxmc02092017Service-csar.csar
+++ b/asdc-controller/src/test/resources/resource-examples/WorkflowBpmn/service-VfZrdm5bpxmc02092017Service-csar.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VENDOR_LICENSE/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VENDOR_LICENSE/vendor-license-model.xml
new file mode 100644
index 0000000000..6499a58fab
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VENDOR_LICENSE/vendor-license-model.xml
@@ -0,0 +1 @@
+<vendor-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>VLM</vendor-name><entitlement-pool-list><entitlement-pool><entitlement-pool-invariant-uuid>d6dea4a3db6b415ba50f17cb3311d046</entitlement-pool-invariant-uuid><entitlement-pool-uuid>04B01ABDE6CA4A9FBA75ACC023C6FEDA</entitlement-pool-uuid><version>1.0</version><name>EP</name><description/><increments/><manufacturer-reference-number>2345</manufacturer-reference-number><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit/><value/></threshold-value><sp-limits/><vendor-limits/></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><version>1.0</version><name>LKG</name><description/><type>Unique</type><increments/><manufacturerReferenceNumber/><license-key-group-invariant-uuid>55ddeb1a87be4fbb95a9bd74b4d745ca</license-key-group-invariant-uuid><license-key-group-uuid>81117C9B092C4C70AFF76833373CE7F4</license-key-group-uuid><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit>Absolute</unit><value>23456789</value></threshold-value><sp-limits/><vendor-limits/></license-key-group></license-key-group-list></vendor-license-model> \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VF_LICENSE/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VF_LICENSE/vf-license-model.xml
new file mode 100644
index 0000000000..581a3acb7f
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/VF_LICENSE/vf-license-model.xml
@@ -0,0 +1 @@
+<vf-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>VLM</vendor-name><vf-id>fa87b9536b704787981357393f36b3fc</vf-id><feature-group-list><feature-group><entitlement-pool-list><entitlement-pool><name>EP</name><description/><increments/><entitlement-pool-invariant-uuid>d6dea4a3db6b415ba50f17cb3311d046</entitlement-pool-invariant-uuid><entitlement-pool-uuid>04B01ABDE6CA4A9FBA75ACC023C6FEDA</entitlement-pool-uuid><manufacturer-reference-number>2345</manufacturer-reference-number><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit/><value/></threshold-value><version>1.0</version><sp-limits/><vendor-limits/></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><name>LKG</name><description/><type>Unique</type><increments/><license-key-group-invariant-uuid>55ddeb1a87be4fbb95a9bd74b4d745ca</license-key-group-invariant-uuid><license-key-group-uuid>81117C9B092C4C70AFF76833373CE7F4</license-key-group-uuid><manufacturer-reference-number/><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit>Absolute</unit><value>23456789</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/></license-key-group></license-key-group-list><name>FG</name><feature-group-uuid>2218d90f94944a94952be83354847631</feature-group-uuid><description/><part-number>234594</part-number></feature-group></feature-group-list></vf-license-model> \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/vgw6.csar b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/vgw6.csar
new file mode 100644
index 0000000000..56dbb2bce0
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/ONBOARDED_PACKAGE/vgw6.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/SDC_RESOURCE_CSAR/vgw_sdc_resource.csar b/asdc-controller/src/test/resources/resource-examples/vgw/SDC_RESOURCE_CSAR/vgw_sdc_resource.csar
new file mode 100644
index 0000000000..7ddfb6ef51
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/SDC_RESOURCE_CSAR/vgw_sdc_resource.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/VENDOR_LICENSE/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vgw/VENDOR_LICENSE/vendor-license-model.xml
new file mode 100644
index 0000000000..6499a58fab
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/VENDOR_LICENSE/vendor-license-model.xml
@@ -0,0 +1 @@
+<vendor-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>VLM</vendor-name><entitlement-pool-list><entitlement-pool><entitlement-pool-invariant-uuid>d6dea4a3db6b415ba50f17cb3311d046</entitlement-pool-invariant-uuid><entitlement-pool-uuid>04B01ABDE6CA4A9FBA75ACC023C6FEDA</entitlement-pool-uuid><version>1.0</version><name>EP</name><description/><increments/><manufacturer-reference-number>2345</manufacturer-reference-number><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit/><value/></threshold-value><sp-limits/><vendor-limits/></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><version>1.0</version><name>LKG</name><description/><type>Unique</type><increments/><manufacturerReferenceNumber/><license-key-group-invariant-uuid>55ddeb1a87be4fbb95a9bd74b4d745ca</license-key-group-invariant-uuid><license-key-group-uuid>81117C9B092C4C70AFF76833373CE7F4</license-key-group-uuid><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit>Absolute</unit><value>23456789</value></threshold-value><sp-limits/><vendor-limits/></license-key-group></license-key-group-list></vendor-license-model> \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/VF_LICENSE/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vgw/VF_LICENSE/vf-license-model.xml
new file mode 100644
index 0000000000..581a3acb7f
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/VF_LICENSE/vf-license-model.xml
@@ -0,0 +1 @@
+<vf-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>VLM</vendor-name><vf-id>fa87b9536b704787981357393f36b3fc</vf-id><feature-group-list><feature-group><entitlement-pool-list><entitlement-pool><name>EP</name><description/><increments/><entitlement-pool-invariant-uuid>d6dea4a3db6b415ba50f17cb3311d046</entitlement-pool-invariant-uuid><entitlement-pool-uuid>04B01ABDE6CA4A9FBA75ACC023C6FEDA</entitlement-pool-uuid><manufacturer-reference-number>2345</manufacturer-reference-number><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit/><value/></threshold-value><version>1.0</version><sp-limits/><vendor-limits/></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><name>LKG</name><description/><type>Unique</type><increments/><license-key-group-invariant-uuid>55ddeb1a87be4fbb95a9bd74b4d745ca</license-key-group-invariant-uuid><license-key-group-uuid>81117C9B092C4C70AFF76833373CE7F4</license-key-group-uuid><manufacturer-reference-number/><operational-scope><value/></operational-scope><start-date/><expiry-date/><threshold-value><unit>Absolute</unit><value>23456789</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/></license-key-group></license-key-group-list><name>FG</name><feature-group-uuid>2218d90f94944a94952be83354847631</feature-group-uuid><description/><part-number>234594</part-number></feature-group></feature-group-list></vf-license-model> \ No newline at end of file
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/dmaap-notification-message.json b/asdc-controller/src/test/resources/resource-examples/vgw/dmaap-notification-message.json
new file mode 100644
index 0000000000..d936cd1144
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/dmaap-notification-message.json
@@ -0,0 +1,66 @@
+{
+ "distributionID": "35f20eb9-238a-4cc2-96dc-0a08f71bc209",
+ "serviceName": "VgwServiceV1",
+ "serviceVersion": "1.0",
+ "serviceUUID": "e051ff77-fb79-451c-8457-1cbf94e4db8f",
+ "serviceDescription": "Test VGW Service",
+ "serviceInvariantUUID": "c2ce924f-0aa1-4777-9b42-c0fec006a883",
+ "resources": [
+ {
+ "resourceInstanceName": "VgwVspV1 0",
+ "resourceName": "VgwVspV1",
+ "resourceVersion": "1.0",
+ "resourceType": "VF",
+ "resourceUUID": "655aa939-d589-4333-8cc6-8fcb15db858a",
+ "resourceInvariantUUID": "c53a0c91-35f6-40ff-bcda-f75030cfaf2d",
+ "resourceCustomizationUUID": "db1673e1-351a-4d04-8e2f-84b2b4c52cc7",
+ "category": "Generic",
+ "subcategory": "Network Service",
+ "artifacts": [
+ {
+ "artifactName": "vf-license-model.xml",
+ "artifactType": "VF_LICENSE",
+ "artifactURL": "/VF_LICENSE/vf-license-model.xml",
+ "artifactChecksum": "NjMwZDc0YzhiNDRlZDAyYjIxMmFlM2M0MWRkZjFmNDA\u003d",
+ "artifactDescription": "VF license file",
+ "artifactTimeout": 120,
+ "artifactUUID": "8dda263d-90bb-4b3d-b8e0-0048222dc658",
+ "artifactVersion": "1"
+ },
+ {
+ "artifactName": "vgw6.csar",
+ "artifactType": "ONBOARDED_PACKAGE",
+ "artifactURL": "/ONBOARDED_PACKAGE/vgw6.csar",
+ "artifactChecksum": "NjdmNGU3ZDlkODQ0YTUzMTU5NjZmOThiYjMxNTJiNGI\u003d",
+ "artifactDescription": "Artifact created from csar",
+ "artifactTimeout": 120,
+ "artifactUUID": "9e9930b8-898e-4b8b-999e-66c43e1611f4",
+ "artifactVersion": "1"
+ },
+ {
+ "artifactName": "vendor-license-model.xml",
+ "artifactType": "VENDOR_LICENSE",
+ "artifactURL": "/VENDOR_LICENSE/vendor-license-model.xml",
+ "artifactChecksum": "NGNmNzU4MDhjN2FjMTJkNWIxMjNkZDZhOWQyYzU0ZjA\u003d",
+ "artifactDescription": " Vendor license file",
+ "artifactTimeout": 120,
+ "artifactUUID": "b3f7a4cf-6a35-4f66-b800-cd4a9a0e9719",
+ "artifactVersion": "1"
+ }
+ ]
+ }
+ ],
+ "serviceArtifacts": [
+ {
+ "artifactName": "service-Vgwservicev1-csar.csar",
+ "artifactType": "TOSCA_CSAR",
+ "artifactURL": "/service-Vgwservicev1-csar.csar",
+ "artifactChecksum": "MzcxNTMwMDhmNGY0MjRkMjFkNzk1MDNjOTVhNjQzMmE\u003d",
+ "artifactDescription": "TOSCA definition package of the asset",
+ "artifactTimeout": 0,
+ "artifactUUID": "0cc70c6e-6ddc-4ecc-8052-d9f1433c14b8",
+ "artifactVersion": "1"
+ }
+ ],
+ "workloadContext": "Production"
+}
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error-package-exists.json b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error-package-exists.json
new file mode 100644
index 0000000000..8dc07b9613
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error-package-exists.json
@@ -0,0 +1,20 @@
+{
+ "jobId": "57c13120-0a03-4d2e-837a-7c41d61e4a30",
+ "responseDescriptor":
+ {
+ "status": "error",
+ "progress": "255",
+ "statusDescription": "VNF package() already exists.",
+ "errorCode": "1",
+ "responseId": "2",
+ "responseHistoryList": [
+ {
+ "status": "processing",
+ "progress": "5",
+ "statusDescription": "Start CSAR(8f0b72e1-b6d6-42b6-a808-c60b17f04d7a) distribute.",
+ "errorCode": "0",
+ "responseId": "1"
+ }
+ ]
+ }
+}
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error.json b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error.json
new file mode 100644
index 0000000000..13f346fb7a
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-error.json
@@ -0,0 +1,20 @@
+{
+ "jobId": "57c13120-0a03-4d2e-837a-7c41d61e4a30",
+ "responseDescriptor":
+ {
+ "status": "error",
+ "progress": "255",
+ "statusDescription": "Failed to query artifacts(resources) from sdc.",
+ "errorCode": "0",
+ "responseId": "2",
+ "responseHistoryList": [
+ {
+ "status": "processing",
+ "progress": "5",
+ "statusDescription": "Start CSAR(8f0b72e1-b6d6-42b6-a808-c60b17f04d7a) distribute.",
+ "errorCode": "0",
+ "responseId": "1"
+ }
+ ]
+ }
+}
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-successful.json b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-successful.json
new file mode 100644
index 0000000000..b5dc1fe4f2
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/etsi-catalog-package-onboading-job-status-successful.json
@@ -0,0 +1,27 @@
+{
+ "jobId": "57c13120-0a03-4d2e-837a-7c41d61e4a30",
+ "responseDescriptor":
+ {
+ "status": "finished",
+ "progress": "100",
+ "statusDescription": "CSAR(8f0b72e1-b6d6-42b6-a808-c60b17f04d7a) distribute successfully.",
+ "errorCode": "0",
+ "responseId": "3",
+ "responseHistoryList": [
+ {
+ "status": "processing",
+ "progress": "30",
+ "statusDescription": "Save CSAR(8f0b72e1-b6d6-42b6-a808-c60b17f04d7a) to database.",
+ "errorCode": "0",
+ "responseId": "2"
+ },
+ {
+ "status": "processing",
+ "progress": "5",
+ "statusDescription": "Start CSAR(8f0b72e1-b6d6-42b6-a808-c60b17f04d7a) distribute.",
+ "errorCode": "0",
+ "responseId": "1"
+ }
+ ]
+ }
+}
diff --git a/asdc-controller/src/test/resources/resource-examples/vgw/service-Vgwservicev1-csar.csar b/asdc-controller/src/test/resources/resource-examples/vgw/service-Vgwservicev1-csar.csar
new file mode 100644
index 0000000000..51a9e19466
--- /dev/null
+++ b/asdc-controller/src/test/resources/resource-examples/vgw/service-Vgwservicev1-csar.csar
Binary files differ
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index 0821ebc97c..d051d1a56c 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -1378,6 +1378,34 @@ CREATE TABLE IF NOT EXISTS `activity_spec_to_user_parameters` (
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
+CREATE TABLE IF NOT EXISTS `service_info` (
+ `ID` int (11) AUTO_INCREMENT,
+ `SERVICE_INPUT` varchar (5000),
+ `SERVICE_PROPERTIES` varchar (5000),
+ PRIMARY KEY (`ID`)
+)ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `service_artifact`(
+ `ARTIFACT_UUID` varchar (200) NOT NULL,
+ `TYPE` varchar (200) NOT NULL,
+ `NAME` varchar (200) NOT NULL,
+ `VERSION` varchar (200) NOT NULL,
+ `DESCRIPTION` varchar (200) DEFAULT NULL,
+ `CONTENT` LONGTEXT DEFAULT NULL,
+ `CHECKSUM` varchar (200) DEFAULT NULL,
+ `CREATION_TIMESTAMP` DATETIME DEFAULT CURRENT_TIMESTAMP,
+ `SERVICE_MODEL_UUID` varchar (200) NOT NULL,
+ PRIMARY KEY (`ARTIFACT_UUID`),
+ CONSTRAINT `fk_service_artifact_service_info1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+)ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `service_to_service_info` (
+ `SERVICE_MODEL_UUID` varchar (200) NOT NULL,
+ `SERVICE_INFO_ID` INT (11) NOT NULL,
+ PRIMARY KEY (`SERVICE_MODEL_UUID`,`SERVICE_INFO_ID`),
+ CONSTRAINT `fk_service_to_service_info__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_service_to_service_info__service_info1` FOREIGN KEY (`SERVICE_INFO_ID`) REFERENCES `service_info` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE
+)ENGINE=InnoDB DEFAULT CHARSET=latin1;
--------START Request DB SCHEMA --------
CREATE DATABASE requestdb;
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml
index e233e6a7c6..5d9c1a3acd 100644
--- a/bpmn/MSOCommonBPMN/pom.xml
+++ b/bpmn/MSOCommonBPMN/pom.xml
@@ -1,11 +1,12 @@
<?xml version="1.0"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>MSOCommonBPMN</artifactId>
<name>MSOCommonBPMN</name>
@@ -21,18 +22,23 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <executions>
- <execution>
- <id>test-compile</id>
- <phase>compile</phase>
- <goals>
- <goal>testCompile</goal>
- </goals>
- <configuration>
- <skip>false</skip>
- </configuration>
- </execution>
- </executions>
+ <version>3.8.0</version>
+ <configuration>
+ <compilerId>groovy-eclipse-compiler</compilerId>
+ </configuration>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-compiler</artifactId>
+ <version>3.6.0-03</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-batch</artifactId>
+ <version>2.4.19-01</version>
+ </dependency>
+ </dependencies>
</plugin>
<plugin>
@@ -60,64 +66,6 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <version>2.8</version>
- <configuration>
- <additionalProjectnatures>
- <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature>
- </additionalProjectnatures>
- <sourceIncludes>
- <sourceInclude>**/*.groovy</sourceInclude>
- </sourceIncludes>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>compile</id>
- <phase>compile</phase>
- <configuration>
- <tasks>
- <mkdir dir="${basedir}/src/main/groovy" />
- <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
- <classpath refid="maven.compile.classpath" />
- </taskdef>
- <mkdir dir="${project.build.outputDirectory}" />
- <groovyc destdir="${project.build.outputDirectory}" srcdir="${basedir}/src/main/groovy/"
- listfiles="true">
- <classpath refid="maven.compile.classpath" />
- </groovyc>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>test-compile</id>
- <phase>test-compile</phase>
- <configuration>
- <tasks>
- <mkdir dir="${basedir}/src/test/groovy" />
- <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
- <classpath refid="maven.test.classpath" />
- </taskdef>
- <mkdir dir="${project.build.testOutputDirectory}" />
- <groovyc destdir="${project.build.testOutputDirectory}" srcdir="${basedir}/src/test/groovy/"
- listfiles="true">
- <classpath refid="maven.test.classpath" />
- </groovyc>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
@@ -161,8 +109,8 @@
</plugins>
<pluginManagement>
<plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings
- only. It has no influence on the Maven build itself. -->
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
@@ -173,14 +121,14 @@
<pluginExecution>
<pluginExecutionFilter>
<groupId>
- org.apache.maven.plugins
- </groupId>
+ org.apache.maven.plugins
+ </groupId>
<artifactId>
- maven-antrun-plugin
- </artifactId>
+ maven-antrun-plugin
+ </artifactId>
<versionRange>
- [1.3,)
- </versionRange>
+ [1.3,)
+ </versionRange>
<goals>
<goal>run</goal>
</goals>
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy
index ee70dcc89c..ecd90165c2 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy
@@ -24,7 +24,7 @@ package org.onap.so.bpmn.common.scripts
import org.onap.so.logger.LoggingAnchor
import org.onap.so.client.HttpClientFactory
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import java.util.regex.Matcher
import java.util.regex.Pattern
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
index 976ad1466d..e83e7e2ea2 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
@@ -32,6 +32,7 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse
import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.client.HttpClientFactory
import org.onap.so.client.aai.AAIResourcesClient
import org.springframework.web.util.UriUtils
import org.slf4j.Logger
@@ -677,4 +678,8 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
public AAIResourcesClient getAAIClient(){
return new AAIResourcesClient();
}
+
+ HttpClientFactory getHttpClientFactory(){
+ return new HttpClientFactory()
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy
index 4df38edcc3..e5fff9c100 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy
@@ -24,7 +24,7 @@ package org.onap.so.bpmn.common.scripts
import org.onap.so.logger.LoggingAnchor
import org.onap.so.client.aai.entities.AAIResultWrapper
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import static org.apache.commons.lang3.StringUtils.isBlank;
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy
index c843cc35fe..6b021834b3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy
@@ -28,7 +28,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.appc.client.lcm.model.Action
import org.onap.so.client.appc.ApplicationControllerAction
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
index 83784e1960..7b49fa06b3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
@@ -32,7 +32,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy
index 841fe9f50e..48a8e60095 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy
@@ -27,7 +27,7 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.db.request.beans.InfraActiveRequests
import org.onap.so.db.request.client.RequestsDbClient
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
index b666c8d19d..9c8d8bfa12 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
@@ -30,7 +30,7 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
index 569d4b75b9..24375e59cc 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
@@ -32,7 +32,7 @@ import org.onap.so.client.aai.entities.Relationships
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
index 163e914238..c0124cfd50 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
@@ -22,10 +22,10 @@
package org.onap.so.bpmn.common.scripts
-import org.onap.so.logger.LoggingAnchor
import org.apache.commons.lang.StringUtils
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.GenericVnf
+import org.onap.aai.domain.yang.GenericVnfs
import org.onap.so.bpmn.core.RollbackData
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
@@ -33,7 +33,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.db.catalog.beans.OrchestrationStatus
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -151,15 +152,13 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
AAIResourceUri uri
def vnfId = execution.getVariable("CAAIVfMod_vnfId")
def vnfName = execution.getVariable("CAAIVfMod_vnfName")
+ Optional<GenericVnf> genericVnfOp
if (vnfId == null || vnfId.isEmpty()) {
- uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF)
- uri.queryParam("vnf-name", vnfName)
+ genericVnfOp = getAAIClient().getFirst(GenericVnfs.class, GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE))
} else {
- uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ genericVnfOp = getAAIClient().get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
}
- uri.depth(Depth.ONE)
try {
- Optional<GenericVnf> genericVnfOp = getAAIClient().get(GenericVnf.class, uri)
if(genericVnfOp.isPresent()){
execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode", 200)
execution.setVariable("CAAIVfMod_queryGenericVnfResponse", genericVnfOp.get())
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
index 4d57b1b26f..4b33676955 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
@@ -29,7 +29,7 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
index 195b1fc0d6..38f7bf445f 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
@@ -23,7 +23,7 @@
package org.onap.so.bpmn.common.scripts
import org.onap.so.logger.LoggingAnchor
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import static org.apache.commons.lang3.StringUtils.*
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy
index 8306f33592..c294f1b8c3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy
@@ -26,7 +26,7 @@ import org.onap.so.logger.LoggingAnchor
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.db.request.beans.InfraActiveRequests
import org.onap.so.db.request.client.RequestsDbClient
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.bpmn.core.UrnPropertiesReader;
import java.text.SimpleDateFormat
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
index 6d4b50f690..203ccb97f6 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
@@ -25,7 +25,7 @@ package org.onap.so.bpmn.common.scripts
import org.onap.so.logger.LoggingAnchor
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.client.HttpClientFactory
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import java.io.Serializable;
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy
index 615964b2a9..a1e3576d86 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy
@@ -23,7 +23,7 @@
package org.onap.so.bpmn.common.scripts
import org.onap.so.logger.LoggingAnchor
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import static org.apache.commons.lang3.StringUtils.*;
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
index a2f5dfbffe..eea476a278 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
@@ -23,7 +23,7 @@
package org.onap.so.bpmn.common.scripts
import org.onap.so.logger.LoggingAnchor
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import java.text.SimpleDateFormat
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
index 606b97bec2..34cbb00735 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.common.scripts
+import com.fasterxml.jackson.databind.ObjectMapper
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -529,4 +530,24 @@ class OofUtils {
return UriBuilder.fromPath("").host(msbHost).port(msbPort).scheme("http").build().toString()
}
+
+ public String buildSelectNSTRequest(String requestId, Map<String, Object> profileInfo) {
+ def transactionId = requestId
+ logger.debug( "transactionId is: " + transactionId)
+ ObjectMapper objectMapper = new ObjectMapper()
+ String json = objectMapper.writeValueAsString(profileInfo)
+ StringBuilder response = new StringBuilder()
+ response.append(
+ "{\n" +
+ " \"requestInfo\": {\n" +
+ " \"transactionId\": \"${transactionId}\",\n" +
+ " \"requestId\": \"${requestId}\",\n" +
+ " \"sourceId\": \"so\",\n" +
+ " \"timeout\": 600\n" +
+ " },\n")
+ response.append(",\n \"serviceInfo\": \n")
+ response.append(json);
+ response.append("\n }\n")
+ return response.toString()
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy
index 39e6db4d3f..f012eabe5e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy
@@ -30,7 +30,7 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtil.groovy
new file mode 100644
index 0000000000..b35042e3c0
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtil.groovy
@@ -0,0 +1,119 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.common.scripts
+
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.db.request.beans.OperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.springframework.web.util.UriUtils
+
+class RequestDBUtil {
+ private static final Logger logger = LoggerFactory.getLogger( RequestDBUtil.class);
+ private ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ /**
+ * update operation status in requestDB
+ * @param execution
+ * @param operationStatus
+ */
+ void prepareUpdateOperationStatus(DelegateExecution execution, final OperationStatus operationStatus){
+ logger.debug("start prepareUpdateOperationStatus")
+ try{
+ def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
+ execution.setVariable("dbAdapterEndpoint", dbAdapterEndpoint)
+ logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+
+ String serviceId = operationStatus.getServiceId()
+ serviceId = UriUtils.encode(serviceId,"UTF-8")
+ String operationId = operationStatus.getOperationId()
+ String userId = operationStatus.getUserId()
+ String operationType = operationStatus.getOperation()
+ String result = operationStatus.getResult()
+ String progress = operationStatus.getProgress()
+ String operationContent = operationStatus.getOperationContent()?: ""
+ String reason = operationStatus.getReason()?: ""
+
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.onap.so/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
+ <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
+ <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
+ <operationType>${MsoUtils.xmlEscape(operationType)}</operationType>
+ <userId>${MsoUtils.xmlEscape(userId)}</userId>
+ <result>${MsoUtils.xmlEscape(result)}</result>
+ <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent>
+ <progress>${MsoUtils.xmlEscape(progress)}</progress>
+ <reason>${MsoUtils.xmlEscape(reason)}</reason>
+ </ns:updateServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+ execution.setVariable("updateOperationStatus", payload)
+
+ }catch(any){
+ String exceptionMessage = "Prepare update ServiceOperationStatus failed. cause - " + any.getMessage()
+ logger.debug(exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ logger.trace("finished update OperationStatus")
+ }
+
+
+ /**
+ * get operation status from requestDB by serviceId and operationId
+ * @param execution
+ * @param serviceId
+ * @param operationId
+ */
+ void getOperationStatus(DelegateExecution execution, String serviceId, String operationId) {
+ logger.trace("start getOperationStatus")
+ try {
+ def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
+ execution.setVariable("dbAdapterEndpoint", dbAdapterEndpoint)
+ logger.trace("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+
+ serviceId = UriUtils.encode(serviceId,"UTF-8")
+ operationId = UriUtils.encode(operationId,"UTF-8")
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.onap.so/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:getServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
+ <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
+ <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
+ </ns:getServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+ execution.setVariable("getOperationStatus", payload)
+
+ } catch(any){
+ String exceptionMessage = "Get ServiceOperationStatus failed. cause - " + any.getMessage()
+ logger.error(exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
index db39358ccd..f9119dcb1d 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
@@ -24,7 +24,7 @@ package org.onap.so.bpmn.common.scripts
import org.onap.so.logger.LoggingAnchor
import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import java.text.SimpleDateFormat
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
index 52d6758b2b..ebaf65ff81 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
@@ -24,7 +24,7 @@ package org.onap.so.bpmn.common.scripts
import org.onap.so.logger.LoggingAnchor
import org.onap.so.client.HttpClientFactory
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import java.text.SimpleDateFormat
import javax.ws.rs.core.Response
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
index ba5145d19b..753d4403f3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
@@ -23,7 +23,7 @@
package org.onap.so.bpmn.common.scripts
import org.onap.so.logger.LoggingAnchor
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import java.text.SimpleDateFormat
import java.net.URLEncoder
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
index f24eda813d..2455305b4e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
@@ -28,7 +28,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.L3Network
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.springframework.web.util.UriUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.logger.MessageEnum
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy
index 30964aa4ec..8075944c8c 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy
@@ -25,7 +25,7 @@ package org.onap.so.bpmn.common.scripts
import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.apache.commons.lang3.*
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
index 8f409fa13e..f19933fa8b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
@@ -31,7 +31,7 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy
index 20aeb11c5f..cfa384dc50 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy
@@ -23,7 +23,7 @@
package org.onap.so.bpmn.common.scripts
import org.onap.so.logger.LoggingAnchor
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import javax.xml.parsers.DocumentBuilder
import javax.xml.parsers.DocumentBuilderFactory
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
index 803a3f71de..a6aacc7ea5 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
@@ -24,7 +24,7 @@ package org.onap.so.bpmn.common.scripts
import org.onap.so.logger.LoggingAnchor
import org.onap.so.client.HttpClientFactory
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import javax.ws.rs.core.Response
import org.apache.commons.lang3.*
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy
index 6cfa2a1a64..91b29d3867 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy
@@ -26,7 +26,7 @@ import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java
index d9356306b7..bd31c552d3 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java
@@ -34,7 +34,7 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.onap.so.bpmn.core.UrnPropertiesReader;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.utils.CryptoUtils;
import org.slf4j.Logger;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java
index 047b1f3930..204611cb8f 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java
@@ -26,7 +26,7 @@ package org.onap.so.bpmn.common.workflow.context;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.TimeUnit;
import org.onap.so.logger.LoggingAnchor;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index e7e51bba77..f0954c3695 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -662,6 +662,7 @@ public class BBInputSetup implements JavaDelegate {
}
protected void populateVolumeGroup(BBInputSetupParameter parameter) throws Exception {
+ String replaceVnfModelCustomizationUUID = null;
VolumeGroup volumeGroup = null;
GenericVnf vnf = null;
String vnfModelCustomizationUUID = null;
@@ -674,7 +675,11 @@ public class BBInputSetup implements JavaDelegate {
for (RelatedInstanceList relatedInstList : parameter.getRelatedInstanceList()) {
RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
- vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid();
+ if (parameter.getIsReplace()) {
+ replaceVnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
+ } else {
+ vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
+ }
break;
}
}
@@ -685,8 +690,13 @@ public class BBInputSetup implements JavaDelegate {
vnfModelCustomizationUUID =
bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId();
ModelInfo vnfModelInfo = new ModelInfo();
- vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
- mapCatalogVnf(tempVnf, vnfModelInfo, parameter.getService());
+ if (parameter.getIsReplace()) {
+ vnfModelInfo.setModelCustomizationUuid(replaceVnfModelCustomizationUUID);
+ mapCatalogVnf(tempVnf, vnfModelInfo, parameter.getServiceModel().getNewService());
+ } else {
+ vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
+ mapCatalogVnf(tempVnf, vnfModelInfo, parameter.getServiceModel().getCurrentService());
+ }
break;
}
}
@@ -696,6 +706,22 @@ public class BBInputSetup implements JavaDelegate {
&& volumeGroupTemp.getVolumeGroupId()
.equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.VOLUME_GROUP_ID))) {
volumeGroup = volumeGroupTemp;
+ if (volumeGroup.getModelInfoVfModule() == null) {
+ throw new Exception(
+ "ModelInfoVfModule is null for VolumeGroup: " + volumeGroup.getVolumeGroupId());
+ }
+ String volumeGroupCustId = volumeGroup.getModelInfoVfModule().getModelCustomizationUUID();
+ ModelInfo modelInfoVolumeGroup = new ModelInfo();
+ modelInfoVolumeGroup.setModelCustomizationId(volumeGroupCustId);
+ if (parameter.getIsReplace() && parameter.getLookupKeyMap().get(ResourceKey.VOLUME_GROUP_ID) != null
+ && volumeGroupTemp.getVolumeGroupId()
+ .equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.VOLUME_GROUP_ID))) {
+ mapCatalogVolumeGroup(volumeGroupTemp, modelInfoVolumeGroup,
+ parameter.getServiceModel().getNewService(), replaceVnfModelCustomizationUUID);
+ } else {
+ mapCatalogVolumeGroup(volumeGroupTemp, modelInfoVolumeGroup,
+ parameter.getServiceModel().getCurrentService(), vnfModelCustomizationUUID);
+ }
break;
}
}
@@ -703,10 +729,13 @@ public class BBInputSetup implements JavaDelegate {
volumeGroup = createVolumeGroup(parameter.getLookupKeyMap(), parameter.getResourceId(),
parameter.getInstanceName(), generatedVnfType, parameter.getInstanceParams());
vnf.getVolumeGroups().add(volumeGroup);
- }
- if (volumeGroup != null) {
- mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(), parameter.getService(),
- vnfModelCustomizationUUID);
+ if (parameter.getIsReplace()) {
+ mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(),
+ parameter.getServiceModel().getNewService(), replaceVnfModelCustomizationUUID);
+ } else {
+ mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(),
+ parameter.getServiceModel().getCurrentService(), vnfModelCustomizationUUID);
+ }
}
} else {
logger.debug("Related VNF instance Id not found: {}",
@@ -1514,6 +1543,9 @@ public class BBInputSetup implements JavaDelegate {
parameter.setInstanceName(vfModules.getVolumeGroupInstanceName());
parameter.setVnfType(vnfType);
parameter.setInstanceParams(vfModules.getInstanceParams());
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
+ parameter.setServiceModel(serviceModel);
this.populateVolumeGroup(parameter);
} else {
parameter.setResourceId(lookupKeyMap.get(ResourceKey.VF_MODULE_ID));
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
index 28ec71b13f..67d073d7b6 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
@@ -186,6 +186,9 @@ public class BBInputSetupMapperLayer {
protected VolumeGroup mapAAIVolumeGroup(org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup) {
VolumeGroup volumeGroup = modelMapper.map(aaiVolumeGroup, VolumeGroup.class);
+ ModelInfoVfModule modelInfo = new ModelInfoVfModule();
+ modelInfo.setModelCustomizationUUID(aaiVolumeGroup.getModelCustomizationId());
+ volumeGroup.setModelInfoVfModule(modelInfo);
volumeGroup.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVolumeGroup.getOrchestrationStatus()));
return volumeGroup;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
index ec7b613727..85f5f1f728 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
@@ -24,6 +24,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -51,6 +52,7 @@ import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.entities.uri.Depth;
@@ -313,68 +315,24 @@ public class BBInputSetupUtils {
.depth(Depth.TWO)).orElse(null);
}
- protected org.onap.aai.domain.yang.ServiceInstances getAAIServiceInstancesByName(String serviceInstanceName,
- Customer customer) {
-
- return injectionHelper.getAaiClient()
- .get(org.onap.aai.domain.yang.ServiceInstances.class,
- AAIUriFactory
- .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(),
- customer.getServiceSubscription().getServiceType())
- .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO))
- .orElseGet(() -> {
- logger.debug("No Service Instance matched by name");
- return null;
- });
- }
-
public org.onap.aai.domain.yang.ServiceInstance getAAIServiceInstanceByName(String serviceInstanceName,
Customer customer) throws Exception {
- org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null;
- org.onap.aai.domain.yang.ServiceInstances aaiServiceInstances = null;
- aaiServiceInstances = getAAIServiceInstancesByName(serviceInstanceName, customer);
-
- if (aaiServiceInstances == null) {
- return null;
- } else if (aaiServiceInstances.getServiceInstance().size() > 1) {
- throw new Exception("Multiple Service Instances Returned");
- } else {
- aaiServiceInstance = aaiServiceInstances.getServiceInstance().get(0);
- }
- return aaiServiceInstance;
- }
-
- protected ServiceInstances getAAIServiceInstancesByName(String globalCustomerId, String serviceType,
- String serviceInstanceName) {
+ Optional<org.onap.aai.domain.yang.ServiceInstance> aaiServiceInstance =
+ injectionHelper.getAaiClient()
+ .getOne(ServiceInstances.class, org.onap.aai.domain.yang.ServiceInstance.class, AAIUriFactory
+ .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(),
+ customer.getServiceSubscription().getServiceType())
+ .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO));
- return injectionHelper.getAaiClient()
- .get(ServiceInstances.class,
- AAIUriFactory
- .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, globalCustomerId, serviceType)
- .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO))
- .orElseGet(() -> {
- logger.debug("No Service Instance matched by name");
- return null;
- });
+ return aaiServiceInstance.orElse(null);
}
public Optional<ServiceInstance> getAAIServiceInstanceByName(String globalCustomerId, String serviceType,
- String serviceInstanceName) throws MultipleObjectsFoundException {
- ServiceInstance aaiServiceInstance = null;
- ServiceInstances aaiServiceInstances = null;
- aaiServiceInstances = getAAIServiceInstancesByName(globalCustomerId, serviceType, serviceInstanceName);
+ String serviceInstanceName) {
- if (aaiServiceInstances == null) {
- return Optional.empty();
- } else if (aaiServiceInstances.getServiceInstance().size() > 1) {
- String message = String.format(
- "Multiple service instances found for customer-id: %s, service-type: %s and service-instance-name: %s.",
- globalCustomerId, serviceType, serviceInstanceName);
- throw new MultipleObjectsFoundException(message);
- } else {
- aaiServiceInstance = aaiServiceInstances.getServiceInstance().get(0);
- }
- return Optional.of(aaiServiceInstance);
+ return injectionHelper.getAaiClient().getOne(ServiceInstances.class, ServiceInstance.class,
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, globalCustomerId, serviceType)
+ .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO));
}
public org.onap.so.db.catalog.beans.InstanceGroup getCatalogInstanceGroup(String modelUUID) {
@@ -398,74 +356,43 @@ public class BBInputSetupUtils {
}
public Configuration getAAIConfiguration(String configurationId) {
- return this.injectionHelper.getAaiClient()
- .get(Configuration.class,
- AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId).depth(Depth.ONE))
- .orElseGet(() -> {
- logger.debug("No Configuration matched by id");
- return null;
- });
+ return this.getConcreteAAIResource(Configuration.class, AAIObjectType.CONFIGURATION, configurationId);
}
public GenericVnf getAAIGenericVnf(String vnfId) {
-
- return this.injectionHelper.getAaiClient()
- .get(GenericVnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE))
- .orElseGet(() -> {
- logger.debug("No Generic Vnf matched by id");
- return null;
- });
+ return getConcreteAAIResource(GenericVnf.class, AAIObjectType.GENERIC_VNF, vnfId);
}
public VpnBinding getAAIVpnBinding(String vpnBindingId) {
-
- return this.injectionHelper.getAaiClient()
- .get(VpnBinding.class,
- AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnBindingId).depth(Depth.ONE))
- .orElseGet(() -> {
- logger.debug("No VpnBinding matched by id");
- return null;
- });
+ return getConcreteAAIResource(VpnBinding.class, AAIObjectType.VPN_BINDING, vpnBindingId);
}
public VolumeGroup getAAIVolumeGroup(String cloudOwnerId, String cloudRegionId, String volumeGroupId) {
- return this.injectionHelper.getAaiClient()
- .get(VolumeGroup.class, AAIUriFactory
- .createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwnerId, cloudRegionId, volumeGroupId)
- .depth(Depth.ONE))
- .orElseGet(() -> {
- logger.debug("No Generic Vnf matched by id");
- return null;
- });
+ return getConcreteAAIResource(VolumeGroup.class, AAIObjectType.VOLUME_GROUP, cloudOwnerId, cloudRegionId,
+ volumeGroupId);
}
public VfModule getAAIVfModule(String vnfId, String vfModuleId) {
- return this.injectionHelper.getAaiClient()
- .get(VfModule.class,
- AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE))
- .orElseGet(() -> {
- logger.debug("No Generic Vnf matched by id");
- return null;
- });
+ return getConcreteAAIResource(VfModule.class, AAIObjectType.VF_MODULE, vnfId, vfModuleId);
}
public L3Network getAAIL3Network(String networkId) {
+ return getConcreteAAIResource(L3Network.class, AAIObjectType.L3_NETWORK, networkId);
+ }
- return this.injectionHelper.getAaiClient()
- .get(L3Network.class,
- AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE))
- .orElseGet(() -> {
- logger.debug("No Generic Vnf matched by id");
+ private <T> T getConcreteAAIResource(Class<T> clazz, AAIObjectType objectType, Object... ids) {
+ return injectionHelper.getAaiClient()
+ .get(clazz, AAIUriFactory.createResourceUri(objectType, ids).depth(Depth.ONE)).orElseGet(() -> {
+ logger.debug("No resource of type: {} matched by ids: {}", objectType.typeName(),
+ Arrays.toString(ids));
return null;
});
-
}
public Optional<ServiceInstance> getRelatedServiceInstanceFromInstanceGroup(String instanceGroupId)
throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId);
- uri.relatedTo(AAIObjectPlurals.SERVICE_INSTANCE);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)
+ .relatedTo(AAIObjectPlurals.SERVICE_INSTANCE);
Optional<ServiceInstances> serviceInstances = injectionHelper.getAaiClient().get(ServiceInstances.class, uri);
ServiceInstance serviceInstance = null;
if (!serviceInstances.isPresent()) {
@@ -487,8 +414,8 @@ public class BBInputSetupUtils {
public Optional<L3Network> getRelatedNetworkByNameFromServiceInstance(String serviceInstanceId, String networkName)
throws MultipleObjectsFoundException {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
- uri.relatedTo(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ .relatedTo(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
Optional<L3Networks> networks = injectionHelper.getAaiClient().get(L3Networks.class, uri);
L3Network network = null;
if (!networks.isPresent()) {
@@ -507,100 +434,36 @@ public class BBInputSetupUtils {
}
}
- public Optional<GenericVnf> getRelatedVnfByNameFromServiceInstance(String serviceInstanceId, String vnfName)
- throws MultipleObjectsFoundException {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
- uri.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName);
- Optional<GenericVnfs> vnfs = injectionHelper.getAaiClient().get(GenericVnfs.class, uri);
- GenericVnf vnf = null;
- if (!vnfs.isPresent()) {
- logger.debug("No Vnfs matched by name");
- return Optional.empty();
- } else {
- if (vnfs.get().getGenericVnf().size() > 1) {
- String message = String.format("Multiple vnfs found for service-instance-id: %s and vnf-name: %s.",
- serviceInstanceId, vnfName);
- throw new MultipleObjectsFoundException(message);
- } else {
- vnf = vnfs.get().getGenericVnf().get(0);
- }
- return Optional.of(vnf);
- }
+ public Optional<GenericVnf> getRelatedVnfByNameFromServiceInstance(String serviceInstanceId, String vnfName) {
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ .relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName);
+ return injectionHelper.getAaiClient().getOne(GenericVnfs.class, GenericVnf.class, uri);
+
}
- public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVnf(String vnfId, String volumeGroupName)
- throws MultipleObjectsFoundException {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
- uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName);
- Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
- VolumeGroup volumeGroup = null;
- if (!volumeGroups.isPresent()) {
- logger.debug("No VolumeGroups matched by name");
- return Optional.empty();
- } else {
- if (volumeGroups.get().getVolumeGroup().size() > 1) {
- String message = String.format("Multiple volume-groups found for vnf-id: %s and volume-group-name: %s.",
- vnfId, volumeGroupName);
- throw new MultipleObjectsFoundException(message);
- } else {
- volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
- }
- return Optional.of(volumeGroup);
- }
+ public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVnf(String vnfId, String volumeGroupName) {
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName);
+ return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri);
}
public Optional<VolumeGroup> getRelatedVolumeGroupByIdFromVnf(String vnfId, String volumeGroupId) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
- uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-id", volumeGroupId);
- Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
- VolumeGroup volumeGroup = null;
- if (!volumeGroups.isPresent()) {
- logger.debug("No VolumeGroups matched by id");
- return Optional.empty();
- } else {
- volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
- return Optional.of(volumeGroup);
- }
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-id", volumeGroupId);
+ return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri);
}
public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vnfId, String vfModuleId,
- String volumeGroupName) throws MultipleObjectsFoundException {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
- uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName);
- Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
- VolumeGroup volumeGroup = null;
- if (!volumeGroups.isPresent()) {
- logger.debug("No VolumeGroups matched by name");
- return Optional.empty();
- } else {
- if (volumeGroups.get().getVolumeGroup().size() > 1) {
- String message = String.format(
- "Multiple voulme-groups found for vnf-id: %s, vf-module-id: %s and volume-group-name: %s.",
- vnfId, vfModuleId, volumeGroupName);
- throw new MultipleObjectsFoundException(message);
- } else {
- volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
- }
- return Optional.of(volumeGroup);
- }
+ String volumeGroupName) throws Exception {
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName);
+ return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri);
}
public Optional<VolumeGroup> getRelatedVolumeGroupFromVfModule(String vnfId, String vfModuleId) throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
- uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP);
- Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
- VolumeGroup volumeGroup = null;
- if (!volumeGroups.isPresent()) {
- logger.debug("VfModule does not have a volume group attached");
- return Optional.empty();
- } else {
- if (volumeGroups.get().getVolumeGroup().size() > 1) {
- throw new Exception("Multiple VolumeGroups Returned");
- } else {
- volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
- }
- return Optional.of(volumeGroup);
- }
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP);
+ return injectionHelper.getAaiClient().getOne(VolumeGroups.class, VolumeGroup.class, uri);
}
public Optional<org.onap.aai.domain.yang.VpnBinding> getAICVpnBindingFromNetwork(
@@ -628,26 +491,26 @@ public class BBInputSetupUtils {
public boolean existsAAINetworksGloballyByName(String networkName) {
- AAIResourceUri l3networkUri =
+ AAIPluralResourceUri l3networkUri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
AAIResourcesClient aaiRC = injectionHelper.getAaiClient();
return aaiRC.exists(l3networkUri);
}
public boolean existsAAIVfModuleGloballyByName(String vfModuleName) {
- AAIResourceUri vfModuleUri =
+ AAIPluralResourceUri vfModuleUri =
AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE).queryParam("vf-module-name", vfModuleName);
return injectionHelper.getAaiClient().exists(vfModuleUri);
}
public boolean existsAAIConfigurationGloballyByName(String configurationName) {
- AAIResourceUri configUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
+ AAIPluralResourceUri configUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
.queryParam("configuration-name", configurationName);
return injectionHelper.getAaiClient().exists(configUri);
}
public boolean existsAAIVolumeGroupGloballyByName(String volumeGroupName) {
- AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
.queryParam("volume-group-name", volumeGroupName);
return injectionHelper.getAaiClient().exists(volumeGroupUri);
}
@@ -664,24 +527,9 @@ public class BBInputSetupUtils {
}
public Optional<Configuration> getRelatedConfigurationByNameFromServiceInstance(String serviceInstanceId,
- String configurationName) throws MultipleObjectsFoundException {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId);
- uri.relatedTo(AAIObjectPlurals.CONFIGURATION).queryParam("configuration-name", configurationName);
- Optional<Configurations> configurations = injectionHelper.getAaiClient().get(Configurations.class, uri);
- Configuration configuration = null;
- if (!configurations.isPresent()) {
- logger.debug("No Configurations matched by name");
- return Optional.empty();
- } else {
- if (configurations.get().getConfiguration().size() > 1) {
- String message = String.format(
- "Multiple configurations found for service-instance-d: %s and configuration-name: %s.",
- serviceInstanceId, configurationName);
- throw new MultipleObjectsFoundException(message);
- } else {
- configuration = configurations.get().getConfiguration().get(0);
- }
- return Optional.of(configuration);
- }
+ String configurationName) {
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ .relatedTo(AAIObjectPlurals.CONFIGURATION).queryParam("configuration-name", configurationName);
+ return injectionHelper.getAaiClient().getOne(Configurations.class, Configuration.class, uri);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java
index 424a4f3ecc..51b1a218c8 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtils.java
@@ -22,14 +22,18 @@
package org.onap.so.client.cds;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
+import com.google.protobuf.InvalidProtocolBufferException;
+import com.google.protobuf.Struct;
+import com.google.protobuf.Struct.Builder;
+import com.google.protobuf.util.JsonFormat;
+import io.grpc.Status;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader;
import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.client.PreconditionFailedException;
import org.onap.so.client.RestPropertiesLoader;
import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
@@ -39,15 +43,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import com.google.protobuf.InvalidProtocolBufferException;
-import com.google.protobuf.Struct;
-import com.google.protobuf.Struct.Builder;
-import com.google.protobuf.util.JsonFormat;
-import io.grpc.Status;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
/**
* Util class to support Call to CDS client
- *
*/
@Component
public class AbstractCDSProcessingBBUtils {
@@ -58,13 +58,9 @@ public class AbstractCDSProcessingBBUtils {
private static final String FAILED = "Failed";
private static final String PROCESSING = "Processing";
private static final String RESPONSE_PAYLOAD = "CDSResponsePayload";
- private static final String CDS_STATUS = "CDSStatus";
+ private static final String CDS_STATUS = "ControllerStatus";
private static final String EXEC_INPUT = "executionServiceInput";
-
-
- /**
- * indicate exception thrown.
- */
+ private static final String EXECUTION_OBJECT = "executionObject";
private static final String EXCEPTION = "Exception";
@Autowired
@@ -76,34 +72,33 @@ public class AbstractCDSProcessingBBUtils {
* @param execution DelegateExecution object
*/
public void constructExecutionServiceInputObject(DelegateExecution execution) {
- logger.trace("Start AbstractCDSProcessingBBUtils.preProcessRequest ");
+ logger.trace("Start AbstractCDSProcessingBBUtils.preProcessRequest for DelegateExecution object.");
try {
AbstractCDSPropertiesBean executionObject =
- (AbstractCDSPropertiesBean) execution.getVariable("executionObject");
-
- String payload = executionObject.getRequestObject();
-
- CommonHeader commonHeader = CommonHeader.newBuilder().setOriginatorId(executionObject.getOriginatorId())
- .setRequestId(executionObject.getRequestId()).setSubRequestId(executionObject.getSubRequestId())
- .build();
- ActionIdentifiers actionIdentifiers =
- ActionIdentifiers.newBuilder().setBlueprintName(executionObject.getBlueprintName())
- .setBlueprintVersion(executionObject.getBlueprintVersion())
- .setActionName(executionObject.getActionName()).setMode(executionObject.getMode()).build();
-
- Builder struct = Struct.newBuilder();
- try {
- JsonFormat.parser().merge(payload, struct);
- } catch (InvalidProtocolBufferException e) {
- logger.error("Failed to parse received message. blueprint({}:{}) for action({}). {}",
- executionObject.getBlueprintVersion(), executionObject.getBlueprintName(),
- executionObject.getActionName(), e);
- }
+ (AbstractCDSPropertiesBean) execution.getVariable(EXECUTION_OBJECT);
+
+ ExecutionServiceInput executionServiceInput = prepareExecutionServiceInput(executionObject);
+
+ execution.setVariable(EXEC_INPUT, executionServiceInput);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
- ExecutionServiceInput executionServiceInput =
- ExecutionServiceInput.newBuilder().setCommonHeader(commonHeader)
- .setActionIdentifiers(actionIdentifiers).setPayload(struct.build()).build();
+ /**
+ * Extracting data from execution object and building the ExecutionServiceInput Object
+ *
+ * @param execution BuildingBlockExecution object
+ */
+ public void constructExecutionServiceInputObject(BuildingBlockExecution execution) {
+ logger.trace("Start AbstractCDSProcessingBBUtils.preProcessRequest for BuildingBlockExecution object.");
+
+ try {
+ AbstractCDSPropertiesBean executionObject = execution.getVariable(EXECUTION_OBJECT);
+
+ ExecutionServiceInput executionServiceInput = prepareExecutionServiceInput(executionObject);
execution.setVariable(EXEC_INPUT, executionServiceInput);
@@ -119,50 +114,98 @@ public class AbstractCDSProcessingBBUtils {
*/
public void sendRequestToCDSClient(DelegateExecution execution) {
- logger.trace("Start AbstractCDSProcessingBBUtils.sendRequestToCDSClient ");
+ logger.trace("Start AbstractCDSProcessingBBUtils.sendRequestToCDSClient for DelegateExecution object.");
try {
- CDSProperties props = RestPropertiesLoader.getInstance().getNewImpl(CDSProperties.class);
- if (props == null) {
- throw new PreconditionFailedException(
- "No RestProperty.CDSProperties implementation found on classpath, can't create client.");
- }
-
ExecutionServiceInput executionServiceInput = (ExecutionServiceInput) execution.getVariable(EXEC_INPUT);
+ CDSResponse cdsResponse = getCdsResponse(executionServiceInput);
+ execution.setVariable(CDS_STATUS, cdsResponse.status);
- CDSResponse cdsResponse = new CDSResponse();
-
- try (CDSProcessingClient cdsClient = new CDSProcessingClient(new ResponseHandler(cdsResponse))) {
- CountDownLatch countDownLatch = cdsClient.sendRequest(executionServiceInput);
- countDownLatch.await(props.getTimeout(), TimeUnit.SECONDS);
- } catch (InterruptedException ex) {
- logger.error("Caught exception in sendRequestToCDSClient in AbstractCDSProcessingBBUtils : ", ex);
- Thread.currentThread().interrupt();
+ if (cdsResponse.payload != null) {
+ String payload = JsonFormat.printer().print(cdsResponse.payload);
+ execution.setVariable(RESPONSE_PAYLOAD, payload);
}
- String cdsResponseStatus = cdsResponse.status;
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
- /**
- * throw CDS failed exception.
- */
- if (!cdsResponseStatus.equals(SUCCESS)) {
- throw new BadResponseException("CDS call failed with status: " + cdsResponse.status
- + " and errorMessage: " + cdsResponse.errorMessage);
- }
+ /**
+ * get the executionServiceInput object from execution and send a request to CDS Client and wait for TIMEOUT period
+ *
+ * @param execution BuildingBlockExecution object
+ */
+ public void sendRequestToCDSClient(BuildingBlockExecution execution) {
- execution.setVariable(CDS_STATUS, cdsResponseStatus);
+ logger.trace("Start AbstractCDSProcessingBBUtils.sendRequestToCDSClient for BuildingBlockExecution object.");
+ try {
+ ExecutionServiceInput executionServiceInput = execution.getVariable(EXEC_INPUT);
+ CDSResponse cdsResponse = getCdsResponse(executionServiceInput);
+ execution.setVariable(CDS_STATUS, cdsResponse.status);
if (cdsResponse.payload != null) {
String payload = JsonFormat.printer().print(cdsResponse.payload);
execution.setVariable(RESPONSE_PAYLOAD, payload);
}
-
-
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ private CDSResponse getCdsResponse(ExecutionServiceInput executionServiceInput) throws BadResponseException {
+ CDSProperties props = RestPropertiesLoader.getInstance().getNewImpl(CDSProperties.class);
+ if (props == null) {
+ throw new PreconditionFailedException(
+ "No RestProperty.CDSProperties implementation found on classpath, can't create client.");
+ }
+
+ CDSResponse cdsResponse = new CDSResponse();
+
+ try (CDSProcessingClient cdsClient = new CDSProcessingClient(new ResponseHandler(cdsResponse))) {
+ CountDownLatch countDownLatch = cdsClient.sendRequest(executionServiceInput);
+ countDownLatch.await(props.getTimeout(), TimeUnit.SECONDS);
+ } catch (InterruptedException ex) {
+ logger.error("Caught exception in sendRequestToCDSClient in AbstractCDSProcessingBBUtils : ", ex);
+ Thread.currentThread().interrupt();
+ }
+
+ String cdsResponseStatus = cdsResponse.status;
+
+ /**
+ * throw CDS failed exception.
+ */
+ if (!cdsResponseStatus.equals(SUCCESS)) {
+ throw new BadResponseException("CDS call failed with status: " + cdsResponse.status + " and errorMessage: "
+ + cdsResponse.errorMessage);
+ }
+ return cdsResponse;
+ }
+
+ private ExecutionServiceInput prepareExecutionServiceInput(AbstractCDSPropertiesBean executionObject) {
+ String payload = executionObject.getRequestObject();
+
+ CommonHeader commonHeader = CommonHeader.newBuilder().setOriginatorId(executionObject.getOriginatorId())
+ .setRequestId(executionObject.getRequestId()).setSubRequestId(executionObject.getSubRequestId())
+ .build();
+ ActionIdentifiers actionIdentifiers =
+ ActionIdentifiers.newBuilder().setBlueprintName(executionObject.getBlueprintName())
+ .setBlueprintVersion(executionObject.getBlueprintVersion())
+ .setActionName(executionObject.getActionName()).setMode(executionObject.getMode()).build();
+
+ Builder struct = Struct.newBuilder();
+ try {
+ JsonFormat.parser().merge(payload, struct);
+ } catch (InvalidProtocolBufferException e) {
+ logger.error("Failed to parse received message. blueprint({}:{}) for action({}). {}",
+ executionObject.getBlueprintVersion(), executionObject.getBlueprintName(),
+ executionObject.getActionName(), e);
+ }
+
+ return ExecutionServiceInput.newBuilder().setCommonHeader(commonHeader).setActionIdentifiers(actionIdentifiers)
+ .setPayload(struct.build()).build();
+ }
+
private class ResponseHandler implements CDSProcessingListener {
private CDSResponse cdsResponse;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/CDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/CDSRequestProvider.java
new file mode 100644
index 0000000000..e01de69b74
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/CDSRequestProvider.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Bell Canada
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.client.cds;
+
+import com.google.gson.JsonObject;
+import org.onap.so.client.exception.PayloadGenerationException;
+import java.util.Optional;
+import static org.onap.so.client.cds.PayloadConstants.REQUEST;
+import static org.onap.so.client.cds.PayloadConstants.SEPARATOR;
+
+public interface CDSRequestProvider {
+
+ /**
+ * Build entire payload for CDS.
+ *
+ * @param action - action could be assign/deploy/undeploy etc.
+ * @return "payload":{ "config-<action>-<scope>":{ // information about resolution key, property configuration and
+ * template prefix based on the scope and action}
+ * @throws PayloadGenerationException If fail to build the payload.
+ */
+ Optional<String> buildRequestPayload(String action) throws PayloadGenerationException;
+
+ /**
+ * Get the blueprint name for CDS payload
+ *
+ * @return blueprint name
+ */
+ String getBlueprintName();
+
+ /**
+ * Get the blueprint version for CDS payload
+ *
+ * @return blueprint version
+ */
+ String getBlueprintVersion();
+
+ /**
+ * Set the executionObject(BuildingBlockExecution or DelegateExecution for PNF)
+ *
+ * @param executionObject object could be BuildingBlockExecution or DelegateExecution.
+ */
+ <T> void setExecutionObject(T executionObject);
+
+
+ /**
+ * Build Request payload for CDS
+ *
+ * @param cdsPropertyObject - Json Object
+ * @param action - action could be assign/deploy/undeploy etc.
+ * @return Request Payload
+ */
+ default String buildRequestJsonObject(JsonObject cdsPropertyObject, String action) {
+ String requestBasedOnAction = action.concat(SEPARATOR).concat(REQUEST);
+ JsonObject requestObject = new JsonObject();
+ requestObject.add(requestBasedOnAction, cdsPropertyObject);
+ return requestObject.toString();
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java
new file mode 100644
index 0000000000..6f850fa898
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModule.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Bell Canada
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.client.cds;
+
+import com.google.gson.JsonObject;
+import org.onap.so.client.cds.ExtractServiceFromUserParameters;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.VfModules;
+import org.onap.so.serviceinstancebeans.Vnfs;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class ConfigureInstanceParamsForVfModule {
+
+ @Autowired
+ private ExtractServiceFromUserParameters extractServiceFromUserParameters;
+
+ /**
+ * Read instance parameters for VF-Module and put into JsonObject.
+ *
+ * @param jsonObject- JsonObject which will hold the payload to send to CDS.
+ * @param userParamsFromRequest - User parameters for a vf-module
+ * @param vnfCustomizationUuid - Unique ID for vnf.
+ * @param vfModuleCustomizationUuid - Unique ID for vf-module.
+ * @throws PayloadGenerationException- If it doesn't able to populate instance parameters from SO payload.
+ */
+ public void populateInstanceParams(JsonObject jsonObject, List<Map<String, Object>> userParamsFromRequest,
+ String vnfCustomizationUuid, String vfModuleCustomizationUuid) throws PayloadGenerationException {
+ try {
+ Service service = extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
+
+ List<Map<String, String>> instanceParamsList =
+ getInstanceParams(service, vnfCustomizationUuid, vfModuleCustomizationUuid);
+
+ instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
+ .forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue()));
+ } catch (Exception e) {
+ throw new PayloadGenerationException("Couldn't able to resolve instance parameters", e);
+ }
+ }
+
+ private List<Map<String, String>> getInstanceParams(Service service, String vnfCustomizationUuid,
+ String vfModuleCustomizationUuid) throws PayloadGenerationException {
+
+ Vnfs foundedVnf = service.getResources().getVnfs().stream()
+ .filter(vnfs -> vnfs.getModelInfo().getModelCustomizationId().equals(vnfCustomizationUuid)).findFirst()
+ .orElseThrow(() -> new PayloadGenerationException(String
+ .format("Can not find vnf for genericVnfModelCustomizationUuid: %s", vnfCustomizationUuid)));
+
+ VfModules vfModule = foundedVnf.getVfModules().stream().filter(
+ vfModules -> vfModules.getModelInfo().getModelCustomizationId().equals(vfModuleCustomizationUuid))
+ .findFirst().orElseThrow(() -> new PayloadGenerationException(String
+ .format("Can not find vnf for vfModuleCustomizationUuid: %s", vfModuleCustomizationUuid)));
+
+ return vfModule.getInstanceParams();
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java
new file mode 100644
index 0000000000..22c9a7bee4
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForVnf.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Bell Canada
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.client.cds;
+
+import com.google.gson.JsonObject;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.Vnfs;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+@Component
+public class ConfigureInstanceParamsForVnf {
+
+ @Autowired
+ private ExtractServiceFromUserParameters extractServiceFromUserParameters;
+
+ /**
+ * Read instance parameters for VNF and put into JsonObject.
+ *
+ * @param jsonObject - JsonObject which will hold the payload to send to CDS.
+ * @param userParamsFromRequest - User parameters.
+ * @param modelCustomizationUuid - Unique ID for Vnf.
+ * @throws PayloadGenerationException if it doesn't able to populate instance parameters from SO payload.
+ */
+ public void populateInstanceParams(JsonObject jsonObject, List<Map<String, Object>> userParamsFromRequest,
+ String modelCustomizationUuid) throws PayloadGenerationException {
+ try {
+ Service service = extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest);
+ List<Map<String, String>> instanceParamsList = getInstanceParamForVnf(service, modelCustomizationUuid);
+
+ instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream())
+ .forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue()));
+ } catch (Exception e) {
+ throw new PayloadGenerationException("Couldn't able to resolve instance parameters", e);
+ }
+ }
+
+ private List<Map<String, String>> getInstanceParamForVnf(Service service, String genericVnfModelCustomizationUuid)
+ throws PayloadGenerationException {
+ Optional<Vnfs> foundedVnf = service.getResources().getVnfs().stream()
+ .filter(vnfs -> vnfs.getModelInfo().getModelCustomizationId().equals(genericVnfModelCustomizationUuid))
+ .findFirst();
+
+ if (foundedVnf.isPresent()) {
+ return foundedVnf.get().getInstanceParams();
+ } else {
+ throw new PayloadGenerationException(String.format(
+ "Can not find vnf for genericVnfModelCustomizationUuid: %s", genericVnfModelCustomizationUuid));
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ExtractServiceFromUserParameters.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ExtractServiceFromUserParameters.java
new file mode 100644
index 0000000000..43fabd3253
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ExtractServiceFromUserParameters.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Bell Canada
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.client.cds;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.onap.so.serviceinstancebeans.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class ExtractServiceFromUserParameters {
+
+ private static final String SERVICE_KEY = "service";
+
+ @Autowired
+ private ObjectMapper objectMapper;
+
+ public Service getServiceFromRequestUserParams(List<Map<String, Object>> userParams) throws Exception {
+ Map<String, Object> serviceMap = userParams.stream().filter(key -> key.containsKey(SERVICE_KEY)).findFirst()
+ .orElseThrow(() -> new Exception("Can not find service in userParams section in generalBuildingBlock"));
+ return getServiceObjectFromServiceMap(serviceMap);
+ }
+
+ private Service getServiceObjectFromServiceMap(Map<String, Object> serviceMap) throws PayloadGenerationException {
+ try {
+ String serviceFromJson = objectMapper.writeValueAsString(serviceMap.get(SERVICE_KEY));
+ return objectMapper.readValue(serviceFromJson, Service.class);
+ } catch (Exception e) {
+ throw new PayloadGenerationException("An exception occurred while converting json object to Service object",
+ e);
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/GeneratePayloadForCds.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/GeneratePayloadForCds.java
new file mode 100644
index 0000000000..fb79880572
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/GeneratePayloadForCds.java
@@ -0,0 +1,153 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Bell Canada
+ * ================================================================================
+ * Modifications Copyright (c) 2020 Nordix
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.client.cds;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.util.UUID;
+
+@Component
+public class GeneratePayloadForCds {
+
+ private static final String ORIGINATOR_ID = "SO";
+ private static final String BUILDING_BLOCK = "buildingBlock";
+ private static final String DEFAULT_SYNC_MODE = "sync";
+ private static final String MSO_REQUEST_ID = "msoRequestId";
+
+ @Autowired
+ private VnfCDSRequestProvider vnfCDSRequestProvider;
+
+ @Autowired
+ private VfModuleCDSRequestProvider vfModuleCDSRequestProvider;
+
+ @Autowired
+ private ServiceCDSRequestProvider serviceCDSRequestProvider;
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private PnfCDSRequestProvider pnfCDSRequestProvider;
+
+ /**
+ * Build properties like (blueprint name, version, action etc..) along with the request payload for vnf, vf-module
+ * and service.
+ *
+ * @param execution - A building block execution object.
+ * @return AbstractCDSPropertiesBean - A POJO which contains CDS related information.
+ * @throws PayloadGenerationException - Throw an exception if it fails to build payload for CDS.
+ */
+ public AbstractCDSPropertiesBean buildCdsPropertiesBean(BuildingBlockExecution execution)
+ throws PayloadGenerationException {
+
+ ExecuteBuildingBlock executeBuildingBlock = execution.getVariable(BUILDING_BLOCK);
+ BuildingBlock buildingBlock = executeBuildingBlock.getBuildingBlock();
+ final String requestId = execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId();
+ final String scope = buildingBlock.getBpmnScope();
+ final String action = buildingBlock.getBpmnAction();
+
+
+ CDSRequestProvider requestProvider = getRequestProviderByScope(scope);
+ requestProvider.setExecutionObject(execution);
+
+ final String requestPayload = requestProvider.buildRequestPayload(action)
+ .orElseThrow(() -> new PayloadGenerationException("Failed to build payload for CDS"));
+
+ return prepareAndSetCdsPropertyBean(requestProvider, requestPayload, requestId, action, DEFAULT_SYNC_MODE);
+ }
+
+ /**
+ * Build properties like (blueprint name, version, action etc..) along with the request payload for pnf.
+ *
+ * @param execution - A building block execution object.
+ * @return AbstractCDSPropertiesBean - A POJO which contains CDS related information.
+ * @throws PayloadGenerationException - Throw an exception if it fails to build payload for CDS.
+ */
+ public AbstractCDSPropertiesBean buildCdsPropertiesBean(DelegateExecution execution)
+ throws PayloadGenerationException {
+
+ final String scope = String.valueOf(execution.getVariable(PayloadConstants.SCOPE));
+ final String action = String.valueOf(execution.getVariable(PayloadConstants.ACTION));
+ final String requestId = String.valueOf(execution.getVariable(MSO_REQUEST_ID));
+ final String mode = extractAndSetMode(execution);
+
+ CDSRequestProvider requestProvider = getRequestProviderByScope(scope);
+ requestProvider.setExecutionObject(execution);
+
+ final String requestPayload = requestProvider.buildRequestPayload(action)
+ .orElseThrow(() -> new PayloadGenerationException("Failed to build payload for CDS"));
+
+ return prepareAndSetCdsPropertyBean(requestProvider, requestPayload, requestId, action, mode);
+ }
+
+ private AbstractCDSPropertiesBean prepareAndSetCdsPropertyBean(CDSRequestProvider requestProvider,
+ String requestPayload, String requestId, String action, String mode) {
+ final AbstractCDSPropertiesBean cdsPropertiesBean = new AbstractCDSPropertiesBean();
+ cdsPropertiesBean.setRequestObject(requestPayload);
+ cdsPropertiesBean.setBlueprintName(requestProvider.getBlueprintName());
+ cdsPropertiesBean.setBlueprintVersion(requestProvider.getBlueprintVersion());
+ cdsPropertiesBean.setRequestId(requestId);
+ cdsPropertiesBean.setOriginatorId(ORIGINATOR_ID);
+ cdsPropertiesBean.setSubRequestId(UUID.randomUUID().toString());
+ cdsPropertiesBean.setActionName(action);
+ cdsPropertiesBean.setMode(mode);
+ return cdsPropertiesBean;
+ }
+
+ private String extractAndSetMode(DelegateExecution execution) {
+ String mode = DEFAULT_SYNC_MODE;
+ Object obj = execution.getVariable(PayloadConstants.MODE);
+ if (obj != null && !String.valueOf(obj).isEmpty()) {
+ mode = String.valueOf(obj);
+ }
+ return mode;
+ }
+
+ private CDSRequestProvider getRequestProviderByScope(String scope) throws PayloadGenerationException {
+ CDSRequestProvider requestProvider;
+ switch (scope) {
+ case PayloadConstants.VNF_SCOPE:
+ requestProvider = vnfCDSRequestProvider;
+ break;
+ case PayloadConstants.VF_MODULE_SCOPE:
+ requestProvider = vfModuleCDSRequestProvider;
+ break;
+ case PayloadConstants.SERVICE_SCOPE:
+ requestProvider = serviceCDSRequestProvider;
+ break;
+ case PayloadConstants.PNF_SCOPE:
+ requestProvider = pnfCDSRequestProvider;
+ break;
+ default:
+ throw new PayloadGenerationException("No scope defined with " + scope);
+ }
+ return requestProvider;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java
new file mode 100644
index 0000000000..808d427d65
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PayloadConstants.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Bell Canada
+ * ================================================================================
+ * Modifications Copyright (C) 2020 Nordix
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.client.cds;
+
+public final class PayloadConstants {
+
+ private PayloadConstants() {
+
+ }
+
+ public static final String REQUEST = "request";
+ public static final String PROPERTIES = "properties";
+ public static final String SCOPE = "scope";
+ public static final String ACTION = "action";
+ public static final String MODE = "mode";
+ public static final String SEPARATOR = "-";
+ public static final String PNF_SCOPE = "pnf";
+ public static final String VNF_SCOPE = "vnf";
+ public static final String VF_MODULE_SCOPE = "vfModule";
+ public static final String SERVICE_SCOPE = "service";
+ public static final String RESOLUTION_KEY = "resolution-key";
+ public static final String CDS_ACTOR = "cds";
+
+ public static final String PRC_BLUEPRINT_NAME = "PRC_blueprintName";
+ public static final String PRC_BLUEPRINT_VERSION = "PRC_blueprintVersion";
+ public static final String PRC_CUSTOMIZATION_UUID = "PRC_customizationUuid";
+ public static final String PRC_TARGET_SOFTWARE_VERSION = "targetSoftwareVersion";
+
+ public final static String PNF_CORRELATION_ID = "pnfCorrelationId";
+ public final static String PNF_UUID = "pnfUuid";
+ public final static String SERVICE_INSTANCE_ID = "serviceInstanceId";
+ public final static String MODEL_UUID = "modelUuid";
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PnfCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PnfCDSRequestProvider.java
new file mode 100644
index 0000000000..86bca755ed
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/PnfCDSRequestProvider.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.client.cds;
+
+import com.google.gson.JsonObject;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+import java.util.Optional;
+import static org.onap.so.client.cds.PayloadConstants.*;
+
+@Component
+@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+public class PnfCDSRequestProvider implements CDSRequestProvider {
+ private String blueprintName;
+ private String blueprintVersion;
+ private DelegateExecution execution;
+
+ @Override
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ @Override
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ @Override
+ public <T> void setExecutionObject(T executionObject) {
+ execution = (DelegateExecution) executionObject;
+ }
+
+ @Override
+ public Optional<String> buildRequestPayload(String action) {
+
+ final JsonObject pnfObject = new JsonObject();
+ final String resolutionKey = String.valueOf(execution.getVariable(PNF_CORRELATION_ID));
+ blueprintName = String.valueOf(execution.getVariable(PRC_BLUEPRINT_NAME));
+ blueprintVersion = String.valueOf(execution.getVariable(PRC_BLUEPRINT_VERSION));
+
+ extractAndSetExecutionVariable("service-instance-id", SERVICE_INSTANCE_ID, pnfObject);
+ extractAndSetExecutionVariable("service-model-uuid", MODEL_UUID, pnfObject);
+ extractAndSetExecutionVariable("pnf-id", PNF_UUID, pnfObject);
+ extractAndSetExecutionVariable("pnf-name", PNF_CORRELATION_ID, pnfObject);
+ extractAndSetExecutionVariable("pnf-customization-uuid", PRC_CUSTOMIZATION_UUID, pnfObject);
+ extractAndSetExecutionVariable("target-software-version", PRC_TARGET_SOFTWARE_VERSION, pnfObject);
+
+ final JsonObject cdsPropertyObject = new JsonObject();
+ cdsPropertyObject.addProperty(RESOLUTION_KEY, resolutionKey);
+ cdsPropertyObject.add(action + SEPARATOR + PROPERTIES, pnfObject);
+
+ return Optional.of(buildRequestJsonObject(cdsPropertyObject, action));
+ }
+
+ private void extractAndSetExecutionVariable(String jsonProperty, String executionProperty, JsonObject pnfObject) {
+ if (execution.getVariable(executionProperty) != null) {
+ pnfObject.addProperty(jsonProperty, String.valueOf(execution.getVariable(executionProperty)));
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ServiceCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ServiceCDSRequestProvider.java
new file mode 100644
index 0000000000..12c841a2c6
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ServiceCDSRequestProvider.java
@@ -0,0 +1,89 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Bell Canada
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.client.cds;
+
+import com.google.gson.JsonObject;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+import java.util.Optional;
+import static org.onap.so.client.cds.PayloadConstants.PROPERTIES;
+import static org.onap.so.client.cds.PayloadConstants.SEPARATOR;
+
+@Component
+@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+public class ServiceCDSRequestProvider implements CDSRequestProvider {
+
+ private static final String EMPTY_STRING = "";
+ private String resolutionKey;
+ private BuildingBlockExecution execution;
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Override
+ public String getBlueprintName() {
+ return EMPTY_STRING;
+ }
+
+ @Override
+ public String getBlueprintVersion() {
+ return EMPTY_STRING;
+ }
+
+ @Override
+ public <T> void setExecutionObject(T executionObject) {
+ execution = (BuildingBlockExecution) executionObject;
+ }
+
+ @Override
+ public Optional<String> buildRequestPayload(String action) throws PayloadGenerationException {
+ JsonObject cdsPropertyObject = new JsonObject();
+ JsonObject serviceObject = new JsonObject();
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+
+ resolutionKey = serviceInstance.getServiceInstanceName();
+
+ // TODO Need to figure out how to populate blueprint name and version for service.
+
+ serviceObject.addProperty("service-instance-id", serviceInstance.getServiceInstanceId());
+ serviceObject.addProperty("service-model-uuid",
+ serviceInstance.getModelInfoServiceInstance().getModelUuid());
+
+ } catch (Exception e) {
+ throw new PayloadGenerationException("Failed to buildPropertyObjectForService", e);
+ }
+
+ cdsPropertyObject.addProperty("resolution-key", resolutionKey);
+ cdsPropertyObject.add(action + SEPARATOR + PROPERTIES, serviceObject);
+
+ return Optional.of(buildRequestJsonObject(cdsPropertyObject, action));
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java
new file mode 100644
index 0000000000..bba8925f21
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java
@@ -0,0 +1,121 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Bell Canada
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.client.cds;
+
+import com.google.gson.JsonObject;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import static org.onap.so.client.cds.PayloadConstants.PROPERTIES;
+import static org.onap.so.client.cds.PayloadConstants.SEPARATOR;
+
+@Component
+@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+public class VfModuleCDSRequestProvider implements CDSRequestProvider {
+ private String blueprintName;
+ private String blueprintVersion;
+ private BuildingBlockExecution execution;
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private ConfigureInstanceParamsForVfModule configureInstanceParamsForVfModule;
+
+ @Override
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ @Override
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ @Override
+ public <T> void setExecutionObject(T executionObject) {
+ execution = (BuildingBlockExecution) executionObject;
+ }
+
+ @Override
+ public Optional<String> buildRequestPayload(String action) throws PayloadGenerationException {
+ JsonObject cdsPropertyObject = new JsonObject();
+ JsonObject vfModuleObject = new JsonObject();
+ String vfModuleName;
+
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+
+ final String modelCustomizationUuidForVnf = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid();
+
+ blueprintName = genericVnf.getBlueprintName();
+ blueprintVersion = genericVnf.getBlueprintVersion();
+
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ vfModuleName = vfModule.getVfModuleName();
+
+ final String modelCustomizationUuidForVfModule =
+ vfModule.getModelInfoVfModule().getModelCustomizationUUID();
+
+ vfModuleObject.addProperty("service-instance-id", serviceInstance.getServiceInstanceId());
+ vfModuleObject.addProperty("service-model-uuid",
+ serviceInstance.getModelInfoServiceInstance().getModelUuid());
+ vfModuleObject.addProperty("vnf-id", genericVnf.getVnfId());
+ vfModuleObject.addProperty("vnf-name", genericVnf.getVnfName());
+ vfModuleObject.addProperty("vf-module-id", vfModule.getVfModuleId());
+ vfModuleObject.addProperty("vf-module-name", vfModule.getVfModuleName());
+ vfModuleObject.addProperty("vf-module-customization-uuid",
+ vfModule.getModelInfoVfModule().getModelCustomizationUUID());
+
+ final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock();
+ List<Map<String, Object>> userParamsFromRequest =
+ buildingBlock.getRequestContext().getRequestParameters().getUserParams();
+
+ configureInstanceParamsForVfModule.populateInstanceParams(vfModuleObject, userParamsFromRequest,
+ modelCustomizationUuidForVnf, modelCustomizationUuidForVfModule);
+ } catch (Exception e) {
+ throw new PayloadGenerationException("Failed to buildPropertyObject for VF-Module", e);
+ }
+
+ // Not sure for resolutionKey should be same as vfModule name.
+ cdsPropertyObject.addProperty("resolution-key", vfModuleName);
+ cdsPropertyObject.addProperty("template-prefix", vfModuleName + action);
+ cdsPropertyObject.add(action + SEPARATOR + PROPERTIES, vfModuleObject);
+
+ return Optional.of(buildRequestJsonObject(cdsPropertyObject, action));
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java
new file mode 100644
index 0000000000..d33976d229
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java
@@ -0,0 +1,106 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Bell Canada
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.client.cds;
+
+import com.google.gson.JsonObject;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import static org.onap.so.client.cds.PayloadConstants.PROPERTIES;
+import static org.onap.so.client.cds.PayloadConstants.SEPARATOR;
+
+@Component
+@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+public class VnfCDSRequestProvider implements CDSRequestProvider {
+ private String blueprintName;
+ private String blueprintVersion;
+ private BuildingBlockExecution execution;
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private ConfigureInstanceParamsForVnf configureInstanceParamsForVnf;
+
+ @Override
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ @Override
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ @Override
+ public <T> void setExecutionObject(T executionObject) {
+ execution = (BuildingBlockExecution) executionObject;
+ }
+
+ @Override
+ public Optional<String> buildRequestPayload(String action) throws PayloadGenerationException {
+ JsonObject cdsPropertyObject = new JsonObject();
+ JsonObject vnfObject = new JsonObject();
+ String resolutionKey;
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+
+ final String modelCustomizationUuid = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid();
+
+ resolutionKey = genericVnf.getVnfName();
+ blueprintName = genericVnf.getBlueprintName();
+ blueprintVersion = genericVnf.getBlueprintVersion();
+
+ vnfObject.addProperty("service-instance-id", serviceInstance.getServiceInstanceId());
+ vnfObject.addProperty("service-model-uuid", serviceInstance.getModelInfoServiceInstance().getModelUuid());
+ vnfObject.addProperty("vnf-id", genericVnf.getVnfId());
+ vnfObject.addProperty("vnf-name", genericVnf.getVnfName());
+ vnfObject.addProperty("vnf-customization-uuid", modelCustomizationUuid);
+
+ final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock();
+ List<Map<String, Object>> userParamsFromRequest =
+ buildingBlock.getRequestContext().getRequestParameters().getUserParams();
+
+ configureInstanceParamsForVnf.populateInstanceParams(vnfObject, userParamsFromRequest,
+ modelCustomizationUuid);
+ } catch (Exception e) {
+ throw new PayloadGenerationException("Failed to buildPropertyObjectForVnf", e);
+ }
+
+ cdsPropertyObject.addProperty("resolution-key", resolutionKey);
+ cdsPropertyObject.add(action + SEPARATOR + PROPERTIES, vnfObject);
+
+ return Optional.of(buildRequestJsonObject(cdsPropertyObject, action));
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
index 0a6ce05a06..2e9d4b0117 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
@@ -40,7 +40,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.objects.audit.AAIObjectAudit;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/PayloadGenerationException.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/PayloadGenerationException.java
new file mode 100644
index 0000000000..3c148a17a5
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/PayloadGenerationException.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Bell Canada
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.client.exception;
+
+public class PayloadGenerationException extends Exception {
+
+ /**
+ * @param message The message to dump
+ */
+ public PayloadGenerationException(final String message) {
+ super(message);
+ }
+
+ /**
+ * @param message The message to dump.
+ * @param cause The throwable cause object.
+ */
+ public PayloadGenerationException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/SDNCLcmPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/SDNCLcmPropertiesImpl.java
new file mode 100644
index 0000000000..9b46611468
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/SDNCLcmPropertiesImpl.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.restproperties;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.sdnc.common.SDNCConstants;
+import org.onap.so.client.sdnc.lcm.SDNCLcmProperties;
+
+public class SDNCLcmPropertiesImpl implements SDNCLcmProperties {
+
+ public static final String SDNC_HOST = "sdnc.host";
+ public static final String SDNC_AUTH = "sdnc.auth";
+ public static final String LCM_PATH = "sdnc.lcm.path";
+ public static final String LCM_ACTION_TIMEOUT = "sdnc.lcm.actionTimeout";
+
+ public static final String DMAAP_HOST = "sdnc.dmaap.host";
+ public static final String DMAAP_AUTH = "sdnc.dmaap.auth";
+ public static final String DMAAP_TIMEOUT = "sdnc.dmaap.timeout";
+ public static final String DMAAP_ENVIRONMENT = "sdnc.dmaap.environment";
+
+ public static final String LCM_DMAAP_PARTITION = "sdnc.lcm.dmaap.partition";
+ public static final String LCM_DMAAP_READ_TOPIC = "sdnc.lcm.dmapp.readTopic";
+ public static final String LCM_DMAAP_WRITE_TOPIC = "sdnc.lcm.dmaap.writeTopic";
+
+ public static final String MSO_KEY = "mso.msoKey";
+
+ public SDNCLcmPropertiesImpl() {}
+
+ @Override
+ public String getHost() {
+ return UrnPropertiesReader.getVariable(SDNC_HOST);
+ }
+
+ @Override
+ public String getPath() {
+ String path = UrnPropertiesReader.getVariable(LCM_PATH);
+ return (path != null) ? path : SDNCConstants.LCM_API_BASE_PATH;
+ }
+
+ @Override
+ public long getActionTimeout() {
+ String actionTimeout = UrnPropertiesReader.getVariable(LCM_ACTION_TIMEOUT);
+ return (actionTimeout != null) ? Long.parseLong(actionTimeout) : SDNCConstants.LCM_ACTION_TIMEOUT;
+ }
+
+ @Override
+ public String getBasicAuth() {
+ return UrnPropertiesReader.getVariable(SDNC_AUTH);
+ }
+
+ @Override
+ public String getDmaapHost() {
+ return UrnPropertiesReader.getVariable(DMAAP_HOST);
+ }
+
+ @Override
+ public String getDmaapAuth() {
+ return UrnPropertiesReader.getVariable(DMAAP_AUTH);
+ }
+
+ @Override
+ public String getDmaapPartition() {
+ String partition = UrnPropertiesReader.getVariable(LCM_DMAAP_PARTITION);
+ return (partition != null) ? partition : SDNCConstants.LCM_DMAAP_PARTITION;
+ }
+
+ @Override
+ public String getDmaapTimeout() {
+ String timeout = UrnPropertiesReader.getVariable(DMAAP_TIMEOUT);
+ return (timeout != null) ? timeout : SDNCConstants.LCM_DMAAP_TIMEOUT;
+ }
+
+ @Override
+ public String getDmaapEnvironment() {
+ String environment = UrnPropertiesReader.getVariable(DMAAP_ENVIRONMENT);
+ return (environment != null) ? environment : SDNCConstants.LCM_DMAAP_ENVIRONMENT;
+ }
+
+ @Override
+ public String getDmaaPLcmReadTopic() {
+ String readTopic = UrnPropertiesReader.getVariable(LCM_DMAAP_READ_TOPIC);
+ return (readTopic != null) ? readTopic : SDNCConstants.LCM_DMAAP_READ_TOPIC;
+ }
+
+ @Override
+ public String getDmaaPLcmWriteTopic() {
+ String writeTopic = UrnPropertiesReader.getVariable(LCM_DMAAP_WRITE_TOPIC);
+ return (writeTopic != null) ? writeTopic : SDNCConstants.LCM_DMAAP_WRITE_TOPIC;
+ }
+
+ @Override
+ public String getKey() {
+ return UrnPropertiesReader.getVariable(MSO_KEY);
+ }
+
+ @Override
+ public URL getEndpoint() throws MalformedURLException {
+ return new URL(getHost());
+ }
+
+ @Override
+ public String getSystemName() {
+ return SDNCConstants.SYSTEM_NAME;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SDNCConstants.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SDNCConstants.java
new file mode 100644
index 0000000000..dcbb120c69
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/common/SDNCConstants.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.common;
+
+public interface SDNCConstants {
+ String SYSTEM_NAME = "MSO";
+
+ String LCM_API_VER = "2.00";
+
+ String LCM_FLAGS_MODE_NORMAL = "NORMAL";
+ String LCM_FLAGS_MODE_EXCLUSIVE = "EXCLUSIVE";
+
+ String LCM_FLAGS_FORCE_TRUE = "TRUE";
+ String LCM_FLAGS_FORCE_FALSE = "FALSE";
+
+ int LCM_FLAGS_TTL = 65000;
+
+ String LCM_API_BASE_PATH = "/restconf/operations/LCM:";
+
+ String LCM_DMAAP_MSG_VER = "1.0";
+ String LCM_DMAAP_MSG_TYPE_REQUEST = "request";
+ String LCM_DMAAP_MSG_TYPE_RESPONSE = "response";
+
+ String LCM_DMAAP_PARTITION = "MSOLCM";
+ String LCM_DMAAP_TIMEOUT = "20000";
+ String LCM_DMAAP_ENVIRONMENT = "TEST";
+ String LCM_DMAAP_READ_TOPIC = "SDNC-LCM-WRITE";
+ String LCM_DMAAP_WRITE_TOPIC = "SDNC-LCM-READ";
+
+ long LCM_ACTION_TIMEOUT = 300000; // Millisecond
+ int LCM_OUTPUT_SUCCESS_CODE = 400;
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmActionConstants.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmActionConstants.java
new file mode 100644
index 0000000000..8ab40cb08d
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmActionConstants.java
@@ -0,0 +1,28 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm;
+
+public interface SDNCLcmActionConstants {
+ String ACTIVATE_N_E_SW = "ActivateNESw";
+ String DOWNLOAD_N_E_SW = "DownloadNESw";
+ String UPGRADE_POST_CHECK = "UpgradePostCheck";
+ String UPGRADE_PRE_CHECK = "UpgradePreCheck";
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java
new file mode 100644
index 0000000000..0f17c547b5
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilder.java
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm;
+
+import java.net.URI;
+import org.onap.so.client.RestPropertiesLoader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SDNCLcmClientBuilder {
+
+ private static Logger logger = LoggerFactory.getLogger(SDNCLcmClientBuilder.class);
+
+ private final SDNCLcmProperties sdncLcmProperties;
+
+ public SDNCLcmClientBuilder() {
+ sdncLcmProperties = RestPropertiesLoader.getInstance().getNewImpl(SDNCLcmProperties.class);
+ }
+
+ public SDNCLcmClientBuilder(SDNCLcmProperties pros) {
+ sdncLcmProperties = pros;
+ }
+
+ public SDNCLcmProperties getSDNCLcmProperties() {
+ return sdncLcmProperties;
+ }
+
+ public SDNCLcmRestClient newSDNCLcmRestClient(String operation) throws SDNCLcmClientBuilderException {
+ URI pathUri;
+ try {
+ String path = sdncLcmProperties.getPath() + operation;
+ pathUri = new URI(path);
+ logger.debug("SDNC host: " + sdncLcmProperties.getHost());
+ logger.debug("SDNC API path: " + pathUri.getPath());
+ } catch (Exception e) {
+ String msg = "Error API path syntax: ";
+ logger.error(msg, e);
+ throw new SDNCLcmClientBuilderException(msg + e.toString());
+ }
+
+ try {
+ SDNCLcmRestClient sdncLcmRestClient = new SDNCLcmRestClient(sdncLcmProperties, pathUri);
+ logger.debug("Create SDNCLcmRestClient success");
+ return sdncLcmRestClient;
+ } catch (Exception e) {
+ String msg = "Create SDNCLcmRestClient failure: ";
+ logger.error(msg, e);
+ throw new SDNCLcmClientBuilderException(msg + e.toString());
+ }
+ }
+
+ public SDNCLcmDmaapClient newSDNCLcmDmaapClient() throws SDNCLcmClientBuilderException {
+ try {
+ SDNCLcmDmaapClient sdncLcmDmaapClient = new SDNCLcmDmaapClient(sdncLcmProperties);
+ logger.debug("Create SDNCLcmDmaapClient success");
+ return sdncLcmDmaapClient;
+ } catch (Exception e) {
+ String msg = "Create SDNCLcmDmaapClient failure: ";
+ logger.error(msg, e);
+ throw new SDNCLcmClientBuilderException(msg + e.toString());
+ }
+ }
+}
diff --git a/common/src/main/java/org/onap/so/logger/ErrorCode.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilderException.java
index a57ed99f2b..9160d4e352 100644
--- a/common/src/main/java/org/onap/so/logger/ErrorCode.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmClientBuilderException.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.
@@ -18,23 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.logger;
+package org.onap.so.client.sdnc.lcm;
-public enum ErrorCode {
- PermissionError(100),
- AvailabilityError(200),
- DataError(300),
- SchemaError(400),
- BusinessProcessError(500),
- UnknownError(900);
+public class SDNCLcmClientBuilderException extends Exception {
- private int value;
+ private static final long serialVersionUID = -1525705272349747712L;
- ErrorCode(int value) {
- this.value = value;
- }
-
- public int getValue() {
- return this.value;
+ public SDNCLcmClientBuilderException(String message) {
+ super(message);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClient.java
new file mode 100644
index 0000000000..f6e4ffce59
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClient.java
@@ -0,0 +1,90 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.onap.so.client.sdnc.lcm.beans.LcmDmaapRequest;
+import org.onap.so.client.sdnc.lcm.beans.LcmDmaapResponse;
+import org.onap.so.client.dmaap.rest.RestPublisher;
+import org.onap.so.client.dmaap.rest.RestConsumer;
+
+public class SDNCLcmDmaapClient {
+
+ private static Logger logger = LoggerFactory.getLogger(SDNCLcmDmaapClient.class);
+
+ private RestPublisher dmaapPublisher;
+ private RestConsumer dmaapConsumer;
+
+ public SDNCLcmDmaapClient(SDNCLcmProperties sdncLcmProperties) {
+ Properties properties = new Properties();
+
+ properties.put("host", sdncLcmProperties.getDmaapHost());
+ if (sdncLcmProperties.getDmaapAuth() != null && sdncLcmProperties.getKey() != null) {
+ properties.put("auth", sdncLcmProperties.getDmaapAuth());
+ properties.put("key", sdncLcmProperties.getKey());
+ }
+ properties.put("partition", sdncLcmProperties.getDmaapPartition());
+ properties.put("timeout", sdncLcmProperties.getDmaapTimeout());
+ properties.put("environment", sdncLcmProperties.getDmaapEnvironment());
+
+ properties.put("topic", sdncLcmProperties.getDmaaPLcmWriteTopic());
+ dmaapPublisher = new RestPublisher(properties);
+
+ properties.put("topic", sdncLcmProperties.getDmaaPLcmReadTopic());
+ dmaapConsumer = new RestConsumer(properties);
+ }
+
+ public void sendRequest(LcmDmaapRequest lcmDmaapRequest) throws Exception {
+ ObjectMapper mapper = new ObjectMapper();
+ String lcmRestRequestString = mapper.writeValueAsString(lcmDmaapRequest);
+
+ dmaapPublisher.send(lcmRestRequestString);
+ }
+
+ public Iterable<String> fetch() {
+ return dmaapConsumer.fetch();
+ }
+
+ public List<LcmDmaapResponse> getResponse() {
+ List<LcmDmaapResponse> responseList = new ArrayList<>();
+
+ ObjectMapper mapper = new ObjectMapper();
+ Iterable<String> itrString = dmaapConsumer.fetch();
+ for (String message : itrString) {
+ LcmDmaapResponse lcmDmaapResponse;
+ try {
+ lcmDmaapResponse = mapper.readValue(message, LcmDmaapResponse.class);
+ } catch (Exception e) {
+ logger.warn("Invalid SDNC LCM DMaaP response: " + message);
+ continue;
+ }
+
+ responseList.add(lcmDmaapResponse);
+ }
+
+ return responseList;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilder.java
new file mode 100644
index 0000000000..bf1229a310
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilder.java
@@ -0,0 +1,87 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm;
+
+import java.time.Instant;
+import org.onap.so.client.sdnc.common.SDNCConstants;
+import org.onap.so.client.sdnc.lcm.beans.*;
+
+public class SDNCLcmMessageBuilder {
+
+ public static LcmFlags getSDNCFlags() {
+ LcmFlags lcmFlags = new LcmFlags();
+
+ lcmFlags.setMode(SDNCConstants.LCM_FLAGS_MODE_NORMAL);
+ lcmFlags.setForce(SDNCConstants.LCM_FLAGS_FORCE_FALSE);
+ lcmFlags.setTtl(SDNCConstants.LCM_FLAGS_TTL);
+
+ return lcmFlags;
+ }
+
+ public static LcmCommonHeader buildLcmCommonHeader(String requestId, String subRequestId) {
+ LcmCommonHeader lcmCommonHeader = new LcmCommonHeader();
+
+ lcmCommonHeader.setApiVer(SDNCConstants.LCM_API_VER);
+ lcmCommonHeader.setOriginatorId(SDNCConstants.SYSTEM_NAME);
+ lcmCommonHeader.setRequestId(requestId);
+ lcmCommonHeader.setSubRequestId(subRequestId);
+ lcmCommonHeader.setFlags(getSDNCFlags());
+ lcmCommonHeader.setTimestamp(Instant.now().toString());
+
+ return lcmCommonHeader;
+ }
+
+ public static LcmInput buildLcmInputForPnf(String requestId, String subRequestId, String pnfName, String action,
+ String payload) {
+ LcmInput lcmInput = new LcmInput();
+
+ LcmCommonHeader lcmCommonHeader = buildLcmCommonHeader(requestId, subRequestId);
+
+ LcmActionIdentifiers sdncActionIdentifiers = new LcmActionIdentifiers();
+ sdncActionIdentifiers.setPnfName(pnfName);
+
+ lcmInput.setCommonHeader(lcmCommonHeader);
+ lcmInput.setAction(action);
+ lcmInput.setActionIdentifiers(sdncActionIdentifiers);
+ lcmInput.setPayload(payload);
+
+ return lcmInput;
+ }
+
+ public static LcmDmaapRequest buildLcmDmaapRequest(String operation, LcmInput lcmInput) {
+ LcmDmaapRequest lcmDmaapRequest = new LcmDmaapRequest();
+
+ LcmRestRequest lcmRestRequest = new LcmRestRequest();
+ lcmRestRequest.setInput(lcmInput);
+
+ String correlationId =
+ lcmInput.getCommonHeader().getRequestId() + "-" + lcmInput.getCommonHeader().getSubRequestId();
+
+ lcmDmaapRequest.setVersion(SDNCConstants.LCM_DMAAP_MSG_VER);
+ lcmDmaapRequest.setType(SDNCConstants.LCM_DMAAP_MSG_TYPE_REQUEST);
+ lcmDmaapRequest.setCambriaPartition(SDNCConstants.SYSTEM_NAME);
+ lcmDmaapRequest.setCorrelationId(correlationId);
+ lcmDmaapRequest.setRpcName(operation);
+ lcmDmaapRequest.setBody(lcmRestRequest);
+
+ return lcmDmaapRequest;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmProperties.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmProperties.java
new file mode 100644
index 0000000000..a21196e08f
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmProperties.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm;
+
+import org.onap.so.client.RestProperties;
+
+public interface SDNCLcmProperties extends RestProperties {
+ String getHost();
+
+ String getPath();
+
+ long getActionTimeout();
+
+ String getBasicAuth();
+
+ String getDmaapHost();
+
+ String getDmaapAuth();
+
+ String getDmaapPartition();
+
+ String getDmaapTimeout();
+
+ String getDmaapEnvironment();
+
+ String getDmaaPLcmReadTopic();
+
+ String getDmaaPLcmWriteTopic();
+
+ String getKey();
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClient.java
new file mode 100644
index 0000000000..3faf58ec28
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClient.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Optional;
+import org.onap.so.client.RestClient;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.so.client.sdnc.lcm.beans.LcmInput;
+import org.onap.so.client.sdnc.lcm.beans.LcmOutput;
+import org.onap.so.client.sdnc.lcm.beans.LcmRestRequest;
+import org.onap.so.client.sdnc.lcm.beans.LcmRestResponse;
+
+public class SDNCLcmRestClient extends RestClient {
+
+ private final SDNCLcmProperties sdncLcmProperties;
+
+ public SDNCLcmRestClient(SDNCLcmProperties props, URI path) {
+ this(props, path, "application/json", "application/json");
+ }
+
+ public SDNCLcmRestClient(SDNCLcmProperties props, URI path, String accept, String contentType) {
+ super(props, Optional.of(path), accept, contentType);
+ this.sdncLcmProperties = props;
+ }
+
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+ headerMap.put("Authorization", sdncLcmProperties.getBasicAuth());
+ }
+
+ @Override
+ public ONAPComponents getTargetEntity() {
+ return ONAPComponents.SDNC;
+ }
+
+ public LcmRestResponse sendRequest(LcmRestRequest lcmRestRequest) {
+ return post(lcmRestRequest, LcmRestResponse.class);
+ }
+
+ public LcmOutput sendRequest(LcmInput lcmInput) {
+ LcmRestRequest lcmRestRequest = new LcmRestRequest();
+ lcmRestRequest.setInput(lcmInput);
+
+ LcmRestResponse lcmRestResponse = sendRequest(lcmRestRequest);
+ return lcmRestResponse.getOutput();
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmActionIdentifiers.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmActionIdentifiers.java
new file mode 100644
index 0000000000..883fd02c78
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmActionIdentifiers.java
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"serviceInstanceId", "vnfId", "vfModuleId", "vnfcName", "vserverId", "pnfName"})
+public class LcmActionIdentifiers {
+
+ @JsonProperty("service-instance-id")
+ private String serviceInstanceId;
+
+ @JsonProperty("vnf-id")
+ private String vnfId;
+
+ @JsonProperty("vf-module-id")
+ private String vfModuleId;
+
+ @JsonProperty("vnfc-name")
+ private String vnfcName;
+
+ @JsonProperty("vserver-id")
+ private String vserverId;
+
+ @JsonProperty("pnf-name")
+ private String pnfName;
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String value) {
+ this.serviceInstanceId = value;
+ }
+
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ public void setVnfId(String value) {
+ this.vnfId = value;
+ }
+
+ public String getVfModuleId() {
+ return vfModuleId;
+ }
+
+ public void setVfModuleId(String value) {
+ this.vfModuleId = value;
+ }
+
+ public String getVnfcName() {
+ return vnfcName;
+ }
+
+ public void setVnfcName(String value) {
+ this.vnfcName = value;
+ }
+
+ public String getVserverId() {
+ return vserverId;
+ }
+
+ public void setVserverId(String value) {
+ this.vserverId = value;
+ }
+
+ public String getPnfName() {
+ return pnfName;
+ }
+
+ public void setPnfName(String value) {
+ this.pnfName = value;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmCommonHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmCommonHeader.java
new file mode 100644
index 0000000000..f3fd2ca11d
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmCommonHeader.java
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"apiVer", "flags", "originatorId", "requestId", "subRequestId", "timestamp"})
+public class LcmCommonHeader {
+
+ @JsonProperty(value = "api-ver", required = true)
+ private String apiVer;
+
+ @JsonProperty(value = "flags")
+ private LcmFlags flags;
+
+ @JsonProperty(value = "originator-id", required = true)
+ private String originatorId;
+
+ @JsonProperty(value = "request-id", required = true)
+ private String requestId;
+
+ @JsonProperty(value = "sub-request-id")
+ private String subRequestId;
+
+ @JsonProperty(value = "timestamp", required = true)
+ private String timestamp;
+
+ public String getApiVer() {
+ return apiVer;
+ }
+
+ public void setApiVer(String value) {
+ this.apiVer = value;
+ }
+
+ public String getOriginatorId() {
+ return originatorId;
+ }
+
+ public void setOriginatorId(String value) {
+ this.originatorId = value;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String value) {
+ this.requestId = value;
+ }
+
+ public String getSubRequestId() {
+ return subRequestId;
+ }
+
+ public void setSubRequestId(String value) {
+ this.subRequestId = value;
+ }
+
+ public LcmFlags getFlags() {
+ return flags;
+ }
+
+ public void setFlags(LcmFlags value) {
+ this.flags = value;
+ }
+
+ public String getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(String value) {
+ this.timestamp = value;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequest.java
new file mode 100644
index 0000000000..db62e8b20b
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequest.java
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"version", "type", "cambriaPartition", "correlationId", "rpcName", "body"})
+public class LcmDmaapRequest {
+
+ @JsonProperty(value = "version", required = true)
+ private String version;
+
+ @JsonProperty(value = "type", required = true)
+ private String type;
+
+ @JsonProperty(value = "cambria.partition", required = true)
+ private String cambriaPartition;
+
+ @JsonProperty(value = "correlation-id", required = true)
+ private String correlationId;
+
+ @JsonProperty(value = "rpc-name", required = true)
+ private String rpcName;
+
+ @JsonProperty(value = "body")
+ private LcmRestRequest body;
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String value) {
+ this.version = value;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String value) {
+ this.type = value;
+ }
+
+ public String getCambriaPartition() {
+ return cambriaPartition;
+ }
+
+ public void setCambriaPartition(String value) {
+ this.cambriaPartition = value;
+ }
+
+ public String getCorrelationId() {
+ return correlationId;
+ }
+
+ public void setCorrelationId(String value) {
+ this.correlationId = value;
+ }
+
+ public String getRpcName() {
+ return rpcName;
+ }
+
+ public void setRpcName(String value) {
+ this.rpcName = value;
+ }
+
+ public LcmRestRequest getBody() {
+ return body;
+ }
+
+ public void setBody(LcmRestRequest value) {
+ this.body = value;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponse.java
new file mode 100644
index 0000000000..35f4a26b17
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponse.java
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"version", "type", "cambriaPartition", "correlationId", "rpcName", "body"})
+public class LcmDmaapResponse {
+
+ @JsonProperty(value = "version", required = true)
+ private String version;
+
+ @JsonProperty(value = "type", required = true)
+ private String type;
+
+ @JsonProperty(value = "cambria.partition", required = true)
+ private String cambriaPartition;
+
+ @JsonProperty(value = "correlation-id", required = true)
+ private String correlationId;
+
+ @JsonProperty(value = "rpc-name", required = true)
+ private String rpcName;
+
+ @JsonProperty(value = "body")
+ private LcmRestResponse body;
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String value) {
+ this.version = value;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String value) {
+ this.type = value;
+ }
+
+ public String getCambriaPartition() {
+ return cambriaPartition;
+ }
+
+ public void setCambriaPartition(String value) {
+ this.cambriaPartition = value;
+ }
+
+ public String getCorrelationId() {
+ return correlationId;
+ }
+
+ public void setCorrelationId(String value) {
+ this.correlationId = value;
+ }
+
+ public String getRpcName() {
+ return rpcName;
+ }
+
+ public void setRpcName(String value) {
+ this.rpcName = value;
+ }
+
+ public LcmRestResponse getBody() {
+ return body;
+ }
+
+ public void setBody(LcmRestResponse value) {
+ this.body = value;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmFlags.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmFlags.java
new file mode 100644
index 0000000000..36527ec887
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmFlags.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"mode", "force", "ttl"})
+public class LcmFlags {
+
+ @JsonProperty("mode")
+ private String mode;
+
+ @JsonProperty("force")
+ private String force;
+
+ @JsonProperty("ttl")
+ private int ttl;
+
+ public String getMode() {
+ return mode;
+ }
+
+ public void setMode(String value) {
+ this.mode = value;
+ }
+
+ public String getForce() {
+ return force;
+ }
+
+ public void setForce(String value) {
+ this.force = value;
+ }
+
+ public Integer getTtl() {
+ return ttl;
+ }
+
+ public void setTtl(Integer value) {
+ this.ttl = value;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmInput.java
new file mode 100644
index 0000000000..6634430bed
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmInput.java
@@ -0,0 +1,75 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"commonHeader", "action", "actionIdentifiers", "payload"})
+public class LcmInput {
+
+ @JsonProperty(value = "common-header", required = true)
+ private LcmCommonHeader commonHeader;
+
+ @JsonProperty(value = "action", required = true)
+ private String action;
+
+ @JsonProperty(value = "action-identifiers", required = true)
+ private LcmActionIdentifiers actionIdentifiers;
+
+ @JsonProperty(value = "payload")
+ private String payload;
+
+ public LcmCommonHeader getCommonHeader() {
+ return commonHeader;
+ }
+
+ public void setCommonHeader(LcmCommonHeader value) {
+ this.commonHeader = value;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String value) {
+ this.action = value;
+ }
+
+ public LcmActionIdentifiers getActionIdentifiers() {
+ return actionIdentifiers;
+ }
+
+ public void setActionIdentifiers(LcmActionIdentifiers value) {
+ this.actionIdentifiers = value;
+ }
+
+ public String getPayload() {
+ return payload;
+ }
+
+ public void setPayload(String value) {
+ this.payload = value;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmOutput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmOutput.java
new file mode 100644
index 0000000000..3741786671
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmOutput.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"commonHeader", "status", "payload"})
+public class LcmOutput {
+
+ @JsonProperty(value = "common-header", required = true)
+ private LcmCommonHeader commonHeader;
+
+ @JsonProperty(value = "status", required = true)
+ private LcmStatus status;
+
+ @JsonProperty(value = "payload")
+ private String payload;
+
+ public LcmCommonHeader getCommonHeader() {
+ return commonHeader;
+ }
+
+ public void setCommonHeader(LcmCommonHeader value) {
+ this.commonHeader = value;
+ }
+
+ public LcmStatus getStatus() {
+ return status;
+ }
+
+ public void setStatus(LcmStatus value) {
+ this.status = value;
+ }
+
+ public String getPayload() {
+ return payload;
+ }
+
+ public void setPayload(String value) {
+ this.payload = value;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequest.java
new file mode 100644
index 0000000000..146eb8a4f6
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequest.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"input"})
+public class LcmRestRequest {
+
+ @JsonProperty(value = "input", required = true)
+ private LcmInput input;
+
+ public LcmInput getInput() {
+ return input;
+ }
+
+ public void setInput(LcmInput value) {
+ this.input = value;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponse.java
new file mode 100644
index 0000000000..6920f95ce2
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponse.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"output"})
+public class LcmRestResponse {
+
+ @JsonProperty(value = "output", required = true)
+ private LcmOutput output;
+
+ public LcmOutput getOutput() {
+ return output;
+ }
+
+ public void setOutput(LcmOutput value) {
+ this.output = value;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmStatus.java
new file mode 100644
index 0000000000..8a2a142792
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/LcmStatus.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"code", "message"})
+public class LcmStatus {
+
+ @JsonProperty(value = "code", required = true)
+ private int code;
+
+ @JsonProperty(value = "message", required = true)
+ private String message;
+
+ public int getCode() {
+ return code;
+ }
+
+ public void setCode(int value) {
+ this.code = value;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String value) {
+ this.message = value;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayload.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayload.java
new file mode 100644
index 0000000000..d86d114a9f
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayload.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans.payload;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"ipaddressV4Oam", "playbookName", "swVersionToBeActivated"})
+public class ActivateNESwPayload {
+
+ @JsonProperty(value = "ipaddress-v4-oam", required = true)
+ private String ipaddressV4Oam;
+
+ @JsonProperty(value = "playbook-name")
+ private String playbookName;
+
+ @JsonProperty(value = "swVersionToBeActivated", required = true)
+ private String swVersionToBeActivated;
+
+ public String getIpaddressV4Oam() {
+ return ipaddressV4Oam;
+ }
+
+ public void setIpaddressV4Oam(String value) {
+ this.ipaddressV4Oam = value;
+ }
+
+ public String getPlaybookName() {
+ return playbookName;
+ }
+
+ public void setPlaybookName(String value) {
+ this.playbookName = value;
+ }
+
+ public String getSwVersionToBeActivated() {
+ return swVersionToBeActivated;
+ }
+
+ public void setSwVersionToBeActivated(String value) {
+ this.swVersionToBeActivated = value;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayload.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayload.java
new file mode 100644
index 0000000000..5dc5cf503d
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayload.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans.payload;
+
+import java.util.ArrayList;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"ipaddressV4Oam", "playbookName", "swToBeDownloaded"})
+public class DownloadNESwPayload {
+
+ @JsonProperty(value = "ipaddress-v4-oam", required = true)
+ private String ipaddressV4Oam;
+
+ @JsonProperty(value = "playbook-name")
+ private String playbookName;
+
+ @JsonProperty(value = "swToBeDownloaded", required = true)
+ private List<SwToBeDownloadedElement> swToBeDownloaded = new ArrayList<>();
+
+ public String getIpaddressV4Oam() {
+ return ipaddressV4Oam;
+ }
+
+ public void setIpaddressV4Oam(String value) {
+ this.ipaddressV4Oam = value;
+ }
+
+ public String getPlaybookName() {
+ return playbookName;
+ }
+
+ public void setPlaybookName(String value) {
+ this.playbookName = value;
+ }
+
+ public List<SwToBeDownloadedElement> getSwToBeDownloaded() {
+ return swToBeDownloaded;
+ }
+
+ public void setSwToBeDownloaded(List<SwToBeDownloadedElement> value) {
+ this.swToBeDownloaded = value;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/SwToBeDownloadedElement.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/SwToBeDownloadedElement.java
new file mode 100644
index 0000000000..1a3529d7c4
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/SwToBeDownloadedElement.java
@@ -0,0 +1,75 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans.payload;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"swLocation", "swFileSize", "swFileCompression", "swFileFormat"})
+public class SwToBeDownloadedElement {
+
+ @JsonProperty(value = "swLocation", required = true)
+ private String swLocation;
+
+ @JsonProperty(value = "swFileSize")
+ private long swFileSize;
+
+ @JsonProperty(value = "swFileCompression")
+ private String swFileCompression;
+
+ @JsonProperty(value = "swFileFormat")
+ private String swFileFormat;
+
+ public String getSwLocation() {
+ return swLocation;
+ }
+
+ public void setSwLocation(String value) {
+ this.swLocation = value;
+ }
+
+ public long getSwFileSize() {
+ return swFileSize;
+ }
+
+ public void setSwFileSize(long value) {
+ this.swFileSize = value;
+ }
+
+ public String getSwFileCompression() {
+ return swFileCompression;
+ }
+
+ public void setSwFileCompression(String value) {
+ this.swFileCompression = value;
+ }
+
+ public String getSwFileFormat() {
+ return swFileFormat;
+ }
+
+ public void setSwFileFormat(String value) {
+ this.swFileFormat = value;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayload.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayload.java
new file mode 100644
index 0000000000..76937d262c
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayload.java
@@ -0,0 +1,96 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans.payload;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"ipaddressV4Oam", "playbookName", "oldSwVersion", "targetSwVersion", "ruleName", "additionalData"})
+public class UpgradePostCheckPayload {
+
+ @JsonProperty(value = "ipaddress-v4-oam", required = true)
+ private String ipaddressV4Oam;
+
+ @JsonProperty(value = "playbook-name")
+ private String playbookName;
+
+ @JsonProperty(value = "oldSwVersion", required = true)
+ private String oldSwVersion;
+
+ @JsonProperty(value = "targetSwVersion", required = true)
+ private String targetSwVersion;
+
+ @JsonProperty(value = "ruleName", required = true)
+ private String ruleName;
+
+ @JsonProperty(value = "additionalData")
+ private String additionalData;
+
+ public String getIpaddressV4Oam() {
+ return ipaddressV4Oam;
+ }
+
+ public void setIpaddressV4Oam(String value) {
+ this.ipaddressV4Oam = value;
+ }
+
+ public String getPlaybookName() {
+ return playbookName;
+ }
+
+ public void setPlaybookName(String value) {
+ this.playbookName = value;
+ }
+
+ public String getOldSwVersion() {
+ return oldSwVersion;
+ }
+
+ public void setOldSwVersion(String value) {
+ this.oldSwVersion = value;
+ }
+
+ public String getTargetSwVersion() {
+ return targetSwVersion;
+ }
+
+ public void setTargetSwVersion(String value) {
+ this.targetSwVersion = value;
+ }
+
+ public String getRuleName() {
+ return ruleName;
+ }
+
+ public void setRuleName(String value) {
+ this.ruleName = value;
+ }
+
+ public String getAdditionalData() {
+ return additionalData;
+ }
+
+ public void setAdditionalData(String value) {
+ this.additionalData = value;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayload.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayload.java
new file mode 100644
index 0000000000..d1a95b8418
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayload.java
@@ -0,0 +1,96 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans.payload;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"ipaddressV4Oam", "playbookName", "oldSwVersion", "targetSwVersion", "ruleName", "additionalData"})
+public class UpgradePreCheckPayload {
+
+ @JsonProperty(value = "ipaddress-v4-oam", required = true)
+ private String ipaddressV4Oam;
+
+ @JsonProperty(value = "playbook-name")
+ private String playbookName;
+
+ @JsonProperty(value = "oldSwVersion", required = true)
+ private String oldSwVersion;
+
+ @JsonProperty(value = "targetSwVersion", required = true)
+ private String targetSwVersion;
+
+ @JsonProperty(value = "ruleName", required = true)
+ private String ruleName;
+
+ @JsonProperty(value = "additionalData")
+ private String additionalData;
+
+ public String getIpaddressV4Oam() {
+ return ipaddressV4Oam;
+ }
+
+ public void setIpaddressV4Oam(String value) {
+ this.ipaddressV4Oam = value;
+ }
+
+ public String getPlaybookName() {
+ return playbookName;
+ }
+
+ public void setPlaybookName(String value) {
+ this.playbookName = value;
+ }
+
+ public String getOldSwVersion() {
+ return oldSwVersion;
+ }
+
+ public void setOldSwVersion(String value) {
+ this.oldSwVersion = value;
+ }
+
+ public String getTargetSwVersion() {
+ return targetSwVersion;
+ }
+
+ public void setTargetSwVersion(String value) {
+ this.targetSwVersion = value;
+ }
+
+ public String getRuleName() {
+ return ruleName;
+ }
+
+ public void setRuleName(String value) {
+ this.ruleName = value;
+ }
+
+ public String getAdditionalData() {
+ return additionalData;
+ }
+
+ public void setAdditionalData(String value) {
+ this.additionalData = value;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
index 27da189456..147bc2ee95 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
+++ b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
@@ -1,3 +1,4 @@
org.onap.so.client.restproperties.AAIPropertiesImpl
org.onap.so.client.restproperties.CDSPropertiesImpl
-org.onap.so.client.restproperties.PolicyRestPropertiesImpl \ No newline at end of file
+org.onap.so.client.restproperties.PolicyRestPropertiesImpl
+org.onap.so.client.restproperties.SDNCLcmPropertiesImpl
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
index 525307a5df..59b34c4074 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoGroovyTest.groovy
@@ -37,6 +37,7 @@ import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
@@ -118,8 +119,8 @@ abstract class MsoGroovyTest {
}
protected Optional<GenericVnf> mockAAIGenericVnfByName(String vnfName){
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)
- AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE)
+ AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)
+ AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE)
Optional<GenericVnf> genericVnf = getAAIObjectFromJson(GenericVnf.class,"__files/aai/GenericVnf.json");
when(client.get(GenericVnf.class, resourceUri)).thenReturn(genericVnf)
when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(genericVnf)
@@ -134,8 +135,8 @@ abstract class MsoGroovyTest {
}
protected void mockAAIGenericVnfByNameNotFound(String vnfName){
- AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)
- AAIResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE)
+ AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)
+ AAIPluralResourceUri resourceUriDepthOne = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName).depth(Depth.ONE)
when(client.get(GenericVnf.class, resourceUri)).thenReturn(Optional.empty())
when(client.get(GenericVnf.class, resourceUriDepthOne)).thenReturn(Optional.empty())
}
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtilTest.groovy
new file mode 100644
index 0000000000..6b63bbe56c
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtilTest.groovy
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.common.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.so.db.request.beans.OperationStatus
+
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.when
+
+class RequestDBUtilTest extends MsoGroovyTest {
+
+ @Before
+ void init() throws IOException {
+ super.init("DoDeleteSliceServiceTest")
+ }
+
+ @Captor
+ static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+ @Test
+ void prepareUpdateOperationStatus(){
+ when(mockExecution.getVariable("mso.adapters.openecomp.db.endpoint")).thenReturn("http://sdc-wfd-be:8080")
+ OperationStatus operationStatus = new OperationStatus()
+ operationStatus.setServiceId("testServiceId")
+ operationStatus.setOperationId("testOperationId")
+ operationStatus.setUserId("testUserId")
+ operationStatus.setOperation("testOpertation")
+ operationStatus.setResult("testResult")
+ operationStatus.setProgress("testProgress")
+ operationStatus.setOperationContent("testOperationContent")
+ operationStatus.setReason("testReason")
+
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ requestDBUtil.prepareUpdateOperationStatus(mockExecution, operationStatus)
+
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String updateOperationStatus = captor.getAllValues()
+ assertNotNull(updateOperationStatus)
+ }
+
+ @Test
+ void testGetOperationStatus(){
+ when(mockExecution.getVariable("mso.adapters.openecomp.db.endpoint")).thenReturn("http://sdc-wfd-be:8080")
+
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ requestDBUtil.getOperationStatus(mockExecution, "testServiceId","testOperationId")
+
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("getOperationStatus"), captor.capture())
+ String getOperationStatus = captor.getAllValues()
+ assertNotNull(getOperationStatus)
+
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index 1acf4edb4a..df7337c0d9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -888,7 +888,6 @@ public class BBInputSetupTest {
verify(SPY_bbInputSetup, times(1)).populateGenericVnf(parameter);
assertEquals("VnfId populated", true,
lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID).equalsIgnoreCase(resourceId));
-
doReturn(ModelType.volumeGroup).when(modelInfo).getModelType();
resourceId = "volumeGroupId";
parameter.setResourceId(resourceId);
@@ -1159,12 +1158,13 @@ public class BBInputSetupTest {
ModelInfo mi = new ModelInfo();
mi.setModelType(ModelType.vnf);
mi.setModelCustomizationUuid("vnfModelCustomizationUUID");
+ mi.setModelCustomizationId("vnfModelCustomizationUUID");
ri.setModelInfo(mi);
ril.setRelatedInstance(ri);
requestDetails.setRelatedInstanceList(new RelatedInstanceList[] {ril});
ModelInfo modelInfo = new ModelInfo();
- modelInfo.setModelType(ModelType.volumeGroup);
+ modelInfo.setModelCustomizationId("volumeGroupCustId");
RequestInfo reqInfo = new RequestInfo();
reqInfo.setInstanceName("volumeGroupName");
@@ -1178,6 +1178,8 @@ public class BBInputSetupTest {
VolumeGroup vg = new VolumeGroup();
vg.setVolumeGroupName("volumeGroupName");
vg.setVolumeGroupId("volumeGroupId");
+ vg.setModelInfoVfModule(new ModelInfoVfModule());
+ vg.getModelInfoVfModule().setModelCustomizationUUID("volumeGroupCustId");
vnf.getVolumeGroups().add(vg);
serviceInstance.getVnfs().add(vnf);
@@ -1186,6 +1188,8 @@ public class BBInputSetupTest {
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId");
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
String bbName = AssignFlows.VOLUME_GROUP.toString();
String resourceId = "123";
doNothing().when(SPY_bbInputSetup).mapCatalogVolumeGroup(isA(VolumeGroup.class), eq(modelInfo), eq(service),
@@ -1198,9 +1202,10 @@ public class BBInputSetupTest {
BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
.setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance)
.setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setRequestDetails(requestDetails)
- .setInstanceName(reqInfo.getInstanceName()).build();
+ .setInstanceName(reqInfo.getInstanceName()).setServiceModel(serviceModel).build();
SPY_bbInputSetup.populateVolumeGroup(parameter);
- verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(vg, modelInfo, service, "vnfModelCustomizationUUID");
+ verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(eq(vg), isA(ModelInfo.class), eq(service),
+ eq("vnfModelCustomizationUUID"));
vnf.getVolumeGroups().clear();
SPY_bbInputSetup.populateVolumeGroup(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(vnf.getVolumeGroups().get(0), modelInfo, service,
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
index fcc59c3340..64e1b40739 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
@@ -74,6 +74,7 @@ import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceF
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.entities.uri.Depth;
@@ -317,38 +318,14 @@ public class BBInputSetupUtilsTest {
ServiceInstances serviceInstances = new ServiceInstances();
serviceInstances.getServiceInstance().add(expectedServiceInstance);
- doReturn(Optional.of(serviceInstances)).when(MOCK_aaiResourcesClient).get(isA(Class.class),
- isA(AAIResourceUri.class));
-
- assertThat(bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer),
- sameBeanAs(serviceInstances.getServiceInstance().get(0)));
- }
-
- @Test
- public void getAAIServiceInstanceByNameExceptionTest() throws Exception {
- final String serviceInstanceName = "serviceInstanceName";
-
- expectedException.expect(Exception.class);
- expectedException.expectMessage("Multiple Service Instances Returned");
-
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId("serviceInstanceId");
-
- ServiceSubscription serviceSubscription = new ServiceSubscription();
- serviceSubscription.setServiceType("serviceType");
-
- Customer customer = new Customer();
- customer.setGlobalCustomerId("globalCustomerId");
- customer.setServiceSubscription(serviceSubscription);
-
- ServiceInstances serviceInstances = new ServiceInstances();
- serviceInstances.getServiceInstance().add(serviceInstance);
- serviceInstances.getServiceInstance().add(serviceInstance);
-
- doReturn(Optional.of(serviceInstances)).when(MOCK_aaiResourcesClient).get(isA(Class.class),
- isA(AAIResourceUri.class));
-
+ AAIPluralResourceUri expectedUri = AAIUriFactory
+ .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(),
+ customer.getServiceSubscription().getServiceType())
+ .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO);
bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer);
+
+ verify(MOCK_aaiResourcesClient, times(1)).getOne(org.onap.aai.domain.yang.ServiceInstances.class,
+ org.onap.aai.domain.yang.ServiceInstance.class, expectedUri);
}
@Test
@@ -360,30 +337,6 @@ public class BBInputSetupUtilsTest {
}
@Test
- public void getOptionalAAIServiceInstanceByNameExceptionTest() throws Exception {
- expectedException.expect(MultipleObjectsFoundException.class);
- expectedException.expectMessage(containsString(
- "Multiple service instances found for customer-id: globalCustomerId, service-type: serviceType and service-instance-name: serviceInstanceId."));
-
- final String globalCustomerId = "globalCustomerId";
- final String serviceType = "serviceType";
- final String serviceInstanceId = "serviceInstanceId";
-
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId(serviceInstanceId);
- serviceInstance.setServiceType(serviceType);
-
- ServiceInstances serviceInstances = new ServiceInstances();
- serviceInstances.getServiceInstance().add(serviceInstance);
- serviceInstances.getServiceInstance().add(serviceInstance);
-
- doReturn(Optional.of(serviceInstances)).when(MOCK_aaiResourcesClient).get(isA(Class.class),
- isA(AAIResourceUri.class));
-
- bbInputSetupUtils.getAAIServiceInstanceByName(globalCustomerId, serviceType, serviceInstanceId);
- }
-
- @Test
public void getOptionalAAIServiceInstanceByNameNullTest() throws Exception {
Optional<ServiceInstance> actual = bbInputSetupUtils.getAAIServiceInstanceByName("", "", "");
@@ -487,8 +440,7 @@ public class BBInputSetupUtilsTest {
network.setNetworkId(networkId);
network.setNetworkName(networkName);
expected.get().getL3Network().add(network);
-
- doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class), any(AAIResourceUri.class));
+ doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class), any(AAIPluralResourceUri.class));
Optional<L3Network> actual =
bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(networkId, networkName);
@@ -499,31 +451,17 @@ public class BBInputSetupUtilsTest {
}
@Test
- public void getRelatedNetworkByNameFromServiceInstanceMultipleNetworksExceptionTest() throws Exception {
- final String serviceInstanceId = "serviceInstanceId";
- final String networkName = "networkName";
- expectedException.expect(MultipleObjectsFoundException.class);
- expectedException.expectMessage(
- String.format("Multiple networks found for service-instance-id: %s and network-name: %s.",
- serviceInstanceId, networkName));
-
- L3Network network = new L3Network();
- network.setNetworkId("id123");
- network.setNetworkName("name123");
-
- L3Networks l3Networks = new L3Networks();
- l3Networks.getL3Network().add(network);
- l3Networks.getL3Network().add(network);
- Optional<L3Networks> optNetworks = Optional.of(l3Networks);
+ public void getRelatedNetworkByNameFromServiceInstanceNotFoundTest() throws Exception {
+ String serviceInstanceId = "serviceInstanceId";
+ String networkName = "networkName";
- doReturn(optNetworks).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class), any(AAIResourceUri.class));
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class),
+ any(AAIPluralResourceUri.class));
- bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(serviceInstanceId, networkName);
- }
+ Optional<L3Network> actualNetwork =
+ bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(serviceInstanceId, networkName);
- @Test
- public void getRelatedNetworkByNameFromServiceInstanceNotFoundTest() throws Exception {
- assertEquals(Optional.empty(), bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance("", ""));
+ assertEquals(Optional.empty(), actualNetwork);
}
@Test
@@ -534,7 +472,8 @@ public class BBInputSetupUtilsTest {
serviceInstance.setServiceInstanceName("serviceInstanceName");
expected.get().getServiceInstance().add(serviceInstance);
- doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class), any(AAIResourceUri.class));
+ doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class),
+ any(AAIPluralResourceUri.class));
Optional<ServiceInstance> actual = this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001");
assertTrue(actual.isPresent());
@@ -546,9 +485,6 @@ public class BBInputSetupUtilsTest {
public void getRelatedServiceInstanceFromInstanceGroupMultipleExceptionTest() throws Exception {
final String instanceGroupId = "ig-001";
expectedException.expect(MultipleObjectsFoundException.class);
- expectedException.expectMessage(
- String.format("Mulitple service instances were found for instance-group-id: %s.", instanceGroupId));
-
Optional<ServiceInstances> serviceInstances = Optional.of(new ServiceInstances());
ServiceInstance si1 = Mockito.mock(ServiceInstance.class);
ServiceInstance si2 = Mockito.mock(ServiceInstance.class);
@@ -556,60 +492,35 @@ public class BBInputSetupUtilsTest {
serviceInstances.get().getServiceInstance().add(si2);
doReturn(serviceInstances).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class),
- any(AAIResourceUri.class));
- bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup(instanceGroupId);
+ any(AAIPluralResourceUri.class));
+ this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup(instanceGroupId);
}
@Test
public void getRelatedServiceInstanceFromInstanceGroupNotFoundExceptionTest() throws Exception {
expectedException.expect(NoServiceInstanceFoundException.class);
- expectedException.expectMessage("No ServiceInstances Returned");
-
Optional<ServiceInstances> serviceInstances = Optional.of(new ServiceInstances());
doReturn(serviceInstances).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class),
- any(AAIResourceUri.class));
- bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001");
+ any(AAIPluralResourceUri.class));
+ this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001");
}
@Test
public void getRelatedVnfByNameFromServiceInstanceTest() throws Exception {
final String vnfId = "id123";
final String vnfName = "name123";
-
- Optional<GenericVnfs> expected = Optional.of(new GenericVnfs());
+ final String serviceInstanceId = "service-instance-id123";
GenericVnf vnf = new GenericVnf();
vnf.setVnfId(vnfId);
vnf.setVnfName(vnfName);
- expected.get().getGenericVnf().add(vnf);
-
- doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(GenericVnfs.class), any(AAIResourceUri.class));
- Optional<GenericVnf> actual = this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(vnfId, vnfName);
-
+ doReturn(Optional.of(vnf)).when(MOCK_aaiResourcesClient).getOne(GenericVnfs.class, GenericVnf.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ .relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName));
+ Optional<GenericVnf> actual =
+ this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName);
assertTrue(actual.isPresent());
- assertEquals(expected.get().getGenericVnf().get(0).getVnfId(), actual.get().getVnfId());
- }
-
- @Test
- public void getRelatedVnfByNameFromServiceInstanceMultipleVnfsExceptionTest() throws Exception {
- final String serviceInstanceId = "serviceInstanceId";
- final String vnfName = "vnfName";
- expectedException.expect(MultipleObjectsFoundException.class);
- expectedException.expectMessage(String.format(
- "Multiple vnfs found for service-instance-id: %s and vnf-name: %s.", serviceInstanceId, vnfName));
-
- GenericVnf vnf = new GenericVnf();
- vnf.setVnfId("id123");
- vnf.setVnfName("name123");
-
- GenericVnfs vnfs = new GenericVnfs();
- vnfs.getGenericVnf().add(vnf);
- vnfs.getGenericVnf().add(vnf);
-
- Optional<GenericVnfs> optVnfs = Optional.of(vnfs);
- doReturn(optVnfs).when(MOCK_aaiResourcesClient).get(eq(GenericVnfs.class), any(AAIResourceUri.class));
-
- bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName);
+ assertEquals(vnf.getVnfId(), actual.get().getVnfId());
}
@Test
@@ -617,69 +528,56 @@ public class BBInputSetupUtilsTest {
final String serviceInstanceId = "serviceInstanceId";
final String vnfName = "vnfName";
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).getOne(eq(GenericVnfs.class), eq(GenericVnf.class),
+ any(AAIPluralResourceUri.class));
+
assertEquals(Optional.empty(),
bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName));
}
@Test
public void getRelatedVolumeGroupByNameFromVnfTest() throws Exception {
- final String vnfId = "id123";
- final String vnfName = "name123";
-
- Optional<VolumeGroups> expected = Optional.of(new VolumeGroups());
+ final String vnfId = "vnf-id123";
+ final String volumeGroupId = "id123";
+ final String volumeGroupName = "volume-group-name123";
VolumeGroup volumeGroup = new VolumeGroup();
- volumeGroup.setVolumeGroupId(vnfId);
- volumeGroup.setVolumeGroupName(vnfName);
- expected.get().getVolumeGroup().add(volumeGroup);
-
- doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class));
- Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, vnfName);
-
- assertTrue(actual.isPresent());
- assertEquals(expected.get().getVolumeGroup().get(0).getVolumeGroupId(), actual.get().getVolumeGroupId());
+ volumeGroup.setVolumeGroupId(volumeGroupId);
+ volumeGroup.setVolumeGroupName(volumeGroupName);
+ doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-name", volumeGroupName));
+ Optional<VolumeGroup> actual =
+ this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName);
+ assertEquals(volumeGroup.getVolumeGroupId(), actual.get().getVolumeGroupId());
}
@Test
- public void getRelatedVolumeGroupByNameFromVnfMultipleVolumeGroupsExceptionTest() throws Exception {
- final String vnfId = "vnfId";
- final String volumeGroupName = "volumeGroupName";
- expectedException.expect(MultipleObjectsFoundException.class);
- expectedException.expectMessage(String.format(
- "Multiple volume-groups found for vnf-id: %s and volume-group-name: %s.", vnfId, volumeGroupName));
-
- VolumeGroup volumeGroup = new VolumeGroup();
- volumeGroup.setVolumeGroupId("id123");
- volumeGroup.setVolumeGroupName("name123");
+ public void getRelatedVolumeGroupByNameFromVnfNotFoundTest() throws Exception {
+ String vnfId = "vnfId";
+ String volumeGroupName = "volumeGroupName";
- VolumeGroups volumeGroups = new VolumeGroups();
- volumeGroups.getVolumeGroup().add(volumeGroup);
- volumeGroups.getVolumeGroup().add(volumeGroup);
- Optional<VolumeGroups> optVolumeGroups = Optional.of(volumeGroups);
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).getOne(eq(VolumeGroups.class), eq(VolumeGroup.class),
+ any(AAIPluralResourceUri.class));
- doReturn(optVolumeGroups).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class));
+ Optional<VolumeGroup> actualVolumeGroup =
+ bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName);
- bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName);
- }
-
- @Test
- public void getRelatedVolumeGroupByNameFromVnfNotFoundTest() throws Exception {
- assertEquals(Optional.empty(), bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf("", ""));
+ assertEquals(Optional.empty(), actualVolumeGroup);
}
@Test
public void getRelatedVolumeGroupByNameFromVfModuleTest() throws Exception {
- Optional<VolumeGroups> expected = Optional.of(new VolumeGroups());
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("id123");
volumeGroup.setVolumeGroupName("name123");
- expected.get().getVolumeGroup().add(volumeGroup);
-
- doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class));
- Optional<VolumeGroup> actual =
- this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "id123", "name123");
-
+ doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "vnf-id123", "vf-module-id123")
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP)
+ .queryParam("volume-group-name", "volume-group-name123"));
+ Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("vnf-id123",
+ "vf-module-id123", "volume-group-name123");
assertTrue(actual.isPresent());
- assertEquals(expected.get().getVolumeGroup().get(0).getVolumeGroupId(), actual.get().getVolumeGroupId());
+ assertEquals(volumeGroup.getVolumeGroupId(), actual.get().getVolumeGroupId());
}
@Test
@@ -707,51 +605,41 @@ public class BBInputSetupUtilsTest {
final String vnfId = "vnfId";
final String volumeGroupId = "volumeGroupId";
- assertEquals(Optional.empty(), bbInputSetupUtils.getRelatedVolumeGroupFromVfModule(vnfId, volumeGroupId));
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).getOne(eq(VolumeGroups.class), eq(VolumeGroup.class),
+ any(AAIPluralResourceUri.class));
+
+ Optional<VolumeGroup> actualVolumeGroup =
+ bbInputSetupUtils.getRelatedVolumeGroupFromVfModule(vnfId, volumeGroupId);
+
+ assertEquals(Optional.empty(), actualVolumeGroup);
}
@Test
public void getRelatedVolumeGroupFromVfModuleTest() throws Exception {
- Optional<VolumeGroups> expected = Optional.of(new VolumeGroups());
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("id123");
- expected.get().getVolumeGroup().add(volumeGroup);
-
- doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class));
- Optional<VolumeGroup> actual = bbInputSetupUtils.getRelatedVolumeGroupFromVfModule("id123", "id123");
-
+ doReturn(Optional.of(volumeGroup)).when(MOCK_aaiResourcesClient).getOne(VolumeGroups.class, VolumeGroup.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, "vnf-id123", "vf-module-id123")
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP));
+ Optional<VolumeGroup> actual =
+ this.bbInputSetupUtils.getRelatedVolumeGroupFromVfModule("vnf-id123", "vf-module-id123");
assertTrue(actual.isPresent());
- assertEquals(expected.get().getVolumeGroup().get(0).getVolumeGroupId(), actual.get().getVolumeGroupId());
+ assertEquals(volumeGroup.getVolumeGroupId(), actual.get().getVolumeGroupId());
}
@Test
- public void getRelatedVolumeGroupByNameFromVfModuleMultipleVolumeGroupsExceptionTest() throws Exception {
- final String vnfId = "vnfId";
- final String vfModuleId = "vfModuleId";
- final String volumeGroupName = "volumeGroupName";
-
- expectedException.expect(MultipleObjectsFoundException.class);
- expectedException.expectMessage(String.format(
- "Multiple voulme-groups found for vnf-id: %s, vf-module-id: %s and volume-group-name: %s.", vnfId,
- vfModuleId, volumeGroupName));
-
- VolumeGroup volumeGroup = new VolumeGroup();
- volumeGroup.setVolumeGroupId("id123");
- volumeGroup.setVolumeGroupName("name123");
-
- VolumeGroups volumeGroups = new VolumeGroups();
- volumeGroups.getVolumeGroup().add(volumeGroup);
- volumeGroups.getVolumeGroup().add(volumeGroup);
+ public void getRelatedVolumeGroupByNameFromVfModuleNotFoundTest() throws Exception {
+ String vnfId = "vnfId";
+ String volumeGroupId = "volumeGroupId";
+ String volumeGroupName = "volumeGroupName";
- Optional<VolumeGroups> optVolumeGroups = Optional.of(volumeGroups);
- doReturn(optVolumeGroups).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class));
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).getOne(eq(VolumeGroups.class), eq(VolumeGroup.class),
+ any(AAIPluralResourceUri.class));
- bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, vfModuleId, volumeGroupName);
- }
+ Optional<VolumeGroup> actualVolumeGroup =
+ bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupId, volumeGroupName);
- @Test
- public void getRelatedVolumeGroupByNameFromVfModuleNotFoundTest() throws Exception {
- assertEquals(Optional.empty(), bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("", "", ""));
+ assertEquals(Optional.empty(), actualVolumeGroup);
}
@Test
@@ -780,46 +668,28 @@ public class BBInputSetupUtilsTest {
}
@Test
- public void getRelatedConfigurationByNameFromServiceInstanceExceptionTest() throws Exception {
- Configuration configuration = new Configuration();
- configuration.setConfigurationId("id123");
-
- Configurations configurations = new Configurations();
- configurations.getConfiguration().add(configuration);
- configurations.getConfiguration().add(configuration);
-
- Optional<Configurations> optConfigurations = Optional.of(configurations);
-
- doReturn(optConfigurations).when(MOCK_aaiResourcesClient).get(eq(Configurations.class),
- any(AAIResourceUri.class));
-
- expectedException.expect(MultipleObjectsFoundException.class);
- this.bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance("id123", "name123");
- }
-
- @Test
public void getRelatedConfigurationByNameFromServiceInstanceNotFoundTest() throws Exception {
assertEquals(Optional.empty(), bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance("", ""));
}
@Test
public void getRelatedConfigurationByNameFromServiceInstanceTest() throws Exception {
- Optional<Configurations> expected = Optional.of(new Configurations());
Configuration configuration = new Configuration();
configuration.setConfigurationId("id123");
- expected.get().getConfiguration().add(configuration);
-
- doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(Configurations.class), any(AAIResourceUri.class));
- Optional<Configuration> actual =
- this.bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance("id123", "name123");
-
+ doReturn(Optional.of(configuration)).when(MOCK_aaiResourcesClient).getOne(Configurations.class,
+ Configuration.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "service-instance-id123")
+ .relatedTo(AAIObjectPlurals.CONFIGURATION)
+ .queryParam("configuration-name", "configuration-name123"));
+ Optional<Configuration> actual = this.bbInputSetupUtils
+ .getRelatedConfigurationByNameFromServiceInstance("service-instance-id123", "configuration-name123");
assertTrue(actual.isPresent());
- assertEquals(expected.get().getConfiguration().get(0).getConfigurationId(), actual.get().getConfigurationId());
+ assertEquals(configuration.getConfigurationId(), actual.get().getConfigurationId());
}
@Test
public void existsAAIVfModuleGloballyByNameTest() {
- AAIResourceUri expectedUri =
+ AAIPluralResourceUri expectedUri =
AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE).queryParam("vf-module-name", "testVfModule");
bbInputSetupUtils.existsAAIVfModuleGloballyByName("testVfModule");
@@ -828,7 +698,7 @@ public class BBInputSetupUtilsTest {
@Test
public void existsAAIConfigurationGloballyByNameTest() {
- AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
+ AAIPluralResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
.queryParam("configuration-name", "testConfig");
bbInputSetupUtils.existsAAIConfigurationGloballyByName("testConfig");
@@ -837,7 +707,7 @@ public class BBInputSetupUtilsTest {
@Test
public void existsAAINetworksGloballyByNameTest() {
- AAIResourceUri expectedUri =
+ AAIPluralResourceUri expectedUri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "testNetwork");
bbInputSetupUtils.existsAAINetworksGloballyByName("testNetwork");
@@ -846,7 +716,7 @@ public class BBInputSetupUtilsTest {
@Test
public void existsAAIVolumeGroupGloballyByNameTest() {
- AAIResourceUri expectedUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri expectedUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
.queryParam("volume-group-name", "testVoumeGroup");
bbInputSetupUtils.existsAAIVolumeGroupGloballyByName("testVoumeGroup");
@@ -860,7 +730,7 @@ public class BBInputSetupUtilsTest {
bbInputSetupUtils.updateInfraActiveRequestVnfId(infraActiveRequests, vnfId);
- assertEquals(infraActiveRequests.getVnfId(), vnfId);
+ assertEquals(vnfId, infraActiveRequests.getVnfId());
}
@Test
@@ -870,7 +740,7 @@ public class BBInputSetupUtilsTest {
bbInputSetupUtils.updateInfraActiveRequestVfModuleId(infraActiveRequests, vfModuleId);
- assertEquals(infraActiveRequests.getVfModuleId(), vfModuleId);
+ assertEquals(vfModuleId, infraActiveRequests.getVfModuleId());
}
@Test
@@ -880,7 +750,7 @@ public class BBInputSetupUtilsTest {
bbInputSetupUtils.updateInfraActiveRequestVolumeGroupId(infraActiveRequests, volumeGroupId);
- assertEquals(infraActiveRequests.getVolumeGroupId(), volumeGroupId);
+ assertEquals(volumeGroupId, infraActiveRequests.getVolumeGroupId());
}
@Test
@@ -890,7 +760,7 @@ public class BBInputSetupUtilsTest {
bbInputSetupUtils.updateInfraActiveRequestNetworkId(infraActiveRequests, networkId);
- assertEquals(infraActiveRequests.getNetworkId(), networkId);
+ assertEquals(networkId, infraActiveRequests.getNetworkId());
}
@Test
@@ -921,14 +791,14 @@ public class BBInputSetupUtilsTest {
mapper.readValue(new File(RESOURCE_PATH + "aaiL3NetworkInputWithSubnets.json"), L3Network.class);
Optional<VpnBinding> actual = bbInputSetupUtils.getAICVpnBindingFromNetwork(l3Network);
- assertEquals(actual, Optional.empty());
+ assertEquals(Optional.empty(), actual);
}
@Test
public void getAAIServiceInstancesGloballyByName_noAAIResourceTest() {
final String serviceInstanceName = "serviceInstanceName";
- doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class));
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIPluralResourceUri.class));
ServiceInstances actualServiceInstances =
bbInputSetupUtils.getAAIServiceInstancesGloballyByName(serviceInstanceName);
@@ -939,7 +809,7 @@ public class BBInputSetupUtilsTest {
public void getAAIVnfsGloballyByName_noAAIResourceTest() {
final String vnfName = "vnfName";
- doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class));
+ doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIPluralResourceUri.class));
GenericVnfs actualGenericVnfs = bbInputSetupUtils.getAAIVnfsGloballyByName(vnfName);
assertNull(actualGenericVnfs);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java
index f558932d33..10844ec652 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractCDSProcessingBBUtilsTest.java
@@ -34,6 +34,7 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
import org.onap.so.client.exception.ExceptionBuilder;
@@ -69,7 +70,7 @@ public class AbstractCDSProcessingBBUtilsTest {
}
@Test
- public void preProcessRequestTest() throws Exception {
+ public void preProcessRequestDETest() throws Exception {
DelegateExecution execution = mock(DelegateExecution.class);
when(execution.getVariable("executionObject")).thenReturn(abstractCDSPropertiesBean);
@@ -80,7 +81,7 @@ public class AbstractCDSProcessingBBUtilsTest {
}
@Test
- public void sendRequestToCDSClientTest() {
+ public void sendRequestToCDSClientDETest() {
DelegateExecution execution = mock(DelegateExecution.class);
when(execution.getVariable("executionServiceInput")).thenReturn(abstractCDSPropertiesBean);
@@ -90,4 +91,26 @@ public class AbstractCDSProcessingBBUtilsTest {
}
+ @Test
+ public void preProcessRequestBBTest() throws Exception {
+
+ BuildingBlockExecution execution = mock(BuildingBlockExecution.class);
+ when(execution.getVariable("executionObject")).thenReturn(abstractCDSPropertiesBean);
+
+ abstractCDSProcessingBBUtils.constructExecutionServiceInputObject(execution);
+ verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), anyInt(),
+ any(Exception.class));
+ }
+
+ @Test
+ public void sendRequestToCDSClientBBTest() {
+
+ BuildingBlockExecution execution = mock(BuildingBlockExecution.class);
+ when(execution.getVariable("executionServiceInput")).thenReturn(abstractCDSPropertiesBean);
+ abstractCDSProcessingBBUtils.sendRequestToCDSClient(execution);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), anyInt(),
+ any(Exception.class));
+
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java
new file mode 100644
index 0000000000..9c3ce60400
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java
@@ -0,0 +1,205 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.cds;
+
+import com.google.gson.JsonParser;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.serviceinstancebeans.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+public abstract class AbstractVnfCDSRequestProviderTest {
+
+ protected static final String GENERIC_VNF_ID = "vnfId_configVnfTest1";
+ protected static final String VF_MODULE_ID = "vf-module-id-1";
+ protected static final String VF_MODULE_NAME = "vf-module-name-1";
+ protected static final String VF_MODULE_CUSTOMIZATION_UUID = "23ce9ac4-e5dd-11e9-81b4-2a2ae2dbcce1";
+ protected static final String GENERIC_VNF_NAME = "vnf-name-1";
+ protected static final String SERVICE_INSTANCE_ID = "serviceInst_configTest";
+ protected static final String SERVICE_MODEL_UUID = "b45b5780-e5dd-11e9-81b4-2a2ae2dbcce4";
+ protected static final String SERVICE_INSTANCE_NAME = "test-service-instance";
+ protected static final String VNF_MODEL_CUSTOMIZATION_UUID = "23ce9ac4-e5dd-11e9-81b4-2a2ae2dbcce4";
+ protected static final String GENERAL_BLOCK_EXECUTION_MAP_KEY = "gBBInput";
+ protected static final String VNF_SCOPE = "vnf";
+ protected static final String SERVICE_SCOPE = "service";
+ protected static final String SERVICE_ACTION = "create";
+ protected static final String VF_SCOPE = "vfModule";
+ protected static final String ASSIGN_ACTION = "configAssign";
+ protected static final String DEPLOY_ACTION = "configDeploy";
+ protected static final String MSO_REQUEST_ID = "1234";
+ protected static final String BUILDING_BLOCK = "buildingBlock";
+ protected static final String PUBLIC_NET_ID = "public-net-id";
+ protected static final String CLOUD_REGION = "acl-cloud-region";
+
+ @Mock
+ protected ExtractPojosForBB extractPojosForBB;
+
+ protected BuildingBlockExecution buildingBlockExecution;
+
+ protected ExecuteBuildingBlock executeBuildingBlock;
+
+
+ @Before
+ public void setUp() {
+ buildingBlockExecution = createBuildingBlockExecution();
+ executeBuildingBlock = new ExecuteBuildingBlock();
+ }
+
+ protected BuildingBlockExecution createBuildingBlockExecution() {
+ DelegateExecution execution = new DelegateExecutionFake();
+ execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY, createGeneralBuildingBlock());
+ return new DelegateExecutionImpl(execution);
+ }
+
+ protected GeneralBuildingBlock createGeneralBuildingBlock() {
+ GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock();
+ RequestContext requestContext = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUserParams(createRequestUserParams());
+ requestContext.setRequestParameters(requestParameters);
+ requestContext.setMsoRequestId(MSO_REQUEST_ID);
+ generalBuildingBlock.setRequestContext(requestContext);
+ return generalBuildingBlock;
+ }
+
+ protected ServiceInstance createServiceInstance() {
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceName(SERVICE_INSTANCE_NAME);
+ serviceInstance.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelUuid(SERVICE_MODEL_UUID);
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ return serviceInstance;
+ }
+
+ protected GenericVnf createGenericVnf() {
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId(GENERIC_VNF_ID);
+ genericVnf.setVnfName(GENERIC_VNF_NAME);
+ genericVnf.setBlueprintName("test");
+ genericVnf.setBlueprintVersion("1.0.0");
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelCustomizationUuid(VNF_MODEL_CUSTOMIZATION_UUID);
+ genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+ return genericVnf;
+ }
+
+ protected VfModule createVfModule() {
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId(VF_MODULE_ID);
+ vfModule.setVfModuleName(VF_MODULE_NAME);
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelCustomizationUUID(VF_MODULE_CUSTOMIZATION_UUID);
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+ return vfModule;
+ }
+
+ protected List<Map<String, Object>> createRequestUserParams() {
+ List<Map<String, Object>> userParams = new ArrayList<>();
+ Map<String, Object> userParamMap = new HashMap<>();
+ userParamMap.put("service", getUserParams());
+ userParams.add(userParamMap);
+ return userParams;
+ }
+
+ protected Service getUserParams() {
+ Service service = new Service();
+ Resources resources = new Resources();
+ resources.setVnfs(createVnfList());
+ service.setResources(resources);
+ return service;
+ }
+
+ protected List<Vnfs> createVnfList() {
+ List<Map<String, String>> instanceParamsListSearchedVnf = new ArrayList<>();
+ Map<String, String> instanceParam = new HashMap<>();
+ instanceParam.put("public_net_id", PUBLIC_NET_ID);
+ instanceParam.put("acl-cloud-region", CLOUD_REGION);
+ instanceParamsListSearchedVnf.add(instanceParam);
+ Vnfs searchedVnf = createVnf(instanceParamsListSearchedVnf);
+ List<Vnfs> vnfList = new ArrayList<>();
+ vnfList.add(searchedVnf);
+ return vnfList;
+ }
+
+ protected Vnfs createVnf(List<Map<String, String>> instanceParamsList) {
+ Vnfs vnf = new Vnfs();
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(VNF_MODEL_CUSTOMIZATION_UUID);
+ vnf.setModelInfo(modelInfo);
+ vnf.setInstanceParams(instanceParamsList);
+
+ // Set instance parameters and modelinfo for vf-module
+ VfModules vfModule = new VfModules();
+ ModelInfo modelInfoForVfModule = new ModelInfo();
+ modelInfoForVfModule.setModelCustomizationId(VF_MODULE_CUSTOMIZATION_UUID);
+ vfModule.setModelInfo(modelInfoForVfModule);
+
+ List<Map<String, String>> instanceParamsListSearchedVfModule = new ArrayList<>();
+ Map<String, String> instanceParams = new HashMap<>();
+ instanceParams.put("public-net-vf-module-id", PUBLIC_NET_ID);
+ instanceParams.put("aci-cloud-region-vf-module", CLOUD_REGION);
+
+ instanceParamsListSearchedVfModule.add(instanceParams);
+ vfModule.setInstanceParams(instanceParamsListSearchedVfModule);
+
+ List<VfModules> vfModules = new ArrayList<>();
+ vfModules.add(vfModule);
+
+ vnf.setVfModules(vfModules);
+
+ return vnf;
+ }
+
+ protected boolean verfiyJsonFromString(String payload) {
+ JsonParser parser = new JsonParser();
+ return parser.parse(payload).isJsonObject();
+ }
+
+ protected void setScopeAndAction(String scope, String action) {
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnScope(scope);
+ buildingBlock.setBpmnAction(action);
+ executeBuildingBlock.setBuildingBlock(buildingBlock);
+ buildingBlockExecution.setVariable(BUILDING_BLOCK, executeBuildingBlock);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java
new file mode 100644
index 0000000000..9baf5dc5bf
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ConfigureInstanceParamsForVfModuleTest.java
@@ -0,0 +1,127 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Bell Canada
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.client.cds;
+
+import com.google.gson.JsonObject;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.Resources;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.VfModules;
+import org.onap.so.serviceinstancebeans.Vnfs;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.anyList;
+import static org.mockito.Mockito.doReturn;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class ConfigureInstanceParamsForVfModuleTest {
+
+ @InjectMocks
+ private ConfigureInstanceParamsForVfModule configureInstanceParamsForVfModule;
+
+ @Mock
+ private ExtractServiceFromUserParameters extractServiceFromUserParameters;
+
+ private static final String TEST_VNF_MODEL_CUSTOMIZATION_UUID = "23ce9ac4-e5dd-11e9-81b4-2a2ae2dbcce4";
+ private static final String TEST_VF_MODULE_CUSTOMIZATION_UUID = "23ce9ac4-e5dd-11e9-81b4-2a2ae2dbcce2";
+ private static final String TEST_INSTANCE_PARAM_VALUE_1 = "vf-module-1-value";
+ private static final String TEST_INSTANCE_PARAM_VALUE_2 = "vf-module-2-value";
+ private static final String TEST_INSTANCE_PARAM_KEY_1 = "instance-param-1";
+ private static final String TEST_INSTANCE_PARAM_KEY_2 = "instance-param-2";
+
+ @Test
+ public void testInstanceParamsForVfModule() throws Exception {
+ // given
+ List<Map<String, Object>> userParamsFromRequest = createRequestParameters();
+ JsonObject jsonObject = new JsonObject();
+ doReturn(getUserParams()).when(extractServiceFromUserParameters).getServiceFromRequestUserParams(anyList());
+
+ // when
+ configureInstanceParamsForVfModule.populateInstanceParams(jsonObject, userParamsFromRequest,
+ TEST_VNF_MODEL_CUSTOMIZATION_UUID, TEST_VF_MODULE_CUSTOMIZATION_UUID);
+
+ // verify
+ assertEquals(TEST_INSTANCE_PARAM_VALUE_1, jsonObject.get(TEST_INSTANCE_PARAM_KEY_1).getAsString());
+ assertEquals(TEST_INSTANCE_PARAM_VALUE_2, jsonObject.get(TEST_INSTANCE_PARAM_KEY_2).getAsString());
+ }
+
+ private List<Map<String, Object>> createRequestParameters() {
+ List<Map<String, Object>> userParams = new ArrayList<>();
+ Map<String, Object> userParamMap = new HashMap<>();
+ userParamMap.put("service", getUserParams());
+ userParams.add(userParamMap);
+ return userParams;
+ }
+
+ private Service getUserParams() {
+ Service service = new Service();
+ Resources resources = new Resources();
+ resources.setVnfs(createVnfs());
+ service.setResources(resources);
+ return service;
+ }
+
+ private List<Vnfs> createVnfs() {
+ Vnfs searchedVnf = createVnf();
+ List<Vnfs> vnfList = new ArrayList<>();
+ vnfList.add(searchedVnf);
+ return vnfList;
+ }
+
+ private Vnfs createVnf() {
+ Vnfs vnf = new Vnfs();
+ ModelInfo modelInfoForVnf = new ModelInfo();
+ modelInfoForVnf.setModelCustomizationId(TEST_VNF_MODEL_CUSTOMIZATION_UUID);
+ vnf.setModelInfo(modelInfoForVnf);
+
+ VfModules vfModule = new VfModules();
+
+ ModelInfo modelInfoForVfModule = new ModelInfo();
+ modelInfoForVfModule.setModelCustomizationId(TEST_VF_MODULE_CUSTOMIZATION_UUID);
+
+ vfModule.setModelInfo(modelInfoForVfModule);
+
+ // Set instance parameters.
+ List<Map<String, String>> instanceParamsListSearchedVfModule = new ArrayList<>();
+ Map<String, String> instanceParams = new HashMap<>();
+ instanceParams.put("instance-param-1", TEST_INSTANCE_PARAM_VALUE_1);
+ instanceParams.put("instance-param-2", TEST_INSTANCE_PARAM_VALUE_2);
+
+ instanceParamsListSearchedVfModule.add(instanceParams);
+ vfModule.setInstanceParams(instanceParamsListSearchedVfModule);
+
+ List<VfModules> vfModules = new ArrayList<>();
+ vfModules.add(vfModule);
+
+ vnf.setVfModules(vfModules);
+
+ return vnf;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/GeneratePayloadForCdsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/GeneratePayloadForCdsTest.java
new file mode 100644
index 0000000000..998976589c
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/GeneratePayloadForCdsTest.java
@@ -0,0 +1,342 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Bell Canada.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.client.cds;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.onap.so.serviceinstancebeans.*;
+import java.util.*;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.ThrowableAssert.catchThrowable;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class GeneratePayloadForCdsTest {
+ private static final String VF_MODULE_CUSTOMIZATION_UUID = "23ce9ac4-e5dd-11e9-81b4-2a2ae2dbcce1";
+ private static final String VNF_MODEL_CUSTOMIZATION_UUID = "23ce9ac4-e5dd-11e9-81b4-2a2ae2dbcce4";
+ private static final String GENERAL_BLOCK_EXECUTION_MAP_KEY = "gBBInput";
+ private static final String VNF_SCOPE = "vnf";
+ private static final String SERVICE_SCOPE = "service";
+ private static final String SERVICE_ACTION = "create";
+ private static final String VF_SCOPE = "vfModule";
+ private static final String ASSIGN_ACTION = "configAssign";
+ private static final String DEPLOY_ACTION = "configDeploy";
+ private static final String DOWNLOAD_ACTION = "downloadNESw";
+ private static final String MSO_REQUEST_ID = "1234";
+ private static final String BUILDING_BLOCK = "buildingBlock";
+ private static final String PUBLIC_NET_ID = "public-net-id";
+ private static final String CLOUD_REGION = "acl-cloud-region";
+ private static final String TEST_MODEL_UUID = "6bc0b04d-1873-4721-b53d-6615225b2a28";
+ private static final String TEST_SERVICE_INSTANCE_ID = "test_service_id";
+ private static final String TEST_PROCESS_KEY = "processKey1";
+ private static final String TEST_PNF_RESOURCE_INSTANCE_NAME = "PNF_demo_resource";
+ private static final String TEST_PNF_CORRELATION_ID = "PNFDemo";
+ private static final String TEST_PNF_RESOURCE_CUSTOMIZATION_UUID = "9acb3a83-8a52-412c-9a45-901764938144";
+ private static final String TEST_MSO_REQUEST_ID = "ff874603-4222-11e7-9252-005056850d2e";
+ private static final String TEST_PNF_UUID = "5df8b6de-2083-11e7-93ae-92361f002671";
+ private static final String TEST_SOFTWARE_VERSION = "demo-sw-ver2.0.0";
+ private static final String PNF_CORRELATION_ID = "pnfCorrelationId";
+ private static final String PNF_UUID = "pnfUuid";
+ private static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
+ private static final String MODEL_UUID = "modelUuid";
+ private static final String PRC_CUSTOMIZATION_UUID = "PRC_customizationUuid";
+ private static final String PRC_INSTANCE_NAME = "PRC_instanceName";
+ private static final String PRC_TARGET_SOFTWARE_VERSION = "targetSoftwareVersion";
+ private static final String SCOPE = "scope";
+ private static final String ACTION = "action";
+ private static final String PROCESS_KEY = "testProcessKey";
+ private static final String PRC_BLUEPRINT_NAME = "PRC_blueprintName";
+ private static final String PRC_BLUEPRINT_VERSION = "PRC_blueprintVersion";
+ private static final String TEST_PNF_RESOURCE_BLUEPRINT_NAME = "blueprintOnap";
+ private static final String TEST_PNF_RESOURCE_BLUEPRINT_VERSION = "1.0.1";
+
+ private BuildingBlockExecution buildingBlockExecution;
+ private ExecuteBuildingBlock executeBuildingBlock;
+
+ @InjectMocks
+ private GeneratePayloadForCds configurePayloadForCds;
+
+ @Mock
+ private VnfCDSRequestProvider vnfCDSRequestProvider;
+
+ @Mock
+ private VfModuleCDSRequestProvider vfModuleCDSRequestProvider;
+
+ @Mock
+ private ServiceCDSRequestProvider serviceCDSRequestProvider;
+
+ @Mock
+ private PnfCDSRequestProvider pnfCDSRequestProvider;
+
+
+ @Before
+ public void setup() {
+ buildingBlockExecution = createBuildingBlockExecution();
+ executeBuildingBlock = new ExecuteBuildingBlock();
+ }
+
+ @Test
+ public void testBuildCdsPropertiesBeanAssignVnf() throws Exception {
+ // given
+ final String assignPayload =
+ "{\"configAssign-request\":{\"resolution-key\":\"vnf-name-1\",\"configAssign-properties\":{\"service-instance-id\":\"serviceInst_configTest\",\"service-model-uuid\":\"b45b5780-e5dd-11e9-81b4-2a2ae2dbcce4\",\"vnf-id\":\"vnfId_configVnfTest1\",\"vnf-name\":\"vnf-name-1\",\"vnf-customization-uuid\":\"23ce9ac4-e5dd-11e9-81b4-2a2ae2dbcce4\",\"acl-cloud-region\":\"acl-cloud-region\",\"public_net_id\":\"public-net-id\"}}}";
+ setScopeAndAction(VNF_SCOPE, ASSIGN_ACTION);
+ doReturn(Optional.of(assignPayload)).when(vnfCDSRequestProvider).buildRequestPayload(ASSIGN_ACTION);
+
+ // when
+ AbstractCDSPropertiesBean propertyBean = configurePayloadForCds.buildCdsPropertiesBean(buildingBlockExecution);
+
+ // verify
+ assertNotNull(propertyBean);
+ String payload = propertyBean.getRequestObject();
+ assertThat(assignPayload.equals(payload));
+ assertThat(propertyBean.getRequestId().equals(MSO_REQUEST_ID));
+ assertThat(propertyBean.getOriginatorId().equals("SO"));
+ assertNotNull(propertyBean.getSubRequestId());
+ assertThat(propertyBean.getActionName().equals(ASSIGN_ACTION));
+ assertThat(propertyBean.getMode().equalsIgnoreCase("sync"));
+ }
+
+ @Test
+ public void testBuildCdsPropertiesBeanDeployVnf() throws Exception {
+ // given
+ final String deployPayload =
+ "{\"configDeploy-request\":{\"resolution-key\":\"vnf-name-1\",\"configDeploy-properties\":{\"service-instance-id\":\"serviceInst_configTest\",\"service-model-uuid\":\"b45b5780-e5dd-11e9-81b4-2a2ae2dbcce4\",\"vnf-id\":\"vnfId_configVnfTest1\",\"vnf-name\":\"vnf-name-1\",\"vnf-customization-uuid\":\"23ce9ac4-e5dd-11e9-81b4-2a2ae2dbcce4\",\"acl-cloud-region\":\"acl-cloud-region\",\"public_net_id\":\"public-net-id\"}}}";
+ setScopeAndAction(VNF_SCOPE, DEPLOY_ACTION);
+ doReturn(Optional.of(deployPayload)).when(vnfCDSRequestProvider).buildRequestPayload(DEPLOY_ACTION);
+
+ // when
+ AbstractCDSPropertiesBean propertyBean = configurePayloadForCds.buildCdsPropertiesBean(buildingBlockExecution);
+
+ // verify
+ assertNotNull(propertyBean);
+ String payload = propertyBean.getRequestObject();
+ assertThat(deployPayload.equals(payload));
+ assertThat(propertyBean.getRequestId().equals(MSO_REQUEST_ID));
+ assertThat(propertyBean.getOriginatorId().equals("SO"));
+ assertNotNull(propertyBean.getSubRequestId());
+ assertThat(propertyBean.getActionName().equals(DEPLOY_ACTION));
+ assertThat(propertyBean.getMode().equalsIgnoreCase("sync"));
+ }
+
+ @Test
+ public void testBuildCdsPropertiesBeanCreateService() throws Exception {
+ // given
+ final String servicePayload =
+ "{\"create-request\":{\"resolution-key\":\"test-service-instance\",\"create-properties\":{\"service-instance-id\":\"serviceInst_configTest\",\"service-model-uuid\":\"b45b5780-e5dd-11e9-81b4-2a2ae2dbcce4\"}}}";
+ setScopeAndAction(SERVICE_SCOPE, SERVICE_ACTION);
+ doReturn(Optional.of(servicePayload)).when(serviceCDSRequestProvider).buildRequestPayload(SERVICE_ACTION);
+
+ // when
+ AbstractCDSPropertiesBean propertyBean = configurePayloadForCds.buildCdsPropertiesBean(buildingBlockExecution);
+
+ // verify
+ assertNotNull(propertyBean);
+ String payload = propertyBean.getRequestObject();
+ assertThat(servicePayload.equals(payload));
+ assertThat(propertyBean.getRequestId().equals(MSO_REQUEST_ID));
+ assertThat(propertyBean.getOriginatorId().equals("SO"));
+ assertNotNull(propertyBean.getSubRequestId());
+ assertThat(propertyBean.getActionName().equals(SERVICE_ACTION));
+ assertThat(propertyBean.getMode().equalsIgnoreCase("sync"));
+ }
+
+ @Test
+ public void testBuildCdsPropertiesBeanConfigDeployVfModule() throws Exception {
+ // given
+ final String deployVfModulePayload =
+ "{\"configDeploy-request\":{\"resolution-key\":\"vf-module-name-1\",\"template-prefix\":\"vf-module-name-1configDeploy\",\"configDeploy-properties\":{\"service-instance-id\":\"serviceInst_configTest\",\"service-model-uuid\":\"b45b5780-e5dd-11e9-81b4-2a2ae2dbcce4\",\"vnf-id\":\"vnfId_configVnfTest1\",\"vnf-name\":\"vnf-name-1\",\"vf-module-id\":\"vf-module-id-1\",\"vf-module-name\":\"vf-module-name-1\",\"vf-module-customization-uuid\":\"23ce9ac4-e5dd-11e9-81b4-2a2ae2dbcce1\",\"aci-cloud-region-vf-module\":\"acl-cloud-region\",\"public-net-vf-module-id\":\"public-net-id\"}}}";
+ setScopeAndAction(VF_SCOPE, DEPLOY_ACTION);
+ doReturn(Optional.of(deployVfModulePayload)).when(vfModuleCDSRequestProvider)
+ .buildRequestPayload(DEPLOY_ACTION);
+
+ // when
+ AbstractCDSPropertiesBean propertyBean = configurePayloadForCds.buildCdsPropertiesBean(buildingBlockExecution);
+
+ // verify
+ assertNotNull(propertyBean);
+ String payload = propertyBean.getRequestObject();
+ assertThat(deployVfModulePayload.equals(payload));
+ assertThat(propertyBean.getRequestId().equals(MSO_REQUEST_ID));
+ assertThat(propertyBean.getOriginatorId().equals("SO"));
+ assertNotNull(propertyBean.getSubRequestId());
+ assertThat(propertyBean.getActionName().equals(DEPLOY_ACTION));
+ assertThat(propertyBean.getMode().equalsIgnoreCase("sync"));
+ }
+
+ @Test
+ public void testBuildCdsPropertiesBeanDownloadPnf() throws Exception {
+ // given
+ final String downloadPayload =
+ "{\"downloadNeSw-request\":{\"resolution-key\":\"PNFDemo\",\"downloadNeSw-properties\":{\"service-instance-id\":\"test_service_id\",\"service-model-uuid\":\"6bc0b04d-1873-4721-b53d-6615225b2a28\",\"pnf-id\":\"5df8b6de-2083-11e7-93ae-92361f002671\",\"pnf-name\":\"PNFDemo\",\"pnf-customization-uuid\":\"9acb3a83-8a52-412c-9a45-901764938144\",\"target-software-version\":\"demo-sw-ver2.0.0\"}}}";
+ DelegateExecution execution = prepareDelegateExecutionObj(PayloadConstants.PNF_SCOPE, DOWNLOAD_ACTION);
+ doReturn(Optional.of(downloadPayload)).when(pnfCDSRequestProvider).buildRequestPayload(DOWNLOAD_ACTION);
+ doReturn(TEST_PNF_RESOURCE_BLUEPRINT_NAME).when(pnfCDSRequestProvider).getBlueprintName();
+ doReturn(TEST_PNF_RESOURCE_BLUEPRINT_VERSION).when(pnfCDSRequestProvider).getBlueprintVersion();
+
+ // when
+ AbstractCDSPropertiesBean propertyBean = configurePayloadForCds.buildCdsPropertiesBean(execution);
+
+ // verify
+ assertNotNull(propertyBean);
+ String payload = propertyBean.getRequestObject();
+ assertThat(downloadPayload.equals(payload));
+ assertThat(propertyBean.getRequestId().equals(MSO_REQUEST_ID));
+ assertThat(propertyBean.getOriginatorId().equals("SO"));
+ assertNotNull(propertyBean.getSubRequestId());
+ assertThat(propertyBean.getActionName().equals(DOWNLOAD_ACTION));
+ assertThat(propertyBean.getMode().equalsIgnoreCase("async"));
+ assertThat(propertyBean.getBlueprintName().equalsIgnoreCase(TEST_PNF_RESOURCE_BLUEPRINT_NAME));
+ assertThat(propertyBean.getBlueprintVersion().equalsIgnoreCase(TEST_PNF_RESOURCE_BLUEPRINT_VERSION));
+ }
+
+ @Test
+ public void testFailureWhenServiceInstanceIsNotPresent() throws Exception {
+ // given
+ setScopeAndAction(VNF_SCOPE, ASSIGN_ACTION);
+ doThrow(PayloadGenerationException.class).when(serviceCDSRequestProvider).buildRequestPayload(ASSIGN_ACTION);
+
+ // when
+ final Throwable throwable =
+ catchThrowable(() -> configurePayloadForCds.buildCdsPropertiesBean(buildingBlockExecution));
+
+ // verify
+ assertThat(throwable).isInstanceOf(PayloadGenerationException.class)
+ .hasMessage("Failed to build payload for CDS");
+ }
+
+ private BuildingBlockExecution createBuildingBlockExecution() {
+ DelegateExecution execution = new DelegateExecutionFake();
+ execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY, createGeneralBuildingBlock());
+ return new DelegateExecutionImpl(execution);
+ }
+
+ private GeneralBuildingBlock createGeneralBuildingBlock() {
+ GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock();
+ RequestContext requestContext = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUserParams(createRequestUserParams());
+ requestContext.setRequestParameters(requestParameters);
+ requestContext.setMsoRequestId(MSO_REQUEST_ID);
+ generalBuildingBlock.setRequestContext(requestContext);
+ return generalBuildingBlock;
+ }
+
+ private List<Map<String, Object>> createRequestUserParams() {
+ List<Map<String, Object>> userParams = new ArrayList<>();
+ Map<String, Object> userParamMap = new HashMap<>();
+ userParamMap.put("service", getUserParams());
+ userParams.add(userParamMap);
+ return userParams;
+ }
+
+ private Service getUserParams() {
+ Service service = new Service();
+ Resources resources = new Resources();
+ resources.setVnfs(createVnfList());
+ service.setResources(resources);
+ return service;
+ }
+
+ private List<Vnfs> createVnfList() {
+ List<Map<String, String>> instanceParamsListSearchedVnf = new ArrayList<>();
+ Map<String, String> instanceParam = new HashMap<>();
+ instanceParam.put("public_net_id", PUBLIC_NET_ID);
+ instanceParam.put("acl-cloud-region", CLOUD_REGION);
+ instanceParamsListSearchedVnf.add(instanceParam);
+ Vnfs searchedVnf = createVnf(instanceParamsListSearchedVnf);
+ List<Vnfs> vnfList = new ArrayList<>();
+ vnfList.add(searchedVnf);
+ return vnfList;
+ }
+
+ private Vnfs createVnf(List<Map<String, String>> instanceParamsList) {
+ Vnfs vnf = new Vnfs();
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(VNF_MODEL_CUSTOMIZATION_UUID);
+ vnf.setModelInfo(modelInfo);
+ vnf.setInstanceParams(instanceParamsList);
+
+ // Set instance parameters and modelinfo for vf-module
+ VfModules vfModule = new VfModules();
+ ModelInfo modelInfoForVfModule = new ModelInfo();
+ modelInfoForVfModule.setModelCustomizationId(VF_MODULE_CUSTOMIZATION_UUID);
+ vfModule.setModelInfo(modelInfoForVfModule);
+
+ List<Map<String, String>> instanceParamsListSearchedVfModule = new ArrayList<>();
+ Map<String, String> instanceParams = new HashMap<>();
+ instanceParams.put("public-net-vf-module-id", PUBLIC_NET_ID);
+ instanceParams.put("aci-cloud-region-vf-module", CLOUD_REGION);
+
+ instanceParamsListSearchedVfModule.add(instanceParams);
+ vfModule.setInstanceParams(instanceParamsListSearchedVfModule);
+
+ List<VfModules> vfModules = new ArrayList<>();
+ vfModules.add(vfModule);
+
+ vnf.setVfModules(vfModules);
+
+ return vnf;
+ }
+
+ private void setScopeAndAction(String scope, String action) {
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnScope(scope);
+ buildingBlock.setBpmnAction(action);
+ executeBuildingBlock.setBuildingBlock(buildingBlock);
+ buildingBlockExecution.setVariable(BUILDING_BLOCK, executeBuildingBlock);
+ }
+
+ private DelegateExecution prepareDelegateExecutionObj(String scope, String action) {
+ DelegateExecution execution = new DelegateExecutionFake();
+ execution.setVariable(PROCESS_KEY, TEST_PROCESS_KEY);
+ execution.setVariable(PNF_CORRELATION_ID, TEST_PNF_CORRELATION_ID);
+ execution.setVariable(MODEL_UUID, TEST_MODEL_UUID);
+ execution.setVariable(SERVICE_INSTANCE_ID, TEST_SERVICE_INSTANCE_ID);
+ execution.setVariable(MSO_REQUEST_ID, TEST_MSO_REQUEST_ID);
+ execution.setVariable(PNF_UUID, TEST_PNF_UUID);
+ execution.setVariable(PRC_INSTANCE_NAME, TEST_PNF_RESOURCE_INSTANCE_NAME);
+ execution.setVariable(PRC_CUSTOMIZATION_UUID, TEST_PNF_RESOURCE_CUSTOMIZATION_UUID);
+ execution.setVariable(PRC_TARGET_SOFTWARE_VERSION, TEST_SOFTWARE_VERSION);
+ execution.setVariable(PRC_BLUEPRINT_NAME, TEST_PNF_RESOURCE_BLUEPRINT_NAME);
+ execution.setVariable(PRC_BLUEPRINT_VERSION, TEST_PNF_RESOURCE_BLUEPRINT_VERSION);
+ execution.setVariable(SCOPE, scope);
+ execution.setVariable(ACTION, action);
+ execution.setVariable("mode", "async");
+ return execution;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/PnfCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/PnfCDSRequestProviderTest.java
new file mode 100644
index 0000000000..88559280b6
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/PnfCDSRequestProviderTest.java
@@ -0,0 +1,139 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.cds;
+
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.JsonParser;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.junit.MockitoJUnitRunner;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class PnfCDSRequestProviderTest {
+
+ @InjectMocks
+ private PnfCDSRequestProvider pnfCDSRequestProvider;
+
+ private static final String DOWNLOAD_ACTION = "downloadNESw";
+ private static final String ACTIVATE_ACTION = "activateNESw";
+ private static final String TEST_MODEL_UUID = "6bc0b04d-1873-4721-b53d-6615225b2a28";
+ private static final String TEST_SERVICE_INSTANCE_ID = "test_service_id";
+ private static final String TEST_PROCESS_KEY = "processKey1";
+ private static final String TEST_PNF_RESOURCE_INSTANCE_NAME = "PNF_demo_resource";
+ private static final String TEST_PNF_CORRELATION_ID = "PNFDemo";
+ private static final String TEST_PNF_RESOURCE_CUSTOMIZATION_UUID = "9acb3a83-8a52-412c-9a45-901764938144";
+ private static final String TEST_MSO_REQUEST_ID = "ff874603-4222-11e7-9252-005056850d2e";
+ private static final String TEST_PNF_UUID = "5df8b6de-2083-11e7-93ae-92361f002671";
+ private static final String TEST_SOFTWARE_VERSION = "demo-sw-ver2.0.0";
+ private static final String PNF_CORRELATION_ID = "pnfCorrelationId";
+ private static final String PNF_UUID = "pnfUuid";
+ private static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
+ private static final String MSO_REQUEST_ID = "msoRequestId";
+ private static final String MODEL_UUID = "modelUuid";
+ private static final String PRC_CUSTOMIZATION_UUID = "PRC_customizationUuid";
+ private static final String PRC_INSTANCE_NAME = "PRC_instanceName";
+ private static final String PRC_TARGET_SOFTWARE_VERSION = "targetSoftwareVersion";
+ private static final String SCOPE = "scope";
+ private static final String ACTION = "action";
+ private static final String PROCESS_KEY = "testProcessKey";
+ private static final String PRC_BLUEPRINT_NAME = "PRC_blueprintName";
+ private static final String PRC_BLUEPRINT_VERSION = "PRC_blueprintVersion";
+ private static final String TEST_PNF_RESOURCE_BLUEPRINT_NAME = "blueprintOnap";
+ private static final String TEST_PNF_RESOURCE_BLUEPRINT_VERSION = "1.0.1";
+
+ @Test
+ public void testBuildRequestPayloadDownloadActionPnf() {
+ try {
+ runTest(DOWNLOAD_ACTION);
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ @Test
+ public void testBuildRequestPayloadActivateActionPnf() {
+ try {
+ runTest(ACTIVATE_ACTION);
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ private void runTest(String action) throws Exception {
+ // given
+ DelegateExecution execution = prepareDelegateExecutionObj(PayloadConstants.PNF_SCOPE, action);
+
+ // when
+ pnfCDSRequestProvider.setExecutionObject(execution);
+ String payload = pnfCDSRequestProvider.buildRequestPayload(action).get();
+ System.out.println(payload);
+
+ // verify
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode payloadJson = mapper.readTree(payload);
+ JsonNode requestNode = payloadJson.findValue(action + "-request");
+ JsonNode propertiesNode = payloadJson.findValue(action + "-properties");
+
+ assertNotNull(payload);
+ assertTrue(verfiyJsonFromString(payload));
+ assertThat(requestNode.get("resolution-key").asText()).isEqualTo(TEST_PNF_CORRELATION_ID);
+ assertThat(propertiesNode.get("service-instance-id").asText()).isEqualTo(TEST_SERVICE_INSTANCE_ID);
+ assertThat(propertiesNode.get("service-model-uuid").asText()).isEqualTo(TEST_MODEL_UUID);
+ assertThat(propertiesNode.get("pnf-id").asText()).isEqualTo(TEST_PNF_UUID);
+ assertThat(propertiesNode.get("pnf-customization-uuid").asText())
+ .isEqualTo(TEST_PNF_RESOURCE_CUSTOMIZATION_UUID);
+ assertThat(propertiesNode.get("target-software-version").asText()).isEqualTo(TEST_SOFTWARE_VERSION);
+ assertThat(pnfCDSRequestProvider.getBlueprintName().equals(TEST_PNF_RESOURCE_BLUEPRINT_NAME));
+ assertThat(pnfCDSRequestProvider.getBlueprintVersion().equals(TEST_PNF_RESOURCE_BLUEPRINT_VERSION));
+ }
+
+ private DelegateExecution prepareDelegateExecutionObj(String scope, String action) {
+ DelegateExecution execution = new DelegateExecutionFake();
+ execution.setVariable(PROCESS_KEY, TEST_PROCESS_KEY);
+ execution.setVariable(PNF_CORRELATION_ID, TEST_PNF_CORRELATION_ID);
+ execution.setVariable(MODEL_UUID, TEST_MODEL_UUID);
+ execution.setVariable(SERVICE_INSTANCE_ID, TEST_SERVICE_INSTANCE_ID);
+ execution.setVariable(MSO_REQUEST_ID, TEST_MSO_REQUEST_ID);
+ execution.setVariable(PNF_UUID, TEST_PNF_UUID);
+ execution.setVariable(PRC_INSTANCE_NAME, TEST_PNF_RESOURCE_INSTANCE_NAME);
+ execution.setVariable(PRC_CUSTOMIZATION_UUID, TEST_PNF_RESOURCE_CUSTOMIZATION_UUID);
+ execution.setVariable(PRC_TARGET_SOFTWARE_VERSION, TEST_SOFTWARE_VERSION);
+ execution.setVariable(SCOPE, scope);
+ execution.setVariable(ACTION, action);
+ execution.setVariable(PRC_BLUEPRINT_NAME, TEST_PNF_RESOURCE_BLUEPRINT_NAME);
+ execution.setVariable(PRC_BLUEPRINT_VERSION, TEST_PNF_RESOURCE_BLUEPRINT_VERSION);
+ return execution;
+ }
+
+ private boolean verfiyJsonFromString(String payload) {
+ JsonParser parser = new JsonParser();
+ return parser.parse(payload).isJsonObject();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ServiceCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ServiceCDSRequestProviderTest.java
new file mode 100644
index 0000000000..70ce3a1eed
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/ServiceCDSRequestProviderTest.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.cds;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.*;
+
+public class ServiceCDSRequestProviderTest extends AbstractVnfCDSRequestProviderTest {
+
+ @InjectMocks
+ private ServiceCDSRequestProvider serviceCDSRequestProvider;
+
+ @Test
+ public void testRequestPayloadForCreateService() throws Exception {
+ // given
+ setScopeAndAction(SERVICE_SCOPE, SERVICE_ACTION);
+ ServiceInstance instance = createServiceInstance();
+ doReturn(instance).when(extractPojosForBB).extractByKey(buildingBlockExecution,
+ ResourceKey.SERVICE_INSTANCE_ID);
+
+ // when
+ serviceCDSRequestProvider.setExecutionObject(buildingBlockExecution);
+ String payload = serviceCDSRequestProvider.buildRequestPayload(SERVICE_ACTION).get();
+
+ // verify
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode payloadJson = mapper.readTree(payload);
+ JsonNode requestNode = payloadJson.findValue("create-request");
+ JsonNode propertiesNode = payloadJson.findValue("create-properties");
+
+ assertNotNull(payload);
+ assertTrue(verfiyJsonFromString(payload));
+ assertThat(requestNode.get("resolution-key").asText()).isEqualTo(SERVICE_INSTANCE_NAME);
+ assertThat(propertiesNode.get("service-instance-id").asText()).isEqualTo(SERVICE_INSTANCE_ID);
+ assertThat(propertiesNode.get("service-model-uuid").asText()).isEqualTo(SERVICE_MODEL_UUID);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java
new file mode 100644
index 0000000000..2ca09d9ab3
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java
@@ -0,0 +1,80 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.cds;
+
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.*;
+
+public class VfModuleCDSRequestProviderTest extends AbstractVnfCDSRequestProviderTest {
+
+ @InjectMocks
+ private VfModuleCDSRequestProvider vfModuleCDSRequestProvider;
+
+ @Mock
+ protected ConfigureInstanceParamsForVfModule configureInstanceParamsForVfModule;
+
+ @Test
+ public void testRequestPayloadForConfigDeployVfModule() throws Exception {
+ // given
+ setScopeAndAction(VF_SCOPE, DEPLOY_ACTION);
+ ServiceInstance serviceInstance = createServiceInstance();
+
+ doReturn(serviceInstance).when(extractPojosForBB).extractByKey(buildingBlockExecution,
+ ResourceKey.SERVICE_INSTANCE_ID);
+ doReturn(createGenericVnf()).when(extractPojosForBB).extractByKey(buildingBlockExecution,
+ ResourceKey.GENERIC_VNF_ID);
+ doReturn(createVfModule()).when(extractPojosForBB).extractByKey(buildingBlockExecution,
+ ResourceKey.VF_MODULE_ID);
+ doNothing().when(configureInstanceParamsForVfModule).populateInstanceParams(any(), any(), anyString(),
+ anyString());
+
+ // when
+ vfModuleCDSRequestProvider.setExecutionObject(buildingBlockExecution);
+ String payload = vfModuleCDSRequestProvider.buildRequestPayload(DEPLOY_ACTION).get();
+
+ // verify
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode payloadJson = mapper.readTree(payload);
+ JsonNode requestNode = payloadJson.findValue("configDeploy-request");
+ JsonNode propertiesNode = payloadJson.findValue("configDeploy-properties");
+
+ assertNotNull(payload);
+ assertTrue(verfiyJsonFromString(payload));
+ assertThat(requestNode.get("resolution-key").asText()).isEqualTo(VF_MODULE_NAME);
+ assertThat(propertiesNode.get("service-instance-id").asText()).isEqualTo(SERVICE_INSTANCE_ID);
+ assertThat(propertiesNode.get("vf-module-id").asText()).isEqualTo(VF_MODULE_ID);
+ assertThat(propertiesNode.get("vf-module-name").asText()).isEqualTo(VF_MODULE_NAME);
+ assertThat(propertiesNode.get("vf-module-customization-uuid").asText()).isEqualTo(VF_MODULE_CUSTOMIZATION_UUID);
+ assertThat(propertiesNode.get("service-model-uuid").asText()).isEqualTo(SERVICE_MODEL_UUID);
+ assertThat(propertiesNode.get("vnf-id").asText()).isEqualTo(GENERIC_VNF_ID);
+ }
+
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VnfCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VnfCDSRequestProviderTest.java
new file mode 100644
index 0000000000..7aafd900d4
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VnfCDSRequestProviderTest.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.cds;
+
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.*;
+
+public class VnfCDSRequestProviderTest extends AbstractVnfCDSRequestProviderTest {
+
+ @InjectMocks
+ private VnfCDSRequestProvider vnfCDSRequestProvider;
+
+ @Mock
+ protected ConfigureInstanceParamsForVnf configureInstanceParamsForVnf;
+
+ @Test
+ public void testBuildRequestPayloadAssignActionVnf() throws Exception {
+ // given
+ setScopeAndAction(VNF_SCOPE, ASSIGN_ACTION);
+ ServiceInstance instance = createServiceInstance();
+
+ doReturn(instance).when(extractPojosForBB).extractByKey(buildingBlockExecution,
+ ResourceKey.SERVICE_INSTANCE_ID);
+ doReturn(createGenericVnf()).when(extractPojosForBB).extractByKey(buildingBlockExecution,
+ ResourceKey.GENERIC_VNF_ID);
+ doNothing().when(configureInstanceParamsForVnf).populateInstanceParams(any(), any(), anyString());
+
+ // when
+ vnfCDSRequestProvider.setExecutionObject(buildingBlockExecution);
+ String payload = vnfCDSRequestProvider.buildRequestPayload(ASSIGN_ACTION).get();
+
+ // verify
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode payloadJson = mapper.readTree(payload);
+ JsonNode requestNode = payloadJson.findValue("configAssign-request");
+ JsonNode propertiesNode = payloadJson.findValue("configAssign-properties");
+
+ assertNotNull(payload);
+ assertTrue(verfiyJsonFromString(payload));
+ assertThat(requestNode.get("resolution-key").asText()).isEqualTo(GENERIC_VNF_NAME);
+ assertThat(propertiesNode.get("service-instance-id").asText()).isEqualTo(SERVICE_INSTANCE_ID);
+ assertThat(propertiesNode.get("service-model-uuid").asText()).isEqualTo(SERVICE_MODEL_UUID);
+ assertThat(propertiesNode.get("vnf-id").asText()).isEqualTo(GENERIC_VNF_ID);
+ assertThat(propertiesNode.get("vnf-customization-uuid").asText()).isEqualTo(VNF_MODEL_CUSTOMIZATION_UUID);
+ }
+
+ @Test
+ public void testBuildRequestPayloadDeployActionVnf() throws Exception {
+ // given
+ setScopeAndAction(VNF_SCOPE, DEPLOY_ACTION);
+ ServiceInstance instance = createServiceInstance();
+
+ doReturn(instance).when(extractPojosForBB).extractByKey(buildingBlockExecution,
+ ResourceKey.SERVICE_INSTANCE_ID);
+ doReturn(createGenericVnf()).when(extractPojosForBB).extractByKey(buildingBlockExecution,
+ ResourceKey.GENERIC_VNF_ID);
+ doNothing().when(configureInstanceParamsForVnf).populateInstanceParams(any(), any(), any());
+
+ // when
+ vnfCDSRequestProvider.setExecutionObject(buildingBlockExecution);
+ String payload = vnfCDSRequestProvider.buildRequestPayload(DEPLOY_ACTION).get();
+
+ // verify
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode payloadJson = mapper.readTree(payload);
+ JsonNode requestNode = payloadJson.findValue("configDeploy-request");
+ JsonNode propertiesNode = payloadJson.findValue("configDeploy-properties");
+
+ assertNotNull(payload);
+ assertTrue(verfiyJsonFromString(payload));
+ assertThat(requestNode.get("resolution-key").asText()).isEqualTo(GENERIC_VNF_NAME);
+ assertThat(propertiesNode.get("service-instance-id").asText()).isEqualTo(SERVICE_INSTANCE_ID);
+ assertThat(propertiesNode.get("service-model-uuid").asText()).isEqualTo(SERVICE_MODEL_UUID);
+ assertThat(propertiesNode.get("vnf-id").asText()).isEqualTo(GENERIC_VNF_ID);
+ assertThat(propertiesNode.get("vnf-customization-uuid").asText()).isEqualTo(VNF_MODEL_CUSTOMIZATION_UUID);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java
new file mode 100644
index 0000000000..3757769769
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmDmaapClientTest.java
@@ -0,0 +1,139 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm;
+
+import java.util.List;
+import org.apache.http.HttpStatus;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.fail;
+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.urlPathEqualTo;
+import org.onap.so.BaseTest;
+import org.onap.so.client.restproperties.SDNCLcmPropertiesImpl;
+import org.onap.so.client.sdnc.lcm.beans.*;
+
+public class SDNCLcmDmaapClientTest extends BaseTest {
+
+ protected SDNCLcmMessageBuilderTest sdncLcmMessageBuilderTest = new SDNCLcmMessageBuilderTest();
+
+ protected static final String DMAAP_HOST_PROP = SDNCLcmPropertiesImpl.DMAAP_HOST;
+ protected static final String DMAAP_WRITE_TOPIC_PROP = SDNCLcmPropertiesImpl.LCM_DMAAP_WRITE_TOPIC;
+ protected static final String DMAAP_READ_TOPIC_PROP = SDNCLcmPropertiesImpl.LCM_DMAAP_READ_TOPIC;
+ protected static final String DMAAP_PARTITION_PROP = SDNCLcmPropertiesImpl.LCM_DMAAP_PARTITION;
+
+ protected String testWriteTopic = "TEST-WRITE-TOPIC";
+ protected String testReadTopic = "TEST-READ-TOPIC";
+ protected String testPartition = "TESTMSO";
+ protected final String defaultConsumerName = "consumer1";
+
+ private void clearSystemProperty() {
+ System.clearProperty(DMAAP_HOST_PROP);
+ System.clearProperty(DMAAP_WRITE_TOPIC_PROP);
+ System.clearProperty(DMAAP_READ_TOPIC_PROP);
+ System.clearProperty(DMAAP_PARTITION_PROP);
+ }
+
+ public SDNCLcmDmaapClient buildSDNCLcmDmaapClient() {
+ String testHost = "http://localhost:" + wireMockPort;
+
+ System.setProperty(DMAAP_HOST_PROP, testHost);
+ System.setProperty(DMAAP_WRITE_TOPIC_PROP, testWriteTopic);
+ System.setProperty(DMAAP_READ_TOPIC_PROP, testReadTopic);
+ System.setProperty(DMAAP_PARTITION_PROP, testPartition);
+
+ SDNCLcmProperties sdncLcmProperties = new SDNCLcmPropertiesImpl();
+ SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder(sdncLcmProperties);
+
+ try {
+ return sdncLcmClientBuilder.newSDNCLcmDmaapClient();
+ } catch (Exception e) {
+ clearSystemProperty();
+ fail("Create SDNCLcmDmaapClient error: " + e.toString());
+ return null;
+ }
+ }
+
+ @Test
+ public final void testSDNCLcmDmaapClientSendRequest() {
+ SDNCLcmDmaapClient sdncLcmDmaapClient = buildSDNCLcmDmaapClient();
+
+ assertNotEquals(null, sdncLcmDmaapClient);
+
+ String testDmaapWritePath = "/events/" + testWriteTopic;
+ String expectedWriteResponse = "{\"serverTimeMs\":2,\"count\":1}";
+ wireMockServer.stubFor(post(urlPathEqualTo(testDmaapWritePath))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(expectedWriteResponse)
+ .withStatus(HttpStatus.SC_OK)));
+
+ LcmInput lcmInput = sdncLcmMessageBuilderTest.buildLcmInputForPnf();
+ LcmDmaapRequest lcmDmaapRequest =
+ SDNCLcmMessageBuilder.buildLcmDmaapRequest(sdncLcmMessageBuilderTest.getOperation(), lcmInput);
+
+ try {
+ sdncLcmDmaapClient.sendRequest(lcmDmaapRequest);
+ } catch (Exception e) {
+ clearSystemProperty();
+ fail("SDNCLcmDmaapClient sends request error: " + e.toString());
+ return;
+ }
+
+ String testDmaapReadPath = "/events/" + testReadTopic + "/" + testPartition + "/" + defaultConsumerName;
+
+ String expectedLcmDmaapResponse = LcmDmaapResponseTest.getExpectedLcmDmaapResponse();
+ String expectedResponseListItem;
+ try {
+ expectedResponseListItem = sdncLcmMessageBuilderTest.convertToSting(expectedLcmDmaapResponse);
+ } catch (JsonProcessingException e) {
+ clearSystemProperty();
+ fail("Convert LcmDmaapResponse String to List item error: " + e.toString());
+ return;
+ }
+ String expectedReadResponse = "[" + expectedResponseListItem + "]";
+ wireMockServer.stubFor(get(urlPathEqualTo(testDmaapReadPath))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(expectedReadResponse)
+ .withStatus(HttpStatus.SC_OK)));
+
+ List<LcmDmaapResponse> LcmDmaapResponseList = sdncLcmDmaapClient.getResponse();
+
+ clearSystemProperty();
+
+ if (LcmDmaapResponseList.size() < 1) {
+ clearSystemProperty();
+ fail("Can not get LcmDmaapResponse list");
+ return;
+ }
+
+ LcmOutput lcmOutput = LcmDmaapResponseList.get(0).getBody().getOutput();
+
+ String expectedLcmOutput = LcmOutputTest.getExpectedLcmOutput();
+ try {
+ String lcmOutputString = sdncLcmMessageBuilderTest.convertToSting(lcmOutput);
+ assertEquals(expectedLcmOutput, lcmOutputString);
+ } catch (Exception e) {
+ fail("Convert LcmOutput to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilderTest.java
new file mode 100644
index 0000000000..d930c6728c
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmMessageBuilderTest.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import org.onap.so.client.sdnc.lcm.beans.LcmBeanTest;
+import org.onap.so.client.sdnc.lcm.beans.LcmInput;
+import org.onap.so.client.sdnc.lcm.beans.LcmInputTest;
+
+public class SDNCLcmMessageBuilderTest extends LcmBeanTest {
+
+ public LcmInput buildLcmInputForPnf() {
+ LcmInput lcmInput =
+ SDNCLcmMessageBuilder.buildLcmInputForPnf(requestId, subRequestId, pnfName, action, inputPayload);
+
+ lcmInput.getCommonHeader().setTimestamp(timestamp);
+
+ return lcmInput;
+ }
+
+ @Test
+ public final void testBuildLcmRestRequestForPnf() {
+ LcmInput lcmInput = buildLcmInputForPnf();
+
+ String expectedLcmInput = LcmInputTest.getExpectedLcmInput();
+ try {
+ String lcmInputString = convertToSting(lcmInput);
+ assertEquals(expectedLcmInput, lcmInputString);
+ } catch (Exception e) {
+ fail("Convert LcmInput to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClientTest.java
new file mode 100644
index 0000000000..04cfc6e3c8
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/SDNCLcmRestClientTest.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm;
+
+import org.apache.http.HttpStatus;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.fail;
+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.urlPathEqualTo;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.so.BaseTest;
+import org.onap.so.client.restproperties.SDNCLcmPropertiesImpl;
+import org.onap.so.client.sdnc.common.SDNCConstants;
+import org.onap.so.client.sdnc.lcm.beans.*;
+
+public class SDNCLcmRestClientTest extends BaseTest {
+
+ protected SDNCLcmMessageBuilderTest sdncLcmMessageBuilderTest = new SDNCLcmMessageBuilderTest();
+
+ protected static final String SDNC_HOST_PROP = SDNCLcmPropertiesImpl.SDNC_HOST;
+ protected static final String SDNC_PATH_PROP = SDNCLcmPropertiesImpl.LCM_PATH;
+
+ private void clearSystemProperty() {
+ System.clearProperty(SDNC_HOST_PROP);
+ System.clearProperty(SDNC_PATH_PROP);
+ }
+
+ public SDNCLcmRestClient buildSDNCLcmRestClient() {
+ String testHost = "http://localhost:" + wireMockPort;
+
+ System.setProperty(SDNC_HOST_PROP, testHost);
+ System.setProperty(SDNC_PATH_PROP, SDNCConstants.LCM_API_BASE_PATH);
+
+ SDNCLcmProperties sdncLcmProperties = new SDNCLcmPropertiesImpl();
+ SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder(sdncLcmProperties);
+
+ try {
+ return sdncLcmClientBuilder.newSDNCLcmRestClient(sdncLcmMessageBuilderTest.getOperation());
+ } catch (Exception e) {
+ clearSystemProperty();
+ fail("Create SDNCLcmRestClient error: " + e.toString());
+ return null;
+ }
+ }
+
+ @Test
+ public final void testSDNCLcmRestClientSendRequest() {
+ SDNCLcmRestClient sdncLcmRestClient = buildSDNCLcmRestClient();
+
+ assertNotEquals(null, sdncLcmRestClient);
+ assertEquals(ONAPComponents.SDNC, sdncLcmRestClient.getTargetEntity());
+
+ String testLcmApiPath = SDNCConstants.LCM_API_BASE_PATH + sdncLcmMessageBuilderTest.getOperation();
+ String expectedLcmRestResponse = LcmRestResponseTest.getExpectedLcmRestResponse();
+ wireMockServer.stubFor(post(urlPathEqualTo(testLcmApiPath))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(expectedLcmRestResponse)
+ .withStatus(HttpStatus.SC_OK)));
+
+ LcmInput lcmInput = sdncLcmMessageBuilderTest.buildLcmInputForPnf();
+ LcmOutput lcmOutput = sdncLcmRestClient.sendRequest(lcmInput);
+
+ clearSystemProperty();
+
+ String expectedLcmOutput = LcmOutputTest.getExpectedLcmOutput();
+ try {
+ String lcmOutputString = sdncLcmMessageBuilderTest.convertToSting(lcmOutput);
+ assertEquals(expectedLcmOutput, lcmOutputString);
+ } catch (Exception e) {
+ fail("Convert LcmOutput to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmBeanTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmBeanTest.java
new file mode 100644
index 0000000000..5562444a46
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmBeanTest.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.onap.so.client.sdnc.common.SDNCConstants;
+
+public class LcmBeanTest {
+ private static Logger logger = LoggerFactory.getLogger(LcmBeanTest.class);
+
+ protected String requestId = "9f77f437-1515-44bd-a420-0aaf8a3c31a0";
+ protected String subRequestId = "c197a4b5-18d9-48a2-ad2d-a3b56858501c";
+ protected String timestamp = "2020-02-25T10:20:28.116Z";
+
+ protected String pnfName = "testpnf";
+ protected String action = "TestAction";
+ protected String operation = "test-operation";
+
+ protected String inputPayload = "{\"testPayload\": \"input test\"}";
+ protected String outputPayload = "{\"testPayload\": \"output test\"}";
+
+ public String getOperation() {
+ return operation;
+ }
+
+ public LcmFlags buildSDNCFlags() {
+ LcmFlags lcmFlags = new LcmFlags();
+
+ lcmFlags.setMode(SDNCConstants.LCM_FLAGS_MODE_NORMAL);
+ lcmFlags.setForce(SDNCConstants.LCM_FLAGS_FORCE_FALSE);
+ lcmFlags.setTtl(SDNCConstants.LCM_FLAGS_TTL);
+
+ return lcmFlags;
+ }
+
+ public LcmCommonHeader buildLcmCommonHeader() {
+ LcmCommonHeader lcmCommonHeader = new LcmCommonHeader();
+
+ lcmCommonHeader.setApiVer(SDNCConstants.LCM_API_VER);
+ lcmCommonHeader.setFlags(buildSDNCFlags());
+ lcmCommonHeader.setOriginatorId(SDNCConstants.SYSTEM_NAME);
+ lcmCommonHeader.setRequestId(requestId);
+ lcmCommonHeader.setSubRequestId(subRequestId);
+ lcmCommonHeader.setTimestamp(timestamp);
+
+ return lcmCommonHeader;
+ }
+
+ public String convertToSting(Object msgObject) throws JsonProcessingException {
+ ObjectMapper mapper = new ObjectMapper();
+
+ String msgString = mapper.writeValueAsString(msgObject);
+ logger.debug(msgObject.getClass().getSimpleName() + "\n" + msgString);
+
+ return msgString;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequestTest.java
new file mode 100644
index 0000000000..709a557937
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapRequestTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import org.junit.Test;
+import org.onap.so.client.sdnc.common.SDNCConstants;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class LcmDmaapRequestTest extends LcmBeanTest {
+ private static String expectedLcmDmaapRequest = "{" + "\"version\":\"1.0\"," + "\"type\":\"request\","
+ + "\"cambria.partition\":\"MSO\","
+ + "\"correlation-id\":\"9f77f437-1515-44bd-a420-0aaf8a3c31a0-c197a4b5-18d9-48a2-ad2d-a3b56858501c\","
+ + "\"rpc-name\":\"test-operation\"," + "\"body\":" + LcmRestRequestTest.getExpectedLcmRestRequest() + "}";
+
+ public LcmDmaapRequest buildLcmDmaapRequest() {
+ LcmDmaapRequest lcmDmaapRequest = new LcmDmaapRequest();
+
+ LcmRestRequestTest lcmRestRequestTest = new LcmRestRequestTest();
+ LcmRestRequest lcmRestRequest = lcmRestRequestTest.buildLcmRestRequest();
+ LcmCommonHeader lcmCommonHeader = lcmRestRequest.getInput().getCommonHeader();
+ String correlationId = lcmCommonHeader.getRequestId() + "-" + lcmCommonHeader.getSubRequestId();
+
+ lcmDmaapRequest.setVersion(SDNCConstants.LCM_DMAAP_MSG_VER);
+ lcmDmaapRequest.setType(SDNCConstants.LCM_DMAAP_MSG_TYPE_REQUEST);
+ lcmDmaapRequest.setCambriaPartition(SDNCConstants.SYSTEM_NAME);
+ lcmDmaapRequest.setCorrelationId(correlationId);
+ lcmDmaapRequest.setRpcName(operation);
+ lcmDmaapRequest.setBody(lcmRestRequest);
+
+ return lcmDmaapRequest;
+ }
+
+ public static String getExpectedLcmDmaapRequest() {
+ return expectedLcmDmaapRequest;
+ }
+
+ @Test
+ public final void testLcmDmaapRequest() {
+ LcmDmaapRequest lcmDmaapRequest = buildLcmDmaapRequest();
+
+ try {
+ String lcmDmaapRequestString = convertToSting(lcmDmaapRequest);
+ assertEquals(expectedLcmDmaapRequest, lcmDmaapRequestString);
+ } catch (Exception e) {
+ fail("Convert LcmDmaapRequest to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponseTest.java
new file mode 100644
index 0000000000..0cdbeebb27
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmDmaapResponseTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import org.junit.Test;
+import org.onap.so.client.sdnc.common.SDNCConstants;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class LcmDmaapResponseTest extends LcmBeanTest {
+ private static String expectedLcmDmaapResponse = "{" + "\"version\":\"1.0\"," + "\"type\":\"response\","
+ + "\"cambria.partition\":\"MSO\","
+ + "\"correlation-id\":\"9f77f437-1515-44bd-a420-0aaf8a3c31a0-c197a4b5-18d9-48a2-ad2d-a3b56858501c\","
+ + "\"rpc-name\":\"test-operation\"," + "\"body\":" + LcmRestResponseTest.getExpectedLcmRestResponse() + "}";
+
+ public LcmDmaapResponse buildLcmDmaapResponse() {
+ LcmDmaapResponse lcmDmaapResponse = new LcmDmaapResponse();
+
+ LcmRestResponseTest lcmRestResponseTest = new LcmRestResponseTest();
+ LcmRestResponse lcmRestResponse = lcmRestResponseTest.buildLcmRestResponse();
+ LcmCommonHeader lcmCommonHeader = lcmRestResponse.getOutput().getCommonHeader();
+ String correlationId = lcmCommonHeader.getRequestId() + "-" + lcmCommonHeader.getSubRequestId();
+
+ lcmDmaapResponse.setVersion(SDNCConstants.LCM_DMAAP_MSG_VER);
+ lcmDmaapResponse.setType(SDNCConstants.LCM_DMAAP_MSG_TYPE_RESPONSE);
+ lcmDmaapResponse.setCambriaPartition(SDNCConstants.SYSTEM_NAME);
+ lcmDmaapResponse.setCorrelationId(correlationId);
+ lcmDmaapResponse.setRpcName(operation);
+ lcmDmaapResponse.setBody(lcmRestResponse);
+
+ return lcmDmaapResponse;
+ }
+
+ public static String getExpectedLcmDmaapResponse() {
+ return expectedLcmDmaapResponse;
+ }
+
+ @Test
+ public final void testLcmDmaapResponse() {
+ LcmDmaapResponse lcmDmaapResponse = buildLcmDmaapResponse();
+
+ try {
+ String lcmDmaapResponseString = convertToSting(lcmDmaapResponse);
+ assertEquals(expectedLcmDmaapResponse, lcmDmaapResponseString);
+ } catch (Exception e) {
+ fail("Convert LcmDmaapResponse to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmInputTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmInputTest.java
new file mode 100644
index 0000000000..b8c34fcbc7
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmInputTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class LcmInputTest extends LcmBeanTest {
+ private static String expectedLcmInput = "{" + "\"common-header\":{" + "\"api-ver\":\"2.00\","
+ + "\"flags\":{\"mode\":\"NORMAL\",\"force\":\"FALSE\",\"ttl\":65000}," + "\"originator-id\":\"MSO\","
+ + "\"request-id\":\"9f77f437-1515-44bd-a420-0aaf8a3c31a0\","
+ + "\"sub-request-id\":\"c197a4b5-18d9-48a2-ad2d-a3b56858501c\","
+ + "\"timestamp\":\"2020-02-25T10:20:28.116Z\"" + "}," + "\"action\":\"TestAction\","
+ + "\"action-identifiers\":{\"pnf-name\":\"testpnf\"},"
+ + "\"payload\":\"{\\\"testPayload\\\": \\\"input test\\\"}\"}";
+
+ public LcmInput buildLcmInput() {
+ LcmInput lcmInput = new LcmInput();
+
+ LcmCommonHeader lcmCommonHeader = buildLcmCommonHeader();
+
+ LcmActionIdentifiers lcmActionIdentifiers = new LcmActionIdentifiers();
+ lcmActionIdentifiers.setPnfName(pnfName);
+
+ lcmInput.setCommonHeader(lcmCommonHeader);
+ lcmInput.setAction(action);
+ lcmInput.setActionIdentifiers(lcmActionIdentifiers);
+ lcmInput.setPayload(inputPayload);
+
+ return lcmInput;
+ }
+
+ public static String getExpectedLcmInput() {
+ return expectedLcmInput;
+ }
+
+ @Test
+ public final void testLcmInput() {
+ LcmInput lcmInput = buildLcmInput();
+
+ try {
+ String lcmInputString = convertToSting(lcmInput);
+ assertEquals(expectedLcmInput, lcmInputString);
+ } catch (Exception e) {
+ fail("Convert LcmInput to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmOutputTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmOutputTest.java
new file mode 100644
index 0000000000..1530be38a7
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmOutputTest.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import org.onap.so.client.sdnc.common.SDNCConstants;
+
+public class LcmOutputTest extends LcmBeanTest {
+ private static String expectedLcmOutput = "{" + "\"common-header\":{" + "\"api-ver\":\"2.00\","
+ + "\"originator-id\":\"MSO\"," + "\"request-id\":\"9f77f437-1515-44bd-a420-0aaf8a3c31a0\","
+ + "\"sub-request-id\":\"c197a4b5-18d9-48a2-ad2d-a3b56858501c\"" + "},"
+ + "\"status\":{\"code\":400,\"message\":\"Test output message\"},"
+ + "\"payload\":\"{\\\"testPayload\\\": \\\"output test\\\"}\"}";
+
+ @Override
+ public LcmCommonHeader buildLcmCommonHeader() {
+ LcmCommonHeader lcmCommonHeader = new LcmCommonHeader();
+
+ lcmCommonHeader.setApiVer(SDNCConstants.LCM_API_VER);
+ lcmCommonHeader.setOriginatorId(SDNCConstants.SYSTEM_NAME);
+ lcmCommonHeader.setRequestId(requestId);
+ lcmCommonHeader.setSubRequestId(subRequestId);
+
+ return lcmCommonHeader;
+ }
+
+ public LcmStatus buildLcmStatus() {
+ LcmStatus lcmStatus = new LcmStatus();
+
+ lcmStatus.setCode(400);
+ lcmStatus.setMessage("Test output message");
+
+ return lcmStatus;
+ }
+
+ public LcmOutput buildLcmOutput() {
+ LcmOutput lcmOutput = new LcmOutput();
+
+ LcmCommonHeader lcmCommonHeader = buildLcmCommonHeader();
+ LcmStatus lcmStatus = buildLcmStatus();
+
+ lcmOutput.setCommonHeader(lcmCommonHeader);
+ lcmOutput.setStatus(lcmStatus);
+ lcmOutput.setPayload(outputPayload);
+
+ return lcmOutput;
+ }
+
+ public static String getExpectedLcmOutput() {
+ return expectedLcmOutput;
+ }
+
+ @Test
+ public final void testLcmOutput() {
+ LcmOutput lcmOutput = buildLcmOutput();
+
+ try {
+ String lcmOutputString = convertToSting(lcmOutput);
+ assertEquals(expectedLcmOutput, lcmOutputString);
+ } catch (Exception e) {
+ fail("Convert LcmOutput to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequestTest.java
new file mode 100644
index 0000000000..c078326c82
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestRequestTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class LcmRestRequestTest extends LcmBeanTest {
+ private static String expectedLcmRestRequest = "{" + "\"input\":" + LcmInputTest.getExpectedLcmInput() + "}";
+
+ public LcmRestRequest buildLcmRestRequest() {
+ LcmRestRequest lcmRestRequest = new LcmRestRequest();
+
+ LcmInputTest lcmInputTest = new LcmInputTest();
+ lcmRestRequest.setInput(lcmInputTest.buildLcmInput());
+
+ return lcmRestRequest;
+ }
+
+ public static String getExpectedLcmRestRequest() {
+ return expectedLcmRestRequest;
+ }
+
+ @Test
+ public final void testLcmRestRequest() {
+ LcmRestRequest lcmRestRequest = buildLcmRestRequest();
+
+ try {
+ String lcmRestRequestString = convertToSting(lcmRestRequest);
+ assertEquals(expectedLcmRestRequest, lcmRestRequestString);
+ } catch (Exception e) {
+ fail("Convert LcmRestRequest to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponseTest.java
new file mode 100644
index 0000000000..5867acb421
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/LcmRestResponseTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class LcmRestResponseTest extends LcmBeanTest {
+ private static String expectedLcmRestResponse = "{" + "\"output\":" + LcmOutputTest.getExpectedLcmOutput() + "}";
+
+ public LcmRestResponse buildLcmRestResponse() {
+ LcmRestResponse lcmRestResponse = new LcmRestResponse();
+
+ LcmOutputTest lcmOutputTest = new LcmOutputTest();
+ lcmRestResponse.setOutput(lcmOutputTest.buildLcmOutput());
+
+ return lcmRestResponse;
+ }
+
+ public static String getExpectedLcmRestResponse() {
+ return expectedLcmRestResponse;
+ }
+
+ @Test
+ public final void testLcmRestResponse() {
+ LcmRestResponse lcmRestResponse = buildLcmRestResponse();
+
+ try {
+ String lcmRestResponseString = convertToSting(lcmRestResponse);
+ assertEquals(expectedLcmRestResponse, lcmRestResponseString);
+ } catch (Exception e) {
+ fail("Convert LcmRestResponse to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayloadTest.java
new file mode 100644
index 0000000000..bee07f2022
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/ActivateNESwPayloadTest.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans.payload;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class ActivateNESwPayloadTest extends LcmBasePayloadTest {
+ private static String expectedActivateNESwPayload = "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\","
+ + "\"playbook-name\":\"test_playbook\"," + "\"swVersionToBeActivated\":\"v2\"" + "}";
+
+ public ActivateNESwPayload buildActivateNESwPayload() {
+ ActivateNESwPayload activateNESwPayload = new ActivateNESwPayload();
+
+ activateNESwPayload.setIpaddressV4Oam(ipaddressV4Oam);
+ activateNESwPayload.setPlaybookName(playbookName);
+ activateNESwPayload.setSwVersionToBeActivated("v2");
+
+ return activateNESwPayload;
+ }
+
+ @Test
+ public final void testActivateNESwPayload() {
+ ActivateNESwPayload activateNESwPayload = buildActivateNESwPayload();
+
+ try {
+ String activateNESwPayloadString = convertToSting(activateNESwPayload);
+ assertEquals(expectedActivateNESwPayload, activateNESwPayloadString);
+ } catch (Exception e) {
+ fail("Convert ActivateNESwPayload to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java
new file mode 100644
index 0000000000..f9fa679790
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/DownloadNESwPayloadTest.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans.payload;
+
+import java.util.Collections;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class DownloadNESwPayloadTest extends LcmBasePayloadTest {
+ private static String expectedSwToBeDownloadedElement = "{" + "\"swLocation\":\"http://192.168.1.20/test.zip\","
+ + "\"swFileSize\":123456," + "\"swFileCompression\":\"ZIP\"," + "\"swFileFormat\":\"binary\"" + "}";
+
+ private static String expectedDownloadNESwPayload =
+ "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\"," + "\"playbook-name\":\"test_playbook\","
+ + "\"swToBeDownloaded\":[" + expectedSwToBeDownloadedElement + "]" + "}";
+
+ public SwToBeDownloadedElement buildSwToBeDownloadedElement() {
+ SwToBeDownloadedElement swToBeDownloadedElement = new SwToBeDownloadedElement();
+
+ swToBeDownloadedElement.setSwLocation("http://192.168.1.20/test.zip");
+ swToBeDownloadedElement.setSwFileSize(123456);
+ swToBeDownloadedElement.setSwFileCompression("ZIP");
+ swToBeDownloadedElement.setSwFileFormat("binary");
+
+ return swToBeDownloadedElement;
+ }
+
+ public DownloadNESwPayload buildDownloadNESwPayload() {
+ DownloadNESwPayload downloadNESwPayload = new DownloadNESwPayload();
+
+ downloadNESwPayload.setIpaddressV4Oam(ipaddressV4Oam);
+ downloadNESwPayload.setPlaybookName(playbookName);
+
+ SwToBeDownloadedElement swToBeDownloadedElement = buildSwToBeDownloadedElement();
+ downloadNESwPayload.setSwToBeDownloaded(Collections.singletonList(swToBeDownloadedElement));
+
+ return downloadNESwPayload;
+ }
+
+ @Test
+ public final void testSwToBeDownloadedElement() {
+ SwToBeDownloadedElement swToBeDownloadedElement = buildSwToBeDownloadedElement();
+
+ try {
+ String swToBeDownloadedElementString = convertToSting(swToBeDownloadedElement);
+ assertEquals(expectedSwToBeDownloadedElement, swToBeDownloadedElementString);
+ } catch (Exception e) {
+ fail("Convert SwToBeDownloadedElement to String error: " + e.toString());
+ }
+ }
+
+ @Test
+ public final void testDownloadNESwPayload() {
+ DownloadNESwPayload downloadNESwPayload = buildDownloadNESwPayload();
+
+ try {
+ String downloadNESwPayloadString = convertToSting(downloadNESwPayload);
+ assertEquals(expectedDownloadNESwPayload, downloadNESwPayloadString);
+ } catch (Exception e) {
+ fail("Convert DownloadNESwPayload to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/LcmBasePayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/LcmBasePayloadTest.java
new file mode 100644
index 0000000000..5452166d03
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/LcmBasePayloadTest.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans.payload;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LcmBasePayloadTest {
+ private static Logger logger = LoggerFactory.getLogger(LcmBasePayloadTest.class);
+
+ protected String ipaddressV4Oam = "192.168.1.10";
+ protected String playbookName = "test_playbook";
+
+ public String convertToSting(Object msgObject) throws JsonProcessingException {
+ ObjectMapper mapper = new ObjectMapper();
+
+ String msgString = mapper.writeValueAsString(msgObject);
+ logger.debug(msgObject.getClass().getSimpleName() + "\n" + msgString);
+
+ return msgString;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayloadTest.java
new file mode 100644
index 0000000000..acd447e890
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePostCheckPayloadTest.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans.payload;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class UpgradePostCheckPayloadTest extends LcmBasePayloadTest {
+ private static String expectedUpgradePostCheckPayload = "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\","
+ + "\"playbook-name\":\"test_playbook\"," + "\"oldSwVersion\":\"v1\"," + "\"targetSwVersion\":\"v2\","
+ + "\"ruleName\":\"r102\"," + "\"additionalData\":\"{}\"" + "}";
+
+ public UpgradePostCheckPayload buildUpgradePostCheckPayload() {
+ UpgradePostCheckPayload upgradePostCheckPayload = new UpgradePostCheckPayload();
+
+ upgradePostCheckPayload.setIpaddressV4Oam(ipaddressV4Oam);
+ upgradePostCheckPayload.setPlaybookName(playbookName);
+ upgradePostCheckPayload.setOldSwVersion("v1");
+ upgradePostCheckPayload.setTargetSwVersion("v2");
+ upgradePostCheckPayload.setRuleName("r102");
+ upgradePostCheckPayload.setAdditionalData("{}");
+
+ return upgradePostCheckPayload;
+ }
+
+ @Test
+ public final void testUpgradePostCheckPayload() {
+ UpgradePostCheckPayload upgradePostCheckPayload = buildUpgradePostCheckPayload();
+
+ try {
+ String upgradePostCheckPayloadString = convertToSting(upgradePostCheckPayload);
+ assertEquals(expectedUpgradePostCheckPayload, upgradePostCheckPayloadString);
+ } catch (Exception e) {
+ fail("Convert UpgradePostCheckPayload to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayloadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayloadTest.java
new file mode 100644
index 0000000000..8bc0714fff
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/sdnc/lcm/beans/payload/UpgradePreCheckPayloadTest.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.client.sdnc.lcm.beans.payload;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+public class UpgradePreCheckPayloadTest extends LcmBasePayloadTest {
+ private static String expectedUpgradePreCheckPayload = "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\","
+ + "\"playbook-name\":\"test_playbook\"," + "\"oldSwVersion\":\"v1\"," + "\"targetSwVersion\":\"v2\","
+ + "\"ruleName\":\"r101\"," + "\"additionalData\":\"{}\"" + "}";
+
+ public UpgradePreCheckPayload buildUpgradePreCheckPayload() {
+ UpgradePreCheckPayload upgradePreCheckPayload = new UpgradePreCheckPayload();
+
+ upgradePreCheckPayload.setIpaddressV4Oam(ipaddressV4Oam);
+ upgradePreCheckPayload.setPlaybookName(playbookName);
+ upgradePreCheckPayload.setOldSwVersion("v1");
+ upgradePreCheckPayload.setTargetSwVersion("v2");
+ upgradePreCheckPayload.setRuleName("r101");
+ upgradePreCheckPayload.setAdditionalData("{}");
+
+ return upgradePreCheckPayload;
+ }
+
+ @Test
+ public final void testUpgradePreCheckPayload() {
+ UpgradePreCheckPayload upgradePreCheckPayload = buildUpgradePreCheckPayload();
+
+ try {
+ String upgradePreCheckPayloadString = convertToSting(upgradePreCheckPayload);
+ assertEquals(expectedUpgradePreCheckPayload, upgradePreCheckPayloadString);
+ } catch (Exception e) {
+ fail("Convert UpgradePreCheckPayload to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json
index bcc565dc75..7de6df617b 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json
@@ -4,5 +4,8 @@
"vnf-type":"vnfType",
"orchestration-status":"PRECREATED",
"cloud-params":{},
- "heat-stack-id":"heatStackId"
+ "heat-stack-id":"heatStackId",
+ "model-info-vf-module": {
+ "modelCustomizationUUID": "modelCustomizationId"
+ }
}
diff --git a/bpmn/MSOCoreBPMN/pom.xml b/bpmn/MSOCoreBPMN/pom.xml
index fd239562e2..47254e75f2 100644
--- a/bpmn/MSOCoreBPMN/pom.xml
+++ b/bpmn/MSOCoreBPMN/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>MSOCoreBPMN</artifactId>
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceArtifact.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceArtifact.java
new file mode 100644
index 0000000000..aefd70ff89
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceArtifact.java
@@ -0,0 +1,119 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.core.domain;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import java.io.Serializable;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"artifactUUID", "name", "version", "checksum", "type", "content", "description"})
+@JsonRootName("serviceArtifact")
+public class ServiceArtifact extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ @JsonProperty("artifactUUID")
+ private String artifactUUID;
+ @JsonProperty("name")
+ private String name;
+ @JsonProperty("version")
+ private String version;
+ @JsonProperty("checksum")
+ private String checksum;
+ @JsonProperty("type")
+ private String type;
+ @JsonProperty("content")
+ private String content;
+ @JsonProperty("description")
+ private String description;
+
+ @JsonProperty("artifactUUID")
+ public String getArtifactUUID() {
+ return artifactUUID;
+ }
+
+ @JsonProperty("artifactUUID")
+ public void setArtifactUUID(String artifactUUID) {
+ this.artifactUUID = artifactUUID;
+ }
+
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ @JsonProperty("name")
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @JsonProperty("version")
+ public String getVersion() {
+ return version;
+ }
+
+ @JsonProperty("version")
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ @JsonProperty("checksum")
+ public String getChecksum() {
+ return checksum;
+ }
+
+ @JsonProperty("checksum")
+ public void setChecksum(String checksum) {
+ this.checksum = checksum;
+ }
+
+ @JsonProperty("type")
+ public String getType() {
+ return type;
+ }
+
+ @JsonProperty("type")
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @JsonProperty("content")
+ public String getContent() {
+ return content;
+ }
+
+ @JsonProperty("content")
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ @JsonProperty("description")
+ public String getDescription() {
+ return description;
+ }
+
+ @JsonProperty("description")
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInfo.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInfo.java
new file mode 100644
index 0000000000..542fa2d463
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceInfo.java
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.core.domain;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.*;
+
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"id", "serviceInput", "serviceProperties", "serviceArtifact"})
+@JsonRootName("serviceInfo")
+public class ServiceInfo extends JsonWrapper implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @JsonProperty("id")
+ private Integer id;
+ @JsonProperty("serviceInput")
+ private String serviceInput;
+ @JsonProperty("serviceProperties")
+ private String serviceProperties;
+ @JsonProperty("serviceArtifact")
+ private List<ServiceArtifact> serviceArtifact = null;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ @JsonProperty("id")
+ public Integer getId() {
+ return id;
+ }
+
+ @JsonProperty("id")
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ @JsonProperty("serviceInput")
+ public String getServiceInput() {
+ return serviceInput;
+ }
+
+ @JsonProperty("serviceInput")
+ public void setServiceInput(String serviceInput) {
+ this.serviceInput = serviceInput;
+ }
+
+ @JsonProperty("serviceProperties")
+ public String getServiceProperties() {
+ return serviceProperties;
+ }
+
+ @JsonProperty("serviceProperties")
+ public void setServiceProperties(String serviceProperties) {
+ this.serviceProperties = serviceProperties;
+ }
+
+ @JsonProperty("serviceArtifact")
+ public List<ServiceArtifact> getServiceArtifact() {
+ return serviceArtifact;
+ }
+
+ @JsonProperty("serviceArtifact")
+ public void setServiceArtifact(List<ServiceArtifact> serviceArtifact) {
+ this.serviceArtifact = serviceArtifact;
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+}
+
+
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceProxy.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceProxy.java
new file mode 100644
index 0000000000..6903d34987
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceProxy.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.core.domain;
+
+import java.io.Serializable;
+import com.fasterxml.jackson.annotation.*;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"modelInfo", "toscaNodeType", "description", "sourceModelUuid"})
+@JsonRootName("serviceProxy")
+public class ServiceProxy extends JsonWrapper implements Serializable {
+ private static final long serialVersionUID = 1L;
+ @JsonProperty("modelInfo")
+ private ModelInfo modelInfo;
+ @JsonProperty("toscaNodeType")
+ private String toscaNodeType;
+ @JsonProperty("description")
+ private String description;
+ @JsonProperty("sourceModelUuid")
+ private String sourceModelUuid;
+
+ @JsonProperty("modelInfo")
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ @JsonProperty("modelInfo")
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ @JsonProperty("toscaNodeType")
+ public String getToscaNodeType() {
+ return toscaNodeType;
+ }
+
+ @JsonProperty("toscaNodeType")
+ public void setToscaNodeType(String toscaNodeType) {
+ this.toscaNodeType = toscaNodeType;
+ }
+
+ @JsonProperty("description")
+ public String getDescription() {
+ return description;
+ }
+
+ @JsonProperty("description")
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @JsonProperty("sourceModelUuid")
+ public String getSourceModelUuid() {
+ return sourceModelUuid;
+ }
+
+ @JsonProperty("sourceModelUuid")
+ public void setSourceModelUuid(String sourceModelUuid) {
+ this.sourceModelUuid = sourceModelUuid;
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml
index c3c26ef5e7..04a291af8c 100644
--- a/bpmn/mso-infrastructure-bpmn/pom.xml
+++ b/bpmn/mso-infrastructure-bpmn/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mso-infrastructure-bpmn</artifactId>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
index 13ba46a852..4e6396c4be 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
@@ -33,7 +33,7 @@ import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.runtime.Execution;
import org.camunda.bpm.engine.runtime.MessageCorrelationResult;
import org.onap.so.bpmn.core.UrnPropertiesReader;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
index f76fde9ef1..2eb9d175f2 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
@@ -35,7 +35,7 @@ import javax.ws.rs.core.Response;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError;
import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
index 6debcfbff6..731e9d8703 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
@@ -49,7 +49,7 @@ import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats;
import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
import org.onap.so.bpmn.core.WorkflowException;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index 29fc4e93fc..506088eb15 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -24,16 +24,16 @@ package org.onap.so.bpmn.infrastructure;
import java.util.List;
import java.util.concurrent.Executor;
-import org.onap.so.logger.LoggingAnchor;
import javax.annotation.PostConstruct;
import org.camunda.bpm.application.PreUndeploy;
import org.camunda.bpm.application.ProcessApplicationInfo;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.repository.DeploymentBuilder;
+import org.onap.logging.filter.spring.MDCTaskDecorator;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
import org.onap.so.db.catalog.beans.Workflow;
import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.logging.filter.spring.MDCTaskDecorator;;
+import org.onap.so.logger.LoggingAnchor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
index f9db93e3f7..80fd3eede4 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
@@ -58,6 +58,12 @@ public class PnfManagementTestImpl implements PnfManagement {
serviceAndPnfRelationMap.put(serviceInstanceId, pnfName);
}
+ @Override
+ public void updateEntry(String pnfCorrelationId, Pnf entry) {
+ created.put(pnfCorrelationId, entry);
+ }
+
+
public Map<String, Pnf> getCreated() {
return created;
}
diff --git a/bpmn/pom.xml b/bpmn/pom.xml
index 65af2fd8d5..e680cb025c 100644
--- a/bpmn/pom.xml
+++ b/bpmn/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>bpmn</artifactId>
@@ -25,7 +25,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sdnc.northbound.version>1.5.2</sdnc.northbound.version>
- <appc.client.version>1.6.0-SNAPSHOT</appc.client.version>
+ <appc.client.version>1.7.1-SNAPSHOT</appc.client.version>
</properties>
<modules>
diff --git a/bpmn/so-bpmn-building-blocks/pom.xml b/bpmn/so-bpmn-building-blocks/pom.xml
index a867613890..52c5502b32 100644
--- a/bpmn/so-bpmn-building-blocks/pom.xml
+++ b/bpmn/so-bpmn-building-blocks/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-building-blocks</artifactId>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn
index 11d77bf97a..88e5eadef2 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigAssignVnfBB.bpmn
@@ -12,7 +12,7 @@
<bpmn:callActivity id="CallActivity_1gfzi2g" name="Abstract CDS&#10;(CDS Call)&#10;" calledElement="AbstractCDSProcessingBB">
<bpmn:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
- <camunda:out source="CDSStatus" target="CDSStatus" />
+ <camunda:out source="ControllerStatus" target="ControllerStatus" />
<camunda:in source="executionObject" target="executionObject" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_05qembo</bpmn:incoming>
@@ -34,7 +34,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_0cvsnuu" sourceRef="CallActivity_1gfzi2g" targetRef="ExclusiveGateway_13q340y" />
<bpmn:sequenceFlow id="SequenceFlow_07tqu82" name="success" sourceRef="ExclusiveGateway_13q340y" targetRef="Task_1hs1mn0">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("CDSStatus").equals("Success")}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("ControllerStatus").equals("Success")}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:endEvent id="EndEvent_0mnaj50">
<bpmn:incoming>SequenceFlow_15gxql1</bpmn:incoming>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigDeployVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigDeployVnfBB.bpmn
index 92ac5f9f5b..3993eca467 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigDeployVnfBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigDeployVnfBB.bpmn
@@ -18,7 +18,7 @@
<bpmn:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="executionObject" target="executionObject" />
- <camunda:out source="CDSStatus" target="CDSStatus" />
+ <camunda:out source="ControllerStatus" target="ControllerStatus" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0kruy8t</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_03xbj4e</bpmn:outgoing>
@@ -39,7 +39,7 @@
<bpmn:outgoing>SequenceFlow_0o50k2d</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_1tb7fs1" name="success" sourceRef="ExclusiveGateway_0duh80v" targetRef="UpdateAAIConfigured">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("CDSStatus").equals("Success")}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_0o50k2d" sourceRef="ExclusiveGateway_0duh80v" targetRef="EndEvent_0wwnq4u" />
<bpmn:endEvent id="EndEvent_0wwnq4u">
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn
index 32d3bce469..279fdc0983 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn
@@ -13,7 +13,7 @@
<bpmn:callActivity id="CallActivity_1gfzi2g" name="Abstract CDS&#10;(CDS Call)&#10;" calledElement="AbstractCDSProcessingBB">
<bpmn:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
- <camunda:out source="CDSStatus" target="CDSStatus" />
+ <camunda:out source="ControllerStatus" target="ControllerStatus" />
<camunda:in source="executionObject" target="executionObject" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_05qembo</bpmn:incoming>
@@ -35,7 +35,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_0cvsnuu" sourceRef="CallActivity_1gfzi2g" targetRef="ExclusiveGateway_13q340y" />
<bpmn:sequenceFlow id="SequenceFlow_07tqu82" name="success" sourceRef="ExclusiveGateway_13q340y" targetRef="Task_1hs1mn0">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("CDSStatus").equals("Success")}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:endEvent id="EndEvent_0mnaj50">
<bpmn:incoming>SequenceFlow_15gxql1</bpmn:incoming>
diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml
index 74df3a2c2e..1a4e9c6ee8 100644
--- a/bpmn/so-bpmn-infrastructure-common/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-common/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-infrastructure-common</artifactId>
@@ -18,51 +18,6 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <version>2.8</version>
- <configuration>
- <additionalProjectnatures>
- <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature>
- </additionalProjectnatures>
- <sourceIncludes>
- <sourceInclude>**/*.groovy</sourceInclude>
- </sourceIncludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.gmaven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <version>1.5</version>
- <dependencies>
- <dependency>
- <groupId>org.codehaus.gmaven.runtime</groupId>
- <artifactId>gmaven-runtime-2.0</artifactId>
- <version>1.5</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy</artifactId>
- <version>${groovy.version}</version>
- </dependency>
- </dependencies>
- <configuration>
- <debug>false</debug>
- <verbose>true</verbose>
- <stacktrace>true</stacktrace>
- <defaultScriptExtension>.groovy</defaultScriptExtension>
- <providerSelection>2.0</providerSelection>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>testCompile</goal>
- <goal>compile</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
@@ -77,41 +32,30 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.0</version>
+ <configuration>
+ <compilerId>groovy-eclipse-compiler</compilerId>
+ </configuration>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-compiler</artifactId>
+ <version>3.6.0-03</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-eclipse-batch</artifactId>
+ <version>2.4.19-01</version>
+ </dependency>
+ </dependencies>
+ </plugin>
</plugins>
<pluginManagement>
<plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings
- only. It has no influence on the Maven build itself. -->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- org.apache.maven.plugins
- </groupId>
- <artifactId>
- maven-antrun-plugin
- </artifactId>
- <versionRange>
- [1.3,)
- </versionRange>
- <goals>
- <goal>run</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore />
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy
new file mode 100644
index 0000000000..89490ff620
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/HandleOrchestrationTask.groovy
@@ -0,0 +1,127 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import org.onap.so.db.request.beans.OrchestrationTask
+
+import static org.apache.commons.lang3.StringUtils.*
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+class HandleOrchestrationTask extends AbstractServiceTaskProcessor {
+ private static final Logger logger = LoggerFactory.getLogger(HandleOrchestrationTask.class)
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ def supportedMethod = ["GET", "POST", "PUT"]
+ def validStatus = [200, 201]
+
+ @Override
+ public void preProcessRequest(DelegateExecution execution) {
+ logger.debug("Start preProcessRequest")
+ String method = execution.getVariable("method")
+ if (!supportedMethod.contains(method)) {
+ String msg = "Method: " + method + " is not supported"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ String taskId = execution.getVariable("taskId")
+ if (isBlank(taskId)) {
+ String msg = "taskId is empty"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.requestDb.endpoint",execution)
+ def orchestrationTaskEndpoint = dbAdapterEndpoint + "/orchestrationTask/"
+ if (!"POST".equals(method)) {
+ orchestrationTaskEndpoint = orchestrationTaskEndpoint + taskId
+ }
+ execution.setVariable("url", orchestrationTaskEndpoint)
+ logger.debug("DB Adapter Endpoint is: " + orchestrationTaskEndpoint)
+ def dbAdapterAuth = UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth")
+ Map<String, String> headerMap = [:]
+ headerMap.put("content-type", "application/json")
+ headerMap.put("Authorization", dbAdapterAuth)
+ execution.setVariable("headerMap", headerMap)
+ logger.debug("DB Adapter Header is: " + headerMap)
+
+ String requestId = execution.getVariable("requestId")
+ if (("POST".equals(method) || "PUT".equals(method)) && isBlank(requestId)) {
+ String msg = "requestId is empty"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ String taskName = execution.getVariable("taskName")
+ if (("POST".equals(method) || "PUT".equals(method)) && isBlank(taskName)) {
+ String msg = "task name is empty"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ String taskStatus = execution.getVariable("taskStatus")
+ if (("POST".equals(method) || "PUT".equals(method)) && isBlank(taskStatus)) {
+ String msg = "task status is empty"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ String isManual = execution.getVariable("isManual")
+ if (("POST".equals(method) || "PUT".equals(method)) && isBlank(isManual)) {
+ String msg = "isManual is empty"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ String paramJson = execution.getVariable("paramJson")
+
+ String payload = ""
+ if ("POST".equals(method) || "PUT".equals(method)) {
+ OrchestrationTask task = new OrchestrationTask()
+ task.setTaskId(taskId)
+ task.setRequestId(requestId)
+ task.setName(taskName)
+ task.setStatus(taskStatus)
+ task.setIsManual(isManual)
+ task.setParams(paramJson)
+ ObjectMapper objectMapper = new ObjectMapper()
+ payload = objectMapper.writeValueAsString(task)
+ logger.debug("Outgoing payload is \n" + payload)
+ }
+ execution.setVariable("payload", payload)
+ logger.debug("End preProcessRequest")
+ }
+
+ public void postProcess(DelegateExecution execution) {
+ Integer statusCode = execution.getVariable("statusCode")
+ logger.debug("statusCode: " + statusCode)
+ String response = execution.getVariable("response")
+ logger.debug("response: " + response)
+ if (!validStatus.contains(statusCode)) {
+ String msg = "Error in sending orchestrationTask request. \nstatusCode: " + statusCode + "\nresponse: " + response
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+}
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy
new file mode 100644
index 0000000000..4ed0ea6a44
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationService.groovy
@@ -0,0 +1,438 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.RelationshipData
+import org.onap.aai.domain.yang.RelationshipList
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.db.request.beans.OperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import javax.ws.rs.NotFoundException
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class ActivateCommunicationService extends AbstractServiceTaskProcessor {
+
+ String Prefix="ACS_"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+
+ JsonUtils jsonUtil = new JsonUtils()
+
+ AAIResourcesClient client = getAAIClient()
+
+ private static final Logger logger = LoggerFactory.getLogger(ActivateCommunicationService.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+ String msg
+
+ try {
+ // check for incoming json message/input
+ String siRequest = execution.getVariable("bpmnRequest")
+ logger.debug(siRequest)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ logger.info("Input Request:" + siRequest + " reqId:" + requestId)
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ if (isBlank(serviceInstanceId)) {
+ msg = "Input serviceInstanceId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ logger.info(msg)
+ execution.setVariable("globalSubscriberId", "5GCustomer")
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+
+ String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ logger.debug(msg)
+ execution.setVariable("subscriptionServiceType", "5G")
+ } else {
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ }
+
+ String operationId = jsonUtil.getJsonValue(siRequest, "operationId")
+ execution.setVariable("operationId", operationId)
+
+ String operationType = execution.getVariable("operationType")
+ execution.setVariable("operationType", operationType.toUpperCase())
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ def checkAAIOrchStatus = { DelegateExecution execution ->
+
+ logger.debug(Prefix + "checkAAIOrchStatus Start")
+
+ String msg
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+ String operationType = execution.getVariable("operationType")
+
+ logger.debug("serviceInstanceId: " + serviceInstanceId)
+
+ //check the cms status
+ try {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ globalSubscriberId, subscriptionServiceType, serviceInstanceId)
+
+ if (!client.exists(uri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
+ }
+
+ AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+ Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+ if(si.isPresent()) {
+
+ if (si.get().getOrchestrationStatus().toLowerCase() == "activated" &&
+ operationType.equalsIgnoreCase("deactivation")) {
+ logger.info("Service is in active state")
+ execution.setVariable("serviceExpectStatus", "deactivated")
+ execution.setVariable("isContinue", "true")
+ execution.setVariable("requestParam", "deactivate")
+
+ } else if (si.get().getOrchestrationStatus().toLowerCase() == "deactivated" &&
+ operationType.equalsIgnoreCase("activation")){
+ logger.info("Service is in de-activated state")
+ execution.setVariable("serviceExpectStatus", "activated")
+ execution.setVariable("isContinue", "true")
+ execution.setVariable("requestParam", "activate")
+
+ } else {
+ execution.setVariable("isContinue", "false")
+ }
+
+ RelationshipList relationshipList = si.get().getRelationshipList()
+ List<Relationship> relationship
+ if (relationshipList != null && (relationship = relationshipList.getRelationship()) != null
+ && relationship.size() > 0) {
+ List<RelationshipData> relationshipDatas = relationship.get(0).getRelationshipData()
+
+ for (RelationshipData relationshipData : relationshipDatas) {
+ execution.setVariable("e2e_" + relationshipData.getRelationshipKey(),
+ relationshipData.getRelationshipValue())
+ }
+ } else {
+ msg = "the communication service has no e2e service"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ }
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in " + Prefix + "checkAAIOrchStatus: " + ex.getMessage()
+ logger.info( msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug(Prefix + "checkAAIOrchStatus Exit")
+ }
+
+
+ def prepareInitOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareInitOperationStatus Start")
+
+ String serviceId = execution.getVariable("serviceInstanceId")
+
+ // 生成 operationId
+ String operationId = execution.getVariable("operationId")
+
+ String operationType = execution.getVariable("operationType")
+
+ OperationStatus initStatus = new OperationStatus()
+ initStatus.setServiceId(serviceId)
+ initStatus.setOperationId(operationId)
+ initStatus.setOperation(operationType)
+ initStatus.setUserId(execution.getVariable("globalSubscriberId") as String)
+ initStatus.setResult("processing")
+ initStatus.setProgress("0")
+ initStatus.setReason("")
+ initStatus.setOperationContent("communication service active operation start")
+
+ requestDBUtil.prepareUpdateOperationStatus(execution, initStatus)
+
+ logger.debug(Prefix + "prepareInitOperationStatus Exit")
+ }
+
+
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String operationId = execution.getVariable("operationId")
+
+ String restRequest = """{"operationId":"${operationId}"}""".trim()
+ logger.debug(" sendSyncResponse to APIH:" + "\n" + restRequest)
+
+ sendWorkflowResponse(execution, 202, restRequest)
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
+
+
+ def preRequestSend2NSMF = { DelegateExecution execution ->
+ logger.debug(Prefix + "preRequestSend2NSMF Start")
+ try {
+
+ String e2eServiceInstanceId = execution.getVariable("e2e_service-instance.service-instance-id")
+ execution.setVariable("e2eServiceInstanceId", e2eServiceInstanceId)
+
+ String requestParam = execution.getVariable("requestParam")
+ //String NSMF_endpoint = "/onap/so/infra/e2eServiceInstances/v3"
+ def NSMF_endpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution)
+ def url = NSMF_endpoint + "/e2eServiceInstances/v3/${e2eServiceInstanceId}/${requestParam}"
+ execution.setVariable("NSMF_endpoint", url)
+
+ //get from model catalog inputs
+ String payload = """
+ {
+ "globalSubscriberId": "${execution.getVariable("globalSubscriberId")}",
+ "serviceType": "${execution.getVariable("subscriptionServiceType")}"
+ }
+ """
+ execution.setVariable("CSMF_NSMFRequest", payload.replaceAll("\\s+", ""))
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in " + Prefix + "preRequestSend2NSMF. " + ex.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug(Prefix + "preRequestSend2NSMF Exit")
+ }
+
+
+ def processNSMFResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "processNSMFResponse Start")
+ //oof
+ try {
+ def CSMF_NSMFResponseCode = execution.getVariable("CSMF_NSMFResponseCode") as Integer
+ if (CSMF_NSMFResponseCode >= 200 && CSMF_NSMFResponseCode < 400) {
+ def CSMF_NSMFResponse = execution.getVariable("CSMF_NSMFResponse") as String
+ def e2eOperationId = jsonUtil.getJsonValue(CSMF_NSMFResponse, "operationId")
+
+ execution.setVariable("e2eOperationId", e2eOperationId)
+ execution.setVariable("ProcessNsmfSuccess", "OK")
+ } else {
+ execution.setVariable("ProcessNsmfSuccess", "ERROR")
+ execution.setVariable("operationStatus", "error")
+ execution.setVariable("operationContent",
+ "communication service " + execution.getVariable("operationType")
+ + " operation error: nsmf response fail")
+ execution.setVariable("orchestrationStatus", "error")
+ }
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in " + Prefix + "processOOFResponse. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "processNSMFResponse Exit")
+ }
+
+
+ def prepareUpdateOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareUpdateOperationStatus Start")
+ // update status creating
+ OperationStatus status = new OperationStatus()
+ status.setServiceId(execution.getVariable("serviceInstanceId") as String)
+ status.setOperationId(execution.getVariable("operationId") as String)
+ status.setOperation(execution.getVariable("operationType") as String)
+ status.setResult("processing")
+ status.setProgress("20")
+ status.setOperationContent("communication service "+ execution.getVariable("operationType")
+ + " operation processing: waiting nsmf service create finished")
+ status.setUserId(execution.getVariable("globalSubscriberId") as String)
+
+ requestDBUtil.prepareUpdateOperationStatus(execution, status)
+ logger.debug(Prefix + "prepareUpdateOperationStatus Exit")
+ }
+
+
+ //todo
+ def prepareCallCheckProcessStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareCallCheckProcessStatus Start")
+
+ def successConditions = new ArrayList<>()
+ successConditions.add("finished")
+ execution.setVariable("successConditions", successConditions)
+
+ def errorConditions = new ArrayList<>()
+ errorConditions.add("error")
+ execution.setVariable("errorConditions", errorConditions)
+
+ execution.setVariable("processServiceType", "communication service")
+
+ execution.setVariable("timeOut", 3 * 60 * 60 * 1000)
+
+ def successParamMap = new HashMap<String, Object>()
+ successParamMap.put("orchestrationStatus", execution.getVariable("serviceExpectStatus"))
+
+ execution.setVariable("successParamMap", successParamMap)
+
+ def errorParamMap = new HashMap<String, Object>()
+ errorParamMap.put("orchestrationStatus", "error")
+
+ execution.setVariable("errorParamMap", errorParamMap)
+
+ def timeOutParamMap = new HashMap<String, Object>()
+ timeOutParamMap.put("orchestrationStatus", "error")
+
+ execution.setVariable("timeOutParamMap", timeOutParamMap)
+
+ execution.setVariable("initProgress", 20)
+ execution.setVariable("endProgress", 90)
+
+ logger.debug(Prefix + "prepareCallCheckProcessStatus Exit")
+ }
+
+
+ /**
+ * prepare update operation status to complete after NSMF process success
+ * @param execution
+ */
+ def prepareCompleteStatus = { DelegateExecution execution ->
+
+ logger.debug(Prefix + "prepareCompleteStatus Start")
+ String operationType = execution.getVariable("operationType")
+ OperationStatus status = new OperationStatus()
+ status.setServiceId(execution.getVariable("serviceInstanceId") as String)
+ status.setOperationId(execution.getVariable("operationId") as String)
+ status.setOperation(operationType)
+ status.setResult(execution.getVariable("operationStatus") as String)
+ status.setProgress("100")
+ status.setOperationContent(execution.getVariable("operationContent") as String)
+ status.setUserId(execution.getVariable("globalSubscriberId") as String)
+
+ requestDBUtil.prepareUpdateOperationStatus(execution, status)
+ logger.debug("prepareCompleteStatus end, serviceInstanceId: " + execution.getVariable("serviceInstanceId")
+ + ", operationId: " + execution.getVariable("operationId"))
+
+ logger.debug(Prefix + "prepareCompleteStatus Exit")
+ }
+
+
+ /**
+ * update NSMF complete status to AAI when the NSMF process finished
+ * @param execution
+ */
+ def updateFinishStatusInAAI = { DelegateExecution execution ->
+ logger.debug(Prefix + "updateFinishStatusInAAI Start")
+ String msg
+ try {
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String orchestrationStatus = execution.getVariable("orchestrationStatus")
+ // create service
+ ServiceInstance csi = new ServiceInstance()
+ csi.setOrchestrationStatus(orchestrationStatus)
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ globalSubscriberId, subscriptionServiceType, serviceInstanceId)
+ client.update(uri, csi)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in complete communication service " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "updateFinishStatusInAAI Exit")
+ }
+
+
+ public sendSyncError = { DelegateExecution execution ->
+ logger.debug("sendSyncError Start")
+ try {
+ String errorMessage
+ if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
+ WorkflowException wfe = execution.getVariable("WorkflowException") as WorkflowException
+ errorMessage = wfe.getErrorMessage()
+ } else {
+ errorMessage = "Sending Sync Error."
+ }
+
+ String buildWorkflowException =
+ """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
+ <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>"""
+
+ logger.debug(buildWorkflowException)
+ sendWorkflowResponse(execution, 500, buildWorkflowException)
+
+ } catch (Exception ex) {
+ logger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
+ }
+ logger.debug(Prefix + "sendSyncError Exit")
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy
new file mode 100644
index 0000000000..a8c3ef189e
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy
@@ -0,0 +1,587 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.onap.so.bpmn.infrastructure.scripts
+
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.*
+import org.onap.so.beans.nsmf.NSSI
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.db.request.beans.OperationStatus
+import org.onap.logging.filter.base.ErrorCode
+import org.onap.so.logger.LoggingAnchor
+import org.onap.so.logger.MessageEnum
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import javax.ws.rs.NotFoundException
+import java.lang.reflect.Type
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+/**
+ * This groovy class supports the <class>ActivateSliceService.bpmn</class> process.
+ * AlaCarte flow for 1702 slice service activate
+ *
+ */
+
+class ActivateSliceService extends AbstractServiceTaskProcessor {
+
+
+ String Prefix = "ACTSS_"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ JsonUtils jsonUtil = new JsonUtils()
+
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+
+ private static final Logger logger = LoggerFactory.getLogger(ActivateSliceService.class)
+
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+ String msg
+
+ try {
+ // check for incoming json message/input
+ String siRequest = execution.getVariable("bpmnRequest")
+ logger.debug(siRequest)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ logger.info("Input Request:" + siRequest + " reqId:" + requestId)
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ if (isBlank(serviceInstanceId)) {
+ msg = "Input serviceInstanceId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ String source = jsonUtil.getJsonValue(siRequest, "source")
+ execution.setVariable("source", source)
+
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ logger.info(msg)
+ execution.setVariable("globalSubscriberId", "5GCustomer")
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+
+ //requestParameters
+ String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ logger.debug(msg)
+ execution.setVariable("subscriptionServiceType", "5G")
+ } else {
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ }
+ String operationId = jsonUtil.getJsonValue(siRequest, "operationId")
+ execution.setVariable("operationId", operationId)
+
+ String operationType = execution.getVariable("operationType")
+ execution.setVariable("operationType", operationType.toUpperCase())
+
+ logger.info("operationType is " + execution.getVariable("operationType") )
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String operationId = execution.getVariable("operationId")
+ // RESTResponse for API Handler (APIH) Reply Task
+ String Activate5GsliceServiceRestRequest = """{"operationId":"${operationId}"}""".trim()
+ logger.debug(" sendSyncResponse to APIH:" + "\n" + Activate5GsliceServiceRestRequest)
+ sendWorkflowResponse(execution, 202, Activate5GsliceServiceRestRequest)
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
+
+
+ public sendSyncError = { DelegateExecution execution ->
+ logger.debug("sendSyncError Start")
+ try {
+ String errorMessage
+ if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
+ WorkflowException wfe = execution.getVariable("WorkflowException") as WorkflowException
+ errorMessage = wfe.getErrorMessage()
+ } else {
+ errorMessage = "Sending Sync Error."
+ }
+
+ String buildWorkflowException =
+ """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
+ <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>"""
+
+ logger.debug(buildWorkflowException)
+ sendWorkflowResponse(execution, 500, buildWorkflowException)
+
+ } catch (Exception ex) {
+ logger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
+ }
+ logger.debug(Prefix + "sendSyncError Exit")
+ }
+
+
+ def prepareCompletionRequest = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareCompletionRequest Start")
+ String serviceId = execution.getVariable("serviceInstanceId")
+ String operationId = execution.getVariable("operationId")
+ String userId = execution.getVariable("globalSubscriberId")
+ //String result = execution.getVariable("result")
+ String result = "finished"
+ String progress = "100"
+ String reason = ""
+ String operationContent = execution.getVariable("operationContent")
+ String operationType = execution.getVariable("operationType")
+
+ OperationStatus initStatus = new OperationStatus()
+ initStatus.setServiceId(serviceId)
+ initStatus.setOperationId(operationId)
+ initStatus.setOperation(operationType)
+ initStatus.setUserId(userId)
+ initStatus.setResult(result)
+ initStatus.setProgress(progress)
+ initStatus.setReason(reason)
+ initStatus.setOperationContent(operationContent)
+
+ requestDBUtil.prepareUpdateOperationStatus(execution, initStatus)
+
+ logger.debug(Prefix + "prepareCompletionRequest Exit")
+ }
+
+
+ /**
+ * Init the service Operation Status
+ */
+ def prepareInitServiceOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareActivateServiceOperationStatus Start")
+ try {
+ String serviceId = execution.getVariable("serviceInstanceId")
+ String operationId = execution.getVariable("operationId")
+ String operationType = execution.getVariable("operationType")
+ String userId = execution.getVariable("globalSubscriberId")
+ String result = "processing"
+ String progress = "0"
+ String reason = ""
+ String operationContent = "Prepare service activation"
+
+ execution.setVariable("e2eserviceInstanceId", serviceId)
+ execution.setVariable("operationType", operationType)
+
+ OperationStatus initStatus = new OperationStatus()
+ initStatus.setServiceId(serviceId)
+ initStatus.setOperationId(operationId)
+ initStatus.setOperation(operationType)
+ initStatus.setUserId(userId)
+ initStatus.setResult(result)
+ initStatus.setProgress(progress)
+ initStatus.setReason(reason)
+ initStatus.setOperationContent(operationContent)
+
+ requestDBUtil.prepareUpdateOperationStatus(execution, initStatus)
+
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
+ execution.setVariable("CVFMI_ErrorResponse",
+ "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
+ }
+ logger.debug(Prefix + "prepareInitServiceOperationStatus Exit")
+ }
+
+
+ private getSNSSIStatusByNsi = { DelegateExecution execution, String NSIServiceId ->
+
+ logger.debug(Prefix + "getSNSSIStatusByNsi Start")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ globalSubscriberId, subscriptionServiceType, NSIServiceId)
+ if (!client.exists(uri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
+ }
+ AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+ Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+ if (si.isPresent()) {
+
+ List<Relationship> relatedList = si.get().getRelationshipList().getRelationship()
+ for (Relationship relationship : relatedList) {
+ String relatedTo = relationship.getRelatedTo()
+ if (relatedTo.toLowerCase() == "allotted-resource") {
+ //get snssi from allotted resource in list by nsi
+ List<String> SNSSIList = new ArrayList<>()
+ List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+ for (RelationshipData relationshipData : relationshipDataList) {
+ if (relationshipData.getRelationshipKey() == "service-instance.service-instance-id") {
+ SNSSIList.add(relationshipData.getRelationshipValue())
+ }
+ }
+ for (String snssi : SNSSIList) {
+ AAIResourcesClient client01 = new AAIResourcesClient()
+ AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ globalSubscriberId, subscriptionServiceType, snssi)
+ if (!client.exists(uri01)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
+ "Service Instance was not found in aai")
+ }
+ AAIResultWrapper wrapper01 = client01.get(uri01, NotFoundException.class)
+ Optional<ServiceInstance> nssiSi = wrapper01.asBean(ServiceInstance.class)
+ if (nssiSi.isPresent()) {
+ return nssiSi.get().getOrchestrationStatus() == "deactivated"
+ }
+ }
+
+ }
+ }
+
+ }
+ logger.debug(Prefix + "getSNSSIStatusByNsi Exit")
+ }
+
+
+ def updateStatusSNSSAIandNSIandNSSI = { DelegateExecution execution ->
+ logger.debug(Prefix + "updateStatusSNSSAIandNSIandNSSI Start")
+ logger.debug(" ***** update SNSSAI NSI NSSI slicing ***** ")
+ String e2eserviceInstanceId = execution.getVariable("e2eserviceInstanceId")
+ String NSIserviceInstanceId = execution.getVariable("NSIserviceid")
+
+ String globalCustId = execution.getVariable("globalSubscriberId")
+ String serviceType = execution.getVariable("serviceType")
+ String operationType = execution.getVariable("operationType")
+
+ String nssiMap = execution.getVariable("nssiMap")
+ Type type = new TypeToken<HashMap<String, NSSI>>() {}.getType()
+ Map<String, NSSI> activateNssiMap = new Gson().fromJson(nssiMap, type)
+ //update tn/cn/an nssi
+ for (Map.Entry<String, NSSI> entry : activateNssiMap.entrySet()) {
+ NSSI nssi = entry.getValue()
+ String nssiid = nssi.getNssiId()
+ updateStratus(execution, globalCustId, serviceType, nssiid, operationType)
+ }
+ if (operationType.equalsIgnoreCase("activation")) {
+ //update the s-nssai
+ updateStratus(execution, globalCustId, serviceType, e2eserviceInstanceId, operationType)
+ //update the nsi
+ updateStratus(execution, globalCustId, serviceType, NSIserviceInstanceId, operationType)
+ } else {
+ //update the s-nssai
+ updateStratus(execution, globalCustId, serviceType, e2eserviceInstanceId, operationType)
+ boolean flag = getSNSSIStatusByNsi(execution, NSIserviceInstanceId)
+ if (flag) {
+ //update the nsi
+ updateStratus(execution, globalCustId, serviceType, NSIserviceInstanceId, operationType)
+ } else {
+ logger.error("Service's status update failed")
+ String msg = "Service's status update failed"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+ logger.debug(Prefix + "updateStatusSNSSAIandNSIandNSSI Exit")
+ }
+
+
+ def updateStratus = { DelegateExecution execution, String globalCustId,
+ String serviceType, String serviceId, String operationType ->
+ logger.debug(Prefix + "updateStratus Start")
+
+ try {
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ globalCustId, serviceType, serviceId)
+ if (!client.exists(uri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
+ }
+ AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+ Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+
+ if (si.isPresent()) {
+ if (operationType.equalsIgnoreCase("activation")) {
+ if (si.get().getOrchestrationStatus() == "deactivated") {
+ si.get().setOrchestrationStatus("activated")
+ client.update(uri, si.get())
+ }
+ } else {
+ if (si.get().getOrchestrationStatus() == "activated") {
+ si.get().setOrchestrationStatus("deactivated")
+ client.update(uri, si.get())
+ }
+ }
+
+ }
+ } catch (Exception e) {
+ logger.info("Service is already in active state")
+ String msg = "Service is already in active state, " + e.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug(Prefix + "updateStratus Exit")
+ }
+
+
+ def prepareActivation = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareActivation Start")
+
+ logger.debug(" ***** prepare active NSI/AN/CN/TN slice ***** ")
+ String NSIserviceInstanceId = execution.getVariable("NSIserviceid")
+
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+ Map<String, NSSI> nssiMap = new HashMap<>()
+
+ List<String> activationSequence = new ArrayList<>(Arrays.asList("an", "tn", "cn"))
+
+ def activationCount = activationSequence.size()
+
+ execution.setVariable("activationIndex", "0")
+
+ execution.setVariable("activationCount", activationCount)
+ try {
+ //get the TN NSSI id by NSI id, active NSSI TN slicing
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ globalSubscriberId, subscriptionServiceType, NSIserviceInstanceId)
+ if (!client.exists(uri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
+ }
+ AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+ Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+ if (si.isPresent()) {
+
+ List<Relationship> relatedList = si.get().getRelationshipList().getRelationship()
+ for (Relationship relationship : relatedList) {
+ String relatedTo = relationship.getRelatedTo()
+ if (relatedTo.toLowerCase() == "service-instance") {
+ String relatioshipurl = relationship.getRelatedLink()
+ String nssiserviceid =
+ relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length())
+
+ AAIResourcesClient client01 = new AAIResourcesClient()
+ AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ globalSubscriberId, subscriptionServiceType, nssiserviceid)
+ if (!client.exists(uri01)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
+ "Service Instance was not found in aai")
+ }
+ AAIResultWrapper wrapper01 = client01.get(uri01, NotFoundException.class)
+ Optional<ServiceInstance> nssiSi = wrapper01.asBean(ServiceInstance.class)
+ if (nssiSi.isPresent()) {
+ if (nssiSi.get().getEnvironmentContext().toLowerCase().contains("an")
+ || nssiSi.get().getEnvironmentContext().toLowerCase().contains("cn")
+ || nssiSi.get().getEnvironmentContext().toLowerCase().contains("tn")) {
+ nssiMap.put(nssiSi.get().getEnvironmentContext(),
+ new NSSI(nssiSi.get().getServiceInstanceId(),
+ nssiSi.get().getModelInvariantId(), nssiSi.get().getModelVersionId()))
+ }
+ }
+ }
+ }
+
+
+ }
+ } catch (Exception e) {
+ String msg = "Requested service does not exist:" + e.getMessage()
+ logger.info("Service doesnt exist")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ if (nssiMap.size() > 0) {
+ execution.setVariable("isNSSIActivate", "true")
+ String nssiMap01 = mapToJsonStr(nssiMap)
+ execution.setVariable("nssiMap", nssiMap01)
+ execution.setVariable("operation_type", "activate")
+ execution.setVariable("activationCount", nssiMap.size())
+ logger.info("the nssiMap01 is :" + nssiMap01)
+ } else {
+ execution.setVariable("isNSSIActivate", "false")
+ }
+
+ logger.debug(Prefix + "prepareActivation Exit")
+ }
+
+
+ private mapToJsonStr = { HashMap<String, NSSI> stringNSSIHashMap ->
+ HashMap<String, NSSI> map = new HashMap<String, NSSI>()
+ for (Map.Entry<String, NSSI> child : stringNSSIHashMap.entrySet()) {
+ map.put(child.getKey(), child.getValue())
+ }
+ return new Gson().toJson(map)
+ }
+
+
+ def checkAAIOrchStatusofslice = { DelegateExecution execution ->
+ logger.debug(Prefix + "CheckAAIOrchStatus Start")
+
+ String msg = ""
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+ String operationType = execution.getVariable("operationType")
+
+ logger.debug("serviceInstanceId: " + serviceInstanceId)
+
+ //check the e2e slice status
+ try {
+ try {
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ globalSubscriberId, subscriptionServiceType, serviceInstanceId)
+ if (!client.exists(uri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
+ "Service Instance was not found in aai")
+ }
+ AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+ Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+ if (si.isPresent()) {
+ if (si.get().getOrchestrationStatus().toLowerCase() == "activated" &&
+ operationType.equalsIgnoreCase("deactivation")) {
+ logger.info("Service is in active state")
+ execution.setVariable("e2eservicestatus", "activated")
+ execution.setVariable("isContinue", "true")
+ String snssai = si.get().getEnvironmentContext()
+ execution.setVariable("snssai", snssai)
+ } else if (si.get().getOrchestrationStatus().toLowerCase() == "deactivated" &&
+ operationType.equalsIgnoreCase("activation")) {
+ logger.info("Service is in de-activated state")
+ execution.setVariable("e2eservicestatus", "deactivated")
+ execution.setVariable("isContinue", "true")
+ String snssai = si.get().getEnvironmentContext()
+ execution.setVariable("snssai", snssai)
+ } else {
+ execution.setVariable("isContinue", "false")
+ }
+ }
+ } catch (Exception e) {
+ msg = "Requested e2eservice does not exist"
+ logger.info("e2eservice doesnt exist")
+ execution.setVariable("isContinue", "false")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ //check the NSI is exist or the status of NSI is active or de-active
+ try {
+
+ //get the allotted-resources by e2e slice id
+ AAIResourcesClient client_allotted = new AAIResourcesClient()
+ AAIResourceUri uri_allotted = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE_ALL,
+ globalSubscriberId, subscriptionServiceType, serviceInstanceId)
+ if (!client_allotted.exists(uri_allotted)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
+ }
+ AAIResultWrapper wrapper_allotted = client_allotted.get(uri_allotted, NotFoundException.class)
+ Optional<AllottedResources> all_allotted = wrapper_allotted.asBean(AllottedResources.class)
+
+ if (all_allotted.isPresent() && all_allotted.get().getAllottedResource()) {
+ List<AllottedResource> AllottedResourceList = all_allotted.get().getAllottedResource()
+ AllottedResource ar = AllottedResourceList.first()
+ String relatedLink = ar.getRelationshipList().getRelationship().first().getRelatedLink()
+ String nsiserviceid = relatedLink.substring(relatedLink.lastIndexOf("/") + 1, relatedLink.length())
+ execution.setVariable("NSIserviceid", nsiserviceid)
+ logger.info("the NSI ID is:" + nsiserviceid)
+
+ //Query nsi by nsi id
+ try {
+ //get the NSI id by e2e slice id
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ globalSubscriberId, subscriptionServiceType, nsiserviceid)
+ if (!client.exists(uri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
+ "Service Instance was not found in aai")
+ }
+ AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+ Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+
+ if (si.isPresent()) {
+ if (si.get().getServiceRole().toLowerCase() == "nsi") {
+ if (si.get().getOrchestrationStatus() == "activated") {
+ logger.info("NSI services is in activated state")
+ execution.setVariable("NSIservicestatus", "activated")
+ } else {
+ logger.info("NSI services is in deactivated state")
+ execution.setVariable("NSIservicestatus", "deactivated")
+ }
+ } else {
+ logger.info("the service id" + si.get().getServiceInstanceId() + "is " +
+ si.get().getServiceRole())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+ } catch (Exception e) {
+ msg = "Requested NSI service does not exist:" + e.getMessage()
+ logger.info("NSI service doesnt exist")
+ execution.setVariable("isContinue", "false")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+ } catch (Exception e) {
+ msg = "Requested service does not exist: " + e.getMessage()
+ logger.info("NSI Service doesnt exist")
+ execution.setVariable("isActivate", "false")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in org.onap.so.bpmn.common.scripts.CompleteMsoProcess.CheckAAIOrchStatus " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug(Prefix + "CheckAAIOrchStatus Exit")
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy
new file mode 100644
index 0000000000..3233bfff61
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy
@@ -0,0 +1,333 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.db.request.beans.OperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import java.util.concurrent.TimeUnit
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class CheckServiceProcessStatus extends AbstractServiceTaskProcessor {
+
+
+ String Prefix="CSPS_"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+
+ JsonUtils jsonUtil = new JsonUtils()
+
+ AAIResourcesClient client = getAAIClient()
+
+ private static final Logger logger = LoggerFactory.getLogger(CheckServiceProcessStatus.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "CheckServiceProcessStatus preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String operationId = execution.getVariable("operationId")
+ String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
+ String parentOperationId = execution.getVariable("parentOperationId")
+
+ if (isBlank(serviceInstanceId) || isBlank(operationId)) {
+ String msg = "Exception in" + Prefix + "preProcessRequest: Input serviceInstanceId or operationId is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ if (isBlank(parentServiceInstanceId) || isBlank(parentOperationId)) {
+ execution.setVariable("isNeedUpdateParentStatus", false)
+ }
+
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ execution.setVariable("globalSubscriberId", "5GCustomer")
+ }
+
+ // serviceType: type of service
+ String serviceType = execution.getVariable("processServiceType")
+ if (isBlank(serviceType)) {
+ execution.setVariable("processServiceType", "service")
+ }
+
+ // operationType: type of service
+ String operationType = execution.getVariable("operationType")
+ if (isBlank(operationType)) {
+ execution.setVariable("operationType", "CREATE")
+ }
+
+ //successConditions: processing end success conditions
+ List<String> successConditions = execution.getVariable("successConditions") as List
+
+ //errorConditions: processing end error conditions
+ List<String> errorConditions = execution.getVariable("errorConditions") as List
+
+ if ((successConditions == null || successConditions.size() < 1)
+ && (errorConditions == null || errorConditions.size() < 1)) {
+ String msg = "Exception in" + Prefix + "preProcessRequest: conditions is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ for (int i = 0; i < successConditions.size(); i++) {
+ String condition = successConditions.get(i)
+ successConditions.set(i, condition.toLowerCase())
+ }
+ for (int i = 0; i < errorConditions.size(); i++) {
+ String condition = errorConditions.get(i)
+ errorConditions.set(i, condition.toLowerCase())
+ }
+ }
+
+ execution.setVariable("startTime", System.currentTimeMillis())
+
+ String initProgress = execution.getVariable("initProgress")
+
+ if (isBlank(initProgress)) {
+ execution.setVariable("initProgress", 0)
+ }
+
+ String endProgress = execution.getVariable("endProgress")
+
+ if (isBlank(endProgress)) {
+ execution.setVariable("endProgress", 100)
+ }
+
+ execution.setVariable("progress", 0)
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ /**
+ * check service status through request operation id, update operation status
+ */
+ def preCheckServiceStatusReq = { DelegateExecution execution ->
+ logger.trace(Prefix + "preCheckServiceStatusReq Start")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId") as String
+ String operationId = execution.getVariable("operationId") as String
+ requestDBUtil.getOperationStatus(execution, serviceInstanceId, operationId)
+ logger.trace(Prefix + "preCheckServiceStatusReq Exit")
+ }
+
+
+ /**
+ * handle service status, if service status is finished or error, set the service status
+ * @param execution
+ */
+ def handlerServiceStatusResp = { DelegateExecution execution ->
+ logger.trace(Prefix + "handlerServiceStatusResp Start")
+ String msg
+ try {
+ def dbResponseCode = execution.getVariable("dbResponseCode") as Integer
+ if (dbResponseCode >= 200 && dbResponseCode < 400) {
+ String dbResponse = execution.getVariable("dbResponse")
+ def dbResponseJson = jsonUtil.xml2json(dbResponse) as String
+
+ String result = jsonUtil.getJsonValue(dbResponseJson,
+ "Envelope.Body.getServiceOperationStatusResponse.return.result")
+
+ if (isSuccessCompleted(execution, result)) {
+
+ handlerSuccess(execution, result)
+ execution.setVariable("isAllFinished", "true")
+
+ logger.debug(Prefix + "handlerServiceStatusResp: service success finished, dbResponse_result: "
+ + result)
+
+ } else if (isErrorCompleted(execution, result)) {
+
+ handlerError(execution, result)
+ execution.setVariable("isAllFinished", "true")
+
+ logger.debug(Prefix + "handlerServiceStatusResp: service error finished, dbResponse_result: "
+ + result)
+
+ } else {
+ String progress = jsonUtil.getJsonValue(dbResponseJson,
+ "Envelope.Body.getServiceOperationStatusResponse.return.progress")
+
+ String oldProgress = execution.getVariable("progress")
+
+ if (progress == oldProgress) {
+ execution.setVariable("isNeedUpdateDB", false)
+ } else {
+ execution.setVariable("progress", progress)
+ execution.setVariable("isNeedUpdateDB", true)
+ }
+ execution.setVariable("isAllFinished", "false")
+ TimeUnit.SECONDS.sleep(10)
+ }
+ } else {
+ execution.setVariable("isAllFinished", "false")
+ //todo: retry
+ TimeUnit.MILLISECONDS.sleep(10)
+ }
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in " + Prefix + "handlerServiceStatusResp: " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.trace(Prefix + "handlerServiceStatusResp Exit")
+ }
+
+
+ def timeWaitDelay = { DelegateExecution execution ->
+
+ Long startTime = execution.getVariable("startTime") as Long
+ Long timeOut = execution.getVariable("timeOut") as Long
+
+ timeOut = timeOut == null ? 3 * 60 * 60 * 1000 : timeOut
+
+ if (System.currentTimeMillis() - startTime > timeOut) {
+
+ handlerTimeOut(execution)
+ execution.setVariable("isTimeOut", "YES")
+
+ } else {
+ execution.setVariable("isTimeOut", "NO")
+ }
+ }
+
+
+ private handlerTimeOut = { DelegateExecution execution ->
+
+ Map<String, Object> paramMap = execution.getVariable("timeOutParamMap") as Map
+
+ handlerProcess(execution, "error", paramMap, "error", "with timeout")
+ }
+
+
+ private handlerSuccess = { DelegateExecution execution, String result ->
+
+ Map<String, Object> paramMap = execution.getVariable("successParamMap") as Map
+
+ handlerProcess(execution, result, paramMap, "deactivated", "success")
+ }
+
+
+ private handlerError = { DelegateExecution execution, String result ->
+
+ Map<String, Object> paramMap = execution.getVariable("errorParamMap") as Map
+
+ handlerProcess(execution, result, paramMap, "error", "with error")
+ }
+
+
+ private handlerProcess = { DelegateExecution execution, String result, def paramMap, def status, def msg ->
+
+ if (paramMap != null) {
+ for (Map.Entry<String, Object> entry : paramMap.entrySet()) {
+ execution.setVariable(entry.getKey(), entry.getValue())
+ }
+ }
+
+
+ if (isBlank(execution.getVariable("operationStatus") as String)) {
+ execution.setVariable("operationStatus", result)
+ }
+
+
+ if (isBlank(execution.getVariable("operationContent") as String)) {
+ String operationContent = execution.getVariable("processServiceType") + " " +
+ execution.getVariable("operationType") + " operation finished " + msg
+ execution.setVariable("operationContent", operationContent)
+ }
+
+ if (isBlank(execution.getVariable("orchestrationStatus") as String)) {
+ execution.setVariable("orchestrationStatus", status)
+ }
+
+ }
+
+
+ /**
+ * judge if the service processing success finished
+ */
+ private isSuccessCompleted = { DelegateExecution execution, String result ->
+
+ //successConditions: processing end success conditions
+ List<String> successConditions = execution.getVariable("successConditions") as List
+
+ result = result.toLowerCase()
+ if (successConditions.contains(result)) {
+ return true
+ }
+ return false
+ }
+
+
+ /**
+ * judge if the service processing error finished
+ */
+ private isErrorCompleted = { DelegateExecution execution, String result ->
+
+ //errorConditions: processing end error conditions
+ List<String> errorConditions = execution.getVariable("errorConditions") as List
+
+ result = result.toLowerCase()
+ if (errorConditions.contains(result)) {
+ return true
+ }
+ return false
+ }
+
+
+ def preUpdateOperationProgress = { DelegateExecution execution ->
+ logger.trace(Prefix + "prepareUpdateOperationStatus Start")
+
+ def progress = execution.getVariable("progress") as Integer
+ def initProgress = execution.getVariable("initProgress") as Integer
+ def endProgress = execution.getVariable("endProgress") as Integer
+
+ def resProgress = (initProgress + (endProgress - initProgress) / 100 * progress) as Integer
+
+ def operationType = execution.getVariable("operationType")
+ def operationContent = execution.getVariable("processServiceType") + " " +
+ operationType + " operation processing " + resProgress
+
+ // update status creating
+ OperationStatus status = new OperationStatus()
+ status.setServiceId(execution.getVariable("parentServiceInstanceId") as String)
+ status.setOperationId(execution.getVariable("parentOperationId") as String)
+ status.setOperation(operationType as String)
+ status.setResult("processing")
+ status.setProgress(resProgress as String)
+ status.setOperationContent(operationContent as String)
+ status.setUserId(execution.getVariable("globalSubscriberId") as String)
+
+ requestDBUtil.prepareUpdateOperationStatus(execution, status)
+ logger.trace(Prefix + "prepareUpdateOperationStatus Exit")
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
new file mode 100644
index 0000000000..71da2abd05
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
@@ -0,0 +1,678 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+import groovy.json.JsonSlurper
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.json.JSONObject
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceInfo
+import org.onap.so.bpmn.core.domain.ServiceProxy
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.db.request.beans.OperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.springframework.web.util.UriUtils
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+/**
+ * This groovy class supports the <class>DoCreateCommunicationService.bpmn</class> process.
+ * AlaCarte flow for 1702 ServiceInstance Create
+ *
+ */
+class CreateCommunicationService extends AbstractServiceTaskProcessor {
+
+ String Prefix="CCS_"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+
+ JsonUtils jsonUtil = new JsonUtils()
+
+ AAIResourcesClient client = getAAIClient()
+
+ private static final Logger logger = LoggerFactory.getLogger(CreateCommunicationService.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+ execution.setVariable("startTime", System.currentTimeMillis())
+ def msg
+ //execution.setVariable("bpmnRequest", InputString)
+ try {
+ // get request input
+ String siRequest = execution.getVariable("bpmnRequest")
+ logger.debug(siRequest)
+
+ //String requestId = execution.getVariable("mso-request-id")
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ logger.debug("Input Request:" + siRequest + " reqId:" + requestId)
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ if (isBlank(serviceInstanceId)) {
+ serviceInstanceId = UUID.randomUUID().toString()
+ }
+ logger.debug("Generated new Service Instance:" + serviceInstanceId)
+ 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"
+ logger.debug(msg)
+ //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"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("csServiceModelInfo", serviceModelInfo)
+ }
+
+ logger.debug("modelInfo: " + serviceModelInfo)
+
+ //requestParameters, subscriptionServiceType is 5G
+ String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ // todo: in create e2e interface, this value is write "MOG", so write it as "5G"
+ execution.setVariable("subscriptionServiceType", "5G")
+ }
+
+
+ /*
+ * Extracting User Parameters from incoming Request and converting into a Map
+ */
+ def jsonSlurper = new JsonSlurper()
+
+ Map reqMap = jsonSlurper.parseText(siRequest) as Map
+
+ //InputParams
+ def userParamsList = reqMap.requestDetails?.requestParameters?.userParams
+
+ Map<String, String> inputMap = [:]
+ if (userParamsList) {
+ for (def i=0; i<userParamsList.size(); i++) {
+ def userParams1 = userParamsList.get(i)
+ userParams1.each { param -> inputMap.put(param.key, param.value)}
+ }
+ }
+
+ logger.debug("User Input Parameters map: " + inputMap.toString())
+ execution.setVariable("serviceInputParams", inputMap)
+ execution.setVariable("uuiRequest", inputMap.get("UUIRequest"))
+ execution.setVariable("isAllNSMFFinished", "false")
+ String operationId = UUID.randomUUID().toString()
+ execution.setVariable("operationId", operationId)
+
+ } catch(BpmnError e) {
+ throw e
+ } catch(Exception ex) {
+ msg = "Exception in CreateCommunicationService.preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ /**
+ * create operation status in request db
+ *
+ * Init the Operation Status
+ */
+ def prepareInitOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareInitOperationStatus Start")
+
+ String serviceId = execution.getVariable("serviceInstanceId")
+ // 生成 operationId
+ String operationId = execution.getVariable("operationId")
+ logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
+
+ OperationStatus initStatus = new OperationStatus()
+ initStatus.setServiceId(serviceId)
+ initStatus.setOperationId(operationId)
+ initStatus.setOperation("CREATE")
+ initStatus.setUserId(execution.getVariable("globalSubscriberId") as String)
+ initStatus.setResult("processing")
+ initStatus.setProgress("0")
+ initStatus.setReason("")
+ initStatus.setOperationContent("communication service create operation start")
+
+ requestDBUtil.prepareUpdateOperationStatus(execution, initStatus)
+
+ logger.debug(Prefix + "prepareInitOperationStatus Exit")
+ }
+
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String operationId = execution.getVariable("operationId")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String createServiceRestRequest = """
+ {
+ "service": {
+ "serviceId":"${serviceInstanceId}",
+ "operationId":"${operationId}"
+ }
+ }
+ """.trim().replaceAll(" ", "")
+
+ logger.debug("sendSyncResponse to APIH:" + "\n" + createServiceRestRequest)
+ sendWorkflowResponse(execution, 202, createServiceRestRequest)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
+
+
+ /**
+ * query e2e service
+ * @param execution
+ */
+ def prepareDoComposeE2E = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareDoComposeE2E Start")
+ try {
+ ServiceDecomposition serviceDecomposition = execution.getVariable(
+ "csServiceDecomposition") as ServiceDecomposition
+
+ logger.debug("serviceDecomposition is:" + serviceDecomposition.toJsonString())
+
+ List<ServiceProxy> serviceProxies = serviceDecomposition.getServiceProxy()
+ String sourceModelUuid = serviceProxies.get(0).getSourceModelUuid()
+
+ JSONObject queryJson = new JSONObject()
+ queryJson.put("modelUuid", sourceModelUuid)
+
+ execution.setVariable("e2eServiceModelInfo", queryJson.toString())
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in CreateCommunicationService.prepareDoComposeE2E. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug(Prefix + "prepareDoComposeE2E Exit")
+ }
+
+
+ /**
+ * parse communication service params from request
+ * @param execution
+ */
+ def parseCSParamsFromReq = { DelegateExecution execution ->
+ logger.debug(Prefix + "parseCSParamsFromReq Start")
+ try {
+ //1. CMS info
+
+ String modelInfo = execution.getVariable("csServiceModelInfo")
+ String modelInvariantUuid = jsonUtil.getJsonValue(modelInfo, "modelInvariantUuid")
+ String modelUuid = jsonUtil.getJsonValue(modelInfo, "modelUuid")
+
+ //String modelInvariantUuid = execution.getVariable("modelInvariantId")
+ //String modelUuid = execution.getVariable("modelUuid")
+ String uuiRequest = execution.getVariable("uuiRequest")
+ String useInterval = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.useInterval")
+ String csServiceName = jsonUtil.getJsonValue(uuiRequest, "service.name")
+ String csServiceDescription = jsonUtil.getJsonValue(uuiRequest, "service.description")
+
+ execution.setVariable("modelInvariantUuid", modelInvariantUuid)
+ execution.setVariable("modelUuid", modelUuid)
+ execution.setVariable("useInterval", useInterval)
+ execution.setVariable("csServiceName", csServiceName)
+ execution.setVariable("csServiceDescription", csServiceDescription)
+
+
+ //2. profile info
+ Integer expDataRateDL = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.expDataRateDL")
+ Integer expDataRateUL = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.expDataRateUL")
+ Integer latency = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.latency")
+ Integer maxNumberOfUEs = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.maxNumberofUEs")
+ String uEMobilityLevel = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.uemobilityLevel")
+ String resourceSharingLevel = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.resourceSharingLevel")
+ String coverageArea = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.coverageAreaList")
+
+ // from template construct input map
+ //String cstTemplate = execution.getVariable("cstTemplate")
+ ServiceDecomposition csServiceDecomposition = execution.getVariable(
+ "csServiceDecomposition") as ServiceDecomposition
+ //String csServiceType = jsonUtil.getJsonValue(cstTemplate, "serviceResources.serviceType")
+ String csServiceType = csServiceDecomposition.getServiceType()
+ execution.setVariable("csServiceType", csServiceType)
+
+ //String cstTemplateInfo = jsonUtil.getJsonValue(cstTemplate, "serviceResources.serviceInfo.serviceInput")
+ ServiceInfo csServiceInfo = csServiceDecomposition.getServiceInfo()
+ String cstTemplateInfo = csServiceInfo.getServiceProperties()
+
+ List<String> csInputs = jsonUtil.StringArrayToList(cstTemplateInfo)
+
+ Map<String, ?> csInputMap = new HashMap<>()
+ for (String csInput : csInputs) {
+ def value
+ if (jsonUtil.getJsonValue(csInput, "type") == "integer") {
+ value = jsonUtil.getJsonValue(csInput, "default")
+ csInputMap.put(jsonUtil.getJsonValue(csInput, "name"), isBlank(value) ? 0 : (value as Integer))
+ } else if (jsonUtil.getJsonValue(csInput, "type") == "string") {
+ csInputMap.put(jsonUtil.getJsonValue(csInput, "name"),
+ jsonUtil.getJsonValue(csInput, "default"))
+ }
+ }
+ csInputMap.put("expDataRateDL", expDataRateDL)
+ csInputMap.put("expDataRateUL", expDataRateUL)
+ csInputMap.put("latency", latency)
+ csInputMap.put("maxNumberofUEs", maxNumberOfUEs)
+ csInputMap.put("uEMobilityLevel", uEMobilityLevel)
+ csInputMap.put("resourceSharingLevel", resourceSharingLevel)
+ csInputMap.put("coverageAreaTAList", coverageArea)
+ csInputMap.put("useInterval", useInterval)
+
+ execution.setVariable("csInputMap", csInputMap)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in CreateCommunicationService.parseCSParamsFromReq. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "parseCSParamsFromReq Exit")
+ }
+
+
+ /**
+ * get E2EST id through CST id and change communication profile to E2E service profile
+ * 1. get E2EST id from cst
+ * 1.1 查source service id
+ * 1.2 source service
+ * 1.3 source service input, init e2e profile
+ */
+ def generateE2EServiceProfile = { DelegateExecution execution ->
+ logger.debug(Prefix + "generateE2EServiceProfile Start")
+ try {
+ ServiceDecomposition e2eServiceDecomposition = execution.getVariable(
+ "e2eServiceDecomposition") as ServiceDecomposition
+ String e2estTemplateInfo = e2eServiceDecomposition.getServiceInfo().getServiceProperties()
+
+ List<String> e2eInputs = jsonUtil.StringArrayToList(e2estTemplateInfo)
+
+ Map<String, ?> csInputMap = execution.getVariable("csInputMap") as Map
+ Map<String, ?> e2eInputMap = new HashMap<>()
+ String key
+ def value
+
+
+ for (String e2eInput in e2eInputs) {
+ if (jsonUtil.getJsonValue(e2eInput, "type") == "integer") {
+ def temp
+ key = jsonUtil.getJsonValue(e2eInput, "name")
+ value = csInputMap.containsKey(key) ? csInputMap.getOrDefault(key, 0) : (isBlank(temp = jsonUtil.getJsonValue(e2eInput, "default")) ? 0 : temp)
+
+ e2eInputMap.put(key, value as Integer)
+ } else {
+ e2eInputMap.put(key = jsonUtil.getJsonValue(e2eInput, "name"), csInputMap.containsKey(key)
+ ? csInputMap.getOrDefault(key, null) : (jsonUtil.getJsonValue(e2eInput, "default")))
+ }
+ }
+
+ e2eInputMap.put("sNSSAI", execution.getVariable("sNSSAI_id"))
+ e2eInputMap.put("areaTrafficCapDL", 100)
+ e2eInputMap.put("areaTrafficCapUL", 100)
+ e2eInputMap.put("sST", execution.getVariable("csServiceType"))
+
+ execution.setVariable("e2eInputMap", e2eInputMap)
+ execution.setVariable("e2eServiceType", e2eServiceDecomposition.getServiceType())
+ execution.setVariable("e2eModelInvariantUuid", e2eServiceDecomposition.getModelInfo().getModelInvariantUuid())
+ execution.setVariable("e2eModelUuid", e2eServiceDecomposition.getModelInfo().getModelUuid())
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoCreateE2EServiceInstance.createRelationShipInAAI. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug(Prefix + "generateE2EServiceProfile Exit")
+ }
+
+
+ /**
+ * call createE2EService get operation id,
+ * created/processing
+ */
+ def preRequestSend2NSMF(DelegateExecution execution) {
+ logger.debug(Prefix + "preRequestSend2NSMF Start")
+ try {
+
+ //String NSMF_endpoint = "/onap/so/infra/e2eServiceInstances/v3"
+ def NSMF_endpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution)
+ def url = NSMF_endpoint + "/e2eServiceInstances/v3"
+ execution.setVariable("NSMF_endpoint", url)
+ //get from model catalog inputs
+ String payload = """
+ {
+ "service":{
+ "name": "${execution.getVariable("csServiceName")}",
+ "description": "e2eService of ${execution.getVariable("modelUuid")}",
+ "serviceInvariantUuid": "${execution.getVariable("e2eModelInvariantUuid")}",
+ "serviceUuid": "${execution.getVariable("e2eModelUuid")}",
+ "globalSubscriberId": "${execution.getVariable("globalSubscriberId")}",
+ "serviceType": "${execution.getVariable("subscriptionServiceType")}",
+ "parameters":{
+ "requestInputs": ${execution.getVariable("e2eInputMap") as JSONObject}
+ }
+ }
+ }
+ """
+ execution.setVariable("CSMF_NSMFRequest", payload.replaceAll("\\s+", ""))
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in CreateCommunicationService.preRequestSend2NSMF. " + ex.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug(Prefix + "preRequestSend2NSMF Exit")
+ }
+
+
+ def processNSMFResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "processNSMFResponse Start")
+ //oof
+ try {
+ def CSMF_NSMFResponseCode = execution.getVariable("CSMF_NSMFResponseCode") as Integer
+ if (CSMF_NSMFResponseCode >= 200 && CSMF_NSMFResponseCode < 400) {
+ def CSMF_NSMFResponse = execution.getVariable("CSMF_NSMFResponse") as String
+ def e2eServiceInstanceId = jsonUtil.getJsonValue(CSMF_NSMFResponse, "service.serviceId")
+ def e2eOperationId = jsonUtil.getJsonValue(CSMF_NSMFResponse, "service.operationId")
+
+ execution.setVariable("e2eServiceInstanceId", e2eServiceInstanceId)
+ execution.setVariable("e2eOperationId", e2eOperationId)
+ execution.setVariable("ProcessNsmfSuccess", "OK")
+ } else {
+ execution.setVariable("ProcessNsmfSuccess", "ERROR")
+ execution.setVariable("operationStatus", "error")
+ execution.setVariable("operationContent",
+ "communication service create operation error: nsmf response fail")
+ execution.setVariable("orchestrationStatus", "error")
+ }
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in " + Prefix + "processOOFResponse. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "processNSMFResponse Exit")
+ }
+
+
+ /**
+ * create communication service and e2e service relationship
+ *
+ */
+ def createCSAndSSRelationship = { DelegateExecution execution ->
+ logger.debug(Prefix + "createCSAndSSRelationship Start")
+ String msg = ""
+ try {
+ def e2eServiceInstanceId = execution.getVariable("e2eServiceInstanceId")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+ Relationship relationship = new Relationship()
+ String relatedLink = "aai/v16/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${e2eServiceInstanceId}"
+ relationship.setRelatedLink(relatedLink)
+
+ // create CS and SS relationship in AAI
+ createRelationShipInAAI(execution, relationship)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+
+ msg = "Exception in DoCreateE2EServiceInstance.createCustomRelationship. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "createCSAndSSRelationship Exit")
+ }
+
+
+ /**
+ * prepare update operation status to 50% after create relationship in aai
+ * @param execution
+ */
+ def prepareUpdateOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareUpdateOperationStatus Start")
+ // update status creating
+ OperationStatus status = new OperationStatus()
+ status.setServiceId(execution.getVariable("serviceInstanceId") as String)
+ status.setOperationId(execution.getVariable("operationId") as String)
+ status.setOperation("CREATE")
+ status.setResult("processing")
+ status.setProgress("20")
+ status.setOperationContent("communication service create operation processing: waiting nsmf service create finished")
+ status.setUserId(execution.getVariable("globalSubscriberId") as String)
+
+ requestDBUtil.prepareUpdateOperationStatus(execution, status)
+ logger.debug(Prefix + "prepareUpdateOperationStatus Exit")
+ }
+
+
+ /**
+ * create relationship in AAI
+ */
+ private createRelationShipInAAI = { DelegateExecution execution, final Relationship relationship ->
+ logger.debug(Prefix + "createRelationShipInAAI Start")
+ String msg
+ try {
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ execution.getVariable("globalSubscriberId"),
+ execution.getVariable("subscriptionServiceType"),
+ serviceInstanceId).relationshipAPI()
+ client.create(uri, relationship)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in CreateCommunicationService.createRelationShipInAAI. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "createRelationShipInAAI Exit")
+
+ }
+
+
+ def prepareCallCheckProcessStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareCallCheckProcessStatus Start")
+
+ def successConditions = new ArrayList<>()
+ successConditions.add("finished")
+ execution.setVariable("successConditions", successConditions)
+
+ def errorConditions = new ArrayList<>()
+ errorConditions.add("error")
+ execution.setVariable("errorConditions", errorConditions)
+
+ execution.setVariable("processServiceType", "communication service")
+
+ execution.setVariable("subOperationType", "CREATE")
+
+ execution.setVariable("timeOut", 3 * 60 * 60 * 1000)
+
+ def successParamMap = new HashMap<String, Object>()
+ successParamMap.put("orchestrationStatus", "deactivated")
+
+ execution.setVariable("successParamMap", successParamMap)
+
+ def errorParamMap = new HashMap<String, Object>()
+ errorParamMap.put("orchestrationStatus", "error")
+
+ execution.setVariable("errorParamMap", errorParamMap)
+
+ def timeOutParamMap = new HashMap<String, Object>()
+ timeOutParamMap.put("orchestrationStatus", "error")
+
+ execution.setVariable("timeOutParamMap", timeOutParamMap)
+
+ execution.setVariable("initProgress", 20)
+ execution.setVariable("endProgress", 90)
+
+ logger.debug(Prefix + "prepareCallCheckProcessStatus Exit")
+ }
+
+
+ /**
+ * prepare update operation status to complete after NSMF process success
+ * @param execution
+ */
+ def prepareCompleteStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareCompleteStatus Start")
+ OperationStatus status = new OperationStatus()
+ status.setServiceId(execution.getVariable("serviceInstanceId") as String)
+ status.setOperationId(execution.getVariable("operationId") as String)
+ status.setOperation("CREATE")
+ status.setResult(execution.getVariable("operationStatus") as String)
+ status.setProgress("100")
+ status.setOperationContent(execution.getVariable("operationContent") as String)
+ status.setUserId(execution.getVariable("globalSubscriberId") as String)
+
+ requestDBUtil.prepareUpdateOperationStatus(execution, status)
+ logger.debug("prepareCompleteStatus end, serviceInstanceId: " + execution.getVariable("serviceInstanceId")
+ + ", operationId: " + execution.getVariable("operationId"))
+ logger.debug(Prefix + "prepareCompleteStatus Exit")
+ }
+
+
+ /**
+ * update NSMF complete status to AAI when the NSMF process finished
+ * @param execution
+ */
+ def updateFinishStatusInAAI = { DelegateExecution execution ->
+ logger.debug(Prefix + "updateFinishStatusInAAI Start")
+ String msg
+ try {
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String orchestrationStatus = execution.getVariable("orchestrationStatus")
+ // create service
+ ServiceInstance csi = new ServiceInstance()
+ csi.setOrchestrationStatus(orchestrationStatus)
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ globalSubscriberId, subscriptionServiceType, serviceInstanceId)
+ client.update(uri, csi)
+ logger.debug(Prefix + "updateFinishStatusInAAI update communication service status to deactivated")
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in complete communication service " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "updateFinishStatusInAAI Exit")
+ }
+
+
+ public sendSyncError = { DelegateExecution execution ->
+ logger.debug("sendSyncError Start")
+ try {
+ String errorMessage
+ if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
+ WorkflowException wfe = execution.getVariable("WorkflowException") as WorkflowException
+ errorMessage = wfe.getErrorMessage()
+ } else {
+ errorMessage = "Sending Sync Error."
+ }
+
+ String buildWorkflowException =
+ """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
+ <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>"""
+
+ logger.debug(buildWorkflowException)
+ sendWorkflowResponse(execution, 500, buildWorkflowException)
+
+ } catch (Exception ex) {
+ logger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
+ }
+ logger.debug(Prefix + "sendSyncError Exit")
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
index cae629fdf0..650f79b633 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
@@ -39,7 +39,7 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
index 4b3c1aa7b4..8b9726c2b7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
@@ -127,7 +127,11 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String key = iterator.next()
HashMap<String, String> hashMap = new HashMap()
hashMap.put("name", key)
- hashMap.put("value", jsonObject.get(key))
+ if(jsonObject.get(key)==null){
+ hashMap.put("value", "")
+ }else{
+ hashMap.put("value", jsonObject.get(key))
+ }
paramList.add(hashMap)
}
Map<String, List<Map<String, Object>>> paramMap = new HashMap()
@@ -163,36 +167,20 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String serInput = jsonUtil.getJsonValue(resourceInputTmp, "requestsInputs")
switch (modelName) {
- case ~/[\w\s\W]*OLT[\w\s\W]*/ :
+ case ~/[\w\s\W]*OLT[\w\s\W]*/ : // for backward compatibilty only, this case will be deprecated
+ case ~/[\w\s\W]*AccessConnectivity[\w\s\W]*/ :
// get the required properties and update in resource input
def resourceInput = resourceInputObj.getResourceParameters()
String incomingRequest = resourceInputObj.getRequestsInputs()
String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters")
String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs")
- String cvlan
- String svlan
- String remoteId
-
- List<Metadatum> metadatum = getMetaDatum(resourceInputObj.getGlobalSubscriberId(),
- resourceInputObj.getServiceType(),
- resourceInputObj.getServiceInstanceId())
- for(Metadatum datum: metadatum) {
- if (datum.getMetaname().equalsIgnoreCase("cvlan")) {
- cvlan = datum.getMetaval()
- }
-
- if (datum.getMetaname().equalsIgnoreCase("svlan")) {
- svlan = datum.getMetaval()
- }
-
- if (datum.getMetaname().equalsIgnoreCase("remoteId")) {
- remoteId = datum.getMetaval()
- }
- }
-
- logger.debug("cvlan: "+cvlan+" | svlan: "+svlan+" | remoteId: "+remoteId)
-
+ String cvlan = jsonUtil.getJsonValue(serInput,
+ "service.parameters.requestInputs.cvlan")
+ String svlan = jsonUtil.getJsonValue(serInput,
+ "service.parameters.requestInputs.svlan")
+ String remoteId = jsonUtil.getJsonValue(serInput,
+ "service.parameters.requestInputs.edgeinternetprofile_ip_remote_id")
String manufacturer = jsonUtil.getJsonValue(serInput,
"service.parameters.requestInputs.ont_ont_manufacturer")
String ontsn = jsonUtil.getJsonValue(serInput,
@@ -209,7 +197,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
logger.debug("new resource Input :" + resourceInputObj.toString())
break
- case ~/[\w\s\W]*EdgeInternetProfile[\w\s\W]*/ :
+ case ~/[\w\s\W]*EdgeInternetProfile[\w\s\W]*/ : // for backward compatibilty only, this case will be deprecated
+ case ~/[\w\s\W]*InternetProfile[\w\s\W]*/ :
// get the required properties and update in resource input
def resourceInput = resourceInputObj.getResourceParameters()
String incomingRequest = resourceInputObj.getRequestsInputs()
@@ -217,37 +206,34 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs")
JSONObject inputParameters = new JSONObject(requestInputs)
- String cvlan
- String svlan
- String remoteId
+ String cvlan = jsonUtil.getJsonValue(serInput,
+ "service.parameters.requestInputs.cvlan")
+ String svlan = jsonUtil.getJsonValue(serInput,
+ "service.parameters.requestInputs.svlan")
String manufacturer = jsonUtil.getJsonValue(serInput,
"service.parameters.requestInputs.ont_ont_manufacturer")
-
+ String remoteId = jsonUtil.getJsonValue(serInput,
+ "service.parameters.requestInputs.edgeinternetprofile_ip_remote_id")
String ontsn = jsonUtil.getJsonValue(serInput,
"service.parameters.requestInputs.ont_ont_serial_num")
-
- List<Metadatum> metadatum = getMetaDatum(resourceInputObj.getGlobalSubscriberId(),
- resourceInputObj.getServiceType(),
- resourceInputObj.getServiceInstanceId())
- for(Metadatum datum: metadatum) {
- if (datum.getMetaname().equalsIgnoreCase("cvlan")) {
- cvlan = datum.getMetaval()
- }
-
- if (datum.getMetaname().equalsIgnoreCase("svlan")) {
- svlan = datum.getMetaval()
- }
-
- if (datum.getMetaname().equalsIgnoreCase("remoteId")) {
- remoteId = datum.getMetaval()
- }
- }
+ String serviceType = jsonUtil.getJsonValue(serInput,
+ "service.parameters.requestInputs.edgeinternetprofile_ip_service_type")
+ String macAddr = jsonUtil.getJsonValue(serInput,
+ "service.parameters.requestInputs.edgeinternetprofile_ip_rg_mac_addr")
+ String upStream = jsonUtil.getJsonValue(serInput,
+ "service.parameters.requestInputs.edgeinternetprofile_ip_upstream_speed")
+ String downStream = jsonUtil.getJsonValue(serInput,
+ "service.parameters.requestInputs.edgeinternetprofile_ip_downstream_speed")
String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.c_vlan", cvlan)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.s_vlan", svlan)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.manufacturer", manufacturer)
- uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_access_id", remoteId)
+ uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_remote_id", remoteId)
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ont_sn", ontsn)
+ uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_service_type", serviceType)
+ uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_rg_mac_addr", macAddr)
+ uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_upstream_speed", upStream)
+ uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_downstream_speed", downStream)
logger.debug("old resource input:" + resourceInputObj.toString())
resourceInputObj.setResourceParameters(uResourceInput)
execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString())
@@ -363,6 +349,32 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
switch (modelType) {
case "VNF" :
+ if(modelName.contains("UNI") && "MDONS_OTN".equals(serviceType)){
+ source = "SO"
+ sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
+ xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${msoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>optical-service-create</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>opticalservice</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-id>${msoUtils.xmlEscape(hdrRequestId)}</request-id>
+ <global-customer-id>${msoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <service-type>${msoUtils.xmlEscape(serviceType)}</service-type>
+ <notification-url>sdncCallback</notification-url>
+ <source>${msoUtils.xmlEscape(source)}</source>
+ <service-id>${msoUtils.xmlEscape(serviceInstanceId)}</service-id>
+ <payload>
+ $netowrkInputParameters
+ </payload>
+ </sdncadapterworkflow:SDNCRequestData>
+ </aetgt:SDNCAdapterWorkflowRequest>""".trim()
+ } else{
sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
@@ -417,6 +429,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
</vnf-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
+ }
break
case "GROUP" :
String vnfid = resourceInputObj.getVnfId()
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
new file mode 100644
index 0000000000..1efc1c11aa
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
@@ -0,0 +1,513 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+
+import javax.ws.rs.core.Response
+
+import static org.apache.commons.lang3.StringUtils.*
+import org.springframework.web.util.UriUtils
+import groovy.json.JsonSlurper
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.logging.filter.base.ONAPComponents
+import org.onap.so.beans.nsmf.SliceTaskParams
+import org.onap.so.db.request.beans.OrchestrationTask
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.OofUtils
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.logging.filter.base.ErrorCode
+import org.onap.so.logger.LoggingAnchor
+import org.onap.so.logger.MessageEnum
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+public class CreateSliceService extends AbstractServiceTaskProcessor {
+ String Prefix = "CRESS_"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ JsonSlurper jsonSlurper = new JsonSlurper()
+ ObjectMapper objectMapper = new ObjectMapper()
+ OofUtils oofUtils = new OofUtils()
+ private static final Logger logger = LoggerFactory.getLogger(CreateSliceService.class)
+
+
+ public void preProcessRequest(DelegateExecution execution) {
+ logger.debug("Start preProcessRequest")
+ execution.setVariable("prefix", Prefix)
+ String msg = ""
+
+ try {
+ String ssRequest = execution.getVariable("bpmnRequest")
+ logger.debug(ssRequest)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ logger.debug("Input Request:" + ssRequest + " reqId:" + requestId)
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ if (isBlank(serviceInstanceId)) {
+ serviceInstanceId = UUID.randomUUID().toString()
+ }
+
+ String operationId = UUID.randomUUID().toString()
+ execution.setVariable("operationId", operationId)
+
+ logger.debug("Generated new Service Instance:" + serviceInstanceId)
+ serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8")
+ execution.setVariable("serviceInstanceId", serviceInstanceId)
+
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(ssRequest, "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(ssRequest, "requestDetails.requestInfo.source"))
+ execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(ssRequest, "requestDetails.requestInfo.instanceName"))
+ execution.setVariable("disableRollback", jsonUtil.getJsonValue(ssRequest, "requestDetails.requestInfo.suppressRollback"))
+ String productFamilyId = jsonUtil.getJsonValue(ssRequest, "requestDetails.requestInfo.productFamilyId")
+ if (isBlank(productFamilyId)) {
+ msg = "Input productFamilyId is null"
+ logger.debug(msg)
+ //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("productFamilyId", productFamilyId)
+ }
+
+ //modelInfo
+ String serviceModelInfo = jsonUtil.getJsonValue(ssRequest, "requestDetails.modelInfo")
+ if (isBlank(serviceModelInfo)) {
+ msg = "Input serviceModelInfo is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+ }
+
+ logger.debug("modelInfo: " + serviceModelInfo)
+
+ //requestParameters
+ String subscriptionServiceType = jsonUtil.getJsonValue(ssRequest, "requestDetails.requestParameters.subscriptionServiceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ }
+ logger.debug("subscriptionServiceType: " + subscriptionServiceType)
+
+ /*
+ * Extracting User Parameters from incoming Request and converting into a Map
+ */
+ Map reqMap = jsonSlurper.parseText(ssRequest)
+
+ //InputParams
+ def userParamsList = reqMap.requestDetails?.requestParameters?.userParams
+
+ Map<String, String> inputMap = [:]
+ if (userParamsList) {
+ for (def i = 0; i < userParamsList.size(); i++) {
+ def userParams1 = userParamsList.get(i)
+ userParams1.each { param -> inputMap.put(param.key, param.value) }
+ }
+ }
+
+ logger.debug("User Input Parameters map: " + inputMap.toString())
+ String uuiRequest = inputMap.get("UUIRequest")
+ Map uuiReqMap = jsonSlurper.parseText(uuiRequest)
+ Map<String, Object> serviceObject = (Map<String, Object>) uuiReqMap.get("service")
+ Map<String, Object> parameterObject = (Map<String, Object>) serviceObject.get("parameters")
+ Map<String, Object> requestInputs = (Map<String, Object>) parameterObject.get("requestInputs")
+
+ execution.setVariable("serviceInputParams", inputMap)
+ execution.setVariable("uuiRequest", uuiRequest)
+ execution.setVariable("serviceProfile", requestInputs)
+
+ //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()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug("Finish preProcessRequest")
+ }
+
+ public void getNSTSelection(DelegateExecution execution) {
+ logger.debug("Start getNSTSelection")
+ String requestId = execution.getVariable("msoRequestId")
+ Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
+ String oofUrl = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+
+ def authHeader = ""
+ String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution)
+ String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+
+ String basicAuthValue = utils.encrypt(basicAuth, msokey)
+ if (basicAuthValue != null) {
+ logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue)
+ try {
+ authHeader = utils.getBasicAuth(basicAuthValue, msokey)
+ execution.setVariable("BasicAuthHeaderValue", authHeader)
+ } catch (Exception ex) {
+ logger.debug( "Unable to encode username and password string: " + ex)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " +
+ "encode username and password string")
+ }
+ } else {
+ logger.debug( "Unable to obtain BasicAuth - BasicAuth value null")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
+ "value null")
+ }
+
+ URL requestUrl = new URL(oofUrl + "/api/oof/v1/selection/nst")
+ String oofRequest = oofUtils.buildSelectNSTRequest(requestId, serviceProfile)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(requestUrl, ONAPComponents.OOF)
+ httpClient.addAdditionalHeader("Authorization", authHeader)
+ Response httpResponse = httpClient.post(oofRequest)
+
+ int responseCode = httpResponse.getStatus()
+ logger.debug("OOF sync response code is: " + responseCode)
+
+ if(responseCode != 200){
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
+ }
+
+ Map<String, Object> nstSolution
+ try {
+ Map<String, Object> resMap = httpResponse.readEntity(Map.class)
+ List<Map<String, Object>> nstSolutions = (List<Map<String, Object>>) resMap.get("solutions")
+ nstSolution = nstSolutions.get(0)
+ execution.setVariable("nstSolution", nstSolution)
+ } catch (Exception ex) {
+ logger.debug( "Failed to get NST solution suggested by OOF.")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Failed to get NST solution suggested by OOF.")
+ }
+
+ logger.debug("Finish getNSTSelection")
+
+ }
+
+ public void prepareDecomposeService(DelegateExecution execution) {
+ logger.debug("Start prepareDecomposeService")
+ String uuiRequest = execution.getVariable("uuiRequest")
+ String ssModelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid")
+ String ssModelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid")
+ String ssServiceModelInfo = """{
+ "modelInvariantUuid":"${ssModelInvariantUuid}",
+ "modelUuid":"${ssModelUuid}",
+ "modelVersion":""
+ }"""
+ execution.setVariable("ssServiceModelInfo", ssServiceModelInfo)
+
+ logger.debug("Finish prepareDecomposeService")
+ }
+
+ public void processDecomposition(DelegateExecution execution) {
+ logger.debug("Start processDecomposition")
+ String uuiRequest = execution.getVariable("uuiRequest")
+ Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
+ Map<String, Object> nstSolution = execution.getVariable("nstSolution")
+
+ Map uuiReqMap = jsonSlurper.parseText(uuiRequest)
+ Map<String, Object> serviceObject = (Map<String, Object>) uuiReqMap.get("service")
+ String subscriptionServiceType = serviceObject.get("serviceType")
+
+ String serviceType = (String) serviceProfile.get("sST")
+ String resourceSharingLevel = (String) serviceProfile.get("resourceSharingLevel")
+ String nstModelUuid = (String) nstSolution.get("UUID")
+ String nstModelInvariantUuid = (String) nstSolution.get("invariantUUID")
+
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ execution.setVariable("serviceType", serviceType)
+ execution.setVariable("resourceSharingLevel", resourceSharingLevel)
+ execution.setVariable("nstModelUuid", nstModelUuid)
+ execution.setVariable("nstModelInvariantUuid", nstModelInvariantUuid)
+
+ logger.debug("Finish processDecomposition")
+ }
+
+ public void prepareCreateOrchestrationTask(DelegateExecution execution) {
+ logger.debug("Start createOrchestrationTask")
+ String taskId = execution.getBusinessKey()
+ execution.setVariable("orchestrationTaskId", taskId)
+ logger.debug("BusinessKey: " + taskId)
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String serviceInstanceName = execution.getVariable("serviceInstanceName")
+ String taskName = "SliceServiceTask"
+ String taskStatus = "Planning"
+ String isManual = "false"
+ String requestMethod = "POST"
+ execution.setVariable("CSSOT_taskId", taskId)
+ execution.setVariable("CSSOT_name", taskName)
+ execution.setVariable("CSSOT_status", taskStatus)
+ execution.setVariable("CSSOT_isManual", isManual)
+ execution.setVariable("CSSOT_requestMethod", requestMethod)
+
+ Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
+
+ SliceTaskParams sliceTaskParams = new SliceTaskParams()
+ sliceTaskParams.setServiceId(serviceInstanceId)
+ sliceTaskParams.setServiceName(serviceInstanceName)
+ sliceTaskParams.setServiceProfile(serviceProfile)
+ execution.setVariable("sliceTaskParams", sliceTaskParams)
+
+ String paramJson = sliceTaskParams.convertToJson()
+ execution.setVariable("CSSOT_paramJson", paramJson)
+ logger.debug("CSSOT_paramJson: " + paramJson)
+
+ logger.debug("Finish createOrchestrationTask")
+ }
+
+ public void prepareUpdateOrchestrationTask(DelegateExecution execution) {
+ logger.debug("Start prepareUpdateOrchestrationTask")
+ String requestMethod = "PUT"
+ String taskStatus = execution.getVariable("taskStatus")
+ SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+ String paramJson = sliceTaskParams.convertToJson()
+ execution.setVariable("CSSOT_status", taskStatus)
+ execution.setVariable("CSSOT_paramJson", paramJson)
+ execution.setVariable("CSSOT_requestMethod", requestMethod)
+ logger.debug("Finish prepareUpdateOrchestrationTask")
+ }
+
+ public void prepareGetUserOptions(DelegateExecution execution) {
+ logger.debug("Start prepareGetUserOptions")
+ String requestMethod = "GET"
+ execution.setVariable("taskAction", "commit")
+ String taskAction = execution.getVariable("taskAction")
+ logger.debug("task action is: " + taskAction)
+ if (!"commit".equals(taskAction) && !"abort".equals(taskAction)) {
+ String msg = "Unknown task action: " + taskAction
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ execution.setVariable("CSSOT_requestMethod", requestMethod)
+ logger.debug("Finish prepareGetUserOptions")
+ }
+
+ public void processUserOptions(DelegateExecution execution) {
+ logger.debug("Start processUserOptions")
+ String response = execution.getVariable("CSSOT_dbResponse")
+ OrchestrationTask orchestrationTask = objectMapper.readValue(response, OrchestrationTask.class)
+ String paramJson = orchestrationTask.getParams()
+ logger.debug("paramJson: " + paramJson)
+ SliceTaskParams sliceTaskParams = new SliceTaskParams()
+ sliceTaskParams.convertFromJson(paramJson)
+ execution.setVariable("sliceTaskParams", sliceTaskParams)
+ logger.debug("Finish processUserOptions")
+ }
+
+ public void updateAAIOrchStatus(DelegateExecution execution) {
+ logger.debug("Start updateAAIOrchStatus")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String orchStatus = execution.getVariable("orchestrationStatus")
+
+ try {
+ ServiceInstance si = execution.getVariable("serviceInstanceData")
+ si.setOrchestrationStatus(orchStatus)
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+ client.update(uri, si)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug("Finish updateAAIOrchStatus")
+ }
+
+ public void prepareInitServiceOperationStatus(DelegateExecution execution) {
+ logger.debug("Start prepareInitServiceOperationStatus")
+ try{
+ String serviceId = execution.getVariable("serviceInstanceId")
+ String operationId = execution.getVariable("operationId")
+ String operationType = "CREATE"
+ String userId = execution.getVariable("globalSubscriberId")
+ String result = "processing"
+ String progress = "0"
+ String reason = ""
+ String operationContent = "Prepare service creation"
+ logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
+ serviceId = UriUtils.encode(serviceId,"UTF-8")
+ execution.setVariable("serviceInstanceId", serviceId)
+ execution.setVariable("operationType", operationType)
+
+ def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution)
+ execution.setVariable("CSSOS_dbAdapterEndpoint", dbAdapterEndpoint)
+ logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+ def dbAdapterAuth = UrnPropertiesReader.getVariable("mso.requestDb.auth")
+ Map<String, String> CSSOS_headerMap = [:]
+ CSSOS_headerMap.put("content-type", "application/soap+xml")
+ CSSOS_headerMap.put("Authorization", dbAdapterAuth)
+ execution.setVariable("CSSOS_headerMap", CSSOS_headerMap)
+ logger.debug("DB Adapter Header is: " + CSSOS_headerMap)
+
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.onap.so/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
+ <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
+ <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
+ <operationType>${MsoUtils.xmlEscape(operationType)}</operationType>
+ <userId>${MsoUtils.xmlEscape(userId)}</userId>
+ <result>${MsoUtils.xmlEscape(result)}</result>
+ <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent>
+ <progress>${MsoUtils.xmlEscape(progress)}</progress>
+ <reason>${MsoUtils.xmlEscape(reason)}</reason>
+ </ns:initServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ payload = utils.formatXml(payload)
+ execution.setVariable("CSSOS_updateServiceOperStatusRequest", payload)
+ logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload)
+ }catch(Exception e){
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
+ }
+ logger.debug("Finish prepareInitServiceOperationStatus")
+ }
+
+ public void prepareUpdateServiceOperationStatus(DelegateExecution execution) {
+ logger.debug("Start preUpdateServiceOperationStatus")
+ try{
+ String serviceId = execution.getVariable("serviceInstanceId")
+ String operationId = execution.getVariable("operationId")
+ String operationType = execution.getVariable("operationType")
+ String userId = execution.getVariable("globalSubscriberId")
+ String result = execution.getVariable("operationResult")
+ String progress = execution.getVariable("operationProgress")
+ String reason = execution.getVariable("operationReason")
+ String operationContent = "service: " + result + " progress: " + progress
+
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.onap.so/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
+ <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
+ <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
+ <operationType>${MsoUtils.xmlEscape(operationType)}</operationType>
+ <userId>${MsoUtils.xmlEscape(userId)}</userId>
+ <result>${MsoUtils.xmlEscape(result)}</result>
+ <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent>
+ <progress>${MsoUtils.xmlEscape(progress)}</progress>
+ <reason>${MsoUtils.xmlEscape(reason)}</reason>
+ </ns:initServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ payload = utils.formatXml(payload)
+ execution.setVariable("CSSOS_updateServiceOperStatusRequest", payload)
+ logger.debug("Outgoing updateServiceOperStatusRequest: \n" + payload)
+
+ }catch(Exception e){
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing preUpdateServiceOperationStatus.", "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e.getMessage())
+ }
+ logger.debug("Finish preUpdateServiceOperationStatus")
+ }
+
+ public void sendSyncResponse(DelegateExecution execution) {
+ logger.debug("Start sendSyncResponse")
+ try {
+ String operationId = execution.getVariable("operationId")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ // RESTResponse for API Handler (APIH) Reply Task
+ String createServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim()
+ logger.debug("sendSyncResponse to APIH:" + "\n" + createServiceRestRequest)
+ sendWorkflowResponse(execution, 202, createServiceRestRequest)
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception e) {
+ String msg = "Exceptuion in sendSyncResponse:" + e.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug("Finish sendSyncResponse")
+ }
+
+ public void prepareCompletionRequest (DelegateExecution execution) {
+ logger.trace("Start prepareCompletionRequest")
+ try {
+ String requestId = execution.getVariable("msoRequestId")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String source = execution.getVariable("source")
+
+ String msoCompletionRequest =
+ """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:ns="http://org.onap/so/request/types/v1">
+ <request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
+ <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
+ <action>CREATE</action>
+ <source>${MsoUtils.xmlEscape(source)}</source>
+ </request-info>
+ <status-message>Service Instance was created successfully.</status-message>
+ <serviceInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceInstanceId>
+ <mso-bpel-name>CreateGenericALaCarteServiceInstance</mso-bpel-name>
+ </aetgt:MsoCompletionRequest>"""
+
+ // Format Response
+ String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
+
+ execution.setVariable("completionRequest", xmlMsoCompletionRequest)
+ logger.debug("Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
+
+ } catch (Exception ex) {
+ String msg = " Exception in prepareCompletion:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.trace("Finish prepareCompletionRequest")
+ }
+
+}
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
index c9dadf57cb..fc97c292fb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
@@ -36,7 +36,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.infrastructure.aai.AAICreateResources
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy
index 1fba23d3c8..33a607268d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy
@@ -32,7 +32,7 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy
index 3eb15558d2..dc9655e7af 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy
@@ -24,7 +24,7 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.logger.LoggingAnchor
import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import static org.apache.commons.lang3.StringUtils.*;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy
new file mode 100644
index 0000000000..b121083954
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy
@@ -0,0 +1,460 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aai.domain.yang.CommunicationServiceProfile
+import org.onap.aai.domain.yang.CommunicationServiceProfiles
+import org.onap.logging.filter.base.ONAPComponents
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.db.request.beans.OperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.Response
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class DeleteCommunicationService extends AbstractServiceTaskProcessor {
+ private final String PREFIX ="DeleteCommunicationService"
+ private final Long TIMEOUT = 60 * 60 * 1000
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ private RequestDBUtil requestDBUtil = new RequestDBUtil()
+ private static final Logger LOGGER = LoggerFactory.getLogger(DeleteCommunicationService.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ execution.setVariable("prefix",PREFIX)
+ String msg = ""
+
+ LOGGER.trace("Starting preProcessRequest")
+
+ try {
+ // check for incoming json message/input
+ String siRequest = execution.getVariable("bpmnRequest")
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ execution.setVariable("operationType", "DELETE")
+
+ //communication service id
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ if (isBlank(serviceInstanceId)) {
+ msg = "communication-service id is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ LOGGER.info("Input Request: ${siRequest}, reqId: ${requestId}, serviceInstanceId: ${serviceInstanceId}")
+
+ //requestParameters
+ checkAndSetRequestParam(siRequest,"globalSubscriberId",false,execution)
+ checkAndSetRequestParam(siRequest,"serviceType",false,execution)
+ checkAndSetRequestParam(siRequest,"operationId",false,execution)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (any) {
+ msg = "Exception in preProcessRequest " + any.getCause()
+ LOGGER.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ LOGGER.trace("Exit preProcessRequest")
+ }
+
+
+ /**
+ * prepare update operation status
+ * @param execution
+ */
+ void preInitUpdateOperationStatus(DelegateExecution execution){
+ LOGGER.trace(" ======== STARTED initUpdateOperationStatus Process ======== ")
+ try{
+ execution.setVariable("result","processing")
+ execution.setVariable("progress","0")
+ execution.setVariable("operationContent","delete communication service operation start")
+ setOperationStatus(execution)
+
+ }catch(Exception e){
+ LOGGER.error("Exception Occured Processing initUpdateOperationStatus. Exception is:\n" + e)
+ execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during initUpdateOperationStatus Method:\n" + e.getMessage())
+ }
+ LOGGER.trace("======== COMPLETED initUpdateOperationStatus Process ======== ")
+ }
+
+ /**
+ * send sync response
+ * @param execution
+ */
+ void sendSyncResponse(DelegateExecution execution) {
+ LOGGER.debug("Begin sendSyncResponse")
+
+ try {
+ String operationId = execution.getVariable("operationId")
+ String syncResponse = """{"operationId":"${operationId}"}""".trim()
+ sendWorkflowResponse(execution, 202, syncResponse)
+
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse: " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ LOGGER.debug("Exit sendSyncResponse")
+ }
+
+ /**
+ * query CommunicationSerive from AAI
+ * save e2eslice-service instance id and service name
+ * @param execution
+ */
+ void queryCommunicationSeriveFromAAI(DelegateExecution execution)
+ {
+ LOGGER.trace(" ***** begin queryCommunicationSeriveFromAAI *****")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+
+ String errorMsg = "query communication service from aai failed"
+ AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg)
+ Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+ if(si.isPresent())
+ {
+ String serviceInstName = si.get()?.getServiceInstanceName()
+ String e2eSliceServiceInstId
+ if(si.isPresent())
+ {
+ List<Relationship> relationshipList = si.get().getRelationshipList()?.getRelationship()
+ for (Relationship relationship : relationshipList)
+ {
+ String relatedTo = relationship.getRelatedTo()
+ if (relatedTo == "service-instance")
+ {
+ String relatedLink = relationship.getRelatedLink()?:""
+ e2eSliceServiceInstId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : ""
+ break
+ }
+ }
+ }
+ execution.setVariable("e2eSliceServiceInstanceId", e2eSliceServiceInstId)
+ execution.setVariable("serviceInstanceName", serviceInstName ?: "")
+ LOGGER.info("communication-service Id: ${serviceInstanceId}, e2eslice-service Id: ${e2eSliceServiceInstId}, serviceName: ${serviceInstName}")
+ }
+ LOGGER.debug(" ***** Exit queryCommunicationSeriveFromAAI *****")
+ }
+
+ /**
+ * query AAI
+ * @param execution
+ * @param aaiObjectType
+ * @param instanceId
+ * @return AAIResultWrapper
+ */
+ private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectType aaiObjectType, String instanceId, String errorMsg)
+ {
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String serviceType = execution.getVariable("serviceType")
+
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, instanceId)
+ if (!getAAIClient().exists(resourceUri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg)
+ }
+ AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class)
+ return wrapper
+ }
+
+
+ /**
+ * 再次调用deleteE2EServiceInstance接口,然后获取到operationid,
+ */
+ void sendRequest2NSMFWF(DelegateExecution execution) {
+ LOGGER.trace("begin preRequestSend2NSMF")
+ try {
+ //url:/onap/so/infra/e2eServiceInstances/v3/{serviceInstanceId}"
+ def NSMF_endpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution)
+ String url = "${NSMF_endpoint}/e2eServiceInstances/v3/${execution.getVariable("e2eSliceServiceInstanceId")}"
+
+ String requestBody = """
+ {
+ "globalSubscriberId": "${execution.getVariable("globalSubscriberId")}",
+ "serviceType": "${execution.getVariable("serviceType")}"
+ }
+ """
+ requestBody.replaceAll("\\s+", "")
+
+ String basicAuthValue = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
+ HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO)
+ httpClient.addAdditionalHeader("Authorization", basicAuthValue)
+ httpClient.addAdditionalHeader("Accept", "application/json")
+ Response httpResponse = httpClient.delete(requestBody)
+ handleNSSMFWFResponse(httpResponse, execution)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (any) {
+ String msg = "Exception in DeleteCommunicationService.preRequestSend2NSMF. " + any.getCause()
+ LOGGER.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ LOGGER.trace("exit preRequestSend2NSMF")
+ }
+
+ /**
+ * prepare update operation status
+ * @param execution
+ */
+ private void handleNSSMFWFResponse(Response httpResponse, DelegateExecution execution){
+ LOGGER.debug(" ======== STARTED prepareUpdateOperationStatus Process ======== ")
+
+ int nsmfResponseCode = httpResponse.getStatus()
+ LOGGER.debug("nsmfResponseCode${nsmfResponseCode}")
+
+ if (nsmfResponseCode >= 200 && nsmfResponseCode < 204 && httpResponse.hasEntity()) {
+ String nsmfResponse = httpResponse.readEntity(String.class)
+ def e2eOperationId = jsonUtil.getJsonValue(nsmfResponse, "operationId")
+ execution.setVariable("e2eOperationId", e2eOperationId)
+ execution.setVariable("progress","20")
+ execution.setVariable("operationContent","waiting nsmf service delete finished")
+
+ execution.setVariable("currentCycle",0)
+ execution.setVariable("isNSMFTimeOut", "no")
+ execution.setVariable("isNSMFWFRspSucceed","yes")
+ }
+ else
+ {
+ String serviceName = execution.getVariable("serviceInstanceName")
+ execution.setVariable("progress", "100")
+ execution.setVariable("result", "error")
+ execution.setVariable("operationContent", "terminate service failure.")
+ execution.setVariable("reason","NSMF WF asynchronous response failed, status Code:${nsmfResponseCode}")
+ execution.setVariable("isNSMFWFRspSucceed","no")
+ LOGGER.error("nsmf async response error,nsmfResponseCode:${nsmfResponseCode},serivceName:${serviceName}")
+ }
+ setOperationStatus(execution)
+ LOGGER.debug("======== COMPLETED prepareUpdateOperationStatus Process ======== ")
+ }
+
+ /**
+ * prepare to call sub process
+ * @param execution
+ */
+ void prepareCallCheckProcessStatus(DelegateExecution execution)
+ {
+ LOGGER.debug(PREFIX + "prepareCallCheckProcessStatus Start")
+
+ def successConditions = new ArrayList<>()
+ successConditions.add("finished")
+ execution.setVariable("successConditions", successConditions)
+
+ def errorConditions = new ArrayList<>()
+ errorConditions.add("error")
+ execution.setVariable("errorConditions", errorConditions)
+
+ execution.setVariable("processServiceType", "communication service")
+ execution.setVariable("subOperationType", "DELETE")
+ execution.setVariable("initProgress", 20)
+ execution.setVariable("endProgress",90)
+
+ execution.setVariable("timeOut", TIMEOUT)
+
+ LOGGER.debug(PREFIX + "prepareCallCheckProcessStatus Exit")
+ }
+
+ /**
+ * delete communication profile from AAI
+ * @param execution
+ */
+ void delCSProfileFromAAI(DelegateExecution execution)
+ {
+ LOGGER.debug("start delete communication service profile from AAI")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String serviceType = execution.getVariable("serviceType")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+
+ String profileId
+ try
+ {
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_PROFILE_ALL, globalSubscriberId, serviceType, serviceInstanceId)
+ AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class)
+ Optional<CommunicationServiceProfiles> csProfilesOpt = wrapper.asBean(CommunicationServiceProfiles.class)
+ if(csProfilesOpt.isPresent()){
+ CommunicationServiceProfiles csProfiles = csProfilesOpt.get()
+ CommunicationServiceProfile csProfile = csProfiles.getCommunicationServiceProfile().get(0)
+ profileId = csProfile ? csProfile.getProfileId() : ""
+ }
+ resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, globalSubscriberId, serviceType, serviceInstanceId, profileId)
+ if (!getAAIClient().exists(resourceUri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "communication service profile was not found in aai")
+ }
+
+ getAAIClient().delete(resourceUri)
+ LOGGER.debug("end delete communication service profile from AAI")
+ }
+ catch (any)
+ {
+ String msg = "delete communication service profile from aai failed! cause-"+any.getCause()
+ LOGGER.error(any.printStackTrace())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+
+ }
+
+ /**
+ * delete communication service from AAI
+ * @param execution
+ */
+ void delCSFromAAI(DelegateExecution execution)
+ {
+ try
+ {
+ LOGGER.debug("start delete communication service from AAI")
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), execution.getVariable("serviceInstanceId"))
+ getAAIClient().delete(serviceInstanceUri)
+
+ execution.setVariable("progress", "100")
+ execution.setVariable("result", "finished")
+ execution.setVariable("operationContent", "CSMF completes service terminated.")
+ setOperationStatus(execution)
+ LOGGER.debug("end delete communication service from AAI")
+ }
+ catch (any)
+ {
+ LOGGER.error("Error occured within delCSFromAAI method, cause: ${any.getCause()} ")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during delete communication service from aai")
+ }
+ }
+
+ void sendSyncError(DelegateExecution execution)
+ {
+ LOGGER.debug("Starting sendSyncError")
+
+ try {
+ String errorMessage = "Sending Sync Error."
+ if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
+ WorkflowException wfe = execution.getVariable("WorkflowException")
+ errorMessage = wfe.getErrorMessage()
+ }
+
+ String buildworkflowException =
+ """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
+ <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>"""
+
+ LOGGER.debug(buildworkflowException)
+ sendWorkflowResponse(execution, 500, buildworkflowException)
+
+ } catch (Exception ex) {
+ LOGGER.error("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
+ }
+ }
+
+ /**
+ * prepare update operation status
+ * @param execution
+ */
+ void preFailedOperationStatus(DelegateExecution execution)
+ {
+ LOGGER.debug(" ======== STARTED preFailedOperationStatus Process ======== ")
+
+ execution.setVariable("progress", "100")
+ execution.setVariable("result", "error")
+ execution.setVariable("operationContent", "terminate service failure")
+
+ WorkflowException wfex = execution.getVariable("WorkflowException") as WorkflowException
+ String errorMessage = wfex.getErrorMessage()
+ errorMessage = errorMessage.length() > 200 ? errorMessage.substring(0,200) + "......" : errorMessage
+ execution.setVariable("reason", errorMessage)
+ setOperationStatus(execution)
+
+ LOGGER.debug("======== COMPLETED prepareEndOperationStatus Process ======== ")
+ }
+
+ /**
+ * prepare Operation status
+ * @param execution
+ * @param operationType
+ */
+ private void setOperationStatus(DelegateExecution execution)
+ {
+ OperationStatus operationStatus = new OperationStatus()
+ operationStatus.setServiceId(execution.getVariable("serviceInstanceId"))
+ operationStatus.setOperationId(execution.getVariable("operationId"))
+ operationStatus.setUserId(execution.getVariable("globalSubscriberId"))
+ //interface not support update
+ operationStatus.setServiceName(execution.getVariable("serviceInstanceName"))
+ operationStatus.setResult(execution.getVariable("result"))
+ operationStatus.setProgress(execution.getVariable("progress"))
+ operationStatus.setOperationContent(execution.getVariable("operationContent"))
+ operationStatus.setReason(execution.getVariable("reason")?:"")
+ operationStatus.setOperation("DELETE")
+
+ requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus)
+ }
+
+ void prepareFailureStatus(DelegateExecution execution)
+ {
+ execution.setVariable("result", "finished")
+ execution.setVariable("progress", "100")
+ execution.setVariable("operationContent", "terminate service failure.")
+ setOperationStatus(execution)
+ LOGGER.debug("${PREFIX}-prepareFailureStatus,result:${execution.getVariable("result")}, reason: ${execution.getVariable("reason")}")
+ }
+
+ /**
+ * check request json and save parameter to execution
+ * @param siRequest
+ * @param paraName
+ * @param isErrorException
+ * @param execution
+ */
+ private void checkAndSetRequestParam(String siRequest, String paraName, boolean isErrorException, DelegateExecution execution)
+ {
+ String msg = ""
+ String paramValue = jsonUtil.getJsonValue(siRequest, paraName)
+ if (isBlank(paramValue)) {
+ msg = "Input ${paraName} is null"
+ LOGGER.error(msg)
+ if(isErrorException)
+ {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ } else {
+ execution.setVariable(paraName, paramValue)
+ }
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy
index 5c7127f36e..41a4ab85ec 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy
@@ -31,7 +31,7 @@ import org.onap.so.bpmn.common.scripts.NetworkUtils
import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy
new file mode 100644
index 0000000000..d8160a97bc
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy
@@ -0,0 +1,259 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.ServiceProfile
+import org.onap.aai.domain.yang.ServiceProfiles
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.db.request.beans.OperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import javax.ws.rs.NotFoundException
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class DeleteSliceService extends AbstractServiceTaskProcessor {
+
+ private final String PREFIX ="DeleteSliceService"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ private RequestDBUtil requestDBUtil = new RequestDBUtil()
+
+ private static final Logger LOGGER = LoggerFactory.getLogger( DeleteSliceService.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ execution.setVariable("prefix", PREFIX)
+ String msg = ""
+
+ LOGGER.debug("*****${PREFIX} preProcessRequest *****")
+
+ try {
+ // check for incoming json message/input
+ String siRequest = execution.getVariable("bpmnRequest")
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+
+ //e2eslice-service instance id
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ if (isBlank(serviceInstanceId)) {
+ msg = "e2eslice-service id is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ LOGGER.info("Input Request: ${siRequest}, reqId: ${requestId}, e2eslice-service: ${serviceInstanceId}")
+
+ //subscriberInfo
+ checkAndSetRequestParam(siRequest,"globalSubscriberId",false, execution)
+ checkAndSetRequestParam(siRequest,"serviceType",false, execution)
+ checkAndSetRequestParam(siRequest,"operationId",false, execution)
+
+ //prepare init operation status
+ execution.setVariable("progress", "0")
+ execution.setVariable("result", "processing")
+ execution.setVariable("operationType", "DELETE")
+ execution.setVariable("operationContent", "Delete Slice service operation start")
+ updateServiceOperationStatus(execution)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ LOGGER.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ LOGGER.debug("*****${PREFIX} Exit preProcessRequest *****")
+ }
+
+ /**
+ * send asynchronous response
+ * @param execution
+ */
+ void sendAsyncResponse(DelegateExecution execution) {
+ LOGGER.trace("${PREFIX} Start sendSyncResponse ")
+
+ try {
+ String operationId = execution.getVariable("operationId")
+ String syncResponse = """{"operationId":"${operationId}"}""".trim()
+ LOGGER.info("sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse)
+ sendWorkflowResponse(execution, 202, syncResponse)
+
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse: " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ LOGGER.trace("${PREFIX} Exit sendSyncResponse")
+ }
+
+ /**
+ * Deletes the slice service instance in aai
+ */
+ void deleteSliceServiceInstance(DelegateExecution execution) {
+ LOGGER.trace("${PREFIX} Start deleteSliceServiceInstance")
+ try {
+
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), execution.getVariable("serviceInstanceId"))
+ getAAIClient().delete(serviceInstanceUri)
+
+ execution.setVariable("progress", "100")
+ execution.setVariable("result", "finished")
+ execution.setVariable("operationContent", "NSMF completes slicing service termination.")
+ updateServiceOperationStatus(execution)
+
+ LOGGER.trace("${PREFIX} Exited deleteSliceServiceInstance")
+ }catch(Exception e){
+ LOGGER.debug("Error occured within deleteSliceServiceInstance method: " + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Error occured during deleteSliceServiceInstance from aai")
+ }
+ }
+
+ /**
+ * update operation status
+ * @param execution
+ */
+ private void updateServiceOperationStatus(DelegateExecution execution){
+
+ OperationStatus operationStatus = new OperationStatus()
+ operationStatus.setServiceId(execution.getVariable("serviceInstanceId"))
+ operationStatus.setOperationId(execution.getVariable("operationId"))
+ operationStatus.setUserId(execution.getVariable("globalSubscriberId"))
+ operationStatus.setResult(execution.getVariable("result"))
+ operationStatus.setProgress(execution.getVariable("progress"))
+ operationStatus.setOperationContent(execution.getVariable("operationContent"))
+ operationStatus.setReason(execution.getVariable("reason"))
+ operationStatus.setOperation(execution.getVariable("operationType"))
+
+ requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus)
+ }
+
+ /**
+ * delete service profile from aai
+ * @param execution
+ */
+ void delServiceProfileFromAAI(DelegateExecution execution)
+ {
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String serviceType = execution.getVariable("serviceType")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String profileId = ""
+
+ try
+ {
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE_ALL, globalSubscriberId, serviceType, serviceInstanceId)
+ AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class)
+ Optional<ServiceProfiles> serviceProfilesOpt =wrapper.asBean(ServiceProfiles.class)
+ if(serviceProfilesOpt.isPresent()){
+ ServiceProfiles serviceProfiles = serviceProfilesOpt.get()
+ ServiceProfile serviceProfile = serviceProfiles.getServiceProfile().get(0)
+ profileId = serviceProfile ? serviceProfile.getProfileId() : ""
+ }
+ resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE, globalSubscriberId, serviceType, serviceInstanceId, profileId)
+ if (!getAAIClient().exists(resourceUri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
+ }
+ getAAIClient().delete(resourceUri)
+ }
+ catch (any)
+ {
+ String msg = "delete service profile from aai failed! cause-"+any.getCause()
+ LOGGER.error(any.printStackTrace())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+ }
+
+ void sendSyncError(DelegateExecution execution) {
+ LOGGER.debug("${PREFIX} Start sendSyncError")
+
+ try {
+ String errorMessage = "Sending Sync Error."
+ if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
+ WorkflowException wfe = execution.getVariable("WorkflowException")
+ errorMessage = wfe.getErrorMessage()
+ }
+
+ String buildworkflowException =
+ """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
+ <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>"""
+
+ LOGGER.debug(buildworkflowException)
+ sendWorkflowResponse(execution, 500, buildworkflowException)
+
+ } catch (Exception ex) {
+ LOGGER.error("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
+ }
+
+ }
+
+ void prepareEndOperationStatus(DelegateExecution execution){
+ LOGGER.debug(" ======== ${PREFIX} STARTED prepareEndOperationStatus Process ======== ")
+
+ execution.setVariable("progress", "100")
+ execution.setVariable("result", "error")
+ execution.setVariable("operationContent", "NSSMF Terminate service failure")
+
+ WorkflowException wfex = execution.getVariable("WorkflowException") as WorkflowException
+ String errorMessage = wfex.getErrorMessage()
+ errorMessage = errorMessage.length() > 200 ? errorMessage.substring(0,200) + "......" : errorMessage
+ execution.setVariable("reason",errorMessage)
+ updateServiceOperationStatus(execution)
+
+ LOGGER.debug("======== ${PREFIX} COMPLETED prepareEndOperationStatus Process ======== ")
+ }
+
+ /**
+ * check parameters from request body
+ * set to execution
+ * @param siRequest
+ * @param paraName
+ * @param isErrorException
+ * @param execution
+ */
+ private void checkAndSetRequestParam(String siRequest, String paraName, boolean isErrorException, DelegateExecution execution)
+ {
+ String msg = ""
+ String paramValue = jsonUtil.getJsonValue(siRequest, paraName)
+ if (isBlank(paramValue)) {
+ msg = "Input ${paraName} is null"
+ LOGGER.error(msg)
+ if(isErrorException)
+ {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ } else {
+ execution.setVariable(paraName, paramValue)
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy
index 79aa745792..fd30722369 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy
@@ -31,7 +31,7 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.VidUtils;
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
index 9fa488f8a7..eb2ec2bc9d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
@@ -38,7 +38,7 @@ import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
new file mode 100644
index 0000000000..d5b554d841
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
@@ -0,0 +1,338 @@
+package org.onap.so.bpmn.infrastructure.scripts
+
+import com.google.common.reflect.TypeToken
+import com.google.gson.Gson
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.AllottedResource
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.RelationshipList
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.so.beans.nsmf.SliceTaskParams
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceProxy
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.AAIEdgeLabel
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.db.request.client.RequestsDbClient
+import org.onap.so.db.request.beans.OrchestrationTask
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.UriBuilder
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor{
+
+ private static final Logger logger = LoggerFactory.getLogger( DoAllocateNSIandNSSI.class);
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestsDbClient requestsDbClient = new RequestsDbClient()
+
+ /**
+ * Pre Process the BPMN Flow Request
+ * Inclouds:
+ * generate the nsOperationKey
+ * generate the nsParameters
+ */
+
+ void preProcessRequest (DelegateExecution execution) {
+ String msg = ""
+ logger.trace("Enter preProcessRequest()")
+ Map<String, Object> nssiMap = new HashMap<>()
+ execution.setVariable("nssiMap", nssiMap)
+ boolean isMoreNSSTtoProcess = true
+ execution.setVariable("isMoreNSSTtoProcess", isMoreNSSTtoProcess)
+ List<String> nsstSequence = new ArrayList<>(Arrays.asList("cn"))
+ execution.setVariable("nsstSequence", nsstSequence)
+ logger.trace("Exit preProcessRequest")
+ }
+
+ void retriveSliceOption(DelegateExecution execution) {
+ logger.trace("Enter retriveSliceOption() of DoAllocateNSIandNSSI")
+ String uuiRequest = execution.getVariable("uuiRequest")
+ boolean isNSIOptionAvailable = false
+ List<String> nssiAssociated = new ArrayList<>()
+ SliceTaskParams sliceParams = execution.getVariable("sliceTaskParams")
+ try
+ {
+ String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.nstar0_allottedresource0_providing_service_uuid")
+ String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.nstar0_allottedresource0_providing_service_invariant_uuid")
+ String serviceModelInfo = """{
+ "modelInvariantUuid":"${modelInvariantUuid}",
+ "modelUuid":"${modelUuid}",
+ "modelVersion":""
+ }"""
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+ //Params sliceParams = new Gson().fromJson(params, new TypeToken<Params>() {}.getType());
+ execution.setVariable("sliceParams", sliceParams)
+ }catch (Exception ex) {
+ logger.debug( "Unable to get the task information from request DB: " + ex)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Unable to get task information from request DB.")
+ }
+
+ if(isBlank(sliceParams.getSuggestNsiId()))
+ {
+ isNSIOptionAvailable=false
+ }
+ else
+ {
+ isNSIOptionAvailable=true
+ execution.setVariable('nsiServiceInstanceId',sliceParams.getSuggestNsiId())
+ execution.setVariable('nsiServiceInstanceName',sliceParams.getSuggestNsiName())
+ }
+ execution.setVariable("isNSIOptionAvailable",isNSIOptionAvailable)
+ logger.trace("Exit retriveSliceOption() of DoAllocateNSIandNSSI")
+ }
+
+ void updateRelationship(DelegateExecution execution) {
+ logger.trace("Enter update relationship in DoAllocateNSIandNSSI()")
+ String nsiServiceInstanceId = execution.getVariable("nsiServiceInstanceId")
+ String allottedResourceId = execution.getVariable("allottedResourceId")
+ //Need to check whether nsi exist : Begin
+ org.onap.aai.domain.yang.ServiceInstance nsiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance()
+ SliceTaskParams sliceParams = execution.getVariable("sliceParams")
+
+ String nsiServiceInstanceID = sliceParams.getSuggestNsiId()
+
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
+ AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), nsiServiceInstanceID)
+ //AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.QUERY_ALLOTTED_RESOURCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), nsiServiceInstanceID)
+
+ try {
+ AAIResultWrapper wrapper = resourceClient.get(nsiServiceuri, NotFoundException.class)
+ Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class)
+ nsiServiceInstance = si.get()
+ //allottedResourceId=nsiServiceInstance.getAllottedResources().getAllottedResource().get(0).getId()
+
+// if(resourceClient.exists(nsiServiceuri)){
+// execution.setVariable("nsi_resourceLink", nsiServiceuri.build().toString())
+// }else{
+// exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " +
+// "associate for service :"+serviceInstanceId)
+// }
+ }catch(BpmnError e) {
+ throw e;
+ }catch (Exception ex){
+ String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), nsiServiceInstanceId, allottedResourceId)
+ getAAIClient().connect(allottedResourceUri,nsiServiceuri)
+
+ List<String> nssiAssociated = new ArrayList<>()
+ RelationshipList relationshipList = nsiServiceInstance.getRelationshipList()
+ List<Relationship> relationships = relationshipList.getRelationship()
+ for(Relationship relationship in relationships)
+ {
+ if(relationship.getRelatedTo().equalsIgnoreCase("service-instance"))
+ {
+ String NSSIassociated = relationship.getRelatedLink().substring(relationship.getRelatedLink().lastIndexOf("/") + 1);
+ if(!NSSIassociated.equals(nsiServiceInstanceID))
+ nssiAssociated.add(NSSIassociated)
+ }
+ }
+ execution.setVariable("nssiAssociated",nssiAssociated)
+ execution.setVariable("nsiServiceInstanceName",nsiServiceInstance.getServiceInstanceName())
+ logger.trace("Exit update relationship in DoAllocateNSIandNSSI()")
+ }
+
+ void prepareNssiModelInfo(DelegateExecution execution){
+ logger.trace("Enter prepareNssiModelInfo in DoAllocateNSIandNSSI()")
+ List<String> nssiAssociated = new ArrayList<>()
+ Map<String, Object> nssiMap = new HashMap<>()
+ nssiAssociated=execution.getVariable("nssiAssociated")
+ for(String nssiID in nssiAssociated)
+ {
+ try {
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), nssiID)
+ AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
+ Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class)
+ org.onap.aai.domain.yang.ServiceInstance nssi = si.get()
+ nssiMap.put(nssi.getEnvironmentContext(),"""{
+ "serviceInstanceId":"${nssi.getServiceInstanceId()}",
+ "modelUuid":"${nssi.getModelVersionId()}"
+ }""")
+
+ }catch(NotFoundException e)
+ {
+ logger.debug("NSSI Service Instance not found in AAI: " + nssiID)
+ }catch(Exception e)
+ {
+ logger.debug("NSSI Service Instance not found in AAI: " + nssiID)
+ }
+ execution.setVariable("nssiMap",nssiMap)
+
+ }
+ logger.trace("Exit prepareNssiModelInfo in DoAllocateNSIandNSSI()")
+ }
+
+ void createNSIinAAI(DelegateExecution execution) {
+ logger.trace("Enter CreateNSIinAAI in DoAllocateNSIandNSSI()")
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ org.onap.aai.domain.yang.ServiceInstance nsi = new ServiceInstance();
+ String sliceInstanceId = UUID.randomUUID().toString()
+ execution.setVariable("sliceInstanceId",sliceInstanceId)
+ nsi.setServiceInstanceId(sliceInstanceId)
+ String sliceInstanceName = "nsi_"+execution.getVariable("serviceInstanceName")
+ nsi.setServiceInstanceName(sliceInstanceName)
+ String serviceType = execution.getVariable("serviceType")
+ nsi.setServiceType(serviceType)
+ String serviceStatus = "deactivated"
+ nsi.setOrchestrationStatus(serviceStatus)
+ String modelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid()
+ String modelUuid = serviceDecomposition.getModelInfo().getModelUuid()
+ nsi.setModelInvariantId(modelInvariantUuid)
+ nsi.setModelVersionId(modelUuid)
+ String uuiRequest = execution.getVariable("uuiRequest")
+ String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList")
+ nsi.setServiceInstanceLocationId(serviceInstanceLocationid)
+ //String snssai = jsonUtil.getJsonValue(uuiRequest, "service.requestInputs.snssai")
+ //nsi.setEnvironmentContext(snssai)
+ String serviceRole = "nsi"
+ nsi.setServiceRole(serviceRole)
+ try {
+
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), sliceInstanceId)
+ client.create(uri, nsi)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ Map<String, Object> nssiMap = new HashMap<>()
+ List<ServiceProxy> serviceProxyList = serviceDecomposition.getServiceProxy()
+ List<String> nsstModelInfoList = new ArrayList<>()
+ for(ServiceProxy serviceProxy : serviceProxyList)
+ {
+ //String nsstModelUuid = serviceProxy.getModelInfo().getModelUuid()
+ String nsstModelUuid = serviceProxy.getSourceModelUuid()
+ //String nsstModelInvariantUuid = serviceProxy.getModelInfo().getModelInvariantUuid()
+ String nsstServiceModelInfo = """{
+ "modelInvariantUuid":"",
+ "modelUuid":"${nsstModelUuid}",
+ "modelVersion":""
+ }"""
+ nsstModelInfoList.add(nsstServiceModelInfo)
+ }
+ int currentIndex=0
+ int maxIndex=nsstModelInfoList.size()
+ if(maxIndex < 1)
+ {
+ msg = "Exception in DoAllocateNSIandNSSI. There is no NSST associated with NST "
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ execution.setVariable("nsstModelInfoList",nsstModelInfoList)
+ execution.setVariable("currentIndex",currentIndex)
+ execution.setVariable("maxIndex",maxIndex)
+ execution.setVariable('nsiServiceInstanceId',sliceInstanceId)
+ execution.setVariable("nsiServiceInstanceName",sliceInstanceName)
+ logger.trace("Exit CreateNSIinAAI in DoAllocateNSIandNSSI()")
+ }
+
+ void getOneNsstInfo(DelegateExecution execution){
+ List<String> nsstModelInfoList = new ArrayList<>()
+ nsstModelInfoList = execution.getVariable("nsstModelInfoList")
+ int currentIndex = execution.getVariable("currentIndex")
+ int maxIndex = execution.getVariable("maxIndex")
+ boolean isMoreNSSTtoProcess = true
+ String nsstServiceModelInfo = nsstModelInfoList.get(currentIndex)
+ execution.setVariable("serviceModelInfo", nsstServiceModelInfo)
+ execution.setVariable("currentIndex", currentIndex)
+ currentIndex = currentIndex+1
+ if(currentIndex <= maxIndex )
+ isMoreNSSTtoProcess = false
+ execution.setVariable("isMoreNSSTtoProcess", isMoreNSSTtoProcess)
+ }
+
+ void createNSSTMap(DelegateExecution execution){
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ String modelUuid= serviceDecomposition.getModelInfo().getModelUuid()
+ String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent()
+ //String nsstID = jsonUtil.getJsonValue(content, "metadata.id")
+ //String vendor = jsonUtil.getJsonValue(content, "metadata.vendor")
+ //String type = jsonUtil.getJsonValue(content, "metadata.type")
+ String domain = jsonUtil.getJsonValue(content, "metadata.domainType")
+
+ Map<String, Object> nssiMap = execution.getVariable("nssiMap")
+ String servicename = execution.getVariable("serviceInstanceName")
+ String nsiname = "nsi_"+servicename
+ nssiMap.put(domain,"""{
+ "serviceInstanceId":"",
+ "modelUuid":"${modelUuid}"
+ }""")
+ execution.setVariable("nssiMap",nssiMap)
+ }
+
+ void prepareNSSIList(DelegateExecution execution){
+ logger.trace("Enter prepareNSSIList in DoAllocateNSIandNSSI()")
+ Map<String, Object> nssiMap = new HashMap<>()
+ Boolean isMoreNSSI = false
+ nssiMap = execution.getVariable("nssiMap")
+ List<String> keys=new ArrayList<String>(nssiMap.values())
+ List<String> nsstSequence = execution.getVariable("nsstSequence")
+ Integer currentIndex=0;
+ execution.setVariable("currentNssiIndex",currentIndex)
+ Integer maxIndex=keys.size()
+ execution.setVariable("maxIndex",maxIndex)
+ if(maxIndex>0)
+ isMoreNSSI=true
+ execution.setVariable("isMoreNSSI",isMoreNSSI)
+ logger.trace("Exit prepareNSSIList in DoAllocateNSIandNSSI()")
+ }
+
+
+ void getOneNSSIInfo(DelegateExecution execution){
+ logger.trace("Enter getOneNSSIInfo in DoAllocateNSIandNSSI()")
+
+ //ServiceDecomposition serviceDecompositionObj = execution.getVariable("serviceDecompositionObj")
+ Map<String, Object> nssiMap=execution.getVariable("nssiMap")
+ List<String> nsstSequence = execution.getVariable("nsstSequence")
+ String currentNSST= nsstSequence.get(execution.getVariable("currentNssiIndex"))
+ boolean isNSSIOptionAvailable = false
+ String nsstInput=nssiMap.get(currentNSST)
+ execution.setVariable("nsstInput",nsstInput)
+ String modelUuid = jsonUtil.getJsonValue(nsstInput, "modelUuid")
+ String nssiInstanceId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId")
+ String nssiserviceModelInfo = """{
+ "modelInvariantUuid":"",
+ "modelUuid":"${modelUuid}",
+ "modelVersion":""
+ }"""
+ Integer currentIndex = execution.getVariable("currentNssiIndex")
+ currentIndex=currentIndex+1;
+ execution.setVariable("currentNssiIndex",currentIndex)
+ execution.setVariable("nssiserviceModelInfo",nssiserviceModelInfo)
+ execution.setVariable("nssiInstanceId",nssiInstanceId)
+ logger.trace("Exit getOneNSSIInfo in DoAllocateNSIandNSSI()")
+ }
+
+ void updateCurrentIndex(DelegateExecution execution){
+
+ logger.trace("Enter updateCurrentIndex in DoAllocateNSIandNSSI()")
+ Integer currentIndex = execution.getVariable("currentNssiIndex")
+ Integer maxIndex = execution.getVariable("maxIndex")
+ if(currentIndex>=maxIndex)
+ {
+ Boolean isMoreNSSI=false
+ execution.setVariable("isMoreNSSI",isMoreNSSI)
+ }
+ logger.trace("Exit updateCurrentIndex in DoAllocateNSIandNSSI()")
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
new file mode 100644
index 0000000000..d786cb0ba1
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
@@ -0,0 +1,771 @@
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aai.domain.yang.SliceProfile
+import org.onap.logging.filter.base.ONAPComponents
+import org.onap.so.beans.nsmf.AllocateAnNssi
+import org.onap.so.beans.nsmf.AllocateCnNssi
+import org.onap.so.beans.nsmf.AllocateTnNssi
+import org.onap.so.beans.nsmf.AnSliceProfile
+import org.onap.so.beans.nsmf.CnSliceProfile
+import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.beans.nsmf.JobStatusRequest
+import org.onap.so.beans.nsmf.NetworkType
+import org.onap.so.beans.nsmf.NsiInfo
+import org.onap.so.beans.nsmf.NssiAllocateRequest
+import org.onap.so.beans.nsmf.PerfReq
+import org.onap.so.beans.nsmf.PerfReqEmbbList
+import org.onap.so.beans.nsmf.PerfReqUrllcList
+import org.onap.so.beans.nsmf.ResourceSharingLevel
+import org.onap.so.beans.nsmf.ServiceProfile
+import org.onap.so.beans.nsmf.SliceTaskParams
+import org.onap.so.beans.nsmf.TnSliceProfile
+import org.onap.so.beans.nsmf.UeMobilityLevel
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.core.RollbackData
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.domain.ModelInfo
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.AAIEdgeLabel
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import com.fasterxml.jackson.databind.ObjectMapper;
+import javax.ws.rs.core.Response
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+
+class DoAllocateNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor{
+
+ private static final Logger logger = LoggerFactory.getLogger( DoAllocateNSSI.class);
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ JsonUtils jsonUtil = new JsonUtils()
+
+ /**
+ * Pre Process the BPMN Flow Request
+ * Inclouds:
+ * generate the nsOperationKey
+ * generate the nsParameters
+ */
+ void preProcessRequest (DelegateExecution execution) {
+ logger.trace("Enter preProcessRequest()")
+ String msg = ""
+ String nssmfOperation = ""
+ String msoRequestId = execution.getVariable("msoRequestId")
+ String nsstInput = execution.getVariable("nsstInput")
+ String modelUuid = jsonUtil.getJsonValue(nsstInput, "modelUuid")
+ //modelUuid="2763777c-27bd-4df7-93b8-c690e23f4d3f"
+ String nssiInstanceId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId")
+ String serviceModelInfo = """{
+ "modelInvariantUuid":"",
+ "modelUuid":"${modelUuid}",
+ "modelVersion":""
+ }"""
+ execution.setVariable("serviceModelInfo",serviceModelInfo)
+ execution.setVariable("nssiInstanceId",nssiInstanceId)
+ String nssiProfileID = UUID.randomUUID().toString()
+ execution.setVariable("nssiProfileID",nssiProfileID)
+ if(isBlank(nssiInstanceId))
+ {
+ nssmfOperation="create"
+ nssiInstanceId = UUID.randomUUID().toString()
+ }else {
+ nssmfOperation = "update"
+ }
+ execution.setVariable("nssmfOperation",nssmfOperation)
+ execution.setVariable("nssiInstanceId",nssiInstanceId)
+
+ def isDebugLogEnabled ="false"
+ def isNSSICreated = false
+ execution.setVariable("isNSSICreated",isNSSICreated)
+
+ int currentCycle = 0
+ execution.setVariable("currentCycle", currentCycle)
+
+ logger.trace("Exit preProcessRequest")
+ }
+
+
+ void getNSSTInfo(DelegateExecution execution){
+ logger.trace("Enter getNSSTInfo in DoAllocateNSSI()")
+ ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
+ ModelInfo modelInfo = serviceDecomposition.getModelInfo()
+ String serviceRole = "nssi"
+ String nssiServiceInvariantUuid = serviceDecomposition.modelInfo.getModelInvariantUuid()
+ String nssiServiceUuid = serviceDecomposition.modelInfo.getModelUuid()
+ String nssiServiceType = serviceDecomposition.getServiceType()
+ String uuiRequest = execution.getVariable("uuiRequest")
+ String nssiServiceName = "nssi_"+jsonUtil.getJsonValue(uuiRequest, "service.name")
+ execution.setVariable("nssiServiceName",nssiServiceName)
+ execution.setVariable("nssiServiceType",nssiServiceType)
+ execution.setVariable("nssiServiceInvariantUuid",nssiServiceInvariantUuid)
+ execution.setVariable("nssiServiceUuid",nssiServiceUuid)
+ execution.setVariable("serviceRole",serviceRole)
+
+ String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent()
+ String nsstID = jsonUtil.getJsonValue(content, "metadata.id")
+ String nsstVendor = jsonUtil.getJsonValue(content, "metadata.vendor")
+ String nsstDomain = jsonUtil.getJsonValue(content, "metadata.domainType")
+ String nsstType = jsonUtil.getJsonValue(content, "metadata.type")
+
+ execution.setVariable("nsstID",nsstID)
+ execution.setVariable("nsstVendor",nsstVendor)
+ execution.setVariable("nsstDomain",nsstDomain)
+ execution.setVariable("nssiServiceUuid",nssiServiceUuid)
+ execution.setVariable("nsstType",nsstType)
+
+ String nsstContentInfo = """{
+ "NsstID":"${nsstID}",
+ "Vendor":"${nsstVendor}",
+ "type":"${nsstType}"
+ }"""
+
+ logger.trace("Exit getNSSTInfo in DoAllocateNSSI()")
+ }
+
+ void timeDelay(DelegateExecution execution) {
+ logger.trace("Enter timeDelay in DoAllocateNSSI()")
+ try {
+ Thread.sleep(60000);
+ int currentCycle = execution.getVariable("currentCycle")
+ currentCycle=currentCycle+1
+ if(currentCycle>60)
+ {
+ logger.trace("Completed all the retry times... but still nssmf havent completed the creation process...")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "NSSMF creation didnt complete by time...")
+ }
+ execution.setVariable("currentCycle",currentCycle)
+ } catch(InterruptedException e) {
+ logger.info("Time Delay exception" + e)
+ }
+ logger.trace("Exit timeDelay in DoAllocateNSSI()")
+ }
+
+
+ void sendUpdateRequestNSSMF(DelegateExecution execution) {
+ logger.trace("Enter sendUpdateRequestNSSMF in DoAllocateNSSI()")
+ String urlString = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution)
+ logger.debug( "get NSSMF: " + urlString)
+
+ //Prepare auth for NSSMF - Begin
+ def authHeader = ""
+ String basicAuth = UrnPropertiesReader.getVariable("mso.nssmf.auth", execution)
+ String domain = execution.getVariable("nsstDomain")
+ String nssmfRequest = buildUpdateNSSMFRequest(execution, domain.toUpperCase())
+
+ //send request to update NSSI option - Begin
+ URL url = new URL(urlString+"/api/rest/provMns/v1/NSS/SliceProfiles")
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL)
+ Response httpResponse = httpClient.post(nssmfRequest)
+
+ int responseCode = httpResponse.getStatus()
+ logger.debug("NSSMF sync response code is: " + responseCode)
+
+ if(responseCode < 199 && responseCode > 299){
+ String nssmfResponse ="NSSMF response have nobody"
+ if(httpResponse.hasEntity())
+ nssmfResponse = httpResponse.readEntity(String.class)
+ logger.trace("received error message from NSSMF : "+nssmfResponse)
+ logger.trace("Exit sendCreateRequestNSSMF in DoAllocateNSSI()")
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.")
+ }
+
+ if(httpResponse.hasEntity()){
+ String nssmfResponse = httpResponse.readEntity(String.class)
+ execution.setVariable("nssmfResponse", nssmfResponse)
+ String nssiId = jsonUtil.getJsonValue(nssmfResponse, "nssiId")
+ String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+ execution.setVariable("nssiId",nssiId)
+ execution.setVariable("jobId",jobId)
+ }else{
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.")
+ }
+ logger.trace("Exit sendUpdateRequestNSSMF in DoAllocateNSSI()")
+ }
+
+ void sendCreateRequestNSSMF(DelegateExecution execution) {
+ logger.trace("Enter sendCreateRequestNSSMF in DoAllocateNSSI()")
+ String urlString = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution)
+ logger.debug( "get NSSMF: " + urlString)
+
+ //Prepare auth for NSSMF - Begin
+ String domain = execution.getVariable("nsstDomain")
+ String nssmfRequest = buildCreateNSSMFRequest(execution, domain.toUpperCase())
+
+ //send request to get NSI option - Begin
+ URL url = new URL(urlString+"/api/rest/provMns/v1/NSS/SliceProfiles")
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL)
+ Response httpResponse = httpClient.post(nssmfRequest)
+
+ int responseCode = httpResponse.getStatus()
+ logger.debug("NSSMF sync response code is: " + responseCode)
+
+ if(responseCode < 199 || responseCode > 299 ){
+ String nssmfResponse ="NSSMF response have nobody"
+ if(httpResponse.hasEntity())
+ nssmfResponse = httpResponse.readEntity(String.class)
+ logger.trace("received error message from NSSMF : "+nssmfResponse)
+ logger.trace("Exit sendCreateRequestNSSMF in DoAllocateNSSI()")
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.")
+ }
+
+ if(httpResponse.hasEntity()){
+ String nssmfResponse = httpResponse.readEntity(String.class)
+ execution.setVariable("nssmfResponse", nssmfResponse)
+ String nssiId = jsonUtil.getJsonValue(nssmfResponse, "nssiId")
+ String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
+ execution.setVariable("nssiId",nssiId)
+ execution.setVariable("jobId",jobId)
+ }else{
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.")
+ }
+ logger.trace("Exit sendCreateRequestNSSMF in DoAllocateNSSI()")
+
+ }
+
+ void getNSSMFProgresss(DelegateExecution execution) {
+ logger.trace("Enter getNSSMFProgresss in DoAllocateNSSI()")
+
+ String endpoint = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution)
+ logger.debug( "get NSSMF: " + endpoint)
+
+ //Prepare auth for NSSMF - Begin
+ def authHeader = ""
+ String basicAuth = UrnPropertiesReader.getVariable("mso.nssmf.auth", execution)
+
+ String nssmfRequest = buildNSSMFProgressRequest(execution)
+ String strUrl="/api/rest/provMns/v1/NSS/jobs/"+execution.getVariable("jobId")
+ //send request to update NSSI option - Begin
+ URL url = new URL(endpoint+strUrl)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL)
+ Response httpResponse = httpClient.post(nssmfRequest)
+
+ int responseCode = httpResponse.getStatus()
+ logger.debug("NSSMF sync response code is: " + responseCode)
+
+ if(responseCode < 199 || responseCode > 299){
+ String nssmfResponse ="NSSMF response have nobody"
+ if(httpResponse.hasEntity())
+ nssmfResponse = httpResponse.readEntity(String.class)
+ logger.trace("received error message from NSSMF : "+nssmfResponse)
+ logger.trace("Exit sendCreateRequestNSSMF in DoAllocateNSSI()")
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.")
+ }
+
+ if(httpResponse.hasEntity()){
+ String nssmfResponse = httpResponse.readEntity(String.class)
+ Boolean isNSSICreated = false
+ execution.setVariable("nssmfResponse", nssmfResponse)
+ Integer progress = java.lang.Integer.parseInt(jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.progress"))
+ String status = jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.status")
+ String statusDescription = jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.statusDescription")
+ execution.setVariable("nssmfProgress",progress)
+ execution.setVariable("nssmfStatus",status)
+ execution.setVariable("nddmfStatusDescription",statusDescription)
+ if(progress>99)
+ isNSSICreated = true
+ execution.setVariable("isNSSICreated",isNSSICreated)
+
+ }else{
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.")
+ }
+ logger.trace("Exit getNSSMFProgresss in DoAllocateNSSI()")
+
+ }
+
+ void updateRelationship(DelegateExecution execution) {
+ logger.trace("Enter updateRelationship in DoAllocateNSSI()")
+ String nssiInstanceId = execution.getVariable("nssiInstanceId")
+ String nsiInstanceId = execution.getVariable("nsiServiceInstanceId")
+ try{
+ AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nsiInstanceId);
+ AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiInstanceId)
+ getAAIClient().connect(nsiServiceuri, nssiServiceUri, AAIEdgeLabel.COMPOSED_OF);
+ }catch(Exception ex) {
+ String msg = "Exception in DoAllocateNSSI InstantiateNSSI service while creating relationship " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.trace("Exit updateRelationship in DoAllocateNSSI()")
+ }
+
+
+ void instantiateNSSIService(DelegateExecution execution) {
+ logger.trace("Enter instantiateNSSIService in DoAllocateNSSI()")
+ //String nssiInstanceId = execution.getVariable("nssiInstanceId")
+ String nssiInstanceId = execution.getVariable("nssiId")
+ execution.setVariable("nssiInstanceId",nssiInstanceId)
+ String sliceInstanceId = execution.getVariable("nsiServiceInstanceId")
+ try {
+ org.onap.aai.domain.yang.ServiceInstance nssi = new ServiceInstance();
+ Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile")
+
+ nssi.setServiceInstanceId(nssiInstanceId)
+ nssi.setServiceInstanceName(execution.getVariable("nssiServiceName"))
+ //nssi.setServiceType(execution.getVariable("nssiServiceType"))
+ nssi.setServiceType(serviceProfileMap.get("sST").toString())
+ String serviceStatus = "deactivated"
+ nssi.setOrchestrationStatus(serviceStatus)
+ String modelInvariantUuid = execution.getVariable("nssiServiceInvariantUuid")
+ String modelUuid = execution.getVariable("nssiServiceUuid")
+ nssi.setModelInvariantId(modelInvariantUuid)
+ nssi.setModelVersionId(modelUuid)
+ String uuiRequest = execution.getVariable("uuiRequest")
+ String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList")
+ nssi.setServiceInstanceLocationId(serviceInstanceLocationid)
+ //String snssai = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.sNSSAI")
+ String envContext=execution.getVariable("nsstDomain")
+ nssi.setEnvironmentContext(envContext)
+ nssi.setServiceRole(execution.getVariable("serviceRole"))
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), nssiInstanceId)
+ client.create(uri, nssi)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ try{
+ AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, sliceInstanceId);
+ AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiInstanceId)
+ getAAIClient().connect(nsiServiceuri, nssiServiceUri, AAIEdgeLabel.COMPOSED_OF);
+ }catch(Exception ex) {
+ String msg = "Exception in DoAllocateNSSI InstantiateNSSI service while creating relationship " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+
+
+ def rollbackData = execution.getVariable("RollbackData")
+ if (rollbackData == null) {
+ rollbackData = new RollbackData();
+ }
+ //rollbackData.put("SERVICEINSTANCE", "disableRollback", idisableRollback.toStrng())
+ rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
+ rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", nssiInstanceId)
+ rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
+ rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
+ execution.setVariable("rollbackData", rollbackData)
+ execution.setVariable("RollbackData", rollbackData)
+ logger.debug("RollbackData:" + rollbackData)
+ logger.trace("Exit instantiateNSSIService in DoAllocateNSSI()")
+ }
+
+
+ void createSliceProfile(DelegateExecution execution) {
+ logger.trace("Enter createSliceProfile in DoAllocateNSSI()")
+ String sliceserviceInstanceId = execution.getVariable("nssiInstanceId")
+ String nssiProfileID = execution.getVariable("nssiProfileID")
+ Map<String, Object> sliceProfileMap = execution.getVariable("sliceProfileCn")
+ Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile")
+ SliceProfile sliceProfile = new SliceProfile()
+ sliceProfile.setServiceAreaDimension("")
+ sliceProfile.setPayloadSize(0)
+ sliceProfile.setJitter(0)
+ sliceProfile.setSurvivalTime(0)
+ //sliceProfile.setCsAvailability()
+ //sliceProfile.setReliability()
+ sliceProfile.setExpDataRate(0)
+ sliceProfile.setTrafficDensity(0)
+ sliceProfile.setConnDensity(0)
+ sliceProfile.setExpDataRateUL(Integer.parseInt(sliceProfileMap.get("expDataRateUL").toString()))
+ sliceProfile.setExpDataRateDL(Integer.parseInt(sliceProfileMap.get("expDataRateDL").toString()))
+ sliceProfile.setActivityFactor(Integer.parseInt(sliceProfileMap.get("activityFactor").toString()))
+ sliceProfile.setResourceSharingLevel(sliceProfileMap.get("activityFactor").toString())
+ sliceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString())
+ sliceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString())
+ sliceProfile.setMaxNumberOfUEs(Integer.parseInt(sliceProfileMap.get("activityFactor").toString()))
+ sliceProfile.setLatency(Integer.parseInt(sliceProfileMap.get("latency").toString()))
+ sliceProfile.setProfileId(nssiProfileID)
+ sliceProfile.setE2ELatency(0)
+
+ try {
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE,
+ execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, nssiProfileID)
+ client.create(uri, sliceProfile)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ def rollbackData = execution.getVariable("RollbackData")
+ if (rollbackData == null) {
+ rollbackData = new RollbackData();
+ }
+ //rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
+ rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
+ rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", sliceserviceInstanceId)
+ rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("serviceType"))
+ rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
+ execution.setVariable("rollbackData", rollbackData)
+ execution.setVariable("RollbackData", rollbackData)
+ logger.debug("RollbackData:" + rollbackData)
+ logger.trace("Exit createSliceProfile in DoAllocateNSSI()")
+ }
+
+
+ String buildCreateNSSMFRequest(DelegateExecution execution, String domain) {
+
+ NssiAllocateRequest request = new NssiAllocateRequest()
+ String strRequest = ""
+ //String uuiRequest = execution.getVariable("uuiRequest")
+ SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+
+ switch (domain) {
+ case "AN":
+ EsrInfo esrInfo = new EsrInfo()
+ esrInfo.setNetworkType(execution.getVariable("networkType"))
+ esrInfo.setVendor(execution.getVariable("nsstVendor"))
+
+ NsiInfo nsiInfo = new NsiInfo()
+ nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
+ nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
+
+ AnSliceProfile anSliceProfile = new AnSliceProfile()
+ anSliceProfile.setLatency(execution.getVariable("latency"))
+ anSliceProfile.setCoverageAreaTAList(execution.getVariable("coverageAreaList"))
+ anSliceProfile.setQi(execution.getVariable("qi"))
+
+ AllocateAnNssi allocateAnNssi = new AllocateAnNssi()
+ allocateAnNssi.setNsstId(execution.getVariable("nsstId"))
+ allocateAnNssi.setNssiName(execution.getVariable("nssiName"))
+ allocateAnNssi.setNsiInfo(nsiInfo)
+ allocateAnNssi.setSliceProfile(anSliceProfile)
+ String anScriptName = sliceTaskParams.getAnScriptName()
+ allocateAnNssi.setScriptName(anScriptName)
+
+ request.setAllocateAnNssi(allocateAnNssi)
+ request.setEsrInfo(esrInfo)
+ break;
+ case "CN":
+ Map<String, Object> sliceProfileCn =execution.getVariable("sliceProfileCn")
+ Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
+ NsiInfo nsiInfo = new NsiInfo()
+ nsiInfo.setNsiId(execution.getVariable("nsiServiceInstanceId"))
+ nsiInfo.setNsiName(execution.getVariable("nsiServiceInstanceName"))
+
+ EsrInfo esrInfo = new EsrInfo()
+ esrInfo.setNetworkType(NetworkType.fromString(domain))
+ esrInfo.setVendor(execution.getVariable("nsstVendor"))
+ execution.setVariable("esrInfo",esrInfo)
+
+
+ PerfReqEmbbList perfReqEmbb = new PerfReqEmbbList()
+ perfReqEmbb.setActivityFactor(sliceProfileCn.get("activityFactor"))
+ perfReqEmbb.setAreaTrafficCapDL(sliceProfileCn.get("areaTrafficCapDL"))
+ perfReqEmbb.setAreaTrafficCapUL(sliceProfileCn.get("areaTrafficCapUL"))
+ perfReqEmbb.setExpDataRateDL(sliceProfileCn.get("expDataRateDL"))
+ perfReqEmbb.setExpDataRateUL(sliceProfileCn.get("expDataRateUL"))
+
+ List<PerfReqEmbbList> listPerfReqEmbbList = new ArrayList<>()
+ listPerfReqEmbbList.add(perfReqEmbb)
+
+ PerfReq perfReq = new PerfReq()
+ perfReq.setPerfReqEmbbList(listPerfReqEmbbList)
+
+ PerfReqUrllcList perfReqUrllc = new PerfReqUrllcList()
+ perfReqUrllc.setConnDensity(0)
+ perfReqUrllc.setTrafficDensity(0)
+ perfReqUrllc.setExpDataRate(0)
+ perfReqUrllc.setReliability(0)
+ perfReqUrllc.setCsAvailability(0)
+ perfReqUrllc.setSurvivalTime(0)
+ perfReqUrllc.setJitter(0)
+ perfReqUrllc.setE2eLatency(0)
+ perfReqUrllc.setPayloadSize("0")
+ perfReqUrllc.setServiceAreaDimension("")
+
+ List<PerfReqUrllcList> perfReqUrllcList = new ArrayList<>()
+ perfReqUrllcList.add(perfReqUrllc)
+ perfReq.setPerfReqUrllcList(perfReqUrllcList)
+
+ CnSliceProfile cnSliceProfile = new CnSliceProfile()
+ cnSliceProfile.setSliceProfileId(execution.getVariable("nssiProfileID"))
+ String plmnStr = serviceProfile.get("plmnIdList")
+ List<String> plmnIdList=Arrays.asList(plmnStr.split("\\|"))
+ cnSliceProfile.setPlmnIdList(plmnIdList)
+
+ String resourceSharingLevel = serviceProfile.get("resourceSharingLevel").toString()
+ cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(resourceSharingLevel))
+
+ String coverageArea = serviceProfile.get("coverageAreaTAList")
+ List<String> coverageAreaList=Arrays.asList(coverageArea.split("\\|"))
+ cnSliceProfile.setCoverageAreaTAList(coverageAreaList)
+
+ String ueMobilityLevel = serviceProfile.get("uEMobilityLevel").toString()
+ cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(ueMobilityLevel))
+
+ int latency = serviceProfile.get("latency")
+ cnSliceProfile.setLatency(latency)
+
+ int maxUE = serviceProfile.get("maxNumberofUEs")
+ cnSliceProfile.setMaxNumberofUEs(maxUE)
+
+ String snssai = serviceProfile.get("sNSSAI")
+ List<String> snssaiList = Arrays.asList(snssai.split("\\|"))
+ cnSliceProfile.setSnssaiList(snssaiList)
+
+ cnSliceProfile.setPerfReq(perfReq)
+
+ AllocateCnNssi allocateCnNssi = new AllocateCnNssi()
+ allocateCnNssi.setNsstId(execution.getVariable("nsstid"))
+ allocateCnNssi.setNssiName(execution.getVariable("nssiName"))
+ allocateCnNssi.setSliceProfile(cnSliceProfile)
+ allocateCnNssi.setNsiInfo(nsiInfo)
+ String cnScriptName = sliceTaskParams.getCnScriptName()
+ allocateCnNssi.setScriptName(cnScriptName)
+ request.setAllocateCnNssi(allocateCnNssi)
+ request.setEsrInfo(esrInfo)
+ break;
+ case "TN":
+ EsrInfo esrInfo = new EsrInfo()
+ esrInfo.setNetworkType(execution.getVariable("networkType"))
+ esrInfo.setVendor(execution.getVariable("vendor"))
+
+ TnSliceProfile tnSliceProfile = new TnSliceProfile()
+ tnSliceProfile.setLatency(execution.getVariable("latency"))
+ tnSliceProfile.setBandwidth(execution.getVariable("bandWidth"))
+
+ NsiInfo nsiInfo = new NsiInfo()
+ nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
+ nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
+
+ AllocateTnNssi allocateTnNssi = new AllocateTnNssi()
+ allocateTnNssi.setSliceProfile(tnSliceProfile)
+ allocateTnNssi.setNsiInfo(nsiInfo)
+ allocateTnNssi.setNsstId(execution.getVariable("nsstid"))
+ String tnScriptName = sliceTaskParams.getTnScriptName()
+ allocateTnNssi.setScriptName(tnScriptName)
+
+ request.setAllocateTnNssi(allocateTnNssi)
+ request.setEsrInfo(esrInfo)
+ break;
+ default:
+ break;
+ }
+ try {
+ strRequest = MAPPER.writeValueAsString(request);
+ } catch (IOException e) {
+ logger.error("Invalid get progress request bean to convert as string");
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string")
+ }
+ return strRequest
+ }
+
+
+ String buildUpdateNSSMFRequest(DelegateExecution execution, String domain) {
+ NssiAllocateRequest request = new NssiAllocateRequest()
+ String nsstInput = execution.getVariable("nsstInput")
+ String nssiId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId")
+ String strRequest = ""
+ SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+ switch (domain) {
+ case "AN":
+ EsrInfo esrInfo = new EsrInfo()
+ esrInfo.setNetworkType(execution.getVariable("nsstType"))
+ esrInfo.setVendor(execution.getVariable("vendor"))
+
+ NsiInfo nsiInfo = new NsiInfo()
+ nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
+ nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
+
+ AnSliceProfile anSliceProfile = new AnSliceProfile()
+ anSliceProfile.setLatency(execution.getVariable("latency"))
+ anSliceProfile.setCoverageAreaTAList(execution.getVariable("coverageAreaList"))
+ anSliceProfile.setQi(execution.getVariable("qi"))
+
+ AllocateAnNssi allocateAnNssi = new AllocateAnNssi()
+ allocateAnNssi.setNsstId(execution.getVariable("nsstId"))
+ allocateAnNssi.setNssiName(execution.getVariable("nssiName"))
+ allocateAnNssi.setNsiInfo(nsiInfo)
+ allocateAnNssi.setSliceProfile(anSliceProfile)
+ String anScriptName = sliceTaskParams.getAnScriptName()
+ allocateAnNssi.setScriptName(anScriptName)
+ request.setAllocateAnNssi(allocateAnNssi)
+ request.setEsrInfo(esrInfo)
+ break;
+ case "CN":
+ Map<String, Object> sliceProfileCn =execution.getVariable("sliceProfileCn")
+ Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
+ NsiInfo nsiInfo = new NsiInfo()
+ nsiInfo.setNsiId(execution.getVariable("nsiServiceInstanceId"))
+ nsiInfo.setNsiName(execution.getVariable("nsiServiceInstanceName"))
+
+ EsrInfo esrInfo = new EsrInfo()
+ esrInfo.setNetworkType(NetworkType.fromString(domain))
+ esrInfo.setVendor(execution.getVariable("nsstVendor"))
+ execution.setVariable("esrInfo",esrInfo)
+
+
+ PerfReqEmbbList perfReqEmbb = new PerfReqEmbbList()
+ perfReqEmbb.setActivityFactor(sliceProfileCn.get("activityFactor"))
+ perfReqEmbb.setAreaTrafficCapDL(sliceProfileCn.get("areaTrafficCapDL"))
+ perfReqEmbb.setAreaTrafficCapUL(sliceProfileCn.get("areaTrafficCapUL"))
+ perfReqEmbb.setExpDataRateDL(sliceProfileCn.get("expDataRateDL"))
+ perfReqEmbb.setExpDataRateUL(sliceProfileCn.get("expDataRateUL"))
+
+ List<PerfReqEmbbList> listPerfReqEmbbList = new ArrayList<>()
+ listPerfReqEmbbList.add(perfReqEmbb)
+
+ PerfReq perfReq = new PerfReq()
+ perfReq.setPerfReqEmbbList(listPerfReqEmbbList)
+
+ PerfReqUrllcList perfReqUrllc = new PerfReqUrllcList()
+ perfReqUrllc.setConnDensity(0)
+ perfReqUrllc.setTrafficDensity(0)
+ perfReqUrllc.setExpDataRate(0)
+ perfReqUrllc.setReliability(0)
+ perfReqUrllc.setCsAvailability(0)
+ perfReqUrllc.setSurvivalTime(0)
+ perfReqUrllc.setJitter(0)
+ perfReqUrllc.setE2eLatency(0)
+ perfReqUrllc.setPayloadSize("0")
+ perfReqUrllc.setServiceAreaDimension("")
+
+ List<PerfReqUrllcList> perfReqUrllcList = new ArrayList<>()
+ perfReqUrllcList.add(perfReqUrllc)
+ perfReq.setPerfReqUrllcList(perfReqUrllcList)
+
+ CnSliceProfile cnSliceProfile = new CnSliceProfile()
+ cnSliceProfile.setSliceProfileId(execution.getVariable("nssiProfileID"))
+ String plmnStr = serviceProfile.get("plmnIdList")
+ List<String> plmnIdList=Arrays.asList(plmnStr.split("\\|"))
+ cnSliceProfile.setPlmnIdList(plmnIdList)
+
+ String resourceSharingLevel = serviceProfile.get("resourceSharingLevel").toString()
+ cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(resourceSharingLevel))
+
+ String coverageArea = serviceProfile.get("coverageAreaTAList")
+ List<String> coverageAreaList=Arrays.asList(coverageArea.split("\\|"))
+ cnSliceProfile.setCoverageAreaTAList(coverageAreaList)
+
+ String ueMobilityLevel = serviceProfile.get("uEMobilityLevel").toString()
+ cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(ueMobilityLevel))
+
+ int latency = serviceProfile.get("latency")
+ cnSliceProfile.setLatency(latency)
+
+ int maxUE = serviceProfile.get("maxNumberofUEs")
+ cnSliceProfile.setMaxNumberofUEs(maxUE)
+
+ String snssai = serviceProfile.get("sNSSAI")
+ List<String> snssaiList = Arrays.asList(snssai.split("\\|"))
+ cnSliceProfile.setSnssaiList(snssaiList)
+
+ cnSliceProfile.setPerfReq(perfReq)
+
+ AllocateCnNssi allocateCnNssi = new AllocateCnNssi()
+ allocateCnNssi.setNsstId(execution.getVariable("nsstid"))
+ allocateCnNssi.setNssiName(execution.getVariable("nssiName"))
+ allocateCnNssi.setSliceProfile(cnSliceProfile)
+ allocateCnNssi.setNsiInfo(nsiInfo)
+ allocateCnNssi.setNssiId(nssiId) // need to check this
+ String cnScriptName = sliceTaskParams.getCnScriptName()
+ allocateCnNssi.setScriptName(cnScriptName)
+ request.setAllocateCnNssi(allocateCnNssi)
+ request.setEsrInfo(esrInfo)
+ break;
+ case "TN":
+ EsrInfo esrInfo = new EsrInfo()
+ esrInfo.setNetworkType(execution.getVariable("networkType"))
+ esrInfo.setVendor(execution.getVariable("vendor"))
+
+ TnSliceProfile tnSliceProfile = new TnSliceProfile()
+ tnSliceProfile.setLatency(execution.getVariable("latency"))
+ tnSliceProfile.setBandwidth(execution.getVariable("bandWidth"))
+
+ NsiInfo nsiInfo = new NsiInfo()
+ nsiInfo.setNsiId(execution.getVariable("nsiInstanceID"))
+ nsiInfo.setNsiName(execution.getVariable("nsiInstanceName"))
+
+ AllocateTnNssi allocateTnNssi = new AllocateTnNssi()
+ allocateTnNssi.setSliceProfile(tnSliceProfile)
+ allocateTnNssi.setNsiInfo(nsiInfo)
+ allocateTnNssi.setNsstId(execution.getVariable("nsstid"))
+ String tnScriptName = sliceTaskParams.getTnScriptName()
+ allocateTnNssi.setScriptName(tnScriptName)
+ request.setAllocateTnNssi(allocateTnNssi)
+ request.setEsrInfo(esrInfo)
+ break;
+ default:
+ break;
+ }
+ try {
+ strRequest = MAPPER.writeValueAsString(request);
+ } catch (IOException e) {
+ logger.error("Invalid get progress request bean to convert as string");
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string")
+ }
+ return strRequest
+ }
+
+ String buildNSSMFProgressRequest(DelegateExecution execution){
+ JobStatusRequest request = new JobStatusRequest()
+ String strRequest = ""
+ EsrInfo esrInfo = execution.getVariable("esrInfo")
+ request.setNsiId(execution.getVariable("nsiServiceInstanceId"))
+ request.setNssiId(execution.getVariable("nssiId"))
+ request.setEsrInfo(esrInfo)
+
+ try {
+ strRequest = MAPPER.writeValueAsString(request);
+ } catch (IOException e) {
+ logger.error("Invalid get progress request bean to convert as string");
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string")
+ }
+ return strRequest
+ }
+
+ public void prepareUpdateOrchestrationTask(DelegateExecution execution) {
+ logger.debug("Start prepareUpdateOrchestrationTask progress")
+ String requestMethod = "PUT"
+ String progress = execution.getVariable("nssmfProgress")
+ String status = execution.getVariable("nssmfStatus")
+ String statusDescription=execution.getVariable("nddmfStatusDescription")
+ SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+ String domain = execution.getVariable("nsstDomain")
+ switch (domain.toUpperCase()) {
+ case "AN":
+ sliceTaskParams.setAnProgress(progress)
+ sliceTaskParams.setAnStatus(status)
+ sliceTaskParams.setAnStatusDescription(statusDescription)
+ break;
+ case "CN":
+ sliceTaskParams.setCnProgress(progress)
+ sliceTaskParams.setCnStatus(status)
+ sliceTaskParams.setCnStatusDescription(statusDescription)
+ break;
+ case "TN":
+ sliceTaskParams.setTnProgress(progress)
+ sliceTaskParams.setTnStatus(status)
+ sliceTaskParams.setTnStatusDescription(statusDescription)
+ break;
+ default:
+ break;
+ }
+ String paramJson = sliceTaskParams.convertToJson()
+ execution.setVariable("CSSOT_paramJson", paramJson)
+ execution.setVariable("CSSOT_requestMethod", requestMethod)
+ logger.debug("Finish prepareUpdateOrchestrationTask progress")
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy
new file mode 100644
index 0000000000..fb4bd158b7
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy
@@ -0,0 +1,210 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.CommunicationServiceProfile
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+/**
+ * This groovy class supports the <class>DoCreateCommunicationService.bpmn</class> process.
+ * AlaCarte flow for 1702 ServiceInstance Create
+ *
+ */
+class DoCreateCommunicationService extends AbstractServiceTaskProcessor{
+ String Prefix="DCCS_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ AAIResourcesClient client = new AAIResourcesClient()
+
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateCommunicationService.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.trace("start preProcessRequest")
+ execution.setVariable("prefix", Prefix)
+ String msg = ""
+ try {
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ if (isBlank(serviceInstanceId)) {
+ msg = "Input serviceInstanceId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+
+ } catch(BpmnError e) {
+ throw e
+ } catch(Exception ex) {
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.trace("Exit preProcessRequest")
+ }
+
+ /**
+ * create communication service, generate S-NSSAI Id and communication service profile
+ * 1.create communication service profile
+ *
+ */
+ def createCommunicationServiceProfile = { DelegateExecution execution ->
+ logger.trace("createCSandServiceProfile")
+ String msg = ""
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+ try {
+ // String sNSSAI_id = execution.getVariable("sNSSAI_id")
+ // create communication service profile
+ String profileId = UUID.randomUUID().toString()
+ execution.setVariable("communicationProfileId", profileId)
+
+ def csInputMap = execution.getVariable("csInputMap") as Map<String, ?>
+ Integer latency = csInputMap.get("latency") as Integer
+ Integer maxNumberOfUEs = csInputMap.get("maxNumberofUEs") as Integer
+ Integer expDataRateDL = csInputMap.get("expDataRateDL") as Integer
+ Integer expDataRateUL = csInputMap.get("expDataRateUL") as Integer
+ String coverageArea = csInputMap.get("coverageAreaTAList")
+ String uEMobilityLevel = csInputMap.get("uEMobilityLevel")
+ String resourceSharingLevel = csInputMap.get("resourceSharingLevel")
+
+ CommunicationServiceProfile csp = new CommunicationServiceProfile()
+ csp.setProfileId(profileId)
+
+ csp.setLatency(latency)
+ csp.setMaxNumberOfUEs(maxNumberOfUEs)
+ csp.setUeMobilityLevel(uEMobilityLevel)
+ csp.setResourceSharingLevel(resourceSharingLevel)
+ csp.setExpDataRateDL(expDataRateDL)
+ csp.setExpDataRateUL(expDataRateUL)
+ csp.setCoverageAreaList(coverageArea)
+
+ execution.setVariable("communicationServiceInstanceProfile", csp)
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE,
+ globalSubscriberId,
+ subscriptionServiceType,
+ serviceInstanceId,
+ profileId
+ )
+ client.create(uri, csp)
+
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in createCSandServiceProfile " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.trace("exit createCSandServiceProfile")
+ }
+
+
+ /**
+ * create communication service, generate S-NSSAI Id
+ * 1.generate S-NSSAI Id
+ * 2.create communication service
+ *
+ */
+ def createCommunicationService = { DelegateExecution execution ->
+ logger.trace("create communication service")
+ String msg
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ try {
+ //generate S-NSSAI Id and communication service profile
+ String sNSSAI_id = generateNSSAI(serviceInstanceId)
+
+ execution.setVariable("sNSSAI_id", sNSSAI_id)
+ // 创建service
+ String serviceInstanceName = execution.getVariable("serviceInstanceName")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+ String csServiceType = execution.getVariable("csServiceType")
+ String aaiServiceRole = "communication-service" //待确定
+
+ String oStatus = "processing"
+ String uuiRequest = execution.getVariable("uuiRequest")
+ String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+ String modelUuid = execution.getVariable("modelUuid")
+ String useInterval = execution.getVariable("useInterval")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+
+ // create service
+ ServiceInstance csi = new ServiceInstance()
+ csi.setServiceInstanceName(serviceInstanceName)
+ csi.setServiceType(csServiceType)
+ csi.setServiceRole(aaiServiceRole)
+ csi.setOrchestrationStatus(oStatus)
+ csi.setModelInvariantId(modelInvariantUuid)
+ csi.setModelVersionId(modelUuid)
+ csi.setInputParameters(uuiRequest)
+ csi.setWorkloadContext(useInterval)
+ csi.setEnvironmentContext(sNSSAI_id)
+
+ //timestamp format YYYY-MM-DD hh:mm:ss
+ csi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault()))
+
+ execution.setVariable("communicationServiceInstance", csi)
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, subscriptionServiceType, serviceInstanceId)
+ client.create(uri, csi)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in communication service " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.trace("exit communication service")
+ }
+
+ private static generateNSSAI = { final String instanceId ->
+ int h, res
+ res = (instanceId == null) ? 0 : (h = instanceId.hashCode()) ^ (h >>> 16)
+ res = res >>> 1
+ return "01-" + Integer.toHexString(res).toUpperCase()
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
index 15b91e5221..6af7cc069e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializationFeature
import org.onap.so.logger.LoggingAnchor
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import static org.apache.commons.lang3.StringUtils.*
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
index 22c8a11fae..5c8ece88fe 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
@@ -41,6 +41,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.aai.entities.AAIResultWrapper
@@ -379,7 +380,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
String networkName = utils.getNodeText(networkInputs, "network-name")
AAIResourcesClient client = new AAIResourcesClient()
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName)
L3Networks networks = client.get(uri, NotFoundException.class).asBean(L3Networks.class).get()
L3Network network = networks.getL3Network().get(0)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
index 64d9827c7c..78b8e2d8a7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
@@ -23,7 +23,6 @@
package org.onap.so.bpmn.infrastructure.scripts;
import static org.apache.commons.lang3.StringUtils.*;
-
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.OwningEntity
@@ -44,7 +43,6 @@ import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.uri.AAIResourceUri
-import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -293,7 +291,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
String globalCustomerId = execution.getVariable("globalSubscriberId") //VID to AAI name map
logger.debug(" ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId)
- AAIUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalCustomerId)
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalCustomerId)
if(!getAAIClient().exists(uri)){
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "GlobalCustomerId:" + globalCustomerId + " not found (404) in AAI")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
new file mode 100644
index 0000000000..5a955e65f5
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
@@ -0,0 +1,230 @@
+package org.onap.so.bpmn.infrastructure.scripts
+
+
+import org.onap.aai.domain.yang.AllottedResource
+
+import static org.apache.commons.lang3.StringUtils.*;
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.OwningEntity
+import org.onap.aai.domain.yang.ServiceProfile;
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.CatalogDbUtils
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
+import org.onap.so.bpmn.core.RollbackData
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.domain.ModelInfo
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceInstance
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+
+
+class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
+
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateSliceServiceInstance.class);
+ JsonUtils jsonUtil = new JsonUtils()
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
+
+ /**
+ * Pre Process the BPMN Flow Request
+ * Inclouds:
+ * generate the nsOperationKey
+ * generate the nsParameters
+ */
+ void preProcessRequest (DelegateExecution execution) {
+ String msg = ""
+ logger.trace("Enter preProcessRequest()")
+ //Need update
+ //1. Prepare service parameter.
+ //2. Prepare slice profile parameters.
+
+ String sliceserviceInstanceId = execution.getVariable("serviceInstanceId")
+ String allottedResourceId = UUID.randomUUID().toString()
+ execution.setVariable("sliceserviceInstanceId", sliceserviceInstanceId)
+ execution.setVariable("allottedResourceId", allottedResourceId)
+
+ String uuiRequest = execution.getVariable("uuiRequest")
+ String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid")
+ String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid")
+ //here modelVersion is not set, we use modelUuid to decompose the service.
+ def isDebugLogEnabled = true
+ execution.setVariable("serviceInstanceId",sliceserviceInstanceId)
+ execution.setVariable("isDebugLogEnabled",isDebugLogEnabled)
+ String serviceModelInfo = """{
+ "modelInvariantUuid":"${modelInvariantUuid}",
+ "modelUuid":"${modelUuid}",
+ "modelVersion":""
+ }"""
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+
+ logger.trace("Exit preProcessRequest")
+ }
+
+
+ void createServiceProfile(DelegateExecution execution) {
+
+ String sliceserviceInstanceId = execution.getVariable("sliceserviceInstanceId")
+ Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile")
+ String serviceProfileID = UUID.randomUUID().toString()
+ ServiceProfile serviceProfile = new ServiceProfile();
+ serviceProfile.setProfileId(serviceProfileID)
+ serviceProfile.setLatency(Integer.parseInt(serviceProfileMap.get("latency").toString()))
+ serviceProfile.setMaxNumberOfUEs(Integer.parseInt(serviceProfileMap.get("maxNumberofUEs").toString()))
+ serviceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString())
+ serviceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString())
+ serviceProfile.setResourceSharingLevel(serviceProfileMap.get("resourceSharingLevel").toString())
+ serviceProfile.setExpDataRateUL(Integer.parseInt(serviceProfileMap.get("expDataRateUL").toString()))
+ serviceProfile.setExpDataRateDL(Integer.parseInt(serviceProfileMap.get("expDataRateDL").toString()))
+ serviceProfile.setAreaTrafficCapUL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapUL").toString()))
+ serviceProfile.setAreaTrafficCapDL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapDL").toString()))
+ serviceProfile.setActivityFactor(Integer.parseInt(serviceProfileMap.get("activityFactor").toString()))
+
+ serviceProfile.setJitter(0)
+ serviceProfile.setSurvivalTime(0)
+ serviceProfile.setCsAvailability(new Object())
+ serviceProfile.setReliability(new Object())
+ serviceProfile.setExpDataRate(0)
+ serviceProfile.setTrafficDensity(0)
+ serviceProfile.setConnDensity(0)
+ try {
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE, execution.getVariable("globalSubscriberId"),
+ execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, serviceProfileID)
+ client.create(uri, serviceProfile)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ void instantiateSliceService(DelegateExecution execution) {
+
+ ServiceDecomposition serviceDecomposition= execution.getVariable("sliceServiceDecomposition")
+ String uuiRequest = execution.getVariable("uuiRequest")
+ ModelInfo modelInfo = serviceDecomposition.getModelInfo()
+ String serviceRole = "e2eslice-service"
+ String serviceType = execution.getVariable("serviceType")
+ Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
+ String ssInstanceId = execution.getVariable("serviceInstanceId")
+ try {
+ org.onap.aai.domain.yang.ServiceInstance ss = new org.onap.aai.domain.yang.ServiceInstance()
+ ss.setServiceInstanceId(ssInstanceId)
+ String sliceInstanceName = execution.getVariable("serviceInstanceName")
+ ss.setServiceInstanceName(sliceInstanceName)
+ ss.setServiceType(serviceType)
+ String serviceStatus = "deactivated"
+ ss.setOrchestrationStatus(serviceStatus)
+ String modelInvariantUuid = modelInfo.getModelInvariantUuid()
+ String modelUuid = modelInfo.getModelUuid()
+ ss.setModelInvariantId(modelInvariantUuid)
+ ss.setModelVersionId(modelUuid)
+ String serviceInstanceLocationid = serviceProfile.get("plmnIdList")
+ ss.setServiceInstanceLocationId(serviceInstanceLocationid)
+ String snssai = serviceProfile.get("sNSSAI")
+ ss.setEnvironmentContext(snssai)
+ ss.setServiceRole(serviceRole)
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), ssInstanceId)
+ client.create(uri, ss)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+
+ def rollbackData = execution.getVariable("RollbackData")
+ if (rollbackData == null) {
+ rollbackData = new RollbackData();
+ }
+ //rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
+ rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
+ rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", ssInstanceId)
+ rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
+ rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
+ execution.setVariable("rollbackData", rollbackData)
+ execution.setVariable("RollbackData", rollbackData)
+ logger.debug("RollbackData:" + rollbackData)
+
+ }
+
+
+ void createAllottedResource(DelegateExecution execution) {
+ String serviceInstanceId = execution.getVariable('sliceserviceInstanceId')
+
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
+ AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+
+// try {
+//
+// if(resourceClient.exists(ssServiceuri)){
+// execution.setVariable("ssi_resourceLink", uri.build().toString())
+// }else{
+// exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " +
+// "associate allotted resource for service :"+serviceInstanceId)
+// }
+// }catch(BpmnError e) {
+// throw e;
+// }catch (Exception ex){
+// String msg = "Exception in getServiceInstance. " + ex.getMessage()
+// logger.debug(msg)
+// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+// }
+
+ try {
+ String allottedResourceId = execution.getVariable("allottedResourceId")
+ ServiceDecomposition serviceDecomposition = execution.getVariable("sliceServiceDecomposition")
+ List<org.onap.so.bpmn.core.domain.AllottedResource> allottedResourceList = serviceDecomposition.getAllottedResources()
+ for(org.onap.so.bpmn.core.domain.AllottedResource allottedResource : allottedResourceList)
+ {
+ //AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(ssServiceuri, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
+ AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE,
+ execution.getVariable("globalSubscriberId"),execution.getVariable("subscriptionServiceType"),
+ execution.getVariable("sliceserviceInstanceId"), allottedResourceId)
+ execution.setVariable("allottedResourceUri", allottedResourceUri)
+ String arType = allottedResource.getAllottedResourceType()
+ String arRole = allottedResource.getAllottedResourceRole()
+ String modelInvariantId = allottedResource.getModelInfo().getModelInvariantUuid()
+ String modelVersionId = allottedResource.getModelInfo().getModelUuid()
+
+ org.onap.aai.domain.yang.AllottedResource resource = new org.onap.aai.domain.yang.AllottedResource()
+ resource.setId(allottedResourceId)
+ resource.setType(arType)
+ resource.setAllottedResourceName("Allotted_"+ execution.getVariable("serviceInstanceName"))
+ resource.setRole(arRole)
+ resource.setModelInvariantId(modelInvariantId)
+ resource.setModelVersionId(modelVersionId)
+ getAAIClient().create(allottedResourceUri, resource)
+ //AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(ssServiceuri).build())
+ //getAAIClient().connect(allottedResourceUri,ssServiceuri)
+ }
+ //execution.setVariable("aaiARPath", allottedResourceUri.build().toString());
+
+ }catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
+ }
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
new file mode 100644
index 0000000000..c66a89b9c6
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
@@ -0,0 +1,524 @@
+package org.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.core.type.TypeReference
+import groovy.json.JsonBuilder
+import groovy.json.JsonSlurper
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.RelationshipList
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.logging.filter.base.ONAPComponents
+import org.onap.so.beans.nsmf.SliceTaskParams
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.OofUtils
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceProxy
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.db.request.client.RequestsDbClient
+import org.onap.so.db.request.beans.OrchestrationTask
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.Response
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+public class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
+
+ private static final Logger logger = LoggerFactory.getLogger( DoCreateSliceServiceOption.class)
+
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ JsonUtils jsonUtil = new JsonUtils()
+
+ RequestsDbClient requestsDbClient = new RequestsDbClient()
+
+ OofUtils oofUtils = new OofUtils()
+
+ /**
+ * Pre Process the BPMN Flow Request
+ * Inclouds:
+ * generate the nsOperationKey
+ * generate the nsParameters
+ */
+ void preProcessRequest (DelegateExecution execution) {
+ String msg = ""
+ logger.trace("Enter preProcessRequest()")
+ String taskID = execution.getVariable("taskID")
+ Boolean isSharable = true
+ String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
+ if (resourceSharingLevel.equals("shared"))
+ isSharable = true
+ execution.setVariable("isSharable",isSharable)
+ logger.trace("Exit preProcessRequest")
+
+ }
+
+
+ void getNSIOptionfromOOF(DelegateExecution execution) {
+
+ String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+ logger.debug( "get NSI option OOF Url: " + urlString)
+ boolean isNSISuggested = true
+ execution.setVariable("isNSISuggested",isNSISuggested)
+ String nsiInstanceId = ""
+ String nsiName = ""
+ SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+ //Prepare auth for OOF - Begin
+ def authHeader = ""
+ String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution)
+ String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+
+ String basicAuthValue = utils.encrypt(basicAuth, msokey)
+ if (basicAuthValue != null) {
+ logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue)
+ try {
+ authHeader = utils.getBasicAuth(basicAuthValue, msokey)
+ execution.setVariable("BasicAuthHeaderValue", authHeader)
+ } catch (Exception ex) {
+ logger.debug( "Unable to encode username and password string: " + ex)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " +
+ "encode username and password string")
+ }
+ } else {
+ logger.debug( "Unable to obtain BasicAuth - BasicAuth value null")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
+ "value null")
+ }
+ //Prepare auth for OOF - End
+
+ String requestId = execution.getVariable("msoRequestId")
+ Map<String, Object> profileInfo = execution.getVariable("serviceProfile")
+ String nstModelUuid = execution.getVariable("nstModelUuid")
+ String nstModelInvariantUuid = execution.getVariable("nstModelInvariantUuid")
+ String nstInfo = """"NSTInfo" : {
+ "invariantUUID":"${nstModelInvariantUuid}",
+ "UUID":"${nstModelUuid}"
+ }"""
+
+ String oofRequest = oofUtils.buildSelectNSIRequest(execution, requestId, nstInfo, profileInfo)
+
+ //send request to get NSI option - Begin
+ URL url = new URL(urlString+"/api/oof/v1/selectnsi")
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF)
+ httpClient.addAdditionalHeader("Authorization", authHeader)
+ Response httpResponse = httpClient.post(oofRequest)
+
+ int responseCode = httpResponse.getStatus()
+ logger.debug("OOF sync response code is: " + responseCode)
+
+ if(responseCode != 200){
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
+ logger.debug("Info: No NSI suggested by OOF" )
+ }
+
+ if(httpResponse.hasEntity()){
+ String OOFResponse = httpResponse.readEntity(String.class)
+ execution.setVariable("OOFResponse", OOFResponse)
+ int index = 0 //This needs to be changed to derive a value when we add policy to decide the solution options.
+ Map OOFResponseObject = new JsonSlurper().parseText(OOFResponse)
+ if(execution.getVariable("isSharable" ) == true && OOFResponseObject.get("solutions").containsKey("sharedNSIsolutions")) {
+ nsiInstanceId = OOFResponseObject.get("solutions").get("sharedNSIsolutions").get(0).get("NSISolution").NSIId
+ nsiName = OOFResponseObject.get("solutions").get("sharedNSIsolutions").get(0).get("NSISolution").NSIName
+ sliceTaskParams.setNstId(nsiInstanceId)
+ sliceTaskParams.setSuggestNsiName(nsiName)
+ execution.setVariable("nsiInstanceId",nsiInstanceId)
+ execution.setVariable("nsiName",nsiName)
+ }else {
+ if(OOFResponseObject.get("solutions").containsKey("newNSISolutions")) {
+ List NSSImap = OOFResponseObject.get("solutions").get("newNSISolutions").get(index).get("NSSISolutions")
+ for(Map nssi : NSSImap) {
+ String nssiName = nssi.get("NSSISolution").NSSIName
+ String nssiId = nssi.get("NSSISolution").NSSIId
+ String domain = nssi.get("NSSISolution").domain.toUpperCase()
+ switch (domain) {
+ case "AN":
+ sliceTaskParams.setAnSuggestNssiId(nssiId)
+ sliceTaskParams.setAnSuggestNssiName(nssiName)
+ break;
+ case "CN":
+ sliceTaskParams.setCnSuggestNssiId(nssiId)
+ sliceTaskParams.setCnSuggestNssiName(nssiName)
+ break;
+ case "TN":
+ sliceTaskParams.setTnSuggestNssiId(nssiId)
+ sliceTaskParams.setTnSuggestNssiName(nssiName)
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ }
+ execution.setVariable("sliceTaskParams", sliceTaskParams)
+ logger.debug("Info: No NSI suggested by OOF" )
+ }
+ //send request to get NSI option - Begin
+
+
+ //send request to get NSI service Info - Begin
+
+ /***
+ * Need to check whether its needed.
+ */
+// logger.debug("Begin to query OOF suggetsed NSI from AAI ")
+// if(isBlank(nsiInstanceId)){
+// isNSISuggested = false
+// execution.setVariable("isNSISuggested",isNSISuggested)
+// }else
+// {
+// try {
+// String globalSubscriberId = execution.getVariable('globalSubscriberId')
+// String serviceType = execution.getVariable('subscriptionServiceType')
+// AAIResourcesClient resourceClient = new AAIResourcesClient()
+// AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nsiInstanceId)
+// AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
+// Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class)
+// org.onap.aai.domain.yang.ServiceInstance nsiServiceInstance = si.get()
+// execution.setVariable("nsiServiceInstance",nsiServiceInstance)
+// isNSISuggested = true
+// execution.setVariable("isNSISuggested",isNSISuggested)
+// SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+// sliceTaskParams.setSuggestNsiId(nsiInstanceId)
+// sliceTaskParams.setSuggestNsiName(si.get().getServiceInstanceName())
+// execution.setVariable("sliceTaskParams", sliceTaskParams)
+// logger.debug("Info: NSI suggested by OOF exist in AAI ")
+// }catch(BpmnError e) {
+// throw e
+// }catch(Exception ex) {
+// String msg = "Internal Error in getServiceInstance: " + ex.getMessage()
+// //exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+// logger.debug("Info: NSI suggested by OOF doesnt exist in AAI " + nsiInstanceId)
+// }
+// }
+ //send request to get NSI service Info - End
+ //${OrchestrationTaskHandler.createOrchestrationTask(execution.getVariable("OrchestrationTask"))}
+ logger.debug( "*** Completed options Call to OOF ***")
+
+ }
+
+
+ public void parseServiceProfile(DelegateExecution execution) {
+ logger.debug("Start parseServiceProfile")
+ String serviceType = execution.getVariable("serviceType")
+ Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
+
+ // set sliceProfile for three domains
+ Map<String, Object> sliceProfileTn = getSliceProfile(serviceType, "TN", serviceProfile)
+ Map<String, Object> sliceProfileCn = getSliceProfile(serviceType, "CN", serviceProfile)
+ Map<String, Object> sliceProfileAn = getSliceProfile(serviceType, "AN", serviceProfile)
+
+ execution.setVariable("sliceProfileTn", sliceProfileTn)
+ execution.setVariable("sliceProfileCn", sliceProfileCn)
+ execution.setVariable("sliceProfileAn", sliceProfileAn)
+ logger.debug("sliceProfileTn: " + sliceProfileTn)
+ logger.debug("sliceProfileCn: " + sliceProfileCn)
+ logger.debug("sliceProfileAn: " + sliceProfileAn)
+
+ logger.debug("Finish parseServiceProfile")
+ }
+
+ public Map getSliceProfile(String serviceType, String domain, Map<String, Object> serviceProfile) {
+ String variablePath = "nsmf." + serviceType + ".profileMap" + domain
+ String profileMapStr = UrnPropertiesReader.getVariable(variablePath)
+ logger.debug("Profile map for " + domain + " : " + profileMapStr)
+ Map<String, String> profileMaps = objectMapper.readValue(profileMapStr, new TypeReference<Map<String, String>>(){})
+ Map<String, Object> sliceProfileTn = [:]
+ for (Map.Entry<String, String> profileMap : profileMaps) {
+ sliceProfileTn.put(profileMap.key, serviceProfile.get(profileMap.value))
+ }
+
+ return sliceProfileTn
+ }
+
+
+ void prepareNSSIList(DelegateExecution execution)
+ {
+ ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
+ List<String> nssiAssociated = new ArrayList<>()
+ Map<String, String> nssimap = new HashMap<>()
+ String nsiInstanceId=execution.getVariable("nsiInstanceId")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String serviceType = execution.getVariable("subscriptionServiceType")
+
+ try {
+
+ ServiceInstance si = execution.getVariable("nsiServiceInstance")
+ //List<Relationship> relationships = si.getRelationshipList().getRelationship().stream().filter(relation ->
+ // relation.getRelatedTo().equalsIgnoreCase("service-instance"))
+ RelationshipList relationshipList = si.getRelationshipList()
+ List<Relationship> relationships = relationshipList.getRelationship()
+ for(Relationship relationship in relationships)
+ {
+ if(relationship.getRelatedTo().equalsIgnoreCase("service-instance"))
+ {
+ String NSSIassociated = relationship.getRelatedLink().substring(relationship.getRelatedLink().lastIndexOf("/") + 1);
+ if(!NSSIassociated.equals(nsiInstanceId))
+ nssiAssociated.add(NSSIassociated)
+ }
+ }
+ }catch(BpmnError e) {
+ throw e
+ }catch(Exception ex) {
+ String msg = "Internal Error in getServiceInstance: " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ Map<String, Object> params = execution.getVariable("params")
+ SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+ for(String nssiID in nssiAssociated)
+ {
+ try {
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nssiID)
+ AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
+ Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class)
+ org.onap.aai.domain.yang.ServiceInstance nssi = si.get()
+
+ String domain = nssi.getEnvironmentContext().toString().toUpperCase()
+ switch (domain) {
+ case "AN":
+ sliceTaskParams.setAnSuggestNssiId(nssi.getServiceInstanceId())
+ sliceTaskParams.setAnSuggestNssiName(nssi.getServiceInstanceName())
+ break;
+ case "CN":
+ sliceTaskParams.setCnSuggestNssiId(nssi.getServiceInstanceId())
+ sliceTaskParams.setCnSuggestNssiName(nssi.getServiceInstanceName())
+ break;
+ case "TN":
+ sliceTaskParams.setTnSuggestNssiId(nssi.getServiceInstanceId())
+ sliceTaskParams.setTnSuggestNssiName(nssi.getServiceInstanceName())
+ break;
+ default:
+ break;
+ }
+ }catch(NotFoundException e)
+ {
+ logger.debug("NSSI Service Instance not found in AAI: " + nssiID)
+ }catch(Exception e)
+ {
+ logger.debug("NSSI Service Instance not found in AAI: " + nssiID)
+ }
+
+ }
+ String nstName = serviceDecomposition.getModelInfo().getModelName()
+ sliceTaskParams.setNstName(nstName)
+ String nstId = serviceDecomposition.getModelInfo().getModelUuid()
+ sliceTaskParams.setNstId(nstId)
+ execution.setVariable("sliceTaskParams",sliceTaskParams)
+
+ }
+
+
+ void updateOptionsInDB(DelegateExecution execution) {
+ logger.debug("Updating options with default value since not sharable : Begin ")
+ String taskID = execution.getVariable("taskID")
+ String params = execution.getVariable("params")
+ logger.debug("Updating options with default value since not sharable : End ")
+
+ }
+
+ void prepareNSTDecompose(DelegateExecution execution) {
+
+ String modelUuid = execution.getVariable("nstModelUuid")
+ String modelInvariantUuid = execution.getVariable("nstModelInvariantUuid")
+
+ String serviceModelInfo = """{
+ "modelInvariantUuid":"${modelInvariantUuid}",
+ "modelUuid":"${modelUuid}",
+ "modelVersion":""
+ }"""
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+ }
+
+ void prepareNSSTDecompose(DelegateExecution execution) {
+ Boolean isMoreNSSTtoProcess = false
+ Integer maxNSST = execution.getVariable("maxNSST")
+ Integer currentNSST=execution.getVariable("currentNSST")
+ List<String> nsstModelUUIDList = new ArrayList<>()
+ nsstModelUUIDList = execution.getVariable("nsstModelUUIDList")
+ String modelUuid = nsstModelUUIDList.get(currentNSST)
+ String serviceModelInfo = """{
+ "modelInvariantUuid":"",
+ "modelUuid":"${modelUuid}",
+ "modelVersion":""
+ }"""
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+ currentNSST=currentNSST+1
+ if(currentNSST<maxNSST)
+ isMoreNSSTtoProcess=true
+ execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess)
+ execution.setVariable("maxNSST",maxNSST)
+ execution.setVariable("currentNSST",currentNSST)
+ }
+
+
+ void updateStatusInDB(DelegateExecution execution) {
+
+ String taskID = execution.getVariable("taskID")
+ //OrchestrationTask orchestrationTask = requestsDbClient.getNetworkSliceOption(taskID);
+ //orchestrationTask.setTaskStage("wait to confirm")
+ //requestsDbClient.updateNetworkSliceOption(orchestrationTask)
+ }
+
+ void prepareNSSTlistfromNST(DelegateExecution execution) {
+ //Need to update this part from decomposition.
+ logger.trace("Enter prepareNSSTlistfromNST()")
+ Boolean isMoreNSSTtoProcess = false
+ ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
+ SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+ String nstName = serviceDecomposition.getModelInfo().getModelName()
+ sliceTaskParams.setNstName(nstName)
+ String nstId = serviceDecomposition.getModelInfo().getModelUuid()
+ sliceTaskParams.setNstId(nstId)
+ execution.setVariable("sliceTaskParams",sliceTaskParams)
+
+ List<ServiceProxy> proxyList = serviceDecomposition.getServiceProxy()
+ List<String> nsstModelUUIDList = new ArrayList<>()
+ for(ServiceProxy serviceProxy:proxyList)
+ nsstModelUUIDList.add(serviceProxy.getSourceModelUuid())
+ execution.setVariable("nsstModelUUIDList",nsstModelUUIDList)
+ Integer maxNSST = nsstModelUUIDList.size()
+ Integer currentNSST=0
+ execution.setVariable("maxNSST",maxNSST)
+ execution.setVariable("currentNSST",currentNSST)
+ if(currentNSST<maxNSST)
+ isMoreNSSTtoProcess=true
+ execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess)
+ logger.trace("Exit prepareNSSTlistfromNST()")
+
+ }
+
+
+ void getNSSTOption(DelegateExecution execution) {
+ ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition")
+ String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String serviceType = execution.getVariable("subscriptionServiceType")
+ String nssiInstanceId =""
+ String nssiName =""
+ SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+ logger.debug( "get NSI option OOF Url: " + urlString)
+ boolean isNSISuggested = false
+ execution.setVariable("isNSISuggested",isNSISuggested)
+
+ //Prepare auth for OOF - Begin
+ def authHeader = ""
+ String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution)
+ String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+
+ String basicAuthValue = utils.encrypt(basicAuth, msokey)
+ if (basicAuthValue != null) {
+ logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue)
+ try {
+ authHeader = utils.getBasicAuth(basicAuthValue, msokey)
+ execution.setVariable("BasicAuthHeaderValue", authHeader)
+ } catch (Exception ex) {
+ logger.debug( "Unable to encode username and password string: " + ex)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " +
+ "encode username and password string")
+ }
+ } else {
+ logger.debug( "Unable to obtain BasicAuth - BasicAuth value null")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
+ "value null")
+ }
+ //Prepare auth for OOF - End
+ //Prepare send request to OOF - Begin
+ String requestId = execution.getVariable("msoRequestId")
+ Map<String, Object> profileInfo = execution.getVariable("serviceProfile")
+ String nsstModelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid()
+ String nsstModelUuid = serviceDecomposition.getModelInfo().getModelUuid()
+ String nsstInfo = """"NSSTInfo": {
+ "invariantUUID":"${nsstModelInvariantUuid}",
+ "UUID":"${nsstModelUuid}"
+ }"""
+ String oofRequest = oofUtils.buildSelectNSSIRequest(execution, requestId, nsstInfo ,profileInfo)
+
+
+ URL url = new URL(urlString+"/api/oof/v1/selectnssi")
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF)
+ httpClient.addAdditionalHeader("Authorization", authHeader)
+ Response httpResponse = httpClient.post(oofRequest)
+
+ int responseCode = httpResponse.getStatus()
+ logger.debug("OOF sync response code is: " + responseCode)
+
+ if(responseCode != 200){
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
+ }
+
+ if(httpResponse.hasEntity()){
+ String OOFResponse = httpResponse.readEntity(String.class)
+ execution.setVariable("OOFResponse", OOFResponse)
+ nssiInstanceId = jsonUtil.getJsonValue(OOFResponse, "NSSIIInfo.NSSIID")
+ nssiName = jsonUtil.getJsonValue(OOFResponse, "NSSIInfo.NSSIName")
+ execution.setVariable("nssiInstanceId",nssiInstanceId)
+ execution.setVariable("nssiName",nssiName)
+ }
+ if(isBlank(nssiInstanceId)){
+ logger.debug( "There is no valid NSST suggested by OOF.")
+ }else
+ {
+ try {
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nssiInstanceId)
+ AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
+ Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class)
+ org.onap.aai.domain.yang.ServiceInstance nssi = si.get()
+
+ String domain = nssi.getEnvironmentContext().toString().toUpperCase()
+ switch (domain) {
+ case "AN":
+ sliceTaskParams.setAnSuggestNssiId(nssi.getServiceInstanceId())
+ sliceTaskParams.setAnSuggestNssiName(nssi.getServiceInstanceName())
+ break;
+ case "CN":
+ sliceTaskParams.setCnSuggestNssiId(nssi.getServiceInstanceId())
+ sliceTaskParams.setCnSuggestNssiName(nssi.getServiceInstanceName())
+ break;
+ case "TN":
+ sliceTaskParams.setTnSuggestNssiId(nssi.getServiceInstanceId())
+ sliceTaskParams.setTnSuggestNssiName(nssi.getServiceInstanceName())
+ break;
+ default:
+ break;
+ }
+ }catch(NotFoundException e)
+ {
+ logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId)
+ }catch(Exception e)
+ {
+ logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId)
+ }
+ }
+
+
+ //Prepare send request to OOF - End
+
+// String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent()
+// String nsstID = jsonUtil.getJsonValue(content, "metadata.id")
+// String vendor = jsonUtil.getJsonValue(content, "metadata.vendor")
+// String domain = jsonUtil.getJsonValue(content, "metadata.domainType")
+// String type = jsonUtil.getJsonValue(content, "metadata.type")
+// String nsstContentInfo = """{
+// "NsstID":"${nsstID}",
+// "Vendor":"${vendor}",
+// "type":"${type}"
+// }"""
+
+ logger.debug("Prepare NSSI option completed ")
+ }
+}
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
index 2def9e2d06..4835c9b84b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
@@ -33,7 +33,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
index dafc4b5470..1a3df6ff4e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
@@ -22,24 +22,21 @@
package org.onap.so.bpmn.infrastructure.scripts
-import org.onap.so.logger.LoggingAnchor
-import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
-import org.onap.so.client.HttpClientFactory
-import org.onap.so.logger.ErrorCode
-
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.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.json.JSONArray
import org.json.JSONObject
import org.onap.aai.domain.yang.GenericVnf
import org.onap.aai.domain.yang.NetworkPolicy
+import org.onap.logging.filter.base.ErrorCode
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.CatalogDbUtils
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.NetworkUtils
@@ -53,28 +50,27 @@ import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.DecomposeJsonUtil
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
-import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.constants.Defaults
import org.onap.so.db.catalog.beans.HomingInstance
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-
-import org.onap.logging.filter.base.ONAPComponents;
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.xml.sax.InputSource
-
import com.fasterxml.jackson.databind.ObjectMapper
@@ -307,7 +303,7 @@ public class DoCreateVfModule extends VfModuleBase {
}
try{
- AAIUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId)
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId)
AAIResourcesClient aaiRC = new AAIResourcesClient()
AAIResultWrapper aaiRW = aaiRC.get(serviceInstanceURI)
Map<String, Object> aaiJson = aaiRW.asMap()
@@ -778,7 +774,7 @@ public class DoCreateVfModule extends VfModuleBase {
def vfModuleName = execution.getVariable('DCVFM_vfModuleName')
AaiUtil aaiUriUtil = new AaiUtil(this)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId).queryParam("vf-module-name",vfModuleName)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId).queryParam("vf-module-name",vfModuleName)
String endPoint = aaiUriUtil.createAaiUri(uri)
HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), ONAPComponents.AAI)
@@ -1927,7 +1923,7 @@ public class DoCreateVfModule extends VfModuleBase {
String fqdn = fqdnList[i]
// Query AAI for this network policy FQDN
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", fqdn)
AAIResourcesClient resourceClient = new AAIResourcesClient()
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
index 4bab2b390d..a77f6f0628 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
@@ -36,9 +36,10 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -507,7 +508,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
try {
// Query AAI for this network policy FQDN
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", fqdn)
Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy
index a233a0a02e..7f2a3e4245 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy
@@ -32,6 +32,7 @@ import org.onap.so.bpmn.core.RollbackData
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
@@ -132,7 +133,7 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor
volumeGroupName = testVolumeGroupName
}
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
try {
Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class, uri)
if (volumeGroups.isPresent()) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
index b2006c45d7..fafe97b0eb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
@@ -22,6 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import javax.ws.rs.NotFoundException
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.GenericVnf
@@ -45,14 +46,12 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import javax.ws.rs.NotFoundException
-
class DoCreateVfModuleVolumeV2 extends VfModuleBase {
private static final Logger logger = LoggerFactory.getLogger( DoCreateVfModuleVolumeV2.class);
- String prefix='DCVFMODVOLV2_'
- JsonUtils jsonUtil = new JsonUtils()
- private ExceptionUtil exceptionUtil = new ExceptionUtil()
+ String prefix='DCVFMODVOLV2_'
+ JsonUtils jsonUtil = new JsonUtils()
+ private ExceptionUtil exceptionUtil = new ExceptionUtil()
/**
@@ -66,330 +65,327 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
public void preProcessRequest(DelegateExecution execution, isDebugLogEnabled) {
- execution.setVariable("prefix",prefix)
- execution.setVariable(prefix+'SuccessIndicator', false)
- execution.setVariable(prefix+'isPONR', false)
-
- displayInput(execution, isDebugLogEnabled)
- setRollbackData(execution, isDebugLogEnabled)
- setRollbackEnabled(execution, isDebugLogEnabled)
-
-
- def tenantId = execution.getVariable("tenantId")
- if (tenantId == null) {
- String cloudConfiguration = execution.getVariable("cloudConfiguration")
- tenantId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.tenantId")
- execution.setVariable("tenantId", tenantId)
- }
-
- def cloudSiteId = execution.getVariable("lcpCloudRegionId")
- if (cloudSiteId == null) {
- String cloudConfiguration = execution.getVariable("cloudConfiguration")
- cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.lcpCloudRegionId")
- def cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.cloudOwner")
- execution.setVariable("lcpCloudRegionId", cloudSiteId)
- execution.setVariable("cloudOwner", cloudOwner)
- }
-
- // Extract attributes from modelInfo
- String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo")
-
- //modelCustomizationUuid
- def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid")
- execution.setVariable("modelCustomizationId", modelCustomizationUuid)
- logger.debug("modelCustomizationId: " + modelCustomizationUuid)
-
- //modelName
- def modelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName")
- execution.setVariable("modelName", modelName)
- logger.debug("modelName: " + modelName)
-
- // The following is used on the get Generic Service Instance call
- execution.setVariable('GENGS_type', 'service-instance')
- }
-
-
- /**
- * Display input variables
- * @param execution
- * @param isDebugLogEnabled
- */
- public void displayInput(DelegateExecution execution, isDebugLogEnabled) {
- def input = ['mso-request-id', 'msoRequestId', 'isDebugLogEnabled', 'disableRollback', 'failIfExists', 'serviceInstanceId',
- 'vnfId', 'vnfName', 'tenantId', 'volumeGroupId', 'volumeGroupName', 'lcpCloudRegionId', 'vnfType', 'vfModuleModelInfo', 'asdcServiceModelVersion',
- 'test-volume-group-name', 'test-volume-group-id', 'vfModuleInputParams']
-
- logger.debug('Begin input: ')
- input.each {
- logger.debug(it + ': ' + execution.getVariable(it))
- }
- logger.debug('End input.')
- }
-
-
- /**
- * Define and set rollbackdata object
- * @param execution
- * @param isDebugEnabled
- */
- public void setRollbackData(DelegateExecution execution, isDebugEnabled) {
- def rollbackData = execution.getVariable("rollbackData")
- if (rollbackData == null) {
- rollbackData = new RollbackData()
- }
- def volumeGroupName = execution.getVariable('volumeGroupName')
- rollbackData.put("DCVFMODULEVOL", "volumeGroupName", volumeGroupName)
- execution.setVariable("rollbackData", rollbackData)
- }
-
-
- /**
- * Gets the service instance uri from aai
- */
- public void getServiceInstance(DelegateExecution execution) {
- try {
- String serviceInstanceId = execution.getVariable('serviceInstanceId')
-
- AAIResourcesClient resourceClient = new AAIResourcesClient()
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
-
- if(!resourceClient.exists(uri)){
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
- }
-
- }catch(BpmnError e) {
- throw e
- }catch (Exception ex){
- String msg = "Exception in getServiceInstance. " + ex.getMessage()
- logger.debug(msg)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, msg)
- }
- }
-
- /**
- * Get cloud region
- * @param execution
- * @param isDebugEnabled
- */
- public void callRESTQueryAAICloudRegion (DelegateExecution execution, isDebugEnabled) {
-
- def cloudRegion = execution.getVariable("lcpCloudRegionId")
- logger.debug('Request cloud region is: ' + cloudRegion)
-
- AaiUtil aaiUtil = new AaiUtil(this)
-
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
- def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
-
- cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
-
- def aaiCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "AAI", cloudRegion)
- if ((aaiCloudRegion != "ERROR")) {
- execution.setVariable("lcpCloudRegionId", aaiCloudRegion)
- logger.debug("AIC Cloud Region for AAI: " + aaiCloudRegion)
- } else {
- String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")
- logger.debug(errorMessage)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage)
- }
-
- def poCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
- if ((poCloudRegion != "ERROR")) {
- execution.setVariable("poLcpCloudRegionId", poCloudRegion)
- logger.debug("AIC Cloud Region for PO: " + poCloudRegion)
- } else {
- String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")
- logger.debug(errorMessage)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage)
- }
-
- def rollbackData = execution.getVariable("rollbackData")
- rollbackData.put("DCVFMODULEVOL", "aiccloudregion", cloudRegion)
- }
-
-
- /**
- * Query AAI volume group by name
- * @param execution
- * @param isDebugEnabled
- */
- public void callRESTQueryAAIVolGrpName(DelegateExecution execution, isDebugEnabled) {
-
- def volumeGroupName = execution.getVariable('volumeGroupName')
- def cloudRegion = execution.getVariable('lcpCloudRegionId')
-
- try {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
- Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class,uri)
- if(volumeGroups.isPresent()){
- VolumeGroup volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
- execution.setVariable(prefix+'AaiReturnCode', 200)
- execution.setVariable("queriedVolumeGroupId",volumeGroup.getVolumeGroupId())
- logger.debug("Volume Group Name $volumeGroupName exists in AAI.")
- }else{
- execution.setVariable(prefix+'AaiReturnCode', 404)
- exceptionUtil.buildAndThrowWorkflowException(execution,25000, "Volume Group Name $volumeGroupName does not exist in AAI.")
- }
- }catch(BpmnError error){
- throw error
- }catch(Exception e){
- execution.setVariable(prefix+'AaiReturnCode', 500)
- exceptionUtil.buildAndThrowWorkflowException(execution,25000, "Exception in get volume group by name: " + e.getMessage())
- }
- }
-
-
- /**
- * Create a WorkflowException
- * @param execution
- * @param isDebugEnabled
- */
- public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage) {
- logger.debug(errorMessage)
- (new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage)
- }
-
-
- /**
- * Create a WorkflowException
- * @param execution
- * @param isDebugEnabled
- */
- public void handleError(DelegateExecution execution, isDebugEnabled) {
- WorkflowException we = execution.getVariable('WorkflowException')
- if (we == null) {
- (new ExceptionUtil()).buildWorkflowException(execution, 2500, "Enexpected error encountered!")
- }
- throw new BpmnError("MSOWorkflowException")
- }
-
-
- /**
- * Create volume group in AAI
- * @param execution
- * @param isDebugEnabled
- */
- public void callRESTCreateAAIVolGrpName(DelegateExecution execution, isDebugEnabled) {
-
- def vnfId = execution.getVariable('vnfId')
- def volumeGroupId = execution.getVariable('volumeGroupId')
- def volumeName = execution.getVariable("volumeGroupName")
- def modelCustomizationId = execution.getVariable("modelCustomizationId")
- def vnfType = execution.getVariable("vnfType")
- def tenantId = execution.getVariable("tenantId")
- def cloudRegion = execution.getVariable('lcpCloudRegionId')
- def cloudOwner = execution.getVariable('cloudOwner')
-
- def testGroupId = execution.getVariable('test-volume-group-id')
- if (testGroupId != null && testGroupId.trim() != '') {
- logger.debug("test volumeGroupId is present: " + testGroupId)
- volumeGroupId = testGroupId
- execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0")
- }
-
- VolumeGroup volumeGroup = new VolumeGroup()
- volumeGroup.setVolumeGroupId(volumeGroupId)
- volumeGroup.setVolumeGroupName(volumeName)
- volumeGroup.setVnfType(vnfType)
- volumeGroup.setOrchestrationStatus(OrchestrationStatus.PENDING.toString())
- volumeGroup.setModelCustomizationId(modelCustomizationId)
-
- logger.debug("volumeGroupId to be used: " + volumeGroupId)
-
- AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId)
- AAIResourceUri tenantUri = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId)
- AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
- try {
- getAAIClient().create(volumeGroupUri, volumeGroup)
- getAAIClient().connect(volumeGroupUri, vnfUri)
- getAAIClient().connect(volumeGroupUri, tenantUri)
- execution.setVariable("queriedVolumeGroupId", volumeGroupId)
- RollbackData rollbackData = execution.getVariable("rollbackData")
- rollbackData.put("DCVFMODULEVOL", "isAAIRollbackNeeded", "true")
- } catch (NotFoundException ignored) {
- execution.setVariable(prefix + "isErrorMessageException", true)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to create volume group in AAI. Response code: 404")
- } catch (Exception ex) {
- execution.setVariable(prefix + "isErrorMessageException", true)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, ex.getMessage())
- }
- }
-
- /**
- * Prepare VNF adapter create request XML
- * @param execution
- */
- public void prepareVnfAdapterCreateRequest(DelegateExecution execution, isDebugEnabled) {
-
- GenericVnf aaiGenericVnfResponse = execution.getVariable(prefix+'AAIQueryGenericVfnResponse')
- def vnfId = aaiGenericVnfResponse.getVnfId()
- def vnfName = aaiGenericVnfResponse.getVnfName()
- def vnfType = aaiGenericVnfResponse.getVnfType()
-
- def requestId = execution.getVariable('msoRequestId')
- def serviceId = execution.getVariable('serviceInstanceId')
- def cloudSiteId = execution.getVariable('poLcpCloudRegionId')
- def tenantId = execution.getVariable('tenantId')
- def volumeGroupId = execution.getVariable('volumeGroupId')
- def volumeGroupnName = execution.getVariable('volumeGroupName')
-
- def vnfVersion = execution.getVariable("asdcServiceModelVersion")
- def vnfModuleType = execution.getVariable("modelName")
-
- def modelCustomizationId = execution.getVariable("modelCustomizationId")
-
- // for testing
- logger.debug("volumeGroupId: " + volumeGroupId)
- def testGroupId = execution.getVariable('test-volume-group-id')
- if (testGroupId != null && testGroupId.trim() != '') {
- logger.debug("test volumeGroupId is present: " + testGroupId)
- volumeGroupId = testGroupId
- execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0")
- }
- logger.debug("volumeGroupId to be used: " + volumeGroupId)
-
- // volume group parameters
-
- String volumeGroupParams = ''
- StringBuilder sbParams = new StringBuilder()
- Map<String, String> paramsMap = execution.getVariable("vfModuleInputParams")
- for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
- String paramsXml
- String paramName = entry.getKey()
- String paramValue = entry.getValue()
- paramsXml =
- """ <entry>
+ execution.setVariable("prefix",prefix)
+ execution.setVariable(prefix+'SuccessIndicator', false)
+ execution.setVariable(prefix+'isPONR', false)
+
+ displayInput(execution, isDebugLogEnabled)
+ setRollbackData(execution, isDebugLogEnabled)
+ setRollbackEnabled(execution, isDebugLogEnabled)
+
+
+ def tenantId = execution.getVariable("tenantId")
+ if (tenantId == null) {
+ String cloudConfiguration = execution.getVariable("cloudConfiguration")
+ tenantId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.tenantId")
+ execution.setVariable("tenantId", tenantId)
+ }
+
+ def cloudSiteId = execution.getVariable("lcpCloudRegionId")
+ if (cloudSiteId == null) {
+ String cloudConfiguration = execution.getVariable("cloudConfiguration")
+ cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.lcpCloudRegionId")
+ def cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudConfiguration.cloudOwner")
+ execution.setVariable("lcpCloudRegionId", cloudSiteId)
+ execution.setVariable("cloudOwner", cloudOwner)
+ }
+
+ // Extract attributes from modelInfo
+ String vfModuleModelInfo = execution.getVariable("vfModuleModelInfo")
+
+ //modelCustomizationUuid
+ def modelCustomizationUuid = jsonUtil.getJsonValue(vfModuleModelInfo, "modelCustomizationUuid")
+ execution.setVariable("modelCustomizationId", modelCustomizationUuid)
+ logger.debug("modelCustomizationId: " + modelCustomizationUuid)
+
+ //modelName
+ def modelName = jsonUtil.getJsonValue(vfModuleModelInfo, "modelName")
+ execution.setVariable("modelName", modelName)
+ logger.debug("modelName: " + modelName)
+
+ // The following is used on the get Generic Service Instance call
+ execution.setVariable('GENGS_type', 'service-instance')
+ }
+
+
+ /**
+ * Display input variables
+ * @param execution
+ * @param isDebugLogEnabled
+ */
+ public void displayInput(DelegateExecution execution, isDebugLogEnabled) {
+ def input = ['mso-request-id', 'msoRequestId', 'isDebugLogEnabled', 'disableRollback', 'failIfExists', 'serviceInstanceId', 'vnfId', 'vnfName', 'tenantId', 'volumeGroupId', 'volumeGroupName', 'lcpCloudRegionId', 'vnfType', 'vfModuleModelInfo', 'asdcServiceModelVersion', 'test-volume-group-name', 'test-volume-group-id', 'vfModuleInputParams']
+
+ logger.debug('Begin input: ')
+ input.each {
+ logger.debug(it + ': ' + execution.getVariable(it))
+ }
+ logger.debug('End input.')
+ }
+
+
+ /**
+ * Define and set rollbackdata object
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void setRollbackData(DelegateExecution execution, isDebugEnabled) {
+ def rollbackData = execution.getVariable("rollbackData")
+ if (rollbackData == null) {
+ rollbackData = new RollbackData()
+ }
+ def volumeGroupName = execution.getVariable('volumeGroupName')
+ rollbackData.put("DCVFMODULEVOL", "volumeGroupName", volumeGroupName)
+ execution.setVariable("rollbackData", rollbackData)
+ }
+
+
+ /**
+ * Gets the service instance uri from aai
+ */
+ public void getServiceInstance(DelegateExecution execution) {
+ try {
+ String serviceInstanceId = execution.getVariable('serviceInstanceId')
+
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
+
+ if(!resourceClient.exists(uri)){
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
+ }
+ }catch(BpmnError e) {
+ throw e
+ }catch (Exception ex){
+ String msg = "Exception in getServiceInstance. " + ex.getMessage()
+ logger.debug(msg)
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+
+ /**
+ * Get cloud region
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void callRESTQueryAAICloudRegion (DelegateExecution execution, isDebugEnabled) {
+
+ def cloudRegion = execution.getVariable("lcpCloudRegionId")
+ logger.debug('Request cloud region is: ' + cloudRegion)
+
+ AaiUtil aaiUtil = new AaiUtil(this)
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, Defaults.CLOUD_OWNER.toString(), cloudRegion)
+ def queryCloudRegionRequest = aaiUtil.createAaiUri(uri)
+
+ cloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
+
+ def aaiCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "AAI", cloudRegion)
+ if ((aaiCloudRegion != "ERROR")) {
+ execution.setVariable("lcpCloudRegionId", aaiCloudRegion)
+ logger.debug("AIC Cloud Region for AAI: " + aaiCloudRegion)
+ } else {
+ String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")
+ logger.debug(errorMessage)
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage)
+ }
+
+ def poCloudRegion = aaiUtil.getAAICloudReqion(execution, queryCloudRegionRequest, "PO", cloudRegion)
+ if ((poCloudRegion != "ERROR")) {
+ execution.setVariable("poLcpCloudRegionId", poCloudRegion)
+ logger.debug("AIC Cloud Region for PO: " + poCloudRegion)
+ } else {
+ String errorMessage = "AAI Query Cloud Region Unsuccessful. Return Code: " + execution.getVariable(prefix+"queryCloudRegionReturnCode")
+ logger.debug(errorMessage)
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 2500, errorMessage)
+ }
+
+ def rollbackData = execution.getVariable("rollbackData")
+ rollbackData.put("DCVFMODULEVOL", "aiccloudregion", cloudRegion)
+ }
+
+
+ /**
+ * Query AAI volume group by name
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void callRESTQueryAAIVolGrpName(DelegateExecution execution, isDebugEnabled) {
+
+ def volumeGroupName = execution.getVariable('volumeGroupName')
+ def cloudRegion = execution.getVariable('lcpCloudRegionId')
+
+ try {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
+ Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class,uri)
+ if(volumeGroups.isPresent()){
+ VolumeGroup volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
+ execution.setVariable(prefix+'AaiReturnCode', 200)
+ execution.setVariable("queriedVolumeGroupId",volumeGroup.getVolumeGroupId())
+ logger.debug("Volume Group Name $volumeGroupName exists in AAI.")
+ }else{
+ execution.setVariable(prefix+'AaiReturnCode', 404)
+ exceptionUtil.buildAndThrowWorkflowException(execution,25000, "Volume Group Name $volumeGroupName does not exist in AAI.")
+ }
+ }catch(BpmnError error){
+ throw error
+ }catch(Exception e){
+ execution.setVariable(prefix+'AaiReturnCode', 500)
+ exceptionUtil.buildAndThrowWorkflowException(execution,25000, "Exception in get volume group by name: " + e.getMessage())
+ }
+ }
+
+
+ /**
+ * Create a WorkflowException
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage) {
+ logger.debug(errorMessage)
+ (new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage)
+ }
+
+
+ /**
+ * Create a WorkflowException
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void handleError(DelegateExecution execution, isDebugEnabled) {
+ WorkflowException we = execution.getVariable('WorkflowException')
+ if (we == null) {
+ (new ExceptionUtil()).buildWorkflowException(execution, 2500, "Enexpected error encountered!")
+ }
+ throw new BpmnError("MSOWorkflowException")
+ }
+
+
+ /**
+ * Create volume group in AAI
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void callRESTCreateAAIVolGrpName(DelegateExecution execution, isDebugEnabled) {
+
+ def vnfId = execution.getVariable('vnfId')
+ def volumeGroupId = execution.getVariable('volumeGroupId')
+ def volumeName = execution.getVariable("volumeGroupName")
+ def modelCustomizationId = execution.getVariable("modelCustomizationId")
+ def vnfType = execution.getVariable("vnfType")
+ def tenantId = execution.getVariable("tenantId")
+ def cloudRegion = execution.getVariable('lcpCloudRegionId')
+ def cloudOwner = execution.getVariable('cloudOwner')
+
+ def testGroupId = execution.getVariable('test-volume-group-id')
+ if (testGroupId != null && testGroupId.trim() != '') {
+ logger.debug("test volumeGroupId is present: " + testGroupId)
+ volumeGroupId = testGroupId
+ execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0")
+ }
+
+ VolumeGroup volumeGroup = new VolumeGroup()
+ volumeGroup.setVolumeGroupId(volumeGroupId)
+ volumeGroup.setVolumeGroupName(volumeName)
+ volumeGroup.setVnfType(vnfType)
+ volumeGroup.setOrchestrationStatus(OrchestrationStatus.PENDING.toString())
+ volumeGroup.setModelCustomizationId(modelCustomizationId)
+
+ logger.debug("volumeGroupId to be used: " + volumeGroupId)
+
+ AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId)
+ AAIResourceUri tenantUri = AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId)
+ AAIResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ try {
+ getAAIClient().create(volumeGroupUri, volumeGroup)
+ getAAIClient().connect(volumeGroupUri, vnfUri)
+ getAAIClient().connect(volumeGroupUri, tenantUri)
+ execution.setVariable("queriedVolumeGroupId", volumeGroupId)
+ RollbackData rollbackData = execution.getVariable("rollbackData")
+ rollbackData.put("DCVFMODULEVOL", "isAAIRollbackNeeded", "true")
+ } catch (NotFoundException ignored) {
+ execution.setVariable(prefix + "isErrorMessageException", true)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to create volume group in AAI. Response code: 404")
+ } catch (Exception ex) {
+ execution.setVariable(prefix + "isErrorMessageException", true)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, ex.getMessage())
+ }
+ }
+
+ /**
+ * Prepare VNF adapter create request XML
+ * @param execution
+ */
+ public void prepareVnfAdapterCreateRequest(DelegateExecution execution, isDebugEnabled) {
+
+ GenericVnf aaiGenericVnfResponse = execution.getVariable(prefix+'AAIQueryGenericVfnResponse')
+ def vnfId = aaiGenericVnfResponse.getVnfId()
+ def vnfName = aaiGenericVnfResponse.getVnfName()
+ def vnfType = aaiGenericVnfResponse.getVnfType()
+
+ def requestId = execution.getVariable('msoRequestId')
+ def serviceId = execution.getVariable('serviceInstanceId')
+ def cloudSiteId = execution.getVariable('poLcpCloudRegionId')
+ def tenantId = execution.getVariable('tenantId')
+ def volumeGroupId = execution.getVariable('volumeGroupId')
+ def volumeGroupnName = execution.getVariable('volumeGroupName')
+
+ def vnfVersion = execution.getVariable("asdcServiceModelVersion")
+ def vnfModuleType = execution.getVariable("modelName")
+
+ def modelCustomizationId = execution.getVariable("modelCustomizationId")
+
+ // for testing
+ logger.debug("volumeGroupId: " + volumeGroupId)
+ def testGroupId = execution.getVariable('test-volume-group-id')
+ if (testGroupId != null && testGroupId.trim() != '') {
+ logger.debug("test volumeGroupId is present: " + testGroupId)
+ volumeGroupId = testGroupId
+ execution.setVariable("test-volume-group-name", "MSOTESTVOL101a-vSAMP12_base_vol_module-0")
+ }
+ logger.debug("volumeGroupId to be used: " + volumeGroupId)
+
+ // volume group parameters
+
+ String volumeGroupParams = ''
+ StringBuilder sbParams = new StringBuilder()
+ Map<String, String> paramsMap = execution.getVariable("vfModuleInputParams")
+ for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
+ String paramsXml
+ String paramName = entry.getKey()
+ String paramValue = entry.getValue()
+ paramsXml =
+ """ <entry>
<key>${MsoUtils.xmlEscape(paramName)}</key>
<value>${MsoUtils.xmlEscape(paramValue)}</value>
</entry>
"""
- sbParams.append(paramsXml)
- }
+ sbParams.append(paramsXml)
+ }
- volumeGroupParams = sbParams.toString()
- logger.debug("volumeGroupParams: "+ volumeGroupParams)
+ volumeGroupParams = sbParams.toString()
+ logger.debug("volumeGroupParams: "+ volumeGroupParams)
- def backoutOnFailure = execution.getVariable(prefix+"backoutOnFailure")
- logger.debug("backoutOnFailure: "+ backoutOnFailure)
+ def backoutOnFailure = execution.getVariable(prefix+"backoutOnFailure")
+ logger.debug("backoutOnFailure: "+ backoutOnFailure)
- def failIfExists = execution.getVariable("failIfExists")
- if(failIfExists == null) {
- failIfExists = 'true'
- }
+ def failIfExists = execution.getVariable("failIfExists")
+ if(failIfExists == null) {
+ failIfExists = 'true'
+ }
- String messageId = UUID.randomUUID()
- logger.debug("messageId to be used is generated: " + messageId)
+ String messageId = UUID.randomUUID()
+ logger.debug("messageId to be used is generated: " + messageId)
- def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
- def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
- if ('true'.equals(useQualifiedHostName)) {
- notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
- }
- logger.debug("CreateVfModuleVolume - notificationUrl: "+ notificationUrl)
+ def notificationUrl = createCallbackURL(execution, "VNFAResponse", messageId)
+ def useQualifiedHostName = UrnPropertiesReader.getVariable("mso.use.qualified.host",execution)
+ if ('true'.equals(useQualifiedHostName)) {
+ notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl)
+ }
+ logger.debug("CreateVfModuleVolume - notificationUrl: "+ notificationUrl)
- // build request
- String vnfSubCreateWorkflowRequest =
- """
+ // build request
+ String vnfSubCreateWorkflowRequest =
+ """
<createVolumeGroupRequest>
<cloudSiteId>${MsoUtils.xmlEscape(cloudSiteId)}</cloudSiteId>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
@@ -432,23 +428,23 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
</createVolumeGroupRequest>
"""
- String vnfSubCreateWorkflowRequestAsString = utils.formatXml(vnfSubCreateWorkflowRequest)
- logger.debug(vnfSubCreateWorkflowRequestAsString)
- logger.debug(vnfSubCreateWorkflowRequestAsString)
- execution.setVariable(prefix+"createVnfARequest", vnfSubCreateWorkflowRequestAsString)
+ String vnfSubCreateWorkflowRequestAsString = utils.formatXml(vnfSubCreateWorkflowRequest)
+ logger.debug(vnfSubCreateWorkflowRequestAsString)
+ logger.debug(vnfSubCreateWorkflowRequestAsString)
+ execution.setVariable(prefix+"createVnfARequest", vnfSubCreateWorkflowRequestAsString)
- // build rollback request for use later if needed
- String vnfSubRollbackWorkflowRequest = buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl)
+ // build rollback request for use later if needed
+ String vnfSubRollbackWorkflowRequest = buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl)
- logger.debug("Sub Vnf flow rollback request: vnfSubRollbackWorkflowRequest " + "\n" + vnfSubRollbackWorkflowRequest)
+ logger.debug("Sub Vnf flow rollback request: vnfSubRollbackWorkflowRequest " + "\n" + vnfSubRollbackWorkflowRequest)
- String vnfSubRollbackWorkflowRequestAsString = utils.formatXml(vnfSubRollbackWorkflowRequest)
- execution.setVariable(prefix+"rollbackVnfARequest", vnfSubRollbackWorkflowRequestAsString)
- }
+ String vnfSubRollbackWorkflowRequestAsString = utils.formatXml(vnfSubRollbackWorkflowRequest)
+ execution.setVariable(prefix+"rollbackVnfARequest", vnfSubRollbackWorkflowRequestAsString)
+ }
- public String buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) {
+ public String buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) {
- String request = """
+ String request = """
<rollbackVolumeGroupRequest>
<volumeGroupRollback>
<volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId>
@@ -467,88 +463,88 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
</rollbackVolumeGroupRequest>
"""
- return request
- }
-
- public String updateRollbackVolumeGroupRequestXml(String rollabackRequest, String heatStackId) {
- String newRequest = rollabackRequest.replace("{{VOLUMEGROUPSTACKID}}", heatStackId)
- return newRequest
- }
-
- /**
- * Validate VNF adapter response
- * @param execution
- */
- public void validateVnfResponse(DelegateExecution execution, isDebugEnabled) {
- def vnfSuccess = execution.getVariable('VNFREST_SuccessIndicator')
- logger.debug("vnfAdapterSuccessIndicator: "+ vnfSuccess)
- if(vnfSuccess==true) {
- String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse")
- String heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId")
- String vnfRollbackRequest = execution.getVariable(prefix+"rollbackVnfARequest")
- String updatedVnfRollbackRequest = updateRollbackVolumeGroupRequestXml(vnfRollbackRequest, heatStackID)
- logger.debug("vnfAdapter rollback request: "+ updatedVnfRollbackRequest)
- RollbackData rollbackData = execution.getVariable("rollbackData")
- rollbackData.put("DCVFMODULEVOL", "rollbackVnfARequest", updatedVnfRollbackRequest)
- rollbackData.put("DCVFMODULEVOL", "isCreateVnfRollbackNeeded", "true")
- }
- }
-
-
- /**
- * Update voulume group in AAI
- * @TODO: Can we re-use the create method??
- * @param execution
- * @param isDebugEnabled
- */
- public void callRESTUpdateCreatedVolGrpName(DelegateExecution execution, isDebugEnabled) {
- String volumeGroupId = execution.getVariable("queriedVolumeGroupId")
- String modelCustomizationId = execution.getVariable("modelCustomizationId")
- String cloudRegion = execution.getVariable("lcpCloudRegionId")
- String cloudOwner = execution.getVariable('cloudOwner')
- String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse")
- def heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId")
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId)
-
- execution.setVariable(prefix+"heatStackId", heatStackID)
-
- VolumeGroup volumeGroup = new VolumeGroup()
- volumeGroup.setHeatStackId(heatStackID)
- volumeGroup.setModelCustomizationId(modelCustomizationId)
- try {
- getAAIClient().update(uri, volumeGroup)
- execution.setVariable(prefix+"isPONR", true)
- }catch(NotFoundException ignored){
- execution.setVariable(prefix+"isErrorMessageException", true)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to update volume group in AAI. Response code: 404")
- }catch(BpmnError error){
- throw error
- }catch(Exception e){
- execution.setVariable(prefix+"isErrorMessageException", true)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "AAI Adapter Query Failed. "+ e.getMessage())
- }
- }
-
-
- /**
- * Query AAI Generic VNF
- * @param execution
- * @param isDebugEnabled
- */
- public void callRESTQueryAAIGenericVnf(DelegateExecution execution, isDebugEnabled) {
-
- def vnfId = execution.getVariable('vnfId')
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
- try {
- Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class, uri)
- if (genericVnf.isPresent()) {
- execution.setVariable(prefix + 'AAIQueryGenericVfnResponse', genericVnf.get())
- } else {
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, 'Generic vnf ' + vnfId + ' was not found in AAI. Return code: 404.')
- }
- }catch(Exception e){
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Exception in get generic VNF: " + e.getMessage())
- }
- }
+ return request
+ }
+
+ public String updateRollbackVolumeGroupRequestXml(String rollabackRequest, String heatStackId) {
+ String newRequest = rollabackRequest.replace("{{VOLUMEGROUPSTACKID}}", heatStackId)
+ return newRequest
+ }
+
+ /**
+ * Validate VNF adapter response
+ * @param execution
+ */
+ public void validateVnfResponse(DelegateExecution execution, isDebugEnabled) {
+ def vnfSuccess = execution.getVariable('VNFREST_SuccessIndicator')
+ logger.debug("vnfAdapterSuccessIndicator: "+ vnfSuccess)
+ if(vnfSuccess==true) {
+ String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse")
+ String heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId")
+ String vnfRollbackRequest = execution.getVariable(prefix+"rollbackVnfARequest")
+ String updatedVnfRollbackRequest = updateRollbackVolumeGroupRequestXml(vnfRollbackRequest, heatStackID)
+ logger.debug("vnfAdapter rollback request: "+ updatedVnfRollbackRequest)
+ RollbackData rollbackData = execution.getVariable("rollbackData")
+ rollbackData.put("DCVFMODULEVOL", "rollbackVnfARequest", updatedVnfRollbackRequest)
+ rollbackData.put("DCVFMODULEVOL", "isCreateVnfRollbackNeeded", "true")
+ }
+ }
+
+
+ /**
+ * Update voulume group in AAI
+ * @TODO: Can we re-use the create method??
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void callRESTUpdateCreatedVolGrpName(DelegateExecution execution, isDebugEnabled) {
+ String volumeGroupId = execution.getVariable("queriedVolumeGroupId")
+ String modelCustomizationId = execution.getVariable("modelCustomizationId")
+ String cloudRegion = execution.getVariable("lcpCloudRegionId")
+ String cloudOwner = execution.getVariable('cloudOwner')
+ String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse")
+ def heatStackID = utils.getNodeText(createVnfAResponse, "volumeGroupStackId")
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, cloudRegion, volumeGroupId)
+
+ execution.setVariable(prefix+"heatStackId", heatStackID)
+
+ VolumeGroup volumeGroup = new VolumeGroup()
+ volumeGroup.setHeatStackId(heatStackID)
+ volumeGroup.setModelCustomizationId(modelCustomizationId)
+ try {
+ getAAIClient().update(uri, volumeGroup)
+ execution.setVariable(prefix+"isPONR", true)
+ }catch(NotFoundException ignored){
+ execution.setVariable(prefix+"isErrorMessageException", true)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Unable to update volume group in AAI. Response code: 404")
+ }catch(BpmnError error){
+ throw error
+ }catch(Exception e){
+ execution.setVariable(prefix+"isErrorMessageException", true)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "AAI Adapter Query Failed. "+ e.getMessage())
+ }
+ }
+
+
+ /**
+ * Query AAI Generic VNF
+ * @param execution
+ * @param isDebugEnabled
+ */
+ public void callRESTQueryAAIGenericVnf(DelegateExecution execution, isDebugEnabled) {
+
+ def vnfId = execution.getVariable('vnfId')
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ try {
+ Optional<GenericVnf> genericVnf = getAAIClient().get(GenericVnf.class, uri)
+ if (genericVnf.isPresent()) {
+ execution.setVariable(prefix + 'AAIQueryGenericVfnResponse', genericVnf.get())
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, 'Generic vnf ' + vnfId + ' was not found in AAI. Return code: 404.')
+ }
+ }catch(Exception e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Exception in get generic VNF: " + e.getMessage())
+ }
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
index e9b748b14b..823217c4f7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
@@ -24,7 +24,7 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.logger.LoggingAnchor
import org.onap.so.db.catalog.beans.HomingInstance
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import static org.apache.commons.lang3.StringUtils.*
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
index 180032c8f0..e60fab5766 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
@@ -41,7 +41,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.logger.MessageEnum
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy
index a6cb5cf4cc..150f55316c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy
@@ -23,7 +23,7 @@
package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.logger.LoggingAnchor
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
index a88becad1a..72f71686d9 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
@@ -23,7 +23,7 @@
package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.logger.LoggingAnchor
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import static org.apache.commons.lang3.StringUtils.*
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
index 48e4fdf2ff..bc535a348f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
@@ -24,7 +24,7 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.logger.LoggingAnchor
import org.onap.aai.domain.yang.AllottedResource
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import javax.ws.rs.core.UriBuilder
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
new file mode 100644
index 0000000000..8d8e97328d
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
@@ -0,0 +1,308 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.logging.filter.base.ONAPComponents
+import org.onap.so.beans.nsmf.DeAllocateNssi
+import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.beans.nsmf.JobStatusRequest
+import org.onap.so.beans.nsmf.JobStatusResponse
+import org.onap.so.beans.nsmf.NetworkType
+import org.onap.so.beans.nsmf.NssiDeAllocateRequest
+import org.onap.so.beans.nsmf.NssiResponse
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.domain.ServiceArtifact
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.db.request.beans.OperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import javax.ws.rs.core.Response
+
+
+class DoDeallocateNSSI extends AbstractServiceTaskProcessor
+{
+ private final String PREFIX ="DoDeallocateNSSI"
+
+ private ExceptionUtil exceptionUtil = new ExceptionUtil()
+ private JsonUtils jsonUtil = new JsonUtils()
+ private RequestDBUtil requestDBUtil = new RequestDBUtil()
+ private static final Logger LOGGER = LoggerFactory.getLogger( DoDeallocateNSSI.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ LOGGER.trace(" ***** ${PREFIX} Start preProcessRequest *****")
+
+ def currentNSSI = execution.getVariable("currentNSSI")
+ if (!currentNSSI) {
+ String msg = "currentNSSI is null"
+ LOGGER.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ LOGGER.trace("***** ${PREFIX} Exit preProcessRequest *****")
+ }
+
+ /**
+ *
+ * @param execution
+ */
+ void prepareDecomposeService(DelegateExecution execution)
+ {
+ LOGGER.trace(" *****${PREFIX} Start prepareDecomposeService *****")
+ try
+ {
+ def currentNSSI = execution.getVariable("currentNSSI")
+ String modelInvariantUuid = currentNSSI['modelInvariantId']
+ String modelVersionId = currentNSSI['modelVersionId']
+ String serviceModelInfo = """{
+ "modelInvariantUuid":"${modelInvariantUuid}",
+ "modelUuid":"${modelVersionId}",
+ "modelVersion":""
+ }"""
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+ }
+ catch (any)
+ {
+ String exceptionMessage = "Bpmn error encountered in deallocate nssi. Unexpected Error from method prepareDecomposeService() - " + any.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ LOGGER.debug(" ***** ${PREFIX} Exit prepareDecomposeService *****")
+ }
+
+ /**
+ * get vendor Info
+ * @param execution
+ */
+ void processDecomposition(DelegateExecution execution) {
+ LOGGER.debug("*****${PREFIX} start processDecomposition *****")
+
+ try {
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") as ServiceDecomposition
+ ServiceArtifact serviceArtifact = serviceDecomposition ?.getServiceInfo()?.getServiceArtifact()?.get(0)
+ String content = serviceArtifact.getContent()
+ String vendor = jsonUtil.getJsonValue(content, "metadata.vendor")
+ String domainType = jsonUtil.getJsonValue(content, "metadata.domainType")
+
+ def currentNSSI = execution.getVariable("currentNSSI")
+ currentNSSI['vendor'] = vendor
+ currentNSSI['domainType'] = domainType
+ LOGGER.info("processDecomposition, current vendor-domainType:" +String.join("-", vendor, domainType))
+
+ } catch (any) {
+ String exceptionMessage = "Bpmn error encountered in deallocate nssi. processDecomposition() - " + any.getMessage()
+ LOGGER.debug(exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ LOGGER.debug("*****${PREFIX} Exit processDecomposition *****")
+ }
+
+ /**
+ * send deallocate request to nssmf
+ * @param execution
+ */
+ void sendRequestToNSSMF(DelegateExecution execution)
+ {
+ LOGGER.debug("*****${PREFIX} start sendRequestToNSSMF *****")
+ def currentNSSI = execution.getVariable("currentNSSI")
+ String snssai= currentNSSI['snssai']
+ String profileId = currentNSSI['profileId']
+ String nssiId = currentNSSI['nssiServiceInstanceId']
+ String nsiId = currentNSSI['nsiServiceInstanceId']
+
+ DeAllocateNssi deAllocateNssi = new DeAllocateNssi()
+ deAllocateNssi.setNsiId(nsiId)
+ deAllocateNssi.setNssiId(nssiId)
+ deAllocateNssi.setTerminateNssiOption(0)
+ deAllocateNssi.setSnssaiList(Arrays.asList(snssai))
+
+ NssiDeAllocateRequest deAllocateRequest = new NssiDeAllocateRequest()
+ deAllocateRequest.setDeAllocateNssi(deAllocateNssi)
+ deAllocateRequest.setEsrInfo(getEsrInfo(currentNSSI))
+
+ ObjectMapper mapper = new ObjectMapper()
+ String json = mapper.writeValueAsString(deAllocateRequest)
+
+ //Prepare auth for NSSMF - Begin
+ String nssmfRequest = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution)
+ nssmfRequest = nssmfRequest + String.format("/api/rest/provMns/v1/NSS/SliceProfiles/%s",profileId)
+ //nssmfRequest = nssmfRequest + String.format(NssmfAdapterUtil.NSSMI_DEALLOCATE_URL,profileId)
+ //send request to active NSSI TN option
+ URL url = new URL(nssmfRequest)
+ LOGGER.info("deallocate nssmfRequest:${nssmfRequest}, reqBody: ${json}")
+
+ HttpClient httpClient = getHttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL)
+ Response httpResponse = httpClient.post(json)
+ checkNssmfResponse(httpResponse, execution)
+
+ NssiResponse nssmfResponse = httpResponse.readEntity(NssiResponse.class)
+ currentNSSI['jobId']= nssmfResponse.getJobId() ?: ""
+ currentNSSI['jobProgress'] = 0
+ execution.setVariable("currentNSSI", currentNSSI)
+
+ LOGGER.debug("*****${PREFIX} Exit sendRequestToNSSMF *****")
+ }
+
+ /**
+ * send to nssmf query progress
+ * @param execution
+ */
+ void getJobStatus(DelegateExecution execution)
+ {
+ def currentNSSI = execution.getVariable("currentNSSI")
+ String jobId = currentNSSI['jobId']
+ String nssiId = currentNSSI['nssiServiceInstanceId']
+ String nsiId = currentNSSI['nsiServiceInstanceId']
+
+ JobStatusRequest jobStatusRequest = new JobStatusRequest()
+ jobStatusRequest.setNssiId(nssiId)
+ jobStatusRequest.setNsiId(nsiId)
+ jobStatusRequest.setEsrInfo(getEsrInfo(currentNSSI))
+
+ ObjectMapper mapper = new ObjectMapper()
+ String json = mapper.writeValueAsString(jobStatusRequest)
+
+ //Prepare auth for NSSMF - Begin
+ String nssmfRequest = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution)
+ nssmfRequest = nssmfRequest + String.format("/api/rest/provMns/v1/NSS/jobs/%s",jobId)
+ //send request to active NSSI TN option
+ URL url = new URL(nssmfRequest)
+ LOGGER.info("get deallocate job status, nssmfRequest:${nssmfRequest}, requestBody: ${json}")
+
+ HttpClient httpClient = getHttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL)
+ Response httpResponse = httpClient.post(json)
+ checkNssmfResponse(httpResponse, execution)
+
+ JobStatusResponse jobStatusResponse = httpResponse.readEntity(JobStatusResponse.class)
+ def progress = jobStatusResponse?.getResponseDescriptor()?.getProgress()
+ if(!progress)
+ {
+ LOGGER.error("job progress is null or empty!")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Job progress from NSSMF.")
+ }
+ int oldProgress = currentNSSI['jobProgress']
+ int currentProgress = progress
+
+ execution.setVariable("isNSSIDeAllocated", (currentProgress == 100))
+ execution.setVariable("isNeedUpdateDB", (oldProgress != currentProgress))
+ currentNSSI['jobProgress'] = currentProgress
+
+ def statusDescription = jobStatusResponse?.getResponseDescriptor()?.getStatusDescription()
+ currentNSSI['statusDescription'] = statusDescription
+
+ LOGGER.debug("job status result: nsiId = ${nsiId}, nssiId=${nssiId}, oldProgress=${oldProgress}, progress = ${currentProgress}" )
+ }
+
+ private void checkNssmfResponse(Response httpResponse, DelegateExecution execution) {
+ int responseCode = httpResponse.getStatus()
+ LOGGER.debug("NSSMF response code is: " + responseCode)
+
+ if ( responseCode < 200 || responseCode > 204 || !httpResponse.hasEntity()) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Response from NSSMF.")
+ }
+ }
+
+
+ private EsrInfo getEsrInfo(def currentNSSI)
+ {
+ String domaintype = currentNSSI['domainType']
+ String vendor = currentNSSI['vendor']
+
+ EsrInfo info = new EsrInfo()
+ info.setNetworkType(NetworkType.fromString(domaintype))
+ info.setVendor(vendor)
+ return info
+ }
+
+ /**
+ * handle job status
+ * prepare update requestdb
+ * @param execution
+ */
+ void handleJobStatus(DelegateExecution execution)
+ {
+ def currentNSSI = execution.getVariable("currentNSSI")
+ int currentProgress = currentNSSI["jobProgress"]
+ def proportion = currentNSSI['proportion']
+ def statusDes = currentNSSI["statusDescription"]
+ int progress = (currentProgress as int) == 0 ? 0 : (currentProgress as int) / 100 * (proportion as int)
+
+ OperationStatus operationStatus = new OperationStatus()
+ operationStatus.setServiceId(currentNSSI['e2eServiceInstanceId'] as String)
+ operationStatus.setOperationId(currentNSSI['operationId'] as String)
+ operationStatus.setOperation("DELETE")
+ operationStatus.setResult("processing")
+ operationStatus.setProgress(progress as String)
+ operationStatus.setOperationContent(statusDes as String)
+ requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus)
+ LOGGER.debug("update operation, currentProgress=${currentProgress}, proportion=${proportion}, progress = ${progress}" )
+ }
+
+ void timeDelay(DelegateExecution execution) {
+ try {
+ Thread.sleep(10000);
+ } catch(InterruptedException e) {
+ LOGGER.error("Time Delay exception" + e)
+ }
+ }
+
+ /**
+ * delete slice profile from aai
+ * @param execution
+ */
+ void delSliceProfileFromAAI(DelegateExecution execution)
+ {
+ LOGGER.debug("*****${PREFIX} start delSliceProfileFromAAI *****")
+ def currentNSSI = execution.getVariable("currentNSSI")
+ String nssiServiceInstanceId = currentNSSI['nssiServiceInstanceId']
+ String profileId = currentNSSI['profileId']
+ String globalSubscriberId = currentNSSI["globalSubscriberId"]
+ String serviceType = currentNSSI["serviceType"]
+
+ try
+ {
+ LOGGER.debug("delete nssiServiceInstanceId:${nssiServiceInstanceId}, profileId:${profileId}")
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, globalSubscriberId, serviceType, nssiServiceInstanceId, profileId)
+ if (!getAAIClient().exists(resourceUri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
+ }
+ getAAIClient().delete(resourceUri)
+ }
+ catch (any)
+ {
+ String msg = "delete slice profile from aai failed! cause-"+any.getCause()
+ LOGGER.error(any.printStackTrace())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ LOGGER.debug("*****${PREFIX} Exist delSliceProfileFromAAI *****")
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
index 09eb7994a8..89c5be8d6e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
@@ -45,7 +45,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.constants.Defaults
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy
new file mode 100644
index 0000000000..76086dab49
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy
@@ -0,0 +1,320 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.AllottedResource
+import org.onap.aai.domain.yang.AllottedResources
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aai.domain.yang.SliceProfiles
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import javax.ws.rs.NotFoundException
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+/**
+ * This groovy class supports the <class>DoDeleteSliceService.bpmn</class> process.
+ *
+ * Inputs:
+ * @param - msoRequestId
+ * @param - globalSubscriberId - O
+ * @param - subscriptionServiceType - O
+ * @param - serviceInstanceId
+ *
+ */
+class DoDeleteSliceService extends AbstractServiceTaskProcessor {
+ private final String PREFIX ="DoDeleteSliceService"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ private static final Logger LOGGER = LoggerFactory.getLogger( DoDeleteSliceService.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ LOGGER.debug(" *****${PREFIX} preProcessRequest *****")
+ String msg = ""
+
+ try {
+ //String requestId = execution.getVariable("msoRequestId")
+ execution.setVariable("prefix",PREFIX)
+
+ //Inputs
+ //requestDetails.subscriberInfo. for AAI GET & PUT
+ execution.getVariable("globalSubscriberId") ?: execution.setVariable("globalSubscriberId", "")
+
+ //requestDetails.requestParameters. for AAI PUT
+ execution.getVariable("serviceType") ?: execution.setVariable("serviceType", "")
+
+ //Generated in parent for AAI PUT
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ if (isBlank(serviceInstanceId)){
+ msg = "Input serviceInstanceId is null"
+ LOGGER.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex){
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ LOGGER.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ LOGGER.debug("*****${PREFIX} Exit preProcessRequest *****")
+ }
+
+ /**
+ * query E2ESliceService from AAI
+ * save snssai
+ * @param execution
+ */
+ void queryE2ESliceSeriveFromAAI(DelegateExecution execution)
+ {
+ LOGGER.trace(" *****${PREFIX} Start queryE2ESliceSeriveFromAAI *****")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+
+ String errorMsg = "query e2e slice service from aai failed"
+ AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, serviceInstanceId, errorMsg)
+ Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class)
+ if(si.isPresent())
+ {
+ String snssai = si.get()?.getEnvironmentContext()
+ execution.setVariable("snssai", snssai ?: "")
+ LOGGER.info("serviceInstanceId: ${serviceInstanceId}, snssai: ${snssai}")
+ }
+ LOGGER.trace(" *****${PREFIX} Exit queryE2ESliceSeriveFromAAI *****")
+ }
+
+ /**
+ * get allotted resource from AAI
+ * save nsi id
+ * @param execution
+ */
+ void getAllottedResFromAAI(DelegateExecution execution)
+ {
+ LOGGER.trace(" *****${PREFIX} Start getAllottedResFromAAI *****")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ try
+ {
+ String errorMsg = "query allotted resource from aai failed."
+ AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.ALLOTTED_RESOURCE_ALL, serviceInstanceId, errorMsg)
+ Optional<AllottedResources> ars = wrapper?.asBean(AllottedResources.class)
+ if(ars.isPresent() && ars.get().getAllottedResource())
+ {
+ List<AllottedResource> allottedResourceList = ars.get().getAllottedResource()
+ AllottedResource ar = allottedResourceList.first()
+ String relatedLink = ar?.getRelationshipList()?.getRelationship()?.first()?.getRelatedLink()
+ String nsiId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : ""
+ execution.setVariable("nsiId", nsiId)
+ LOGGER.info("serviceInstanceId: ${serviceInstanceId}, nsiId:${nsiId}")
+ }
+ }
+ catch(BpmnError e){
+ throw e
+ }
+ catch (Exception ex){
+ String msg = "Exception in getAllottedResFromAAI " + ex.getMessage()
+ LOGGER.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ LOGGER.trace(" *****${PREFIX} Exit getAllottedResFromAAI *****")
+ }
+
+ /**
+ * get nsi service instance from aai
+ * save nssi id
+ * @param execution
+ */
+ void getNSIFromAAI(DelegateExecution execution)
+ {
+ LOGGER.trace(" *****${PREFIX} Start getNSIFromAAI *****")
+ String nsiId = execution.getVariable("nsiId")
+ try
+ {
+ String errorMsg = "query nsi from aai failed."
+ AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, nsiId, errorMsg)
+ Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class)
+ List<String> nssiIdList = []
+ String msg = "nsiId:${nsiId},nssiIdList:"
+ if(si.isPresent())
+ {
+ List<Relationship> relationshipList = si.get().getRelationshipList()?.getRelationship()
+ for (Relationship relationship : relationshipList)
+ {
+ String relatedTo = relationship.getRelatedTo()
+ if (relatedTo == "service-instance")
+ {
+ String relatedLink = relationship.getRelatedLink()?:""
+ String nssiId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : ""
+ nssiIdList.add(nssiId)
+ msg+="${nssiId}, "
+ }
+ }
+ }
+ LOGGER.info(msg)
+ execution.setVariable("nssiIdList", nssiIdList)
+ }
+ catch(BpmnError e){
+ throw e
+ }
+ catch (Exception ex){
+ String msg = "Exception in getNSIFromAAI " + ex.getMessage()
+ LOGGER.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ LOGGER.trace(" *****${PREFIX} Exit getNSIFromAAI *****")
+ }
+
+ /**
+ * get nssi service from AAI
+ * prepare list
+ * @param execution
+ */
+ void getNSSIListFromAAI(DelegateExecution execution)
+ {
+ LOGGER.trace("*****${PREFIX} Start getNSSIListFromAAI *****")
+ List<String> nssiIdList = execution.getVariable("nssiIdList")
+ List<ServiceInstance> nssiInstanceList = []
+ String errorMsg = "query nssi list from aai failed"
+ for(String nssiId : nssiIdList)
+ {
+ AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SERVICE_INSTANCE, nssiId, errorMsg)
+ Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class)
+ if(si.isPresent())
+ {
+ nssiInstanceList.add(si.get())
+ }
+ }
+ int size = nssiInstanceList.size()
+ int proportion = size >0 ?((90/size) as int) : 90
+ execution.setVariable("nssiInstanceList", nssiInstanceList)
+ execution.setVariable("currentNSSIIndex", 0)
+ execution.setVariable("proportion", proportion)
+ String msg ="nssiInstanceList size: ${nssiInstanceList.size()}, proportion:${proportion}"
+ LOGGER.info(msg)
+ LOGGER.trace(" *****${PREFIX} Exit getNSSIListFromAAI *****")
+ }
+
+ /**
+ * get current NSSI
+ * @param execution
+ */
+ void getCurrentNSSI(DelegateExecution execution)
+ {
+ LOGGER.trace(" *****${PREFIX} Start getCurrentNSSI *****")
+ List<ServiceInstance> nssiInstanceList = execution.getVariable("nssiInstanceList")
+ int currentIndex = execution.getVariable("currentNSSIIndex") as int
+ ServiceInstance nssi = nssiInstanceList?.get(currentIndex)
+ def currentNSSI = [:]
+ currentNSSI['nssiServiceInstanceId'] = nssi?.getServiceInstanceId()
+ currentNSSI['modelInvariantId'] = nssi?.getModelInvariantId()
+ currentNSSI['modelVersionId'] = nssi?.getModelVersionId()
+ currentNSSI['snssai'] = execution.getVariable("snssai") ?: ""
+ currentNSSI['nsiServiceInstanceId'] = execution.getVariable("nsiId") ?: ""
+ currentNSSI['operationId'] = execution.getVariable("operationId") ?: ""
+ currentNSSI['e2eServiceInstanceId'] = execution.getVariable("serviceInstanceId") ?: ""
+ currentNSSI['msoRequestId'] = execution.getVariable("msoRequestId") ?: ""
+ currentNSSI['globalSubscriberId'] = execution.getVariable("globalSubscriberId") ?: ""
+ currentNSSI['serviceType'] = execution.getVariable("serviceType") ?: ""
+ currentNSSI['serviceModelInfo'] = execution.getVariable("serviceModelInfo") ?: ""
+ currentNSSI['proportion'] = (execution.getVariable("proportion") as int)*(currentIndex+1)
+ execution.setVariable("currentNSSI", currentNSSI)
+ String msg = "Now we deal with nssiServiceInstanceId: ${currentNSSI['nssiServiceInstanceId']}, current Index: ${currentIndex}, current proportion:${currentNSSI['proportion']}"
+ LOGGER.info(msg)
+ LOGGER.trace(" *****${PREFIX} Exit getCurrentNSSI *****")
+ }
+
+ /**
+ * parse next nssi
+ * @param execution
+ */
+ void parseNextNSSI(DelegateExecution execution)
+ {
+ LOGGER.trace(" *****${PREFIX} Start parseNextNSSI *****")
+ if(execution.getVariable("WorkflowException") != null){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "current job failure!")
+ }
+ def currentIndex = execution.getVariable("currentNSSIIndex")
+ List<ServiceInstance> nssiInstanceList = execution.getVariable("nssiInstanceList")
+ def nextIndex = ++currentIndex
+ LOGGER.info("nextIndex: ${nextIndex}")
+ if(nextIndex >= nssiInstanceList.size()){
+ execution.setVariable("isAllNSSIFinished", "true")
+ }else{
+ execution.setVariable("isAllNSSIFinished", "false")
+ execution.setVariable("currentNSSIIndex", nextIndex)
+ }
+ LOGGER.trace(" *****${PREFIX} Exit parseNextNSSI *****")
+ }
+
+
+ /**
+ * query sliceProfile from AAI
+ * save profileId
+ * @param execution
+ */
+ void querySliceProfileFromAAI(DelegateExecution execution)
+ {
+ LOGGER.trace(" *****${PREFIX} Start querySliceProfileFromAAI *****")
+ def currentNSSI = execution.getVariable("currentNSSI")
+ String nssiId = currentNSSI['nssiServiceInstanceId']
+ String errorMsg = "query slice profile failed"
+ AAIResultWrapper wrapper = queryAAI(execution, AAIObjectType.SLICE_PROFILE_ALL, nssiId, errorMsg)
+ Optional<SliceProfiles> sliceProfiles =wrapper.asBean(SliceProfiles.class)
+ if(sliceProfiles.isPresent())
+ {
+ String profileId = sliceProfiles.get().getSliceProfile()?.get(0)?.getProfileId()
+ currentNSSI['profileId'] = profileId ?: ""
+ LOGGER.info("nssiId: ${nssiId}, profileId: ${profileId}")
+ }
+ execution.setVariable("currentNSSI", currentNSSI)
+ LOGGER.trace(" *****${PREFIX} Exit querySliceProfileFromAAI *****")
+ }
+
+ /**
+ * query AAI
+ * @param execution
+ * @param aaiObjectType
+ * @param instanceId
+ * @return AAIResultWrapper
+ */
+ private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectType aaiObjectType, String instanceId, String errorMsg)
+ {
+ LOGGER.trace(" *****${PREFIX} Start queryAAI *****")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String serviceType = execution.getVariable("serviceType")
+
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(aaiObjectType, globalSubscriberId, serviceType, instanceId)
+ if (!getAAIClient().exists(resourceUri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, errorMsg)
+ }
+ AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class)
+ LOGGER.trace(" *****${PREFIX} Exit queryAAI *****")
+ return wrapper
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
index 4c8247a309..002e283790 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
@@ -25,7 +25,7 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.logger.LoggingAnchor
import org.onap.aai.domain.yang.NetworkPolicies
import org.onap.aai.domain.yang.NetworkPolicy
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import javax.xml.parsers.DocumentBuilder
import javax.xml.parsers.DocumentBuilderFactory
@@ -41,6 +41,7 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
@@ -489,7 +490,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
for (i in 0..fqdnCount-1) {
String fqdn = fqdnList[i]
// Query AAI for this network policy FQDN
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", fqdn)
try {
Optional<NetworkPolicies> networkPolicies = getAAIClient().get(NetworkPolicies.class, uri)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
index eba43632a7..34a210364a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
@@ -27,7 +27,7 @@ import org.onap.aai.domain.yang.GenericVnf
import org.onap.aai.domain.yang.NetworkPolicies
import org.onap.aai.domain.yang.NetworkPolicy
import org.onap.aai.domain.yang.VfModule
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import static org.apache.commons.lang3.StringUtils.*
import org.camunda.bpm.engine.delegate.BpmnError
@@ -43,6 +43,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
@@ -513,7 +514,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
// Query AAI for this network policy FQDN
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", fqdn)
try {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
index 20d250d89f..ff58fd567d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy
@@ -45,7 +45,7 @@ import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.aai.AAIObjectType
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy
index 231fe6e252..4eba33dc7d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy
@@ -22,7 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.logger.LoggingAnchor
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import static org.apache.commons.lang3.StringUtils.*;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy
index 367975e003..16e1241750 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy
@@ -34,7 +34,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.camunda.bpm.engine.delegate.BpmnError
import com.fasterxml.jackson.databind.ObjectMapper
import org.onap.so.client.HttpClientFactory
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import javax.ws.rs.core.Response
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy
new file mode 100644
index 0000000000..5acc016c7b
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy
@@ -0,0 +1,463 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.logging.filter.base.ONAPComponents
+import org.onap.so.beans.nsmf.*
+import org.onap.so.bpmn.common.scripts.*
+import org.onap.so.bpmn.common.util.OofInfraUtils
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.domain.ServiceArtifact
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.logging.filter.base.ErrorCode
+import org.onap.so.logger.LoggingAnchor
+import org.onap.so.logger.MessageEnum
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.springframework.web.util.UriUtils
+
+import javax.ws.rs.core.Response
+import java.lang.reflect.Type
+
+/**
+ * This class supports the DoCreateVnf building block subflow
+ * with the creation of a generic vnf for
+ * infrastructure.
+ *
+ */
+class DoSendCommandToNSSMF extends AbstractServiceTaskProcessor {
+
+ private static final Logger logger = LoggerFactory.getLogger( DoSendCommandToNSSMF.class);
+ String Prefix="DoCNSSMF_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ VidUtils vidUtils = new VidUtils(this)
+ SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
+ OofInfraUtils oofInfraUtils = new OofInfraUtils()
+
+ /**
+ * This method gets and validates the incoming
+ * request.
+ *
+ * @param - execution
+ *
+ */
+ public void preProcessRequest(DelegateExecution execution) {
+
+ execution.setVariable("prefix",Prefix)
+ logger.debug("STARTED Do sendcommandtoNssmf PreProcessRequest Process")
+
+ /*******************/
+ try{
+ // Get Variables
+ String e2eserviceInstanceId = execution.getVariable("e2eserviceInstanceId")
+ String serviceInstanceId = execution.getVariable("e2eserviceInstanceId")
+ execution.setVariable("e2eserviceInstanceId", e2eserviceInstanceId)
+ execution.setVariable("serviceInstanceId", serviceInstanceId)
+ logger.debug("Incoming e2eserviceInstanceId is: " + e2eserviceInstanceId)
+
+ String NSIserviceid = execution.getVariable("NSIserviceid")
+ execution.setVariable("NSIserviceid", NSIserviceid)
+ logger.debug("Incoming NSI id is: " + NSIserviceid)
+
+
+ String nssiMap = execution.getVariable("nssiMap")
+ Type type = new TypeToken<HashMap<String, NSSI>>(){}.getType()
+ Map<String, NSSI> DonssiMap = new Gson().fromJson(nssiMap,type)
+ String strDonssiMap = mapToJsonStr(DonssiMap)
+ execution.setVariable("DonssiMap",strDonssiMap)
+ logger.debug("Incoming DonssiMap is: " + strDonssiMap)
+
+ String requestId = execution.getVariable("msoRequestId")
+ execution.setVariable("msoRequestId", requestId)
+
+ String operationType = execution.getVariable("operationType")
+ execution.setVariable("operationType", operationType)
+ logger.debug("Incoming operationType is: " + operationType)
+
+ if (operationType == "activation") {
+ execution.setVariable("activationSequence","an,tn,cn")
+ }else {
+ execution.setVariable("activationSequence","cn,tn,an")
+ }
+ execution.setVariable("activationIndex",0)
+ execution.setVariable("miniute", "0")
+ execution.setVariable("activateNumberSlice",0)
+
+ logger.info("the end !!")
+ }catch(BpmnError b){
+ logger.debug("Rethrowing MSOWorkflowException")
+ throw b
+ }catch(Exception e){
+ logger.info("the end of catch !!")
+ logger.debug(" Error Occured in DoSendCommandToNSSMF PreProcessRequest method!" + e.getMessage())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoSendCommandToNSSMF PreProcessRequest")
+
+ }
+ logger.trace("COMPLETED DoSendCommandToNSSMF PreProcessRequest Process")
+ }
+ private String mapToJsonStr(Map<String, NSSI> stringNSSIHashMap) {
+ HashMap<String, NSSI> map = new HashMap<String, NSSI>()
+ for(Map.Entry<String, NSSI> child:stringNSSIHashMap.entrySet())
+ {
+ map.put(child.getKey(), child.getValue())
+ }
+ return new Gson().toJson(map)
+ }
+ public void getNSSIformlist(DelegateExecution execution) {
+
+ String nssiMap = execution.getVariable("DonssiMap")
+ Type type = new TypeToken<HashMap<String, NSSI>>(){}.getType()
+ Map<String, NSSI> DonssiMap = new Gson().fromJson(nssiMap,type)
+ String isNSSIActivate = execution.getVariable("isNSSIActivate")
+
+ String activationSequence01 = execution.getVariable("activationSequence")
+ String[] strlist = activationSequence01.split(",")
+
+ int activationIndex = execution.getVariable("activationIndex")
+ int indexcurrent = 0
+ if (isNSSIActivate == "true")
+ {
+ execution.setVariable("isGetSuccessfull", "false")
+ }else{for (int index = activationIndex; index < 3;index++) {
+ String domaintype01 = strlist[index]
+ if (DonssiMap.containsKey(domaintype01)) {
+ NSSI nssiobject = DonssiMap.get(domaintype01)
+ execution.setVariable("domainType", domaintype01)
+ execution.setVariable("nssiId", nssiobject.getNssiId())
+ execution.setVariable("modelInvariantUuid", nssiobject.getModelInvariantId())
+ execution.setVariable("modelUuid", nssiobject.getModelVersionId())
+ execution.setVariable("isGetSuccessfull", "true")
+ String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+ String modelUuid = execution.getVariable("modelUuid")
+ //here modelVersion is not set, we use modelUuid to decompose the service.
+ String serviceModelInfo = """{
+ "modelInvariantUuid":"${modelInvariantUuid}",
+ "modelUuid":"${modelUuid}",
+ "modelVersion":""
+ }"""
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+ indexcurrent = index
+ execution.setVariable("activationIndex", indexcurrent)
+ break
+ }else
+ {
+ indexcurrent = index + 1
+
+ }
+ }
+ if ( activationIndex > 2) {
+ execution.setVariable("isGetSuccessfull", "false")
+ }
+ execution.setVariable("activationIndex", indexcurrent)}
+
+ }
+ /**
+ * get vendor Info
+ * @param execution
+ */
+ private void processDecomposition(DelegateExecution execution) {
+ logger.debug("***** processDecomposition *****")
+
+ try {
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") as ServiceDecomposition
+ ServiceArtifact serviceArtifact = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0)
+ String content = serviceArtifact.getContent()
+ String vendor = jsonUtil.getJsonValue(content, "metadata.vendor")
+ //String domainType = jsonUtil.getJsonValue(content, "metadata.domainType")
+
+ execution.setVariable("vendor", vendor)
+ // currentNSSI['domainType'] = domainType
+ logger.info("processDecomposition, current vendor-domainType:" + vendor)
+
+ } catch (any) {
+ String exceptionMessage = "Bpmn error encountered in deallocate nssi. processDecomposition() - " + any.getMessage()
+ logger.debug(exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ logger.debug("***** Exit processDecomposition *****")
+ }
+ public void UpdateIndex(DelegateExecution execution) {
+ def activationIndex = execution.getVariable("activationIndex")
+ int activateNumberSlice = execution.getVariable("activateNumberSlice") as Integer
+ def activationCount= execution.getVariable("activationCount")
+ //DecimalFormat df1 = new DecimalFormat("##%")
+ int rate = (activateNumberSlice / activationCount) * 100
+ if (rate == 100)
+ {
+ execution.setVariable("isNSSIActivate","true")
+ }
+ else{
+ execution.setVariable("isNSSIActivate","false")
+ }
+ activationIndex = activationIndex + 1
+ execution.setVariable("activationIndex",activationIndex)
+ logger.trace("the Progress of activation is " + rate.toString() + "%" )
+ try{
+ String serviceId = execution.getVariable("serviceInstanceId")
+ String operationId = UUID.randomUUID().toString()
+ String operationType = execution.getVariable("operationType")
+ String userId = ""
+ String result = (operationType.equals("activation"))? "ACTIVATING": "DEACTIVATING"
+ int progress = rate
+ String reason = ""
+ String operationContent = "Service activation in progress"
+ logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId)
+ serviceId = UriUtils.encode(serviceId,"UTF-8")
+ execution.setVariable("e2eserviceInstanceId", serviceId)
+ execution.setVariable("operationId", operationId)
+ execution.setVariable("operationType", operationType)
+
+ def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution)
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+ logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.onap.so/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
+ <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
+ <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
+ <operationType>${MsoUtils.xmlEscape(operationType)}</operationType>
+ <userId>${MsoUtils.xmlEscape(userId)}</userId>
+ <result>${MsoUtils.xmlEscape(result)}</result>
+ <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent>
+ <progress>${MsoUtils.xmlEscape(progress)}</progress>
+ <reason>${MsoUtils.xmlEscape(reason)}</reason>
+ </ns:initServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ payload = utils.formatXml(payload)
+ execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
+ logger.debug("Outgoing CVFMI_updateServiceOperStatusRequest: \n" + payload)
+
+ }catch(Exception e){
+ logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing Activate Slice .", "BPMN",
+ ErrorCode.UnknownError.getValue(), "Exception is:\n" + e)
+ execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during Activate Slice Method:\n" + e.getMessage())
+ }
+ logger.trace("finished Activate Slice")
+ }
+ public void WaitForReturn(DelegateExecution execution) {
+ //logger.debug("Query : "+ Jobid)
+ def miniute=execution.getVariable("miniute")
+ Thread.sleep(10000)
+ int miniute01 = Integer.parseInt(miniute) + 1
+ logger.debug("waiting for : "+ miniute + "miniutes")
+ execution.setVariable("miniute", String.valueOf(miniute01))
+ }
+ public void GetTheStatusOfActivation(DelegateExecution execution) {
+
+ String snssai= execution.getVariable("snssai")
+ String domaintype = execution.getVariable("domainType")
+ String NSIserviceid=execution.getVariable("NSIserviceid")
+ String nssiId = execution.getVariable("nssiId")
+ String Jobid=execution.getVariable("JobId")
+ def miniute=execution.getVariable("miniute")
+ String vendor = execution.getVariable("vendor")
+ String jobstatus ="error"
+
+
+ logger.debug("Query the jobid activation of SNSSAI: "+ Jobid)
+ logger.debug("the domain is : "+ domaintype)
+ logger.debug("the NSSID is : "+nssiId)
+ logger.debug("the NSIserviceid is : "+NSIserviceid)
+
+ JobStatusRequest jobStatusRequest = new JobStatusRequest()
+
+ EsrInfo info = new EsrInfo()
+ info.setNetworkType(NetworkType.fromString(domaintype))
+ info.setVendor(vendor)
+
+ jobStatusRequest.setNsiId(NSIserviceid)
+ jobStatusRequest.setNssiId(nssiId)
+ jobStatusRequest.setEsrInfo(info)
+
+
+ ObjectMapper mapper = new ObjectMapper()
+ String Reqjson = mapper.writeValueAsString(jobStatusRequest)
+ String isActivateSuccessfull=false
+
+ String urlString = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution)
+ String nssmfRequest = urlString + "/api/rest/provMns/v1/NSS/jobs/" +Jobid
+
+ //send request to active NSSI TN option
+ URL url = new URL(nssmfRequest)
+
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL)
+ Response httpResponse = httpClient.post(Reqjson)
+
+ int responseCode = httpResponse.getStatus()
+ logger.debug("NSSMF activation response code is: " + responseCode)
+
+ if (responseCode == 404) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad job status Response from NSSMF.")
+ isActivateSuccessfull = false
+ execution.setVariable("isActivateSuccessfull", isActivateSuccessfull)
+ jobstatus="error"
+ }else if(responseCode == 200) {
+ if (httpResponse.hasEntity()) {
+ JobStatusResponse jobStatusResponse = httpResponse.readEntity(JobStatusResponse.class)
+ execution.setVariable("statusDescription", jobStatusResponse.getResponseDescriptor().getStatusDescription())
+ jobstatus = jobStatusResponse.getResponseDescriptor().getStatus()
+ switch(jobstatus) {
+ case "started":
+ case "processing":
+ isActivateSuccessfull = "waitting"
+ execution.setVariable("isActivateSuccessfull", isActivateSuccessfull)
+ break
+ case "finished":
+ isActivateSuccessfull = "true"
+ execution.setVariable("isActivateSuccessfull", isActivateSuccessfull)
+ execution.setVariable("activateNumberSlice",execution.getVariable("activateNumberSlice")+ 1)
+ break
+ case "error":
+ default:
+ isActivateSuccessfull = "false"
+ execution.setVariable("isActivateSuccessfull", isActivateSuccessfull)
+
+ }
+ if(Integer.parseInt(miniute) > 6 )
+ {
+ isActivateSuccessfull = "false"
+ execution.setVariable("isActivateSuccessfull", isActivateSuccessfull)
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a timeout job status Response from NSSMF.")
+ }
+ }else
+ {
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad job status Response from NSSMF.")
+ isActivateSuccessfull = false
+ execution.setVariable("isActivateSuccessfull", isActivateSuccessfull)
+ }
+ } else {
+ isActivateSuccessfull = false
+ execution.setVariable("isActivateSuccessfull", isActivateSuccessfull)
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad job status Response from NSSMF.")
+ }
+ }
+ public void SendCommandToNssmf(DelegateExecution execution) {
+
+ String snssai= execution.getVariable("snssai")
+ String domaintype = execution.getVariable("domainType")
+ String NSIserviceid=execution.getVariable("NSIserviceid")
+ String nssiId = execution.getVariable("nssiId")
+ String vendor = execution.getVariable("vendor")
+
+
+ logger.debug("the domain is : "+domaintype)
+ logger.debug("SNSSAI: "+snssai +" will be activated")
+ logger.debug("the NSSID is : "+nssiId)
+ logger.debug("the NSIserviceid is : "+NSIserviceid)
+
+ EsrInfo esr = new EsrInfo();
+ esr.setNetworkType(NetworkType.fromString(domaintype))
+ esr.setVendor(vendor)
+
+ ActDeActNssi actNssi = new ActDeActNssi();
+ actNssi.setNsiId(NSIserviceid);
+ actNssi.setNssiId(nssiId);
+ NssiActDeActRequest actRequest = new NssiActDeActRequest();
+ actRequest.setActDeActNssi(actNssi);
+ actRequest.setEsrInfo(esr)
+
+ ObjectMapper mapper = new ObjectMapper();
+ String json = mapper.writeValueAsString(actRequest);
+
+
+ String urlString = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution)
+
+ //Prepare auth for NSSMF - Begin
+ def authHeader = ""
+ String basicAuth = UrnPropertiesReader.getVariable("mso.nssmf.auth", execution)
+ String operationType = execution.getVariable("operationType")
+
+ String nssmfRequest = urlString + "/api/rest/provMns/v1/NSS/" + snssai + "/" + operationType
+
+ //send request to active NSSI TN option
+ URL url = new URL(nssmfRequest)
+
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL)
+ Response httpResponse = httpClient.post(json)
+
+ int responseCode = httpResponse.getStatus()
+ logger.debug("NSSMF activate response code is: " + responseCode)
+ checkNssmfResponse(httpResponse, execution)
+
+ NssiResponse nssmfResponse = httpResponse.readEntity(NssiResponse.class)
+ String jobId = nssmfResponse.getJobId() ?: ""
+ execution.setVariable("JobId", jobId)
+
+ }
+ private void checkNssmfResponse(Response httpResponse, DelegateExecution execution) {
+ int responseCode = httpResponse.getStatus()
+ logger.debug("NSSMF response code is: " + responseCode)
+
+ if ( responseCode < 200 || responseCode > 202 || !httpResponse.hasEntity()) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Response from NSSMF.")
+ String isNSSIActivated = "false"
+ execution.setVariable("isNSSIActivated", isNSSIActivated)
+ execution.setVariable("isNSSIActivate","false")
+ }else{
+ String isNSSIActivated = "true"
+ execution.setVariable("isNSSIActivated", isNSSIActivated)
+ }
+ }
+
+
+ void sendSyncError (DelegateExecution execution) {
+ logger.trace("start sendSyncError")
+ try {
+ String errorMessage = ""
+ if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
+ WorkflowException wfe = execution.getVariable("WorkflowException")
+ errorMessage = wfe.getErrorMessage()
+ } else {
+ errorMessage = "Sending Sync Error."
+ }
+
+ String buildworkflowException =
+ """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
+ <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>"""
+
+ logger.debug(buildworkflowException)
+ sendWorkflowResponse(execution, 500, buildworkflowException)
+
+ } catch (Exception ex) {
+ logger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
+ }
+ logger.trace("finished sendSyncError")
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
index f7852431e5..ff63bc945b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
@@ -22,10 +22,10 @@
package org.onap.so.bpmn.infrastructure.scripts
-import org.onap.so.logger.LoggingAnchor
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.GenericVnf
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.CatalogDbUtils
import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
@@ -37,15 +37,14 @@ import org.onap.so.bpmn.common.scripts.VfModuleBase
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils;
-import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.AAIResultWrapper
-import org.onap.so.client.aai.entities.uri.AAIUri
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.constants.Defaults
-import org.onap.so.logger.ErrorCode
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -274,7 +273,7 @@ public class DoUpdateVfModule extends VfModuleBase {
}
try{
- AAIUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId)
+ AAIResourceUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId)
AAIResourcesClient aaiRC = new AAIResourcesClient()
AAIResultWrapper aaiRW = aaiRC.get(serviceInstanceURI)
Map<String, Object> aaiJson = aaiRW.asMap()
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
index cfdba89db7..7caa63ec72 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
@@ -24,7 +24,7 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.logger.LoggingAnchor
import org.onap.so.client.HttpClientFactory
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import javax.ws.rs.core.Response
import org.camunda.bpm.engine.delegate.BpmnError
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy
index e36f32578d..275cef0b0c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy
@@ -35,7 +35,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.*
import org.onap.so.client.appc.ApplicationControllerOrchestrator
import org.onap.so.client.appc.ApplicationControllerSupport
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy
index ed65616d89..d5bdb73b61 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/RollbackVnf.groovy
@@ -22,7 +22,7 @@
package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.logger.LoggingAnchor
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.ExceptionUtil
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy
index b21efdd563..b27ca4a956 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy
@@ -23,7 +23,7 @@
package org.onap.so.bpmn.infrastructure.scripts
import org.onap.so.logger.LoggingAnchor
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import static org.apache.commons.lang3.StringUtils.*
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy
index 6946eebc56..6e5ee01c9a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModule.groovy
@@ -29,7 +29,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy
index 2404169493..76702eab81 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy
@@ -30,7 +30,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy
index 3e9b934a2e..f1fbafc7de 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy
@@ -37,7 +37,7 @@ import org.onap.so.client.aai.entities.Relationships
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
index 7f2bbebc8d..5449ba6708 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
@@ -42,7 +42,7 @@ import org.onap.so.client.aai.entities.Relationships
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy
index 26a509022c..053e2b36d1 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy
@@ -35,7 +35,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.AAIRestClientImpl
import org.onap.so.client.aai.AAIUpdatorImpl
import org.onap.so.client.aai.AAIValidatorImpl
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy
index 09e7516f85..980128c848 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfCmBase.groovy
@@ -30,6 +30,7 @@ import org.onap.appc.client.lcm.model.Action
import org.onap.appc.client.lcm.model.ActionIdentifiers
import org.onap.appc.client.lcm.model.Flags
import org.onap.appc.client.lcm.model.Status
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
@@ -42,11 +43,9 @@ import org.onap.so.client.aai.*
import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.Relationships
import org.onap.so.client.aai.entities.uri.AAIResourceUri
-import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.appc.ApplicationControllerClient
import org.onap.so.client.appc.ApplicationControllerSupport
-import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -218,7 +217,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
logger.debug("cloudRegionId is: {}", cloudRegionId)
AAIResourcesClient client = new AAIResourcesClient()
- AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
// Check if this VNF exists
if (!client.exists(genericVnfUri)) {
logger.debug("VNF with vnfId {} does not exist in A&AI", vnfId)
@@ -436,7 +435,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
def vnfId = execution.getVariable("vnfId")
logger.debug("vnfId is: {}", vnfId)
AAIResourcesClient client = new AAIResourcesClient()
- AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
AAIResultWrapper aaiRW = client.get(genericVnfUri)
Map<String, Object> result = aaiRW.asMap()
boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false)
@@ -488,7 +487,7 @@ public abstract class VnfCmBase extends AbstractServiceTaskProcessor {
def transactionLoggingUuid = UUID.randomUUID().toString()
def vnfId = execution.getVariable("vnfId")
AAIResourcesClient client = new AAIResourcesClient()
- AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
Map<String, Boolean> request = new HashMap<>()
request.put("is-closed-loop-disabled", setDisabled)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy
index 90523a02be..70b7ec102b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy
@@ -21,22 +21,22 @@
package org.onap.so.bpmn.infrastructure.scripts
-import groovy.json.JsonOutput
-import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.appc.client.lcm.model.Action
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.*
import org.onap.so.client.aai.entities.AAIResultWrapper
-import org.onap.so.client.aai.entities.uri.AAIUri
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
public class VnfConfigUpdate extends VnfCmBase {
private static final Logger logger = LoggerFactory.getLogger( VnfConfigUpdate.class)
@@ -360,7 +360,7 @@ public class VnfConfigUpdate extends VnfCmBase {
def vnfId = execution.getVariable("vnfId")
logger.debug("vnfId is: {}", vnfId)
AAIResourcesClient client = new AAIResourcesClient()
- AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
AAIResultWrapper aaiRW = client.get(genericVnfUri)
Map<String, Object> result = aaiRW.asMap()
boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false)
@@ -412,7 +412,7 @@ public class VnfConfigUpdate extends VnfCmBase {
def transactionLoggingUuid = UUID.randomUUID().toString()
def vnfId = execution.getVariable("vnfId")
AAIResourcesClient client = new AAIResourcesClient()
- AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
Map<String, Boolean> request = new HashMap<>()
request.put("is-closed-loop-disabled", setDisabled)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
index 3cb40115ba..c5f117b35f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy
@@ -21,28 +21,28 @@
package org.onap.so.bpmn.infrastructure.scripts
-import org.onap.so.logger.LoggingAnchor
-import groovy.json.JsonOutput
-import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.appc.client.lcm.model.Action
import org.onap.appc.client.lcm.model.ActionIdentifiers
import org.onap.appc.client.lcm.model.Flags
import org.onap.appc.client.lcm.model.Status
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.*
import org.onap.so.client.aai.entities.AAIResultWrapper
-import org.onap.so.client.aai.entities.uri.AAIUri
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.appc.ApplicationControllerClient
import org.onap.so.client.appc.ApplicationControllerSupport
-import org.onap.so.logger.ErrorCode
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import groovy.json.JsonOutput
+import groovy.json.JsonSlurper
public class VnfInPlaceUpdate extends VnfCmBase {
private static final Logger logger = LoggerFactory.getLogger(VnfInPlaceUpdate.class)
@@ -380,7 +380,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
def vnfId = execution.getVariable("vnfId")
logger.debug("vnfId is: " + vnfId)
AAIResourcesClient client = new AAIResourcesClient()
- AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
AAIResultWrapper aaiRW = client.get(genericVnfUri)
Map<String, Object> result = aaiRW.asMap()
boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false)
@@ -431,7 +431,7 @@ public class VnfInPlaceUpdate extends VnfCmBase {
def transactionLoggingUuid = UUID.randomUUID().toString()
def vnfId = execution.getVariable("vnfId")
AAIResourcesClient client = new AAIResourcesClient()
- AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ AAIResourceUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
Map<String, Boolean> request = new HashMap<>()
request.put("is-closed-loop-disabled", setDisabled)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
index d57011f61f..6327ea233c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
@@ -22,7 +22,7 @@
package org.onap.so.bpmn.vcpe.scripts
import org.onap.so.logger.LoggingAnchor
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import static org.apache.commons.lang3.StringUtils.*
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
index 553ec2397c..5205fa1874 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
@@ -31,7 +31,7 @@ import org.onap.so.bpmn.common.scripts.NetworkUtils
import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy
index 0681e54bba..a4f7766c15 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy
@@ -22,7 +22,8 @@
package org.onap.so.bpmn.vcpe.scripts
-import org.onap.so.logger.LoggingAnchor
+import static org.apache.commons.lang3.StringUtils.isBlank
+import javax.ws.rs.core.UriBuilder
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.AllottedResource
@@ -35,16 +36,12 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
+import org.onap.so.logger.LoggingAnchor
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import javax.ws.rs.NotFoundException
-import javax.ws.rs.core.UriBuilder
-
-import static org.apache.commons.lang3.StringUtils.isBlank
-
/**
* This groovy class supports the <class>DoCreateAllottedResourceBRG.bpmn</class> process.
*
@@ -235,11 +232,10 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
AAIResourcesClient resourceClient = new AAIResourcesClient()
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId)
- try {
//just to make sure the serviceInstance exists
- uri.build()
+ if (resourceClient.exists(uri)) {
execution.setVariable("PSI_resourceLink", uri)
- } catch (NotFoundException e) {
+ } else {
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy
index f24bb46981..b5ddc57781 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy
@@ -31,7 +31,7 @@ import org.onap.so.bpmn.common.scripts.AllottedResourceUtils
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy
index 51d04dd092..fc50d3a3b3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy
@@ -34,7 +34,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy
index 1427730187..80e5831fbe 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy
@@ -29,7 +29,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy
index 29ee1a648e..117078992f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy
@@ -32,7 +32,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy
index 404f19eca9..b029a4686b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy
@@ -32,7 +32,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.logger.ErrorCode
+import org.onap.logging.filter.base.ErrorCode
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java
index fab3496559..3ea8b190ad 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java
@@ -35,8 +35,10 @@ public class ExecutionVariableNames {
public final static String TIMEOUT_FOR_NOTIFICATION = "timeoutForPnfEntryNotification";
public final static String PNF_UUID = "pnfUuid";
public final static String SERVICE_INSTANCE_ID = "serviceInstanceId";
+ public final static String REQUEST_ID = "requestId";
public final static String MSO_REQUEST_ID = "msoRequestId";
public final static String MODEL_UUID = "modelUuid";
+ public final static String REQUEST_PAYLOAD = "requestPayload";
public final static String SERVICE_MODEL_INFO = "serviceModelInfo";
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/NfSoftwareUpgradeDispatcher.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/NfSoftwareUpgradeDispatcher.java
new file mode 100644
index 0000000000..6c140061c0
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/NfSoftwareUpgradeDispatcher.java
@@ -0,0 +1,168 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.so.bpmn.core.json.JsonUtils;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.*;
+
+/**
+ * This implementation of {@link JavaDelegate} is used to populate the execution object for pnf software upgrade
+ */
+@Component
+public class NfSoftwareUpgradeDispatcher implements JavaDelegate {
+
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+ private static final String SERVICE_INSTANCE_NAME = "serviceInstanceName";
+ private static final String BPMN_REQUEST = "bpmnRequest";
+ private static final String RESOURCE_CUSTOMIZATION_UUID_PARAM = "resource_customization_uuid";
+ private static final String PNF_NAME = "pnfName";
+
+ // ERROR CODE for variable not found in the delegation Context
+ private static final int ERROR_CODE = 601;
+
+ @Autowired
+ private PnfManagement pnfManagement;
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ @Autowired
+ private ObjectMapper mapper;
+
+ @Override
+ public void execute(DelegateExecution delegateExecution) throws Exception {
+ logger.debug("Running execute block for activity id: {}, name: {}", delegateExecution.getCurrentActivityId(),
+ delegateExecution.getCurrentActivityName());
+
+ RequestDetails bpmnRequestDetails = requestVerification(delegateExecution);
+
+ final String serviceInstanceName = bpmnRequestDetails.getRequestInfo().getInstanceName();
+ final String pnfName = bpmnRequestDetails.getRequestParameters().getUserParamValue(PNF_NAME);
+ final String serviceModelUuid = bpmnRequestDetails.getModelInfo().getModelUuid();
+ final List<Map<String, Object>> userParams = bpmnRequestDetails.getRequestParameters().getUserParams();
+ final Pnf pnf = getPnfByPnfName(delegateExecution, pnfName);
+ final List<PnfResourceCustomization> pnfCustomizations =
+ getPnfResourceCustomizations(delegateExecution, serviceModelUuid);
+ final PnfResourceCustomization pnfResourceCustomization = pnfCustomizations.get(0);
+ final String payload = bpmnRequestDetails.getRequestParameters().getPayload();
+
+ populateExecution(delegateExecution, bpmnRequestDetails, pnfResourceCustomization, pnf, serviceInstanceName,
+ pnfName, serviceModelUuid, userParams, payload);
+
+ logger.trace("Completed preProcessRequest PnfSoftwareUpgradeServiceRequest Request ");
+ }
+
+ private RequestDetails requestVerification(DelegateExecution delegateExecution) throws IOException {
+ RequestDetails bpmnRequestDetails = mapper.readValue(
+ JsonUtils.getJsonValue(String.valueOf(delegateExecution.getVariable(BPMN_REQUEST)), "requestDetails"),
+ RequestDetails.class);
+
+ throwIfNull(delegateExecution, bpmnRequestDetails.getModelInfo(), SERVICE_MODEL_INFO);
+ throwIfNull(delegateExecution, bpmnRequestDetails.getRequestInfo(), "RequestInfo");
+ throwIfNull(delegateExecution, bpmnRequestDetails.getRequestParameters(), "RequestParameters");
+ throwIfNull(delegateExecution, bpmnRequestDetails.getRequestParameters().getUserParams(), "UserParams");
+
+ return bpmnRequestDetails;
+ }
+
+ private void populateExecution(DelegateExecution delegateExecution, RequestDetails bpmnRequestDetails,
+ PnfResourceCustomization pnfResourceCustomization, Pnf pnf, String serviceInstanceName, String pnfName,
+ String serviceModelUuid, List<Map<String, Object>> userParams, String payload) {
+
+ delegateExecution.setVariable(SERVICE_MODEL_INFO, bpmnRequestDetails.getModelInfo());
+ delegateExecution.setVariable(SERVICE_INSTANCE_NAME, serviceInstanceName);
+ delegateExecution.setVariable(PNF_CORRELATION_ID, pnfName);
+ delegateExecution.setVariable(MODEL_UUID, serviceModelUuid);
+ delegateExecution.setVariable(PNF_UUID, pnf.getPnfId());
+ delegateExecution.setVariable(PRC_BLUEPRINT_NAME, pnfResourceCustomization.getBlueprintName());
+ delegateExecution.setVariable(PRC_BLUEPRINT_VERSION, pnfResourceCustomization.getBlueprintVersion());
+ delegateExecution.setVariable(PRC_CUSTOMIZATION_UUID, pnfResourceCustomization.getModelCustomizationUUID());
+ delegateExecution.setVariable(RESOURCE_CUSTOMIZATION_UUID_PARAM,
+ pnfResourceCustomization.getModelCustomizationUUID());
+ delegateExecution.setVariable(PRC_INSTANCE_NAME, pnfResourceCustomization.getModelInstanceName());
+ delegateExecution.setVariable(PRC_CONTROLLER_ACTOR, pnfResourceCustomization.getControllerActor());
+
+ for (Map<String, Object> param : userParams) {
+ if (param.containsKey("name") && param.containsKey("value")) {
+ delegateExecution.setVariable(param.get("name").toString(), param.get("value").toString());
+ }
+ }
+
+ delegateExecution.setVariable(REQUEST_PAYLOAD, payload);
+ }
+
+ private Pnf getPnfByPnfName(DelegateExecution delegateExecution, String pnfName) {
+ Optional<Pnf> pnfOptional = null;
+ try {
+ pnfOptional = pnfManagement.getEntryFor(pnfName);
+ } catch (IOException e) {
+ logger.warn(e.getMessage(), e);
+ exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE,
+ "Unable to fetch from AAI" + e.getMessage());
+ }
+ if (pnfOptional == null || !pnfOptional.isPresent()) {
+ exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE,
+ "AAI entry for PNF: " + pnfName + " does not exist");
+ }
+ return pnfOptional.get();
+ }
+
+ private List<PnfResourceCustomization> getPnfResourceCustomizations(DelegateExecution delegateExecution,
+ String serviceModelUuid) {
+ List<PnfResourceCustomization> pnfCustomizations =
+ catalogDbClient.getPnfResourceCustomizationByModelUuid(serviceModelUuid);
+
+ if (pnfCustomizations == null || pnfCustomizations.isEmpty()) {
+ logger.warn("Unable to find the PNF resource customizations of model service UUID: {}", serviceModelUuid);
+ exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE,
+ "Unable to find the PNF resource customizations of model service UUID: " + serviceModelUuid);
+ }
+ return pnfCustomizations;
+ }
+
+ private void throwIfNull(DelegateExecution delegateExecution, Object obj, String param) {
+ if (obj == null) {
+ logger.warn("Unable to find the parameter: {} in the execution context", param);
+ exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE,
+ "Unable to find parameter " + param);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/UpdatePnfEntryInAai.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/UpdatePnfEntryInAai.java
new file mode 100644
index 0000000000..f85be8aab7
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/UpdatePnfEntryInAai.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.util.Optional;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
+import static org.onap.so.client.cds.PayloadConstants.PRC_TARGET_SOFTWARE_VERSION;
+
+
+@Component
+public class UpdatePnfEntryInAai implements JavaDelegate {
+
+ private final Logger logger = LoggerFactory.getLogger(UpdatePnfEntryInAai.class);
+
+ @Autowired
+ private PnfManagement pnfManagement;
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ String pnfCorrelationId = String.valueOf(execution.getVariable(PNF_CORRELATION_ID));
+ Optional<Pnf> pnfAaiEntry = pnfManagement.getEntryFor(pnfCorrelationId);
+
+ if (!pnfAaiEntry.isPresent()) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 404,
+ "AAI entry for PNF: " + PNF_CORRELATION_ID + " does not exist");
+ }
+
+ Pnf pnf = pnfAaiEntry.get();
+ String pnfSoftwareVersion = String.valueOf(execution.getVariable(PRC_TARGET_SOFTWARE_VERSION));
+ pnf.setSwVersion(pnfSoftwareVersion);
+
+ pnfManagement.updateEntry(pnfCorrelationId, pnf);
+ logger.debug("AAI entry is updated for pnf correlation id: {}, pnf uuid: {} with swVersion: {}",
+ pnf.getPnfName(), pnfCorrelationId, pnfSoftwareVersion);
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java
index 9e720fe0a4..46937d0d8c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java
@@ -30,5 +30,7 @@ public interface PnfManagement {
void createEntry(String pnfCorrelationId, Pnf entry) throws IOException;
+ void updateEntry(String pnfCorrelationId, Pnf entry) throws IOException;
+
void createRelation(String serviceInstanceId, String pnfName) throws IOException;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java
index b1af8b1e0b..e6df8070a3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java
@@ -44,6 +44,11 @@ public class PnfManagementImpl implements PnfManagement {
restClient.createPnf(pnfCorrelationId, entry);
}
+ public void updateEntry(String pnfCorrelationId, Pnf entry) {
+ AAIRestClientImpl restClient = new AAIRestClientImpl();
+ restClient.updatePnf(pnfCorrelationId, entry);
+ }
+
@Override
public void createRelation(String serviceInstanceId, String pnfName) {
AAIResourceUri serviceInstanceURI =
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
index 7f2cd5c071..c63edc93c7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
@@ -22,12 +22,8 @@
package org.onap.so.bpmn.infrastructure.workflow.service;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
import java.io.IOException;
import java.io.InputStream;
-import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -40,14 +36,12 @@ import java.util.Properties;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.ParseException;
-import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpRequestBase;
-import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
@@ -69,13 +63,17 @@ import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.Relationships;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.util.UriUtils;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
public class ServicePluginFactory {
@@ -451,7 +449,7 @@ public class ServicePluginFactory {
public Map getTPsfromAAI(String serviceName) {
Map<String, Object> tpInfo = new HashMap<>();
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.LOGICAL_LINK);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.LOGICAL_LINK);
AAIResourcesClient client = new AAIResourcesClient();
Optional<LogicalLinks> result = client.get(LogicalLinks.class, uri);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
index f933277f3c..de8a35de06 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
@@ -45,7 +45,7 @@ import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.GenericResourceApi;
import org.onap.so.db.request.beans.ResourceOperationStatus;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.requestsdb.RequestsDbConstant;
import org.slf4j.Logger;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationServiceTest.groovy
new file mode 100644
index 0000000000..3eefd31e63
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateCommunicationServiceTest.groovy
@@ -0,0 +1,224 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+
+import static org.junit.Assert.assertEquals
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.when
+
+class ActivateCommunicationServiceTest extends MsoGroovyTest {
+
+ @Before
+ void init() throws IOException {
+ super.init("ActivateCommunicationService")
+ }
+
+ @Captor
+ static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+ @Test
+ void testPreProcessRequest() {
+
+ String req = """
+ {
+ "globalSubscriberId": "5GCustomer",
+ "serviceType": "5G",
+ "operationId": "test123"
+ }
+ """
+ when(mockExecution.getVariable("bpmnRequest")).thenReturn(req)
+ when(mockExecution.getVariable("mso-request-id")).thenReturn("54321")
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("operationType")).thenReturn("activation")
+
+ ActivateCommunicationService service = new ActivateCommunicationService()
+ service.preProcessRequest(mockExecution)
+ Mockito.verify(mockExecution, times(6)).setVariable(captor.capture(), captor.capture())
+ }
+
+ @Test
+ void testPrepareInitOperationStatus() {
+
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("operationId")).thenReturn("54321")
+
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111")
+
+ ActivateCommunicationService service = new ActivateCommunicationService()
+
+ service.prepareInitOperationStatus(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String res = captor.getValue()
+ assertNotNull(res)
+ }
+
+
+ @Test
+ void testSendSyncResponse() {
+ when(mockExecution.getVariable("operationId")).thenReturn("123456")
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ ActivateCommunicationService service = new ActivateCommunicationService()
+ service.sendSyncResponse(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("sentSyncResponse"), captor.capture())
+ def updateVolumeGroupRequest = captor.getValue()
+ assertEquals(updateVolumeGroupRequest, true)
+ }
+
+ @Test
+ void testPreRequestSend2NSMF() {
+ when(mockExecution.getVariable("e2e_service-instance.service-instance-id")).thenReturn("12333")
+ when(mockExecution.getVariable("requestParam")).thenReturn("activate")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("test111")
+ when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5GConsumer")
+ ActivateCommunicationService service = new ActivateCommunicationService()
+ service.preRequestSend2NSMF(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("CSMF_NSMFRequest"), captor.capture())
+ String resultSuccess = captor.getValue()
+
+ String expect = """
+ {
+ "globalSubscriberId":"test111",
+ "serviceType":"5GConsumer"
+ }
+ """
+ assertEquals(expect.replaceAll("\\s+", ""), resultSuccess.replaceAll("\\s+", ""))
+ }
+
+ @Test
+ void testProcessNSMFResponseSuccess() {
+ when(mockExecution.getVariable("CSMF_NSMFResponseCode")).thenReturn(202)
+ when(mockExecution.getVariable("CSMF_NSMFResponse")).thenReturn("""
+ {
+ "operationId": "e3819a23-3777-4172-a834-35ee78acf3f4"
+ }
+ """)
+
+ ActivateCommunicationService service = new ActivateCommunicationService()
+ service.processNSMFResponse(mockExecution)
+ Mockito.verify(mockExecution, times(2)).setVariable(captor.capture(), captor.capture())
+ def resultSuccess = captor.getAllValues()
+
+ def expect = new ArrayList<>()
+ expect.add("e2eOperationId")
+ expect.add("e3819a23-3777-4172-a834-35ee78acf3f4")
+ expect.add("ProcessNsmfSuccess")
+ expect.add("OK")
+ assertEquals(expect, resultSuccess)
+ }
+
+ @Test
+ void testProcessNSMFResponseError() {
+ when(mockExecution.getVariable("CSMF_NSMFResponseCode")).thenReturn(500)
+ ActivateCommunicationService service = new ActivateCommunicationService()
+ service.processNSMFResponse(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("ProcessNsmfSuccess"), captor.capture())
+ String resultSuccess = captor.getValue()
+ assertEquals("ERROR", resultSuccess)
+ }
+
+ @Test
+ void testPrepareUpdateOperationStatus() {
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("operationId")).thenReturn("54321")
+ when(mockExecution.getVariable("operationType")).thenReturn("activate")
+
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111")
+ when(mockExecution.getVariable("mso.adapters.openecomp.db.endpoint"))
+ .thenReturn("http://localhost:28090/dbadapters/RequestsDbAdapter")
+ ActivateCommunicationService service = new ActivateCommunicationService()
+
+ service.prepareUpdateOperationStatus(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String res = captor.getValue()
+
+ String expect = getExpectPayload("updateServiceOperationStatus", "processing", "20",
+ "communication service activate operation processing: waiting nsmf service create finished")
+
+ assertEquals(expect.replaceAll("\\s+", ""), res.replaceAll("\\s+", ""))
+ }
+
+ private static getExpectPayload = { String type, String result, String progress, String operationContent ->
+ String expect =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.onap.so/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:${type} xmlns:ns="http://org.onap.so/requestsdb">
+ <serviceId>12345</serviceId>
+ <operationId>54321</operationId>
+ <operationType>activate</operationType>
+ <userId>11111</userId>
+ <result>${result}</result>
+ <operationContent>${operationContent}</operationContent>
+ <progress>${progress}</progress>
+ <reason></reason>
+ </ns:${type}>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+ return expect
+ }
+
+ @Test
+ void testPrepareCallCheckProcessStatus() {
+ ActivateCommunicationService service = new ActivateCommunicationService()
+ service.prepareCallCheckProcessStatus(mockExecution)
+ Mockito.verify(mockExecution, times(9)).setVariable(captor.capture(), captor.capture())
+ def resultSuccess = captor.getAllValues()
+ assertNotNull(resultSuccess)
+ }
+
+ @Test
+ void testPrepareCompleteStatus() {
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("operationId")).thenReturn("54321")
+ when(mockExecution.getVariable("operationType")).thenReturn("activate")
+ when(mockExecution.getVariable("operationContent"))
+ .thenReturn("communication service activate operation finished")
+
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111")
+ when(mockExecution.getVariable("operationStatus"))
+ .thenReturn("deactivated")
+ ActivateCommunicationService service = new ActivateCommunicationService()
+
+ service.prepareCompleteStatus(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String res = captor.getValue()
+
+ String expect = getExpectPayload("updateServiceOperationStatus", "deactivated", "100",
+ "communication service activate operation finished")
+
+ assertEquals(expect.replaceAll("\\s+", ""), res.replaceAll("\\s+", ""))
+ }
+
+}
+
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceServiceTest.groovy
new file mode 100644
index 0000000000..f3c61dd628
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceServiceTest.groovy
@@ -0,0 +1,118 @@
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+
+import static org.junit.Assert.assertEquals
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.when
+
+class ActivateSliceServiceTest extends MsoGroovyTest {
+ @Before
+ void init() throws IOException {
+ super.init("ActivateSliceService")
+ }
+
+ @Captor
+ static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+ @Test
+ void testPreProcessRequest() {
+
+ String req = """
+ {
+ "globalSubscriberId": "5GCustomer",
+ "serviceType": "5G",
+ "operationId": "test123"
+ }
+ """
+ when(mockExecution.getVariable("bpmnRequest")).thenReturn(req)
+ when(mockExecution.getVariable("mso-request-id")).thenReturn("54321")
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("operationType")).thenReturn("activation")
+
+
+ ActivateSliceService service = new ActivateSliceService()
+ service.preProcessRequest(mockExecution)
+ Mockito.verify(mockExecution, times(7)).setVariable(captor.capture(), captor.capture())
+ }
+
+ @Test
+ void testPrepareInitOperationStatus() {
+
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("operationId")).thenReturn("54321")
+
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111")
+
+ ActivateSliceService service = new ActivateSliceService()
+
+ service.prepareInitServiceOperationStatus(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String res = captor.getValue()
+ assertNotNull(res)
+ }
+
+ @Test
+ void testSendSyncResponse() {
+ when(mockExecution.getVariable("operationId")).thenReturn("123456")
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ ActivateSliceService service = new ActivateSliceService()
+ service.sendSyncResponse(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("sentSyncResponse"), captor.capture())
+ def updateVolumeGroupRequest = captor.getValue()
+ assertEquals(updateVolumeGroupRequest, true)
+ }
+
+ private static getExpectPayload = { String type, String result, String progress, String operationContent ->
+ String expect =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.onap.so/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:${type} xmlns:ns="http://org.onap.so/requestsdb">
+ <serviceId>12345</serviceId>
+ <operationId>54321</operationId>
+ <operationType>activate</operationType>
+ <userId>11111</userId>
+ <result>${result}</result>
+ <operationContent>${operationContent}</operationContent>
+ <progress>${progress}</progress>
+ <reason></reason>
+ </ns:${type}>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+ return expect
+ }
+
+ @Test
+ void testPrepareCompleteStatus() {
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("operationId")).thenReturn("54321")
+ when(mockExecution.getVariable("operationType")).thenReturn("activate")
+ when(mockExecution.getVariable("operationContent"))
+ .thenReturn("slice service activate operation finished")
+
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111")
+ when(mockExecution.getVariable("operationStatus"))
+ .thenReturn("deactivated")
+ ActivateSliceService service = new ActivateSliceService()
+
+ service.prepareCompletionRequest(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String res = captor.getValue()
+
+ String expect = getExpectPayload("updateServiceOperationStatus", "finished", "100",
+ "slice service activate operation finished")
+
+ assertEquals(expect.replaceAll("\\s+", ""), res.replaceAll("\\s+", ""))
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatusTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatusTest.groovy
new file mode 100644
index 0000000000..f066f9e878
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatusTest.groovy
@@ -0,0 +1,344 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+
+import static org.junit.Assert.assertEquals
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.when
+
+class CheckServiceProcessStatusTest extends MsoGroovyTest {
+ @Before
+ void init() throws IOException {
+ super.init("CheckServiceProcessStatus")
+ }
+
+ @Captor
+ static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+
+ @Test
+ void testPreProcessRequest () {
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("operationId")).thenReturn("54321")
+
+ def successConditions = new ArrayList<>()
+ successConditions.add("finished")
+ successConditions.add("completed")
+
+ def errorConditions = new ArrayList<>()
+ errorConditions.add("error")
+ errorConditions.add("failed")
+
+ when(mockExecution.getVariable("successConditions")).thenReturn(successConditions)
+ when(mockExecution.getVariable("errorConditions")).thenReturn(errorConditions)
+
+
+ CheckServiceProcessStatus serviceProcessStatus = new CheckServiceProcessStatus()
+ serviceProcessStatus.preProcessRequest(mockExecution)
+ Mockito.verify(mockExecution, times(9)).setVariable(captor.capture(), captor.capture())
+ }
+
+
+ @Test
+ void testPreCheckServiceStatusReq() {
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("operationId")).thenReturn("54321")
+
+ CheckServiceProcessStatus serviceProcessStatus = new CheckServiceProcessStatus()
+
+ serviceProcessStatus.preCheckServiceStatusReq(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("getOperationStatus"), captor.capture())
+ String res = captor.getValue()
+ String expect =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.onap.so/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:getServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
+ <serviceId>12345</serviceId>
+ <operationId>54321</operationId>
+ </ns:getServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+ assertEquals(expect.replaceAll("\\s+", ""), res.replaceAll("\\s+", ""))
+ }
+
+
+ @Test
+ void testHandlerServiceStatusRespSuccess() {
+ mockData()
+ when(mockExecution.getVariable("dbResponseCode")).thenReturn(200)
+ when(mockExecution.getVariable("dbResponse")).thenReturn(getDBResponse("finished"))
+ def successConditions = new ArrayList<>()
+ successConditions.add("finished")
+ successConditions.add("completed")
+
+ when(mockExecution.getVariable("successConditions")).thenReturn(successConditions)
+
+ CheckServiceProcessStatus serviceProcessStatus = new CheckServiceProcessStatus()
+ serviceProcessStatus.handlerServiceStatusResp(mockExecution)
+
+ Mockito.verify(mockExecution, times(4)).setVariable(captor.capture(), captor.capture())
+ def resultSuccess = captor.getAllValues()
+
+ def expect = new ArrayList<>()
+ expect.add("operationStatus")
+ expect.add("finished")
+ expect.add("operationContent")
+ expect.add("communication service create operation finished success")
+ expect.add("orchestrationStatus")
+ expect.add("deactivated")
+ expect.add("isAllFinished")
+ expect.add("true")
+
+ assertEquals(expect, resultSuccess)
+ }
+
+
+ @Test
+ void testHandlerServiceStatusRespError() {
+ mockData()
+ when(mockExecution.getVariable("dbResponseCode")).thenReturn(200)
+ when(mockExecution.getVariable("dbResponse")).thenReturn(getDBResponse("error"))
+
+ def successConditions = new ArrayList<>()
+ successConditions.add("finished")
+ successConditions.add("completed")
+
+ def errorConditions = new ArrayList<>()
+ errorConditions.add("error")
+ errorConditions.add("failed")
+
+ when(mockExecution.getVariable("successConditions")).thenReturn(successConditions)
+ when(mockExecution.getVariable("errorConditions")).thenReturn(errorConditions)
+
+ CheckServiceProcessStatus serviceProcessStatus = new CheckServiceProcessStatus()
+ serviceProcessStatus.handlerServiceStatusResp(mockExecution)
+
+ Mockito.verify(mockExecution, times(4)).setVariable(captor.capture(), captor.capture())
+ def resultSuccess = captor.getAllValues()
+
+ def expect = new ArrayList<>()
+ expect.add("operationStatus")
+ expect.add("error")
+ expect.add("operationContent")
+ expect.add("communication service create operation finished with error")
+ expect.add("orchestrationStatus")
+ expect.add("error")
+ expect.add("isAllFinished")
+ expect.add("true")
+
+ assertEquals(expect, resultSuccess)
+ }
+
+
+ @Test
+ void testHandlerServiceStatusRespProcessingNo() {
+ mockData()
+ when(mockExecution.getVariable("dbResponseCode")).thenReturn(200)
+ when(mockExecution.getVariable("dbResponse")).thenReturn(getDBResponse("processing"))
+ when(mockExecution.getVariable("progress")).thenReturn(50)
+
+ def successConditions = new ArrayList<>()
+ successConditions.add("finished")
+ successConditions.add("completed")
+
+ def errorConditions = new ArrayList<>()
+ errorConditions.add("error")
+ errorConditions.add("failed")
+
+ when(mockExecution.getVariable("successConditions")).thenReturn(successConditions)
+ when(mockExecution.getVariable("errorConditions")).thenReturn(errorConditions)
+
+ CheckServiceProcessStatus serviceProcessStatus = new CheckServiceProcessStatus()
+ serviceProcessStatus.handlerServiceStatusResp(mockExecution)
+
+ Mockito.verify(mockExecution, times(2)).setVariable(captor.capture(), captor.capture())
+ def resultSuccess = captor.getAllValues()
+
+ def expect = new ArrayList<>()
+ expect.add("isNeedUpdateDB")
+ expect.add("false")
+ expect.add("isAllFinished")
+ expect.add("false")
+
+ assertEquals(expect as String, resultSuccess as String)
+ }
+
+
+ @Test
+ void testHandlerServiceStatusRespProcessingYes() {
+ mockData()
+ when(mockExecution.getVariable("dbResponseCode")).thenReturn(200)
+ when(mockExecution.getVariable("dbResponse")).thenReturn(getDBResponse("processing"))
+ when(mockExecution.getVariable("progress")).thenReturn(60)
+
+ def successConditions = new ArrayList<>()
+ successConditions.add("finished")
+ successConditions.add("completed")
+
+ def errorConditions = new ArrayList<>()
+ errorConditions.add("error")
+ errorConditions.add("failed")
+
+ when(mockExecution.getVariable("successConditions")).thenReturn(successConditions)
+ when(mockExecution.getVariable("errorConditions")).thenReturn(errorConditions)
+
+ CheckServiceProcessStatus serviceProcessStatus = new CheckServiceProcessStatus()
+ serviceProcessStatus.handlerServiceStatusResp(mockExecution)
+
+ Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture())
+ def resultSuccess = captor.getAllValues()
+
+ def expect = new ArrayList<>()
+ expect.add("progress")
+ expect.add("50")
+ expect.add("isNeedUpdateDB")
+ expect.add("true")
+ expect.add("isAllFinished")
+ expect.add("false")
+
+ assertEquals(expect as String, resultSuccess as String)
+ }
+
+
+ @Test
+ void testTimeWaitDelayNo() {
+ mockData()
+ when(mockExecution.getVariable("startTime")).thenReturn(System.currentTimeMillis())
+ CheckServiceProcessStatus serviceProcessStatus = new CheckServiceProcessStatus()
+
+ serviceProcessStatus.timeWaitDelay(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("isTimeOut"), captor.capture())
+ def res = captor.getValue()
+
+ assertEquals("NO", res)
+ }
+
+
+ @Test
+ void testTimeWaitDelayYes() {
+ mockData()
+ when(mockExecution.getVariable("startTime")).thenReturn(1000000)
+ CheckServiceProcessStatus serviceProcessStatus = new CheckServiceProcessStatus()
+
+ serviceProcessStatus.timeWaitDelay(mockExecution)
+ Mockito.verify(mockExecution, times(4)).setVariable(captor.capture(), captor.capture())
+ def res = captor.getAllValues()
+ def expect = new ArrayList<>()
+ expect.add("operationStatus")
+ expect.add("error")
+ expect.add("operationContent")
+ expect.add("communication service create operation finished with timeout")
+ expect.add("orchestrationStatus")
+ expect.add("error")
+ expect.add("isTimeOut")
+ expect.add("YES")
+
+ assertEquals(expect, res)
+ }
+
+
+ @Test
+ void testPreUpdateOperationProgress() {
+ mockData()
+ when(mockExecution.getVariable("progress")).thenReturn(50)
+ when(mockExecution.getVariable("initProgress")).thenReturn(20)
+ when(mockExecution.getVariable("endProgress")).thenReturn(90)
+ when(mockExecution.getVariable("operationType")).thenReturn("CREATE")
+ when(mockExecution.getVariable("processServiceType")).thenReturn("communication service")
+ when(mockExecution.getVariable("parentServiceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("parentOperationId")).thenReturn("54321")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111")
+
+ CheckServiceProcessStatus serviceProcessStatus = new CheckServiceProcessStatus()
+ serviceProcessStatus.preUpdateOperationProgress(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String res = captor.getValue()
+
+ String expect = getExpectPayload("55",
+ "communication service CREATE operation processing 55")
+
+ assertEquals(expect.replaceAll("\\s+", ""), res.replaceAll("\\s+", ""))
+
+
+ }
+
+
+ private static String getExpectPayload(String progress, String operationContent) {
+ String expect =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.onap.so/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
+ <serviceId>12345</serviceId>
+ <operationId>54321</operationId>
+ <operationType>CREATE</operationType>
+ <userId>11111</userId>
+ <result>processing</result>
+ <operationContent>${operationContent}</operationContent>
+ <progress>${progress}</progress>
+ <reason></reason>
+ </ns:updateServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+ return expect
+ }
+
+
+ private static String getDBResponse(String result) {
+ String response =
+ """<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+ <soap:Body>
+ <ns2:getServiceOperationStatusResponse xmlns:ns2="http://org.onap.so/requestsdb">
+ <return><operation>CREATE</operation>
+ <operationContent>Prepare service creation</operationContent>
+ <operationId>077995e3-eb32-44ae-b35d-491fc6983a44</operationId>
+ <progress>50</progress>
+ <reason></reason>
+ <result>${result}</result>
+ <serviceId>3324f117-696d-4518-b8b5-b01fcc127a03</serviceId>
+ <userId>5GCustomer</userId>
+ </return></ns2:getServiceOperationStatusResponse>
+ </soap:Body>
+ </soap:Envelope>
+ """
+ return response
+ }
+
+
+ private mockData() {
+ when(mockExecution.getVariable("processServiceType")).thenReturn("communication service")
+ when(mockExecution.getVariable("operationType")).thenReturn("create")
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationServiceTest.groovy
new file mode 100644
index 0000000000..3622cc0062
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationServiceTest.groovy
@@ -0,0 +1,456 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.json.JSONObject
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.onap.so.bpmn.core.domain.ModelInfo
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceInfo
+import org.onap.so.bpmn.core.domain.ServiceProxy
+
+import static org.junit.Assert.assertEquals
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.when
+
+class CreateCommunicationServiceTest extends MsoGroovyTest {
+
+ @Before
+ void init() throws IOException {
+ super.init("CreateCommunicationService")
+ }
+
+ @Captor
+ static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+ @Test
+ void testPreProcessRequest() {
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("bpmnRequest")).thenReturn("""
+ {
+ "requestDetails": {
+ "modelInfo": {
+ "modelInvariantId": "e75698d9-925a-4cdd-a6c0-edacbe6a0b51",
+ "modelType": "service",
+ "modelNameVersionId": "8ee5926d-720b-4bb2-86f9-d20e921c143b",
+ "modelName": "voLTE",
+ "modelVersion": "1.0",
+ "modelVersionId": "8ee5926d-720b-4bb2-86f9-d20e921c143b",
+ "modelUuid": "8ee5926d-720b-4bb2-86f9-d20e921c143b",
+ "modelInvariantUuid": "e75698d9-925a-4cdd-a6c0-edacbe6a0b51"
+ },
+ "requestInfo": {
+ "source": "UUI",
+ "instanceName": "CSMFService",
+ "suppressRollback": true
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "5GCustomer"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "MOG",
+ "userParams": [{
+ "ServiceInstanceName": "CSMFService",
+ "UUIRequest": "{\\r\\n \\
+ "service\\":{\\r\\n \\"name\\":\\"CSMFService\\",\\r\\n
+ \\"description\\":\\"CSMFService\\",\\r\\n
+ \\"serviceInvariantUuid\\":\\"e75698d9-925a-4cdd-a6c0-edacbe6a0b51\\",\\r\\n
+ \\"serviceUuid\\":\\"8ee5926d-720b-4bb2-86f9-d20e921c143b\\",\\r\\n
+ \\"globalSubscriberId\\":\\"5GCustomer\\",\\r\\n
+ \\"serviceType\\":\\"5G\\",\\r\\n
+ \\"parameters\\":{\\r\\n
+ \\"requestInputs\\":{\\r\\n
+ \\"expDataRateDL\\":10,\\r\\n
+ \\"expDataRateUL\\":30,\\r\\n
+ \\"latency\\":20,\\r\\n
+ \\"maxNumberofUEs\\":300,\\r\\n
+ \\"uemobilityLevel\\":\\"stationary\\",\\r\\n
+ \\"resourceSharingLevel\\":\\"shared\\",\\r\\n
+ \\"coverageAreaList\\": \\"01001\\",\\r\\n
+ \\"useInterval\\":\\"3\\"\\r\\n
+ }\\r\\n
+ }\\r\\n }\\r\\n}\\r\\n"
+ }],
+ "aLaCarte": true,
+ "usePreload": true
+ }
+ },
+ "serviceInstanceId": null,
+ "vnfInstanceId": null,
+ "networkInstanceId": null,
+ "volumeGroupInstanceId": null,
+ "vfModuleInstanceId": null,
+ "configurationId": null,
+ "instanceGroupId": null
+ }""".replaceAll("\\s+", ""))
+ when(mockExecution.getVariable("mso-request-id")).thenReturn("edb08d97-e0f9-4c71-840a-72080d7be42e")
+ CreateCommunicationService communicationService = new CreateCommunicationService()
+ communicationService.preProcessRequest(mockExecution)
+ Mockito.verify(mockExecution, times(14)).setVariable(captor.capture() as String, captor.capture())
+ List<ExecutionEntity> values = captor.getAllValues()
+ assertNotNull(values)
+ }
+
+ @Test
+ void testPrepareInitOperationStatus() {
+
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("operationId")).thenReturn("54321")
+
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111")
+
+ CreateCommunicationService communicationService = new CreateCommunicationService()
+
+ communicationService.prepareInitOperationStatus(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String res = captor.getValue()
+ assertNotNull(res)
+ }
+
+
+ @Test
+ void testSendSyncResponse() {
+ when(mockExecution.getVariable("operationId")).thenReturn("123456")
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ CreateCommunicationService communicationService = new CreateCommunicationService()
+ communicationService.sendSyncResponse(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("sentSyncResponse"), captor.capture())
+ def updateVolumeGroupRequest = captor.getValue()
+ assertEquals(updateVolumeGroupRequest, true)
+ }
+
+
+ @Test
+ void testPrepareDoComposeE2E() {
+ ServiceDecomposition serviceDecomposition = new ServiceDecomposition()
+ ServiceProxy serviceProxy = new ServiceProxy()
+ serviceProxy.setSourceModelUuid("f2f5967e-72d3-4c5c-b880-e214e71dba4e")
+ serviceDecomposition.setServiceProxy(Arrays.asList(serviceProxy))
+ when(mockExecution.getVariable("csServiceDecomposition")).thenReturn(serviceDecomposition)
+ CreateCommunicationService communicationService = new CreateCommunicationService()
+ communicationService.prepareDoComposeE2E(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("e2eServiceModelInfo"), captor.capture())
+ String e2eServiceModelInfo = captor.getValue()
+ assertEquals(e2eServiceModelInfo.trim().replaceAll(" ", ""),
+ """{"modelUuid":"f2f5967e-72d3-4c5c-b880-e214e71dba4e"}""")
+ }
+
+ @Test
+ void testParseCSParamsFromReq() {
+ mockData()
+ when(mockExecution.getVariable("csServiceModelInfo")).thenReturn("""
+ {
+ "modelInvariantUuid":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51",
+ "modelName":"voLTE",
+ "modelNameVersionId":"8ee5926d-720b-4bb2-86f9-d20e921c143b",
+ "modelVersion":"1.0",
+ "modelVersionId":"8ee5926d-720b-4bb2-86f9-d20e921c143b",
+ "modelInvariantId":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51",
+ "modelType":"service",
+ "modelUuid":"8ee5926d-720b-4bb2-86f9-d20e921c143b"
+ }""")
+
+ ServiceDecomposition decomposition = new ServiceDecomposition()
+ decomposition.setServiceType("embb")
+ ServiceInfo serviceInfo = new ServiceInfo()
+ serviceInfo.setServiceProperties("""
+ [{"name":"useInterval","type":"string","required":false},
+ {"default":"39-00","name":"plmnIdList","type":"string","required":false},
+ {"name":"maxNumberofUEs","type":"integer","required":false},
+ {"name":"latency","type":"integer","required":false},
+ {"name":"uEMobilityLevel","type":"string","required":false},
+ {"name":"expDataRateUL","type":"integer","required":false},
+ {"name":"expDataRateDL","type":"integer","required":false},
+ {"name":"coverageAreaList","type":"string","required":false},
+ {"name":"sNSSAI","type":"string","required":false},
+ {"name":"resourceSharingLevel","type":"string","required":false}]
+ """)
+ decomposition.setServiceInfo(serviceInfo)
+
+ when(mockExecution.getVariable("csServiceDecomposition")).thenReturn(decomposition)
+
+ CreateCommunicationService communicationService = new CreateCommunicationService()
+ communicationService.parseCSParamsFromReq(mockExecution)
+
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("csInputMap"), captor.capture())
+ def csInputMap = captor.getValue()
+ assertEquals(getExpectCsInputMap(), csInputMap)
+
+ }
+
+ private static Map<String, Object> getExpectCsInputMap() {
+ Map<String, Object> csInputMap = new HashMap<>()
+ csInputMap.put("expDataRateDL", 10)
+ csInputMap.put("expDataRateUL", 30)
+ csInputMap.put("latency", 20)
+ csInputMap.put("maxNumberofUEs", 300)
+ csInputMap.put("uEMobilityLevel", "stationary")
+ csInputMap.put("resourceSharingLevel", "shared")
+ csInputMap.put("coverageAreaTAList", "01001")
+ csInputMap.put("useInterval", "3")
+ csInputMap.put("coverageAreaList", null)
+ csInputMap.put("plmnIdList", "39-00")
+ csInputMap.put("sNSSAI", null)
+ return csInputMap
+ }
+
+ @Test
+ void testGenerateE2EServiceProfile() {
+ ServiceDecomposition decomposition = new ServiceDecomposition()
+ decomposition.setServiceType("embb")
+ ServiceInfo serviceInfo = new ServiceInfo()
+ serviceInfo.setServiceProperties("""
+ [{"name":"nstar0_allottedresource0_providing_service_uuid","type":"string","required":true},
+ {"name":"areaTrafficCapDL","type":"integer","required":false},
+ {"name":"maxNumberofUEs","type":"integer","required":false},
+ {"name":"latency","type":"integer","required":false},
+ {"name":"expDataRateUL","type":"integer","required":false},
+ {"name":"sNSSAI","type":"string","required":false},
+ {"name":"plmnIdList","type":"string","required":false},
+ {"name":"sST","type":"integer","required":false},
+ {"name":"areaTrafficCapUL","type":"integer","required":false},
+ {"name":"uEMobilityLevel","type":"string","required":false},
+ {"name":"expDataRateDL","type":"integer","required":false},
+ {"name":"nstar0_allottedresource0_providing_service_invariant_uuid","type":"string","required":true},
+ {"name":"coverageAreaTAList","type":"string","required":false},
+ {"name":"activityFactor","type":"integer","required":false},
+ {"name":"resourceSharingLevel","type":"string","required":false}]
+ """)
+ decomposition.setServiceInfo(serviceInfo)
+
+ ModelInfo modelInfo = new ModelInfo()
+ modelInfo.setModelInvariantUuid("e75698d9-925a-4cdd-a6c0-edacbe6a0b51")
+ modelInfo.setModelUuid("8ee5926d-720b-4bb2-86f9-d20e921c143b")
+ decomposition.setModelInfo(modelInfo)
+
+ when(mockExecution.getVariable("e2eServiceDecomposition")).thenReturn(decomposition)
+ when(mockExecution.getVariable("csInputMap")).thenReturn(getExpectCsInputMap())
+
+ CreateCommunicationService communicationService = new CreateCommunicationService()
+ communicationService.generateE2EServiceProfile(mockExecution)
+
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("e2eInputMap"), captor.capture())
+ def csInputMap = captor.getValue()
+ assertEquals(csInputMap, getExpectE2eInputMap())
+ }
+
+ private static Map<String, Object> getExpectE2eInputMap() {
+ Map<String, Object> e2eInputMap = new HashMap<>()
+ e2eInputMap.put("nstar0_allottedresource0_providing_service_uuid", null)
+ e2eInputMap.put("nstar0_allottedresource0_providing_service_invariant_uuid", null)
+ e2eInputMap.put("areaTrafficCapDL", 100)
+ e2eInputMap.put("areaTrafficCapUL", 100)
+ e2eInputMap.put("expDataRateDL", 10)
+ e2eInputMap.put("expDataRateUL", 30)
+ e2eInputMap.put("latency", 20)
+ e2eInputMap.put("maxNumberofUEs", 300)
+ e2eInputMap.put("uEMobilityLevel", "stationary")
+ e2eInputMap.put("resourceSharingLevel", "shared")
+ e2eInputMap.put("coverageAreaTAList", "01001")
+ e2eInputMap.put("sST", null)
+ e2eInputMap.put("activityFactor", 0)
+ e2eInputMap.put("plmnIdList", "39-00")
+ e2eInputMap.put("sNSSAI", null)
+
+ return e2eInputMap
+ }
+
+ @Test
+ void testPreRequestSend2NSMF() {
+ when(mockExecution.getVariable("e2eInputMap")).thenReturn(getExpectE2eInputMap())
+ when(mockExecution.getVariable("csServiceName")).thenReturn("testName")
+ when(mockExecution.getVariable("modelUuid")).thenReturn("12345")
+ when(mockExecution.getVariable("e2eModelInvariantUuid")).thenReturn("54321")
+ when(mockExecution.getVariable("e2eModelUuid")).thenReturn("11111")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("test111")
+ when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5GConsumer")
+ CreateCommunicationService communicationService = new CreateCommunicationService()
+ communicationService.preRequestSend2NSMF(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("CSMF_NSMFRequest"), captor.capture())
+ String resultSuccess = captor.getValue()
+
+ def expectMap = getExpectE2eInputMap()
+ expectMap.put("nstar0_allottedresource0_providing_service_uuid", null)
+ expectMap.put("nstar0_allottedresource0_providing_service_invariant_uuid", null)
+
+ String expect = """
+ {
+ "service":{
+ "name": "testName",
+ "description": "e2eService of 12345",
+ "serviceInvariantUuid": "54321",
+ "serviceUuid": "11111",
+ "globalSubscriberId": "test111",
+ "serviceType": "5GConsumer",
+ "parameters":{
+ "requestInputs": ${expectMap as JSONObject}
+ }
+ }
+ }
+ """
+ assertEquals(expect.replaceAll("\\s+", ""), resultSuccess.replaceAll("\\s+", ""))
+ }
+
+ @Test
+ void testProcessNSMFResponseSuccess() {
+ when(mockExecution.getVariable("CSMF_NSMFResponseCode")).thenReturn(202)
+ when(mockExecution.getVariable("CSMF_NSMFResponse")).thenReturn("""
+ {
+ "service": {
+ "serviceId": "945063ff-1a01-4944-9232-8e7999e0d5e4",
+ "operationId": "e3819a23-3777-4172-a834-35ee78acf3f4"
+ }
+ }
+ """)
+
+ CreateCommunicationService communicationService = new CreateCommunicationService()
+ communicationService.processNSMFResponse(mockExecution)
+ Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture())
+ def resultSuccess = captor.getAllValues()
+
+ def expect = new ArrayList<>()
+ expect.add("e2eServiceInstanceId")
+ expect.add("945063ff-1a01-4944-9232-8e7999e0d5e4")
+ expect.add("e2eOperationId")
+ expect.add("e3819a23-3777-4172-a834-35ee78acf3f4")
+ expect.add("ProcessNsmfSuccess")
+ expect.add("OK")
+ assertEquals(expect, resultSuccess)
+ }
+
+ @Test
+ void testProcessNSMFResponseError() {
+ when(mockExecution.getVariable("CSMF_NSMFResponseCode")).thenReturn(500)
+ CreateCommunicationService communicationService = new CreateCommunicationService()
+ communicationService.processNSMFResponse(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("ProcessNsmfSuccess"), captor.capture())
+ String resultSuccess = captor.getValue()
+ assertEquals("ERROR", resultSuccess)
+ }
+
+ @Test
+ void testPrepareUpdateOperationStatus() {
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("operationId")).thenReturn("54321")
+
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111")
+ when(mockExecution.getVariable("mso.adapters.openecomp.db.endpoint"))
+ .thenReturn("http://localhost:28090/dbadapters/RequestsDbAdapter")
+ CreateCommunicationService communicationService = new CreateCommunicationService()
+
+ communicationService.prepareUpdateOperationStatus(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String res = captor.getValue()
+
+ String expect = getExpectPayload("updateServiceOperationStatus", "processing", "20",
+ "communication service create operation processing: waiting nsmf service create finished")
+
+ assertEquals(expect.replaceAll("\\s+", ""), res.replaceAll("\\s+", ""))
+ }
+
+
+ @Test
+ void testPrepareCallCheckProcessStatus() {
+ CreateCommunicationService communicationService = new CreateCommunicationService()
+ communicationService.prepareCallCheckProcessStatus(mockExecution)
+ Mockito.verify(mockExecution, times(10)).setVariable(captor.capture(), captor.capture())
+ def resultSuccess = captor.getAllValues()
+ assertNotNull(resultSuccess)
+ }
+
+
+ @Test
+ void testPrepareCompleteStatus() {
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("operationId")).thenReturn("54321")
+ when(mockExecution.getVariable("operationContent"))
+ .thenReturn("communication service create operation finished")
+
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111")
+ when(mockExecution.getVariable("operationStatus"))
+ .thenReturn("processing")
+ CreateCommunicationService communicationService = new CreateCommunicationService()
+
+ communicationService.prepareCompleteStatus(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String res = captor.getValue()
+
+ String expect = getExpectPayload("updateServiceOperationStatus", "processing", "100",
+ "communication service create operation finished")
+
+ assertEquals(expect.replaceAll("\\s+", ""), res.replaceAll("\\s+", ""))
+ }
+
+ private static String getExpectPayload(String type, String result, String progress, String operationContent) {
+ String expect =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.onap.so/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:${type} xmlns:ns="http://org.onap.so/requestsdb">
+ <serviceId>12345</serviceId>
+ <operationId>54321</operationId>
+ <operationType>CREATE</operationType>
+ <userId>11111</userId>
+ <result>${result}</result>
+ <operationContent>${operationContent}</operationContent>
+ <progress>${progress}</progress>
+ <reason></reason>
+ </ns:${type}>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+ return expect
+ }
+
+ private void mockData() {
+ when(mockExecution.getVariable("uuiRequest")).thenReturn("""{
+ "service":{
+ "name":"CSMFService",
+ "description":"CSMFService",
+ "serviceInvariantUuid":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51",
+ "serviceUuid":"8ee5926d-720b-4bb2-86f9-d20e921c143b",
+ "globalSubscriberId":"5GCustomer",
+ "serviceType":"5G",
+ "parameters":{
+ "requestInputs":{
+ "expDataRateDL":10,
+ "expDataRateUL":30,
+ "latency":20,
+ "maxNumberofUEs":300,
+ "uemobilityLevel":"stationary",
+ "resourceSharingLevel":"shared",
+ "coverageAreaList": "01001",
+ "useInterval":"3"
+ }
+ }
+ }
+ }""")
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy
new file mode 100644
index 0000000000..6b7944cc6e
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceServiceTest.groovy
@@ -0,0 +1,162 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.json.JSONObject
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.so.beans.nsmf.SliceTaskParams
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.onap.so.bpmn.core.domain.ModelInfo
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceInfo
+import org.onap.so.bpmn.core.domain.ServiceProxy
+
+import static org.junit.Assert.assertEquals
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.when
+
+class CreateSliceServiceTest extends MsoGroovyTest {
+
+ @Before
+ void init() throws IOException {
+ super.init("CreateSliceService")
+ }
+
+ @Captor
+ static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+ final String bpmnRequest = """
+ {
+ "requestDetails": {
+ "modelInfo": {
+ "modelInvariantId": "123456",
+ "modelType": "service",
+ "modelNameVersionId": "123456",
+ "modelName": "Service Profile",
+ "modelVersion": "1.0",
+ "modelVersionId": "123456",
+ "modelUuid": "123456",
+ "modelInvariantUuid": "123456"
+ },
+ "requestInfo": {
+ "source": "UUI",
+ "instanceName": "NSMF",
+ "suppressRollback": true
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "5GCustomer"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "MOG",
+ "userParams": [{
+ "ServiceInstanceName": "NSMF",
+ "UUIRequest": {
+ "service":{
+ "name": "NSMF",
+ "description": "CSMFService",
+ "serviceInvariantUuid": "123456",
+ "serviceUuid": "123456",
+ "globalSubscriberId": "5GCustomer",
+ "serviceType": "5G",
+ "parameters": {},
+ "requestInputs": {
+ "sST": "embb",
+ "sNSSAI": "1-10101",
+ "uEMobilityLevel": "stationary",
+ "areaTrafficCapDL": 123,
+ "maxNumberofUEs": 1000,
+ "expDataRateUL": 2000,
+ "plmnIdList": "39-00|39-01",
+ "areaTrafficCapUL": 456,
+ "latency": 300,
+ "expDataRateDL": 400,
+ "coverageAreaTAList": 101001,
+ "activityFactor": 99,
+ "resourceSharingLevel": "shared"
+ }
+ }
+ }
+ }],
+ "aLaCarte": true,
+ "usePreload": true
+ }
+ },
+ "serviceInstanceId": null,
+ "vnfInstanceId": null,
+ "networkInstanceId": null,
+ "volumeGroupInstanceId": null,
+ "vfModuleInstanceId": null,
+ "configurationId": null,
+ "instanceGroupId": null
+ }""".replaceAll("\\s+", "")
+
+ final String uuiRequest = """
+ "service":{
+ "name": "NSMF",
+ "description": "CSMFService",
+ "serviceInvariantUuid": "123456",
+ "serviceUuid": "123456",
+ "globalSubscriberId": "5GCustomer",
+ "serviceType": "5G",
+ "parameters": {},
+ "requestInputs": {
+ "sST": "embb",
+ "sNSSAI": "1-10101",
+ "uEMobilityLevel": "stationary",
+ "areaTrafficCapDL": 123,
+ "maxNumberofUEs": 1000,
+ "expDataRateUL": 2000,
+ "plmnIdList": "39-00|39-01",
+ "areaTrafficCapUL": 456,
+ "latency": 300,
+ "expDataRateDL": 400,
+ "coverageAreaTAList": 101001,
+ "activityFactor": 99,
+ "resourceSharingLevel": "shared"
+ }
+ }""".replaceAll("\\s+", "")
+
+ final def serviceProfile = ["sST": "embb", "sNSSAI": "1-10101", "uEMobilityLevel": "stationary", "areaTrafficCapDL": 123,
+ "maxNumberofUEs": 1000, "expDataRateUL": 2000, "plmnIdList": "39-00|39-01", "areaTrafficCapUL": 456,
+ "latency": 300, "expDataRateDL": 400, "coverageAreaTAList": 101001, "activityFactor": 99,
+ "resourceSharingLevel": "shared"]
+
+ final def nstSolution = ["UUID": "aaaaaa", "NSTName": "test NST", "invariantUUID": "bbbbbb", "matchLevel": "100%"]
+
+ @Test
+ void testPreProcessRequest() {
+ when(mockExecution.getVariable("bpmnRequest")).thenReturn(bpmnRequest)
+ when(mockExecution.getVariable("mso-request-id")).thenReturn("123456")
+ CreateSliceService sliceService = new CreateSliceService()
+ sliceService.preProcessRequest(mockExecution)
+ Mockito.verify(mockExecution, times(14)).setVariable(captor.capture() as String, captor.capture())
+ List<ExecutionEntity> values = captor.getAllValues()
+ assertNotNull(values)
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy
new file mode 100644
index 0000000000..8c08e51efe
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationServiceTest.groovy
@@ -0,0 +1,308 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.logging.filter.base.ONAPComponents
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+
+import javax.ws.rs.NotFoundException
+import javax.ws.rs.core.Response
+
+import static org.junit.Assert.assertEquals
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.*
+
+class DeleteCommunicationServiceTest extends MsoGroovyTest {
+
+ private HttpClientFactory httpClientFactoryMock
+ private HttpClient httpClientMock
+
+ @Before
+ void init() throws IOException {
+ super.init("DeleteCommunicationServiceTest")
+ }
+
+ @Captor
+ static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+ @Test
+ void testPreProcessRequest(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("bpmnRequest")).thenReturn("""
+ {
+ "globalSubscriberId ":"5GCustomer",
+ "serviceType ":"5G"
+ }""".replaceAll("\\\\s+", ""))
+ when(mockExecution.getVariable("mso-request-id")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82")
+
+ DeleteCommunicationService delCS = new DeleteCommunicationService()
+ delCS.preProcessRequest(mockExecution)
+ Mockito.verify(mockExecution,times(3)).setVariable(captor.capture() as String, captor.capture())
+ List<ExecutionEntity> values = captor.getAllValues()
+ assertNotNull(values)
+ }
+
+ @Test
+ void testPreInitUpdateOperationStatus(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test")
+ when(mockExecution.getVariable("result")).thenReturn("processing")
+ when(mockExecution.getVariable("progress")).thenReturn("0")
+ when(mockExecution.getVariable("operationContent")).thenReturn("delete communication service operation start")
+
+ DeleteCommunicationService delCS = new DeleteCommunicationService()
+ delCS.preInitUpdateOperationStatus(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String updateOperationStatus= captor.getValue()
+ assertNotNull(updateOperationStatus)
+ }
+
+ @Test
+ void testQueryCommunicationSeriveFromAAI(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+ DeleteCommunicationService obj = spy(DeleteCommunicationService.class)
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryCommunicationServiceReturn())
+ when(obj.getAAIClient()).thenReturn(client)
+ when(client.exists(resourceUri)).thenReturn(true)
+ when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper)
+ obj.queryCommunicationSeriveFromAAI(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("e2eSliceServiceInstanceId"), captor.capture())
+ String e2eSliceServiceInstanceId = captor.getValue()
+ assertNotNull(e2eSliceServiceInstanceId)
+ }
+
+ @Test
+ void testPrepareCallCheckProcessStatus(){
+ DeleteCommunicationService dcs = new DeleteCommunicationService()
+ dcs.prepareCallCheckProcessStatus(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("endProgress"), captor.capture())
+ int endProgress = captor.getValue()
+ assertEquals(90,endProgress)
+ }
+
+ @Test
+ void testDelCSProfileFromAAI()
+ {
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryCommunicationServiceProfile())
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_PROFILE_ALL, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+ AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be", "5G-111111")
+
+ DeleteCommunicationService obj = spy(DeleteCommunicationService.class)
+ when(obj.getAAIClient()).thenReturn(client)
+ when(client.exists(resourceUri)).thenReturn(true)
+ when(client.exists(profileUri)).thenReturn(true)
+ when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper)
+ doNothing().when(client).delete(profileUri)
+ obj.delCSProfileFromAAI(mockExecution)
+ Mockito.verify(client,times(1)).delete(profileUri)
+ }
+
+ @Test
+ void testPrepareFailureStatus(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test")
+ when(mockExecution.getVariable("result")).thenReturn("finished")
+ when(mockExecution.getVariable("progress")).thenReturn("100")
+ when(mockExecution.getVariable("operationContent")).thenReturn("terminate service failure.")
+
+ DeleteCommunicationService dcs = new DeleteCommunicationService()
+ dcs.prepareFailureStatus(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String updateOperationStatus= captor.getValue()
+ assertNotNull(updateOperationStatus)
+ }
+
+ @Test
+ void testDelCSFromAAI(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+ DeleteCommunicationService obj = spy(DeleteCommunicationService.class)
+ when(obj.getAAIClient()).thenReturn(client)
+ doNothing().when(client).delete(serviceInstanceUri)
+
+ obj.delCSFromAAI(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String updateOperationStatus= captor.getValue()
+ assertNotNull(updateOperationStatus)
+ }
+
+ @Test
+ void testPreFailedOperationStatus(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test")
+ when(mockExecution.getVariable("result")).thenReturn("error")
+ when(mockExecution.getVariable("progress")).thenReturn("100")
+ when(mockExecution.getVariable("operationContent")).thenReturn("terminate service failure")
+
+ DeleteCommunicationService deleteCommunicationService = new DeleteCommunicationService()
+ WorkflowException exception = new WorkflowException("11113",7000,"terminate service failure")
+ when(mockExecution.getVariable("WorkflowException")).thenReturn(exception)
+ deleteCommunicationService.preFailedOperationStatus(mockExecution)
+
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String updateOperationStatus= captor.getValue()
+ assertNotNull(updateOperationStatus)
+ }
+
+ @Test
+ void testSendRequest2NSMFWF(){
+ httpClientMock = mock(HttpClient.class)
+ httpClientFactoryMock = mock(HttpClientFactory.class)
+ String url ="http://so.onap:8080/onap/so/infra/e2eServiceInstances/v3/5G-777"
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+ when(mockExecution.getVariable("progress")).thenReturn("20")
+ when(mockExecution.getVariable("operationContent")).thenReturn("waiting nsmf service delete finished")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("mso.infra.endpoint.url")).thenReturn("http://so.onap:8080/onap/so/infra")
+ when(mockExecution.getVariable("e2eSliceServiceInstanceId")).thenReturn("5G-777")
+ when(mockExecution.getVariable("e2eOperationId")).thenReturn("e151059a-d924-4629-845f-264db19e50b3")
+ when(httpClientFactoryMock.newJsonClient(new URL(url), ONAPComponents.SO)).thenReturn(httpClientMock)
+ DeleteCommunicationService obj = spy(DeleteCommunicationService.class)
+
+ Response responseMock = mock(Response.class)
+ when(responseMock.getStatus()).thenReturn(200)
+ when(responseMock.hasEntity()).thenReturn(true)
+ when(responseMock.getEntity()).thenReturn(getNSSMFResponse())
+ when(obj.getHttpClientFactory()).thenReturn(httpClientFactoryMock)
+ when(httpClientMock.delete(anyString())).thenReturn(responseMock)
+
+ obj.sendRequest2NSMFWF(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String updateOperationStatus= captor.getValue()
+ assertNotNull(updateOperationStatus)
+ }
+
+ private String getNSSMFResponse(){
+ String response = """{
+ "service":{
+ "serviceId":"e151059a-d924-4629-845f-264db19e50b4",
+ "operationId":"e151059a-d924-4629-845f-264db19e50b3"
+ }
+ }"""
+ return response
+ }
+
+
+
+
+ private String mockQueryCommunicationServiceReturn()
+ {
+ String expect =
+ """{
+ "service-instance-id": "5G-666",
+ "service-instance-name": "eMBB_Slice_Communication_Service_5GCustomer",
+ "service-type": "eMBB",
+ "service-role": "communication-service",
+ "environment-context": "01-010101",
+ "workload-context": "12",
+ "created-at": "2019-12-11 19:56:00",
+ "description": "",
+ "model-invariant-id": "e75698d9-925a-4cdd-a6c0-edacbe6a0b51",
+ "model-version-id": "8ee5926d-720b-4bb2-86f9-d20e921c143b",
+ "service-instance-location-id": "300-01|300-02",
+ "resource-version": "1582623470778",
+ "orchestration-status": "created",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/5G-777",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "5GCustomer"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "5G"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "5G-777"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "eMBB_e2e_Slice_Service_5GCustomer"
+ }
+ ]
+ }
+ ]
+ }
+ }"""
+ return expect
+ }
+
+ private String mockQueryCommunicationServiceProfile()
+ {
+ String expect =
+ """{
+ "communication-service-profile": [
+ {
+ "profile-id": "5G-111111",
+ "max-number-of-UEs": 50,
+ "coverage-area-list": "longgang,futian",
+ "latency": 20,
+ "exp-data-rate-UL": 300,
+ "exp-data-rate-DL": 500,
+ "ue-mobility-level": "stationary",
+ "resource-sharing-level": "Non-Shared",
+ "resource-version": "1577454950460"
+ }
+ ]
+ }"""
+ return expect
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy
new file mode 100644
index 0000000000..fb50fcc43b
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceServiceTest.groovy
@@ -0,0 +1,171 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+
+import javax.ws.rs.NotFoundException
+
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.doNothing
+import static org.mockito.Mockito.spy
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.when
+import static org.mockito.Mockito.when
+import static org.mockito.Mockito.when
+
+class DeleteSliceServiceTest extends MsoGroovyTest {
+ @Before
+ void init() throws IOException {
+ super.init("DeleteSliceServiceTest")
+ }
+
+ @Captor
+ static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+ @Test
+ void testPreProcessRequest(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("eb0863e9-a69b-4b17-8a56-f05ad110bef7")
+ when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+ when(mockExecution.getVariable("result")).thenReturn("processing")
+ when(mockExecution.getVariable("progress")).thenReturn("0")
+ when(mockExecution.getVariable("operationContent")).thenReturn("Delete Slice service operation start")
+ when(mockExecution.getVariable("bpmnRequest")).thenReturn("""
+ {
+ "globalSubscriberId ":"5GCustomer",
+ "serviceType ":"5G"
+ }""".replaceAll("\\\\s+", ""))
+ when(mockExecution.getVariable("mso-request-id")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82")
+
+ DeleteSliceService delSS = new DeleteSliceService()
+ delSS.preProcessRequest(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String updateOperationStatus = captor.getValue()
+ assertNotNull(updateOperationStatus)
+ }
+
+ @Test
+ void testDeleteSliceServiceInstance(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+
+ when(mockExecution.getVariable("result")).thenReturn("finished")
+ when(mockExecution.getVariable("progress")).thenReturn("100")
+ when(mockExecution.getVariable("operationContent")).thenReturn("NSMF completes slicing service termination.")
+
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+ DeleteSliceService obj = spy(DeleteSliceService.class)
+ when(obj.getAAIClient()).thenReturn(client)
+ doNothing().when(client).delete(serviceInstanceUri)
+
+ obj.deleteSliceServiceInstance(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String updateOperationStatus= captor.getValue()
+ assertNotNull(updateOperationStatus)
+ }
+
+ @Test
+ void testDelServiceProfileFromAAI(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(mockQuerySliceServiceProfile())
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE_ALL, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+ AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be", "5G-2222222")
+
+ DeleteSliceService obj = spy(DeleteSliceService.class)
+ when(obj.getAAIClient()).thenReturn(client)
+ when(client.exists(resourceUri)).thenReturn(true)
+ when(client.exists(profileUri)).thenReturn(true)
+ when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper)
+ doNothing().when(client).delete(profileUri)
+ obj.delServiceProfileFromAAI(mockExecution)
+ Mockito.verify(client,times(1)).delete(profileUri)
+ }
+
+ @Test
+ void testPrepareEndOperationStatus(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceInstanceName")).thenReturn("5G-test")
+ when(mockExecution.getVariable("result")).thenReturn("error")
+ when(mockExecution.getVariable("progress")).thenReturn("100")
+ when(mockExecution.getVariable("operationContent")).thenReturn("terminate service failure")
+
+ DeleteSliceService deleteSliceService = new DeleteSliceService()
+ WorkflowException exception = new WorkflowException("11113",7000,"terminate service failure")
+ when(mockExecution.getVariable("WorkflowException")).thenReturn(exception)
+ deleteSliceService.prepareEndOperationStatus(mockExecution)
+
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String updateOperationStatus= captor.getValue()
+ assertNotNull(updateOperationStatus)
+
+ }
+
+ private String mockQuerySliceServiceProfile(){
+ String expect =
+ """{
+ "service-profile": [
+ {
+ "profile-id": "5G-2222222",
+ "latency": 50,
+ "max-number-of-UEs": 500,
+ "coverage-area-TA-list": "longgang,futian",
+ "ue-mobility-level": "stationary",
+ "resource-sharing-level": "Non-Shared",
+ "exp-data-rate-UL": 10,
+ "exp-data-rate-DL": 30,
+ "area-traffic-cap-UL": 100,
+ "area-traffic-cap-DL": 100,
+ "activity-factor": 80,
+ "jitter": 10,
+ "survival-time": 30,
+ "cs-availability": 95.5,
+ "reliability": 99.9,
+ "exp-data-rate": 80,
+ "traffic-density": 100,
+ "conn-density": 80,
+ "resource-version": "1577454958647"
+ }
+ ]
+ }"""
+ return expect
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationServiceTest.groovy
new file mode 100644
index 0000000000..37207f8022
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationServiceTest.groovy
@@ -0,0 +1,196 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+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.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.aai.domain.yang.CommunicationServiceProfile
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.onap.so.client.aai.AAIResourcesClient
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs
+import static org.junit.Assert.assertEquals
+import static org.junit.Assert.assertNotNull
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.*
+
+class DoCreateCommunicationServiceTest extends MsoGroovyTest {
+
+ private DoCreateCommunicationService communicationService = new DoCreateCommunicationService()
+
+ @Before
+ public void setUp() throws Exception {
+ super.init("DoCreateCommunicationService")
+ communicationService.client = spy(AAIResourcesClient.class)
+ }
+
+ @Captor
+ static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+ @Test
+ public void testPreProcessRequest(){
+ mockData()
+ DoCreateCommunicationService communicationService = new DoCreateCommunicationService()
+ communicationService.preProcessRequest(mockExecution)
+ Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture())
+ assertNotNull(captor.getAllValues())
+ }
+
+ @Test
+ public void testCreateCommunicationService() {
+ mockData()
+ ServiceInstance expectedServiceInstanceData = getExpectedServiceInstance()
+
+ try {
+ communicationService.createCommunicationService(mockExecution)
+ } catch (Exception e) {
+
+ assertEquals(e.class, BpmnError.class)
+ }
+
+
+ Mockito.verify(mockExecution).setVariable(eq("communicationServiceInstance"), captor.capture())
+ ServiceInstance resData = captor.getValue()
+ resData.setCreatedAt("")
+ resData.setEnvironmentContext("")
+ assertThat(resData, sameBeanAs(expectedServiceInstanceData))
+ }
+
+ @Test
+ public void testCreateCommunicationServiceProfile() {
+ mockData()
+ DoCreateCommunicationService communicationService = new DoCreateCommunicationService()
+
+ CommunicationServiceProfile expectedServiceInstanceData = getExpectedServiceInstanceProfile()
+
+ try {
+ communicationService.createCommunicationServiceProfile(mockExecution)
+ } catch (Exception e) {
+ assertEquals(e.class, BpmnError.class)
+ }
+
+ Mockito.verify(mockExecution).setVariable(eq("communicationServiceInstanceProfile"), captor.capture())
+ CommunicationServiceProfile resData = captor.getValue()
+ resData.setProfileId("")
+ assertThat(resData, sameBeanAs(expectedServiceInstanceData))
+ }
+
+ private static CommunicationServiceProfile getExpectedServiceInstanceProfile() {
+ CommunicationServiceProfile expectedServiceInstanceData = new CommunicationServiceProfile()
+ expectedServiceInstanceData.setProfileId("")
+ expectedServiceInstanceData.setLatency(20)
+ expectedServiceInstanceData.setMaxNumberOfUEs(300)
+ expectedServiceInstanceData.setUeMobilityLevel("stationary")
+ expectedServiceInstanceData.setResourceSharingLevel("shared")
+ expectedServiceInstanceData.setExpDataRateUL(30)
+ expectedServiceInstanceData.setExpDataRateDL(10)
+ expectedServiceInstanceData.setCoverageAreaList("01001")
+ return expectedServiceInstanceData
+ }
+
+ private static ServiceInstance getExpectedServiceInstance() {
+ ServiceInstance expectedServiceInstanceData = new ServiceInstance()
+ expectedServiceInstanceData.setServiceInstanceName("CSMFService")
+ expectedServiceInstanceData.setServiceRole("communication-service")
+ expectedServiceInstanceData.setOrchestrationStatus("processing")
+ expectedServiceInstanceData.setModelInvariantId("e75698d9-925a-4cdd-a6c0-edacbe6a0b51")
+ expectedServiceInstanceData.setModelVersionId("8ee5926d-720b-4bb2-86f9-d20e921c143b")
+ expectedServiceInstanceData.setInputParameters("""{
+ "service":{
+ "name":"CSMFService",
+ "description":"CSMFService",
+ "serviceInvariantUuid":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51",
+ "serviceUuid":"8ee5926d-720b-4bb2-86f9-d20e921c143b",
+ "globalSubscriberId":"5GCustomer",
+ "serviceType":"5G",
+ "parameters":{
+ "requestInputs":{
+ "expDataRateDL":10,
+ "expDataRateUL":30,
+ "latency":20,
+ "maxNumberofUEs":300,
+ "uemobilityLevel":"stationary",
+ "resourceSharingLevel":"shared",
+ "coverageAreaList": "01001",
+ "useInterval":"3"
+ }
+ }
+ }
+ }""")
+ expectedServiceInstanceData.setWorkloadContext("3")
+ expectedServiceInstanceData.setCreatedAt("")
+ expectedServiceInstanceData.setEnvironmentContext("")
+ return expectedServiceInstanceData
+ }
+
+ private void mockData() {
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345")
+ when(mockExecution.getVariable("serviceInstanceName")).thenReturn("CSMFService")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+ when(mockExecution.getVariable("uuiRequest")).thenReturn("""{
+ "service":{
+ "name":"CSMFService",
+ "description":"CSMFService",
+ "serviceInvariantUuid":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51",
+ "serviceUuid":"8ee5926d-720b-4bb2-86f9-d20e921c143b",
+ "globalSubscriberId":"5GCustomer",
+ "serviceType":"5G",
+ "parameters":{
+ "requestInputs":{
+ "expDataRateDL":10,
+ "expDataRateUL":30,
+ "latency":20,
+ "maxNumberofUEs":300,
+ "uemobilityLevel":"stationary",
+ "resourceSharingLevel":"shared",
+ "coverageAreaList": "01001",
+ "useInterval":"3"
+ }
+ }
+ }
+ }""")
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ Map<String, Object> csInputMap = new HashMap<>()
+ csInputMap.put("expDataRateDL", 10)
+ csInputMap.put("expDataRateUL", 30)
+ csInputMap.put("latency", 20)
+ csInputMap.put("maxNumberofUEs", 300)
+ csInputMap.put("uEMobilityLevel", "stationary")
+ csInputMap.put("resourceSharingLevel", "shared")
+ csInputMap.put("coverageAreaTAList", "01001")
+ csInputMap.put("useInterval", "3")
+
+ when(mockExecution.getVariable("csInputMap")).thenReturn(csInputMap)
+
+ when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("e75698d9-925a-4cdd-a6c0-edacbe6a0b51")
+ when(mockExecution.getVariable("modelUuid")).thenReturn("8ee5926d-720b-4bb2-86f9-d20e921c143b")
+ when(mockExecution.getVariable("useInterval")).thenReturn("3")
+ when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G")
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy
index dd18049b5f..7107d15602 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy
@@ -45,6 +45,7 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.mock.FileUtil
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException
@@ -168,7 +169,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
fqdnList.add("test")
when(mockExecution.getVariable(prefix + "createdNetworkPolicyFqdnList")).thenReturn(fqdnList)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", "test")
NetworkPolicies networkPolicies = new NetworkPolicies();
NetworkPolicy networkPolicy = new NetworkPolicy();
@@ -198,7 +199,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
fqdnList.add("test")
when(mockExecution.getVariable(prefix + "createdNetworkPolicyFqdnList")).thenReturn(fqdnList)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", "test")
NetworkPolicies networkPolicies = new NetworkPolicies();
NetworkPolicy networkPolicy = new NetworkPolicy();
@@ -228,7 +229,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
fqdnList.add("test")
when(mockExecution.getVariable(prefix + "createdNetworkPolicyFqdnList")).thenReturn(fqdnList)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", "test")
NetworkPolicies networkPolicies = new NetworkPolicies();
NetworkPolicy networkPolicy = new NetworkPolicy();
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy
index 5c68cc7fc1..8941a24ebc 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollbackTest.groovy
@@ -27,6 +27,7 @@ import org.onap.aai.domain.yang.VolumeGroup
import org.onap.aai.domain.yang.VolumeGroups;
import org.onap.so.bpmn.common.scripts.MsoGroovyTest
import org.onap.so.client.aai.AAIObjectPlurals
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
@@ -50,7 +51,7 @@ public class DoCreateVfModuleVolumeRollbackTest extends MsoGroovyTest {
String cloudRegionId = "cloudRegionId"
when(mockExecution.getVariable("DCVFMODVOLRBK_volumeGroupName")).thenReturn(volumeGroupName)
when(mockExecution.getVariable("DCVFMODVOLRBK_lcpCloudRegionId")).thenReturn(cloudRegionId)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegionId).queryParam("volume-group-name", volumeGroupName)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegionId).queryParam("volume-group-name", volumeGroupName)
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("volumeGroupId")
VolumeGroups groups = new VolumeGroups();
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy
index ddb1fbade4..22414b770e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy
@@ -40,6 +40,7 @@ import org.onap.so.bpmn.common.scripts.MsoGroovyTest
import org.onap.so.bpmn.core.RollbackData
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
@@ -160,7 +161,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest {
String lcpCloudRegionId = "lcpCloudRegionId"
when(mockExecution.getVariable(volumeGroupName)).thenReturn(volumeGroupName)
when(mockExecution.getVariable(lcpCloudRegionId)).thenReturn(lcpCloudRegionId)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).queryParam("volume-group-name", volumeGroupName)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).queryParam("volume-group-name", volumeGroupName)
VolumeGroups volumeGroups = new VolumeGroups();
VolumeGroup volumeGroup = new VolumeGroup()
volumeGroup.setVolumeGroupId("volumeGroupId")
@@ -176,7 +177,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest {
String lcpCloudRegionId = "lcpCloudRegionId"
when(mockExecution.getVariable(volumeGroupName)).thenReturn(volumeGroupName)
when(mockExecution.getVariable(lcpCloudRegionId)).thenReturn(lcpCloudRegionId)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).queryParam("volume-group-name", volumeGroupName)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).queryParam("volume-group-name", volumeGroupName)
when(client.get(VolumeGroup.class,uri)).thenReturn(Optional.empty())
thrown.expect(BpmnError.class)
doCreateVfModuleVolumeV2.callRESTQueryAAIVolGrpName(mockExecution,null)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy
new file mode 100644
index 0000000000..493e2c9e1e
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSITest.groovy
@@ -0,0 +1,258 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.logging.filter.base.ONAPComponents
+import org.onap.so.beans.nsmf.JobStatusResponse
+import org.onap.so.beans.nsmf.NssiResponse
+import org.onap.so.beans.nsmf.ResponseDescriptor
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.onap.so.bpmn.core.domain.ServiceArtifact
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceInfo
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+
+import javax.ws.rs.core.Response
+
+import static org.junit.Assert.assertNotNull
+import static org.junit.Assert.assertTrue
+import static org.mockito.ArgumentMatchers.anyString
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.doNothing
+import static org.mockito.Mockito.mock
+import static org.mockito.Mockito.spy
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.when
+
+class DoDeallocateNSSITest extends MsoGroovyTest {
+
+ private HttpClientFactory httpClientFactoryMock
+ private HttpClient httpClientMock
+
+ @Before
+ void init() throws IOException {
+ super.init("DoDeallocateNSSITest")
+ }
+
+ @Captor
+ static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+
+ @Test
+ void testPreProcessRequest(){
+ def currentNSSI = [:]
+ currentNSSI.put("nssiServiceInstanceId","5G-999")
+ when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+ DoDeallocateNSSI ddnssi = new DoDeallocateNSSI()
+ ddnssi.preProcessRequest(mockExecution)
+ Mockito.verify(mockExecution,times(1)).getVariable("currentNSSI")
+ }
+
+ @Test
+ void testPrepareDecomposeService(){
+ def currentNSSI = [:]
+ currentNSSI.put("modelInvariantId", "21d57d4b-52ad-4d3c-a798-248b5bb9124b")
+ currentNSSI.put("modelVersionId", "bfba363e-e39c-4bd9-a9d5-1371c28f4d22")
+ currentNSSI.put("nssiServiceInstanceId","5G-999")
+ when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+ DoDeallocateNSSI ddnssi = new DoDeallocateNSSI()
+ ddnssi.prepareDecomposeService(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("serviceModelInfo"), captor.capture())
+ String serviceModelInfo = captor.getValue()
+ assertNotNull(serviceModelInfo)
+ }
+
+ @Test
+ void testProcessDecomposition(){
+ def currentNSSI = [:]
+ ServiceArtifact artifact = new ServiceArtifact()
+ artifact.setContent(getArtifactContent())
+ ServiceInfo serviceInfo = new ServiceInfo()
+ List<ServiceArtifact> artifactList = new ArrayList<>()
+ artifactList.add(artifact)
+ serviceInfo.setServiceArtifact(artifactList)
+ ServiceDecomposition decomposition = new ServiceDecomposition()
+ decomposition.setServiceInfo(serviceInfo)
+ when(mockExecution.getVariable("serviceDecomposition")).thenReturn(decomposition)
+ when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+ DoDeallocateNSSI ddnssi = new DoDeallocateNSSI()
+ ddnssi.processDecomposition(mockExecution)
+ String vendor = currentNSSI.get("vendor")
+ assertNotNull(vendor)
+ }
+
+ @Test
+ void testHandleJobStatus(){
+ def currentNSSI = [:]
+ currentNSSI.put("jobProgress", 10)
+ currentNSSI.put("proportion", 90)
+ currentNSSI.put("statusDescription","")
+ currentNSSI.put("e2eServiceInstanceId","21d57d4b-52ad-4d3c-a798-248b5bb9124b")
+ currentNSSI.put("operationId","4c614769-f58a-4556-8ad9-dcd903077c82")
+ when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+ DoDeallocateNSSI ddnssi = new DoDeallocateNSSI()
+ ddnssi.handleJobStatus(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("updateOperationStatus"), captor.capture())
+ String updateOperationStatus= captor.getValue()
+ assertNotNull(updateOperationStatus)
+ }
+
+ @Test
+ void testDelSliceProfileFromAAI(){
+ def currentNSSI = [:]
+ currentNSSI.put("nssiServiceInstanceId", "5G-999")
+ currentNSSI.put("profileId", "ddf57704-fe8d-417b-882d-2f2a12ddb225")
+ currentNSSI.put("globalSubscriberId","5GCustomer")
+ currentNSSI.put("serviceType","5G")
+ when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+
+ AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, "5GCustomer", "5G", "5G-999", "ddf57704-fe8d-417b-882d-2f2a12ddb225")
+ DoDeallocateNSSI obj = spy(DoDeallocateNSSI.class)
+ when(obj.getAAIClient()).thenReturn(client)
+ when(client.exists(profileUri)).thenReturn(true)
+ doNothing().when(client).delete(profileUri)
+
+ obj.delSliceProfileFromAAI(mockExecution)
+ Mockito.verify(client,times(1)).delete(profileUri)
+ }
+
+ @Test
+ void testSendRequestToNSSMF(){
+ httpClientFactoryMock = mock(HttpClientFactory.class)
+ httpClientMock = mock(HttpClient.class)
+
+ def currentNSSI = [:]
+ currentNSSI.put("snssai", "01-010101")
+ currentNSSI.put("profileId", "ddf57704-fe8d-417b-882d-2f2a12ddb225")
+ currentNSSI.put("nssiServiceInstanceId","5G-999")
+ currentNSSI.put("nsiServiceInstanceId","5G-888")
+
+ when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+ when(mockExecution.getVariable("mso.adapters.nssmf.endpoint")).thenReturn("http://so-nssmf-adapter.onap:8088")
+ String nssmfRequest = "http://so-nssmf-adapter.onap:8088/api/rest/provMns/v1/NSS/SliceProfiles/ddf57704-fe8d-417b-882d-2f2a12ddb225"
+
+ when(httpClientFactoryMock.newJsonClient(new URL(nssmfRequest), ONAPComponents.EXTERNAL)).thenReturn(httpClientMock)
+ DoDeallocateNSSI obj = spy(DoDeallocateNSSI.class)
+ when(obj.getHttpClientFactory()).thenReturn(httpClientFactoryMock)
+ Response responseMock = mock(Response.class)
+ NssiResponse response = new NssiResponse()
+ response.setNssiId("NSSI-C-004-HDBHZ-NSSMF-01-A-HW")
+ response.setJobId("a5c5913d-448a-bcb1-9b800a944d84")
+ when(httpClientMock.post(anyString())).thenReturn(responseMock)
+ when(responseMock.getStatus()).thenReturn(202)
+ when(responseMock.readEntity(NssiResponse.class)) thenReturn(response)
+ when(responseMock.hasEntity()).thenReturn(true)
+
+ obj.sendRequestToNSSMF(mockExecution)
+ String jobId = currentNSSI['jobId']
+ assertNotNull(jobId)
+ }
+
+ @Test
+ void testGetJobStatus(){
+ httpClientFactoryMock = mock(HttpClientFactory.class)
+ httpClientMock = mock(HttpClient.class)
+
+ def currentNSSI = [:]
+ currentNSSI.put("jobId", "a5c5913d-448a-bcb1-9b800a944d84")
+ currentNSSI.put("nssiServiceInstanceId","5G-999")
+ currentNSSI.put("nsiServiceInstanceId","5G-888")
+ currentNSSI.put("jobProgress",60)
+
+ when(mockExecution.getVariable("isNSSIDeAllocated")).thenReturn(false)
+ when(mockExecution.getVariable("isNSSIDeAllocated")).thenReturn(false)
+ when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+ when(mockExecution.getVariable("mso.adapters.nssmf.endpoint")).thenReturn("http://so-nssmf-adapter.onap:8088")
+ String nssmfRequest = "http://so-nssmf-adapter.onap:8088/api/rest/provMns/v1/NSS/jobs/a5c5913d-448a-bcb1-9b800a944d84"
+
+ when(httpClientFactoryMock.newJsonClient(new URL(nssmfRequest), ONAPComponents.EXTERNAL)).thenReturn(httpClientMock)
+ DoDeallocateNSSI obj = spy(DoDeallocateNSSI.class)
+ when(obj.getHttpClientFactory()).thenReturn(httpClientFactoryMock)
+ Response responseMock = mock(Response.class)
+ ResponseDescriptor descriptor = new ResponseDescriptor()
+ descriptor.setProgress(100)
+ descriptor.setStatusDescription("finished deallocate nssi")
+ JobStatusResponse jobStatusResponse = new JobStatusResponse()
+ jobStatusResponse.setResponseDescriptor(descriptor)
+ when(httpClientMock.post(anyString())).thenReturn(responseMock)
+ when(responseMock.getStatus()).thenReturn(202)
+ when(responseMock.readEntity(JobStatusResponse.class)) thenReturn(jobStatusResponse)
+ when(responseMock.hasEntity()).thenReturn(true)
+
+ obj.getJobStatus(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("isNSSIDeAllocated"), captor.capture())
+ boolean value = captor.getValue()
+ assertTrue(value)
+ }
+
+
+ private String getArtifactContent(){
+ String content =
+ """
+ {
+ "metadata":{
+ "id":"NSST-C-001-HDBNJ-NSSMF-01-A-HW",
+ "vendor":"HW",
+ "version":"1.0",
+ "name":"eMBB_demo",
+ "description":"eMBB for demo",
+ "type":"embb",
+ "domainType":"cn"
+ },
+ "capabilities":{
+ "latency":{
+ "type":"integer",
+ "constrainstsl":"less_or_equal",
+ "value":"20"
+ },
+ "areaTrafficCapDL":{
+ "type":"integer",
+ "constrainstsl":"less_or_equal",
+ "value":"300"
+ },
+ "areaTrafficCapUL":{
+ "type":"integer",
+ "constrainstsl":"less_or_equal",
+ "value":"300"
+ },
+ "maxNumberofUEs":{
+ "type":"integer",
+ "constrainstsl":"less_or_equal",
+ "value":"300"
+ }
+ }
+ }
+ """
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy
new file mode 100644
index 0000000000..8a18376819
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceServiceTest.groovy
@@ -0,0 +1,460 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.Test
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.so.bpmn.common.scripts.MsoGroovyTest
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.AAIResultWrapper
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+
+import javax.ws.rs.NotFoundException
+
+import static org.junit.Assert.assertEquals
+import static org.junit.Assert.assertNotNull
+import static org.junit.Assert.assertTrue
+import static org.mockito.ArgumentMatchers.eq
+import static org.mockito.Mockito.doNothing
+import static org.mockito.Mockito.spy
+import static org.mockito.Mockito.times
+import static org.mockito.Mockito.verify
+import static org.mockito.Mockito.when
+
+class DoDeleteSliceServiceTest extends MsoGroovyTest {
+ @Before
+ void init() throws IOException {
+ super.init("DoDeleteSliceServiceTest")
+ }
+
+ @Captor
+ static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+ @Test
+ void testPreProcessRequest(){
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("e2a747a0-2ca6-476d-ac28-de999cf3fbfe")
+
+ DoDeleteSliceService doDeleteSliceService = new DoDeleteSliceService()
+ doDeleteSliceService.preProcessRequest(mockExecution)
+
+ Mockito.verify(mockExecution,times(1)).setVariable(captor.capture() as String, captor.capture())
+ List<ExecutionEntity> values = captor.getAllValues()
+ assertNotNull(values)
+ }
+
+ @Test
+ void testQueryE2ESliceSeriveFromAAI(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+ DoDeleteSliceService obj = spy(DoDeleteSliceService.class)
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(mockQuerySliceServiceReturn())
+ when(obj.getAAIClient()).thenReturn(client)
+ when(client.exists(resourceUri)).thenReturn(true)
+ when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper)
+ obj.queryE2ESliceSeriveFromAAI(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("snssai"), captor.capture())
+ String snssai = captor.getValue()
+ assertNotNull(snssai)
+ }
+
+ @Test
+ void testGetAllottedResFromAAI(){
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE_ALL, "5GCustomer", "5G", "5ad89cf9-0569-4a93-9306-d8324321e2be")
+ DoDeleteSliceService obj = spy(DoDeleteSliceService.class)
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(mockQueryAllottedResource())
+ when(obj.getAAIClient()).thenReturn(client)
+ when(client.exists(resourceUri)).thenReturn(true)
+ when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper)
+ obj.getAllottedResFromAAI(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("nsiId"), captor.capture())
+ String nsiId = captor.getValue()
+ assertNotNull(nsiId)
+ }
+
+ @Test
+ void testGetNSIFromAAI(){
+ when(mockExecution.getVariable("nsiId")).thenReturn("5G-888")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5G-888")
+ DoDeleteSliceService obj = spy(DoDeleteSliceService.class)
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(mockNSIReturn())
+ when(obj.getAAIClient()).thenReturn(client)
+ when(client.exists(resourceUri)).thenReturn(true)
+ when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper)
+ obj.getNSIFromAAI(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("nssiIdList"), captor.capture())
+ List<String> nssiIdList = captor.getValue()
+ assertNotNull(nssiIdList)
+ }
+
+ @Test
+ void testGetNSSIListFromAAI(){
+ List<String> nssiIdList = []
+ nssiIdList.add("5G-999")
+
+ when(mockExecution.getVariable("nssiIdList")).thenReturn(nssiIdList)
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "5GCustomer", "5G", "5G-999")
+ DoDeleteSliceService obj = spy(DoDeleteSliceService.class)
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(mockNSSIReturn())
+ when(obj.getAAIClient()).thenReturn(client)
+ when(client.exists(resourceUri)).thenReturn(true)
+ when(client.get(resourceUri, NotFoundException.class)).thenReturn(wrapper)
+ obj.getNSSIListFromAAI(mockExecution)
+ Mockito.verify(mockExecution,times(1)).setVariable(eq("nssiInstanceList"), captor.capture())
+ List<ServiceInstance> nssiInstanceList = captor.getValue()
+ assertNotNull(nssiInstanceList)
+ }
+
+ @Test
+ void testGetCurrentNSSI(){
+ ServiceInstance nssi = new ServiceInstance()
+ nssi.setServiceInstanceId("5G-999")
+ nssi.setModelInvariantId("21d57d4b-52ad-4d3c-a798-248b5bb9124a")
+ nssi.setModelVersionId("bfba363e-e39c-4bd9-a9d5-1371c28f4d22")
+ List<ServiceInstance> nssiInstanceList = []
+ nssiInstanceList.add(nssi)
+ when(mockExecution.getVariable("currentNSSIIndex")).thenReturn(0)
+ when(mockExecution.getVariable("nssiInstanceList")).thenReturn(nssiInstanceList)
+ when(mockExecution.getVariable("snssai")).thenReturn("01-010101")
+ when(mockExecution.getVariable("nsiId")).thenReturn("5G-888")
+ when(mockExecution.getVariable("operationId")).thenReturn("998c2081-5a71-4a39-9ae6-d6b7c5bb50c0")
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("5G-777")
+ when(mockExecution.getVariable("msoRequestId")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82")
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+ when(mockExecution.getVariable("proportion")).thenReturn("90")
+
+ DoDeleteSliceService ddss = new DoDeleteSliceService()
+ ddss.getCurrentNSSI(mockExecution)
+ verify(mockExecution,times(1)).setVariable(eq("currentNSSI"), captor.capture())
+ Map currentNSSI = captor.getValue()
+ assertTrue(currentNSSI.size()>0)
+ }
+
+ @Test
+ void testQuerySliceProfileFromAAI(){
+ def currentNSSI = [:]
+ currentNSSI.put("nssiServiceInstanceId","5G-999")
+ when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
+ when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer")
+ when(mockExecution.getVariable("serviceType")).thenReturn("5G")
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(mockSliceProfile())
+ AAIResourceUri profileUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE_ALL, "5GCustomer", "5G", "5G-999")
+
+ DoDeleteSliceService obj = spy(DoDeleteSliceService.class)
+ when(obj.getAAIClient()).thenReturn(client)
+ when(client.exists(profileUri)).thenReturn(true)
+ when(client.get(profileUri, NotFoundException.class)).thenReturn(wrapper)
+ obj.querySliceProfileFromAAI(mockExecution)
+ verify(mockExecution,times(1)).setVariable(eq("currentNSSI"), captor.capture())
+ Map value = captor.getValue()
+ assertNotNull(currentNSSI.get('profileId'))
+ }
+
+ @Test
+ void parseNextNSSI(){
+ ServiceInstance nssi = new ServiceInstance()
+ nssi.setServiceInstanceId("5G-999")
+ nssi.setModelInvariantId("21d57d4b-52ad-4d3c-a798-248b5bb9124b")
+ nssi.setModelVersionId("bfba363e-e39c-4bd9-a9d5-1371c28f4d22")
+ List<ServiceInstance> nssiInstanceList = []
+ nssiInstanceList.add(nssi)
+ when(mockExecution.getVariable("currentNSSIIndex")).thenReturn(0)
+ when(mockExecution.getVariable("nssiInstanceList")).thenReturn(nssiInstanceList)
+
+ DoDeleteSliceService ddss = new DoDeleteSliceService()
+ ddss.parseNextNSSI(mockExecution)
+ verify(mockExecution,times(1)).setVariable(eq("isAllNSSIFinished"), captor.capture())
+ boolean isAllNSSIFinished = captor.getValue()
+ assertTrue(isAllNSSIFinished)
+ }
+
+ private String mockSliceProfile(){
+ String expect =
+ """{
+ "slice-profile": [
+ {
+ "profile-id": "ddf57704-fe8d-417b-882d-2f2a12ddb225",
+ "latency": 20,
+ "max-number-of-UEs": 0,
+ "coverage-area-TA-list": "[{\\"province\\":\\"??\\",\\"city\\":\\"???\\",\\"county\\":\\"???\\",\\"street\\":\\"?????\\"}]",
+ "ue-mobility-level": "stationary",
+ "resource-sharing-level": "0",
+ "exp-data-rate-UL": 100,
+ "exp-data-rate-DL": 100,
+ "activity-factor": 0,
+ "e2e-latency": 0,
+ "jitter": 0,
+ "survival-time": 0,
+ "exp-data-rate": 0,
+ "payload-size": 0,
+ "traffic-density": 0,
+ "conn-density": 0,
+ "s-nssai": "01003",
+ "resource-version": "1580800791373"
+ }
+ ]
+ }
+ """
+ return expect
+ }
+
+ private String mockNSSIReturn(){
+ String expect =
+ """
+ {
+ "service-instance-id": "5G-999",
+ "service-instance-name": "eMBB_Slice_NSSI_5GCustomer",
+ "service-type": "eMBB",
+ "service-role": "nssi",
+ "environment-context": "cn",
+ "model-invariant-id": "21d57d4b-52ad-4d3c-a798-248b5bb9124a",
+ "model-version-id": "bfba363e-e39c-4bd9-a9d5-1371c28f4d22",
+ "service-instance-location-id": "300-01|300-02",
+ "resource-version": "1578449638032",
+ "orchestration-status": "activated",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/5G-888",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "5GCustomer"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "5G"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "5G-888"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "eMBB_e2e_Slice_Service_5GCustomer"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ """
+ return expect
+ }
+
+ private String mockNSIReturn(){
+ String expect =
+ """
+ {
+ "service-instance-id": "5G-888",
+ "service-instance-name": "eMBB_e2e_Slice_Service_5GCustomer",
+ "service-type": "embb",
+ "service-role": "nsi",
+ "model-invariant-id": "0e9bcb9a-c832-433b-a0c1-74866768f608",
+ "model-version-id": "2c5fd79d-0f84-4057-9222-952cb6f27036",
+ "service-instance-location-id": "300-01|300-02",
+ "resource-version": "1579691104911",
+ "orchestration-status": "activated",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/5G-999",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "5GCustomer"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "5G"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "5G-999"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "eMBB_Slice_NSSI_5GCustomer"
+ }
+ ]
+ },
+ {
+ "related-to": "allotted-resource",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/5G-777/allotted-resources/allotted-resource/5G-1234",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "5GCustomer"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "5G"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "5G-777"
+ },
+ {
+ "relationship-key": "allotted-resource.id",
+ "relationship-value": "5G-1234"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "allotted-resource.description"
+ },
+ {
+ "property-key": "allotted-resource.allotted-resource-name"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ """
+ return expect
+ }
+
+ private String mockQueryAllottedResource(){
+ String expect =
+ """{
+ "allotted-resource": [
+ {
+ "id": "5G-1234",
+ "resource-version": "1577454983471",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/5G-888",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "5GCustomer"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "5G"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "5G-888"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "eMBB_e2e_Slice_Service_5GCustomer"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ """
+ return expect
+ }
+
+ String mockQuerySliceServiceReturn(){
+ String expect =
+ """{
+ "service-instance-id": "5G-777",
+ "service-instance-name": "eMBB_e2e_Slice_Service_5GCustomer",
+ "service-type": "embb",
+ "service-role": "e2eslice-service",
+ "environment-context": "01-010101",
+ "model-invariant-id": "e65d737a-41e0-4ad1-958f-56defdf2e907",
+ "model-version-id": "f2f5967e-72d3-4c5c-b880-e214e71dba4e",
+ "service-instance-location-id": "300-01|300-02",
+ "resource-version": "1578449638436",
+ "orchestration-status": "activated",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v16/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/5G-666",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "5GCustomer"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "5G"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "5G-666"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "eMBB_Slice_Communication_Service_5GCustomer"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ """
+ return expect
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy
index f356845a1e..a8d07b696c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy
@@ -44,6 +44,7 @@ import org.onap.so.bpmn.common.scripts.MsoGroovyTest
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
@@ -105,7 +106,7 @@ class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest {
List fqdnList = new ArrayList()
fqdnList.add("test")
when(mockExecution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList")).thenReturn(fqdnList)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", "test")
NetworkPolicies networkPolicies = new NetworkPolicies();
NetworkPolicy networkPolicy = new NetworkPolicy();
@@ -127,7 +128,7 @@ class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest {
List fqdnList = new ArrayList()
fqdnList.add("test")
when(mockExecution.getVariable("DDVFMV_contrailNetworkPolicyFqdnList")).thenReturn(fqdnList)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", "test")
when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.empty())
deleteVfModuleFromVnf.deleteNetworkPoliciesFromAAI(mockExecution)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy
index b56e108faf..815b3a389c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy
@@ -47,6 +47,7 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.mock.FileUtil
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
@@ -104,7 +105,7 @@ class DoDeleteVfModuleTest extends MsoGroovyTest{
NetworkPolicy networkPolicy = new NetworkPolicy()
networkPolicy.setNetworkPolicyId("NP1")
networkPolicies.getNetworkPolicy().add(networkPolicy)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", "test")
when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies))
doDeleteVfModule.deleteNetworkPoliciesFromAAI(mockExecution)
@@ -120,7 +121,7 @@ class DoDeleteVfModuleTest extends MsoGroovyTest{
NetworkPolicy networkPolicy = new NetworkPolicy()
networkPolicy.setNetworkPolicyId("NP1")
networkPolicies.getNetworkPolicy().add(networkPolicy)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY)
uri.queryParam("network-policy-fqdn", "test")
when(client.get(NetworkPolicies.class, uri)).thenReturn(Optional.of(networkPolicies))
AAIResourceUri delUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "NP1")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java
index 289d97108f..05b0db5d25 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java
@@ -33,8 +33,6 @@ import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/NfSoftwareUpgradeDispatcherTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/NfSoftwareUpgradeDispatcherTest.java
new file mode 100644
index 0000000000..3c568ffc83
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/NfSoftwareUpgradeDispatcherTest.java
@@ -0,0 +1,182 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.so.bpmn.core.json.JsonUtils;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.RequestInfo;
+import org.onap.so.serviceinstancebeans.RequestParameters;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import java.io.IOException;
+import java.util.*;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.fail;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.*;
+import static org.onap.so.client.cds.PayloadConstants.PRC_TARGET_SOFTWARE_VERSION;
+
+
+@RunWith(SpringJUnit4ClassRunner.class)
+public class NfSoftwareUpgradeDispatcherTest {
+
+ private static final String TEST_PROCESS_KEY = "processKey1";
+ private static final String PROCESS_KEY = "testProcessKey";
+ private static final String TEST_PNF_RESOURCE_INSTANCE_NAME = "PNF_demo_resource";
+ private static final String TEST_PNF_RESOURCE_BLUEPRINT_NAME = "blueprintOnap";
+ private static final String TEST_PNF_RESOURCE_BLUEPRINT_VERSION = "1.0.1";
+ private static final String TEST_PNF_RESOURCE_CUSTOMIZATION_UUID = "9acb3a83-8a52-412c-9a45-901764938144";
+ private static final String TEST_PNF_CORRELATION_ID = "PNFDemo";
+ private static final String TEST_PNF_UUID = "FakeID";
+ private static final String TEST_PRC_CONTROLLER_ACTOR = "cds";
+ private static final String TEST_TARGET_SOFTWARE_VERSION = "demo-sw-ver2.0.0";
+
+ private static final String TEST_BPMN_REQUEST = "{\"requestDetails\":{" + "\"requestInfo\":{"
+ + "\"source\":\"VID\"," + "\"suppressRollback\":false," + "\"requestorId\":\"demo\","
+ + "\"productFamilyId\":\"SWUPid\"}," + "\"modelInfo\":{"
+ + "\"modelType\":\"service\",\"modelInvariantUuid\":\"439b7a2f-9524-4dbf-9eee-f2e05521df3f\","
+ + "\"modelInvariantId\":\"439b7a2f-9524-4dbf-9eee-f2e05521df3f\","
+ + "\"modelUuid\":\"42daaac6-5017-4e1e-96c8-6a27dfbe1421\",\"modelName\":\"PNF_int_service_2\","
+ + "\"modelVersion\":\"1.0\"},\"requestParameters\":{\"userParams\":[{\"name\":\"aic_zone\","
+ + "\"value\":\"nova\"},{\"name\":\"pnfId\",\"value\":\"PNFDemo\"},{\"name\":\"targetSoftwareVersion\",\"value\":\"demo-sw-ver2.0.0\"}],"
+ + "\"subscriptionServiceType\":\"SWUP\",\"aLaCarte\":false,\"pnfCorrelationId\":\"PNFDemo\"},"
+ + "\"cloudConfiguration\":{\"lcpCloudRegionId\":\"regionOne\",\"tenantId\":\"09a63533072f4a579d5c99c3b8fe94c6\"},"
+ + "\"subscriberInfo\":{\"globalSubscriberId\":\"ADemoCustomerInEric\"},\"project\":{\"projectName\":\"Project-Demonstration\"},"
+ + "\"owningEntity\":{\"owningEntityId\":\"5eae949c-1c50-4780-b8b5-7cbeb08856b4\",\"owningEntityName\":\"OE-Demonstration\"}}}";
+ /**
+ * Testing model UUID, should be the same as specified in the TEST_SERVICE_MODEL_INFO.
+ */
+ private static final String TEST_MODEL_UUID = "42daaac6-5017-4e1e-96c8-6a27dfbe1421";
+
+ @InjectMocks
+ private NfSoftwareUpgradeDispatcher nfSoftwareUpgradeDispatcher;
+
+ @Mock
+ private PnfManagement pnfManagement;
+
+ @Mock
+ private CatalogDbClient catalogDbClient;
+
+ @Mock
+ private ObjectMapper mapper;
+
+ private DelegateExecution execution = new DelegateExecutionFake();
+
+ @Before
+ public void setUp() throws IOException {
+ List<PnfResourceCustomization> pnfResourceCustomizations = new ArrayList<>();
+ pnfResourceCustomizations.add(buildPnfResourceCustomization());
+ given(catalogDbClient.getPnfResourceCustomizationByModelUuid(TEST_MODEL_UUID))
+ .willReturn(pnfResourceCustomizations);
+ execution.setVariable(PROCESS_KEY, TEST_PROCESS_KEY);
+ execution.setVariable("bpmnRequest", TEST_BPMN_REQUEST);
+ mockMapper();
+ mockAai();
+
+ }
+
+
+ @Test
+ public void testExecution_validCatalogDb_skipVariableSet() {
+ try {
+ nfSoftwareUpgradeDispatcher.execute(execution);
+ assertThat(execution.getVariable(MODEL_UUID)).isEqualTo(TEST_MODEL_UUID);
+ assertThat(execution.getVariable(PRC_TARGET_SOFTWARE_VERSION)).isEqualTo(TEST_TARGET_SOFTWARE_VERSION);
+ assertThat(execution.getVariable(PRC_BLUEPRINT_NAME)).isEqualTo(TEST_PNF_RESOURCE_BLUEPRINT_NAME);
+ assertThat(execution.getVariable(PRC_BLUEPRINT_VERSION)).isEqualTo(TEST_PNF_RESOURCE_BLUEPRINT_VERSION);
+ assertThat(execution.getVariable(PRC_CUSTOMIZATION_UUID)).isEqualTo(TEST_PNF_RESOURCE_CUSTOMIZATION_UUID);
+ assertThat(execution.getVariable(PRC_INSTANCE_NAME)).isEqualTo(TEST_PNF_RESOURCE_INSTANCE_NAME);
+ assertThat(execution.getVariable(PNF_CORRELATION_ID)).isEqualTo(TEST_PNF_CORRELATION_ID);
+ assertThat(execution.getVariable(PNF_UUID)).isEqualTo(TEST_PNF_UUID);
+ assertThat(execution.getVariable(PRC_CONTROLLER_ACTOR)).isEqualTo(TEST_PRC_CONTROLLER_ACTOR);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Exception thrown" + e.getMessage());
+ }
+ }
+
+ private void mockAai() throws IOException {
+ Pnf pnf = new Pnf();
+ pnf.setPnfId(TEST_PNF_UUID);
+ when(pnfManagement.getEntryFor(TEST_PNF_CORRELATION_ID)).thenReturn(Optional.of(pnf));
+ }
+
+ private PnfResourceCustomization buildPnfResourceCustomization() {
+ PnfResourceCustomization pnfResourceCustomization = new PnfResourceCustomization();
+ pnfResourceCustomization.setSkipPostInstConf(true);
+ pnfResourceCustomization.setBlueprintName(TEST_PNF_RESOURCE_BLUEPRINT_NAME);
+ pnfResourceCustomization.setBlueprintVersion(TEST_PNF_RESOURCE_BLUEPRINT_VERSION);
+ pnfResourceCustomization.setModelInstanceName(TEST_PNF_RESOURCE_INSTANCE_NAME);
+ pnfResourceCustomization.setModelCustomizationUUID(TEST_PNF_RESOURCE_CUSTOMIZATION_UUID);
+ pnfResourceCustomization.setControllerActor(TEST_PRC_CONTROLLER_ACTOR);
+ return pnfResourceCustomization;
+ }
+
+ private void mockMapper() throws IOException {
+ RequestDetails bpmnRequestDetails = new RequestDetails();
+
+ RequestInfo requestInfo = new RequestInfo();
+ requestInfo.setInstanceName("demo");
+ bpmnRequestDetails.setRequestInfo(requestInfo);
+
+ RequestParameters requestParameters = new RequestParameters();
+ List<Map<String, Object>> userParams = new ArrayList<>();
+ Map<String, Object> map = new HashMap<>();
+ map.put("name", "targetSoftwareVersion");
+ map.put("value", TEST_TARGET_SOFTWARE_VERSION);
+ userParams.add(map);
+ map = new HashMap<>();
+ map.put("name", "pnfName");
+ map.put("value", "PNFDemo");
+ userParams.add(map);
+ requestParameters.setUserParams(userParams);
+
+ bpmnRequestDetails.setRequestParameters(requestParameters);
+
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelInvariantUuid("439b7a2f-9524-4dbf-9eee-f2e05521df3f");
+ modelInfo.setModelInvariantId("439b7a2f-9524-4dbf-9eee-f2e05521df3f");
+ modelInfo.setModelUuid("42daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ modelInfo.setModelName("PNF_int_service_2");
+ modelInfo.setModelVersion("1.0");
+
+ bpmnRequestDetails.setModelInfo(modelInfo);
+
+
+ doReturn(bpmnRequestDetails).when(mapper).readValue(
+ JsonUtils.getJsonValue(String.valueOf(execution.getVariable("bpmnRequest")), "requestDetails"),
+ RequestDetails.class);
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
index 8577d9555b..b93902d9f7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
@@ -50,6 +50,11 @@ public class PnfManagementTestImpl implements PnfManagement {
}
@Override
+ public void updateEntry(String pnfCorrelationId, Pnf entry) throws IOException {
+ created.put(pnfCorrelationId, entry);
+ }
+
+ @Override
public void createRelation(String serviceInstanceId, String pnfName) {}
public Map<String, Pnf> getCreated() {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java
index f9b467c650..77377db9d9 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java
@@ -38,6 +38,11 @@ public class PnfManagementThrowingException implements PnfManagement {
}
@Override
+ public void updateEntry(String pnfCorrelationId, Pnf entry) throws IOException {
+ throw new IOException();
+ }
+
+ @Override
public void createRelation(String serviceInstanceId, String pnfName) throws IOException {
throw new IOException();
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/UpdatePnfEntryInAaiTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/UpdatePnfEntryInAaiTest.java
new file mode 100644
index 0000000000..bddfe5b180
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/UpdatePnfEntryInAaiTest.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import static org.junit.Assert.*;
+import java.io.IOException;
+import java.util.Optional;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.*;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
+import static org.onap.so.client.cds.PayloadConstants.PRC_TARGET_SOFTWARE_VERSION;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+public class UpdatePnfEntryInAaiTest {
+
+ @InjectMocks
+ private UpdatePnfEntryInAai updatePnfEntryInAai;
+
+ @Mock
+ private PnfManagement pnfManagementTest;
+
+ private DelegateExecution execution;
+
+
+
+ @Test
+ public void shouldSetSwVersion() throws Exception {
+ // given
+ setupPnf();
+ setupExecution();
+
+ // when
+ updatePnfEntryInAai.execute(execution);
+
+ // verify
+ Optional<Pnf> modifiedEntry = pnfManagementTest.getEntryFor("testPnfCorrelationId");
+ assertNotNull(modifiedEntry.get());
+ assertThat(modifiedEntry.get().getPnfId()).isEqualTo("testtest");
+ assertThat(modifiedEntry.get().getPnfName()).isEqualTo("testPnfCorrelationId");
+ assertThat(modifiedEntry.get().getSwVersion()).isEqualTo("demo-1.2");
+ verify(pnfManagementTest, times(2)).getEntryFor(anyString());
+ }
+
+ private void setupPnf() {
+ try {
+ Pnf pnf = new Pnf();
+ pnf.setSwVersion("1");
+ pnf.setPnfId("testtest");
+ pnf.setPnfName("testPnfCorrelationId");
+ doReturn(Optional.of(pnf)).when(pnfManagementTest).getEntryFor(anyString());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void setupExecution() {
+ execution = mock(DelegateExecution.class);
+ given(execution.getVariable(eq(PNF_CORRELATION_ID))).willReturn("testPnfCorrelationId");
+ given(execution.getVariable(eq(PNF_UUID))).willReturn("testtest");
+ given(execution.getVariable(eq(PRC_TARGET_SOFTWARE_VERSION))).willReturn("demo-1.2");
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml
index d0c16fc1cc..c7d4f3f894 100644
--- a/bpmn/so-bpmn-infrastructure-flows/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-infrastructure-flows</artifactId>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateCommunicationService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateCommunicationService.bpmn
new file mode 100644
index 0000000000..92fd5ef52b
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateCommunicationService.bpmn
@@ -0,0 +1,486 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1gtu09b" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+ <bpmn:process id="ActivateCommunicationService" name="ActivateCommunicationService" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_199lc2s</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="ScriptTask_08alvv7" name="Pre Process Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_199lc2s</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0rl5u9x</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def act= new ActivateCommunicationService()
+act.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_199lc2s" sourceRef="StartEvent_1" targetRef="ScriptTask_08alvv7" />
+ <bpmn:scriptTask id="ScriptTask_0t2aizp" name="Init Service Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0cg4k4f</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0xunetn</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def act= new ActivateCommunicationService()
+act.prepareInitOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_1h8uywz" name="Init Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="ACS_init_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="ACS_init_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0xunetn</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_07brvnu</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0xunetn" sourceRef="ScriptTask_0t2aizp" targetRef="ServiceTask_1h8uywz" />
+ <bpmn:scriptTask id="ScriptTask_1rshcew" name="Send Sync Ack Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_07brvnu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0c01147</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def act= new ActivateCommunicationService()
+act.sendSyncResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_0soxu97" name="check AAI Orch Status of cs" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0rl5u9x</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0337wg2</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def act= new ActivateCommunicationService()
+act.checkAAIOrchStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0rl5u9x" sourceRef="ScriptTask_08alvv7" targetRef="ScriptTask_0soxu97" />
+ <bpmn:sequenceFlow id="SequenceFlow_07brvnu" sourceRef="ServiceTask_1h8uywz" targetRef="ScriptTask_1rshcew" />
+ <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1twqa76" name="Goto Call Active Slice">
+ <bpmn:incoming>SequenceFlow_0c01147</bpmn:incoming>
+ <bpmn:linkEventDefinition name="CallActiveSlice" />
+ </bpmn:intermediateThrowEvent>
+ <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_15alt6m" name="CallActiveSlice">
+ <bpmn:outgoing>SequenceFlow_1om5m6o</bpmn:outgoing>
+ <bpmn:linkEventDefinition id="LinkEventDefinition_0zbmuty" name="CallActiveSlice" />
+ </bpmn:intermediateCatchEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1om5m6o" sourceRef="IntermediateThrowEvent_15alt6m" targetRef="ScriptTask_0oun39f" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1j8khf8" name="Is call activate slice Successful?">
+ <bpmn:incoming>SequenceFlow_1i6cshg</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_176pwpd</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1r6lo31</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:scriptTask id="ScriptTask_0fbubvu" name="Update Finish Status In AAI&#10;" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1w1h5vl</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1r6lo31</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1b8q7l5</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def act= new ActivateCommunicationService()
+act.updateFinishStatusInAAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_1seqo87" name="Prepare Complete Status in requestDB" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1b8q7l5</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_103y3rz</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def act= new ActivateCommunicationService()
+act.prepareCompleteStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_10gsfd1" name="Update Service Operation Status Completed">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="ACS_complete_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="ACS_complete_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_103y3rz</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_15dmqcp</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1b8q7l5" sourceRef="ScriptTask_0fbubvu" targetRef="ScriptTask_1seqo87" />
+ <bpmn:sequenceFlow id="SequenceFlow_103y3rz" sourceRef="ScriptTask_1seqo87" targetRef="ServiceTask_10gsfd1" />
+ <bpmn:sequenceFlow id="SequenceFlow_176pwpd" name="yes" sourceRef="ExclusiveGateway_1j8khf8" targetRef="ScriptTask_0zqkikf">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ProcessNsmfSuccess") == "OK"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:endEvent id="EndEvent_0z07q3n">
+ <bpmn:incoming>SequenceFlow_15dmqcp</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_15dmqcp" sourceRef="ServiceTask_10gsfd1" targetRef="EndEvent_0z07q3n" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1g73afb" name="Is orchstatus vaild?" default="SequenceFlow_0hpybf9">
+ <bpmn:incoming>SequenceFlow_0337wg2</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cg4k4f</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0hpybf9</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0cg4k4f" name="yes" sourceRef="ExclusiveGateway_1g73afb" targetRef="ScriptTask_0t2aizp">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isContinue") == "true"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0337wg2" sourceRef="ScriptTask_0soxu97" targetRef="ExclusiveGateway_1g73afb" />
+ <bpmn:sequenceFlow id="SequenceFlow_0hpybf9" name="no" sourceRef="ExclusiveGateway_1g73afb" targetRef="EndEvent_02rugcv" />
+ <bpmn:endEvent id="EndEvent_02rugcv">
+ <bpmn:incoming>SequenceFlow_0hpybf9</bpmn:incoming>
+ <bpmn:errorEventDefinition errorRef="Error_1ld8i6u" />
+ </bpmn:endEvent>
+ <bpmn:subProcess id="SubProcess_1i9i3h1" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_1f90rxc">
+ <bpmn:outgoing>SequenceFlow_1dkviys</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_0iyy5ka" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1m9nsoo">
+ <bpmn:incoming>SequenceFlow_18sqlo7</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_003nbzc" name="Send Error Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1dkviys</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_18sqlo7</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def act= new ActivateCommunicationService()
+act.sendSyncError(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1dkviys" sourceRef="StartEvent_1f90rxc" targetRef="ScriptTask_003nbzc" />
+ <bpmn:sequenceFlow id="SequenceFlow_18sqlo7" sourceRef="ScriptTask_003nbzc" targetRef="EndEvent_1m9nsoo" />
+ </bpmn:subProcess>
+ <bpmn:scriptTask id="ScriptTask_0zqkikf" name="Prepare Update Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_176pwpd</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0mruwcs</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def act= new ActivateCommunicationService()
+act.prepareUpdateOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_11v60ns" name="Update Service Operation Status processing">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="ACS_processing_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="ACS_processing_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0mruwcs</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0f57hgr</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0mruwcs" sourceRef="ScriptTask_0zqkikf" targetRef="ServiceTask_11v60ns" />
+ <bpmn:scriptTask id="ScriptTask_0oun39f" name="Pre Request Send To NSMF" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1om5m6o</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_12ax52p</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def act= new ActivateCommunicationService()
+act.preRequestSend2NSMF(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_1pbp58s" name="Send Request To NSMF">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${NSMF_endpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/json</camunda:entry>
+ <camunda:entry key="Authorization">Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CSMF_NSMFRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CSMF_NSMFResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CSMF_NSMFResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_12ax52p</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1e9r8tc</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:scriptTask id="ScriptTask_167kv01" name="Process NSMF response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1e9r8tc</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1i6cshg</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def act= new ActivateCommunicationService()
+act.processNSMFResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_12ax52p" sourceRef="ScriptTask_0oun39f" targetRef="ServiceTask_1pbp58s" />
+ <bpmn:sequenceFlow id="SequenceFlow_1e9r8tc" sourceRef="ServiceTask_1pbp58s" targetRef="ScriptTask_167kv01" />
+ <bpmn:sequenceFlow id="SequenceFlow_1i6cshg" sourceRef="ScriptTask_167kv01" targetRef="ExclusiveGateway_1j8khf8" />
+ <bpmn:scriptTask id="ScriptTask_0iubb84" name="Prepare Call CheckServiceProcessStatus" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1hsbli0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_102nqyb</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def act= new ActivateCommunicationService()
+act.prepareCallCheckProcessStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_102nqyb" sourceRef="ScriptTask_0iubb84" targetRef="CallActivity_12eufsa" />
+ <bpmn:sequenceFlow id="SequenceFlow_0f57hgr" sourceRef="ServiceTask_11v60ns" targetRef="IntermediateThrowEvent_1u9a1t0" />
+ <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1u9a1t0" name="Goto check processing status">
+ <bpmn:incoming>SequenceFlow_0f57hgr</bpmn:incoming>
+ <bpmn:linkEventDefinition name="CheckProcessingStatus" />
+ </bpmn:intermediateThrowEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1hsbli0" sourceRef="IntermediateThrowEvent_1lcnqle" targetRef="ScriptTask_0iubb84" />
+ <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_1lcnqle" name="CheckProcessingStatus">
+ <bpmn:outgoing>SequenceFlow_1hsbli0</bpmn:outgoing>
+ <bpmn:linkEventDefinition name="CheckProcessingStatus" />
+ </bpmn:intermediateCatchEvent>
+ <bpmn:callActivity id="CallActivity_12eufsa" name="CallCheckServiceProcessStatus" calledElement="CheckServiceProcessStatus">
+ <bpmn:extensionElements>
+ <camunda:in source="e2eServiceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="e2eOperationId" target="operationId" />
+ <camunda:in source="successConditions" target="successConditions" />
+ <camunda:in source="processServiceType" target="processServiceType" />
+ <camunda:in source="errorConditions" target="errorConditions" />
+ <camunda:in source="timeOut" target="timeOut" />
+ <camunda:in source="successParamMap" target="successParamMap" />
+ <camunda:in source="errorParamMap" target="errorParamMap" />
+ <camunda:out source="orchestrationStatus" target="orchestrationStatus" />
+ <camunda:out source="operationStatus" target="operationStatus" />
+ <camunda:out source="operationContent" target="operationContent" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="timeOutParamMap" target="timeOutParamMap" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="operationType" target="operationType" />
+ <camunda:in source="initProgress" target="initProgress" />
+ <camunda:in source="endProgress" target="endProgress" />
+ <camunda:in source="serviceInstanceId" target="parentServiceInstanceId" />
+ <camunda:in source="operationId" target="parentOperationId" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_102nqyb</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1w1h5vl</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1w1h5vl" sourceRef="CallActivity_12eufsa" targetRef="ScriptTask_0fbubvu" />
+ <bpmn:sequenceFlow id="SequenceFlow_1r6lo31" name="No" sourceRef="ExclusiveGateway_1j8khf8" targetRef="ScriptTask_0fbubvu">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ProcessNsmfSuccess") == "ERROR"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0c01147" sourceRef="ScriptTask_1rshcew" targetRef="IntermediateThrowEvent_1twqa76" />
+ </bpmn:process>
+ <bpmn:error id="Error_1ld8i6u" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateCommunicationService">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="179" y="159" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_08alvv7_di" bpmnElement="ScriptTask_08alvv7">
+ <dc:Bounds x="310" y="137" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_199lc2s_di" bpmnElement="SequenceFlow_199lc2s">
+ <di:waypoint x="215" y="177" />
+ <di:waypoint x="310" y="177" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0t2aizp_di" bpmnElement="ScriptTask_0t2aizp">
+ <dc:Bounds x="760" y="137" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1h8uywz_di" bpmnElement="ServiceTask_1h8uywz">
+ <dc:Bounds x="960" y="137" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0xunetn_di" bpmnElement="SequenceFlow_0xunetn">
+ <di:waypoint x="860" y="177" />
+ <di:waypoint x="960" y="177" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1rshcew_di" bpmnElement="ScriptTask_1rshcew">
+ <dc:Bounds x="1140" y="137" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0soxu97_di" bpmnElement="ScriptTask_0soxu97">
+ <dc:Bounds x="480" y="137" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0rl5u9x_di" bpmnElement="SequenceFlow_0rl5u9x">
+ <di:waypoint x="410" y="177" />
+ <di:waypoint x="480" y="177" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_07brvnu_di" bpmnElement="SequenceFlow_07brvnu">
+ <di:waypoint x="1060" y="177" />
+ <di:waypoint x="1140" y="177" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="IntermediateThrowEvent_0bgd82x_di" bpmnElement="IntermediateThrowEvent_1twqa76">
+ <dc:Bounds x="1332" y="159" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1314" y="202" width="79" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateCatchEvent_0qbtq4z_di" bpmnElement="IntermediateThrowEvent_15alt6m">
+ <dc:Bounds x="179" y="402" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="161" y="445" width="73" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1om5m6o_di" bpmnElement="SequenceFlow_1om5m6o">
+ <di:waypoint x="215" y="420" />
+ <di:waypoint x="310" y="420" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1j8khf8_di" bpmnElement="ExclusiveGateway_1j8khf8" isMarkerVisible="true">
+ <dc:Bounds x="815" y="395" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="799" y="358" width="85" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0fbubvu_di" bpmnElement="ScriptTask_0fbubvu">
+ <dc:Bounds x="790" y="560" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1seqo87_di" bpmnElement="ScriptTask_1seqo87">
+ <dc:Bounds x="960" y="560" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_10gsfd1_di" bpmnElement="ServiceTask_10gsfd1">
+ <dc:Bounds x="1140" y="560" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1b8q7l5_di" bpmnElement="SequenceFlow_1b8q7l5">
+ <di:waypoint x="890" y="600" />
+ <di:waypoint x="960" y="600" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_103y3rz_di" bpmnElement="SequenceFlow_103y3rz">
+ <di:waypoint x="1060" y="600" />
+ <di:waypoint x="1140" y="600" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_176pwpd_di" bpmnElement="SequenceFlow_176pwpd">
+ <di:waypoint x="865" y="420" />
+ <di:waypoint x="960" y="420" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="904" y="402" width="17" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0z07q3n_di" bpmnElement="EndEvent_0z07q3n">
+ <dc:Bounds x="1332" y="582" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_15dmqcp_di" bpmnElement="SequenceFlow_15dmqcp">
+ <di:waypoint x="1240" y="600" />
+ <di:waypoint x="1332" y="600" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1g73afb_di" bpmnElement="ExclusiveGateway_1g73afb" isMarkerVisible="true">
+ <dc:Bounds x="645" y="152" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="648" y="116" width="63" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cg4k4f_di" bpmnElement="SequenceFlow_0cg4k4f">
+ <di:waypoint x="695" y="177" />
+ <di:waypoint x="760" y="177" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="719" y="159" width="17" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0337wg2_di" bpmnElement="SequenceFlow_0337wg2">
+ <di:waypoint x="580" y="177" />
+ <di:waypoint x="645" y="177" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0hpybf9_di" bpmnElement="SequenceFlow_0hpybf9">
+ <di:waypoint x="670" y="202" />
+ <di:waypoint x="670" y="262" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="679" y="229" width="13" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_118l531_di" bpmnElement="EndEvent_02rugcv">
+ <dc:Bounds x="652" y="262" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_1i9i3h1_di" bpmnElement="SubProcess_1i9i3h1" isExpanded="true">
+ <dc:Bounds x="340" y="730" width="781" height="196" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_1f90rxc_di" bpmnElement="StartEvent_1f90rxc">
+ <dc:Bounds x="382" y="816" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1m9nsoo_di" bpmnElement="EndEvent_1m9nsoo">
+ <dc:Bounds x="1052" y="816" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_003nbzc_di" bpmnElement="ScriptTask_003nbzc">
+ <dc:Bounds x="670" y="794" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1dkviys_di" bpmnElement="SequenceFlow_1dkviys">
+ <di:waypoint x="418" y="834" />
+ <di:waypoint x="670" y="834" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_18sqlo7_di" bpmnElement="SequenceFlow_18sqlo7">
+ <di:waypoint x="770" y="834" />
+ <di:waypoint x="1052" y="834" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0zqkikf_di" bpmnElement="ScriptTask_0zqkikf">
+ <dc:Bounds x="960" y="380" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_11v60ns_di" bpmnElement="ServiceTask_11v60ns">
+ <dc:Bounds x="1140" y="380" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0mruwcs_di" bpmnElement="SequenceFlow_0mruwcs">
+ <di:waypoint x="1060" y="420" />
+ <di:waypoint x="1140" y="420" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0oun39f_di" bpmnElement="ScriptTask_0oun39f">
+ <dc:Bounds x="310" y="380" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1pbp58s_di" bpmnElement="ServiceTask_1pbp58s">
+ <dc:Bounds x="480" y="380" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_167kv01_di" bpmnElement="ScriptTask_167kv01">
+ <dc:Bounds x="640" y="380" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_12ax52p_di" bpmnElement="SequenceFlow_12ax52p">
+ <di:waypoint x="410" y="420" />
+ <di:waypoint x="480" y="420" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1e9r8tc_di" bpmnElement="SequenceFlow_1e9r8tc">
+ <di:waypoint x="580" y="420" />
+ <di:waypoint x="640" y="420" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1i6cshg_di" bpmnElement="SequenceFlow_1i6cshg">
+ <di:waypoint x="740" y="420" />
+ <di:waypoint x="815" y="420" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0iubb84_di" bpmnElement="ScriptTask_0iubb84">
+ <dc:Bounds x="310" y="560" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_102nqyb_di" bpmnElement="SequenceFlow_102nqyb">
+ <di:waypoint x="410" y="600" />
+ <di:waypoint x="540" y="600" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0f57hgr_di" bpmnElement="SequenceFlow_0f57hgr">
+ <di:waypoint x="1240" y="420" />
+ <di:waypoint x="1332" y="420" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="IntermediateThrowEvent_1wqbbwo_di" bpmnElement="IntermediateThrowEvent_1u9a1t0">
+ <dc:Bounds x="1332" y="402" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1308" y="445" width="87" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1hsbli0_di" bpmnElement="SequenceFlow_1hsbli0">
+ <di:waypoint x="215" y="600" />
+ <di:waypoint x="310" y="600" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="IntermediateCatchEvent_13yvtam_di" bpmnElement="IntermediateThrowEvent_1lcnqle">
+ <dc:Bounds x="179" y="582" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="155" y="625" width="86" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_12eufsa_di" bpmnElement="CallActivity_12eufsa">
+ <dc:Bounds x="540" y="560" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1w1h5vl_di" bpmnElement="SequenceFlow_1w1h5vl">
+ <di:waypoint x="640" y="600" />
+ <di:waypoint x="790" y="600" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1r6lo31_di" bpmnElement="SequenceFlow_1r6lo31">
+ <di:waypoint x="840" y="445" />
+ <di:waypoint x="840" y="560" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="868" y="463" width="15" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0c01147_di" bpmnElement="SequenceFlow_0c01147">
+ <di:waypoint x="1240" y="177" />
+ <di:waypoint x="1332" y="177" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn
new file mode 100644
index 0000000000..cd4cf473a6
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn
@@ -0,0 +1,372 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_13dsy4w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+ <bpmn:error id="Error_0l3pcnc" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmn:error id="Error_1eyu7sx" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmn:collaboration id="Collaboration_0htncd8">
+ <bpmn:participant id="ActivateSliceService01" name="ActivateSliceService" processRef="ActivateSliceService" />
+ </bpmn:collaboration>
+ <bpmn:process id="ActivateSliceService" name="ActivateSliceService" isExecutable="true">
+ <bpmn:scriptTask id="Task_1vscxgp" name="Update the status of SNSSAI and NSI and NSSI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1jp9gjt</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1gkpl5q</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new ActivateSliceService()
+csi.updateStatusSNSSAIandNSIandNSSI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_0cbth6k" name="Prepare Completion Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1gkpl5q</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0pzts4p</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi = new ActivateSliceService()
+csi.prepareCompletionRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_1aymwlt" name="Update Service Operation Status to Success">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">${UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth", execution)}</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0pzts4p</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0ozefu5</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:endEvent id="EndEvent_0d1g3mv">
+ <bpmn:incoming>SequenceFlow_0r611x8</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0ozefu5</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:endEvent id="EndEvent_1pujgw8">
+ <bpmn:incoming>SequenceFlow_1qa8miv</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_17jklyl" errorRef="Error_1eyu7sx" />
+ </bpmn:endEvent>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0z7s0nx" name="IsSuccessfull">
+ <bpmn:incoming>SequenceFlow_00ba5l9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1jp9gjt</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1qa8miv</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:callActivity id="CallActivity_1cvb0iq" name="Send command NSSMF" calledElement="DoSendCommandToNSSMF">
+ <bpmn:extensionElements>
+ <camunda:in source="nssiMap" target="nssiMap" />
+ <camunda:in source="operationType" target="operationType" />
+ <camunda:in source="NSIserviceid" target="NSIserviceid" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="isNSSIActivate" target="isNSSIActivate" />
+ <camunda:in source="snssai" target="snssai" />
+ <camunda:in source="e2eserviceInstanceId" target="e2eserviceInstanceId" />
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="activationCount" target="activationCount" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1o4zjvp</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_00ba5l9</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="ScriptTask_04p0zjj" name="Send Sync Ack Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1yus0c1</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1uqgdxr</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi = new ActivateSliceService()
+csi.sendSyncResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_1o8fe1v" name="check AAI Orch Status of slice" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1uqgdxr</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_149lhmo</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new ActivateSliceService()
+csi.checkAAIOrchStatusofslice(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0fcc3uy" name="Success?">
+ <bpmn:incoming>SequenceFlow_149lhmo</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_15fdf5d</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0r611x8</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:scriptTask id="Task_08zavab" name="PrepareActiviation" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_15fdf5d</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_144cqr9</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new ActivateSliceService()
+csi.prepareActivation(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="Task_18urz3r" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1av6du3</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1yus0c1</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:scriptTask id="Task_1ossedo" name="Pre Process Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0qksr1g</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_183ypky</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new ActivateSliceService()
+csi.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1g8cg9g" name="Any NSSI to activate?">
+ <bpmn:incoming>SequenceFlow_144cqr9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1o4zjvp</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1pj1j1o</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_0qksr1g</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1taw2p9">
+ <bpmn:incoming>SequenceFlow_1pj1j1o</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_03iwehr" errorRef="Error_0l3pcnc" />
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="Task_13zoo6a" name="Init Service Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_183ypky</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1av6du3</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new ActivateSliceService()
+csi.prepareInitServiceOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:subProcess id="SubProcess_0iljxjd" name="sub process for fallouthandler and rollback" triggeredByEvent="true">
+ <bpmn:scriptTask id="Task_01ooik6" name="Send Error Response">
+ <bpmn:incoming>SequenceFlow_0oiiwjo</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0uckyao</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new ActivateSliceService()
+csi.sendSyncError(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:endEvent id="EndEvent_1wd8iqk">
+ <bpmn:incoming>SequenceFlow_0uckyao</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:startEvent id="StartEvent_0hmwdqq">
+ <bpmn:outgoing>SequenceFlow_0oiiwjo</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1il80ww" />
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0oiiwjo" sourceRef="StartEvent_0hmwdqq" targetRef="Task_01ooik6" />
+ <bpmn:sequenceFlow id="SequenceFlow_0uckyao" sourceRef="Task_01ooik6" targetRef="EndEvent_1wd8iqk" />
+ </bpmn:subProcess>
+ <bpmn:sequenceFlow id="SequenceFlow_1av6du3" sourceRef="Task_13zoo6a" targetRef="Task_18urz3r" />
+ <bpmn:sequenceFlow id="SequenceFlow_1pj1j1o" name="no" sourceRef="ExclusiveGateway_1g8cg9g" targetRef="EndEvent_1taw2p9">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "false"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0r611x8" name="NO" sourceRef="ExclusiveGateway_0fcc3uy" targetRef="EndEvent_0d1g3mv">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isContinue") == "false"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1qa8miv" name="no" sourceRef="ExclusiveGateway_0z7s0nx" targetRef="EndEvent_1pujgw8">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "false"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1jp9gjt" name="yes" sourceRef="ExclusiveGateway_0z7s0nx" targetRef="Task_1vscxgp">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "true"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_00ba5l9" sourceRef="CallActivity_1cvb0iq" targetRef="ExclusiveGateway_0z7s0nx" />
+ <bpmn:sequenceFlow id="SequenceFlow_1uqgdxr" sourceRef="ScriptTask_04p0zjj" targetRef="Task_1o8fe1v" />
+ <bpmn:sequenceFlow id="SequenceFlow_0qksr1g" sourceRef="StartEvent_1" targetRef="Task_1ossedo" />
+ <bpmn:sequenceFlow id="SequenceFlow_183ypky" sourceRef="Task_1ossedo" targetRef="Task_13zoo6a" />
+ <bpmn:sequenceFlow id="SequenceFlow_1yus0c1" sourceRef="Task_18urz3r" targetRef="ScriptTask_04p0zjj" />
+ <bpmn:sequenceFlow id="SequenceFlow_149lhmo" sourceRef="Task_1o8fe1v" targetRef="ExclusiveGateway_0fcc3uy" />
+ <bpmn:sequenceFlow id="SequenceFlow_15fdf5d" name="yes" sourceRef="ExclusiveGateway_0fcc3uy" targetRef="Task_08zavab">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isContinue") == "true"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_144cqr9" sourceRef="Task_08zavab" targetRef="ExclusiveGateway_1g8cg9g" />
+ <bpmn:sequenceFlow id="SequenceFlow_1o4zjvp" name="yes" sourceRef="ExclusiveGateway_1g8cg9g" targetRef="CallActivity_1cvb0iq">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "true"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1gkpl5q" sourceRef="Task_1vscxgp" targetRef="ScriptTask_0cbth6k" />
+ <bpmn:sequenceFlow id="SequenceFlow_0pzts4p" sourceRef="ScriptTask_0cbth6k" targetRef="ServiceTask_1aymwlt" />
+ <bpmn:sequenceFlow id="SequenceFlow_0ozefu5" sourceRef="ServiceTask_1aymwlt" targetRef="EndEvent_0d1g3mv" />
+ </bpmn:process>
+ <bpmn:error id="Error_0vq6f5h" name="Error_3ai5jm1" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0htncd8">
+ <bpmndi:BPMNShape id="Participant_1x12pgg_di" bpmnElement="ActivateSliceService01" isHorizontal="true">
+ <dc:Bounds x="160" y="120" width="2290" height="990" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_1qw5nm4_di" bpmnElement="SubProcess_0iljxjd" isExpanded="true">
+ <dc:Bounds x="935" y="680" width="810" height="180" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1azew71_di" bpmnElement="Task_01ooik6">
+ <dc:Bounds x="1255" y="720" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1wd8iqk_di" bpmnElement="EndEvent_1wd8iqk">
+ <dc:Bounds x="1492" y="742" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_0hmwdqq_di" bpmnElement="StartEvent_0hmwdqq">
+ <dc:Bounds x="1042" y="742" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0oiiwjo_di" bpmnElement="SequenceFlow_0oiiwjo">
+ <di:waypoint x="1078" y="760" />
+ <di:waypoint x="1255" y="760" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0uckyao_di" bpmnElement="SequenceFlow_0uckyao">
+ <di:waypoint x="1355" y="760" />
+ <di:waypoint x="1492" y="760" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1lb7w6u_di" bpmnElement="Task_1vscxgp">
+ <dc:Bounds x="1670" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0d1g3mv_di" bpmnElement="EndEvent_0d1g3mv">
+ <dc:Bounds x="2212" y="332" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1pujgw8_di" bpmnElement="EndEvent_1pujgw8">
+ <dc:Bounds x="1462" y="422" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0cbth6k_di" bpmnElement="ScriptTask_0cbth6k">
+ <dc:Bounds x="1860" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0z7s0nx_di" bpmnElement="ExclusiveGateway_0z7s0nx" isMarkerVisible="true">
+ <dc:Bounds x="1455" y="325" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1449" y="313" width="65" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1cvb0iq_di" bpmnElement="CallActivity_1cvb0iq">
+ <dc:Bounds x="1290" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_04p0zjj_di" bpmnElement="ScriptTask_04p0zjj">
+ <dc:Bounds x="695" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1nsbn4r_di" bpmnElement="Task_1o8fe1v">
+ <dc:Bounds x="850" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0fcc3uy_di" bpmnElement="ExclusiveGateway_0fcc3uy" isMarkerVisible="true">
+ <dc:Bounds x="975" y="325" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1006" y="315" width="49" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0g9vipz_di" bpmnElement="Task_08zavab">
+ <dc:Bounds x="1060" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1tv1ow6_di" bpmnElement="Task_18urz3r">
+ <dc:Bounds x="540" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0tam79l_di" bpmnElement="Task_1ossedo">
+ <dc:Bounds x="290" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1g8cg9g_di" bpmnElement="ExclusiveGateway_1g8cg9g" isMarkerVisible="true">
+ <dc:Bounds x="1195" y="325" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1141" y="406" width="58" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="212" y="332" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1o4zjvp_di" bpmnElement="SequenceFlow_1o4zjvp">
+ <di:waypoint x="1220" y="350" />
+ <di:waypoint x="1290" y="350" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1251" y="332" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_144cqr9_di" bpmnElement="SequenceFlow_144cqr9">
+ <di:waypoint x="1160" y="350" />
+ <di:waypoint x="1195" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_15fdf5d_di" bpmnElement="SequenceFlow_15fdf5d">
+ <di:waypoint x="1025" y="350" />
+ <di:waypoint x="1060" y="350" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1034" y="332" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_149lhmo_di" bpmnElement="SequenceFlow_149lhmo">
+ <di:waypoint x="950" y="350" />
+ <di:waypoint x="975" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1yus0c1_di" bpmnElement="SequenceFlow_1yus0c1">
+ <di:waypoint x="640" y="350" />
+ <di:waypoint x="695" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_183ypky_di" bpmnElement="SequenceFlow_183ypky">
+ <di:waypoint x="390" y="350" />
+ <di:waypoint x="420" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0qksr1g_di" bpmnElement="SequenceFlow_0qksr1g">
+ <di:waypoint x="248" y="350" />
+ <di:waypoint x="290" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1uqgdxr_di" bpmnElement="SequenceFlow_1uqgdxr">
+ <di:waypoint x="795" y="350" />
+ <di:waypoint x="850" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_00ba5l9_di" bpmnElement="SequenceFlow_00ba5l9">
+ <di:waypoint x="1390" y="350" />
+ <di:waypoint x="1455" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1jp9gjt_di" bpmnElement="SequenceFlow_1jp9gjt">
+ <di:waypoint x="1505" y="350" />
+ <di:waypoint x="1670" y="350" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1596" y="332" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qa8miv_di" bpmnElement="SequenceFlow_1qa8miv">
+ <di:waypoint x="1480" y="375" />
+ <di:waypoint x="1480" y="422" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1489" y="383" width="12" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0r611x8_di" bpmnElement="SequenceFlow_0r611x8">
+ <di:waypoint x="1000" y="375" />
+ <di:waypoint x="1000" y="500" />
+ <di:waypoint x="2230" y="500" />
+ <di:waypoint x="2230" y="368" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1608" y="482" width="15" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1pj1j1o_di" bpmnElement="SequenceFlow_1pj1j1o">
+ <di:waypoint x="1220" y="375" />
+ <di:waypoint x="1220" y="422" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1199" y="378" width="12" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_1taw2p9_di" bpmnElement="EndEvent_1taw2p9">
+ <dc:Bounds x="1202" y="422" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0uwsu46_di" bpmnElement="Task_13zoo6a">
+ <dc:Bounds x="420" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1av6du3_di" bpmnElement="SequenceFlow_1av6du3">
+ <di:waypoint x="520" y="350" />
+ <di:waypoint x="540" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1aymwlt_di" bpmnElement="ServiceTask_1aymwlt">
+ <dc:Bounds x="2020" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ozefu5_di" bpmnElement="SequenceFlow_0ozefu5">
+ <di:waypoint x="2120" y="350" />
+ <di:waypoint x="2212" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0pzts4p_di" bpmnElement="SequenceFlow_0pzts4p">
+ <di:waypoint x="1960" y="350" />
+ <di:waypoint x="2020" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1gkpl5q_di" bpmnElement="SequenceFlow_1gkpl5q">
+ <di:waypoint x="1770" y="350" />
+ <di:waypoint x="1860" y="350" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn
index 6d5b2a2f28..234c744e4a 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ConfigurePnfResource.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_13i2vsn" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_13i2vsn" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.3.5">
<bpmn:process id="ConfigurePnfResource" name="ConfigurePnfResource" isExecutable="true">
<bpmn:startEvent id="ConfigurePnfResource_StartEvent">
<bpmn:outgoing>SequenceFlow_069mxkg</bpmn:outgoing>
@@ -22,7 +22,7 @@
<bpmn:outgoing>SequenceFlow_1w4p9f7</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_1owbpsy" name="Success" sourceRef="ExclusiveGateway_0vtv1wi" targetRef="Task_14cwhgk">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("CDSStatus").equals("Success")}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:exclusiveGateway id="ExclusiveGateway_01jwwmc" default="SequenceFlow_0d24h26">
<bpmn:incoming>SequenceFlow_02919fh</bpmn:incoming>
@@ -30,7 +30,7 @@
<bpmn:outgoing>SequenceFlow_0d24h26</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_1n080up" name="Success" sourceRef="ExclusiveGateway_01jwwmc" targetRef="EndEvent_0xky46v">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("CDSStatus").equals("Success")}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1w4p9f7" name="Failure" sourceRef="ExclusiveGateway_0vtv1wi" targetRef="EndEvent_16620h9" />
<bpmn:endEvent id="EndEvent_16620h9">
@@ -57,6 +57,7 @@
<camunda:inputOutput>
<camunda:inputParameter name="action">config-assign</camunda:inputParameter>
<camunda:inputParameter name="scope">pnf</camunda:inputParameter>
+ <camunda:inputParameter name="mode">sync</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0j3pm2g</bpmn:incoming>
@@ -68,6 +69,7 @@
<camunda:inputOutput>
<camunda:inputParameter name="action">config-deploy</camunda:inputParameter>
<camunda:inputParameter name="scope">pnf</camunda:inputParameter>
+ <camunda:inputParameter name="mode">async</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1owbpsy</bpmn:incoming>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCommunicationService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCommunicationService.bpmn
new file mode 100644
index 0000000000..a632266c2e
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCommunicationService.bpmn
@@ -0,0 +1,635 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1xh5s36" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+ <bpmn:process id="CreateCommunicationService" name="CreateCommunicationService" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1" name="start flow">
+ <bpmn:outgoing>SequenceFlow_0lzwdto</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0lzwdto" sourceRef="StartEvent_1" targetRef="Task_1beyt5u" />
+ <bpmn:sequenceFlow id="SequenceFlow_1gjmyhd" sourceRef="Task_1beyt5u" targetRef="Task_0dz4tto" />
+ <bpmn:scriptTask id="Task_1beyt5u" name="PreProcessRequest" scriptFormat="groovy">
+ <bpmn:extensionElements>
+ <camunda:properties>
+ <camunda:property />
+ </camunda:properties>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0lzwdto</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1gjmyhd</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCommunicationService()
+csi.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_0dz4tto" name="Init Task Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1gjmyhd</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1vcepmd</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCommunicationService()
+csi.prepareInitOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1vcepmd" sourceRef="Task_0dz4tto" targetRef="ServiceTask_0ozije4" />
+ <bpmn:serviceTask id="ServiceTask_0ozije4" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1vcepmd</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ltd3dc</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:scriptTask id="Task_1khpb1m" name="Generate E2EService Profile" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0kypqg8</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0akbbpi</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCommunicationService()
+csi.generateE2EServiceProfile(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_0siw5ye" name="Pre Request Send To NSMF" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0akbbpi</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0j35uff</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCommunicationService()
+csi.preRequestSend2NSMF(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_0y8x077" name="Send Request To NSMF">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${NSMF_endpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/json</camunda:entry>
+ <camunda:entry key="Authorization">Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CSMF_NSMFRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CSMF_NSMFResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CSMF_NSMFResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0j35uff</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1u66yqo</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="ServiceTask_0yyq6ly" name="Update Service Operation Status Creating">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1iiorr4</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_15mad8z</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="ServiceTask_1t0awxp" name="Update Service Operation Status Completed">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1inkg6e</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0elkfli</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:endEvent id="EndEvent_0lu4p9e" name="end">
+ <bpmn:incoming>SequenceFlow_0elkfli</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0elkfli" sourceRef="ServiceTask_1t0awxp" targetRef="EndEvent_0lu4p9e" />
+ <bpmn:scriptTask id="Task_1a4kd0x" name="Create Relationship CS-SS" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1uvyn2n</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1j65sro</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCommunicationService()
+csi.createCSAndSSRelationship(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0akbbpi" sourceRef="Task_1khpb1m" targetRef="Task_0siw5ye" />
+ <bpmn:callActivity id="CallCreateCommunicationService" name="CallCreateCommunicationService" calledElement="DoCreateCommunicationService">
+ <bpmn:extensionElements>
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="csInputMap" target="csInputMap" />
+ <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
+ <camunda:in source="serviceType" target="serviceType" />
+ <camunda:in source="uuiRequest" target="uuiRequest" />
+ <camunda:in source="modelInvariantUuid" target="modelInvariantUuid" />
+ <camunda:in source="modelUuid" target="modelUuid" />
+ <camunda:in source="useInterval" target="useInterval" />
+ <camunda:out source="sNSSAI_id" target="sNSSAI_id" />
+ <camunda:out source="communicationProfileId" target="communicationProfileId" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1ds2e2l</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0x9rd1d</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1ltd3dc" sourceRef="ServiceTask_0ozije4" targetRef="Task_0k0z1g4" />
+ <bpmn:sequenceFlow id="SequenceFlow_0x9rd1d" sourceRef="CallCreateCommunicationService" targetRef="ExclusiveGateway_1djfumr" />
+ <bpmn:scriptTask id="Task_0u6zuwq" name="Update Finish Status In AAI&#10;" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_114tqpz</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1fpj5vj</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_04321fy</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCommunicationService()
+csi.updateFinishStatusInAAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_04321fy" sourceRef="Task_0u6zuwq" targetRef="ScriptTask_1y7nvia" />
+ <bpmn:sequenceFlow id="SequenceFlow_1inkg6e" sourceRef="ScriptTask_1y7nvia" targetRef="ServiceTask_1t0awxp" />
+ <bpmn:scriptTask id="ScriptTask_1y7nvia" name="Prepare Complete Status in requestDB" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_04321fy</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1inkg6e</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCommunicationService()
+csi.prepareCompleteStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1iiorr4" sourceRef="Task_0z4msb8" targetRef="ServiceTask_0yyq6ly" />
+ <bpmn:scriptTask id="Task_0z4msb8" name="Prepare Update Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1j65sro</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1iiorr4</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCommunicationService()
+csi.prepareUpdateOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="Task_0k0z1g4" name="Call DocomposeService" calledElement="DecomposeService">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="csServiceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:out source="serviceDecomposition" target="csServiceDecomposition" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1ltd3dc</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_13aldsi</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="Task_1iyttxg" name="Prepare Compose E2E Template" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_13aldsi</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1f1zdf9</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCommunicationService()
+csi.prepareDoComposeE2E(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_0w00x24" name="Call e2e DocomposeService" calledElement="DecomposeService">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="e2eServiceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:out source="serviceDecomposition" target="e2eServiceDecomposition" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1f1zdf9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ofzxsf</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1ofzxsf" sourceRef="CallActivity_0w00x24" targetRef="ScriptTask_0cdmkso" />
+ <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1w15bcr" name="Goto Create Communication Service">
+ <bpmn:incoming>SequenceFlow_18guyhw</bpmn:incoming>
+ <bpmn:linkEventDefinition name="CreateCommunicationService" />
+ </bpmn:intermediateThrowEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_13aldsi" sourceRef="Task_0k0z1g4" targetRef="Task_1iyttxg" />
+ <bpmn:sequenceFlow id="SequenceFlow_1f1zdf9" sourceRef="Task_1iyttxg" targetRef="CallActivity_0w00x24" />
+ <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0mnp81i" name="CreateCommunicationService">
+ <bpmn:outgoing>SequenceFlow_1ds2e2l</bpmn:outgoing>
+ <bpmn:linkEventDefinition name="CreateCommunicationService" />
+ </bpmn:intermediateCatchEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1ds2e2l" sourceRef="IntermediateThrowEvent_0mnp81i" targetRef="CallCreateCommunicationService" />
+ <bpmn:subProcess id="SubProcess_1rxymch" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+ <bpmn:endEvent id="EndEvent_0zmwd5y">
+ <bpmn:incoming>SequenceFlow_1kmsen3</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:startEvent id="StartEvent_0wgf0cs">
+ <bpmn:outgoing>SequenceFlow_07fl9jy</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_0uaz13d" />
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_07fl9jy" sourceRef="StartEvent_0wgf0cs" targetRef="ScriptTask_18gv408" />
+ <bpmn:scriptTask id="ScriptTask_18gv408" name="Send Error Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_07fl9jy</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1kmsen3</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCommunicationService()
+csi.sendSyncError(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1kmsen3" sourceRef="ScriptTask_18gv408" targetRef="EndEvent_0zmwd5y" />
+ </bpmn:subProcess>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1djfumr" name="Is create in aai Successful?" default="SequenceFlow_0c89n51">
+ <bpmn:incoming>SequenceFlow_0x9rd1d</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1b66kfh</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0c89n51</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1b66kfh" name="Yes" sourceRef="ExclusiveGateway_1djfumr" targetRef="ScriptTask_0sxtscf">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1r29nqs" name="Goto process NSMF">
+ <bpmn:incoming>SequenceFlow_1u66yqo</bpmn:incoming>
+ <bpmn:linkEventDefinition id="LinkEventDefinition_1o65kbk" name="ProcessNSMF" />
+ </bpmn:intermediateThrowEvent>
+ <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_08tr730" name="ProcessNSMF">
+ <bpmn:outgoing>SequenceFlow_0hkz9h0</bpmn:outgoing>
+ <bpmn:linkEventDefinition id="LinkEventDefinition_0g6ab6j" name="ProcessNSMF" />
+ </bpmn:intermediateCatchEvent>
+ <bpmn:scriptTask id="ScriptTask_01pvcx5" name="Process NSMF response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0hkz9h0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_056nqyg</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCommunicationService()
+csi.processNSMFResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_15mad8z" sourceRef="ServiceTask_0yyq6ly" targetRef="IntermediateThrowEvent_1u6yhg1" />
+ <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1u6yhg1" name="Goto check processing status">
+ <bpmn:incoming>SequenceFlow_15mad8z</bpmn:incoming>
+ <bpmn:linkEventDefinition name="CheckProcessingStatus" />
+ </bpmn:intermediateThrowEvent>
+ <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_13zkj1k" name="CheckProcessingStatus">
+ <bpmn:outgoing>SequenceFlow_0spge8t</bpmn:outgoing>
+ <bpmn:linkEventDefinition name="CheckProcessingStatus" />
+ </bpmn:intermediateCatchEvent>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_19x2qmv" name="Is nsmf ansyc response Successful?">
+ <bpmn:incoming>SequenceFlow_056nqyg</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1uvyn2n</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_114tqpz</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1uvyn2n" name="Yes" sourceRef="ExclusiveGateway_19x2qmv" targetRef="Task_1a4kd0x">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ProcessNsmfSuccess") == "OK"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1j65sro" sourceRef="Task_1a4kd0x" targetRef="Task_0z4msb8" />
+ <bpmn:sequenceFlow id="SequenceFlow_056nqyg" sourceRef="ScriptTask_01pvcx5" targetRef="ExclusiveGateway_19x2qmv" />
+ <bpmn:endEvent id="EndEvent_1g8f1f0">
+ <bpmn:incoming>SequenceFlow_0c89n51</bpmn:incoming>
+ <bpmn:errorEventDefinition errorRef="Error_1w6xfoc" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0c89n51" name="no" sourceRef="ExclusiveGateway_1djfumr" targetRef="EndEvent_1g8f1f0" />
+ <bpmn:sequenceFlow id="SequenceFlow_114tqpz" name="No" sourceRef="ExclusiveGateway_19x2qmv" targetRef="Task_0u6zuwq">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ProcessNsmfSuccess") == "ERROR"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:scriptTask id="ScriptTask_0sxtscf" name="Send Sync Ack Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1b66kfh</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0kypqg8</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCommunicationService()
+csi.sendSyncResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_0cdmkso" name="Parse CS Params From Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1ofzxsf</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_18guyhw</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCommunicationService()
+csi.parseCSParamsFromReq(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_18guyhw" sourceRef="ScriptTask_0cdmkso" targetRef="IntermediateThrowEvent_1w15bcr" />
+ <bpmn:sequenceFlow id="SequenceFlow_0kypqg8" sourceRef="ScriptTask_0sxtscf" targetRef="Task_1khpb1m" />
+ <bpmn:callActivity id="CallCheckServiceProcessStatus" name="CallCheckServiceProcessStatus" calledElement="CheckServiceProcessStatus">
+ <bpmn:extensionElements>
+ <camunda:in source="e2eServiceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="e2eOperationId" target="operationId" />
+ <camunda:in source="successConditions" target="successConditions" />
+ <camunda:in source="processServiceType" target="processServiceType" />
+ <camunda:in source="errorConditions" target="errorConditions" />
+ <camunda:in source="timeOut" target="timeOut" />
+ <camunda:in source="successParamMap" target="successParamMap" />
+ <camunda:in source="errorParamMap" target="errorParamMap" />
+ <camunda:out source="orchestrationStatus" target="orchestrationStatus" />
+ <camunda:out source="operationStatus" target="operationStatus" />
+ <camunda:out source="operationContent" target="operationContent" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="timeOutParamMap" target="timeOutParamMap" />
+ <camunda:in source="subOperationType" target="operationType" />
+ <camunda:in source="initProgress" target="initProgress" />
+ <camunda:in source="endProgress" target="endProgress" />
+ <camunda:in source="serviceInstanceId" target="parentServiceInstanceId" />
+ <camunda:in source="operationId" target="parentOperationId" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_079hxvu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1fpj5vj</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1fpj5vj" sourceRef="CallCheckServiceProcessStatus" targetRef="Task_0u6zuwq" />
+ <bpmn:sequenceFlow id="SequenceFlow_0spge8t" sourceRef="IntermediateThrowEvent_13zkj1k" targetRef="Task_0misguw" />
+ <bpmn:scriptTask id="Task_0misguw" name="Prepare Call CheckServiceProcessStatus" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0spge8t</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_079hxvu</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCommunicationService()
+csi.prepareCallCheckProcessStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_079hxvu" sourceRef="Task_0misguw" targetRef="CallCheckServiceProcessStatus" />
+ <bpmn:sequenceFlow id="SequenceFlow_0j35uff" sourceRef="Task_0siw5ye" targetRef="ServiceTask_0y8x077" />
+ <bpmn:sequenceFlow id="SequenceFlow_1u66yqo" sourceRef="ServiceTask_0y8x077" targetRef="IntermediateThrowEvent_1r29nqs" />
+ <bpmn:sequenceFlow id="SequenceFlow_0hkz9h0" sourceRef="IntermediateCatchEvent_08tr730" targetRef="ScriptTask_01pvcx5" />
+ </bpmn:process>
+ <bpmn:error id="Error_1w6xfoc" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateCommunicationService">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="162" y="99" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="158" y="142" width="46" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0lzwdto_di" bpmnElement="SequenceFlow_0lzwdto">
+ <di:waypoint x="198" y="117" />
+ <di:waypoint x="250" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1gjmyhd_di" bpmnElement="SequenceFlow_1gjmyhd">
+ <di:waypoint x="350" y="117" />
+ <di:waypoint x="390" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1jxjk8b_di" bpmnElement="Task_1beyt5u">
+ <dc:Bounds x="250" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1a9q04w_di" bpmnElement="Task_0dz4tto">
+ <dc:Bounds x="390" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1vcepmd_di" bpmnElement="SequenceFlow_1vcepmd">
+ <di:waypoint x="490" y="117" />
+ <di:waypoint x="550" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0ozije4_di" bpmnElement="ServiceTask_0ozije4">
+ <dc:Bounds x="550" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_12shhv4_di" bpmnElement="Task_1khpb1m">
+ <dc:Bounds x="710" y="266" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1fiq8pw_di" bpmnElement="Task_0siw5ye">
+ <dc:Bounds x="890" y="266" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0y8x077_di" bpmnElement="ServiceTask_0y8x077">
+ <dc:Bounds x="1120" y="266" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0yyq6ly_di" bpmnElement="ServiceTask_0yyq6ly">
+ <dc:Bounds x="1230" y="496" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1t0awxp_di" bpmnElement="ServiceTask_1t0awxp">
+ <dc:Bounds x="1230" y="782" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0lu4p9e_di" bpmnElement="EndEvent_0lu4p9e">
+ <dc:Bounds x="1382" y="804" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1390" y="850" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0elkfli_di" bpmnElement="SequenceFlow_0elkfli">
+ <di:waypoint x="1330" y="822" />
+ <di:waypoint x="1382" y="822" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1q4zssd_di" bpmnElement="Task_1a4kd0x">
+ <dc:Bounds x="910" y="496" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0akbbpi_di" bpmnElement="SequenceFlow_0akbbpi">
+ <di:waypoint x="810" y="306" />
+ <di:waypoint x="890" y="306" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_1d14p1s_di" bpmnElement="CallCreateCommunicationService">
+ <dc:Bounds x="250" y="266" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ltd3dc_di" bpmnElement="SequenceFlow_1ltd3dc">
+ <di:waypoint x="650" y="117" />
+ <di:waypoint x="720" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0x9rd1d_di" bpmnElement="SequenceFlow_0x9rd1d">
+ <di:waypoint x="350" y="306" />
+ <di:waypoint x="415" y="306" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1anjycx_di" bpmnElement="Task_0u6zuwq">
+ <dc:Bounds x="910" y="782" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_04321fy_di" bpmnElement="SequenceFlow_04321fy">
+ <di:waypoint x="1010" y="822" />
+ <di:waypoint x="1080" y="822" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1inkg6e_di" bpmnElement="SequenceFlow_1inkg6e">
+ <di:waypoint x="1180" y="822" />
+ <di:waypoint x="1230" y="822" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1y7nvia_di" bpmnElement="ScriptTask_1y7nvia">
+ <dc:Bounds x="1080" y="782" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1iiorr4_di" bpmnElement="SequenceFlow_1iiorr4">
+ <di:waypoint x="1180" y="536" />
+ <di:waypoint x="1230" y="536" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1rv123h_di" bpmnElement="Task_0z4msb8">
+ <dc:Bounds x="1080" y="496" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0z3vej2_di" bpmnElement="Task_0k0z1g4">
+ <dc:Bounds x="720" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_04n3rws_di" bpmnElement="Task_1iyttxg">
+ <dc:Bounds x="890" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0w00x24_di" bpmnElement="CallActivity_0w00x24">
+ <dc:Bounds x="1040" y="74" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ofzxsf_di" bpmnElement="SequenceFlow_1ofzxsf">
+ <di:waypoint x="1140" y="114" />
+ <di:waypoint x="1210" y="114" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="IntermediateThrowEvent_1lz4unp_di" bpmnElement="IntermediateThrowEvent_1w15bcr">
+ <dc:Bounds x="1382" y="96" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1364" y="139" width="77" height="40" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_13aldsi_di" bpmnElement="SequenceFlow_13aldsi">
+ <di:waypoint x="820" y="117" />
+ <di:waypoint x="890" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1f1zdf9_di" bpmnElement="SequenceFlow_1f1zdf9">
+ <di:waypoint x="990" y="117" />
+ <di:waypoint x="1040" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="IntermediateCatchEvent_0r2oht8_di" bpmnElement="IntermediateThrowEvent_0mnp81i">
+ <dc:Bounds x="162" y="288" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="139" y="331" width="87" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ds2e2l_di" bpmnElement="SequenceFlow_1ds2e2l">
+ <di:waypoint x="198" y="306" />
+ <di:waypoint x="250" y="306" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="SubProcess_1rxymch_di" bpmnElement="SubProcess_1rxymch" isExpanded="true">
+ <dc:Bounds x="290" y="1053" width="781" height="196" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0zmwd5y_di" bpmnElement="EndEvent_0zmwd5y">
+ <dc:Bounds x="1002" y="1139" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1djfumr_di" bpmnElement="ExclusiveGateway_1djfumr" isMarkerVisible="true">
+ <dc:Bounds x="415" y="281" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="404" y="244" width="73" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1b66kfh_di" bpmnElement="SequenceFlow_1b66kfh">
+ <di:waypoint x="465" y="306" />
+ <di:waypoint x="530" y="306" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="491" y="288" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="IntermediateThrowEvent_1r29nqs_di" bpmnElement="IntermediateThrowEvent_1r29nqs">
+ <dc:Bounds x="1382" y="288" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1371" y="331" width="66" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateCatchEvent_08tr730_di" bpmnElement="IntermediateCatchEvent_08tr730">
+ <dc:Bounds x="162" y="518" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="148" y="561" width="72" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_01pvcx5_di" bpmnElement="ScriptTask_01pvcx5">
+ <dc:Bounds x="390" y="496" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_15mad8z_di" bpmnElement="SequenceFlow_15mad8z">
+ <di:waypoint x="1330" y="536" />
+ <di:waypoint x="1382" y="536" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="IntermediateThrowEvent_0kwoo94_di" bpmnElement="IntermediateThrowEvent_1u6yhg1">
+ <dc:Bounds x="1382" y="518" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1359" y="561" width="87" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateCatchEvent_0ky7904_di" bpmnElement="IntermediateThrowEvent_13zkj1k">
+ <dc:Bounds x="162" y="804" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="138" y="847" width="86" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_19x2qmv_di" bpmnElement="ExclusiveGateway_19x2qmv" isMarkerVisible="true">
+ <dc:Bounds x="605" y="511" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="602" y="472" width="68" height="40" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1uvyn2n_di" bpmnElement="SequenceFlow_1uvyn2n">
+ <di:waypoint x="655" y="536" />
+ <di:waypoint x="910" y="536" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="741" y="519" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1j65sro_di" bpmnElement="SequenceFlow_1j65sro">
+ <di:waypoint x="1010" y="536" />
+ <di:waypoint x="1080" y="536" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_056nqyg_di" bpmnElement="SequenceFlow_056nqyg">
+ <di:waypoint x="490" y="536" />
+ <di:waypoint x="605" y="536" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_0wgf0cs_di" bpmnElement="StartEvent_0wgf0cs">
+ <dc:Bounds x="332" y="1139" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_07fl9jy_di" bpmnElement="SequenceFlow_07fl9jy">
+ <di:waypoint x="368" y="1157" />
+ <di:waypoint x="620" y="1157" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_1bombkp_di" bpmnElement="EndEvent_1g8f1f0">
+ <dc:Bounds x="422" y="392" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0c89n51_di" bpmnElement="SequenceFlow_0c89n51">
+ <di:waypoint x="440" y="331" />
+ <di:waypoint x="440" y="392" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="449" y="345" width="13" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_18gv408_di" bpmnElement="ScriptTask_18gv408">
+ <dc:Bounds x="620" y="1117" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1kmsen3_di" bpmnElement="SequenceFlow_1kmsen3">
+ <di:waypoint x="720" y="1157" />
+ <di:waypoint x="1002" y="1157" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_114tqpz_di" bpmnElement="SequenceFlow_114tqpz">
+ <di:waypoint x="630" y="561" />
+ <di:waypoint x="630" y="630" />
+ <di:waypoint x="980" y="630" />
+ <di:waypoint x="980" y="782" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="799" y="612" width="15" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0sxtscf_di" bpmnElement="ScriptTask_0sxtscf">
+ <dc:Bounds x="530" y="266" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0cdmkso_di" bpmnElement="ScriptTask_0cdmkso">
+ <dc:Bounds x="1210" y="74" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_18guyhw_di" bpmnElement="SequenceFlow_18guyhw">
+ <di:waypoint x="1310" y="114" />
+ <di:waypoint x="1382" y="114" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0kypqg8_di" bpmnElement="SequenceFlow_0kypqg8">
+ <di:waypoint x="630" y="306" />
+ <di:waypoint x="710" y="306" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_0oktqmg_di" bpmnElement="CallCheckServiceProcessStatus">
+ <dc:Bounds x="620" y="782" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1fpj5vj_di" bpmnElement="SequenceFlow_1fpj5vj">
+ <di:waypoint x="720" y="822" />
+ <di:waypoint x="910" y="822" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0spge8t_di" bpmnElement="SequenceFlow_0spge8t">
+ <di:waypoint x="198" y="822" />
+ <di:waypoint x="330" y="822" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0bi31xq_di" bpmnElement="Task_0misguw">
+ <dc:Bounds x="330" y="782" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_079hxvu_di" bpmnElement="SequenceFlow_079hxvu">
+ <di:waypoint x="430" y="822" />
+ <di:waypoint x="620" y="822" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0j35uff_di" bpmnElement="SequenceFlow_0j35uff">
+ <di:waypoint x="990" y="306" />
+ <di:waypoint x="1120" y="306" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1u66yqo_di" bpmnElement="SequenceFlow_1u66yqo">
+ <di:waypoint x="1220" y="306" />
+ <di:waypoint x="1382" y="306" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0hkz9h0_di" bpmnElement="SequenceFlow_0hkz9h0">
+ <di:waypoint x="198" y="536" />
+ <di:waypoint x="390" y="536" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn
new file mode 100644
index 0000000000..013e1b62c2
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn
@@ -0,0 +1,805 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.2">
+ <bpmn:process id="Process_0r5eb97" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Slice Service Creation Flow">
+ <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0vilb24" name="Waiting for confirmation">
+ <bpmn:outgoing>SequenceFlow_1fk37v7</bpmn:outgoing>
+ <bpmn:linkEventDefinition id="LinkEventDefinition_197u5pe" name="WaitingForConfirmation" />
+ </bpmn:intermediateCatchEvent>
+ <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css= new CreateSliceService()
+css.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_1jgtb0y" name="Process User Options" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1cv0wop</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_197cm2e</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new CreateSliceService()
+css.processUserOptions(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0elbczl" name="Continue Slice?" default="SequenceFlow_038lb9m">
+ <bpmn:incoming>SequenceFlow_197cm2e</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_12t5exy</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_038lb9m</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:scriptTask id="ScriptTask_0l3d1ai" name="Process Decomposition" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1t19ips</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0jrclmc</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new CreateSliceService()
+css.processDecomposition(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_1eo3m4q" name="Get NST Selection" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_046irye</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1o23s0i</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new CreateSliceService()
+css.getNSTSelection(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_139l55g" name="Call DoCreateSliceServiceInstance&#10;" calledElement="DoCreateSliceServiceInstance">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
+ <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="productFamilyId" target="productFamilyId" />
+ <camunda:in source="serviceInputParams" target="serviceInputParams" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+ <camunda:in source="serviceType" target="serviceType" />
+ <camunda:in source="uuiRequest" target="uuiRequest" />
+ <camunda:in source="requestAction" target="operationType" />
+ <camunda:in source="operationId" target="operationId" />
+ <camunda:in source="serviceProfile" target="serviceProfile" />
+ <camunda:in source="sliceProfileTn" target="sliceProfileTn" />
+ <camunda:in source="sliceProfileCn" target="sliceProfileCn" />
+ <camunda:in source="sliceProfileAn" target="sliceProfileAn" />
+ <camunda:in source="sliceServiceDecomposition" target="sliceServiceDecomposition" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="rollbackData" target="rollbackData" />
+ <camunda:out source="rolledBack" target="rolledBack" />
+ <camunda:out source="allottedResourceId" target="allottedResourceId" />
+ <camunda:out source="serviceInstanceData" target="serviceInstanceData" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1p8vxo5</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1g8m7tq</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1v96asi" name="Goto Waiting for Confirmation">
+ <bpmn:incoming>SequenceFlow_0it2g9j</bpmn:incoming>
+ <bpmn:linkEventDefinition id="LinkEventDefinition_0uj34dx" name="WaitingForConfirmation" />
+ </bpmn:intermediateThrowEvent>
+ <bpmn:scriptTask id="ScriptTask_0gb975b" name="Prepare Update Orchestration Task" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1aaozcg</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_18kur12</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("taskStatus", "WaitingToConfirm")
+def css = new CreateSliceService()
+css.prepareUpdateOrchestrationTask(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_18eld2o" name="Is Slice Successful?" default="SequenceFlow_1c6ka9h">
+ <bpmn:incoming>SequenceFlow_0mlrlbv</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1c6ka9h</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0n4xku8</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:endEvent id="EndEvent_0x406rw">
+ <bpmn:incoming>SequenceFlow_1c6ka9h</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_0mlneuw" errorRef="Error_03akl5v" />
+ </bpmn:endEvent>
+ <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_1omdx56">
+ <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1jx3026">
+ <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" />
+ <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" />
+ </bpmn:subProcess>
+ <bpmn:scriptTask id="ScriptTask_1ef3voz" name="Prepare Update Orchestration Task" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0klb3ey</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("taskStatus", "Completed")
+def css = new CreateSliceService()
+css.prepareUpdateOrchestrationTask(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:endEvent id="EndEvent_05h01gx" name="End">
+ <bpmn:incoming>SequenceFlow_11rbv41</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_1xxag1o" name="Init Service Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0t094g7</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new CreateSliceService()
+css.prepareInitServiceOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1ex8ke9" name="Goto Create Slice Service">
+ <bpmn:incoming>SequenceFlow_0jrclmc</bpmn:incoming>
+ <bpmn:linkEventDefinition id="LinkEventDefinition_0de65en" name="CreateSliceService" />
+ </bpmn:intermediateThrowEvent>
+ <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_1wii8im" name="Create Slice Service">
+ <bpmn:outgoing>SequenceFlow_1o1tu0f</bpmn:outgoing>
+ <bpmn:linkEventDefinition id="LinkEventDefinition_1krpcdk" name="CreateSliceService" />
+ </bpmn:intermediateCatchEvent>
+ <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Service Oper Status((finish)" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0lbdfmt</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("operationProgress", "100")
+execution.setVariable("operationResult", "finished")
+execution.setVariable("operationReason", "Slice completed")
+def css = new CreateSliceService()
+css.prepareUpdateServiceOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_0kd6p6p" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CSSOS_dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:script scriptFormat="groovy">execution.getVariable("CSSOS_headerMap")</camunda:script>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CSSOS_updateServiceOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CSSOS_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CSSOS_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0t094g7</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_046irye</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:callActivity id="CallActivity_1bnkmaz" name="Call Decompose Service" calledElement="DecomposeService">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:out source="serviceDecomposition" target="sliceServiceDecomposition" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0q7yc2c</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1t19ips</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="ScriptTask_0o2r07o" name="Prepare&#10;Decompose&#10;Service&#10;" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1o23s0i</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0q7yc2c</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi= new CreateSliceService()
+dcsi.prepareDecomposeService(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_0b7senu" name="Prepare Create OrchestrationTask" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1o1tu0f</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1sq6kp6</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css= new CreateSliceService()
+css.prepareCreateOrchestrationTask(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_0h88mep" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
+ <bpmn:extensionElements>
+ <camunda:out source="statusCode" target="CSSOT_dbResponseCode" />
+ <camunda:out source="response" target="CSSOT_dbResponse" />
+ <camunda:in source="CSSOT_taskId" target="taskId" />
+ <camunda:in source="msoRequestId" target="requestId" />
+ <camunda:in source="CSSOT_name" target="taskName" />
+ <camunda:in source="CSSOT_status" target="taskStatus" />
+ <camunda:in source="CSSOT_isManual" target="isManual" />
+ <camunda:in source="CSSOT_paramJson" target="paramJson" />
+ <camunda:in source="CSSOT_requestMethod" target="method" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1sq6kp6</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1p8vxo5</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:callActivity id="CallActivity_0n47zoh" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
+ <bpmn:extensionElements>
+ <camunda:out source="statusCode" target="CSSOT_dbResponseCode" />
+ <camunda:out source="response" target="CSSOT_dbResponse" />
+ <camunda:in source="CSSOT_taskId" target="taskId" />
+ <camunda:in source="msoRequestId" target="requestId" />
+ <camunda:in source="CSSOT_name" target="taskName" />
+ <camunda:in source="CSSOT_status" target="taskStatus" />
+ <camunda:in source="CSSOT_isManual" target="isManual" />
+ <camunda:in source="CSSOT_paramJson" target="paramJson" />
+ <camunda:in source="CSSOT_requestMethod" target="method" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_18kur12</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0it2g9j</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="ScriptTask_12h8542" name="Prepare Update Orchestration Task" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_12t5exy</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0thd6ny</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("taskStatus", "Creating")
+def css = new CreateSliceService()
+css.prepareUpdateOrchestrationTask(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_0o89wmf" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
+ <bpmn:extensionElements>
+ <camunda:out source="statusCode" target="CSSOT_dbResponseCode" />
+ <camunda:out source="response" target="CSSOT_dbResponse" />
+ <camunda:in source="CSSOT_taskId" target="taskId" />
+ <camunda:in source="msoRequestId" target="requestId" />
+ <camunda:in source="CSSOT_name" target="taskName" />
+ <camunda:in source="CSSOT_status" target="taskStatus" />
+ <camunda:in source="CSSOT_isManual" target="isManual" />
+ <camunda:in source="CSSOT_paramJson" target="paramJson" />
+ <camunda:in source="CSSOT_requestMethod" target="method" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0thd6ny</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0477975</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:callActivity id="CallActivity_0g98b71" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
+ <bpmn:extensionElements>
+ <camunda:out source="statusCode" target="CSSOT_dbResponseCode" />
+ <camunda:out source="response" target="CSSOT_dbResponse" />
+ <camunda:in source="CSSOT_taskId" target="taskId" />
+ <camunda:in source="msoRequestId" target="requestId" />
+ <camunda:in source="CSSOT_name" target="taskName" />
+ <camunda:in source="CSSOT_status" target="taskStatus" />
+ <camunda:in source="CSSOT_isManual" target="isManual" />
+ <camunda:in source="CSSOT_paramJson" target="paramJson" />
+ <camunda:in source="CSSOT_requestMethod" target="method" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0h2oree</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1cv0wop</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="ScriptTask_08wim95" name="Prepare Get User Options" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_16uz2t9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0h2oree</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new CreateSliceService()
+css.prepareGetUserOptions(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_0jdzpem" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
+ <bpmn:extensionElements>
+ <camunda:out source="statusCode" target="CSSOT_dbResponseCode" />
+ <camunda:out source="response" target="CSSOT_dbResponse" />
+ <camunda:in source="CSSOT_taskId" target="taskId" />
+ <camunda:in source="msoRequestId" target="requestId" />
+ <camunda:in source="CSSOT_name" target="taskName" />
+ <camunda:in source="CSSOT_status" target="taskStatus" />
+ <camunda:in source="CSSOT_isManual" target="isManual" />
+ <camunda:in source="CSSOT_paramJson" target="paramJson" />
+ <camunda:in source="CSSOT_requestMethod" target="method" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_19lsayh</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_10ng1vx</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="ScriptTask_1mscu5w" name="Prepare Update Orchestration Task" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_038lb9m</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_19lsayh</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("taskStatus", "Aborted")
+def css = new CreateSliceService()
+css.prepareUpdateOrchestrationTask(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0pkvfun" name="Allocate Slice">
+ <bpmn:outgoing>SequenceFlow_1bevt3a</bpmn:outgoing>
+ <bpmn:linkEventDefinition id="LinkEventDefinition_1vlfclx" name="AllocateSlice" />
+ </bpmn:intermediateCatchEvent>
+ <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0ktwpki" name="Goto Allocate Slice">
+ <bpmn:incoming>SequenceFlow_0477975</bpmn:incoming>
+ <bpmn:linkEventDefinition id="LinkEventDefinition_16f2ri9" name="AllocateSlice" />
+ </bpmn:intermediateThrowEvent>
+ <bpmn:callActivity id="CallActivity_15pl4ld" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
+ <bpmn:extensionElements>
+ <camunda:out source="statusCode" target="CSSOT_dbResponseCode" />
+ <camunda:out source="response" target="CSSOT_dbResponse" />
+ <camunda:in source="CSSOT_taskId" target="taskId" />
+ <camunda:in source="msoRequestId" target="requestId" />
+ <camunda:in source="CSSOT_name" target="taskName" />
+ <camunda:in source="CSSOT_status" target="taskStatus" />
+ <camunda:in source="CSSOT_isManual" target="isManual" />
+ <camunda:in source="CSSOT_paramJson" target="paramJson" />
+ <camunda:in source="CSSOT_requestMethod" target="method" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0klb3ey</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0lbdfmt</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:endEvent id="EndEvent_1oouvuh" name="End">
+ <bpmn:incoming>SequenceFlow_10ng1vx</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="ServiceTask_0esr949" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CSSOS_dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:script scriptFormat="groovy">execution.getVariable("CSSOS_headerMap")</camunda:script>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CSSOS_updateServiceOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CSSOS_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CSSOS_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1qv8qw1</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_11rbv41</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:scriptTask id="ScriptTask_1jj846g" name="Send Sync Ack Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1g8m7tq</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ey6m1e</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new CreateSliceService()
+css.sendSyncResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_0cxst1i" name="Call DoAllocateNSIandNSSI&#10;" calledElement="DoAllocateNSIandNSSI">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceInstanceId" target="sliceServiceInstanceId" />
+ <camunda:in source="serviceInstanceName" target="sliceServiceInstanceName" />
+ <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="productFamilyId" target="productFamilyId" />
+ <camunda:in source="disableRollback" target="disableRollback" />
+ <camunda:in source="serviceInputParams" target="serviceInputParams" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+ <camunda:in source="serviceType" target="serviceType" />
+ <camunda:in source="uuiRequest" target="uuiRequest" />
+ <camunda:in source="requestAction" target="operationType" />
+ <camunda:in source="operationId" target="operationId" />
+ <camunda:in source="serviceProfile" target="serviceProfile" />
+ <camunda:in source="sliceProfileTn" target="sliceProfileTn" />
+ <camunda:in source="sliceProfileCn" target="sliceProfileCn" />
+ <camunda:in source="sliceProfileAn" target="sliceProfileAn" />
+ <camunda:in source="sliceTaskParams" target="sliceTaskParams" />
+ <camunda:in source="CSSOT_taskId" target="taskId" />
+ <camunda:in source="CSSOT_name" target="taskName" />
+ <camunda:in source="CSSOT_status" target="taskStatus" />
+ <camunda:in source="CSSOT_isManual" target="isManual" />
+ <camunda:in source="resourceSharingLevel" target="resourceSharingLevel" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="rollbackData" target="rollbackData" />
+ <camunda:out source="rolledBack" target="rolledBack" />
+ <camunda:in source="allottedResourceId" target="allottedResourceId" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1bevt3a</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0mlrlbv</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:endEvent id="EndEvent_0bh0kwx">
+ <bpmn:incoming>SequenceFlow_12qt5ci</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1xa66sx" errorRef="Error_0p2naox" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
+ <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="ScriptTask_1xxag1o" />
+ <bpmn:sequenceFlow id="SequenceFlow_1cv0wop" sourceRef="CallActivity_0g98b71" targetRef="ScriptTask_1jgtb0y" />
+ <bpmn:sequenceFlow id="SequenceFlow_197cm2e" sourceRef="ScriptTask_1jgtb0y" targetRef="ExclusiveGateway_0elbczl" />
+ <bpmn:sequenceFlow id="SequenceFlow_12t5exy" name="continue" sourceRef="ExclusiveGateway_0elbczl" targetRef="ScriptTask_12h8542">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("taskAction") == "commit"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_038lb9m" name="abort" sourceRef="ExclusiveGateway_0elbczl" targetRef="ScriptTask_1mscu5w" />
+ <bpmn:sequenceFlow id="SequenceFlow_1t19ips" sourceRef="CallActivity_1bnkmaz" targetRef="ScriptTask_0l3d1ai" />
+ <bpmn:sequenceFlow id="SequenceFlow_1p8vxo5" sourceRef="CallActivity_0h88mep" targetRef="CallActivity_139l55g" />
+ <bpmn:sequenceFlow id="SequenceFlow_1g8m7tq" sourceRef="CallActivity_139l55g" targetRef="ScriptTask_1jj846g" />
+ <bpmn:sequenceFlow id="SequenceFlow_0it2g9j" sourceRef="CallActivity_0n47zoh" targetRef="IntermediateThrowEvent_1v96asi" />
+ <bpmn:sequenceFlow id="SequenceFlow_18kur12" sourceRef="ScriptTask_0gb975b" targetRef="CallActivity_0n47zoh" />
+ <bpmn:sequenceFlow id="SequenceFlow_0mlrlbv" sourceRef="CallActivity_0cxst1i" targetRef="ExclusiveGateway_18eld2o" />
+ <bpmn:sequenceFlow id="SequenceFlow_1c6ka9h" name="No" sourceRef="ExclusiveGateway_18eld2o" targetRef="EndEvent_0x406rw" />
+ <bpmn:sequenceFlow id="SequenceFlow_0n4xku8" name="Yes" sourceRef="ExclusiveGateway_18eld2o" targetRef="ScriptTask_19uxoi8">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0klb3ey" sourceRef="ScriptTask_1ef3voz" targetRef="CallActivity_15pl4ld" />
+ <bpmn:sequenceFlow id="SequenceFlow_11rbv41" sourceRef="ServiceTask_0esr949" targetRef="EndEvent_05h01gx" />
+ <bpmn:sequenceFlow id="SequenceFlow_0t094g7" sourceRef="ScriptTask_1xxag1o" targetRef="ServiceTask_0kd6p6p" />
+ <bpmn:sequenceFlow id="SequenceFlow_1o1tu0f" sourceRef="IntermediateCatchEvent_1wii8im" targetRef="ScriptTask_0b7senu" />
+ <bpmn:sequenceFlow id="SequenceFlow_0lbdfmt" sourceRef="CallActivity_15pl4ld" targetRef="ScriptTask_1ssh2l9" />
+ <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="ServiceTask_0esr949" />
+ <bpmn:sequenceFlow id="SequenceFlow_0q7yc2c" sourceRef="ScriptTask_0o2r07o" targetRef="CallActivity_1bnkmaz" />
+ <bpmn:sequenceFlow id="SequenceFlow_1sq6kp6" sourceRef="ScriptTask_0b7senu" targetRef="CallActivity_0h88mep" />
+ <bpmn:sequenceFlow id="SequenceFlow_0thd6ny" sourceRef="ScriptTask_12h8542" targetRef="CallActivity_0o89wmf" />
+ <bpmn:sequenceFlow id="SequenceFlow_0477975" sourceRef="CallActivity_0o89wmf" targetRef="IntermediateThrowEvent_0ktwpki" />
+ <bpmn:sequenceFlow id="SequenceFlow_0h2oree" sourceRef="ScriptTask_08wim95" targetRef="CallActivity_0g98b71" />
+ <bpmn:sequenceFlow id="SequenceFlow_19lsayh" sourceRef="ScriptTask_1mscu5w" targetRef="CallActivity_0jdzpem" />
+ <bpmn:sequenceFlow id="SequenceFlow_10ng1vx" sourceRef="CallActivity_0jdzpem" targetRef="EndEvent_1oouvuh" />
+ <bpmn:sequenceFlow id="SequenceFlow_1bevt3a" sourceRef="IntermediateCatchEvent_0pkvfun" targetRef="CallActivity_0cxst1i" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ey6m1e" sourceRef="ScriptTask_1jj846g" targetRef="CallActivity_0v4mw2x" />
+ <bpmn:receiveTask id="Task_1b5t88h" name="Waiting for confirmation" messageRef="Message_0c4b2r5">
+ <bpmn:incoming>SequenceFlow_1fk37v7</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_16uz2t9</bpmn:outgoing>
+ </bpmn:receiveTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1fk37v7" sourceRef="IntermediateCatchEvent_0vilb24" targetRef="Task_1b5t88h" />
+ <bpmn:sequenceFlow id="SequenceFlow_16uz2t9" sourceRef="Task_1b5t88h" targetRef="ScriptTask_08wim95" />
+ <bpmn:boundaryEvent id="BoundaryEvent_0clo9pv" attachedToRef="Task_1b5t88h">
+ <bpmn:outgoing>SequenceFlow_12qt5ci</bpmn:outgoing>
+ <bpmn:timerEventDefinition>
+ <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT2H</bpmn:timeDuration>
+ </bpmn:timerEventDefinition>
+ </bpmn:boundaryEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_12qt5ci" sourceRef="BoundaryEvent_0clo9pv" targetRef="EndEvent_0bh0kwx" />
+ <bpmn:callActivity id="CallActivity_0v4mw2x" name="Call DoCreateSliceServiceOption&#10;" calledElement="DoCreateSliceServiceOption">
+ <bpmn:extensionElements>
+ <camunda:in source="nstModelUuid" target="nstModelUuid" />
+ <camunda:in source="nstModelInvariantUuid" target="nstModelInvariantUuid" />
+ <camunda:in source="serviceProfile" target="serviceProfile" />
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="sliceTaskParams" target="sliceTaskParams" />
+ <camunda:in source="resourceSharingLevel" target="resourceSharingLevel" />
+ <camunda:out source="sliceTaskParams" target="sliceTaskParams" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+ <camunda:in source="serviceType" target="serviceType" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1ey6m1e</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1aaozcg</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1aaozcg" sourceRef="CallActivity_0v4mw2x" targetRef="ScriptTask_0gb975b" />
+ <bpmn:sequenceFlow id="SequenceFlow_046irye" sourceRef="ServiceTask_0kd6p6p" targetRef="ScriptTask_1eo3m4q" />
+ <bpmn:sequenceFlow id="SequenceFlow_1o23s0i" sourceRef="ScriptTask_1eo3m4q" targetRef="ScriptTask_0o2r07o" />
+ <bpmn:sequenceFlow id="SequenceFlow_0jrclmc" sourceRef="ScriptTask_0l3d1ai" targetRef="IntermediateThrowEvent_1ex8ke9" />
+ <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0n4xku8</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("orchestrationStatus", "deactivated")
+def css = new CreateSliceService()
+css.updateAAIOrchStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ef3voz" />
+ </bpmn:process>
+ <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
+ <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_0r5eb97">
+ <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+ <dc:Bounds x="178" y="103" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="156" y="146" width="82" height="40" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateCatchEvent_0vilb24_di" bpmnElement="IntermediateCatchEvent_0vilb24">
+ <dc:Bounds x="178" y="438" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="168" y="481" width="60" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+ <dc:Bounds x="285" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1jgtb0y_di" bpmnElement="ScriptTask_1jgtb0y">
+ <dc:Bounds x="830" y="416" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0elbczl_di" bpmnElement="ExclusiveGateway_0elbczl" isMarkerVisible="true">
+ <dc:Bounds x="1040" y="431" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1027" y="413" width="78" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0l3d1ai_di" bpmnElement="ScriptTask_0l3d1ai">
+ <dc:Bounds x="1370" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1eo3m4q_di" bpmnElement="ScriptTask_1eo3m4q">
+ <dc:Bounds x="830" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_139l55g_di" bpmnElement="CallActivity_139l55g">
+ <dc:Bounds x="645" y="249" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateThrowEvent_1v96asi_di" bpmnElement="IntermediateThrowEvent_1v96asi">
+ <dc:Bounds x="1584" y="271" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1567" y="312" width="81" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0gb975b_di" bpmnElement="ScriptTask_0gb975b">
+ <dc:Bounds x="1193" y="249" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_18eld2o_di" bpmnElement="ExclusiveGateway_18eld2o" isMarkerVisible="true">
+ <dc:Bounds x="488" y="776" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="483" y="746" width="60" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0x406rw_di" bpmnElement="EndEvent_0x406rw">
+ <dc:Bounds x="495" y="926" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
+ <dc:Bounds x="685" y="1080" width="781" height="196" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1ef3voz_di" bpmnElement="ScriptTask_1ef3voz">
+ <dc:Bounds x="823" y="761" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+ <dc:Bounds x="1585" y="783" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1593" y="826" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1xxag1o_di" bpmnElement="ScriptTask_1xxag1o">
+ <dc:Bounds x="468" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateThrowEvent_1ex8ke9_di" bpmnElement="IntermediateThrowEvent_1ex8ke9">
+ <dc:Bounds x="1584" y="103" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1564" y="144" width="87" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateCatchEvent_1wii8im_di" bpmnElement="IntermediateCatchEvent_1wii8im">
+ <dc:Bounds x="178" y="271" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="171" y="314" width="60" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+ <dc:Bounds x="1197" y="761" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0kd6p6p_di" bpmnElement="ServiceTask_0kd6p6p">
+ <dc:Bounds x="645" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1bnkmaz_di" bpmnElement="CallActivity_1bnkmaz">
+ <dc:Bounds x="1193" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0o2r07o_di" bpmnElement="ScriptTask_0o2r07o">
+ <dc:Bounds x="1015" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0b7senu_di" bpmnElement="ScriptTask_0b7senu">
+ <dc:Bounds x="285" y="249" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0h88mep_di" bpmnElement="CallActivity_0h88mep">
+ <dc:Bounds x="467" y="249" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0n47zoh_di" bpmnElement="CallActivity_0n47zoh">
+ <dc:Bounds x="1371" y="249" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_12h8542_di" bpmnElement="ScriptTask_12h8542">
+ <dc:Bounds x="1193" y="416" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0o89wmf_di" bpmnElement="CallActivity_0o89wmf">
+ <dc:Bounds x="1371" y="416" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0g98b71_di" bpmnElement="CallActivity_0g98b71">
+ <dc:Bounds x="645" y="416" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_08wim95_di" bpmnElement="ScriptTask_08wim95">
+ <dc:Bounds x="467" y="416" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0jdzpem_di" bpmnElement="CallActivity_0jdzpem">
+ <dc:Bounds x="1371" y="605" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1mscu5w_di" bpmnElement="ScriptTask_1mscu5w">
+ <dc:Bounds x="1193" y="605" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateCatchEvent_0pkvfun_di" bpmnElement="IntermediateCatchEvent_0pkvfun">
+ <dc:Bounds x="178" y="783" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="168" y="826" width="66" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateThrowEvent_0ktwpki_di" bpmnElement="IntermediateThrowEvent_0ktwpki">
+ <dc:Bounds x="1584" y="438" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1577" y="479" width="67" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_15pl4ld_di" bpmnElement="CallActivity_15pl4ld">
+ <dc:Bounds x="1005" y="761" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1oouvuh_di" bpmnElement="EndEvent_1oouvuh">
+ <dc:Bounds x="1584" y="627" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1592" y="670" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0esr949_di" bpmnElement="ServiceTask_0esr949">
+ <dc:Bounds x="1375" y="761" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1jj846g_di" bpmnElement="ScriptTask_1jj846g">
+ <dc:Bounds x="830" y="249" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0cxst1i_di" bpmnElement="CallActivity_0cxst1i">
+ <dc:Bounds x="285" y="761" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0bh0kwx_di" bpmnElement="EndEvent_0bh0kwx">
+ <dc:Bounds x="317" y="593" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+ <di:waypoint x="214" y="121" />
+ <di:waypoint x="285" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+ <di:waypoint x="385" y="121" />
+ <di:waypoint x="468" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1cv0wop_di" bpmnElement="SequenceFlow_1cv0wop">
+ <di:waypoint x="745" y="456" />
+ <di:waypoint x="830" y="456" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_197cm2e_di" bpmnElement="SequenceFlow_197cm2e">
+ <di:waypoint x="930" y="456" />
+ <di:waypoint x="1040" y="456" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_12t5exy_di" bpmnElement="SequenceFlow_12t5exy">
+ <di:waypoint x="1090" y="456" />
+ <di:waypoint x="1193" y="456" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1121.5" y="438" width="42" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_038lb9m_di" bpmnElement="SequenceFlow_038lb9m">
+ <di:waypoint x="1065" y="481" />
+ <di:waypoint x="1065" y="645" />
+ <di:waypoint x="1193" y="645" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1067" y="560" width="27" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1t19ips_di" bpmnElement="SequenceFlow_1t19ips">
+ <di:waypoint x="1293" y="121" />
+ <di:waypoint x="1370" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1p8vxo5_di" bpmnElement="SequenceFlow_1p8vxo5">
+ <di:waypoint x="567" y="289" />
+ <di:waypoint x="645" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1g8m7tq_di" bpmnElement="SequenceFlow_1g8m7tq">
+ <di:waypoint x="745" y="289" />
+ <di:waypoint x="830" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0it2g9j_di" bpmnElement="SequenceFlow_0it2g9j">
+ <di:waypoint x="1471" y="289" />
+ <di:waypoint x="1584" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_18kur12_di" bpmnElement="SequenceFlow_18kur12">
+ <di:waypoint x="1293" y="289" />
+ <di:waypoint x="1371" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0mlrlbv_di" bpmnElement="SequenceFlow_0mlrlbv">
+ <di:waypoint x="385" y="801" />
+ <di:waypoint x="488" y="801" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1c6ka9h_di" bpmnElement="SequenceFlow_1c6ka9h">
+ <di:waypoint x="513" y="826" />
+ <di:waypoint x="513" y="926" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="521" y="832" width="15" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0n4xku8_di" bpmnElement="SequenceFlow_0n4xku8">
+ <di:waypoint x="538" y="801" />
+ <di:waypoint x="645" y="801" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="584" y="783" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0klb3ey_di" bpmnElement="SequenceFlow_0klb3ey">
+ <di:waypoint x="923" y="801" />
+ <di:waypoint x="1005" y="801" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_11rbv41_di" bpmnElement="SequenceFlow_11rbv41">
+ <di:waypoint x="1475" y="801" />
+ <di:waypoint x="1585" y="801" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0t094g7_di" bpmnElement="SequenceFlow_0t094g7">
+ <di:waypoint x="568" y="121" />
+ <di:waypoint x="645" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1o1tu0f_di" bpmnElement="SequenceFlow_1o1tu0f">
+ <di:waypoint x="214" y="289" />
+ <di:waypoint x="285" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0lbdfmt_di" bpmnElement="SequenceFlow_0lbdfmt">
+ <di:waypoint x="1105" y="801" />
+ <di:waypoint x="1197" y="801" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+ <di:waypoint x="1297" y="801" />
+ <di:waypoint x="1375" y="801" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0q7yc2c_di" bpmnElement="SequenceFlow_0q7yc2c">
+ <di:waypoint x="1115" y="121" />
+ <di:waypoint x="1193" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1sq6kp6_di" bpmnElement="SequenceFlow_1sq6kp6">
+ <di:waypoint x="385" y="289" />
+ <di:waypoint x="467" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0thd6ny_di" bpmnElement="SequenceFlow_0thd6ny">
+ <di:waypoint x="1293" y="456" />
+ <di:waypoint x="1371" y="456" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0477975_di" bpmnElement="SequenceFlow_0477975">
+ <di:waypoint x="1471" y="456" />
+ <di:waypoint x="1584" y="456" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0h2oree_di" bpmnElement="SequenceFlow_0h2oree">
+ <di:waypoint x="567" y="456" />
+ <di:waypoint x="645" y="456" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_19lsayh_di" bpmnElement="SequenceFlow_19lsayh">
+ <di:waypoint x="1293" y="645" />
+ <di:waypoint x="1371" y="645" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_10ng1vx_di" bpmnElement="SequenceFlow_10ng1vx">
+ <di:waypoint x="1471" y="645" />
+ <di:waypoint x="1584" y="645" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1bevt3a_di" bpmnElement="SequenceFlow_1bevt3a">
+ <di:waypoint x="214" y="801" />
+ <di:waypoint x="285" y="801" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ey6m1e_di" bpmnElement="SequenceFlow_1ey6m1e">
+ <di:waypoint x="930" y="289" />
+ <di:waypoint x="1015" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+ <dc:Bounds x="715" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+ <dc:Bounds x="1353" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+ <dc:Bounds x="979" y="1144" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+ <di:waypoint x="751" y="1184" />
+ <di:waypoint x="979" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+ <di:waypoint x="1079" y="1184" />
+ <di:waypoint x="1353" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ReceiveTask_0zkpdpa_di" bpmnElement="Task_1b5t88h">
+ <dc:Bounds x="285" y="416" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1fk37v7_di" bpmnElement="SequenceFlow_1fk37v7">
+ <di:waypoint x="214" y="456" />
+ <di:waypoint x="285" y="456" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_16uz2t9_di" bpmnElement="SequenceFlow_16uz2t9">
+ <di:waypoint x="385" y="456" />
+ <di:waypoint x="467" y="456" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="BoundaryEvent_15igwk2_di" bpmnElement="BoundaryEvent_0clo9pv">
+ <dc:Bounds x="317" y="478" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_12qt5ci_di" bpmnElement="SequenceFlow_12qt5ci">
+ <di:waypoint x="335" y="514" />
+ <di:waypoint x="335" y="611" />
+ <di:waypoint x="335" y="593" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_0v4mw2x_di" bpmnElement="CallActivity_0v4mw2x">
+ <dc:Bounds x="1015" y="249" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1aaozcg_di" bpmnElement="SequenceFlow_1aaozcg">
+ <di:waypoint x="1115" y="289" />
+ <di:waypoint x="1193" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_046irye_di" bpmnElement="SequenceFlow_046irye">
+ <di:waypoint x="745" y="121" />
+ <di:waypoint x="830" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1o23s0i_di" bpmnElement="SequenceFlow_1o23s0i">
+ <di:waypoint x="930" y="121" />
+ <di:waypoint x="1015" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0jrclmc_di" bpmnElement="SequenceFlow_0jrclmc">
+ <di:waypoint x="1470" y="121" />
+ <di:waypoint x="1584" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
+ <dc:Bounds x="645" y="761" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
+ <di:waypoint x="745" y="801" />
+ <di:waypoint x="823" y="801" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
+
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCommunicationService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCommunicationService.bpmn
new file mode 100644
index 0000000000..58a69621d3
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteCommunicationService.bpmn
@@ -0,0 +1,523 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1nvjixd" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+ <bpmn:process id="DeleteCommunicationService" name="DeleteCommunicationService" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1" name="start">
+ <bpmn:outgoing>SequenceFlow_1kjqnil</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1kjqnil" sourceRef="StartEvent_1" targetRef="Task_1mqm4nb" />
+ <bpmn:sequenceFlow id="SequenceFlow_0ogievs" sourceRef="Task_1mqm4nb" targetRef="Task_0q2v7qe" />
+ <bpmn:sequenceFlow id="SequenceFlow_192yyii" sourceRef="Task_0q2v7qe" targetRef="Task_0zaekmn" />
+ <bpmn:serviceTask id="Task_0zaekmn" name="Init Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_192yyii</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0xvoume</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:scriptTask id="Task_0q2v7qe" name="Init Service Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0ogievs</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_192yyii</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcs= new DeleteCommunicationService()
+dcs.preInitUpdateOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_1mqm4nb" name="PreProcessRequest" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1kjqnil</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0ogievs</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcs= new DeleteCommunicationService()
+dcs.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_1k5stey" name="Send Sync Ack Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0xvoume</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_017qgen</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcs = new DeleteCommunicationService()
+dcs.sendSyncResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0xvoume" sourceRef="Task_0zaekmn" targetRef="ScriptTask_1k5stey" />
+ <bpmn:sequenceFlow id="SequenceFlow_017qgen" sourceRef="ScriptTask_1k5stey" targetRef="Task_0ux5uk1" />
+ <bpmn:serviceTask id="Task_1kizznk" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0jrbkau</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ssiyug</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="Task_0xwjycr" name="update operation status completed">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/json</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_00g94pg</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_16ewagx</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1amyd7h</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_10g2pnj</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:endEvent id="EndEvent_0ixagvk" name="end">
+ <bpmn:incoming>SequenceFlow_10g2pnj</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_10g2pnj" sourceRef="Task_0xwjycr" targetRef="EndEvent_0ixagvk" />
+ <bpmn:scriptTask id="Task_0ux5uk1" name="Query CommunicationSerive From AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_017qgen</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1j0e2po</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcs = new DeleteCommunicationService()
+dcs.queryCommunicationSeriveFromAAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0ce724z" name="Go to Query delete progress">
+ <bpmn:incoming>SequenceFlow_0bmtfxq</bpmn:incoming>
+ <bpmn:linkEventDefinition name="QueryDeleteProgress" />
+ </bpmn:intermediateThrowEvent>
+ <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_11i33ob" name="QueryDeleteProgress">
+ <bpmn:outgoing>SequenceFlow_1tcgzv0</bpmn:outgoing>
+ <bpmn:linkEventDefinition name="QueryDeleteProgress" />
+ </bpmn:intermediateCatchEvent>
+ <bpmn:scriptTask id="Task_0qg5gn6" name="send request to NSMF WF" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_12xn3kz</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0bmtfxq</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcs = new DeleteCommunicationService()
+dcs.sendRequest2NSMFWF(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0bmtfxq" sourceRef="Task_0qg5gn6" targetRef="IntermediateThrowEvent_0ce724z" />
+ <bpmn:scriptTask id="Task_0qvxmnh" name="Delete CS Profile From AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0s7s7zk</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0arvpzv</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcs = new DeleteCommunicationService()
+dcs.delCSProfileFromAAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0arvpzv" sourceRef="Task_0qvxmnh" targetRef="Task_0b5j6rg" />
+ <bpmn:scriptTask id="Task_0b5j6rg" name="Delete CS From AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0arvpzv</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_00g94pg</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcs = new DeleteCommunicationService()
+dcs.delCSFromAAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:subProcess id="SubProcess_0p6namq" name="Exception Handling Sub-Process" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_1843894">
+ <bpmn:outgoing>SequenceFlow_1u5ko4h</bpmn:outgoing>
+ <bpmn:errorEventDefinition />
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1u5ko4h" sourceRef="StartEvent_1843894" targetRef="Task_1spbb2x" />
+ <bpmn:scriptTask id="Task_1spbb2x" name="Send Error Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1u5ko4h</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_05yfw7t</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcs = new DeleteCommunicationService()
+dcs.sendSyncError(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_05yfw7t" sourceRef="Task_1spbb2x" targetRef="Task_0yqtfvh" />
+ <bpmn:scriptTask id="Task_0yqtfvh" name="Pre update Failed Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_05yfw7t</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0c0btia</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcs = new DeleteCommunicationService()
+dcs.preFailedOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0c0btia" sourceRef="Task_0yqtfvh" targetRef="Task_1s3l3fc" />
+ <bpmn:serviceTask id="Task_1s3l3fc" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0c0btia</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1w55zo7</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:endEvent id="EndEvent_1fsful5">
+ <bpmn:incoming>SequenceFlow_1w55zo7</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1w55zo7" sourceRef="Task_1s3l3fc" targetRef="EndEvent_1fsful5" />
+ </bpmn:subProcess>
+ <bpmn:sequenceFlow id="SequenceFlow_1tcgzv0" sourceRef="IntermediateThrowEvent_11i33ob" targetRef="ExclusiveGateway_16tdrty" />
+ <bpmn:subProcess id="SubProcess_1l7gd5k" name="Sub-process for UnexpectedErrors" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_0zc2hnn">
+ <bpmn:outgoing>SequenceFlow_0mifi3x</bpmn:outgoing>
+ <bpmn:errorEventDefinition />
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0mifi3x" sourceRef="StartEvent_0zc2hnn" targetRef="Task_01va9ms" />
+ <bpmn:endEvent id="EndEvent_052gdjz">
+ <bpmn:incoming>SequenceFlow_073yxs4</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_073yxs4" sourceRef="Task_01va9ms" targetRef="EndEvent_052gdjz" />
+ <bpmn:scriptTask id="Task_01va9ms" name="Handle Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0mifi3x</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_073yxs4</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ </bpmn:subProcess>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1lyw619" name="Is NSMF timeout?" default="SequenceFlow_0s7s7zk">
+ <bpmn:incoming>SequenceFlow_0xipbpr</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1sah9so</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0s7s7zk</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0bqfbxf</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0s7s7zk" sourceRef="ExclusiveGateway_1lyw619" targetRef="Task_0qvxmnh" />
+ <bpmn:sequenceFlow id="SequenceFlow_00g94pg" sourceRef="Task_0b5j6rg" targetRef="Task_0xwjycr" />
+ <bpmn:sequenceFlow id="SequenceFlow_0bqfbxf" name="yes" sourceRef="ExclusiveGateway_1lyw619" targetRef="Task_1ovewjr">
+ <bpmn:documentation>#{(execution.getVariable("isTimeOut") == "YES")}</bpmn:documentation>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isTimeOut") == "YES")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_16tdrty" name="is NSMF Async Succeed?" default="SequenceFlow_0jrbkau">
+ <bpmn:incoming>SequenceFlow_1tcgzv0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0jrbkau</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_16ewagx</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0jrbkau" sourceRef="ExclusiveGateway_16tdrty" targetRef="Task_1kizznk" />
+ <bpmn:sequenceFlow id="SequenceFlow_16ewagx" name="no" sourceRef="ExclusiveGateway_16tdrty" targetRef="Task_0xwjycr">
+ <bpmn:documentation>#{(execution.getVariable("isNSMFWFRspSucceed" ) == "no")}</bpmn:documentation>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSMFWFRspSucceed" ) == "no")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0icj4go" name="Is E2E Slice Service Instance Id Exist?" default="SequenceFlow_12xn3kz">
+ <bpmn:incoming>SequenceFlow_1j0e2po</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_12xn3kz</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0xipbpr</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1j0e2po" sourceRef="Task_0ux5uk1" targetRef="ExclusiveGateway_0icj4go" />
+ <bpmn:sequenceFlow id="SequenceFlow_12xn3kz" sourceRef="ExclusiveGateway_0icj4go" targetRef="Task_0qg5gn6" />
+ <bpmn:sequenceFlow id="SequenceFlow_0xipbpr" name="no" sourceRef="ExclusiveGateway_0icj4go" targetRef="ExclusiveGateway_1lyw619">
+ <bpmn:documentation>#{(execution.getVariable("e2eSliceServiceInstanceId") == null)}</bpmn:documentation>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("e2eSliceServiceInstanceId") == null)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:callActivity id="Task_1ff6flk" name="CallCheckServiceProcessStatus" calledElement="CheckServiceProcessStatus">
+ <bpmn:extensionElements>
+ <camunda:in source="e2eSliceServiceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="e2eOperationId" target="operationId" />
+ <camunda:in source="successConditions" target="successConditions" />
+ <camunda:in source="errorConditions" target="errorConditions" />
+ <camunda:in source="processServiceType" target="processServiceType" />
+ <camunda:in source="timeOut" target="timeOut" />
+ <camunda:out source="operationStatus" target="result" />
+ <camunda:out source="operationContent" target="reason" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="isTimeOut" target="isTimeOut" />
+ <camunda:in source="subOperationType" target="operationType" />
+ <camunda:in source="initProgress" target="initProgress" />
+ <camunda:in source="endProgress" target="endProgress" />
+ <camunda:in source="serviceInstanceId" target="parentServiceInstanceId" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="operationId" target="parentOperationId" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0thr8dc</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1sah9so</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="Task_1ovewjr" name="Prepare update operation status error" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0bqfbxf</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1amyd7h</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcs = new DeleteCommunicationService()
+dcs.prepareFailureStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1amyd7h" sourceRef="Task_1ovewjr" targetRef="Task_0xwjycr" />
+ <bpmn:sequenceFlow id="SequenceFlow_1sah9so" sourceRef="Task_1ff6flk" targetRef="ExclusiveGateway_1lyw619" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ssiyug" sourceRef="Task_1kizznk" targetRef="Task_0y1n9ls" />
+ <bpmn:sequenceFlow id="SequenceFlow_0thr8dc" sourceRef="Task_0y1n9ls" targetRef="Task_1ff6flk" />
+ <bpmn:scriptTask id="Task_0y1n9ls" name="Prepare Call CheckServiceProcessStatus" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1ssiyug</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0thr8dc</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcs = new DeleteCommunicationService()
+dcs.prepareCallCheckProcessStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteCommunicationService">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="152" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="159" y="145" width="23" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1kjqnil_di" bpmnElement="SequenceFlow_1kjqnil">
+ <di:waypoint x="188" y="120" />
+ <di:waypoint x="240" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ogievs_di" bpmnElement="SequenceFlow_0ogievs">
+ <di:waypoint x="340" y="120" />
+ <di:waypoint x="390" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_192yyii_di" bpmnElement="SequenceFlow_192yyii">
+ <di:waypoint x="490" y="120" />
+ <di:waypoint x="560" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_104igd7_di" bpmnElement="Task_0zaekmn">
+ <dc:Bounds x="560" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0tqibrd_di" bpmnElement="Task_0q2v7qe">
+ <dc:Bounds x="390" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_18pflck_di" bpmnElement="Task_1mqm4nb">
+ <dc:Bounds x="240" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1k5stey_di" bpmnElement="ScriptTask_1k5stey">
+ <dc:Bounds x="740" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0xvoume_di" bpmnElement="SequenceFlow_0xvoume">
+ <di:waypoint x="660" y="120" />
+ <di:waypoint x="740" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_017qgen_di" bpmnElement="SequenceFlow_017qgen">
+ <di:waypoint x="840" y="120" />
+ <di:waypoint x="910" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_17pxrcl_di" bpmnElement="Task_1kizznk">
+ <dc:Bounds x="330" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0ucwm85_di" bpmnElement="Task_0xwjycr">
+ <dc:Bounds x="1250" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0ixagvk_di" bpmnElement="EndEvent_0ixagvk">
+ <dc:Bounds x="1432" y="332" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1441" y="375" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_10g2pnj_di" bpmnElement="SequenceFlow_10g2pnj">
+ <di:waypoint x="1350" y="350" />
+ <di:waypoint x="1432" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_05zxl7j_di" bpmnElement="Task_0ux5uk1">
+ <dc:Bounds x="910" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateThrowEvent_1go0jt1_di" bpmnElement="IntermediateThrowEvent_0ce724z">
+ <dc:Bounds x="1432" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1417" y="145" width="76" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateCatchEvent_09w3u1d_di" bpmnElement="IntermediateThrowEvent_11i33ob">
+ <dc:Bounds x="152" y="332" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="127" y="375" width="86" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0me3crz_di" bpmnElement="Task_0qg5gn6">
+ <dc:Bounds x="1220" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0bmtfxq_di" bpmnElement="SequenceFlow_0bmtfxq">
+ <di:waypoint x="1320" y="120" />
+ <di:waypoint x="1432" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_14svlaf_di" bpmnElement="Task_0qvxmnh">
+ <dc:Bounds x="900" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0arvpzv_di" bpmnElement="SequenceFlow_0arvpzv">
+ <di:waypoint x="1000" y="350" />
+ <di:waypoint x="1060" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0q6s59r_di" bpmnElement="Task_0b5j6rg">
+ <dc:Bounds x="1060" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_04znyto_di" bpmnElement="SubProcess_0p6namq" isExpanded="true">
+ <dc:Bounds x="480" y="650" width="730" height="210" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_1qti4dg_di" bpmnElement="StartEvent_1843894">
+ <dc:Bounds x="520" y="742" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1u5ko4h_di" bpmnElement="SequenceFlow_1u5ko4h">
+ <di:waypoint x="556" y="760" />
+ <di:waypoint x="610" y="760" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0xdbw5d_di" bpmnElement="Task_1spbb2x">
+ <dc:Bounds x="610" y="720" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05yfw7t_di" bpmnElement="SequenceFlow_05yfw7t">
+ <di:waypoint x="710" y="760" />
+ <di:waypoint x="770" y="760" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0hmczex_di" bpmnElement="Task_0yqtfvh">
+ <dc:Bounds x="770" y="720" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0c0btia_di" bpmnElement="SequenceFlow_0c0btia">
+ <di:waypoint x="870" y="760" />
+ <di:waypoint x="930" y="760" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0ra7dbt_di" bpmnElement="Task_1s3l3fc">
+ <dc:Bounds x="930" y="720" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1fsful5_di" bpmnElement="EndEvent_1fsful5">
+ <dc:Bounds x="1092" y="742" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1w55zo7_di" bpmnElement="SequenceFlow_1w55zo7">
+ <di:waypoint x="1030" y="760" />
+ <di:waypoint x="1092" y="760" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1tcgzv0_di" bpmnElement="SequenceFlow_1tcgzv0">
+ <di:waypoint x="188" y="350" />
+ <di:waypoint x="235" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="SubProcess_0dwywjh_di" bpmnElement="SubProcess_1l7gd5k" isExpanded="true">
+ <dc:Bounds x="660" y="950" width="350" height="200" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_18u3hph_di" bpmnElement="StartEvent_0zc2hnn">
+ <dc:Bounds x="700" y="1032" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0mifi3x_di" bpmnElement="SequenceFlow_0mifi3x">
+ <di:waypoint x="736" y="1050" />
+ <di:waypoint x="790" y="1050" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_052gdjz_di" bpmnElement="EndEvent_052gdjz">
+ <dc:Bounds x="952" y="1032" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_073yxs4_di" bpmnElement="SequenceFlow_073yxs4">
+ <di:waypoint x="890" y="1050" />
+ <di:waypoint x="952" y="1050" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0lzly9f_di" bpmnElement="Task_01va9ms">
+ <dc:Bounds x="790" y="1010" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1lyw619_di" bpmnElement="ExclusiveGateway_1lyw619" isMarkerVisible="true">
+ <dc:Bounds x="785" y="325" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="786.5" y="384.5" width="47" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0s7s7zk_di" bpmnElement="SequenceFlow_0s7s7zk">
+ <di:waypoint x="835" y="350" />
+ <di:waypoint x="900" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_00g94pg_di" bpmnElement="SequenceFlow_00g94pg">
+ <di:waypoint x="1160" y="350" />
+ <di:waypoint x="1250" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0bqfbxf_di" bpmnElement="SequenceFlow_0bqfbxf">
+ <di:waypoint x="810" y="325" />
+ <di:waypoint x="810" y="250" />
+ <di:waypoint x="900" y="250" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="846" y="232" width="17" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_16tdrty_di" bpmnElement="ExclusiveGateway_16tdrty" isMarkerVisible="true">
+ <dc:Bounds x="235" y="325" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="226" y="295" width="77" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0jrbkau_di" bpmnElement="SequenceFlow_0jrbkau">
+ <di:waypoint x="285" y="350" />
+ <di:waypoint x="330" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_16ewagx_di" bpmnElement="SequenceFlow_16ewagx">
+ <di:waypoint x="260" y="375" />
+ <di:waypoint x="260" y="500" />
+ <di:waypoint x="1300" y="500" />
+ <di:waypoint x="1300" y="390" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="774" y="482" width="13" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0icj4go_di" bpmnElement="ExclusiveGateway_0icj4go" isMarkerVisible="true">
+ <dc:Bounds x="1085" y="95" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1069" y="50" width="82" height="40" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1j0e2po_di" bpmnElement="SequenceFlow_1j0e2po">
+ <di:waypoint x="1010" y="120" />
+ <di:waypoint x="1085" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_12xn3kz_di" bpmnElement="SequenceFlow_12xn3kz">
+ <di:waypoint x="1135" y="120" />
+ <di:waypoint x="1220" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0xipbpr_di" bpmnElement="SequenceFlow_0xipbpr">
+ <di:waypoint x="1110" y="145" />
+ <di:waypoint x="1110" y="190" />
+ <di:waypoint x="810" y="190" />
+ <di:waypoint x="810" y="325" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="946" y="172" width="13" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_1knnc2k_di" bpmnElement="Task_1ff6flk">
+ <dc:Bounds x="630" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1r84j75_di" bpmnElement="Task_1ovewjr">
+ <dc:Bounds x="900" y="210" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1amyd7h_di" bpmnElement="SequenceFlow_1amyd7h">
+ <di:waypoint x="1000" y="250" />
+ <di:waypoint x="1300" y="250" />
+ <di:waypoint x="1300" y="310" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1sah9so_di" bpmnElement="SequenceFlow_1sah9so">
+ <di:waypoint x="730" y="350" />
+ <di:waypoint x="785" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ssiyug_di" bpmnElement="SequenceFlow_1ssiyug">
+ <di:waypoint x="430" y="350" />
+ <di:waypoint x="480" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0thr8dc_di" bpmnElement="SequenceFlow_0thr8dc">
+ <di:waypoint x="580" y="350" />
+ <di:waypoint x="630" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0r8ad9j_di" bpmnElement="Task_0y1n9ls">
+ <dc:Bounds x="480" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn
new file mode 100644
index 0000000000..6d9df5240d
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn
@@ -0,0 +1,332 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0prw6yo" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+ <bpmn:process id="DeleteSliceService" name="DeleteSliceService" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1" name="start">
+ <bpmn:outgoing>SequenceFlow_1ti9sxe</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0xmiev9" sourceRef="Task_1f3k0gq" targetRef="Task_0gsr9fu" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ti9sxe" sourceRef="StartEvent_1" targetRef="Task_1f3k0gq" />
+ <bpmn:scriptTask id="Task_1f3k0gq" name="PreProcess Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1ti9sxe</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0xmiev9</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dss= new DeleteSliceService()
+dss.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="Task_0gsr9fu" name="Init Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0xmiev9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0uehx9h</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0uehx9h" sourceRef="Task_0gsr9fu" targetRef="Task_0walqr6" />
+ <bpmn:scriptTask id="Task_0walqr6" name="Send Async Ack Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0uehx9h</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_16lh6o6</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dss= new DeleteSliceService()
+dss.sendAsyncResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_16lh6o6" sourceRef="Task_0walqr6" targetRef="Task_04n2tl9" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1mcgr3m" name="success?">
+ <bpmn:incoming>SequenceFlow_0nl4kfh</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0wel7ie</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0eqx2y2</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0nl4kfh" sourceRef="Task_04n2tl9" targetRef="ExclusiveGateway_1mcgr3m" />
+ <bpmn:sequenceFlow id="SequenceFlow_0wel7ie" name="yes" sourceRef="ExclusiveGateway_1mcgr3m" targetRef="Task_01siwzc">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0eqx2y2" name="no" sourceRef="ExclusiveGateway_1mcgr3m" targetRef="EndEvent_02ix4tc" />
+ <bpmn:endEvent id="EndEvent_02ix4tc">
+ <bpmn:incoming>SequenceFlow_0eqx2y2</bpmn:incoming>
+ <bpmn:errorEventDefinition errorRef="Error_1jz8wj7" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_18oizb2" sourceRef="Task_0k1pi3g" targetRef="Task_1vklzip" />
+ <bpmn:scriptTask id="Task_0k1pi3g" name="Delete slice service From AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0wel7ie</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_18oizb2</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dss= new DeleteSliceService()
+dss.deleteSliceServiceInstance(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="Task_1vklzip" name="Update Service Operation Status to Success">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">${UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth", execution)}</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_18oizb2</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1oxmm7d</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:endEvent id="EndEvent_0tyqdpw" name="End">
+ <bpmn:incoming>SequenceFlow_1oxmm7d</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1oxmm7d" sourceRef="Task_1vklzip" targetRef="EndEvent_0tyqdpw" />
+ <bpmn:callActivity id="Task_04n2tl9" name="Do Delete SliceServiceV1" calledElement="DoDeleteSliceServiceV1">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="serviceType" target="serviceType" />
+ <camunda:in source="operationId" target="operationId" />
+ <camunda:in source="operationType" target="operationType" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_16lh6o6</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0nl4kfh</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="Task_01siwzc" name="Delete Service Profile From AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0wel7ie</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_142j1q2</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dss= new DeleteSliceService()
+dss.delServiceProfileFromAAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_142j1q2" sourceRef="Task_01siwzc" targetRef="Task_0k1pi3g" />
+ <bpmn:subProcess id="SubProcess_07kf25g" name="Java Exception Handling Sub Process" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_1qskwib">
+ <bpmn:outgoing>SequenceFlow_0x8msq9</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1mmlos4" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_086jahv">
+ <bpmn:incoming>SequenceFlow_10lwgo7</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0x8msq9" sourceRef="StartEvent_1qskwib" targetRef="ScriptTask_19sjlk2" />
+ <bpmn:scriptTask id="ScriptTask_19sjlk2" name="Send Error Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0x8msq9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ihiv5k</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dss = new DeleteCustomE2EServiceInstance()
+dss.sendSyncError(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1ihiv5k" sourceRef="ScriptTask_19sjlk2" targetRef="Task_1fxg7am" />
+ <bpmn:sequenceFlow id="SequenceFlow_0zvzs12" sourceRef="Task_1fxg7am" targetRef="ServiceTask_17jq3cx" />
+ <bpmn:scriptTask id="Task_1fxg7am" name="Termination Service Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1ihiv5k</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0zvzs12</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dss = new DeleteSliceService()
+dss.prepareEndOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_17jq3cx" name="Update Service Operation Status To Terminate">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0zvzs12</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_10lwgo7</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_10lwgo7" sourceRef="ServiceTask_17jq3cx" targetRef="EndEvent_086jahv" />
+ </bpmn:subProcess>
+ <bpmn:subProcess id="SubProcess_0so7l00" name="Sub-process for UnexpectedErrors" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_1jknl5k">
+ <bpmn:outgoing>SequenceFlow_0rasmiu</bpmn:outgoing>
+ <bpmn:errorEventDefinition />
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0rasmiu" sourceRef="StartEvent_1jknl5k" targetRef="Task_0c422xd" />
+ <bpmn:endEvent id="EndEvent_1vr9nc9">
+ <bpmn:incoming>SequenceFlow_1jipldf</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1jipldf" sourceRef="Task_0c422xd" targetRef="EndEvent_1vr9nc9" />
+ <bpmn:scriptTask id="Task_0c422xd" name="Handle Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0rasmiu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1jipldf</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ </bpmn:subProcess>
+ </bpmn:process>
+ <bpmn:error id="Error_1jz8wj7" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteSliceService">
+ <bpmndi:BPMNEdge id="SequenceFlow_1ti9sxe_di" bpmnElement="SequenceFlow_1ti9sxe">
+ <di:waypoint x="188" y="117" />
+ <di:waypoint x="290" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0xmiev9_di" bpmnElement="SequenceFlow_0xmiev9">
+ <di:waypoint x="390" y="117" />
+ <di:waypoint x="480" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="152" y="99" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="159" y="142" width="23" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0aqhg4z_di" bpmnElement="Task_1f3k0gq">
+ <dc:Bounds x="290" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1n9ja9t_di" bpmnElement="Task_0gsr9fu">
+ <dc:Bounds x="480" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0uehx9h_di" bpmnElement="SequenceFlow_0uehx9h">
+ <di:waypoint x="580" y="117" />
+ <di:waypoint x="660" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_13qpvgg_di" bpmnElement="Task_0walqr6">
+ <dc:Bounds x="660" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_16lh6o6_di" bpmnElement="SequenceFlow_16lh6o6">
+ <di:waypoint x="760" y="117" />
+ <di:waypoint x="840" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1mcgr3m_di" bpmnElement="ExclusiveGateway_1mcgr3m" isMarkerVisible="true">
+ <dc:Bounds x="1025" y="92" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1026" y="73" width="47" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0nl4kfh_di" bpmnElement="SequenceFlow_0nl4kfh">
+ <di:waypoint x="940" y="117" />
+ <di:waypoint x="1025" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0wel7ie_di" bpmnElement="SequenceFlow_0wel7ie">
+ <di:waypoint x="1075" y="117" />
+ <di:waypoint x="1164" y="117" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1100" y="98" width="17" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0eqx2y2_di" bpmnElement="SequenceFlow_0eqx2y2">
+ <di:waypoint x="1050" y="142" />
+ <di:waypoint x="1050" y="202" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1059" y="169" width="13" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_169jlln_di" bpmnElement="EndEvent_02ix4tc">
+ <dc:Bounds x="1032" y="202" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_18oizb2_di" bpmnElement="SequenceFlow_18oizb2">
+ <di:waypoint x="1440" y="117" />
+ <di:waypoint x="1530" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_10g3cz7_di" bpmnElement="Task_0k1pi3g">
+ <dc:Bounds x="1340" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0pct2ne_di" bpmnElement="Task_1vklzip">
+ <dc:Bounds x="1530" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0tyqdpw_di" bpmnElement="EndEvent_0tyqdpw">
+ <dc:Bounds x="1562" y="202" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1570" y="245" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1oxmm7d_di" bpmnElement="SequenceFlow_1oxmm7d">
+ <di:waypoint x="1580" y="157" />
+ <di:waypoint x="1580" y="202" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_1igxzig_di" bpmnElement="Task_04n2tl9">
+ <dc:Bounds x="840" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0qqsp7x_di" bpmnElement="Task_01siwzc">
+ <dc:Bounds x="1164" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_142j1q2_di" bpmnElement="SequenceFlow_142j1q2">
+ <di:waypoint x="1264" y="117" />
+ <di:waypoint x="1340" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="SubProcess_07kf25g_di" bpmnElement="SubProcess_07kf25g" isExpanded="true">
+ <dc:Bounds x="340" y="430" width="637" height="162" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_1qskwib_di" bpmnElement="StartEvent_1qskwib">
+ <dc:Bounds x="377" y="497" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_086jahv_di" bpmnElement="EndEvent_086jahv">
+ <dc:Bounds x="902" y="497" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0x8msq9_di" bpmnElement="SequenceFlow_0x8msq9">
+ <di:waypoint x="413" y="515" />
+ <di:waypoint x="456" y="515" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_19sjlk2_di" bpmnElement="ScriptTask_19sjlk2">
+ <dc:Bounds x="456" y="475" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ihiv5k_di" bpmnElement="SequenceFlow_1ihiv5k">
+ <di:waypoint x="556" y="515" />
+ <di:waypoint x="615" y="515" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0zvzs12_di" bpmnElement="SequenceFlow_0zvzs12">
+ <di:waypoint x="715" y="515" />
+ <di:waypoint x="765" y="515" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0bjcnd3_di" bpmnElement="Task_1fxg7am">
+ <dc:Bounds x="615" y="475" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_17jq3cx_di" bpmnElement="ServiceTask_17jq3cx">
+ <dc:Bounds x="765" y="475" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_10lwgo7_di" bpmnElement="SequenceFlow_10lwgo7">
+ <di:waypoint x="865" y="515" />
+ <di:waypoint x="902" y="515" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="SubProcess_1dd77tu_di" bpmnElement="SubProcess_0so7l00" isExpanded="true">
+ <dc:Bounds x="470" y="650" width="350" height="200" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_14mwxm0_di" bpmnElement="StartEvent_1jknl5k">
+ <dc:Bounds x="510" y="732" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0rasmiu_di" bpmnElement="SequenceFlow_0rasmiu">
+ <di:waypoint x="546" y="750" />
+ <di:waypoint x="600" y="750" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_1vr9nc9_di" bpmnElement="EndEvent_1vr9nc9">
+ <dc:Bounds x="762" y="732" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1jipldf_di" bpmnElement="SequenceFlow_1jipldf">
+ <di:waypoint x="700" y="750" />
+ <di:waypoint x="762" y="750" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0vb5d51_di" bpmnElement="Task_0c422xd">
+ <dc:Bounds x="600" y="710" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn
new file mode 100644
index 0000000000..24ca7104a7
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSWUPDownload.bpmn
@@ -0,0 +1,202 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0474hns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.3.4">
+ <bpmn:process id="PNFSWUPDownload" name="PNFSWUPDownload" isExecutable="true">
+ <bpmn:startEvent id="download_StartEvent" name="Start Flow">
+ <bpmn:outgoing>SequenceFlow_1fdclh0</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:serviceTask id="ServiceTask_1mpt2eq" name="NF Download Dispatcher" camunda:delegateExpression="${NfSoftwareUpgradeDispatcher}">
+ <bpmn:incoming>SequenceFlow_1fdclh0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_12155q6</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:endEvent id="download_EndEvent" name="End">
+ <bpmn:incoming>SequenceFlow_1d2rfyx</bpmn:incoming>
+ <bpmn:terminateEventDefinition id="TerminateEventDefinition_1kiurmf" />
+ </bpmn:endEvent>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1ja7grm" default="SequenceFlow_078xmlz">
+ <bpmn:incoming>SequenceFlow_0o6b6a8</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_078xmlz</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0qznt4u</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:endEvent id="EndEvent_1j64ij1">
+ <bpmn:incoming>SequenceFlow_078xmlz</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_0b3kbjs" errorRef="Error_1q14dnd" />
+ </bpmn:endEvent>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1rj84ne" default="SequenceFlow_1tfbzn1">
+ <bpmn:incoming>SequenceFlow_1ccldpp</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0s6i4o9</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1tfbzn1</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:endEvent id="EndEvent_1ubpef4">
+ <bpmn:incoming>SequenceFlow_1tfbzn1</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_0wevx6s" errorRef="Error_1q14dnd" />
+ </bpmn:endEvent>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_08lusga" default="SequenceFlow_1gawssm">
+ <bpmn:incoming>SequenceFlow_1kaikh5</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1d2rfyx</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1gawssm</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:endEvent id="EndEvent_11hee4g">
+ <bpmn:incoming>SequenceFlow_1gawssm</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_12tyzwb" errorRef="Error_1q14dnd" />
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="ServiceTask_0yavde3" name="Download" camunda:delegateExpression="${ControllerExecutionDE}">
+ <bpmn:extensionElements>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="action">downloadNESw</camunda:inputParameter>
+ <camunda:inputParameter name="scope">pnf</camunda:inputParameter>
+ <camunda:inputParameter name="mode">async</camunda:inputParameter>
+ </camunda:inputOutput>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0s6i4o9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0o6b6a8</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="ServiceTask_1wxo7xz" name="Post check" camunda:delegateExpression="${ControllerExecutionDE}">
+ <bpmn:extensionElements>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="action">postCheck</camunda:inputParameter>
+ <camunda:inputParameter name="scope">pnf</camunda:inputParameter>
+ <camunda:inputParameter name="mode">async</camunda:inputParameter>
+ </camunda:inputOutput>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0qznt4u</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1kaikh5</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="ServiceTask_1nl90ao" name="Pre check" camunda:delegateExpression="${ControllerExecutionDE}">
+ <bpmn:extensionElements>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="action">preCheck</camunda:inputParameter>
+ <camunda:inputParameter name="scope">pnf</camunda:inputParameter>
+ <camunda:inputParameter name="mode">async</camunda:inputParameter>
+ </camunda:inputOutput>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_12155q6</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ccldpp</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1fdclh0" sourceRef="download_StartEvent" targetRef="ServiceTask_1mpt2eq" />
+ <bpmn:sequenceFlow id="SequenceFlow_12155q6" sourceRef="ServiceTask_1mpt2eq" targetRef="ServiceTask_1nl90ao" />
+ <bpmn:sequenceFlow id="SequenceFlow_1d2rfyx" name="Success" sourceRef="ExclusiveGateway_08lusga" targetRef="download_EndEvent">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0o6b6a8" sourceRef="ServiceTask_0yavde3" targetRef="ExclusiveGateway_1ja7grm" />
+ <bpmn:sequenceFlow id="SequenceFlow_078xmlz" name="Failure" sourceRef="ExclusiveGateway_1ja7grm" targetRef="EndEvent_1j64ij1" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ccldpp" sourceRef="ServiceTask_1nl90ao" targetRef="ExclusiveGateway_1rj84ne" />
+ <bpmn:sequenceFlow id="SequenceFlow_0s6i4o9" name="Success" sourceRef="ExclusiveGateway_1rj84ne" targetRef="ServiceTask_0yavde3">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1tfbzn1" name="Failure" sourceRef="ExclusiveGateway_1rj84ne" targetRef="EndEvent_1ubpef4" />
+ <bpmn:sequenceFlow id="SequenceFlow_1kaikh5" sourceRef="ServiceTask_1wxo7xz" targetRef="ExclusiveGateway_08lusga" />
+ <bpmn:sequenceFlow id="SequenceFlow_1gawssm" name="Failure" sourceRef="ExclusiveGateway_08lusga" targetRef="EndEvent_11hee4g" />
+ <bpmn:sequenceFlow id="SequenceFlow_0qznt4u" name="Success" sourceRef="ExclusiveGateway_1ja7grm" targetRef="ServiceTask_1wxo7xz">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ </bpmn:process>
+ <bpmn:error id="Error_1q14dnd" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="PNFSWUPDownload">
+ <bpmndi:BPMNShape id="StartEvent_1k8gssq_di" bpmnElement="download_StartEvent">
+ <dc:Bounds x="162" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="157" y="145" width="50" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1mpt2eq_di" bpmnElement="ServiceTask_1mpt2eq">
+ <dc:Bounds x="280" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1e4dq7w_di" bpmnElement="download_EndEvent">
+ <dc:Bounds x="1312" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1321" y="145" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1ja7grm_di" bpmnElement="ExclusiveGateway_1ja7grm" isMarkerVisible="true">
+ <dc:Bounds x="895" y="95" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1j64ij1_di" bpmnElement="EndEvent_1j64ij1">
+ <dc:Bounds x="902" y="252" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1rj84ne_di" bpmnElement="ExclusiveGateway_1rj84ne" isMarkerVisible="true">
+ <dc:Bounds x="635" y="95" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1ubpef4_di" bpmnElement="EndEvent_1ubpef4">
+ <dc:Bounds x="642" y="252" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_08lusga_di" bpmnElement="ExclusiveGateway_08lusga" isMarkerVisible="true">
+ <dc:Bounds x="1155" y="95" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_11hee4g_di" bpmnElement="EndEvent_11hee4g">
+ <dc:Bounds x="1162" y="252" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0yavde3_di" bpmnElement="ServiceTask_0yavde3">
+ <dc:Bounds x="760" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1wxo7xz_di" bpmnElement="ServiceTask_1wxo7xz">
+ <dc:Bounds x="1000" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1nl90ao_di" bpmnElement="ServiceTask_1nl90ao">
+ <dc:Bounds x="480" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1fdclh0_di" bpmnElement="SequenceFlow_1fdclh0">
+ <di:waypoint x="198" y="120" />
+ <di:waypoint x="280" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_12155q6_di" bpmnElement="SequenceFlow_12155q6">
+ <di:waypoint x="380" y="120" />
+ <di:waypoint x="480" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1d2rfyx_di" bpmnElement="SequenceFlow_1d2rfyx">
+ <di:waypoint x="1205" y="120" />
+ <di:waypoint x="1312" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1214" y="102" width="43" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0o6b6a8_di" bpmnElement="SequenceFlow_0o6b6a8">
+ <di:waypoint x="860" y="120" />
+ <di:waypoint x="895" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_078xmlz_di" bpmnElement="SequenceFlow_078xmlz">
+ <di:waypoint x="920" y="145" />
+ <di:waypoint x="920" y="252" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="918" y="217" width="34" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ccldpp_di" bpmnElement="SequenceFlow_1ccldpp">
+ <di:waypoint x="580" y="120" />
+ <di:waypoint x="635" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0s6i4o9_di" bpmnElement="SequenceFlow_0s6i4o9">
+ <di:waypoint x="685" y="120" />
+ <di:waypoint x="760" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="678" y="102" width="43" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1tfbzn1_di" bpmnElement="SequenceFlow_1tfbzn1">
+ <di:waypoint x="660" y="145" />
+ <di:waypoint x="660" y="252" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="658" y="217" width="34" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1kaikh5_di" bpmnElement="SequenceFlow_1kaikh5">
+ <di:waypoint x="1100" y="120" />
+ <di:waypoint x="1155" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1gawssm_di" bpmnElement="SequenceFlow_1gawssm">
+ <di:waypoint x="1180" y="145" />
+ <di:waypoint x="1180" y="252" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1178" y="172" width="34" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0qznt4u_di" bpmnElement="SequenceFlow_0qznt4u">
+ <di:waypoint x="945" y="120" />
+ <di:waypoint x="1000" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="951" y="102" width="43" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn
new file mode 100644
index 0000000000..8d59dac8ac
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/PNFSoftwareUpgrade.bpmn
@@ -0,0 +1,273 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.3.4">
+ <bpmn:process id="PNFSoftwareUpgrade" name="PNFSoftwareUpgrade" isExecutable="true">
+ <bpmn:startEvent id="softwareUpgrade_startEvent" name="Start Flow">
+ <bpmn:outgoing>SequenceFlow_1ng4b6l</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:serviceTask id="ServiceTask_042uz7n" name="NF Upgrade Dispatcher" camunda:delegateExpression="${NfSoftwareUpgradeDispatcher}">
+ <bpmn:incoming>SequenceFlow_1ng4b6l</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_12ejx4m</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_12ejx4m" sourceRef="ServiceTask_042uz7n" targetRef="ServiceTask_0slpahe" />
+ <bpmn:endEvent id="softwareUpgrade_endEvent" name="End">
+ <bpmn:incoming>SequenceFlow_1atiydu</bpmn:incoming>
+ <bpmn:terminateEventDefinition />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1ng4b6l" sourceRef="softwareUpgrade_startEvent" targetRef="ServiceTask_042uz7n" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0v3l3wv" default="SequenceFlow_1lr7vgu">
+ <bpmn:incoming>SequenceFlow_0cchgih</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1lr7vgu</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1eljvek</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:endEvent id="EndEvent_0bnbfds">
+ <bpmn:incoming>SequenceFlow_1lr7vgu</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1sjbsm2" errorRef="Error_12cpov5" />
+ </bpmn:endEvent>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0x6h0ni" default="SequenceFlow_0piri91">
+ <bpmn:incoming>SequenceFlow_0j26xlx</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1nsmyr5</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0piri91</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1nsmyr5" name="Success" sourceRef="ExclusiveGateway_0x6h0ni" targetRef="ServiceTask_0x5cje8">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:endEvent id="EndEvent_180lm4y">
+ <bpmn:incoming>SequenceFlow_0piri91</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_0fm5he7" errorRef="Error_12cpov5" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0piri91" name="Failure" sourceRef="ExclusiveGateway_0x6h0ni" targetRef="EndEvent_180lm4y" />
+ <bpmn:sequenceFlow id="SequenceFlow_1lr7vgu" name="Failure" sourceRef="ExclusiveGateway_0v3l3wv" targetRef="EndEvent_0bnbfds" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0ch3fef" default="SequenceFlow_0dqnb6c">
+ <bpmn:incoming>SequenceFlow_015y785</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0dqnb6c</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0eiif6e</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:endEvent id="EndEvent_1ms4wdz">
+ <bpmn:incoming>SequenceFlow_0dqnb6c</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_15s8fgk" errorRef="Error_12cpov5" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0dqnb6c" name="Failure" sourceRef="ExclusiveGateway_0ch3fef" targetRef="EndEvent_1ms4wdz" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1ny9b1z" default="SequenceFlow_1p0axph">
+ <bpmn:incoming>SequenceFlow_0g3qcd0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1p0axph</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1atiydu</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:endEvent id="EndEvent_0l6n6x5">
+ <bpmn:incoming>SequenceFlow_1p0axph</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1l0gsy0" errorRef="Error_12cpov5" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1p0axph" name="Failure" sourceRef="ExclusiveGateway_1ny9b1z" targetRef="EndEvent_0l6n6x5" />
+ <bpmn:sequenceFlow id="SequenceFlow_1eljvek" name="Success" sourceRef="ExclusiveGateway_0v3l3wv" targetRef="ServiceTask_02lxf48">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1atiydu" name="Success" sourceRef="ExclusiveGateway_1ny9b1z" targetRef="softwareUpgrade_endEvent">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0eiif6e" name="Success" sourceRef="ExclusiveGateway_0ch3fef" targetRef="ServiceTask_1jo8vn7">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:serviceTask id="ServiceTask_0x5cje8" name="Download" camunda:delegateExpression="${ControllerExecutionDE}">
+ <bpmn:extensionElements>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="action">downloadNESw</camunda:inputParameter>
+ <camunda:inputParameter name="scope">pnf</camunda:inputParameter>
+ <camunda:inputParameter name="mode">async</camunda:inputParameter>
+ </camunda:inputOutput>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1nsmyr5</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cchgih</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0cchgih" sourceRef="ServiceTask_0x5cje8" targetRef="ExclusiveGateway_0v3l3wv" />
+ <bpmn:serviceTask id="ServiceTask_02lxf48" name="Activate" camunda:delegateExpression="${ControllerExecutionDE}">
+ <bpmn:extensionElements>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="action">activateNESw</camunda:inputParameter>
+ <camunda:inputParameter name="scope">pnf</camunda:inputParameter>
+ <camunda:inputParameter name="mode">async</camunda:inputParameter>
+ </camunda:inputOutput>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1eljvek</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_015y785</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_015y785" sourceRef="ServiceTask_02lxf48" targetRef="ExclusiveGateway_0ch3fef" />
+ <bpmn:serviceTask id="ServiceTask_0y2uysu" name="Post check" camunda:delegateExpression="${ControllerExecutionDE}">
+ <bpmn:extensionElements>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="action">postCheck</camunda:inputParameter>
+ <camunda:inputParameter name="scope">pnf</camunda:inputParameter>
+ <camunda:inputParameter name="mode">async</camunda:inputParameter>
+ </camunda:inputOutput>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_084orr1</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0g3qcd0</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0g3qcd0" sourceRef="ServiceTask_0y2uysu" targetRef="ExclusiveGateway_1ny9b1z" />
+ <bpmn:serviceTask id="ServiceTask_0slpahe" name="Pre check" camunda:delegateExpression="${ControllerExecutionDE}">
+ <bpmn:extensionElements>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="action">preCheck</camunda:inputParameter>
+ <camunda:inputParameter name="scope">pnf</camunda:inputParameter>
+ <camunda:inputParameter name="mode">async</camunda:inputParameter>
+ </camunda:inputOutput>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_12ejx4m</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0j26xlx</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0j26xlx" sourceRef="ServiceTask_0slpahe" targetRef="ExclusiveGateway_0x6h0ni" />
+ <bpmn:serviceTask id="ServiceTask_1jo8vn7" name="Update Pnf in AAI" camunda:delegateExpression="${UpdatePnfEntryInAai}">
+ <bpmn:incoming>SequenceFlow_0eiif6e</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_084orr1</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_084orr1" sourceRef="ServiceTask_1jo8vn7" targetRef="ServiceTask_0y2uysu" />
+ </bpmn:process>
+ <bpmn:error id="Error_12cpov5" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmn:error id="Error_0nmskzh" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="PNFSoftwareUpgrade">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="softwareUpgrade_startEvent">
+ <dc:Bounds x="162" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="157" y="145" width="50" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_042uz7n_di" bpmnElement="ServiceTask_042uz7n">
+ <dc:Bounds x="280" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_12ejx4m_di" bpmnElement="SequenceFlow_12ejx4m">
+ <di:waypoint x="380" y="120" />
+ <di:waypoint x="480" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_1w3jv30_di" bpmnElement="softwareUpgrade_endEvent">
+ <dc:Bounds x="1662" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1671" y="145" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ng4b6l_di" bpmnElement="SequenceFlow_1ng4b6l">
+ <di:waypoint x="198" y="120" />
+ <di:waypoint x="280" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0v3l3wv_di" bpmnElement="ExclusiveGateway_0v3l3wv" isMarkerVisible="true">
+ <dc:Bounds x="895" y="95" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1040" y="65" width="43" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0bnbfds_di" bpmnElement="EndEvent_0bnbfds">
+ <dc:Bounds x="902" y="252" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1044" y="295" width="34" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0x6h0ni_di" bpmnElement="ExclusiveGateway_0x6h0ni" isMarkerVisible="true">
+ <dc:Bounds x="635" y="95" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1nsmyr5_di" bpmnElement="SequenceFlow_1nsmyr5">
+ <di:waypoint x="685" y="120" />
+ <di:waypoint x="760" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="678" y="102" width="43" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_180lm4y_di" bpmnElement="EndEvent_180lm4y">
+ <dc:Bounds x="642" y="252" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0piri91_di" bpmnElement="SequenceFlow_0piri91">
+ <di:waypoint x="660" y="145" />
+ <di:waypoint x="660" y="252" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="658" y="217" width="34" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1lr7vgu_di" bpmnElement="SequenceFlow_1lr7vgu">
+ <di:waypoint x="920" y="145" />
+ <di:waypoint x="920" y="252" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="918" y="217" width="34" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0ch3fef_di" bpmnElement="ExclusiveGateway_0ch3fef" isMarkerVisible="true">
+ <dc:Bounds x="1125" y="95" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1ms4wdz_di" bpmnElement="EndEvent_1ms4wdz">
+ <dc:Bounds x="1132" y="252" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0dqnb6c_di" bpmnElement="SequenceFlow_0dqnb6c">
+ <di:waypoint x="1150" y="145" />
+ <di:waypoint x="1150" y="252" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1148" y="230" width="34" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1ny9b1z_di" bpmnElement="ExclusiveGateway_1ny9b1z" isMarkerVisible="true">
+ <dc:Bounds x="1505" y="95" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0l6n6x5_di" bpmnElement="EndEvent_0l6n6x5">
+ <dc:Bounds x="1512" y="252" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1p0axph_di" bpmnElement="SequenceFlow_1p0axph">
+ <di:waypoint x="1530" y="145" />
+ <di:waypoint x="1530" y="252" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1528" y="172" width="34" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1eljvek_di" bpmnElement="SequenceFlow_1eljvek">
+ <di:waypoint x="945" y="120" />
+ <di:waypoint x="1010" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="938" y="102" width="43" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1atiydu_di" bpmnElement="SequenceFlow_1atiydu">
+ <di:waypoint x="1555" y="120" />
+ <di:waypoint x="1662" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1564" y="102" width="43" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0eiif6e_di" bpmnElement="SequenceFlow_0eiif6e">
+ <di:waypoint x="1175" y="120" />
+ <di:waypoint x="1210" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1169" y="102" width="43" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0x5cje8_di" bpmnElement="ServiceTask_0x5cje8">
+ <dc:Bounds x="760" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cchgih_di" bpmnElement="SequenceFlow_0cchgih">
+ <di:waypoint x="860" y="120" />
+ <di:waypoint x="895" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_02lxf48_di" bpmnElement="ServiceTask_02lxf48">
+ <dc:Bounds x="1010" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_015y785_di" bpmnElement="SequenceFlow_015y785">
+ <di:waypoint x="1110" y="120" />
+ <di:waypoint x="1125" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0y2uysu_di" bpmnElement="ServiceTask_0y2uysu">
+ <dc:Bounds x="1370" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0g3qcd0_di" bpmnElement="SequenceFlow_0g3qcd0">
+ <di:waypoint x="1470" y="120" />
+ <di:waypoint x="1505" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0slpahe_di" bpmnElement="ServiceTask_0slpahe">
+ <dc:Bounds x="480" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0j26xlx_di" bpmnElement="SequenceFlow_0j26xlx">
+ <di:waypoint x="580" y="120" />
+ <di:waypoint x="635" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1jo8vn7_di" bpmnElement="ServiceTask_1jo8vn7">
+ <dc:Bounds x="1210" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_084orr1_di" bpmnElement="SequenceFlow_084orr1">
+ <di:waypoint x="1310" y="120" />
+ <di:waypoint x="1370" y="120" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/CheckServiceProcessStatus.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/CheckServiceProcessStatus.bpmn
new file mode 100644
index 0000000000..279dd2a4ad
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/CheckServiceProcessStatus.bpmn
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0lf96js" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+ <bpmn:process id="CheckServiceProcessStatus" name="CheckServiceProcessStatus" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1" name="start check processing status">
+ <bpmn:outgoing>SequenceFlow_1g4lx01</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="ScriptTask_1mlave2" name="Prepare service Check Process status Req&#10;" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0e29y0f</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1n5nl53</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0r1x26k</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CheckServiceProcessStatus()
+csi.preCheckServiceStatusReq(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_0w5fmqn" name="get service Operation Status&#10;">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${getOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0r1x26k</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_009p8v1</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:scriptTask id="ScriptTask_0z37e29" name="handler service status Response&#10;" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_009p8v1</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0yws8fh</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CheckServiceProcessStatus()
+csi.handlerServiceStatusResp(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0gk7p3l" name="Is service process finished?&#10;" default="SequenceFlow_01o92x6">
+ <bpmn:incoming>SequenceFlow_0yws8fh</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_18jgpa8</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_01o92x6</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:scriptTask id="ScriptTask_1ao91w3" name="Time Delay" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1pxnqsp</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1ktr440</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0e29y0f</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CheckServiceProcessStatus()
+csi.timeWaitDelay(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0e29y0f" sourceRef="ScriptTask_1ao91w3" targetRef="ScriptTask_1mlave2" />
+ <bpmn:sequenceFlow id="SequenceFlow_0r1x26k" sourceRef="ScriptTask_1mlave2" targetRef="ServiceTask_0w5fmqn" />
+ <bpmn:sequenceFlow id="SequenceFlow_009p8v1" sourceRef="ServiceTask_0w5fmqn" targetRef="ScriptTask_0z37e29" />
+ <bpmn:sequenceFlow id="SequenceFlow_0yws8fh" sourceRef="ScriptTask_0z37e29" targetRef="ExclusiveGateway_0gk7p3l" />
+ <bpmn:sequenceFlow id="SequenceFlow_18jgpa8" name="yes" sourceRef="ExclusiveGateway_0gk7p3l" targetRef="EndEvent_0a3w3xw">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAllFinished") == "true") || (execution.getVariable("isTimeOut") == "YES")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:endEvent id="EndEvent_0a3w3xw">
+ <bpmn:incoming>SequenceFlow_18jgpa8</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1g4lx01" sourceRef="StartEvent_1" targetRef="Task_1djj44q" />
+ <bpmn:sequenceFlow id="SequenceFlow_1n5nl53" sourceRef="Task_1djj44q" targetRef="ScriptTask_1mlave2" />
+ <bpmn:scriptTask id="Task_1djj44q" name="Prepare request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1g4lx01</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1n5nl53</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CheckServiceProcessStatus()
+csi.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_0oic8cv" name="prepare Update Service Operation progress" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0591ght</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1q8dls4</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CheckServiceProcessStatus()
+csi.preUpdateOperationProgress(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1q8dls4" sourceRef="ScriptTask_0oic8cv" targetRef="ServiceTask_1b60rre" />
+ <bpmn:serviceTask id="ServiceTask_1b60rre" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1q8dls4</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1pxnqsp</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1pxnqsp" sourceRef="ServiceTask_1b60rre" targetRef="ScriptTask_1ao91w3" />
+ <bpmn:sequenceFlow id="SequenceFlow_01o92x6" sourceRef="ExclusiveGateway_0gk7p3l" targetRef="ExclusiveGateway_1pdfjh4" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1pdfjh4" name="isNeedUpdateDB?&#10;" default="SequenceFlow_1ktr440">
+ <bpmn:incoming>SequenceFlow_01o92x6</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0591ght</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1ktr440</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0591ght" name="yes" sourceRef="ExclusiveGateway_1pdfjh4" targetRef="ScriptTask_0oic8cv">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNeedUpdateDB" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1ktr440" name="no" sourceRef="ExclusiveGateway_1pdfjh4" targetRef="ScriptTask_1ao91w3" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CheckServiceProcessStatus">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="179" y="159" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="156" y="202" width="87" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1mlave2_di" bpmnElement="ScriptTask_1mlave2">
+ <dc:Bounds x="460" y="137" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0w5fmqn_di" bpmnElement="ServiceTask_0w5fmqn">
+ <dc:Bounds x="610" y="137" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0z37e29_di" bpmnElement="ScriptTask_0z37e29">
+ <dc:Bounds x="770" y="137" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0gk7p3l_di" bpmnElement="ExclusiveGateway_0gk7p3l" isMarkerVisible="true">
+ <dc:Bounds x="955" y="152" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="944" y="122" width="89" height="40" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1ao91w3_di" bpmnElement="ScriptTask_1ao91w3">
+ <dc:Bounds x="460" y="290" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0e29y0f_di" bpmnElement="SequenceFlow_0e29y0f">
+ <di:waypoint x="510" y="290" />
+ <di:waypoint x="510" y="217" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0r1x26k_di" bpmnElement="SequenceFlow_0r1x26k">
+ <di:waypoint x="560" y="177" />
+ <di:waypoint x="610" y="177" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_009p8v1_di" bpmnElement="SequenceFlow_009p8v1">
+ <di:waypoint x="710" y="177" />
+ <di:waypoint x="770" y="177" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0yws8fh_di" bpmnElement="SequenceFlow_0yws8fh">
+ <di:waypoint x="870" y="177" />
+ <di:waypoint x="955" y="177" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_18jgpa8_di" bpmnElement="SequenceFlow_18jgpa8">
+ <di:waypoint x="1005" y="177" />
+ <di:waypoint x="1132" y="177" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1024" y="159" width="17" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0a3w3xw_di" bpmnElement="EndEvent_0a3w3xw">
+ <dc:Bounds x="1132" y="159" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1g4lx01_di" bpmnElement="SequenceFlow_1g4lx01">
+ <di:waypoint x="215" y="177" />
+ <di:waypoint x="270" y="177" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1n5nl53_di" bpmnElement="SequenceFlow_1n5nl53">
+ <di:waypoint x="370" y="177" />
+ <di:waypoint x="460" y="177" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1di7x3h_di" bpmnElement="Task_1djj44q">
+ <dc:Bounds x="270" y="137" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0oic8cv_di" bpmnElement="ScriptTask_0oic8cv">
+ <dc:Bounds x="930" y="430" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1q8dls4_di" bpmnElement="SequenceFlow_1q8dls4">
+ <di:waypoint x="930" y="470" />
+ <di:waypoint x="780" y="470" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1b60rre_di" bpmnElement="ServiceTask_1b60rre">
+ <dc:Bounds x="680" y="430" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1pxnqsp_di" bpmnElement="SequenceFlow_1pxnqsp">
+ <di:waypoint x="680" y="470" />
+ <di:waypoint x="510" y="470" />
+ <di:waypoint x="510" y="370" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_01o92x6_di" bpmnElement="SequenceFlow_01o92x6">
+ <di:waypoint x="980" y="202" />
+ <di:waypoint x="980" y="305" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="964" y="243" width="13" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1pdfjh4_di" bpmnElement="ExclusiveGateway_1pdfjh4" isMarkerVisible="true">
+ <dc:Bounds x="955" y="305" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1007" y="310" width="86" height="40" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0591ght_di" bpmnElement="SequenceFlow_0591ght">
+ <di:waypoint x="980" y="355" />
+ <di:waypoint x="980" y="430" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="987" y="390" width="17" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ktr440_di" bpmnElement="SequenceFlow_1ktr440">
+ <di:waypoint x="955" y="330" />
+ <di:waypoint x="560" y="330" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="751" y="312" width="13" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn
new file mode 100644
index 0000000000..9c090e0594
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn
@@ -0,0 +1,361 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3">
+ <bpmn:process id="DoAllocateNSIandNSSI" name="DoAllocateNSIandNSSI" isExecutable="true">
+ <bpmn:scriptTask id="Task_09nzhwk" name="Generate NSI and create NSI in AAI with E2ESS and NSI relationship" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1e40h52</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createNSIinAAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0b9d9l0" name="Is nsi option available?" default="SequenceFlow_1h5bw41">
+ <bpmn:incoming>SequenceFlow_0dj0jvq</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1h5bw41</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0ueeeca</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:scriptTask id="ScriptTask_1ehyrsg" name="Update AAI relationship for E2ESS and NSI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0ueeeca</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0xfhbqw</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoAllocateNSIandNSSI()
+dcsi.updateRelationship(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_1s23hty" name="Call Decompose Service" calledElement="DecomposeService">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1h5bw41</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1e40h52</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="ScriptTask_1q3ftu4" name="Prepare NSSI model info and instance id" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0xfhbqw</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0uhaps2</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoAllocateNSIandNSSI()
+dcsi.prepareNssiModelInfo(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:startEvent id="allocateslice_StartEvent" name="allocatensi_StartEvent">
+ <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoAllocateNSIandNSSI()
+dcso.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_0o93dvp" name="read NSI options from request DB" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0dj0jvq</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dansi = new DoAllocateNSIandNSSI()
+dansi.retriveSliceOption(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_1k1oonn" name="Call Decompose Service" calledElement="DecomposeService">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1dhpkhd</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0hxky5e</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="ScriptTask_0gunols" name="Get one NSST Info" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1ui528w</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1dhpkhd</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.getOneNsstInfo(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_1lpgn98" name="prepare NSST Info" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0hxky5e</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_19jztxv</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnsio = new DoAllocateNSIandNSSI()
+dcnsio.createNSSTMap(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:endEvent id="EndEvent_1x6k78c">
+ <bpmn:incoming>SequenceFlow_0u8fycy</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="finishNSCreate_Task" name="Get a NSSI to process" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_16nvnxi</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cq2q6g</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoAllocateNSIandNSSI()
+dcsi.getOneNSSIInfo(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_07qkrrb" name="Is there more NSSI to process?" default="SequenceFlow_0u8fycy">
+ <bpmn:incoming>SequenceFlow_0g5bwvl</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1jaxstd</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_16nvnxi</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0u8fycy</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:callActivity id="CallActivity_130tuxn" name="Call DoAllocateNSSI" calledElement="DoAllocateNSSI">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="nsstInput" target="nsstInput" />
+ <camunda:in source="serviceProfile" target="serviceProfile" />
+ <camunda:in source="sliceProfileTn" target="sliceProfileTn" />
+ <camunda:in source="sliceProfileCn" target="sliceProfileCn" />
+ <camunda:in source="sliceProfileAn" target="sliceProfileAn" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+ <camunda:in source="uuiRequest" target="uuiRequest" />
+ <camunda:in source="nsiServiceInstanceId" target="nsiServiceInstanceId" />
+ <camunda:in source="nsiServiceInstanceName" target="nsiServiceInstanceName" />
+ <camunda:in source="nssiserviceModelInfo" target="nssiserviceModelInfo" />
+ <camunda:in source="sliceTaskParams" target="sliceTaskParams" />
+ <camunda:in source="taskId" target="CSSOT_taskId" />
+ <camunda:in source="taskName" target="CSSOT_name" />
+ <camunda:in source="taskStatus" target="CSSOT_status" />
+ <camunda:in source="isManual" target="CSSOT_isManual" />
+ <camunda:in source="isNSIOptionAvailable" target="isNSIOptionAvailable" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0cq2q6g</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_00b8ryw</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="ScriptTask_0anyn7v" name="Update current Index" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_00b8ryw</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1jaxstd</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoAllocateNSIandNSSI()
+dcsi.updateCurrentIndex(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="instantiate_NSTask" name="Prepare NSSI list (with and without shared NSSI)" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0uhaps2</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_04yx9ii</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0g5bwvl</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoAllocateNSIandNSSI()
+dcso.prepareNSSIList(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1jg3el3" name="Is NSST available?" default="SequenceFlow_04yx9ii">
+ <bpmn:incoming>SequenceFlow_19jztxv</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_04yx9ii</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1ui528w</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0uhaps2" sourceRef="ScriptTask_1q3ftu4" targetRef="instantiate_NSTask" />
+ <bpmn:sequenceFlow id="SequenceFlow_1e40h52" sourceRef="CallActivity_1s23hty" targetRef="Task_09nzhwk" />
+ <bpmn:sequenceFlow id="SequenceFlow_0xfhbqw" sourceRef="ScriptTask_1ehyrsg" targetRef="ScriptTask_1q3ftu4" />
+ <bpmn:sequenceFlow id="SequenceFlow_0dj0jvq" sourceRef="ScriptTask_0o93dvp" targetRef="ExclusiveGateway_0b9d9l0" />
+ <bpmn:sequenceFlow id="SequenceFlow_0ueeeca" name="Yes" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="ScriptTask_1ehyrsg">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSIOptionAvailable" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1h5bw41" name="No" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="CallActivity_1s23hty" />
+ <bpmn:sequenceFlow id="SequenceFlow_1uiz85h" sourceRef="Task_09nzhwk" targetRef="ScriptTask_0gunols" />
+ <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="allocateslice_StartEvent" targetRef="PreprocessIncomingRequest_task" />
+ <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="ScriptTask_0o93dvp" />
+ <bpmn:sequenceFlow id="SequenceFlow_0g5bwvl" sourceRef="instantiate_NSTask" targetRef="ExclusiveGateway_07qkrrb" />
+ <bpmn:sequenceFlow id="SequenceFlow_0hxky5e" sourceRef="CallActivity_1k1oonn" targetRef="ScriptTask_1lpgn98" />
+ <bpmn:sequenceFlow id="SequenceFlow_1dhpkhd" sourceRef="ScriptTask_0gunols" targetRef="CallActivity_1k1oonn" />
+ <bpmn:sequenceFlow id="SequenceFlow_19jztxv" sourceRef="ScriptTask_1lpgn98" targetRef="ExclusiveGateway_1jg3el3" />
+ <bpmn:sequenceFlow id="SequenceFlow_0u8fycy" name="No" sourceRef="ExclusiveGateway_07qkrrb" targetRef="EndEvent_1x6k78c" />
+ <bpmn:sequenceFlow id="SequenceFlow_16nvnxi" name="Yes" sourceRef="ExclusiveGateway_07qkrrb" targetRef="finishNSCreate_Task">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSI" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0cq2q6g" sourceRef="finishNSCreate_Task" targetRef="CallActivity_130tuxn" />
+ <bpmn:sequenceFlow id="SequenceFlow_1jaxstd" sourceRef="ScriptTask_0anyn7v" targetRef="ExclusiveGateway_07qkrrb" />
+ <bpmn:sequenceFlow id="SequenceFlow_00b8ryw" sourceRef="CallActivity_130tuxn" targetRef="ScriptTask_0anyn7v" />
+ <bpmn:sequenceFlow id="SequenceFlow_04yx9ii" name="No" sourceRef="ExclusiveGateway_1jg3el3" targetRef="instantiate_NSTask" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ui528w" sourceRef="ExclusiveGateway_1jg3el3" targetRef="ScriptTask_0gunols">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSTtoProcess" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSIandNSSI">
+ <bpmndi:BPMNEdge id="SequenceFlow_0uhaps2_di" bpmnElement="SequenceFlow_0uhaps2">
+ <di:waypoint x="978" y="350" />
+ <di:waypoint x="1736" y="350" />
+ <di:waypoint x="1736" y="487" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1e40h52_di" bpmnElement="SequenceFlow_1e40h52">
+ <di:waypoint x="799" y="527" />
+ <di:waypoint x="878" y="527" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0xfhbqw_di" bpmnElement="SequenceFlow_0xfhbqw">
+ <di:waypoint x="799" y="350" />
+ <di:waypoint x="878" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0dj0jvq_di" bpmnElement="SequenceFlow_0dj0jvq">
+ <di:waypoint x="520" y="527" />
+ <di:waypoint x="583" y="527" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ueeeca_di" bpmnElement="SequenceFlow_0ueeeca">
+ <di:waypoint x="608" y="502" />
+ <di:waypoint x="608" y="350" />
+ <di:waypoint x="699" y="350" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="584" y="422" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1h5bw41_di" bpmnElement="SequenceFlow_1h5bw41">
+ <di:waypoint x="633" y="527" />
+ <di:waypoint x="699" y="527" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="630" y="509" width="14" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h">
+ <di:waypoint x="978" y="527" />
+ <di:waypoint x="1036" y="527" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="631" y="108" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln">
+ <di:waypoint x="210" y="527" />
+ <di:waypoint x="268" y="527" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="266" y="123" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova">
+ <di:waypoint x="368" y="527" />
+ <di:waypoint x="420" y="527" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="436" y="108" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0g5bwvl_di" bpmnElement="SequenceFlow_0g5bwvl">
+ <di:waypoint x="1786" y="527" />
+ <di:waypoint x="1871" y="527" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0hxky5e_di" bpmnElement="SequenceFlow_0hxky5e">
+ <di:waypoint x="1300" y="527" />
+ <di:waypoint x="1388" y="527" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1dhpkhd_di" bpmnElement="SequenceFlow_1dhpkhd">
+ <di:waypoint x="1136" y="527" />
+ <di:waypoint x="1200" y="527" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_19jztxv_di" bpmnElement="SequenceFlow_19jztxv">
+ <di:waypoint x="1488" y="527" />
+ <di:waypoint x="1564" y="527" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0u8fycy_di" bpmnElement="SequenceFlow_0u8fycy">
+ <di:waypoint x="1896" y="502" />
+ <di:waypoint x="1896" y="409" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1904" y="453" width="14" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_16nvnxi_di" bpmnElement="SequenceFlow_16nvnxi">
+ <di:waypoint x="1921" y="527" />
+ <di:waypoint x="1991" y="527" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1942" y="500" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cq2q6g_di" bpmnElement="SequenceFlow_0cq2q6g">
+ <di:waypoint x="2091" y="527" />
+ <di:waypoint x="2197" y="527" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="556.5" y="574" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1jaxstd_di" bpmnElement="SequenceFlow_1jaxstd">
+ <di:waypoint x="1991" y="665" />
+ <di:waypoint x="1896" y="665" />
+ <di:waypoint x="1896" y="552" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_00b8ryw_di" bpmnElement="SequenceFlow_00b8ryw">
+ <di:waypoint x="2247" y="567" />
+ <di:waypoint x="2247" y="665" />
+ <di:waypoint x="2091" y="665" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_04yx9ii_di" bpmnElement="SequenceFlow_04yx9ii">
+ <di:waypoint x="1614" y="527" />
+ <di:waypoint x="1686" y="527" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1643" y="509" width="14" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ui528w_di" bpmnElement="SequenceFlow_1ui528w">
+ <di:waypoint x="1589" y="552" />
+ <di:waypoint x="1589" y="671" />
+ <di:waypoint x="1086" y="671" />
+ <di:waypoint x="1086" y="567" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk">
+ <dc:Bounds x="878" y="487" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0b9d9l0_di" bpmnElement="ExclusiveGateway_0b9d9l0" isMarkerVisible="true">
+ <dc:Bounds x="583" y="502" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="578" y="559" width="60" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1ehyrsg_di" bpmnElement="ScriptTask_1ehyrsg">
+ <dc:Bounds x="699" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1s23hty_di" bpmnElement="CallActivity_1s23hty">
+ <dc:Bounds x="699" y="487" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1q3ftu4_di" bpmnElement="ScriptTask_1q3ftu4">
+ <dc:Bounds x="878" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="allocateslice_StartEvent">
+ <dc:Bounds x="174" y="509" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="152" y="545" width="82" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
+ <dc:Bounds x="268" y="487" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0o93dvp_di" bpmnElement="ScriptTask_0o93dvp">
+ <dc:Bounds x="420" y="487" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1k1oonn_di" bpmnElement="CallActivity_1k1oonn">
+ <dc:Bounds x="1200" y="487" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0gunols_di" bpmnElement="ScriptTask_0gunols">
+ <dc:Bounds x="1036" y="487" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1lpgn98_di" bpmnElement="ScriptTask_1lpgn98">
+ <dc:Bounds x="1388" y="487" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c">
+ <dc:Bounds x="1878" y="373" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="412" y="617" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0xxyfku_di" bpmnElement="finishNSCreate_Task">
+ <dc:Bounds x="1991" y="487" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_07qkrrb_di" bpmnElement="ExclusiveGateway_07qkrrb" isMarkerVisible="true">
+ <dc:Bounds x="1871" y="502" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1853" y="575" width="86" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_130tuxn_di" bpmnElement="CallActivity_130tuxn">
+ <dc:Bounds x="2197" y="487" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0anyn7v_di" bpmnElement="ScriptTask_0anyn7v">
+ <dc:Bounds x="1991" y="625" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask">
+ <dc:Bounds x="1686" y="487" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1jg3el3_di" bpmnElement="ExclusiveGateway_1jg3el3" isMarkerVisible="true">
+ <dc:Bounds x="1564" y="502" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1564" y="465" width="50" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn
new file mode 100644
index 0000000000..445c9378af
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn
@@ -0,0 +1,364 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3">
+ <bpmn:process id="DoAllocateNSSI" name="DoAllocateNSSI" isExecutable="true">
+ <bpmn:startEvent id="allocatenssi_StartEvent" name="allocatenssi_StartEvent">
+ <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="allocatenssi_StartEvent" targetRef="PreprocessIncomingRequest_task" />
+ <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="CallActivity_09l7bhc" />
+ <bpmn:scriptTask id="Task_09nzhwk" name="send create request to NSSMF adapter" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1h5bw41</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.sendCreateRequestNSSMF(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="instantiate_NSTask" name="create slice profile" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0yie00u</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0kzlbeh</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1r8qkgf</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_09pv5lu</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.createSliceProfile(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:endEvent id="EndEvent_1x6k78c">
+ <bpmn:incoming>SequenceFlow_09pv5lu</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="finishNSCreate_Task" name="Get NSSI progress" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1smrx3b</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_08xcz0v</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1lpxjvi</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.getNSSMFProgresss(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1uiz85h" sourceRef="Task_09nzhwk" targetRef="ExclusiveGateway_0xz0xx2" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0b9d9l0" name="Is NSSI sharable?" default="SequenceFlow_0ueeeca">
+ <bpmn:incoming>SequenceFlow_0dj0jvq</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1h5bw41</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0ueeeca</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1h5bw41" name="No" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="Task_09nzhwk">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" ) == "create")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:scriptTask id="ScriptTask_1ehyrsg" name="send update request to NSSMF adapter" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0ueeeca</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0xfhbqw</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.sendUpdateRequestNSSMF(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0ueeeca" name="Yes" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="ScriptTask_1ehyrsg" />
+ <bpmn:scriptTask id="ScriptTask_0o93dvp" name="Get NSST from Catalog DB" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_03bz6dh</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0dj0jvq</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.getNSSTInfo(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0dj0jvq" sourceRef="ScriptTask_0o93dvp" targetRef="ExclusiveGateway_0b9d9l0" />
+ <bpmn:sequenceFlow id="SequenceFlow_0xfhbqw" sourceRef="ScriptTask_1ehyrsg" targetRef="ExclusiveGateway_0xz0xx2" />
+ <bpmn:scriptTask id="ScriptTask_1mv1npn" name="create NSSI and update relationship" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_07azk0i</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0yie00u</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.instantiateNSSIService(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1lpxjvi" sourceRef="finishNSCreate_Task" targetRef="ScriptTask_1fvkcir" />
+ <bpmn:callActivity id="CallActivity_09l7bhc" name="Call Decompose Service" calledElement="DecomposeService">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_03bz6dh</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_03bz6dh" sourceRef="CallActivity_09l7bhc" targetRef="ScriptTask_0o93dvp" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1cgffe3" name="Completed">
+ <bpmn:incoming>SequenceFlow_1xzq95u</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1kxwt7k</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0stj4cv</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:scriptTask id="ScriptTask_1escji6" name="Time delay" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0stj4cv</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_08xcz0v</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.timeDelay(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_08xcz0v" sourceRef="ScriptTask_1escji6" targetRef="finishNSCreate_Task" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0xz0xx2">
+ <bpmn:incoming>SequenceFlow_0xfhbqw</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1smrx3b</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1kxwt7k" name="true" sourceRef="ExclusiveGateway_1cgffe3" targetRef="ExclusiveGateway_09hoejm">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSSICreated" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0stj4cv" name="false" sourceRef="ExclusiveGateway_1cgffe3" targetRef="ScriptTask_1escji6">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSSICreated" ) == false)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1smrx3b" sourceRef="ExclusiveGateway_0xz0xx2" targetRef="finishNSCreate_Task" />
+ <bpmn:sequenceFlow id="SequenceFlow_0yie00u" sourceRef="ScriptTask_1mv1npn" targetRef="instantiate_NSTask" />
+ <bpmn:sequenceFlow id="SequenceFlow_09pv5lu" sourceRef="instantiate_NSTask" targetRef="EndEvent_1x6k78c" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_09hoejm" name="Is NSSI sharable?" default="SequenceFlow_0c2o5zl2">
+ <bpmn:incoming>SequenceFlow_1kxwt7k</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_07azk0i</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0c2o5zl2</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_07azk0i" sourceRef="ExclusiveGateway_09hoejm" targetRef="ScriptTask_1mv1npn">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" ) == "create")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:scriptTask id="ScriptTask_0y2xmwi" name="Update relationship" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_14lzy4o</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0kzlbeh</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.updateRelationship(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0c2o5zl2" sourceRef="ExclusiveGateway_09hoejm" targetRef="ScriptTask_0y2xmwi" />
+ <bpmn:sequenceFlow id="SequenceFlow_0kzlbeh" sourceRef="ScriptTask_0y2xmwi" targetRef="instantiate_NSTask" />
+ <bpmn:scriptTask id="ScriptTask_1fvkcir" name="Prepare Update Orchestration Task" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1lpxjvi</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0jjbci8</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcnssi = new DoAllocateNSSI()
+dcnssi.prepareUpdateOrchestrationTask(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_11d0poc" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask">
+ <bpmn:extensionElements>
+ <camunda:out source="statusCode" target="CSSOT_dbResponseCode" />
+ <camunda:out source="response" target="CSSOT_dbResponse" />
+ <camunda:in source="CSSOT_taskId" target="taskId" />
+ <camunda:in source="msoRequestId" target="requestId" />
+ <camunda:in source="CSSOT_name" target="taskName" />
+ <camunda:in source="CSSOT_status" target="taskStatus" />
+ <camunda:in source="CSSOT_isManual" target="isManual" />
+ <camunda:in source="CSSOT_paramJson" target="paramJson" />
+ <camunda:in source="CSSOT_requestMethod" target="method" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0jjbci8</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1xzq95u</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_0jjbci8" sourceRef="ScriptTask_1fvkcir" targetRef="CallActivity_11d0poc" />
+ <bpmn:sequenceFlow id="SequenceFlow_1xzq95u" sourceRef="CallActivity_11d0poc" targetRef="ExclusiveGateway_1cgffe3" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_19tascw" name="Is NSI option available?" default="SequenceFlow_14lzy4o">
+ <bpmn:incoming>SequenceFlow_0c2o5zl2</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_14lzy4o</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1r8qkgf</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_14lzy4o" sourceRef="ExclusiveGateway_19tascw" targetRef="ScriptTask_0y2xmwi" />
+ <bpmn:sequenceFlow id="SequenceFlow_1r8qkgf" sourceRef="ExclusiveGateway_19tascw" targetRef="instantiate_NSTask">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSIOptionAvailable" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSSI">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="allocatenssi_StartEvent">
+ <dc:Bounds x="175" y="509" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="152" y="545" width="85" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln">
+ <di:waypoint x="211" y="527" />
+ <di:waypoint x="269" y="527" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="266" y="123" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova">
+ <di:waypoint x="369" y="527" />
+ <di:waypoint x="444" y="527" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="436" y="108" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk">
+ <dc:Bounds x="887" y="659" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
+ <dc:Bounds x="269" y="487" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask">
+ <dc:Bounds x="2286" y="467" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c">
+ <dc:Bounds x="2482" y="489" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="412" y="617" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0xxyfku_di" bpmnElement="finishNSCreate_Task">
+ <dc:Bounds x="1238" y="467" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h">
+ <di:waypoint x="987" y="699" />
+ <di:waypoint x="1103" y="699" />
+ <di:waypoint x="1103" y="532" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="631" y="108" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0b9d9l0_di" bpmnElement="ExclusiveGateway_0b9d9l0" isMarkerVisible="true">
+ <dc:Bounds x="778" y="502" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="838" y="520" width="90" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1h5bw41_di" bpmnElement="SequenceFlow_1h5bw41">
+ <di:waypoint x="803" y="552" />
+ <di:waypoint x="803" y="699" />
+ <di:waypoint x="883" y="699" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="836" y="681" width="14" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1ehyrsg_di" bpmnElement="ScriptTask_1ehyrsg">
+ <dc:Bounds x="894" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ueeeca_di" bpmnElement="SequenceFlow_0ueeeca">
+ <di:waypoint x="803" y="502" />
+ <di:waypoint x="803" y="350" />
+ <di:waypoint x="894" y="350" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="831" y="358" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0o93dvp_di" bpmnElement="ScriptTask_0o93dvp">
+ <dc:Bounds x="618" y="487" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0dj0jvq_di" bpmnElement="SequenceFlow_0dj0jvq">
+ <di:waypoint x="718" y="527" />
+ <di:waypoint x="778" y="527" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0xfhbqw_di" bpmnElement="SequenceFlow_0xfhbqw">
+ <di:waypoint x="994" y="350" />
+ <di:waypoint x="1103" y="350" />
+ <di:waypoint x="1103" y="482" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1mv1npn_di" bpmnElement="ScriptTask_1mv1npn">
+ <dc:Bounds x="2089" y="467" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1lpxjvi_di" bpmnElement="SequenceFlow_1lpxjvi">
+ <di:waypoint x="1338" y="507" />
+ <di:waypoint x="1411" y="507" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_09l7bhc_di" bpmnElement="CallActivity_09l7bhc">
+ <dc:Bounds x="444" y="487" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_03bz6dh_di" bpmnElement="SequenceFlow_03bz6dh">
+ <di:waypoint x="544" y="527" />
+ <di:waypoint x="618" y="527" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1cgffe3_di" bpmnElement="ExclusiveGateway_1cgffe3" isMarkerVisible="true">
+ <dc:Bounds x="1773" y="482" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1771" y="458" width="54" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1escji6_di" bpmnElement="ScriptTask_1escji6">
+ <dc:Bounds x="1748" y="624" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_08xcz0v_di" bpmnElement="SequenceFlow_08xcz0v">
+ <di:waypoint x="1748" y="664" />
+ <di:waypoint x="1288" y="664" />
+ <di:waypoint x="1288" y="547" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0xz0xx2_di" bpmnElement="ExclusiveGateway_0xz0xx2" isMarkerVisible="true">
+ <dc:Bounds x="1078" y="482" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1kxwt7k_di" bpmnElement="SequenceFlow_1kxwt7k">
+ <di:waypoint x="1823" y="507" />
+ <di:waypoint x="1928" y="507" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1866" y="489" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0stj4cv_di" bpmnElement="SequenceFlow_0stj4cv">
+ <di:waypoint x="1798" y="532" />
+ <di:waypoint x="1798" y="624" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1801" y="575" width="24" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1smrx3b_di" bpmnElement="SequenceFlow_1smrx3b">
+ <di:waypoint x="1128" y="507" />
+ <di:waypoint x="1238" y="507" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0yie00u_di" bpmnElement="SequenceFlow_0yie00u">
+ <di:waypoint x="2189" y="507" />
+ <di:waypoint x="2286" y="507" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_09pv5lu_di" bpmnElement="SequenceFlow_09pv5lu">
+ <di:waypoint x="2386" y="507" />
+ <di:waypoint x="2482" y="507" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_09hoejm_di" bpmnElement="ExclusiveGateway_09hoejm" isMarkerVisible="true">
+ <dc:Bounds x="1928" y="482" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1908" y="542" width="90" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_07azk0i_di" bpmnElement="SequenceFlow_07azk0i">
+ <di:waypoint x="1978" y="507" />
+ <di:waypoint x="2089" y="507" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0y2xmwi_di" bpmnElement="ScriptTask_0y2xmwi">
+ <dc:Bounds x="2089" y="310" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0kzlbeh_di" bpmnElement="SequenceFlow_0kzlbeh">
+ <di:waypoint x="2189" y="350" />
+ <di:waypoint x="2336" y="350" />
+ <di:waypoint x="2336" y="467" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1fvkcir_di" bpmnElement="ScriptTask_1fvkcir">
+ <dc:Bounds x="1411" y="467" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_11d0poc_di" bpmnElement="CallActivity_11d0poc">
+ <dc:Bounds x="1587" y="467" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0jjbci8_di" bpmnElement="SequenceFlow_0jjbci8">
+ <di:waypoint x="1511" y="507" />
+ <di:waypoint x="1587" y="507" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1xzq95u_di" bpmnElement="SequenceFlow_1xzq95u">
+ <di:waypoint x="1687" y="507" />
+ <di:waypoint x="1773" y="507" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_19tascw_di" bpmnElement="ExclusiveGateway_19tascw" isMarkerVisible="true">
+ <dc:Bounds x="1928" y="325" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1854" y="337" width="64" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0c2o5zl_di" bpmnElement="SequenceFlow_0c2o5zl2">
+ <di:waypoint x="1953" y="482" />
+ <di:waypoint x="1953" y="375" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_14lzy4o_di" bpmnElement="SequenceFlow_14lzy4o">
+ <di:waypoint x="1978" y="350" />
+ <di:waypoint x="2089" y="350" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1r8qkgf_di" bpmnElement="SequenceFlow_1r8qkgf">
+ <di:waypoint x="1953" y="325" />
+ <di:waypoint x="1953" y="205" />
+ <di:waypoint x="2336" y="205" />
+ <di:waypoint x="2336" y="465" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateCommunicationService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateCommunicationService.bpmn
new file mode 100644
index 0000000000..1f0e10b1c1
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateCommunicationService.bpmn
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_152rp63" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+ <bpmn:process id="DoCreateCommunicationService" name="DoCreateCommunicationService" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1" name="start">
+ <bpmn:outgoing>SequenceFlow_0r43nhn</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0r43nhn" sourceRef="StartEvent_1" targetRef="Task_1n00ul2" />
+ <bpmn:scriptTask id="Task_1n00ul2" name="Pre Process Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0r43nhn</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ojuala</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new DoCreateCommunicationService()
+csi.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_13cimkc" name="Create Communication Service Profile" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0mxvw9q</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_15e8qrt</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new DoCreateCommunicationService()
+csi.createCommunicationServiceProfile(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_02h3nyo" name="Create Communication Service" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1ojuala</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0mxvw9q</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new DoCreateCommunicationService()
+csi.createCommunicationService(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:endEvent id="EndEvent_0tx74b8" name="end">
+ <bpmn:incoming>SequenceFlow_15e8qrt</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0mxvw9q" sourceRef="Task_02h3nyo" targetRef="Task_13cimkc" />
+ <bpmn:sequenceFlow id="SequenceFlow_15e8qrt" sourceRef="Task_13cimkc" targetRef="EndEvent_0tx74b8" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ojuala" sourceRef="Task_1n00ul2" targetRef="Task_02h3nyo" />
+ <bpmn:subProcess id="SubProcess_0hvqoiu" name="Java Exception Handling Sub Process" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_06faevu">
+ <bpmn:outgoing>SequenceFlow_1jckdn4</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1idslt4" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1xkvl7n">
+ <bpmn:incoming>SequenceFlow_0ixyf17</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_15u2oe2" name="Process Error" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1jckdn4</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0ixyf17</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil exceptionUtil = new ExceptionUtil()
+exceptionUtil.processJavaException(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0ixyf17" sourceRef="ScriptTask_15u2oe2" targetRef="EndEvent_1xkvl7n" />
+ <bpmn:sequenceFlow id="SequenceFlow_1jckdn4" sourceRef="StartEvent_06faevu" targetRef="ScriptTask_15u2oe2" />
+ </bpmn:subProcess>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateCommunicationService">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="179" y="99" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="186" y="142" width="23" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0r43nhn_di" bpmnElement="SequenceFlow_0r43nhn">
+ <di:waypoint x="215" y="117" />
+ <di:waypoint x="290" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1ilqwj5_di" bpmnElement="Task_1n00ul2">
+ <dc:Bounds x="290" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0vpnfpe_di" bpmnElement="Task_13cimkc">
+ <dc:Bounds x="660" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_03bitgg_di" bpmnElement="Task_02h3nyo">
+ <dc:Bounds x="480" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0tx74b8_di" bpmnElement="EndEvent_0tx74b8">
+ <dc:Bounds x="912" y="99" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="921" y="142" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0mxvw9q_di" bpmnElement="SequenceFlow_0mxvw9q">
+ <di:waypoint x="580" y="117" />
+ <di:waypoint x="660" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_15e8qrt_di" bpmnElement="SequenceFlow_15e8qrt">
+ <di:waypoint x="760" y="117" />
+ <di:waypoint x="912" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ojuala_di" bpmnElement="SequenceFlow_1ojuala">
+ <di:waypoint x="390" y="117" />
+ <di:waypoint x="480" y="117" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="SubProcess_0hvqoiu_di" bpmnElement="SubProcess_0hvqoiu" isExpanded="true">
+ <dc:Bounds x="290" y="250" width="417" height="161" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_06faevu_di" bpmnElement="StartEvent_06faevu">
+ <dc:Bounds x="327" y="317" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1xkvl7n_di" bpmnElement="EndEvent_1xkvl7n">
+ <dc:Bounds x="613" y="317" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_15u2oe2_di" bpmnElement="ScriptTask_15u2oe2">
+ <dc:Bounds x="438" y="295" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ixyf17_di" bpmnElement="SequenceFlow_0ixyf17">
+ <di:waypoint x="538" y="335" />
+ <di:waypoint x="613" y="335" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1jckdn4_di" bpmnElement="SequenceFlow_1jckdn4">
+ <di:waypoint x="363" y="335" />
+ <di:waypoint x="438" y="335" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn
new file mode 100644
index 0000000000..894f7d39dc
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3">
+ <bpmn:process id="DoCreateSliceServiceInstance" name="DoCreateSliceServiceInstance" isExecutable="true">
+ <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent">
+ <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="createNS_StartEvent" targetRef="PreprocessIncomingRequest_task" />
+ <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="instantiate_NSTask" />
+ <bpmn:scriptTask id="Task_09nzhwk" name="Create service profile" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_17u69c4</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCreateSliceServiceInstance()
+dcsi.createServiceProfile(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCreateSliceServiceInstance()
+dcsi.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="instantiate_NSTask" name="create Slice Service in AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0g5bwvl</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCreateSliceServiceInstance()
+dcsi.instantiateSliceService(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:endEvent id="EndEvent_1x6k78c">
+ <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1uiz85h" sourceRef="Task_09nzhwk" targetRef="EndEvent_1x6k78c" />
+ <bpmn:sequenceFlow id="SequenceFlow_0g5bwvl" sourceRef="instantiate_NSTask" targetRef="ScriptTask_18rzwzb" />
+ <bpmn:scriptTask id="ScriptTask_18rzwzb" name="Create Allottedsource" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0g5bwvl</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_17u69c4</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCreateSliceServiceInstance()
+dcsi.createAllottedResource(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_17u69c4" sourceRef="ScriptTask_18rzwzb" targetRef="Task_09nzhwk" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceInstance">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent">
+ <dc:Bounds x="175" y="111" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="152" y="147" width="83" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln">
+ <di:waypoint x="211" y="129" />
+ <di:waypoint x="251" y="129" />
+ <di:waypoint x="251" y="129" />
+ <di:waypoint x="293" y="129" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="266" y="123" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova">
+ <di:waypoint x="393" y="129" />
+ <di:waypoint x="474" y="129" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="436" y="108" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk">
+ <dc:Bounds x="851" y="89" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
+ <dc:Bounds x="293" y="89" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask">
+ <dc:Bounds x="474" y="89" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c">
+ <dc:Bounds x="1049" y="111" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="412" y="617" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h">
+ <di:waypoint x="951" y="129" />
+ <di:waypoint x="1049" y="129" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="631" y="108" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0g5bwvl_di" bpmnElement="SequenceFlow_0g5bwvl">
+ <di:waypoint x="574" y="129" />
+ <di:waypoint x="658" y="129" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_18rzwzb_di" bpmnElement="ScriptTask_18rzwzb">
+ <dc:Bounds x="658" y="89" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_17u69c4_di" bpmnElement="SequenceFlow_17u69c4">
+ <di:waypoint x="758" y="129" />
+ <di:waypoint x="851" y="129" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn
new file mode 100644
index 0000000000..435f91921d
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn
@@ -0,0 +1,338 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3">
+ <bpmn:process id="DoCreateSliceServiceOption" name="DoCreateSliceServiceOption" isExecutable="true">
+ <bpmn:startEvent id="createNS_StartEvent" name="createOption_StartEvent">
+ <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="createNS_StartEvent" targetRef="PreprocessIncomingRequest_task" />
+ <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="ExclusiveGateway_0b9d9l0" />
+ <bpmn:scriptTask id="Task_09nzhwk" name="send request to OOF for NSI options" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1h5bw41</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1utpplq</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.getNSIOptionfromOOF(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0cq2q6g" sourceRef="finishNSCreate_Task" targetRef="ScriptTask_0j3wd2o" />
+ <bpmn:endEvent id="EndEvent_1x6k78c">
+ <bpmn:incoming>SequenceFlow_01ak5x3</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1ap8kar</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0hnsycl</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="finishNSCreate_Task" name="prepare list of NSSI associated with NSI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_15679e8</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cq2q6g</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.prepareNSSIList(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0b9d9l0" default="SequenceFlow_0ueeeca">
+ <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1h5bw41</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0ueeeca</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1h5bw41" name="NSI Sharable" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="Task_09nzhwk">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isSharable" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:scriptTask id="ScriptTask_1ehyrsg" name="update task status in request DB" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0ueeeca</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0ojueqq</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.updateStatusInDB(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0ueeeca" name="NSI Not Sharable" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="ScriptTask_1ehyrsg" />
+ <bpmn:endEvent id="EndEvent_00n990e">
+ <bpmn:incoming>SequenceFlow_0ojueqq</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_0j3wd2o" name="updated options in request DB" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0cq2q6g</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_01ak5x3</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.updateOptionsInDB(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_01ak5x3" sourceRef="ScriptTask_0j3wd2o" targetRef="EndEvent_1x6k78c" />
+ <bpmn:scriptTask id="ScriptTask_0kecvrc" name="prepare list of NSST associated with NST" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1614gtr</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0lt2cdo</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.prepareNSSTlistfromNST(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_1mlytov" name="send request to OOF for NSSI options" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0a5f5y6</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1r9n9ef</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.getNSSTOption(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1y1wzs9">
+ <bpmn:incoming>SequenceFlow_0lt2cdo</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_00gq7h2</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ap8kar</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0m2mr0o</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1ap8kar" sourceRef="ExclusiveGateway_1y1wzs9" targetRef="EndEvent_1x6k78c">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSTtoProcess" ) == false)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0lt2cdo" sourceRef="ScriptTask_0kecvrc" targetRef="ExclusiveGateway_1y1wzs9" />
+ <bpmn:sequenceFlow id="SequenceFlow_0m2mr0o" sourceRef="ExclusiveGateway_1y1wzs9" targetRef="ScriptTask_1e5ysya">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSTtoProcess" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:scriptTask id="ScriptTask_0ojz4lj" name="save NSI and NSSI options in DB" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1r9n9ef</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_00gq7h2</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.updateOptionsInDB(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1r9n9ef" sourceRef="ScriptTask_1mlytov" targetRef="ScriptTask_0ojz4lj" />
+ <bpmn:sequenceFlow id="SequenceFlow_00gq7h2" sourceRef="ScriptTask_0ojz4lj" targetRef="ExclusiveGateway_1y1wzs9" />
+ <bpmn:sequenceFlow id="SequenceFlow_0ojueqq" sourceRef="ScriptTask_1ehyrsg" targetRef="EndEvent_00n990e" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1mdr1l2" default="SequenceFlow_1614gtr">
+ <bpmn:incoming>SequenceFlow_041f5ne</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_15679e8</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1614gtr</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_15679e8" sourceRef="ExclusiveGateway_1mdr1l2" targetRef="finishNSCreate_Task">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSISuggested" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1614gtr" sourceRef="ExclusiveGateway_1mdr1l2" targetRef="ScriptTask_0kecvrc" />
+ <bpmn:scriptTask id="ScriptTask_0uu3j3h" name="prepare NST decomposition" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0wy6oag</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1jnsyix</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.prepareNSTDecompose(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_1qs8xd5" name="Call Decompose Service" calledElement="DecomposeService">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1jnsyix</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_041f5ne</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="ScriptTask_1e5ysya" name="prepare NSST decomposition" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0m2mr0o</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_016vi3s</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.prepareNSSTDecompose(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_016vi3s" sourceRef="ScriptTask_1e5ysya" targetRef="CallActivity_1rfnoe2" />
+ <bpmn:callActivity id="CallActivity_1rfnoe2" name="Call Decompose Service" calledElement="DecomposeService">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_016vi3s</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0a5f5y6</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_0a5f5y6" sourceRef="CallActivity_1rfnoe2" targetRef="ScriptTask_1mlytov" />
+ <bpmn:sequenceFlow id="SequenceFlow_1utpplq" sourceRef="Task_09nzhwk" targetRef="ExclusiveGateway_1skfk7w" />
+ <bpmn:sequenceFlow id="SequenceFlow_1jnsyix" sourceRef="ScriptTask_0uu3j3h" targetRef="CallActivity_1qs8xd5" />
+ <bpmn:sequenceFlow id="SequenceFlow_041f5ne" sourceRef="CallActivity_1qs8xd5" targetRef="ExclusiveGateway_1mdr1l2" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1skfk7w" default="SequenceFlow_0wy6oag">
+ <bpmn:incoming>SequenceFlow_1utpplq</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0wy6oag</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0hnsycl</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0wy6oag" sourceRef="ExclusiveGateway_1skfk7w" targetRef="ScriptTask_0uu3j3h" />
+ <bpmn:sequenceFlow id="SequenceFlow_0hnsycl" sourceRef="ExclusiveGateway_1skfk7w" targetRef="EndEvent_1x6k78c">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSISuggested" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceOption">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent">
+ <dc:Bounds x="175" y="187" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="150" y="223" width="87" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln">
+ <di:waypoint x="211" y="205" />
+ <di:waypoint x="251" y="205" />
+ <di:waypoint x="251" y="205" />
+ <di:waypoint x="293" y="205" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="266" y="123" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova">
+ <di:waypoint x="393" y="205" />
+ <di:waypoint x="448" y="205" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="436" y="108" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk">
+ <dc:Bounds x="594" y="165" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
+ <dc:Bounds x="293" y="165" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cq2q6g_di" bpmnElement="SequenceFlow_0cq2q6g">
+ <di:waypoint x="1536" y="205" />
+ <di:waypoint x="1592" y="205" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="556.5" y="574" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c">
+ <dc:Bounds x="1813" y="187" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="412" y="617" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0xxyfku_di" bpmnElement="finishNSCreate_Task">
+ <dc:Bounds x="1436" y="165" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0b9d9l0_di" bpmnElement="ExclusiveGateway_0b9d9l0" isMarkerVisible="true">
+ <dc:Bounds x="448" y="180" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1h5bw41_di" bpmnElement="SequenceFlow_1h5bw41">
+ <di:waypoint x="498" y="205" />
+ <di:waypoint x="594" y="205" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="514" y="187" width="66" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1ehyrsg_di" bpmnElement="ScriptTask_1ehyrsg">
+ <dc:Bounds x="602" y="-197" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ueeeca_di" bpmnElement="SequenceFlow_0ueeeca">
+ <di:waypoint x="473" y="180" />
+ <di:waypoint x="473" y="-157" />
+ <di:waypoint x="602" y="-157" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="415" y="14" width="86" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_00n990e_di" bpmnElement="EndEvent_00n990e">
+ <dc:Bounds x="785" y="-175" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0j3wd2o_di" bpmnElement="ScriptTask_0j3wd2o">
+ <dc:Bounds x="1592" y="165" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_01ak5x3_di" bpmnElement="SequenceFlow_01ak5x3">
+ <di:waypoint x="1692" y="205" />
+ <di:waypoint x="1813" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0kecvrc_di" bpmnElement="ScriptTask_0kecvrc">
+ <dc:Bounds x="1297" y="391" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1mlytov_di" bpmnElement="ScriptTask_1mlytov">
+ <dc:Bounds x="1781" y="533" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1y1wzs9_di" bpmnElement="ExclusiveGateway_1y1wzs9" isMarkerVisible="true">
+ <dc:Bounds x="1461" y="406" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ap8kar_di" bpmnElement="SequenceFlow_1ap8kar">
+ <di:waypoint x="1486" y="406" />
+ <di:waypoint x="1486" y="315" />
+ <di:waypoint x="1831" y="315" />
+ <di:waypoint x="1831" y="223" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0lt2cdo_di" bpmnElement="SequenceFlow_0lt2cdo">
+ <di:waypoint x="1397" y="431" />
+ <di:waypoint x="1461" y="431" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0m2mr0o_di" bpmnElement="SequenceFlow_0m2mr0o">
+ <di:waypoint x="1511" y="431" />
+ <di:waypoint x="1592" y="431" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0ojz4lj_di" bpmnElement="ScriptTask_0ojz4lj">
+ <dc:Bounds x="1592" y="533" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1r9n9ef_di" bpmnElement="SequenceFlow_1r9n9ef">
+ <di:waypoint x="1781" y="573" />
+ <di:waypoint x="1692" y="573" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_00gq7h2_di" bpmnElement="SequenceFlow_00gq7h2">
+ <di:waypoint x="1592" y="573" />
+ <di:waypoint x="1486" y="573" />
+ <di:waypoint x="1486" y="456" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ojueqq_di" bpmnElement="SequenceFlow_0ojueqq">
+ <di:waypoint x="702" y="-157" />
+ <di:waypoint x="785" y="-157" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1mdr1l2_di" bpmnElement="ExclusiveGateway_1mdr1l2" isMarkerVisible="true">
+ <dc:Bounds x="1322" y="180" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_15679e8_di" bpmnElement="SequenceFlow_15679e8">
+ <di:waypoint x="1372" y="205" />
+ <di:waypoint x="1436" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1614gtr_di" bpmnElement="SequenceFlow_1614gtr">
+ <di:waypoint x="1347" y="230" />
+ <di:waypoint x="1347" y="391" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0uu3j3h_di" bpmnElement="ScriptTask_0uu3j3h">
+ <dc:Bounds x="967" y="165" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1qs8xd5_di" bpmnElement="CallActivity_1qs8xd5">
+ <dc:Bounds x="1136" y="165" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1e5ysya_di" bpmnElement="ScriptTask_1e5ysya">
+ <dc:Bounds x="1592" y="391" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_016vi3s_di" bpmnElement="SequenceFlow_016vi3s">
+ <di:waypoint x="1692" y="431" />
+ <di:waypoint x="1781" y="431" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_1rfnoe2_di" bpmnElement="CallActivity_1rfnoe2">
+ <dc:Bounds x="1781" y="391" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0a5f5y6_di" bpmnElement="SequenceFlow_0a5f5y6">
+ <di:waypoint x="1881" y="431" />
+ <di:waypoint x="1968" y="431" />
+ <di:waypoint x="1968" y="573" />
+ <di:waypoint x="1881" y="573" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1utpplq_di" bpmnElement="SequenceFlow_1utpplq">
+ <di:waypoint x="694" y="205" />
+ <di:waypoint x="796" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1jnsyix_di" bpmnElement="SequenceFlow_1jnsyix">
+ <di:waypoint x="1067" y="205" />
+ <di:waypoint x="1136" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_041f5ne_di" bpmnElement="SequenceFlow_041f5ne">
+ <di:waypoint x="1236" y="205" />
+ <di:waypoint x="1322" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1skfk7w_di" bpmnElement="ExclusiveGateway_1skfk7w" isMarkerVisible="true">
+ <dc:Bounds x="796" y="180" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0wy6oag_di" bpmnElement="SequenceFlow_0wy6oag">
+ <di:waypoint x="846" y="205" />
+ <di:waypoint x="967" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0hnsycl_di" bpmnElement="SequenceFlow_0hnsycl">
+ <di:waypoint x="821" y="180" />
+ <di:waypoint x="821" y="90" />
+ <di:waypoint x="1831" y="90" />
+ <di:waypoint x="1831" y="187" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
new file mode 100644
index 0000000000..db805ecb92
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_0884541" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+ <bpmn:process id="DoDeallocateNSSIV1" name="DoDeallocateNSSIV1" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1" name="start">
+ <bpmn:outgoing>SequenceFlow_05jfhy6</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_05jfhy6" sourceRef="StartEvent_1" targetRef="Task_1vste9s" />
+ <bpmn:scriptTask id="Task_1m8upus" name="Prepare Decompose Service" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0eug5nv</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0wlyy5i</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.prepareDecomposeService(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0wlyy5i" sourceRef="Task_1m8upus" targetRef="Task_1giechg" />
+ <bpmn:callActivity id="Task_1giechg" name="Call Decompose Service" calledElement="DecomposeService">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
+ <camunda:out source="serviceDecompositionString" target="serviceDecompositionString" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0wlyy5i</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1e451y9</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1e451y9" sourceRef="Task_1giechg" targetRef="Task_15ut397" />
+ <bpmn:scriptTask id="Task_15ut397" name="processDecomposition" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1e451y9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1e7o57n</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.processDecomposition(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1e7o57n" sourceRef="Task_15ut397" targetRef="Task_0vi4ijv" />
+ <bpmn:scriptTask id="Task_0vi4ijv" name="Send deallocate request to NSSMF" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1e7o57n</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_03b0822</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.sendRequestToNSSMF(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_03b0822" sourceRef="Task_0vi4ijv" targetRef="Task_0kl6lcq" />
+ <bpmn:scriptTask id="Task_0kl6lcq" name="Query Job Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_03b0822</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1anlirk</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1jj0p5q</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.getJobStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1jj0p5q" sourceRef="Task_0kl6lcq" targetRef="ExclusiveGateway_0nhfsui" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0nhfsui" name="Is deallocate finish?" default="SequenceFlow_0sfh52b">
+ <bpmn:incoming>SequenceFlow_1jj0p5q</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0xq380j</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0sfh52b</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:scriptTask id="Task_13vaezk" name="Delete Slice Profile From AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0xq380j</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ii5002</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.delSliceProfileFromAAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:endEvent id="EndEvent_1f579t4" name="end">
+ <bpmn:incoming>SequenceFlow_1ii5002</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1ii5002" sourceRef="Task_13vaezk" targetRef="EndEvent_1f579t4" />
+ <bpmn:sequenceFlow id="SequenceFlow_0xq380j" name="yes" sourceRef="ExclusiveGateway_0nhfsui" targetRef="Task_13vaezk">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSSIDeAllocated" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0eug5nv" sourceRef="Task_1vste9s" targetRef="Task_1m8upus" />
+ <bpmn:scriptTask id="Task_1vste9s" name="PreProcess Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_05jfhy6</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0eug5nv</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1anlirk" sourceRef="Task_0fxuz4i" targetRef="Task_0kl6lcq" />
+ <bpmn:scriptTask id="Task_0fxuz4i" name="TimeDelay" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1ugva41</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1u66wjs</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1anlirk</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.timeDelay(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="Task_0amt4hu" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="DeNSSI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="DeNSSI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_04vg0c2</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ugva41</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0y0w592" name="IsNeedUpdateDB?" default="SequenceFlow_1u66wjs">
+ <bpmn:incoming>SequenceFlow_0sfh52b</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0r95j9m</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1u66wjs</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0sfh52b" sourceRef="ExclusiveGateway_0nhfsui" targetRef="ExclusiveGateway_0y0w592" />
+ <bpmn:sequenceFlow id="SequenceFlow_0r95j9m" sourceRef="ExclusiveGateway_0y0w592" targetRef="Task_1renmzf">
+ <bpmn:documentation>#{(execution.getVariable("isNeedUpdateDB" ) == true)}</bpmn:documentation>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNeedUpdateDB" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_04vg0c2" sourceRef="Task_1renmzf" targetRef="Task_0amt4hu" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ugva41" sourceRef="Task_0amt4hu" targetRef="Task_0fxuz4i" />
+ <bpmn:sequenceFlow id="SequenceFlow_1u66wjs" sourceRef="ExclusiveGateway_0y0w592" targetRef="Task_0fxuz4i" />
+ <bpmn:scriptTask id="Task_1renmzf" name="Prepare Update Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0r95j9m</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_04vg0c2</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.handleJobStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeallocateNSSIV1">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="192" y="112" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="199" y="155" width="22" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05jfhy6_di" bpmnElement="SequenceFlow_05jfhy6">
+ <di:waypoint x="228" y="130" />
+ <di:waypoint x="310" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_159g5ey_di" bpmnElement="Task_1m8upus">
+ <dc:Bounds x="490" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0wlyy5i_di" bpmnElement="SequenceFlow_0wlyy5i">
+ <di:waypoint x="590" y="130" />
+ <di:waypoint x="660" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_1ep4ama_di" bpmnElement="Task_1giechg">
+ <dc:Bounds x="660" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1e451y9_di" bpmnElement="SequenceFlow_1e451y9">
+ <di:waypoint x="760" y="130" />
+ <di:waypoint x="820" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1yt5s46_di" bpmnElement="Task_15ut397">
+ <dc:Bounds x="820" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1e7o57n_di" bpmnElement="SequenceFlow_1e7o57n">
+ <di:waypoint x="920" y="130" />
+ <di:waypoint x="970" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_16dxpvz_di" bpmnElement="Task_0vi4ijv">
+ <dc:Bounds x="970" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_03b0822_di" bpmnElement="SequenceFlow_03b0822">
+ <di:waypoint x="1070" y="130" />
+ <di:waypoint x="1120" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0arl3j9_di" bpmnElement="Task_0kl6lcq">
+ <dc:Bounds x="1120" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1jj0p5q_di" bpmnElement="SequenceFlow_1jj0p5q">
+ <di:waypoint x="1220" y="130" />
+ <di:waypoint x="1505" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0nhfsui_di" bpmnElement="ExclusiveGateway_0nhfsui" isMarkerVisible="true">
+ <dc:Bounds x="1505" y="105" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1501" y="75" width="63" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1rfdrw3_di" bpmnElement="Task_13vaezk">
+ <dc:Bounds x="1690" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1f579t4_di" bpmnElement="EndEvent_1f579t4">
+ <dc:Bounds x="1862" y="112" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1871" y="155" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ii5002_di" bpmnElement="SequenceFlow_1ii5002">
+ <di:waypoint x="1790" y="130" />
+ <di:waypoint x="1862" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0xq380j_di" bpmnElement="SequenceFlow_0xq380j">
+ <di:waypoint x="1555" y="130" />
+ <di:waypoint x="1690" y="130" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1614" y="112" width="17" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0eug5nv_di" bpmnElement="SequenceFlow_0eug5nv">
+ <di:waypoint x="410" y="130" />
+ <di:waypoint x="490" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1dytya8_di" bpmnElement="Task_1vste9s">
+ <dc:Bounds x="310" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1anlirk_di" bpmnElement="SequenceFlow_1anlirk">
+ <di:waypoint x="1170" y="190" />
+ <di:waypoint x="1170" y="170" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0a4zalz_di" bpmnElement="Task_0fxuz4i">
+ <dc:Bounds x="1120" y="190" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0vegqix_di" bpmnElement="Task_0amt4hu">
+ <dc:Bounds x="1280" y="300" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0y0w592_di" bpmnElement="ExclusiveGateway_0y0w592" isMarkerVisible="true">
+ <dc:Bounds x="1505" y="205" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1567" y="216" width="86" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0sfh52b_di" bpmnElement="SequenceFlow_0sfh52b">
+ <di:waypoint x="1530" y="155" />
+ <di:waypoint x="1530" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0r95j9m_di" bpmnElement="SequenceFlow_0r95j9m">
+ <di:waypoint x="1530" y="255" />
+ <di:waypoint x="1530" y="300" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_04vg0c2_di" bpmnElement="SequenceFlow_04vg0c2">
+ <di:waypoint x="1480" y="340" />
+ <di:waypoint x="1380" y="340" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ugva41_di" bpmnElement="SequenceFlow_1ugva41">
+ <di:waypoint x="1280" y="340" />
+ <di:waypoint x="1170" y="340" />
+ <di:waypoint x="1170" y="270" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1u66wjs_di" bpmnElement="SequenceFlow_1u66wjs">
+ <di:waypoint x="1505" y="230" />
+ <di:waypoint x="1220" y="230" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_10pw6ot_di" bpmnElement="Task_1renmzf">
+ <dc:Bounds x="1480" y="300" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteSliceService.bpmn
new file mode 100644
index 0000000000..5f4816e78f
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteSliceService.bpmn
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1p1suc9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+ <bpmn:process id="DoDeleteSliceServiceV1" name="DoDeleteSliceServiceV1" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1" name="start">
+ <bpmn:outgoing>SequenceFlow_0ep5het</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0ep5het" sourceRef="StartEvent_1" targetRef="Task_0etki1p" />
+ <bpmn:sequenceFlow id="SequenceFlow_1qkgvvu" sourceRef="Task_1ujnqtj" targetRef="Task_1fqiyb4" />
+ <bpmn:sequenceFlow id="SequenceFlow_1rgfzzy" sourceRef="Task_1fqiyb4" targetRef="Task_1u755sr" />
+ <bpmn:scriptTask id="Task_1ujnqtj" name="Query Allotted Resource From AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_029u1wr</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1qkgvvu</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def ddss= new DoDeleteSliceService()
+ddss.getAllottedResFromAAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_1fqiyb4" name="Query NSI From AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1qkgvvu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1rgfzzy</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def ddss= new DoDeleteSliceService()
+ddss.getNSIFromAAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_1u755sr" name="Query NSSI List From AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1rgfzzy</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_05si1me</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def ddss= new DoDeleteSliceService()
+ddss.getNSSIListFromAAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_05si1me" sourceRef="Task_1u755sr" targetRef="Task_1iomfas" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1ogbunu" name="Is all NSSI finished?">
+ <bpmn:incoming>SequenceFlow_15z9iio</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1c4fjbv</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0926ghe</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:endEvent id="EndEvent_0jaitqv" name="End">
+ <bpmn:incoming>SequenceFlow_1c4fjbv</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1c4fjbv" name="yes" sourceRef="ExclusiveGateway_1ogbunu" targetRef="EndEvent_0jaitqv">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAllNSSIFinished" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_01o2qpv" sourceRef="Task_1iomfas" targetRef="Task_1qqljvu" />
+ <bpmn:sequenceFlow id="SequenceFlow_0c58sw3" sourceRef="Task_1rc7mcw" targetRef="ScriptTask_159855t" />
+ <bpmn:sequenceFlow id="SequenceFlow_0926ghe" name="no" sourceRef="ExclusiveGateway_1ogbunu" targetRef="Task_1iomfas">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAllNSSIFinished" ) == false)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:scriptTask id="Task_0etki1p" name="PreProcess Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0ep5het</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0npmman</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def ddss= new DoDeleteSliceService()
+ddss.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0npmman" sourceRef="Task_0etki1p" targetRef="Task_13k9usx" />
+ <bpmn:scriptTask id="Task_1iomfas" name="Get Current NSSI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0926ghe</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_05si1me</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_01o2qpv</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def ddss= new DoDeleteSliceService()
+ddss.getCurrentNSSI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_159855t" name="Parse Next NSSI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0c58sw3</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_15z9iio</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def ddss= new DoDeleteSliceService()
+ddss.parseNextNSSI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_15z9iio" sourceRef="ScriptTask_159855t" targetRef="ExclusiveGateway_1ogbunu" />
+ <bpmn:sequenceFlow id="SequenceFlow_0q83qg3" sourceRef="Task_1qqljvu" targetRef="Task_1rc7mcw" />
+ <bpmn:scriptTask id="Task_1qqljvu" name="Query Slice Profile From AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_01o2qpv</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0q83qg3</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def ddss= new DoDeleteSliceService()
+ddss.querySliceProfileFromAAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_029u1wr" sourceRef="Task_13k9usx" targetRef="Task_1ujnqtj" />
+ <bpmn:scriptTask id="Task_13k9usx" name="Query E2ESlice Serive From AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0npmman</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_029u1wr</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def ddss= new DoDeleteSliceService()
+ddss.queryE2ESliceSeriveFromAAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="Task_1rc7mcw" name="Do Deallocate NSSI " calledElement="DoDeallocateNSSIV1">
+ <bpmn:extensionElements>
+ <camunda:in source="currentNSSI" target="currentNSSI" />
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0q83qg3</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0c58sw3</bpmn:outgoing>
+ </bpmn:callActivity>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeleteSliceServiceV1">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="152" y="122" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="159" y="165" width="22" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ep5het_di" bpmnElement="SequenceFlow_0ep5het">
+ <di:waypoint x="188" y="140" />
+ <di:waypoint x="270" y="140" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qkgvvu_di" bpmnElement="SequenceFlow_1qkgvvu">
+ <di:waypoint x="700" y="140" />
+ <di:waypoint x="750" y="140" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1rgfzzy_di" bpmnElement="SequenceFlow_1rgfzzy">
+ <di:waypoint x="850" y="140" />
+ <di:waypoint x="900" y="140" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1bj6tw4_di" bpmnElement="Task_1ujnqtj">
+ <dc:Bounds x="600" y="100" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0xgmbqj_di" bpmnElement="Task_1fqiyb4">
+ <dc:Bounds x="750" y="100" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_01fp1vt_di" bpmnElement="Task_1u755sr">
+ <dc:Bounds x="900" y="100" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05si1me_di" bpmnElement="SequenceFlow_05si1me">
+ <di:waypoint x="1000" y="140" />
+ <di:waypoint x="1040" y="140" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1ogbunu_di" bpmnElement="ExclusiveGateway_1ogbunu" isMarkerVisible="true">
+ <dc:Bounds x="1555" y="115" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1560" y="85" width="52" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0jaitqv_di" bpmnElement="EndEvent_0jaitqv">
+ <dc:Bounds x="1692" y="122" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1700" y="168" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1c4fjbv_di" bpmnElement="SequenceFlow_1c4fjbv">
+ <di:waypoint x="1605" y="140" />
+ <di:waypoint x="1692" y="140" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1630" y="118" width="17" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_01o2qpv_di" bpmnElement="SequenceFlow_01o2qpv">
+ <di:waypoint x="1140" y="140" />
+ <di:waypoint x="1170" y="140" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0c58sw3_di" bpmnElement="SequenceFlow_0c58sw3">
+ <di:waypoint x="1400" y="140" />
+ <di:waypoint x="1420" y="140" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0926ghe_di" bpmnElement="SequenceFlow_0926ghe">
+ <di:waypoint x="1580" y="165" />
+ <di:waypoint x="1580" y="260" />
+ <di:waypoint x="1090" y="260" />
+ <di:waypoint x="1090" y="180" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1329" y="242" width="13" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0icszw6_di" bpmnElement="Task_0etki1p">
+ <dc:Bounds x="270" y="100" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0npmman_di" bpmnElement="SequenceFlow_0npmman">
+ <di:waypoint x="370" y="140" />
+ <di:waypoint x="430" y="140" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1obnwrr_di" bpmnElement="Task_1iomfas">
+ <dc:Bounds x="1040" y="100" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_159855t_di" bpmnElement="ScriptTask_159855t">
+ <dc:Bounds x="1420" y="100" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_15z9iio_di" bpmnElement="SequenceFlow_15z9iio">
+ <di:waypoint x="1520" y="140" />
+ <di:waypoint x="1555" y="140" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0q83qg3_di" bpmnElement="SequenceFlow_0q83qg3">
+ <di:waypoint x="1270" y="140" />
+ <di:waypoint x="1300" y="140" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0y9ppnc_di" bpmnElement="Task_1qqljvu">
+ <dc:Bounds x="1170" y="100" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_029u1wr_di" bpmnElement="SequenceFlow_029u1wr">
+ <di:waypoint x="530" y="140" />
+ <di:waypoint x="600" y="140" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0f9rjq4_di" bpmnElement="Task_13k9usx">
+ <dc:Bounds x="430" y="100" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_18qkiat_di" bpmnElement="Task_1rc7mcw">
+ <dc:Bounds x="1300" y="100" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoSendCommandToNSSMF.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoSendCommandToNSSMF.bpmn
new file mode 100644
index 0000000000..4f12ca7f41
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoSendCommandToNSSMF.bpmn
@@ -0,0 +1,344 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_13dsy4w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+ <bpmn:collaboration id="Collaboration_0htncd8">
+ <bpmn:participant id="DoSendCommandToNSSMF01" name="DoSendCommandToNSSMF" processRef="DoSendCommandToNSSMF" />
+ </bpmn:collaboration>
+ <bpmn:process id="DoSendCommandToNSSMF" name="DoSendCommandToNSSMF" isExecutable="true">
+ <bpmn:scriptTask id="Task_0qx12sa" name="Get one NSSI info from list" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0umnozs</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1vuuuhr</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ea3pk8</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new DoSendCommandToNSSMF()
+csi.getNSSIformlist(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_18qkm4u" name="Activation completed?">
+ <bpmn:incoming>SequenceFlow_1yjsv5s</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1qxmooy</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1lh0it1</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0swcqw8</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_07yenxg" name="Get successful?">
+ <bpmn:incoming>SequenceFlow_1ea3pk8</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_080lgb0</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1oi86yc</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1vuuuhr" sourceRef="ServiceTask_0myj742" targetRef="Task_0qx12sa" />
+ <bpmn:sequenceFlow id="SequenceFlow_1oeexsj" sourceRef="Task_1a9qxuo" targetRef="ServiceTask_0myj742" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ea3pk8" sourceRef="Task_0qx12sa" targetRef="ExclusiveGateway_07yenxg" />
+ <bpmn:sequenceFlow id="SequenceFlow_1yjsv5s" sourceRef="Task_1y09kt4" targetRef="ExclusiveGateway_18qkm4u" />
+ <bpmn:sequenceFlow id="SequenceFlow_0swcqw8" name="waitting" sourceRef="ExclusiveGateway_18qkm4u" targetRef="Task_08qjojj">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isActivateSuccessfull") == "waitting"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1lh0it1" name="no" sourceRef="ExclusiveGateway_18qkm4u" targetRef="EndEvent_0k52g73">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isActivateSuccessfull") == "false"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1qxmooy" name="yes" sourceRef="ExclusiveGateway_18qkm4u" targetRef="Task_1a9qxuo">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isActivateSuccessfull") == "true"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_080lgb0" name="yes" sourceRef="ExclusiveGateway_07yenxg" targetRef="CallActivity_0018jhc">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isGetSuccessfull") == "true"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_08xfw41" sourceRef="Task_0xfp2r8" targetRef="ExclusiveGateway_0ljwjfh" />
+ <bpmn:sequenceFlow id="SequenceFlow_1s2oozd" name="yes" sourceRef="ExclusiveGateway_0ljwjfh" targetRef="Task_08qjojj">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivated") == "true"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_020xvv4" name="no" sourceRef="ExclusiveGateway_0ljwjfh" targetRef="EndEvent_0k52g73">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivated") == "false"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_10162l8" sourceRef="Task_08qjojj" targetRef="Task_1y09kt4" />
+ <bpmn:sequenceFlow id="SequenceFlow_1pfo460" sourceRef="StartEvent_1" targetRef="ScriptTask_1otgwej" />
+ <bpmn:sequenceFlow id="SequenceFlow_1oi86yc" name="no" sourceRef="ExclusiveGateway_07yenxg" targetRef="EndEvent_0d1g3mv">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isGetSuccessfull") == "false"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:endEvent id="EndEvent_0d1g3mv">
+ <bpmn:incoming>SequenceFlow_1oi86yc</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_1pfo460</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="ScriptTask_1otgwej" name="Preprocess Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1pfo460</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0umnozs</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoSendCommandToNSSMF()
+dcso.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:subProcess id="SubProcess_0iljxjd" name="sub process for fallouthandler and rollback" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_0hmwdqq">
+ <bpmn:outgoing>SequenceFlow_0oiiwjo</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1il80ww" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1wd8iqk">
+ <bpmn:incoming>SequenceFlow_0uckyao</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0oiiwjo" sourceRef="StartEvent_0hmwdqq" targetRef="Task_01ooik6" />
+ <bpmn:sequenceFlow id="SequenceFlow_0uckyao" sourceRef="Task_01ooik6" targetRef="EndEvent_1wd8iqk" />
+ <bpmn:scriptTask id="Task_01ooik6" name="Send Error Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0oiiwjo</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0uckyao</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new DoSendCommandToNSSMF()
+csi.sendSyncError(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ </bpmn:subProcess>
+ <bpmn:sequenceFlow id="SequenceFlow_0umnozs" sourceRef="ScriptTask_1otgwej" targetRef="Task_0qx12sa" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ucjcm1" sourceRef="CallActivity_0018jhc" targetRef="ScriptTask_0q7is68" />
+ <bpmn:endEvent id="EndEvent_0k52g73">
+ <bpmn:incoming>SequenceFlow_020xvv4</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1lh0it1</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_0fypnen" errorRef="Error_08p7hsc" />
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="Task_08qjojj" name="wait for Return" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1s2oozd</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0swcqw8</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_10162l8</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new DoSendCommandToNSSMF()
+csi.WaitForReturn(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_1y09kt4" name="Get the activation status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_10162l8</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1yjsv5s</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new DoSendCommandToNSSMF()
+csi.GetTheStatusOfActivation(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0ljwjfh" name="Activation successful?">
+ <bpmn:incoming>SequenceFlow_08xfw41</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1s2oozd</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_020xvv4</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:scriptTask id="Task_0xfp2r8" name="SendCommandToNssmf" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1a6iu8c</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_08xfw41</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new DoSendCommandToNSSMF()
+csi.SendCommandToNssmf(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_0018jhc" name="Call Decompose Service" calledElement="DecomposeService">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="nssiId" target="serviceInstanceId" />
+ <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
+ <camunda:out source="serviceDecompositionString" target="serviceDecompositionString" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_080lgb0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ucjcm1</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="ScriptTask_0q7is68" name="processDecomposition" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1ucjcm1</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1a6iu8c</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new DoSendCommandToNSSMF()
+csi.processDecomposition(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1a6iu8c" sourceRef="ScriptTask_0q7is68" targetRef="Task_0xfp2r8" />
+ <bpmn:serviceTask id="ServiceTask_0myj742" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1oeexsj</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1vuuuhr</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:scriptTask id="Task_1a9qxuo" name="Update Index" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1qxmooy</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1oeexsj</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new DoSendCommandToNSSMF()
+csi.UpdateIndex(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ </bpmn:process>
+ <bpmn:error id="Error_08p7hsc" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0htncd8">
+ <bpmndi:BPMNShape id="Participant_1x12pgg_di" bpmnElement="DoSendCommandToNSSMF01" isHorizontal="true">
+ <dc:Bounds x="160" y="60" width="2080" height="1000" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0d1g3mv_di" bpmnElement="EndEvent_0d1g3mv">
+ <dc:Bounds x="1642" y="302" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="262" y="302" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0uckyao_di" bpmnElement="SequenceFlow_0uckyao">
+ <di:waypoint x="1120" y="860" />
+ <di:waypoint x="1257" y="860" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0oiiwjo_di" bpmnElement="SequenceFlow_0oiiwjo">
+ <di:waypoint x="843" y="860" />
+ <di:waypoint x="1020" y="860" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_0hmwdqq_di" bpmnElement="StartEvent_0hmwdqq">
+ <dc:Bounds x="807" y="842" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1wd8iqk_di" bpmnElement="EndEvent_1wd8iqk">
+ <dc:Bounds x="1257" y="842" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0s82iw4_di" bpmnElement="Task_0xfp2r8">
+ <dc:Bounds x="1230" y="280" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_18qkm4u_di" bpmnElement="ExclusiveGateway_18qkm4u" isMarkerVisible="true">
+ <dc:Bounds x="835" y="595" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="832" y="558" width="55" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ea3pk8_di" bpmnElement="SequenceFlow_1ea3pk8">
+ <di:waypoint x="770" y="320" />
+ <di:waypoint x="815" y="320" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_08xfw41_di" bpmnElement="SequenceFlow_08xfw41">
+ <di:waypoint x="1330" y="320" />
+ <di:waypoint x="1415" y="320" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1yjsv5s_di" bpmnElement="SequenceFlow_1yjsv5s">
+ <di:waypoint x="1390" y="620" />
+ <di:waypoint x="885" y="620" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0ljwjfh_di" bpmnElement="ExclusiveGateway_0ljwjfh" isMarkerVisible="true">
+ <dc:Bounds x="1415" y="295" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1412" y="265" width="60" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1s2oozd_di" bpmnElement="SequenceFlow_1s2oozd">
+ <di:waypoint x="1440" y="345" />
+ <di:waypoint x="1440" y="420" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1451" y="373" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0k52g73_di" bpmnElement="EndEvent_0k52g73">
+ <dc:Bounds x="1532" y="302" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_020xvv4_di" bpmnElement="SequenceFlow_020xvv4">
+ <di:waypoint x="1465" y="320" />
+ <di:waypoint x="1532" y="320" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1494" y="302" width="12" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_121jfnq_di" bpmnElement="Task_0qx12sa">
+ <dc:Bounds x="670" y="280" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_07yenxg_di" bpmnElement="ExclusiveGateway_07yenxg" isMarkerVisible="true">
+ <dc:Bounds x="815" y="295" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="800" y="353" width="80" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_080lgb0_di" bpmnElement="SequenceFlow_080lgb0">
+ <di:waypoint x="865" y="320" />
+ <di:waypoint x="930" y="320" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="869" y="302" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_10162l8_di" bpmnElement="SequenceFlow_10162l8">
+ <di:waypoint x="1440" y="500" />
+ <di:waypoint x="1440" y="580" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qxmooy_di" bpmnElement="SequenceFlow_1qxmooy">
+ <di:waypoint x="835" y="620" />
+ <di:waypoint x="770" y="620" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="813" y="623" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0aspjme_di" bpmnElement="Task_1a9qxuo">
+ <dc:Bounds x="670" y="580" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_170g0ll_di" bpmnElement="Task_08qjojj">
+ <dc:Bounds x="1390" y="420" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1meh39q_di" bpmnElement="Task_1y09kt4">
+ <dc:Bounds x="1390" y="580" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1lh0it1_di" bpmnElement="SequenceFlow_1lh0it1">
+ <di:waypoint x="860" y="645" />
+ <di:waypoint x="860" y="720" />
+ <di:waypoint x="1550" y="720" />
+ <di:waypoint x="1550" y="338" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1110" y="702" width="12" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0swcqw8_di" bpmnElement="SequenceFlow_0swcqw8">
+ <di:waypoint x="860" y="595" />
+ <di:waypoint x="860" y="460" />
+ <di:waypoint x="1390" y="460" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1067" y="443" width="38" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1oeexsj_di" bpmnElement="SequenceFlow_1oeexsj">
+ <di:waypoint x="720" y="580" />
+ <di:waypoint x="720" y="520" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0myj742_di" bpmnElement="ServiceTask_0myj742">
+ <dc:Bounds x="670" y="440" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1vuuuhr_di" bpmnElement="SequenceFlow_1vuuuhr">
+ <di:waypoint x="720" y="440" />
+ <di:waypoint x="720" y="360" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1pfo460_di" bpmnElement="SequenceFlow_1pfo460">
+ <di:waypoint x="298" y="320" />
+ <di:waypoint x="420" y="320" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1oi86yc_di" bpmnElement="SequenceFlow_1oi86yc">
+ <di:waypoint x="840" y="295" />
+ <di:waypoint x="840" y="230" />
+ <di:waypoint x="1660" y="230" />
+ <di:waypoint x="1660" y="302" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="884" y="212" width="12" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1otgwej_di" bpmnElement="ScriptTask_1otgwej">
+ <dc:Bounds x="420" y="280" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_1hlwd77_di" bpmnElement="SubProcess_0iljxjd" isExpanded="true">
+ <dc:Bounds x="700" y="780" width="810" height="180" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1c5l0io_di" bpmnElement="Task_01ooik6">
+ <dc:Bounds x="1020" y="820" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0umnozs_di" bpmnElement="SequenceFlow_0umnozs">
+ <di:waypoint x="520" y="320" />
+ <di:waypoint x="670" y="320" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_0018jhc_di" bpmnElement="CallActivity_0018jhc">
+ <dc:Bounds x="930" y="280" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ucjcm1_di" bpmnElement="SequenceFlow_1ucjcm1">
+ <di:waypoint x="1030" y="320" />
+ <di:waypoint x="1070" y="320" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0q7is68_di" bpmnElement="ScriptTask_0q7is68">
+ <dc:Bounds x="1070" y="280" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1a6iu8c_di" bpmnElement="SequenceFlow_1a6iu8c">
+ <di:waypoint x="1170" y="320" />
+ <di:waypoint x="1230" y="320" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/HandleOrchestrationTask.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/HandleOrchestrationTask.bpmn
new file mode 100644
index 0000000000..09a14be26b
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/HandleOrchestrationTask.bpmn
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1gbzu9i" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.2">
+ <bpmn:process id="HandleOrchestrationTask" name="HandleOrchestrationTask" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1" name="Start">
+ <bpmn:outgoing>SequenceFlow_0lbtmuu</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="ScriptTask_0r0a9ga" name="Preprocess Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0lbtmuu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0uzjpd6</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def hot = new HandleOrchestrationTask()
+hot.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_1iat8g5" name="Send Orchestration Task Request">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${url}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:script scriptFormat="groovy">execution.getVariable("headerMap")</camunda:script>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${payload}</camunda:inputParameter>
+ <camunda:inputParameter name="method">${method}</camunda:inputParameter>
+ <camunda:outputParameter name="statusCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="response">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0uzjpd6</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_06rrzml</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:scriptTask id="ScriptTask_119zm52" name="Post Process" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_06rrzml</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1qthzdo</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def hot = new HandleOrchestrationTask()
+hot.postProcess(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0uzjpd6" sourceRef="ScriptTask_0r0a9ga" targetRef="ServiceTask_1iat8g5" />
+ <bpmn:sequenceFlow id="SequenceFlow_06rrzml" sourceRef="ServiceTask_1iat8g5" targetRef="ScriptTask_119zm52" />
+ <bpmn:sequenceFlow id="SequenceFlow_0lbtmuu" sourceRef="StartEvent_1" targetRef="ScriptTask_0r0a9ga" />
+ <bpmn:endEvent id="EndEvent_18t5h42" name="End">
+ <bpmn:incoming>SequenceFlow_1qthzdo</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1qthzdo" sourceRef="ScriptTask_119zm52" targetRef="EndEvent_18t5h42" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="HandleOrchestrationTask">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="179" y="103" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="185" y="146" width="25" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0r0a9ga_di" bpmnElement="ScriptTask_0r0a9ga">
+ <dc:Bounds x="284" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1iat8g5_di" bpmnElement="ServiceTask_1iat8g5">
+ <dc:Bounds x="466" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_119zm52_di" bpmnElement="ScriptTask_119zm52">
+ <dc:Bounds x="644" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0uzjpd6_di" bpmnElement="SequenceFlow_0uzjpd6">
+ <di:waypoint x="384" y="121" />
+ <di:waypoint x="466" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_06rrzml_di" bpmnElement="SequenceFlow_06rrzml">
+ <di:waypoint x="566" y="121" />
+ <di:waypoint x="644" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0lbtmuu_di" bpmnElement="SequenceFlow_0lbtmuu">
+ <di:waypoint x="215" y="121" />
+ <di:waypoint x="284" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_18t5h42_di" bpmnElement="EndEvent_18t5h42">
+ <dc:Bounds x="820" y="103" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="828" y="146" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qthzdo_di" bpmnElement="SequenceFlow_1qthzdo">
+ <di:waypoint x="744" y="121" />
+ <di:waypoint x="820" y="121" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
+
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
index aea06b5fc9..d426dc3f66 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java
@@ -20,22 +20,9 @@
package org.onap.so.bpmn.infrastructure.process;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.ok;
-import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
-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.urlEqualTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.fail;
-import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
-import java.io.IOException;
-import java.util.List;
-import java.util.UUID;
+import com.google.protobuf.Struct;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader;
@@ -47,7 +34,21 @@ import org.onap.so.client.aai.AAIVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import com.google.protobuf.Struct;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
+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.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.ok;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.fail;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
/**
@@ -62,10 +63,10 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
private static final String TEST_PROCESSINSTANCE_KEY = "CreateVcpeResCustService_simplified";
private static final AAIVersion VERSION = AAIVersion.LATEST;
+ private static final Map<String, Object> executionVariables = new HashMap();
private String testBusinessKey;
private String requestObject;
private String responseObject;
- private String msoRequestId;
@Autowired
private GrpcNettyServer grpcNettyServer;
@@ -76,25 +77,25 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
requestObject = FileUtil.readResourceFile("request/" + getClass().getSimpleName() + ".json");
responseObject = FileUtil.readResourceFile("response/" + getClass().getSimpleName() + ".json");
- variables.put("bpmnRequest", requestObject);
+ executionVariables.clear();
+
+ executionVariables.put("bpmnRequest", requestObject);
/**
* This variable indicates that the flow was invoked asynchronously. It's injected by {@link WorkflowProcessor}.
*/
- variables.put("isAsyncProcess", "true");
+ executionVariables.put("isAsyncProcess", "true");
/**
* Temporary solution to add pnfCorrelationId to context. this value is getting from the request to SO api
* handler and then convert to CamudaInput
*/
- variables.put("pnfCorrelationId", "PNFDemo");
+ executionVariables.put("pnfCorrelationId", "PNFDemo");
/**
* Create mso-request-id.
*/
- msoRequestId = UUID.randomUUID().toString();
- variables.put("mso-request-id", msoRequestId);
/**
* Create Business key for the process instance
@@ -113,8 +114,11 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
mockAai();
mockDmaapForPnf();
+ final String msoRequestId = UUID.randomUUID().toString();
+ executionVariables.put("mso-request-id", msoRequestId);
+
ProcessInstance pi =
- runtimeService.startProcessInstanceByKey(TEST_PROCESSINSTANCE_KEY, testBusinessKey, variables);
+ runtimeService.startProcessInstanceByKey(TEST_PROCESSINSTANCE_KEY, testBusinessKey, executionVariables);
int waitCount = 10;
while (!isProcessInstanceEnded() && waitCount >= 0) {
@@ -129,14 +133,24 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
"callCompleteMsoProcess_CallActivity", "ScriptTask_2", "CreateVCPE_EndEvent");
List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages();
- assertThat(detailedMessages).hasSize(2);
+ assertThat(detailedMessages.size() == 2);
+ int count = 0;
try {
- checkConfigAssign(detailedMessages.get(0));
- checkConfigDeploy(detailedMessages.get(1));
+ for (ExecutionServiceInput eSI : detailedMessages) {
+ if ("config-assign".equals(eSI.getActionIdentifiers().getActionName())) {
+ checkConfigAssign(eSI, msoRequestId);
+ count++;
+ }
+ if ("config-deploy".equals(eSI.getActionIdentifiers().getActionName())) {
+ checkConfigDeploy(eSI, msoRequestId);
+ count++;
+ }
+ }
} catch (Exception e) {
e.printStackTrace();
fail("ConfigAssign/deploy request exception", e);
}
+ assertThat(count == 2);
}
private boolean isProcessInstanceEnded() {
@@ -144,7 +158,7 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
.singleResult() == null;
}
- private void checkConfigAssign(ExecutionServiceInput executionServiceInput) {
+ private void checkConfigAssign(ExecutionServiceInput executionServiceInput, String msoRequestId) {
logger.info("Checking the configAssign request");
ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
@@ -175,7 +189,7 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest {
.isEqualTo("68dc9a92-214c-11e7-93ae-92361f002680");
}
- private void checkConfigDeploy(ExecutionServiceInput executionServiceInput) {
+ private void checkConfigDeploy(ExecutionServiceInput executionServiceInput, String msoRequestId) {
logger.info("Checking the configDeploy request");
ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSWUPDownloadTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSWUPDownloadTest.java
new file mode 100644
index 0000000000..065d2a54a8
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSWUPDownloadTest.java
@@ -0,0 +1,230 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.process;
+
+import com.google.protobuf.Struct;
+import org.assertj.core.api.Assertions;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
+import org.onap.so.BaseBPMNTest;
+import org.onap.so.GrpcNettyServer;
+import org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.client.aai.AAIVersion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
+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.urlEqualTo;
+import static org.assertj.core.api.Assertions.fail;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+
+/**
+ * Basic Integration test for PNFSWUPDownloadTest.bpmn workflow.
+ */
+public class PNFSWUPDownloadTest extends BaseBPMNTest {
+
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+
+ private static final long WORKFLOW_WAIT_TIME = 1000L;
+
+ private static final String TEST_PROCESSINSTANCE_KEY = "PNFSWUPDownload";
+ private static final AAIVersion VERSION = AAIVersion.LATEST;
+ private static final Map<String, Object> executionVariables = new HashMap();
+ private final String[] actionNames = new String[3];
+ private String responseObject;
+ private String requestObject;
+
+ @Autowired
+ private GrpcNettyServer grpcNettyServer;
+
+ @Before
+ public void setUp() throws IOException {
+
+ actionNames[0] = "preCheck";
+ actionNames[1] = "downloadNESw";
+ actionNames[2] = "postCheck";
+
+ executionVariables.clear();
+
+ requestObject = FileUtil.readResourceFile("request/PNFSoftwareUpgradeTest.json");
+ responseObject = FileUtil.readResourceFile("response/PNFSoftwareUpgradeTest.json");
+
+ executionVariables.put("bpmnRequest", requestObject);
+
+ /**
+ * This variable indicates that the flow was invoked asynchronously. It's injected by {@link WorkflowProcessor}.
+ */
+ executionVariables.put("isAsyncProcess", "true");
+ executionVariables.put(ExecutionVariableNames.PRC_CUSTOMIZATION_UUID, "38dc9a92-214c-11e7-93ae-92361f002680");
+
+ /**
+ * Temporary solution to add pnfCorrelationId to context. this value is getting from the request to SO api
+ * handler and then convert to CamudaInput
+ */
+ executionVariables.put(ExecutionVariableNames.PNF_CORRELATION_ID, "PNFDemo");
+ }
+
+
+ @Test
+ public void workflow_validInput_expectedOutput() throws InterruptedException {
+
+ mockCatalogDb();
+ mockAai();
+
+ final String msoRequestId = UUID.randomUUID().toString();
+ executionVariables.put(ExecutionVariableNames.MSO_REQUEST_ID, msoRequestId);
+
+ final String testBusinessKey = UUID.randomUUID().toString();
+ logger.info("Test the process instance: {} with business key: {}", TEST_PROCESSINSTANCE_KEY, testBusinessKey);
+
+ ProcessInstance pi =
+ runtimeService.startProcessInstanceByKey(TEST_PROCESSINSTANCE_KEY, testBusinessKey, executionVariables);
+
+ int waitCount = 10;
+ while (!isProcessInstanceEnded() && waitCount >= 0) {
+ Thread.sleep(WORKFLOW_WAIT_TIME);
+ waitCount--;
+ }
+
+ // Layout is to reflect the bpmn visual layout
+ assertThat(pi).isEnded().hasPassedInOrder("download_StartEvent", "ServiceTask_1mpt2eq", "ServiceTask_1nl90ao",
+ "ExclusiveGateway_1rj84ne", "ServiceTask_0yavde3", "ExclusiveGateway_1ja7grm", "ServiceTask_1wxo7xz",
+ "ExclusiveGateway_08lusga", "download_EndEvent");
+
+ List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages();
+ assertThat(detailedMessages.size() == 3);
+ int count = 0;
+ try {
+ for (ExecutionServiceInput eSI : detailedMessages) {
+ for (String action : actionNames) {
+ if (action.equals(eSI.getActionIdentifiers().getActionName())
+ && eSI.getCommonHeader().getRequestId().equals(msoRequestId)) {
+ checkWithActionName(eSI, action, msoRequestId);
+ count++;
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("PNFSWUPDownload request exception", e);
+ }
+ assertThat(count == actionNames.length);
+ }
+
+ private boolean isProcessInstanceEnded() {
+ return runtimeService.createProcessInstanceQuery().processDefinitionKey(TEST_PROCESSINSTANCE_KEY)
+ .singleResult() == null;
+ }
+
+ private void checkWithActionName(ExecutionServiceInput executionServiceInput, String action, String msoRequestId) {
+
+ logger.info("Checking the " + action + " request");
+ ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
+
+ /**
+ * the fields of actionIdentifiers should match the one in the response/PNFSoftwareUpgrade_catalogdb.json.
+ */
+ Assertions.assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_pnf_software_upgrade_restconf");
+ Assertions.assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0");
+ Assertions.assertThat(actionIdentifiers.getActionName()).isEqualTo(action);
+ Assertions.assertThat(actionIdentifiers.getMode()).isEqualTo("async");
+
+ CommonHeader commonHeader = executionServiceInput.getCommonHeader();
+ Assertions.assertThat(commonHeader.getOriginatorId()).isEqualTo("SO");
+ Assertions.assertThat(commonHeader.getRequestId()).isEqualTo(msoRequestId);
+
+ Struct payload = executionServiceInput.getPayload();
+ Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue();
+
+ Assertions.assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo");
+ Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue();
+
+ Assertions.assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo");
+ Assertions.assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue())
+ .isEqualTo("32daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ Assertions.assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
+ .isEqualTo("38dc9a92-214c-11e7-93ae-92361f002680");
+ Assertions.assertThat(propertiesStruct.getFieldsOrThrow("target-software-version").getStringValue())
+ .isEqualTo("demo-sw-ver2.0.0");
+ }
+
+ private void mockAai() {
+
+ String aaiPnfEntry =
+ "{ \n" + " \"pnf-name\":\"PNFDemo\",\n" + " \"pnf-id\":\"testtest\",\n" + " \"in-maint\":true,\n"
+ + " \"resource-version\":\"1541720264047\",\n" + " \"swVersion\":\"demo-1.1\",\n"
+ + " \"ipaddress-v4-oam\":\"1.1.1.1\",\n" + " \"ipaddress-v6-oam\":\"::/128\"\n" + "}";
+
+ /**
+ * PUT the PNF correlation ID to AAI.
+ */
+ wireMockServer.stubFor(put(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")));
+
+ /**
+ * Get the PNF entry from AAI.
+ */
+ wireMockServer.stubFor(
+ get(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")).willReturn(okJson(aaiPnfEntry)));
+ }
+
+ /**
+ * Mock the catalobdb rest interface.
+ */
+ private void mockCatalogDb() {
+
+ String catalogdbClientResponse = FileUtil.readResourceFile("response/PNFSoftwareUpgradeTest_catalogdb.json");
+
+
+ /**
+ * Return valid json for the model UUID in the request file.
+ */
+ wireMockServer
+ .stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelUuid=32daaac6-5017-4e1e-96c8-6a27dfbe1421"))
+ .willReturn(okJson(responseObject)));
+
+ /**
+ * Return valid json for the service model InvariantUUID as specified in the request file.
+ */
+ wireMockServer.stubFor(
+ get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=339b7a2f-9524-4dbf-9eee-f2e05521df3f"))
+ .willReturn(okJson(responseObject)));
+
+ /**
+ * Return valid spring data rest json for the service model UUID as specified in the request file.
+ */
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/pnfResourceCustomization/search/findPnfResourceCustomizationByModelUuid?SERVICE_MODEL_UUID=32daaac6-5017-4e1e-96c8-6a27dfbe1421"))
+ .willReturn(okJson(catalogdbClientResponse)));
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java
new file mode 100644
index 0000000000..a9bf4352bf
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java
@@ -0,0 +1,236 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.process;
+
+import com.google.protobuf.Struct;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
+import org.onap.so.BaseBPMNTest;
+import org.onap.so.GrpcNettyServer;
+import org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.client.aai.AAIVersion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
+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.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static org.assertj.core.api.Assertions.fail;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+
+/**
+ * Basic Integration test for PNFSoftwareUpgrade.bpmn workflow.
+ */
+public class PNFSoftwareUpgradeTest extends BaseBPMNTest {
+
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+
+ private static final long WORKFLOW_WAIT_TIME = 1000L;
+
+ private static final String TEST_PROCESSINSTANCE_KEY = "PNFSoftwareUpgrade";
+ private static final AAIVersion VERSION = AAIVersion.LATEST;
+ private static final Map<String, Object> executionVariables = new HashMap();
+ private final String[] actionNames = new String[4];
+ private String requestObject;
+ private String responseObject;
+
+ @Autowired
+ private GrpcNettyServer grpcNettyServer;
+
+ @Before
+ public void setUp() throws IOException {
+ actionNames[0] = "preCheck";
+ actionNames[1] = "downloadNESw";
+ actionNames[2] = "activateNESw";
+ actionNames[3] = "postCheck";
+
+ executionVariables.clear();
+
+ requestObject = FileUtil.readResourceFile("request/" + getClass().getSimpleName() + ".json");
+ responseObject = FileUtil.readResourceFile("response/" + getClass().getSimpleName() + ".json");
+
+ executionVariables.put("bpmnRequest", requestObject);
+
+ /**
+ * This variable indicates that the flow was invoked asynchronously. It's injected by {@link WorkflowProcessor}.
+ */
+ executionVariables.put("isAsyncProcess", "true");
+ executionVariables.put(ExecutionVariableNames.PRC_CUSTOMIZATION_UUID, "38dc9a92-214c-11e7-93ae-92361f002680");
+
+ /**
+ * Temporary solution to add pnfCorrelationId to context. this value is getting from the request to SO api
+ * handler and then convert to CamudaInput
+ */
+ executionVariables.put(ExecutionVariableNames.PNF_CORRELATION_ID, "PNFDemo");
+ }
+
+
+ @Test
+ public void workflow_validInput_expectedOutput() throws InterruptedException {
+
+ mockCatalogDb();
+ mockAai();
+
+ final String msoRequestId = UUID.randomUUID().toString();
+ executionVariables.put(ExecutionVariableNames.MSO_REQUEST_ID, msoRequestId);
+
+ final String testBusinessKey = UUID.randomUUID().toString();
+ logger.info("Test the process instance: {} with business key: {}", TEST_PROCESSINSTANCE_KEY, testBusinessKey);
+
+ ProcessInstance pi =
+ runtimeService.startProcessInstanceByKey(TEST_PROCESSINSTANCE_KEY, testBusinessKey, executionVariables);
+
+ int waitCount = 10;
+ while (!isProcessInstanceEnded() && waitCount >= 0) {
+ Thread.sleep(WORKFLOW_WAIT_TIME);
+ waitCount--;
+ }
+
+ // Layout is to reflect the bpmn visual layout
+ assertThat(pi).isEnded().hasPassedInOrder("softwareUpgrade_startEvent", "ServiceTask_042uz7n",
+ "ServiceTask_0slpahe", "ExclusiveGateway_0x6h0ni", "ServiceTask_0x5cje8", "ExclusiveGateway_0v3l3wv",
+ "ServiceTask_02lxf48", "ExclusiveGateway_0ch3fef", "ServiceTask_0y2uysu", "ExclusiveGateway_1ny9b1z",
+ "softwareUpgrade_endEvent");
+
+ List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages();
+ assertThat(detailedMessages.size() == 4);
+ int count = 0;
+ try {
+ for (ExecutionServiceInput eSI : detailedMessages) {
+ for (String action : actionNames) {
+ if (action.equals(eSI.getActionIdentifiers().getActionName())
+ && eSI.getCommonHeader().getRequestId().equals(msoRequestId)) {
+ checkWithActionName(eSI, action);
+ count++;
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("PNFSoftwareUpgrade request exception", e);
+ }
+ assertThat(count == actionNames.length);
+ }
+
+ private boolean isProcessInstanceEnded() {
+ return runtimeService.createProcessInstanceQuery().processDefinitionKey(TEST_PROCESSINSTANCE_KEY)
+ .singleResult() == null;
+ }
+
+ private void checkWithActionName(ExecutionServiceInput executionServiceInput, String action) {
+
+ logger.info("Checking the " + action + " request");
+ ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
+
+ /**
+ * the fields of actionIdentifiers should match the one in the response/PNFSoftwareUpgrade_catalogdb.json.
+ */
+ assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_pnf_software_upgrade_restconf");
+ assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0");
+ assertThat(actionIdentifiers.getActionName()).isEqualTo(action);
+ assertThat(actionIdentifiers.getMode()).isEqualTo("async");
+
+ CommonHeader commonHeader = executionServiceInput.getCommonHeader();
+ assertThat(commonHeader.getOriginatorId()).isEqualTo("SO");
+
+ Struct payload = executionServiceInput.getPayload();
+ Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue();
+
+ assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo");
+ Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue();
+
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo");
+ assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue())
+ .isEqualTo("32daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
+ .isEqualTo("38dc9a92-214c-11e7-93ae-92361f002680");
+ assertThat(propertiesStruct.getFieldsOrThrow("target-software-version").getStringValue())
+ .isEqualTo("demo-sw-ver2.0.0");
+ }
+
+ private void mockAai() {
+
+ String aaiPnfEntry =
+ "{ \n" + " \"pnf-name\":\"PNFDemo\",\n" + " \"pnf-id\":\"testtest\",\n" + " \"in-maint\":true,\n"
+ + " \"resource-version\":\"1541720264047\",\n" + " \"swVersion\":\"demo-1.1\",\n"
+ + " \"ipaddress-v4-oam\":\"1.1.1.1\",\n" + " \"ipaddress-v6-oam\":\"::/128\"\n" + "}";
+
+ /**
+ * PUT the PNF correlation ID to AAI.
+ */
+ wireMockServer.stubFor(put(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")));
+
+ /**
+ * Get the PNF entry from AAI.
+ */
+ wireMockServer.stubFor(
+ get(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")).willReturn(okJson(aaiPnfEntry)));
+
+ /*
+ * Post the pnf to AAI
+ */
+ wireMockServer.stubFor(post(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")));
+ }
+
+ /**
+ * Mock the catalobdb rest interface.
+ */
+ private void mockCatalogDb() {
+
+ String catalogdbClientResponse =
+ FileUtil.readResourceFile("response/" + getClass().getSimpleName() + "_catalogdb.json");
+
+
+ /**
+ * Return valid json for the model UUID in the request file.
+ */
+ wireMockServer
+ .stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelUuid=32daaac6-5017-4e1e-96c8-6a27dfbe1421"))
+ .willReturn(okJson(responseObject)));
+
+ /**
+ * Return valid json for the service model InvariantUUID as specified in the request file.
+ */
+ wireMockServer.stubFor(
+ get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=339b7a2f-9524-4dbf-9eee-f2e05521df3f"))
+ .willReturn(okJson(responseObject)));
+
+ /**
+ * Return valid spring data rest json for the service model UUID as specified in the request file.
+ */
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/pnfResourceCustomization/search/findPnfResourceCustomizationByModelUuid?SERVICE_MODEL_UUID=32daaac6-5017-4e1e-96c8-6a27dfbe1421"))
+ .willReturn(okJson(catalogdbClientResponse)));
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/request/PNFSoftwareUpgradeTest.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/request/PNFSoftwareUpgradeTest.json
new file mode 100644
index 0000000000..a101118623
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/request/PNFSoftwareUpgradeTest.json
@@ -0,0 +1,54 @@
+{
+ "requestDetails":{
+ "requestInfo":{
+ "source":"VID",
+ "suppressRollback":false,
+ "requestorId":"demo",
+ "productFamilyId":"SWUPid"
+ },
+ "modelInfo":{
+ "modelType":"service",
+ "modelInvariantUuid":"339b7a2f-9524-4dbf-9eee-f2e05521df3f",
+ "modelInvariantId":"339b7a2f-9524-4dbf-9eee-f2e05521df3f",
+ "modelUuid":"32daaac6-5017-4e1e-96c8-6a27dfbe1421",
+ "modelName":"PNF_int_service_2",
+ "modelVersion":"1.0"
+ },
+ "requestParameters":{
+ "userParams":[
+ {
+ "name":"aic_zone",
+ "value":"nova"
+ },
+ {
+ "name":"pnfId",
+ "value":"PNFDemo"
+ },
+ {
+ "name":"targetSoftwareVersion",
+ "value":"demo-sw-ver2.0.0"
+ },
+ {
+ "name":"pnfName",
+ "value":"PNFDemo"
+ }
+ ],
+ "subscriptionServiceType":"SWUP",
+ "aLaCarte":false
+ },
+ "cloudConfiguration":{
+ "lcpCloudRegionId":"regionOne",
+ "tenantId":"09a63533072f4a579d5c99c3b8fe94c6"
+ },
+ "subscriberInfo":{
+ "globalSubscriberId":"ADemoCustomerInEric"
+ },
+ "project":{
+ "projectName":"Project-Demonstration"
+ },
+ "owningEntity":{
+ "owningEntityId":"5eae949c-1c50-4780-b8b5-7cbeb08856b4",
+ "owningEntityName":"OE-Demonstration"
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PNFSoftwareUpgradeTest.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PNFSoftwareUpgradeTest.json
new file mode 100644
index 0000000000..32539844ba
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PNFSoftwareUpgradeTest.json
@@ -0,0 +1,26 @@
+{
+ "serviceResources":{
+ "modelInfo":{
+ "modelInvariantId":"439b7a2f-9524-4dbf-9eee-f2e05521df3f",
+ "modelUuid":"42daaac6-5017-4e1e-96c8-6a27dfbe1421",
+ "modelName":"PNF_int_service_2",
+ "modelVersion":"1.0"
+ },
+ "serviceType":"NA",
+ "environmentContext":"Luna",
+ "serviceRole":"NA",
+ "workloadContext":"Oxygen",
+ "serviceVnfs":[
+
+ ],
+ "serviceNetworks":[
+
+ ],
+ "serviceAllottedResources":[
+
+ ],
+ "configResource":[
+
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PNFSoftwareUpgradeTest_catalogdb.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PNFSoftwareUpgradeTest_catalogdb.json
new file mode 100644
index 0000000000..faec947fec
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PNFSoftwareUpgradeTest_catalogdb.json
@@ -0,0 +1,39 @@
+{
+ "_embedded": {
+ "pnfResourceCustomization": [
+ {
+ "modelCustomizationUUID": "38dc9a92-214c-11e7-93ae-92361f002680",
+ "modelInstanceName": "PNF routing",
+ "created": "2019-03-08 12:00:29.000",
+ "nfFunction": "routing",
+ "nfType": "routing",
+ "nfRole": "routing",
+ "nfNamingCode": "routing",
+ "multiStageDesign": null,
+ "resourceInput": null,
+ "blueprintName": "test_pnf_software_upgrade_restconf",
+ "blueprintVersion": "1.0.0",
+ "skipPostInstConf": false,
+ "softwareVersion": "1.0.0",
+ "creationTimestamp": "2019-03-08T12:00:29.000+0000",
+ "controllerActor": "cds",
+ "_links": {
+ "self": {
+ "href": "http://localhost:41023/pnfResourceCustomization/38dc9a92-214c-11e7-93ae-92361f002680"
+ },
+ "pnfResourceCustomization": {
+ "href": "http://localhost:41023/pnfResourceCustomization/38dc9a92-214c-11e7-93ae-92361f002680"
+ },
+ "pnfResources": {
+ "href": "http://localhost:41023/pnfResourceCustomization/38dc9a92-214c-11e7-93ae-92361f002680/pnfResources"
+ }
+ }
+ }
+ ]
+ },
+ "_links": {
+ "self": {
+ "href": "http://localhost:41023/pnfResourceCustomization/search/findPnfResourceCustomizationByModelUuid?SERVICE_MODEL_UUID=4df8b6de-2083-11e7-93ae-92361f002676"
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml
index d37120b452..cffb67a968 100644
--- a/bpmn/so-bpmn-tasks/pom.xml
+++ b/bpmn/so-bpmn-tasks/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-tasks</artifactId>
@@ -78,6 +78,24 @@
<generateSupportingFiles>false</generateSupportingFiles>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.basedir}/target/generated-sources/src/gen/java/main</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
<dependencyManagement>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
index dab5102efd..a8eb791484 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -53,7 +53,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.AAIObjectPlurals;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
@@ -66,7 +66,7 @@ import org.onap.so.client.orchestration.AAIVfModuleResources;
import org.onap.so.client.orchestration.AAIVnfResources;
import org.onap.so.client.orchestration.AAIVolumeGroupResources;
import org.onap.so.client.orchestration.AAIVpnBindingResources;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
@@ -690,7 +690,7 @@ public class AAICreateTasks {
if (fqdnCount > 0) {
for (int i = 0; i < fqdnCount; i++) {
String fqdn = fqdnList[i];
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy =
aaiNetworkResources.getNetworkPolicy(uri);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
index 15f8c5e4ef..04f47e0306 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
@@ -39,7 +39,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.AAIObjectPlurals;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIConfigurationResources;
@@ -279,7 +279,7 @@ public class AAIDeleteTasks {
if (fqdnCount > 0) {
for (int i = 0; i < fqdnCount; i++) {
String fqdn = fqdnList[i];
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
uri.queryParam(networkPolicyFqdnParam, fqdn);
Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri);
if (oNetPolicies.isPresent()) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index 4d5494d18c..a162088cb2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -5,13 +5,15 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
+ * Modifications Copyright (c) 2019 Bell Canada.
+ * Modifications Copyright (c) 2020 Nokia
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in 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,39 +24,23 @@
package org.onap.so.bpmn.infrastructure.aai.tasks;
-import java.util.List;
-import java.util.Map;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
-import org.onap.so.client.orchestration.AAICollectionResources;
-import org.onap.so.client.orchestration.AAIConfigurationResources;
-import org.onap.so.client.orchestration.AAINetworkResources;
-import org.onap.so.client.orchestration.AAIPnfResources;
-import org.onap.so.client.orchestration.AAIServiceInstanceResources;
-import org.onap.so.client.orchestration.AAIVfModuleResources;
-import org.onap.so.client.orchestration.AAIVnfResources;
-import org.onap.so.client.orchestration.AAIVolumeGroupResources;
+import org.onap.so.client.orchestration.*;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.util.List;
+import java.util.Map;
@Component
public class AAIUpdateTasks {
@@ -85,43 +71,21 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update the status of Service to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) {
- try {
- ServiceInstance serviceInstance =
- extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance,
- OrchestrationStatus.ASSIGNED);
- execution.setVariable("aaiServiceInstanceRollback", true);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedService", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForService(execution, OrchestrationStatus.ASSIGNED);
+ execution.setVariable("aaiServiceInstanceRollback", true);
}
/**
* BPMN access method to update status of Service to Active in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusActiveService(BuildingBlockExecution execution) {
- try {
- ServiceInstance serviceInstance =
- extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance,
- OrchestrationStatus.ACTIVE);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveService", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForService(execution, OrchestrationStatus.ACTIVE);
}
/**
* BPMN access method to update status of Pnf to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignedPnf(BuildingBlockExecution execution) {
updateOrchestrationStatusForPnf(execution, OrchestrationStatus.ASSIGNED);
@@ -129,8 +93,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of Pnf to Active in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusActivePnf(BuildingBlockExecution execution) {
updateOrchestrationStatusForPnf(execution, OrchestrationStatus.ACTIVE);
@@ -150,104 +112,39 @@ public class AAIUpdateTasks {
updateOrchestrationStatusForPnf(execution, OrchestrationStatus.REGISTERED);
}
- private void updateOrchestrationStatusForPnf(BuildingBlockExecution execution, OrchestrationStatus status) {
- try {
- Pnf pnf = extractPojosForBB.extractByKey(execution, ResourceKey.PNF);
- aaiPnfResources.updateOrchestrationStatusPnf(pnf, status);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks during update Orchestration Status to {}", status, ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
/**
* BPMN access method to update status of Vnf to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignedVnf(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ASSIGNED);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVnf", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVnf(execution, OrchestrationStatus.ASSIGNED);
}
/**
* BPMN access method to update status of Vnf to Active in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusActiveVnf(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ACTIVE);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVnf", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVnf(execution, OrchestrationStatus.ACTIVE);
}
/**
* BPMN access method to update status of VolumeGroup to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignedVolumeGroup(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
- volumeGroup.setHeatStackId("");
- aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
- OrchestrationStatus.ASSIGNED);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVolumeGroup", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVolumeGroup(execution, OrchestrationStatus.ASSIGNED);
}
/**
* BPMN access method to update status of VolumeGroup to Active in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusActiveVolumeGroup(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
-
- aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
- OrchestrationStatus.ACTIVE);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVolumeGroup", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVolumeGroup(execution, OrchestrationStatus.ACTIVE);
}
/**
* BPMN access method to update status of VolumeGroup to Created in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusCreatedVolumeGroup(BuildingBlockExecution execution) {
- try {
- GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-
- VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- CloudRegion cloudRegion = gBBInput.getCloudRegion();
-
- aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
- OrchestrationStatus.CREATED);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusCreatedVolumeGroup", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVolumeGroup(execution, OrchestrationStatus.CREATED);
}
/**
@@ -340,7 +237,6 @@ public class AAIUpdateTasks {
* BPMN access method to update status of VfModule to Created in AAI
*
* @param execution
- *
*/
public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {
try {
@@ -357,7 +253,6 @@ public class AAIUpdateTasks {
* BPMN access method to update aaiDeactivateVfModuleRollback to true for deactivating the VfModule
*
* @param execution
- * @throws buildAndThrowWorkflowException
*/
public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiDeactivateVfModuleRollback", false);
@@ -794,7 +689,6 @@ public class AAIUpdateTasks {
logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfigureVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
-
}
/**
@@ -806,11 +700,104 @@ public class AAIUpdateTasks {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURED);
-
} catch (Exception ex) {
logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfiguredVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
+ }
+
+ /**
+ * BPMN access method to update status of VNF/VF-Module based on SO scope and action.
+ *
+ * @param execution - BuildingBlockExecution
+ * @param scope - SO scope (vnf/vfModule)
+ * @param action - action (configAssign/configDeploy/configUndeploy etc..)
+ */
+ public void updateOrchestrationStatusForCds(BuildingBlockExecution execution, String scope, String action) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ OrchestrationStatus status = getOrchestrationStatus(action);
+ switch (scope) {
+ case "vnf":
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf, status);
+ break;
+ case "vfModule":
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, status);
+ break;
+ default:
+ throw new IllegalArgumentException(
+ "Invalid scope to update orchestration status for CDS : " + action);
+ }
+ } catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusForCds", ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ private OrchestrationStatus getOrchestrationStatus(String action) {
+ /**
+ * At this state, OrcherstationStatus enum associated with configAssign and configDeploy. I am not sure which is
+ * the correct approach. 1. Are we going to map each specific action to OrchestrationStauts ? 2. We will have
+ * only one generic status for all actions ?
+ */
+
+ switch (action) {
+ case "configAssign":
+ return OrchestrationStatus.ASSIGNED;
+ case "configDeploy":
+ return OrchestrationStatus.CONFIGURED;
+ default:
+ throw new IllegalArgumentException("Invalid action to set Orchestration status: " + action);
+ }
+ }
+
+ private void updateOrchestrationStatusForService(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, status);
+ } catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks during update orchestration status to {} for service",
+ status, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+ private void updateOrchestrationStatusForPnf(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ Pnf pnf = extractPojosForBB.extractByKey(execution, ResourceKey.PNF);
+ aaiPnfResources.updateOrchestrationStatusPnf(pnf, status);
+ } catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks during update Orchestration Status to {}", status, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
}
+
+ private void updateOrchestrationStatusForVnf(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf, status);
+ } catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks during update orchestration status to {} for vnf",
+ status, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ private void updateOrchestrationStatusForVolumeGroup(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ if (status.equals(OrchestrationStatus.ASSIGNED)) {
+ volumeGroup.setHeatStackId("");
+ }
+ aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup,
+ execution.getGeneralBuildingBlock().getCloudRegion(), status);
+ } catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks during update orchestration status to {} for "
+ + "volume group", status, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index 4522f7f2e7..415d4614da 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -42,7 +42,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.client.exception.ExceptionBuilder;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
index 4285e9aa84..663b097b78 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
@@ -121,7 +121,7 @@ public class VnfAdapterCreateTasks {
try {
volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
} catch (BBObjectNotFoundException bbException) {
- logger.error("Exception occurred if bb objrct not found in VnfAdapterCreateTasks createVfModule ",
+ logger.error("Exception occurred if bb object not found in VnfAdapterCreateTasks createVfModule ",
bbException);
}
CloudRegion cloudRegion = gBBInput.getCloudRegion();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
index e5f28aa4c3..8b78560521 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
@@ -38,7 +38,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.exceptions.MarshallerException;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
index 79ccd9216f..332c390c7d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
@@ -6,12 +6,14 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in 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 +31,6 @@ import java.util.Optional;
import org.onap.so.logger.LoggingAnchor;
import org.json.JSONArray;
import org.json.JSONObject;
-import org.onap.aai.domain.yang.Vserver;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.core.json.JsonUtils;
@@ -49,7 +50,7 @@ import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIVnfResources;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -143,7 +144,7 @@ public class AppcRunTasks {
ControllerSelectionReference controllerSelectionReference = catalogDbClient
.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString());
- String controllerType = null;
+ String controllerType;
if (controllerSelectionReference != null) {
controllerType = controllerSelectionReference.getControllerName();
} else {
@@ -191,13 +192,13 @@ public class AppcRunTasks {
logger.error("Error Message: {}", appcMessage);
logger.error("ERROR CODE: {}", appcCode);
logger.trace("End of runAppCommand ");
- if (appcCode != null && !appcCode.equals("0")) {
+ if (appcCode != null && !"0".equals(appcCode)) {
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
}
}
protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) {
- if (appcCode != null && appcCode.equals("0") && action != null) {
+ if ("0".equals(appcCode) && action != null) {
if (action.equals(Action.Lock)) {
execution.setVariable(ROLLBACK_VNF_LOCK, true);
} else if (action.equals(Action.Unlock)) {
@@ -216,7 +217,7 @@ public class AppcRunTasks {
private HashMap<String, String> buildPayloadInfo(String vnfName, String aicIdentity, String vnfHostIpAddress,
String vmIdList, String vserverIdList, String identityUrl, String vfModuleId) {
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ HashMap<String, String> payloadInfo = new HashMap<>();
payloadInfo.put("vnfName", vnfName);
payloadInfo.put("aicIdentity", aicIdentity);
payloadInfo.put("vnfHostIpAddress", vnfHostIpAddress);
@@ -242,44 +243,39 @@ public class AppcRunTasks {
return payload;
}
- protected void getVserversForAppc(BuildingBlockExecution execution, GenericVnf vnf) throws Exception {
+ protected void getVserversForAppc(BuildingBlockExecution execution, GenericVnf vnf) throws RuntimeException {
AAIResultWrapper aaiRW = aaiVnfResources.queryVnfWrapperById(vnf);
- if (aaiRW != null && aaiRW.getRelationships() != null && aaiRW.getRelationships().isPresent()) {
- Relationships relationships = aaiRW.getRelationships().get();
- if (relationships != null) {
- List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER);
- JSONArray vserverIds = new JSONArray();
- JSONArray vserverSelfLinks = new JSONArray();
- if (vserverUris != null) {
- for (AAIResourceUri j : vserverUris) {
- if (j != null) {
- if (j.getURIKeys() != null) {
- String vserverId = j.getURIKeys().get("vserver-id");
- vserverIds.put(vserverId);
- }
- Optional<Vserver> oVserver = aaiVnfResources.getVserver(j);
- if (oVserver.isPresent()) {
- Vserver vserver = oVserver.get();
- if (vserver != null) {
- String vserverSelfLink = vserver.getVserverSelflink();
- vserverSelfLinks.put(vserverSelfLink);
- }
- }
- }
+ if (aaiRW == null || aaiRW.getRelationships() == null || !aaiRW.getRelationships().isPresent()) {
+ return;
+ }
+ Relationships relationships = aaiRW.getRelationships().get();
+ List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER);
+ JSONArray vserverIds = new JSONArray();
+ JSONArray vserverSelfLinks = new JSONArray();
+ if (vserverUris != null) {
+ for (AAIResourceUri j : vserverUris) {
+ if (j != null) {
+ if (j.getURIKeys() != null) {
+ String vserverId = j.getURIKeys().get("vserver-id");
+ vserverIds.put(vserverId);
}
+ aaiVnfResources.getVserver(j).ifPresent((vserver) -> {
+ String vserverSelfLink = vserver.getVserverSelflink();
+ vserverSelfLinks.put(vserverSelfLink);
+ });
}
-
- JSONObject vmidsArray = new JSONObject();
- JSONObject vserveridsArray = new JSONObject();
- vmidsArray.put("vmIds", vserverSelfLinks.toString());
- vserveridsArray.put("vserverIds", vserverIds.toString());
- logger.debug("vmidsArray is: {}", vmidsArray.toString());
- logger.debug("vserveridsArray is: {}", vserveridsArray.toString());
-
- execution.setVariable("vmIdList", vmidsArray.toString());
- execution.setVariable("vserverIdList", vserveridsArray.toString());
}
}
+
+ JSONObject vmidsArray = new JSONObject();
+ JSONObject vserveridsArray = new JSONObject();
+ vmidsArray.put("vmIds", vserverSelfLinks.toString());
+ vserveridsArray.put("vserverIds", vserverIds.toString());
+ logger.debug("vmidsArray is: {}", vmidsArray.toString());
+ logger.debug("vserveridsArray is: {}", vserveridsArray.toString());
+
+ execution.setVariable("vmIdList", vmidsArray.toString());
+ execution.setVariable("vserverIdList", vserveridsArray.toString());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/LcmControllerDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/LcmControllerDE.java
index 95e270a071..40034aa26c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/LcmControllerDE.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/LcmControllerDE.java
@@ -24,7 +24,6 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.controller.ControllerPreparable;
-import org.onap.so.client.appc.ApplicationControllerAction;
import org.onap.so.client.exception.ExceptionBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,9 +43,6 @@ public abstract class LcmControllerDE implements ControllerRunnable<DelegateExec
@Autowired
protected List<ControllerPreparable<DelegateExecution>> prepareList;
- @Autowired
- protected ApplicationControllerAction client;
-
@Override
public void prepare(ControllerContext<DelegateExecution> context) {
prepareList.stream().filter(prepare -> prepare.understand(context))
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/CdsControllerDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/PnfConfigCdsControllerDE.java
index 6b0cbc0396..ffd49e6b84 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/CdsControllerDE.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/PnfConfigCdsControllerDE.java
@@ -24,6 +24,7 @@ import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.controller.ControllerPreparable;
import org.onap.so.client.cds.AbstractCDSProcessingBBUtils;
+import org.onap.so.client.cds.PayloadConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -31,14 +32,23 @@ import org.springframework.stereotype.Component;
* This implementation of {@ref ControllerRunnable} is used for Self service, i.e, blueprint based Controller.
*/
@Component
-public class CdsControllerDE extends AbstractCDSProcessingBBUtils implements ControllerRunnable<DelegateExecution> {
+public class PnfConfigCdsControllerDE implements ControllerRunnable<DelegateExecution> {
+
+ private static final String ASSIGN_ACTION = "config-assign";
+ private static final String DEPLOY_ACTION = "config-deploy";
@Autowired(required = false)
private List<ControllerPreparable<DelegateExecution>> prepareList;
+ @Autowired
+ private AbstractCDSProcessingBBUtils cdsDispatcher;
+
@Override
public Boolean understand(ControllerContext<DelegateExecution> context) {
- return context.getControllerActor().equalsIgnoreCase("cds");
+ return PayloadConstants.CDS_ACTOR.equalsIgnoreCase(context.getControllerActor())
+ && PayloadConstants.PNF_SCOPE.equalsIgnoreCase(context.getControllerScope())
+ && (ASSIGN_ACTION.equalsIgnoreCase(context.getControllerAction())
+ || DEPLOY_ACTION.equalsIgnoreCase(context.getControllerAction())); // legacy behavior
}
@Override
@@ -55,7 +65,7 @@ public class CdsControllerDE extends AbstractCDSProcessingBBUtils implements Con
@Override
public void run(ControllerContext<DelegateExecution> context) {
DelegateExecution execution = context.getExecution();
- constructExecutionServiceInputObject(execution);
- sendRequestToCDSClient(execution);
+ cdsDispatcher.constructExecutionServiceInputObject(execution);
+ cdsDispatcher.sendRequestToCDSClient(execution);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/common/SoPropertyConstants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/common/SoPropertyConstants.java
new file mode 100644
index 0000000000..badce18a51
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/common/SoPropertyConstants.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.common;
+
+public interface SoPropertyConstants {
+ String TARGET_SOFTWARE_VERSION = "targetSoftwareVersion";
+
+ String SO_ACTION = "action";
+ String SO_ACTION_MODE = "mode";
+
+ String ACTION_ACTIVATE_N_E_SW = "activateNESw";
+ String ACTION_DOWNLOAD_N_E_SW = "downloadNESw";
+ String ACTION_POST_CHECK = "postCheck";
+ String ACTION_PRE_CHECK = "preCheck";
+
+ String CONTROLLER_STATUS = "ControllerStatus";
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SDNCLcmPayloadBuilder.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SDNCLcmPayloadBuilder.java
new file mode 100644
index 0000000000..b29009ff1d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SDNCLcmPayloadBuilder.java
@@ -0,0 +1,153 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.sdnc;
+
+import java.util.Arrays;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.core.json.JsonUtils;
+import org.onap.so.client.sdnc.lcm.beans.payload.*;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.REQUEST_PAYLOAD;
+import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.common.SoPropertyConstants;
+
+public class SDNCLcmPayloadBuilder {
+
+ private static Logger logger = LoggerFactory.getLogger(SDNCLcmPayloadBuilder.class);
+
+ public static ActivateNESwPayload buildActivateNESwPayload(DelegateExecution execution) {
+ String requestPayload = String.valueOf(execution.getVariable(REQUEST_PAYLOAD));
+
+ ActivateNESwPayload activateNESwPayload = new ActivateNESwPayload();
+
+ String ipaddressV4Oam = JsonUtils.getJsonValue(requestPayload, "ipaddressV4Oam");
+ activateNESwPayload.setIpaddressV4Oam(ipaddressV4Oam);
+
+ String targetSwVersion = String.valueOf(execution.getVariable(SoPropertyConstants.TARGET_SOFTWARE_VERSION));
+ if (targetSwVersion == null) {
+ targetSwVersion = JsonUtils.getJsonValue(requestPayload, "targetSwVersion");
+ }
+ activateNESwPayload.setSwVersionToBeActivated(targetSwVersion);
+
+ String playbookName = JsonUtils.getJsonValue(requestPayload, "activateNESwPlaybook");
+ if (playbookName != null) {
+ activateNESwPayload.setPlaybookName(playbookName);
+ }
+
+ return activateNESwPayload;
+ }
+
+ public static DownloadNESwPayload buildDownloadNESwPayload(DelegateExecution execution) {
+ String requestPayload = String.valueOf(execution.getVariable(REQUEST_PAYLOAD));
+
+ DownloadNESwPayload downloadNESwPayload = new DownloadNESwPayload();
+
+ String ipaddressV4Oam = JsonUtils.getJsonValue(requestPayload, "ipaddressV4Oam");
+ downloadNESwPayload.setIpaddressV4Oam(ipaddressV4Oam);
+
+ String swToBeDownloadedString = JsonUtils.getJsonValue(requestPayload, "swToBeDownloaded");
+ SwToBeDownloadedElement[] swToBeDownloadedArray;
+
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ swToBeDownloadedArray = mapper.readValue(swToBeDownloadedString, SwToBeDownloadedElement[].class);
+ downloadNESwPayload.setSwToBeDownloaded(Arrays.asList(swToBeDownloadedArray));
+ } catch (Exception e) {
+ logger.error("Parse SwToBeDownloaded error: ", e);
+ }
+
+ String playbookName = JsonUtils.getJsonValue(requestPayload, "downloadNESwPlaybook");
+ if (playbookName != null) {
+ downloadNESwPayload.setPlaybookName(playbookName);
+ }
+
+ return downloadNESwPayload;
+ }
+
+ public static UpgradePostCheckPayload buildUpgradePostCheckPayload(DelegateExecution execution) {
+ String requestPayload = String.valueOf(execution.getVariable(REQUEST_PAYLOAD));
+
+ UpgradePostCheckPayload upgradePostCheckPayload = new UpgradePostCheckPayload();
+
+ String ipaddressV4Oam = JsonUtils.getJsonValue(requestPayload, "ipaddressV4Oam");
+ upgradePostCheckPayload.setIpaddressV4Oam(ipaddressV4Oam);
+
+ String oldSwVersion = JsonUtils.getJsonValue(requestPayload, "oldSwVersion");
+ upgradePostCheckPayload.setOldSwVersion(oldSwVersion);
+
+ String targetSwVersion = String.valueOf(execution.getVariable(SoPropertyConstants.TARGET_SOFTWARE_VERSION));
+ if (targetSwVersion == null) {
+ targetSwVersion = JsonUtils.getJsonValue(requestPayload, "targetSwVersion");
+ }
+ upgradePostCheckPayload.setTargetSwVersion(targetSwVersion);
+
+ String ruleName = JsonUtils.getJsonValue(requestPayload, "postCheckRuleName");
+ upgradePostCheckPayload.setRuleName(ruleName);
+
+ String additionalData = JsonUtils.getJsonValue(requestPayload, "postCheckAdditionalData");
+ upgradePostCheckPayload.setAdditionalData(additionalData);
+
+ String playbookName = JsonUtils.getJsonValue(requestPayload, "postCheckPlaybook");
+ if (playbookName != null) {
+ upgradePostCheckPayload.setPlaybookName(playbookName);
+ }
+
+ return upgradePostCheckPayload;
+ }
+
+ public static UpgradePreCheckPayload buildUpgradePreCheckPayload(DelegateExecution execution) {
+ String requestPayload = String.valueOf(execution.getVariable(REQUEST_PAYLOAD));
+
+ UpgradePreCheckPayload upgradePreCheckPayload = new UpgradePreCheckPayload();
+
+ String ipaddressV4Oam = JsonUtils.getJsonValue(requestPayload, "ipaddressV4Oam");
+ upgradePreCheckPayload.setIpaddressV4Oam(ipaddressV4Oam);
+
+ String oldSwVersion = JsonUtils.getJsonValue(requestPayload, "oldSwVersion");
+ upgradePreCheckPayload.setOldSwVersion(oldSwVersion);
+
+ String targetSwVersion = String.valueOf(execution.getVariable(SoPropertyConstants.TARGET_SOFTWARE_VERSION));
+ if (targetSwVersion == null) {
+ targetSwVersion = JsonUtils.getJsonValue(requestPayload, "targetSwVersion");
+ }
+ upgradePreCheckPayload.setTargetSwVersion(targetSwVersion);
+
+ String ruleName = JsonUtils.getJsonValue(requestPayload, "preCheckRuleName");
+ upgradePreCheckPayload.setRuleName(ruleName);
+
+ String additionalData = JsonUtils.getJsonValue(requestPayload, "preCheckAdditionalData");
+ upgradePreCheckPayload.setAdditionalData(additionalData);
+
+ String playbookName = JsonUtils.getJsonValue(requestPayload, "preCheckPlaybook");
+ if (playbookName != null) {
+ upgradePreCheckPayload.setPlaybookName(playbookName);
+ }
+
+ return upgradePreCheckPayload;
+ }
+
+ public static String convertToSting(Object msgObject) throws JsonProcessingException {
+ ObjectMapper mapper = new ObjectMapper();
+ return mapper.writeValueAsString(msgObject);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java
index db0d402f6e..ed865e058f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix
+ * Modifications Copyright (C) 2020 Huawei
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,16 +20,24 @@
package org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.sdnc;
+import java.util.List;
+import java.util.UUID;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.stereotype.Component;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.common.SoPropertyConstants;
import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.LcmControllerDE;
-import org.springframework.stereotype.Component;
+import org.onap.so.client.sdnc.common.SDNCConstants;
+import org.onap.so.client.sdnc.lcm.*;
+import org.onap.so.client.sdnc.lcm.beans.*;
+import org.onap.so.client.sdnc.lcm.beans.payload.*;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.REQUEST_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.REQUEST_PAYLOAD;
-/**
- * This class is created to demonstrate how to support {@link DelegateExecution} API based SDNC controller.
- *
- * Function wise, it's similar to the Appc Controller, like in the AppcClient groovy code.
- */
@Component
public class SdncControllerDE extends LcmControllerDE {
@@ -44,14 +53,33 @@ public class SdncControllerDE extends LcmControllerDE {
return true;
}
- /**
- * This method is left empty intentionally. If you are planning to use the SDNC Controller, please implement here.
- *
- * You can use the {@ref ApplicationControllerAction}, {@ref ApplicationControllerOrchestrator},
- * {@ref ApplicationControllerClient} or create your own SDNC Client proxy.
- */
@Override
protected int callLcmClient(ControllerContext<DelegateExecution> context) {
+ DelegateExecution execution = context.getExecution();
+
+ logger.debug("Running activity for id: {}, name: {}", execution.getCurrentActivityId(),
+ execution.getCurrentActivityName());
+
+ boolean result;
+ try {
+ LcmInput lcmInput = buildLcmInput(execution);
+ if (lcmInput != null) {
+ result = sendLcmRequest(execution, lcmInput);
+ } else {
+ logger.error("Build LCM Input error");
+ result = false;
+ }
+ } catch (Exception e) {
+ logger.error("Call SDNC LCM Client failure: ", e);
+ result = false;
+ }
+
+ if (result) {
+ execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Success");
+ } else {
+ execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Failure");
+ }
+
return 0;
}
@@ -59,4 +87,177 @@ public class SdncControllerDE extends LcmControllerDE {
protected int getErrorCode() {
return SDNC_DELEGATE_EXECUTION_ERROR_CODE;
}
+
+ private LcmOutput sendSyncRequest(String operation, LcmInput lcmInput) {
+ SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder();
+ SDNCLcmRestClient sdncLcmRestClient;
+ try {
+ sdncLcmRestClient = sdncLcmClientBuilder.newSDNCLcmRestClient(operation);
+ } catch (SDNCLcmClientBuilderException e) {
+ logger.error("Create SDNCLcmRestClient error: ", e);
+ return null;
+ }
+
+ return sdncLcmRestClient.sendRequest(lcmInput);
+ }
+
+ private LcmOutput selectLcmOutputFromDmaapResponses(List<LcmDmaapResponse> lcmDmaapResponses, LcmInput lcmInput) {
+ String expectedCorrelationId =
+ lcmInput.getCommonHeader().getRequestId() + "-" + lcmInput.getCommonHeader().getSubRequestId();
+
+ for (LcmDmaapResponse lcmDmaapResponse : lcmDmaapResponses) {
+ String correlationId = lcmDmaapResponse.getCorrelationId();
+ if (expectedCorrelationId.equals(correlationId)) {
+ return lcmDmaapResponse.getBody().getOutput();
+ }
+ }
+
+ return null;
+ }
+
+ private LcmOutput sendAsyncRequest(String operation, LcmInput lcmInput) {
+ SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder();
+ SDNCLcmDmaapClient sdncLcmDmaapClient;
+ try {
+ sdncLcmDmaapClient = sdncLcmClientBuilder.newSDNCLcmDmaapClient();
+ } catch (SDNCLcmClientBuilderException e) {
+ logger.error("Create SDNCLcmDmaapClient error: ", e);
+ return null;
+ }
+
+ LcmDmaapRequest lcmDmaapRequest = SDNCLcmMessageBuilder.buildLcmDmaapRequest(operation, lcmInput);
+ try {
+ sdncLcmDmaapClient.sendRequest(lcmDmaapRequest);
+ } catch (Exception e) {
+ logger.error("SDNCLcmDmaapClient sends request error: ", e);
+ return null;
+ }
+
+ long timeout = sdncLcmClientBuilder.getSDNCLcmProperties().getActionTimeout();
+ long startTime = System.currentTimeMillis();
+ while (true) {
+ List<LcmDmaapResponse> lcmDmaapResponses = sdncLcmDmaapClient.getResponse();
+ if (lcmDmaapResponses.size() > 0) {
+ LcmOutput lcmOutput = selectLcmOutputFromDmaapResponses(lcmDmaapResponses, lcmInput);
+ if (lcmOutput != null) {
+ return lcmOutput;
+ }
+ }
+
+ long stopTime = System.currentTimeMillis();
+ if ((stopTime - startTime) > timeout) {
+ logger.error("Timeout for SDNC LCM action {}", lcmInput.getAction());
+ return null;
+ }
+ }
+ }
+
+ public static String toLowerHyphen(String lcmAction) {
+ String regex = "([a-z0-9A-Z])(?=[A-Z])";
+ String replacement = "$1-";
+ return lcmAction.replaceAll(regex, replacement).toLowerCase();
+ }
+
+ private LcmInput buildLcmInput(DelegateExecution execution) throws JsonProcessingException {
+ String requestId = String.valueOf(execution.getVariable(REQUEST_ID));
+ String requestAction = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION));
+ String pnfName = String.valueOf(execution.getVariable(PNF_CORRELATION_ID));
+ logger.debug(String.format("requestId: %s, action: %s, pnfName: %s", requestId, requestAction, pnfName));
+
+ String requestPayload = String.valueOf(execution.getVariable(REQUEST_PAYLOAD));
+ logger.debug("SO request payload: " + requestPayload);
+
+ String lcmAction;
+ String lcmPayload;
+
+ switch (requestAction) {
+ case SoPropertyConstants.ACTION_PRE_CHECK:
+ lcmAction = SDNCLcmActionConstants.UPGRADE_PRE_CHECK;
+
+ UpgradePreCheckPayload upgradePreCheckPayload;
+ upgradePreCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePreCheckPayload(execution);
+ lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePreCheckPayload);
+ break;
+ case SoPropertyConstants.ACTION_DOWNLOAD_N_E_SW:
+ lcmAction = SDNCLcmActionConstants.DOWNLOAD_N_E_SW;
+
+ DownloadNESwPayload downloadNESwPayload;
+ downloadNESwPayload = SDNCLcmPayloadBuilder.buildDownloadNESwPayload(execution);
+ lcmPayload = SDNCLcmPayloadBuilder.convertToSting(downloadNESwPayload);
+ break;
+ case SoPropertyConstants.ACTION_ACTIVATE_N_E_SW:
+ lcmAction = SDNCLcmActionConstants.ACTIVATE_N_E_SW;
+
+ ActivateNESwPayload activateNESwPayload;
+ activateNESwPayload = SDNCLcmPayloadBuilder.buildActivateNESwPayload(execution);
+ lcmPayload = SDNCLcmPayloadBuilder.convertToSting(activateNESwPayload);
+ break;
+ case SoPropertyConstants.ACTION_POST_CHECK:
+ lcmAction = SDNCLcmActionConstants.UPGRADE_POST_CHECK;
+
+ UpgradePostCheckPayload upgradePostCheckPayload;
+ upgradePostCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePostCheckPayload(execution);
+ lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePostCheckPayload);
+ break;
+ default:
+ logger.error("Unsupported SO Action: " + requestAction);
+ return null;
+ }
+
+ logger.debug("SDNC LCM payload for {}: {}", lcmAction, lcmPayload);
+
+ String subRequestId = UUID.randomUUID().toString();
+ LcmInput lcmInput =
+ SDNCLcmMessageBuilder.buildLcmInputForPnf(requestId, subRequestId, pnfName, lcmAction, lcmPayload);
+
+ ObjectMapper mapper = new ObjectMapper();
+ String lcmInputMsg = mapper.writeValueAsString(lcmInput);
+ logger.debug("SDNC input message:\n" + lcmInputMsg);
+
+ return lcmInput;
+ }
+
+ private boolean parseLcmOutput(LcmOutput lcmOutput, String lcmAction) {
+ if (lcmOutput == null) {
+ logger.error("Call SDNC LCM API failure");
+ return false;
+ }
+
+ LcmStatus lcmStatus = lcmOutput.getStatus();
+
+ if (lcmStatus.getCode() == SDNCConstants.LCM_OUTPUT_SUCCESS_CODE) {
+ logger.debug("Call SDNC LCM API success: " + lcmStatus.getMessage());
+ } else {
+ logger.error("Call SDNC LCM API failure: " + lcmStatus.getMessage());
+ }
+
+ String outputPayload = lcmOutput.getPayload();
+ logger.debug("SDNC LCM action: {}, result: {}", lcmAction, outputPayload);
+ if (outputPayload != null) {
+ String result = JsonUtils.getJsonValue(outputPayload, "result");
+ if ("Success".equals(result)) {
+ logger.debug("Run SDNC LCM action {} success", lcmAction);
+ return true;
+ } else {
+ String reason = JsonUtils.getJsonValue(outputPayload, "reason");
+ logger.error("Run SDNC LCM action {} failure, reason: {}", lcmAction, reason);
+ }
+ }
+
+ return false;
+ }
+
+ private boolean sendLcmRequest(DelegateExecution execution, LcmInput lcmInput) {
+ String actionMode = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION_MODE));
+ String lcmOperation = toLowerHyphen(lcmInput.getAction());
+
+ LcmOutput lcmOutput;
+ if ("async".equals(actionMode)) {
+ lcmOutput = sendAsyncRequest(lcmOperation, lcmInput);
+ } else {
+ lcmOutput = sendSyncRequest(lcmOperation, lcmInput);
+ }
+
+ return parseLcmOutput(lcmOutput, lcmInput.getAction());
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
index ff9d7376de..7930a33a2a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
@@ -39,7 +39,7 @@ import org.onap.so.client.appc.ApplicationControllerAction;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java
new file mode 100644
index 0000000000..f568026aa5
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBB.java
@@ -0,0 +1,92 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Bell Canada
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.AbstractCDSProcessingBBUtils;
+import org.onap.so.client.cds.GeneratePayloadForCds;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * For Vnf/Vf-Module/Service BuildingBlockExecution is being used.
+ *
+ * @param - BuildingBlockExecution
+ */
+@Component
+public class GenericCDSProcessingBB implements ControllerRunnable<BuildingBlockExecution> {
+ private static final Logger logger = LoggerFactory.getLogger(GenericCDSProcessingBB.class);
+ private static final String EXECUTION_OBJECT = "executionObject";
+ public static final String CDS_ACTOR = "cds";
+ public static final String VNF_SCOPE = "vnf";
+ public static final String VF_MODULE_SCOPE = "vf-module";
+
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private AbstractCDSProcessingBBUtils cdsDispather;
+
+ @Autowired
+ private GeneratePayloadForCds generatePayloadForCds;
+
+ @Override
+ public Boolean understand(ControllerContext<BuildingBlockExecution> context) {
+ String scope = context.getControllerScope();
+ return CDS_ACTOR.equalsIgnoreCase(context.getControllerActor())
+ && (VNF_SCOPE.equalsIgnoreCase(scope) || VF_MODULE_SCOPE.equalsIgnoreCase(scope));
+ }
+
+ @Override
+ public Boolean ready(ControllerContext<BuildingBlockExecution> context) {
+ return true;
+ }
+
+ @Override
+ public void prepare(ControllerContext<BuildingBlockExecution> context) {
+ BuildingBlockExecution buildingBlockExecution = context.getExecution();
+ try {
+ AbstractCDSPropertiesBean abstractCDSPropertiesBean =
+ generatePayloadForCds.buildCdsPropertiesBean(buildingBlockExecution);
+ buildingBlockExecution.setVariable(EXECUTION_OBJECT, abstractCDSPropertiesBean);
+ } catch (Exception ex) {
+ logger.error("An exception occurred when creating payload for CDS request", ex);
+ exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, ex);
+ }
+ }
+
+ @Override
+ public void run(ControllerContext<BuildingBlockExecution> context) {
+ BuildingBlockExecution obj = context.getExecution();
+ cdsDispather.constructExecutionServiceInputObject(obj);
+ cdsDispather.sendRequestToCDSClient(obj);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java
new file mode 100644
index 0000000000..a1e513fd47
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java
@@ -0,0 +1,166 @@
+/*
+ * ============LICENSE_START======================================================= Copyright (C) 2020 Nokia. 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.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import com.google.gson.JsonObject;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.AbstractCDSProcessingBBUtils;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.cds.PayloadConstants;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.util.UUID;
+import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_NAME;
+import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_VERSION;
+import static org.onap.so.client.cds.PayloadConstants.RESOLUTION_KEY;
+import static org.onap.so.client.cds.PayloadConstants.REQUEST;
+import static org.onap.so.client.cds.PayloadConstants.SEPARATOR;
+import static org.onap.so.client.cds.PayloadConstants.PROPERTIES;
+
+@Component
+public class GenericPnfCDSControllerRunnableBB implements ControllerRunnable<BuildingBlockExecution> {
+
+ private static final Logger logger = LoggerFactory.getLogger(GenericPnfCDSControllerRunnableBB.class);
+ private static final String EXECUTION_OBJECT = "executionObject";
+ private static final String ORIGINATOR_ID = "SO";
+ private static final String BUILDING_BLOCK = "buildingBlock";
+ private static final String DEFAULT_SYNC_MODE = "sync";
+ private static final String MSO_REQUEST_ID = "msoRequestId";
+
+ private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils;
+ private ExtractPojosForBB extractPojosForBB;
+ private ExceptionBuilder exceptionBuilder;
+
+ @Autowired
+ public GenericPnfCDSControllerRunnableBB(AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils,
+ ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder) {
+ this.abstractCDSProcessingBBUtils = abstractCDSProcessingBBUtils;
+ this.extractPojosForBB = extractPojosForBB;
+ this.exceptionBuilder = exceptionBuilder;
+ }
+
+ @Override
+ public Boolean understand(ControllerContext<BuildingBlockExecution> controllerContext) {
+ return PayloadConstants.CDS_ACTOR.equalsIgnoreCase(controllerContext.getControllerActor())
+ && PayloadConstants.PNF_SCOPE.equalsIgnoreCase(controllerContext.getControllerScope());
+ }
+
+ @Override
+ public Boolean ready(ControllerContext<BuildingBlockExecution> controllerContext) {
+ return true;
+ }
+
+ @Override
+ public void prepare(ControllerContext<BuildingBlockExecution> controllerContext) {
+ BuildingBlockExecution buildingBlockExecution = controllerContext.getExecution();
+ final AbstractCDSPropertiesBean abstractCDSPropertiesBean =
+ prepareAndSetCdsPropertyBean(buildingBlockExecution);
+
+ buildingBlockExecution.setVariable(EXECUTION_OBJECT, abstractCDSPropertiesBean);
+ }
+
+ @Override
+ public void run(ControllerContext<BuildingBlockExecution> controllerContext) {
+ BuildingBlockExecution buildingBlockExecution = controllerContext.getExecution();
+ abstractCDSProcessingBBUtils.constructExecutionServiceInputObject(buildingBlockExecution);
+ abstractCDSProcessingBBUtils.sendRequestToCDSClient(buildingBlockExecution);
+ }
+
+ private AbstractCDSPropertiesBean prepareAndSetCdsPropertyBean(BuildingBlockExecution buildingBlockExecution) {
+ final AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
+ final String action = getAction(buildingBlockExecution);
+
+ if (action == null) {
+ exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, "Action is null!",
+ ONAPComponents.SO);
+ }
+
+ abstractCDSPropertiesBean.setRequestObject(this.buildRequestPayload(action, buildingBlockExecution));
+ abstractCDSPropertiesBean.setBlueprintName(buildingBlockExecution.getVariable(PRC_BLUEPRINT_NAME));
+ abstractCDSPropertiesBean.setBlueprintVersion(buildingBlockExecution.getVariable(PRC_BLUEPRINT_VERSION));
+ abstractCDSPropertiesBean.setRequestId(buildingBlockExecution.getVariable(MSO_REQUEST_ID));
+ abstractCDSPropertiesBean.setOriginatorId(ORIGINATOR_ID);
+ abstractCDSPropertiesBean.setSubRequestId(UUID.randomUUID().toString());
+ abstractCDSPropertiesBean.setActionName(action);
+ abstractCDSPropertiesBean.setMode(DEFAULT_SYNC_MODE);
+ return abstractCDSPropertiesBean;
+ }
+
+ private String buildRequestPayload(String action, BuildingBlockExecution execution) {
+ final JsonObject pnfObject = new JsonObject();
+ String resolutionKey = null;
+ try {
+ final Pnf pnf = getPnf(execution);
+ final ServiceInstance serviceInstance = getServiceInstance(execution);
+ resolutionKey = pnf.getPnfName();
+
+ setExecutionVariable("service-instance-id", serviceInstance.getServiceInstanceId(), pnfObject);
+ setExecutionVariable("service-model-uuid", serviceInstance.getModelInfoServiceInstance().getModelUuid(),
+ pnfObject);
+ setExecutionVariable("pnf-id", pnf.getPnfId(), pnfObject);
+ setExecutionVariable("pnf-name", resolutionKey, pnfObject);
+ setExecutionVariable("pnf-customization-uuid", pnf.getModelInfoPnf().getModelCustomizationUuid(),
+ pnfObject);
+
+ } catch (BBObjectNotFoundException exception) {
+ logger.error("An exception occurred when creating payload for CDS request", exception);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, exception);
+ }
+ final JsonObject cdsPropertyObject = new JsonObject();
+ cdsPropertyObject.addProperty(RESOLUTION_KEY, resolutionKey);
+ cdsPropertyObject.add(action + SEPARATOR + PROPERTIES, pnfObject);
+
+ return buildRequestJsonObject(cdsPropertyObject, action);
+ }
+
+ private String buildRequestJsonObject(JsonObject cdsPropertyObject, String action) {
+ String requestBasedOnAction = action.concat(SEPARATOR).concat(REQUEST);
+ JsonObject requestObject = new JsonObject();
+ requestObject.add(requestBasedOnAction, cdsPropertyObject);
+ return requestObject.toString();
+ }
+
+ private void setExecutionVariable(String jsonProperty, String executionProperty, JsonObject pnfObject) {
+ if (executionProperty != null) {
+ pnfObject.addProperty(jsonProperty, executionProperty);
+ }
+ }
+
+ private String getAction(BuildingBlockExecution buildingBlockExecution) {
+ ExecuteBuildingBlock executeBuildingBlock = buildingBlockExecution.getVariable(BUILDING_BLOCK);
+ return executeBuildingBlock.getBuildingBlock().getBpmnAction();
+ }
+
+ private Pnf getPnf(BuildingBlockExecution buildingBlockExecution) throws BBObjectNotFoundException {
+ return extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.PNF);
+ }
+
+ private ServiceInstance getServiceInstance(BuildingBlockExecution buildingBlockExecution)
+ throws BBObjectNotFoundException {
+ return extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.SERVICE_INSTANCE_ID);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDE.java
new file mode 100644
index 0000000000..aa74074cf6
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDE.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
+import org.onap.so.client.cds.AbstractCDSProcessingBBUtils;
+import org.onap.so.client.cds.GeneratePayloadForCds;
+import org.onap.so.client.cds.PayloadConstants;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * For pnf, DelegateExecution is being used.
+ *
+ * @param - DelegateExecution
+ */
+@Component
+public class GenericPnfCDSProcessingDE implements ControllerRunnable<DelegateExecution> {
+ private static final Logger logger = LoggerFactory.getLogger(GenericPnfCDSProcessingDE.class);
+ private static final String EXECUTION_OBJECT = "executionObject";
+ private static final String ASSIGN_ACTION = "config-assign";
+ private static final String DEPLOY_ACTION = "config-deploy";
+
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+
+ @Autowired
+ private AbstractCDSProcessingBBUtils cdsDispather;
+
+ @Autowired
+ private GeneratePayloadForCds generatePayloadForCds;
+
+ @Override
+ public Boolean understand(ControllerContext<DelegateExecution> context) {
+ final String scope = context.getControllerScope();
+ return PayloadConstants.CDS_ACTOR.equalsIgnoreCase(context.getControllerActor())
+ && PayloadConstants.PNF_SCOPE.equalsIgnoreCase(scope)
+ && !(ASSIGN_ACTION.equalsIgnoreCase(context.getControllerAction())
+ || DEPLOY_ACTION.equalsIgnoreCase(context.getControllerAction()));
+ }
+
+ @Override
+ public Boolean ready(ControllerContext<DelegateExecution> context) {
+ return true;
+ }
+
+ @Override
+ public void prepare(ControllerContext<DelegateExecution> context) {
+ DelegateExecution delegateExecution = context.getExecution();
+ try {
+ AbstractCDSPropertiesBean abstractCDSPropertiesBean =
+ generatePayloadForCds.buildCdsPropertiesBean(delegateExecution);
+
+ delegateExecution.setVariable(EXECUTION_OBJECT, abstractCDSPropertiesBean);
+
+ } catch (Exception ex) {
+ logger.error("An exception occurred when creating payload for CDS request", ex);
+ exceptionBuilder.buildAndThrowWorkflowException(delegateExecution, 7000, ex);
+ }
+ }
+
+ @Override
+ public void run(ControllerContext<DelegateExecution> context) {
+ DelegateExecution obj = context.getExecution();
+ cdsDispather.constructExecutionServiceInputObject(obj);
+ cdsDispather.sendRequestToCDSClient(obj);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
index 1a7d22c0dd..2d39cc185e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
@@ -35,7 +35,7 @@ import org.onap.so.client.appc.ApplicationControllerAction;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ExternalTicketTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ExternalTicketTasks.java
index 6bfe618460..7bfcd56c42 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ExternalTicketTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ExternalTicketTasks.java
@@ -24,7 +24,7 @@ import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.client.ticket.ExternalTicket;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
index 64f0072991..1cde9fb8f6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
@@ -6,6 +6,8 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -29,11 +31,9 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.OrchestrationStatusValidationException;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
-import org.onap.so.db.catalog.beans.OrchestrationAction;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective;
import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective;
-import org.onap.so.db.catalog.beans.ResourceType;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,8 +52,6 @@ public class OrchestrationStatusValidator {
"Orchestration Status Validation failed. ResourceType=(%s), TargetAction=(%s), OrchestrationStatus=(%s)";
private static final String ORCHESTRATION_STATUS_VALIDATION_RESULT = "orchestrationStatusValidationResult";
private static final String ALACARTE = "aLaCarte";
- private static final String MULTI_STAGE_DESIGN_OFF = "false";
- private static final String MULTI_STAGE_DESIGN_ON = "true";
@Autowired
private ExtractPojosForBB extractPojosForBB;
@@ -86,7 +84,7 @@ public class OrchestrationStatusValidator {
String.format(BUILDING_BLOCK_DETAIL_NOT_FOUND, buildingBlockFlowName));
}
- OrchestrationStatus orchestrationStatus = null;
+ OrchestrationStatus orchestrationStatus;
switch (buildingBlockDetail.getResourceType()) {
case SERVICE:
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 2284c4af1a..f8a4d910f4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -47,6 +47,7 @@ import org.onap.aai.domain.yang.Vnfc;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.aai.domain.yang.VpnBinding;
import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.utils.WorkflowResourceIdsUtils;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
@@ -94,6 +95,7 @@ import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.util.CollectionUtils;
@Component
public class WorkflowAction {
@@ -184,7 +186,7 @@ public class WorkflowAction {
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
- List<Resource> resourceCounter = new ArrayList<>();
+ List<Resource> resourceList = new ArrayList<>();
execution.setVariable("sentSyncResponse", false);
execution.setVariable("homing", false);
execution.setVariable("calledHoming", false);
@@ -303,7 +305,7 @@ public class WorkflowAction {
}
}
if (containsService) {
- traverseUserParamsService(execution, resourceCounter, sIRequest, requestAction);
+ traverseUserParamsService(execution, resourceList, sIRequest, requestAction);
}
} else {
buildAndThrowException(execution,
@@ -326,11 +328,10 @@ public class WorkflowAction {
}
}
if (containsService) {
- foundRelated =
- traverseUserParamsService(execution, resourceCounter, sIRequest, requestAction);
+ foundRelated = traverseUserParamsService(execution, resourceList, sIRequest, requestAction);
}
if (!foundRelated) {
- traverseCatalogDbService(execution, sIRequest, resourceCounter, aaiResourceIds);
+ traverseCatalogDbService(execution, sIRequest, resourceList, aaiResourceIds);
}
} else if (resourceType == WorkflowType.SERVICE
&& ("activateInstance".equalsIgnoreCase(requestAction)
@@ -341,20 +342,20 @@ public class WorkflowAction {
// SERVICE-MACRO-DELETE
// Will never get user params with service, macro will have
// to query the SI in AAI to find related instances.
- traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds);
+ traverseAAIService(execution, resourceList, resourceId, aaiResourceIds);
} else if (resourceType == WorkflowType.SERVICE
&& "deactivateInstance".equalsIgnoreCase(requestAction)) {
- resourceCounter.add(new Resource(WorkflowType.SERVICE, "", false));
+ resourceList.add(new Resource(WorkflowType.SERVICE, "", false));
} else if (resourceType == WorkflowType.VNF && ("replaceInstance".equalsIgnoreCase(requestAction)
|| ("recreateInstance".equalsIgnoreCase(requestAction)))) {
- traverseAAIVnf(execution, resourceCounter, workflowResourceIds.getServiceInstanceId(),
+ traverseAAIVnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(),
workflowResourceIds.getVnfId(), aaiResourceIds);
} else {
buildAndThrowException(execution, "Current Macro Request is not supported");
}
String foundObjects = "";
for (WorkflowType type : WorkflowType.values()) {
- foundObjects = foundObjects + type + " - " + resourceCounter.stream()
+ foundObjects = foundObjects + type + " - " + resourceList.stream()
.filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size()
+ " ";
}
@@ -369,9 +370,9 @@ public class WorkflowAction {
|| "replaceInstanceRetainAssignments".equalsIgnoreCase(requestAction))) {
vnfReplace = true;
}
- flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion,
+ flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceList, requestId, apiVersion,
resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, vnfReplace);
- if (!resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
+ if (!resourceList.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
.collect(Collectors.toList()).isEmpty()) {
logger.info("Sorting for Vlan Tagging");
flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction);
@@ -379,16 +380,16 @@ public class WorkflowAction {
// By default, enable homing at VNF level for CREATEINSTANCE and ASSIGNINSTANCE
if (resourceType == WorkflowType.SERVICE
&& (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE))
- && !resourceCounter.stream().filter(x -> WorkflowType.VNF.equals(x.getResourceType()))
+ && !resourceList.stream().filter(x -> WorkflowType.VNF.equals(x.getResourceType()))
.collect(Collectors.toList()).isEmpty()) {
execution.setVariable("homing", true);
execution.setVariable("calledHoming", false);
}
if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE)
|| requestAction.equalsIgnoreCase(CREATEINSTANCE))) {
- generateResourceIds(flowsToExecute, resourceCounter, serviceInstanceId);
+ generateResourceIds(flowsToExecute, resourceList, serviceInstanceId);
} else {
- updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds,
+ updateResourceIdsFromAAITraversal(flowsToExecute, resourceList, aaiResourceIds,
serviceInstanceId);
}
}
@@ -410,15 +411,17 @@ public class WorkflowAction {
}
}
- if (flowsToExecute == null || flowsToExecute.isEmpty()) {
+ if (CollectionUtils.isEmpty(flowsToExecute)) {
throw new IllegalStateException("Macro did not come up with a valid execution path.");
}
+
List<String> flowNames = new ArrayList<>();
logger.info("List of BuildingBlocks to execute:");
- for (ExecuteBuildingBlock ebb : flowsToExecute) {
+
+ flowsToExecute.forEach(ebb -> {
logger.info(ebb.getBuildingBlock().getBpmnFlowName());
flowNames.add(ebb.getBuildingBlock().getBpmnFlowName());
- }
+ });
if (!isResume) {
bbInputSetupUtils.persistFlowExecutionPath(requestId, flowsToExecute);
@@ -468,9 +471,7 @@ public class WorkflowAction {
List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(type);
for (AAIResultWrapper vnfcResultWrapper : vnfcResultWrappers) {
Optional<T> vnfcOp = vnfcResultWrapper.asBean(resultClass);
- if (vnfcOp.isPresent()) {
- vnfcs.add(vnfcOp.get());
- }
+ vnfcOp.ifPresent(vnfcs::add);
}
}
return vnfcs;
@@ -490,9 +491,7 @@ public class WorkflowAction {
this.getResultWrappersFromRelationships(relationships, type);
for (AAIResultWrapper configurationResultWrapper : configurationResultWrappers) {
Optional<T> configurationOp = configurationResultWrapper.asBean(resultClass);
- if (configurationOp.isPresent()) {
- configurations.add(configurationOp.get());
- }
+ configurationOp.ifPresent(configurations::add);
}
}
return configurations;
@@ -571,8 +570,6 @@ public class WorkflowAction {
protected List<OrchestrationFlow> getVfModuleReplaceBuildingBlocks(ConfigBuildingBlocksDataObject dataObj)
throws Exception {
- List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
-
String vnfId = dataObj.getWorkflowResourceIds().getVnfId();
String vfModuleId = dataObj.getWorkflowResourceIds().getVfModuleId();
@@ -636,19 +633,15 @@ public class WorkflowAction {
if (!relationshipsOp.isPresent()) {
logger.debug("No relationships were found for Configuration in AAI");
return null;
- } else {
- Relationships relationships = relationshipsOp.get();
- List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(AAIObjectType.VNFC);
- if (vnfcResultWrappers.size() > 1 || vnfcResultWrappers.isEmpty()) {
- logger.debug("Too many vnfcs or no vnfc found that are related to configuration");
- }
- Optional<Vnfc> vnfcOp = vnfcResultWrappers.get(0).asBean(Vnfc.class);
- if (vnfcOp.isPresent()) {
- return vnfcOp.get().getVnfcName();
- } else {
- return null;
- }
}
+ Relationships relationships = relationshipsOp.get();
+ List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(AAIObjectType.VNFC);
+ if (vnfcResultWrappers.size() > 1 || vnfcResultWrappers.isEmpty()) {
+ logger.debug("Too many vnfcs or no vnfc found that are related to configuration");
+ }
+ Optional<Vnfc> vnfcOp = vnfcResultWrappers.get(0).asBean(Vnfc.class);
+ return vnfcOp.map(Vnfc::getVnfcName).orElse(null);
+
}
protected List<Resource> sortVfModulesByBaseFirst(List<Resource> vfModuleResources) {
@@ -676,18 +669,15 @@ public class WorkflowAction {
}
private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute,
- List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) {
+ List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) {
for (Pair<WorkflowType, String> pair : aaiResourceIds) {
logger.debug(pair.getValue0() + ", " + pair.getValue1());
}
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
- List<Resource> resources =
- resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
- for (int i = 0; i < resources.size(); i++) {
- updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(),
- retrieveAAIResourceId(aaiResourceIds, type), null, serviceInstanceId);
- }
+ resourceList.stream().filter(resource -> type.equals(resource.getResourceType()))
+ .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(),
+ retrieveAAIResourceId(aaiResourceIds, type), null, serviceInstanceId));
});
}
@@ -703,21 +693,16 @@ public class WorkflowAction {
return id;
}
- private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter,
+ private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceList,
String serviceInstanceId) {
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
- List<Resource> resources =
- resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
- for (int i = 0; i < resources.size(); i++) {
- Resource resource = resourceCounter.stream().filter(x -> type.equals(x.getResourceType()))
- .collect(Collectors.toList()).get(i);
- updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null,
- resource.getVirtualLinkKey(), serviceInstanceId);
- }
+ resourceList.stream().filter(resource -> type.equals(resource.getResourceType()))
+ .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null,
+ resource.getVirtualLinkKey(), serviceInstanceId));
});
}
- protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource,
+ protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resourceType,
String key, String id, String virtualLinkKey, String serviceInstanceId) {
String resourceId = id;
if (resourceId == null) {
@@ -725,24 +710,10 @@ public class WorkflowAction {
}
for (ExecuteBuildingBlock ebb : flowsToExecute) {
if (key != null && key.equalsIgnoreCase(ebb.getBuildingBlock().getKey())
- && ebb.getBuildingBlock().getBpmnFlowName().contains(resource.toString())) {
+ && ebb.getBuildingBlock().getBpmnFlowName().contains(resourceType.toString())) {
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId(serviceInstanceId);
- if (resource == WorkflowType.VNF) {
- workflowResourceIds.setVnfId(resourceId);
- } else if (resource == WorkflowType.PNF) {
- workflowResourceIds.setPnfId(resourceId);
- } else if (resource == WorkflowType.VFMODULE) {
- workflowResourceIds.setVfModuleId(resourceId);
- } else if (resource == WorkflowType.VOLUMEGROUP) {
- workflowResourceIds.setVolumeGroupId(resourceId);
- } else if (resource == WorkflowType.NETWORK) {
- workflowResourceIds.setNetworkId(resourceId);
- } else if (resource == WorkflowType.NETWORKCOLLECTION) {
- workflowResourceIds.setNetworkCollectionId(resourceId);
- } else if (resource == WorkflowType.CONFIGURATION) {
- workflowResourceIds.setConfigurationId(resourceId);
- }
+ WorkflowResourceIdsUtils.setResourceIdByWorkflowType(workflowResourceIds, resourceType, resourceId);
ebb.setWorkflowResourceIds(workflowResourceIds);
}
if (virtualLinkKey != null && ebb.getBuildingBlock().isVirtualLink()
@@ -776,29 +747,28 @@ public class WorkflowAction {
}
protected void traverseCatalogDbService(DelegateExecution execution, ServiceInstancesRequest sIRequest,
- List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds)
+ List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds)
throws JsonProcessingException, VrfBondingServiceException {
String modelUUID = sIRequest.getRequestDetails().getModelInfo().getModelVersionId();
org.onap.so.db.catalog.beans.Service service = catalogDbClient.getServiceByID(modelUUID);
if (service == null) {
buildAndThrowException(execution, "Could not find the service model in catalog db.");
} else {
- resourceCounter.add(new Resource(WorkflowType.SERVICE, service.getModelUUID(), false));
+ resourceList.add(new Resource(WorkflowType.SERVICE, service.getModelUUID(), false));
RelatedInstance relatedVpnBinding =
bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.vpnBinding);
RelatedInstance relatedLocalNetwork =
bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.network);
if (relatedVpnBinding != null && relatedLocalNetwork != null) {
- traverseVrfConfiguration(aaiResourceIds, resourceCounter, service, relatedVpnBinding,
- relatedLocalNetwork);
+ traverseVrfConfiguration(aaiResourceIds, resourceList, service, relatedVpnBinding, relatedLocalNetwork);
} else {
- traverseNetworkCollection(execution, resourceCounter, service);
+ traverseNetworkCollection(execution, resourceList, service);
}
}
}
protected void traverseVrfConfiguration(List<Pair<WorkflowType, String>> aaiResourceIds,
- List<Resource> resourceCounter, org.onap.so.db.catalog.beans.Service service,
+ List<Resource> resourceList, org.onap.so.db.catalog.beans.Service service,
RelatedInstance relatedVpnBinding, RelatedInstance relatedLocalNetwork)
throws VrfBondingServiceException, JsonProcessingException {
org.onap.aai.domain.yang.L3Network aaiLocalNetwork =
@@ -813,9 +783,9 @@ public class WorkflowAction {
vrfValidation.aaiRouteTargetValidation(aaiLocalNetwork);
String existingAAIVrfConfiguration = getExistingAAIVrfConfiguration(relatedVpnBinding, aaiLocalNetwork);
if (existingAAIVrfConfiguration != null) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, existingAAIVrfConfiguration));
+ aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, existingAAIVrfConfiguration));
}
- resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,
+ resourceList.add(new Resource(WorkflowType.CONFIGURATION,
service.getConfigurationCustomizations().get(0).getModelCustomizationUUID(), false));
}
@@ -866,7 +836,7 @@ public class WorkflowAction {
return false;
}
- protected void traverseNetworkCollection(DelegateExecution execution, List<Resource> resourceCounter,
+ protected void traverseNetworkCollection(DelegateExecution execution, List<Resource> resourceList,
org.onap.so.db.catalog.beans.Service service) {
if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) {
List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
@@ -876,7 +846,7 @@ public class WorkflowAction {
CollectionResourceCustomization collectionResourceCustomization =
findCatalogNetworkCollection(execution, service);
if (collectionResourceCustomization != null) {
- resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,
+ resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
collectionResourceCustomization.getModelCustomizationUUID(), false));
logger.debug("Found a network collection");
if (collectionResourceCustomization.getCollectionResource() != null) {
@@ -918,7 +888,7 @@ public class WorkflowAction {
Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,
collectionNetworkResourceCust.getModelCustomizationUUID(), false);
resource.setVirtualLinkKey(Integer.toString(i));
- resourceCounter.add(resource);
+ resourceList.add(resource);
}
}
} else {
@@ -935,13 +905,13 @@ public class WorkflowAction {
logger.debug("No Network Collection Customization found");
}
}
- if (resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
+ if (resourceList.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
.collect(Collectors.toList()).isEmpty()) {
if (service.getNetworkCustomizations() == null) {
logger.debug("No networks were found on this service model");
} else {
for (int i = 0; i < service.getNetworkCustomizations().size(); i++) {
- resourceCounter.add(new Resource(WorkflowType.NETWORK,
+ resourceList.add(new Resource(WorkflowType.NETWORK,
service.getNetworkCustomizations().get(i).getModelCustomizationUUID(), false));
}
}
@@ -952,32 +922,30 @@ public class WorkflowAction {
}
}
- protected void traverseAAIService(DelegateExecution execution, List<Resource> resourceCounter, String resourceId,
+ protected void traverseAAIService(DelegateExecution execution, List<Resource> resourceList, String resourceId,
List<Pair<WorkflowType, String>> aaiResourceIds) {
try {
ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(resourceId);
org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO =
bbInputSetup.getExistingServiceInstance(serviceInstanceAAI);
- resourceCounter.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
+ resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
if (serviceInstanceMSO.getVnfs() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VNF, vnf.getVnfId()));
- resourceCounter.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
+ aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
+ resourceList.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
if (vnf.getVfModules() != null) {
for (VfModule vfModule : vnf.getVfModules()) {
- aaiResourceIds.add(
- new Pair<WorkflowType, String>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
+ aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false);
resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean());
- resourceCounter.add(resource);
+ resourceList.add(resource);
}
}
if (vnf.getVolumeGroups() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf
.getVolumeGroups()) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VOLUMEGROUP,
- volumeGroup.getVolumeGroupId()));
- resourceCounter
+ aaiResourceIds.add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
+ resourceList
.add(new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false));
}
}
@@ -986,15 +954,15 @@ public class WorkflowAction {
if (serviceInstanceMSO.getNetworks() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network : serviceInstanceMSO
.getNetworks()) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORK, network.getNetworkId()));
- resourceCounter.add(new Resource(WorkflowType.NETWORK, network.getNetworkId(), false));
+ aaiResourceIds.add(new Pair<>(WorkflowType.NETWORK, network.getNetworkId()));
+ resourceList.add(new Resource(WorkflowType.NETWORK, network.getNetworkId(), false));
}
}
if (serviceInstanceMSO.getCollection() != null) {
logger.debug("found networkcollection");
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORKCOLLECTION,
- serviceInstanceMSO.getCollection().getId()));
- resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,
+ aaiResourceIds
+ .add(new Pair<>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId()));
+ resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
serviceInstanceMSO.getCollection().getId(), false));
}
if (serviceInstanceMSO.getConfigurations() != null) {
@@ -1005,9 +973,8 @@ public class WorkflowAction {
for (Relationship relationship : aaiConfig.get().getRelationshipList().getRelationship()) {
if (relationship.getRelatedTo().contains("vnfc")
|| relationship.getRelatedTo().contains("vpn-binding")) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION,
- config.getConfigurationId()));
- resourceCounter.add(
+ aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, config.getConfigurationId()));
+ resourceList.add(
new Resource(WorkflowType.CONFIGURATION, config.getConfigurationId(), false));
break;
}
@@ -1022,34 +989,32 @@ public class WorkflowAction {
}
}
- private void traverseAAIVnf(DelegateExecution execution, List<Resource> resourceCounter, String serviceId,
+ private void traverseAAIVnf(DelegateExecution execution, List<Resource> resourceList, String serviceId,
String vnfId, List<Pair<WorkflowType, String>> aaiResourceIds) {
try {
ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceId);
org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO =
bbInputSetup.getExistingServiceInstance(serviceInstanceAAI);
- resourceCounter.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
+ resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
if (serviceInstanceMSO.getVnfs() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
if (vnf.getVnfId().equals(vnfId)) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VNF, vnf.getVnfId()));
- resourceCounter.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
+ aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
+ resourceList.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
if (vnf.getVfModules() != null) {
for (VfModule vfModule : vnf.getVfModules()) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VFMODULE,
- vfModule.getVfModuleId()));
- resourceCounter
- .add(new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false));
+ aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
+ resourceList.add(new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false));
findConfigurationsInsideVfModule(execution, vnf.getVnfId(), vfModule.getVfModuleId(),
- resourceCounter, aaiResourceIds);
+ resourceList, aaiResourceIds);
}
}
if (vnf.getVolumeGroups() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf
.getVolumeGroups()) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VOLUMEGROUP,
- volumeGroup.getVolumeGroupId()));
- resourceCounter.add(
+ aaiResourceIds
+ .add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
+ resourceList.add(
new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false));
}
}
@@ -1065,7 +1030,7 @@ public class WorkflowAction {
}
private void findConfigurationsInsideVfModule(DelegateExecution execution, String vnfId, String vfModuleId,
- List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds) {
+ List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds) {
try {
org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId);
AAIResultWrapper vfModuleWrapper = new AAIResultWrapper(
@@ -1078,9 +1043,8 @@ public class WorkflowAction {
Optional<Configuration> config =
workflowActionUtils.extractRelationshipsConfiguration(relationshipsOp.get());
if (config.isPresent()) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION,
- config.get().getConfigurationId()));
- resourceCounter.add(
+ aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, config.get().getConfigurationId()));
+ resourceList.add(
new Resource(WorkflowType.CONFIGURATION, config.get().getConfigurationId(), false));
}
}
@@ -1091,7 +1055,7 @@ public class WorkflowAction {
}
}
- protected boolean traverseUserParamsService(DelegateExecution execution, List<Resource> resourceCounter,
+ protected boolean traverseUserParamsService(DelegateExecution execution, List<Resource> resourceList,
ServiceInstancesRequest sIRequest, String requestAction) throws IOException {
boolean foundRelated = false;
boolean foundVfModuleOrVG = false;
@@ -1104,11 +1068,11 @@ public class WorkflowAction {
ObjectMapper obj = new ObjectMapper();
String input = obj.writeValueAsString(params.get(USERPARAMSERVICE));
Service validate = obj.readValue(input, Service.class);
- resourceCounter.add(
+ resourceList.add(
new Resource(WorkflowType.SERVICE, validate.getModelInfo().getModelVersionId(), false));
if (validate.getResources().getVnfs() != null) {
for (Vnfs vnf : validate.getResources().getVnfs()) {
- resourceCounter.add(new Resource(WorkflowType.VNF,
+ resourceList.add(new Resource(WorkflowType.VNF,
vnf.getModelInfo().getModelCustomizationId(), false));
foundRelated = true;
if (vnf.getModelInfo() != null && vnf.getModelInfo().getModelCustomizationUuid() != null) {
@@ -1124,7 +1088,7 @@ public class WorkflowAction {
if (vfModuleCustomization.getVfModule() != null
&& vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null
&& vfModuleCustomization.getVolumeHeatEnv() != null) {
- resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,
+ resourceList.add(new Resource(WorkflowType.VOLUMEGROUP,
vfModuleCustomization.getModelCustomizationUUID(), false));
foundRelated = true;
foundVfModuleOrVG = true;
@@ -1143,7 +1107,7 @@ public class WorkflowAction {
} else {
resource.setBaseVfModule(false);
}
- resourceCounter.add(resource);
+ resourceList.add(resource);
if (vfModule.getModelInfo() != null
&& vfModule.getModelInfo().getModelCustomizationUuid() != null) {
vfModuleCustomizationUUID =
@@ -1162,7 +1126,7 @@ public class WorkflowAction {
vnf.getModelInfo().getModelCustomizationId());
resource.setVfModuleCustomizationId(
vfModule.getModelInfo().getModelCustomizationId());
- resourceCounter.add(configResource);
+ resourceList.add(configResource);
}
}
}
@@ -1177,22 +1141,21 @@ public class WorkflowAction {
}
if (validate.getResources().getPnfs() != null) {
for (Pnfs pnf : validate.getResources().getPnfs()) {
- resourceCounter.add(new Resource(WorkflowType.PNF,
+ resourceList.add(new Resource(WorkflowType.PNF,
pnf.getModelInfo().getModelCustomizationId(), false));
foundRelated = true;
}
}
if (validate.getResources().getNetworks() != null) {
for (Networks network : validate.getResources().getNetworks()) {
- resourceCounter.add(new Resource(WorkflowType.NETWORK,
+ resourceList.add(new Resource(WorkflowType.NETWORK,
network.getModelInfo().getModelCustomizationId(), false));
foundRelated = true;
}
if (requestAction.equals(CREATEINSTANCE)) {
String networkColCustId = queryCatalogDBforNetworkCollection(execution, sIRequest);
if (networkColCustId != null) {
- resourceCounter
- .add(new Resource(WorkflowType.NETWORKCOLLECTION, networkColCustId, false));
+ resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, networkColCustId, false));
foundRelated = true;
}
}
@@ -1239,21 +1202,14 @@ public class WorkflowAction {
}
protected WorkflowResourceIds populateResourceIdsFromApiHandler(DelegateExecution execution) {
- WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
- workflowResourceIds.setServiceInstanceId((String) execution.getVariable("serviceInstanceId"));
- workflowResourceIds.setNetworkId((String) execution.getVariable("networkId"));
- workflowResourceIds.setVfModuleId((String) execution.getVariable("vfModuleId"));
- workflowResourceIds.setVnfId((String) execution.getVariable("vnfId"));
- workflowResourceIds.setVolumeGroupId((String) execution.getVariable("volumeGroupId"));
- workflowResourceIds.setInstanceGroupId((String) execution.getVariable("instanceGroupId"));
- return workflowResourceIds;
+ return WorkflowResourceIdsUtils.getWorkflowResourceIdsFromExecution(execution);
}
protected Resource extractResourceIdAndTypeFromUri(String uri) {
Pattern patt = Pattern.compile("[vV]\\d+.*?(?:(?:/(?<type>" + SUPPORTEDTYPES
+ ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?(?:/resume)?)?$");
Matcher m = patt.matcher(uri);
- Boolean generated = false;
+ boolean generated = false;
if (m.find()) {
logger.debug("found match on {} : {} ", uri, m);
@@ -1363,7 +1319,7 @@ public class WorkflowAction {
} else if (ebb.getBuildingBlock().getBpmnFlowName().equals(CREATENETWORKBB)
|| ebb.getBuildingBlock().getBpmnFlowName().equals(ACTIVATENETWORKBB)) {
continue;
- } else if (!ebb.getBuildingBlock().getBpmnFlowName().equals("")) {
+ } else if (!"".equals(ebb.getBuildingBlock().getBpmnFlowName())) {
sortedOrchFlows.add(ebb);
}
}
@@ -1402,11 +1358,10 @@ public class WorkflowAction {
String resourceId, String requestAction, String vnfType, WorkflowResourceIds workflowResourceIds,
RequestDetails requestDetails, boolean isVirtualLink, boolean isConfiguration) {
- List<Resource> serviceResources = resourceList.stream()
- .filter(resource -> resource.getResourceType().equals(workflowType)).collect(Collectors.toList());
- serviceResources.forEach(resource -> flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource,
- apiVersion, resourceId, requestAction, false, vnfType, workflowResourceIds, requestDetails,
- isVirtualLink, resource.getVirtualLinkKey(), null, isConfiguration)));
+ resourceList.stream().filter(resource -> resource.getResourceType().equals(workflowType))
+ .forEach(resource -> flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource,
+ apiVersion, resourceId, requestAction, false, vnfType, workflowResourceIds, requestDetails,
+ isVirtualLink, resource.getVirtualLinkKey(), null, isConfiguration)));
}
protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows,
@@ -1536,13 +1491,8 @@ public class WorkflowAction {
requestAction, resourceName.toString(), aLaCarte, CLOUD_OWNER);
}
if (northBoundRequest == null) {
- if (aLaCarte) {
- buildAndThrowException(execution,
- "The request: ALaCarte " + resourceName + " " + requestAction + " is not supported by GR_API.");
- } else {
- buildAndThrowException(execution,
- "The request: Macro " + resourceName + " " + requestAction + " is not supported by GR_API.");
- }
+ buildAndThrowException(execution, String.format("The request: %s %s %s is not supported by GR_API.",
+ (aLaCarte ? "AlaCarte" : "Macro"), resourceName, requestAction));
} else {
if (northBoundRequest.getIsToplevelflow() != null) {
execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow());
@@ -1554,9 +1504,7 @@ public class WorkflowAction {
if (!flow.getFlowName().contains("BB") && !flow.getFlowName().contains("Activity")) {
List<OrchestrationFlow> macroQueryFlows =
catalogDbClient.getOrchestrationFlowByAction(flow.getFlowName());
- for (OrchestrationFlow macroFlow : macroQueryFlows) {
- listToExecute.add(macroFlow);
- }
+ listToExecute.addAll(macroQueryFlows);
} else {
listToExecute.add(flow);
}
@@ -1579,11 +1527,11 @@ public class WorkflowAction {
public void handleRuntimeException(DelegateExecution execution) {
StringBuilder wfeExpMsg = new StringBuilder("Runtime error ");
- String runtimeErrorMessage = null;
+ String runtimeErrorMessage;
try {
String javaExpMsg = (String) execution.getVariable("BPMN_javaExpMsg");
if (javaExpMsg != null && !javaExpMsg.isEmpty()) {
- wfeExpMsg = wfeExpMsg.append(": ").append(javaExpMsg);
+ wfeExpMsg.append(": ").append(javaExpMsg);
}
runtimeErrorMessage = wfeExpMsg.toString();
logger.error(runtimeErrorMessage);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
new file mode 100644
index 0000000000..682a0471ee
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
@@ -0,0 +1,116 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Tech Mahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.workflow.tasks.listeners;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.logging.log4j.util.Strings;
+import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+
+@Component
+public class SkipCDSBuildingBlockListener implements FlowManipulator {
+
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ private Set<String> vnfActions =
+ new HashSet<String>(Arrays.asList("config-assign", "config-deploy", "VnfConfigAssign", "VnfConfigDeploy"));
+
+ private Set<String> vFModuleAction =
+ new HashSet<String>(Arrays.asList("VfModuleConfigAssign", "VfModuleConfigDeploy"));
+
+ @Override
+ public boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution) {
+
+ return "ControllerExecutionBB".equals(currentBBName);
+ }
+
+ /**
+ * Skip the CDS Building block according to the Skip Flag.
+ *
+ * @param flowsToExecute - List of ExecuteBuildingBlock object.
+ * @param execution - BuildingBlockExecution object
+ * @param currentBB - ExecuteBuildingBlock object
+ *
+ */
+ @Override
+ public void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB,
+ BuildingBlockExecution execution) {
+ String customizationUUID = currentBB.getBuildingBlock().getKey();
+
+ if (Strings.isEmpty(customizationUUID)) {
+ return;
+ }
+
+ if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("VNF")
+ && containsIgnoreCaseAction(currentBB, vnfActions)) {
+ List<VnfResourceCustomization> vnfResourceCustomizations =
+ catalogDbClient.getVnfResourceCustomizationByModelUuid(
+ currentBB.getRequestDetails().getModelInfo().getModelUuid());
+ if (!CollectionUtils.isEmpty(vnfResourceCustomizations)) {
+ VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(customizationUUID,
+ vnfResourceCustomizations);
+ if (null != vrc) {
+ boolean skipConfigVNF = vrc.isSkipPostInstConf();
+ currentSequenceSkipCheck(execution, skipConfigVNF);
+ }
+
+ }
+ } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("VFModule")
+ && containsIgnoreCaseAction(currentBB, vFModuleAction)) {
+
+ VfModuleCustomization vfc =
+ catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(customizationUUID);
+
+ if (null != vfc) {
+ boolean skipVfModule = vfc.isSkipPostInstConf();
+ currentSequenceSkipCheck(execution, skipVfModule);
+ }
+ }
+
+
+ }
+
+ private boolean containsIgnoreCaseAction(ExecuteBuildingBlock currentBB, Set<String> actions) {
+ return actions.stream().filter(action -> action.equalsIgnoreCase(currentBB.getBuildingBlock().getBpmnAction()))
+ .findFirst().isPresent();
+ }
+
+
+ private void currentSequenceSkipCheck(BuildingBlockExecution execution, boolean skipModule) {
+ if (skipModule) {
+ int currentSequence = execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, currentSequence + 1);
+ }
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java
new file mode 100644
index 0000000000..d16eac147e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Nokia 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.onap.so.bpmn.infrastructure.workflow.tasks.utils;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
+
+public final class WorkflowResourceIdsUtils {
+
+ private WorkflowResourceIdsUtils() {
+ throw new IllegalStateException("Utility class");
+ }
+
+ public static void setResourceIdByWorkflowType(WorkflowResourceIds workflowResourceIds, WorkflowType resourceType,
+ String resourceId) {
+ switch (resourceType) {
+ case SERVICE:
+ workflowResourceIds.setServiceInstanceId(resourceId);
+ break;
+ case VNF:
+ workflowResourceIds.setVnfId(resourceId);
+ break;
+ case PNF:
+ workflowResourceIds.setPnfId(resourceId);
+ break;
+ case VFMODULE:
+ workflowResourceIds.setVfModuleId(resourceId);
+ break;
+ case VOLUMEGROUP:
+ workflowResourceIds.setVolumeGroupId(resourceId);
+ break;
+ case NETWORK:
+ workflowResourceIds.setNetworkId(resourceId);
+ break;
+ case NETWORKCOLLECTION:
+ workflowResourceIds.setNetworkCollectionId(resourceId);
+ break;
+ case CONFIGURATION:
+ workflowResourceIds.setConfigurationId(resourceId);
+ break;
+ case INSTANCE_GROUP:
+ workflowResourceIds.setInstanceGroupId(resourceId);
+ break;
+ }
+ }
+
+ public static WorkflowResourceIds getWorkflowResourceIdsFromExecution(DelegateExecution execution) {
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId((String) execution.getVariable("serviceInstanceId"));
+ workflowResourceIds.setNetworkId((String) execution.getVariable("networkId"));
+ workflowResourceIds.setVfModuleId((String) execution.getVariable("vfModuleId"));
+ workflowResourceIds.setVnfId((String) execution.getVariable("vnfId"));
+ workflowResourceIds.setVolumeGroupId((String) execution.getVariable("volumeGroupId"));
+ workflowResourceIds.setInstanceGroupId((String) execution.getVariable("instanceGroupId"));
+ return workflowResourceIds;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
index cf56964af3..9de8e184f2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
@@ -282,6 +282,7 @@ public class AAIObjectMapper {
map().setConfigurationType(source.getModelInfoConfiguration().getConfigurationType());
map().setConfigurationSubType(source.getModelInfoConfiguration().getConfigurationRole());
map().setConfigPolicyName(source.getModelInfoConfiguration().getPolicyName());
+ skip().setConfigurationRole(null);
}
});
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
index d78fa69680..3f81e432e1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in 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 +54,7 @@ import org.onap.so.entity.MsoRequest;
import org.onap.so.openstack.beans.NetworkRollback;
import org.onap.so.openstack.beans.RouteTarget;
import org.onap.so.openstack.beans.Subnet;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -65,8 +68,7 @@ public class NetworkAdapterObjectMapper {
public CreateNetworkRequest createNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion,
OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network,
- Map<String, String> userInput, String cloudRegionPo, Customer customer)
- throws UnsupportedEncodingException {
+ Map<String, String> userInput, String cloudRegionPo, Customer customer) {
CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
// set cloudSiteId as determined for cloud region PO instead of cloudRegion.getLcpCloudRegionId()
@@ -119,7 +121,7 @@ public class NetworkAdapterObjectMapper {
}
public DeleteNetworkRequest deleteNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion,
- ServiceInstance serviceInstance, L3Network l3Network) throws UnsupportedEncodingException {
+ ServiceInstance serviceInstance, L3Network l3Network) {
DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest();
deleteNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
@@ -150,14 +152,14 @@ public class NetworkAdapterObjectMapper {
/**
* Access method to build Rollback Network Request
- *
+ *
* @return
* @throws UnsupportedEncodingException
*/
public RollbackNetworkRequest createNetworkRollbackRequestMapper(RequestContext requestContext,
CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance,
L3Network l3Network, Map<String, String> userInput, String cloudRegionPo,
- CreateNetworkResponse createNetworkResponse) throws UnsupportedEncodingException {
+ CreateNetworkResponse createNetworkResponse) {
RollbackNetworkRequest rollbackNetworkRequest = new RollbackNetworkRequest();
rollbackNetworkRequest = setCommonRollbackRequestFields(rollbackNetworkRequest, requestContext);
@@ -171,7 +173,7 @@ public class NetworkAdapterObjectMapper {
public UpdateNetworkRequest createNetworkUpdateRequestMapper(RequestContext requestContext, CloudRegion cloudRegion,
OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network,
- Map<String, String> userInput, Customer customer) throws UnsupportedEncodingException {
+ Map<String, String> userInput, Customer customer) {
UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest();
updateNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
@@ -198,11 +200,10 @@ public class NetworkAdapterObjectMapper {
}
private RollbackNetworkRequest setCommonRollbackRequestFields(RollbackNetworkRequest request,
- RequestContext requestContext) throws UnsupportedEncodingException {
+ RequestContext requestContext) {
request.setSkipAAI(true);
String messageId = requestContext.getMsoRequestId();
request.setMessageId(messageId);
- // request.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId));
return request;
}
@@ -240,7 +241,7 @@ public class NetworkAdapterObjectMapper {
return UUID.randomUUID().toString();
}
- protected String createCallbackUrl(String messageType, String correlator) throws UnsupportedEncodingException {
+ protected String createCallbackUrl(String messageType, String correlator) {
String endpoint = this.getEndpoint();
while (endpoint.endsWith("/")) {
@@ -256,14 +257,14 @@ public class NetworkAdapterObjectMapper {
/**
* Use BB L3Network object to build subnets list of type org.onap.so.openstack.beans.Subnet
- *
+ *
* @param L3Network
* @return List<org.onap.so.openstack.beans.Subnet>
*/
protected List<Subnet> buildOpenstackSubnetList(L3Network l3Network) {
List<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet> subnets = l3Network.getSubnets();
- List<org.onap.so.openstack.beans.Subnet> subnetList = new ArrayList<org.onap.so.openstack.beans.Subnet>();
+ List<org.onap.so.openstack.beans.Subnet> subnetList = new ArrayList<>();
// create mapper from onap Subnet to openstack bean Subnet
if (modelMapper.getTypeMap(org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet.class,
org.onap.so.openstack.beans.Subnet.class) == null) {
@@ -292,7 +293,7 @@ public class NetworkAdapterObjectMapper {
.setCidr(subnet.getNetworkStartAddress().concat(FORWARD_SLASH).concat(subnet.getCidrMask()));
List<org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute> hostRouteList = subnet.getHostRoutes();
List<org.onap.so.openstack.beans.HostRoute> openstackHostRouteList = new ArrayList<>();
- org.onap.so.openstack.beans.HostRoute openstackHostRoute = null;
+ org.onap.so.openstack.beans.HostRoute openstackHostRoute;
// TODO only 2 fields available on openstack object. Confirm it is sufficient or add as needed
for (org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute hostRoute : hostRouteList) {
openstackHostRoute = new org.onap.so.openstack.beans.HostRoute();
@@ -319,10 +320,9 @@ public class NetworkAdapterObjectMapper {
private ProviderVlanNetwork buildProviderVlanNetwork(L3Network l3Network) {
ProviderVlanNetwork providerVlanNetwork = new ProviderVlanNetwork();
providerVlanNetwork.setPhysicalNetworkName(l3Network.getPhysicalNetworkName());
- List<Integer> vlans = new ArrayList<Integer>();
- List<org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment> segmentationAssignments =
- l3Network.getSegmentationAssignments();
- for (org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment assignment : segmentationAssignments) {
+ List<Integer> vlans = new ArrayList<>();
+ List<SegmentationAssignment> segmentationAssignments = l3Network.getSegmentationAssignments();
+ for (SegmentationAssignment assignment : segmentationAssignments) {
vlans.add(Integer.valueOf(assignment.getSegmentationId()));
}
providerVlanNetwork.setVlans(vlans);
@@ -401,7 +401,7 @@ public class NetworkAdapterObjectMapper {
private Map<String, String> addSharedAndExternal(Map<String, String> userInput, L3Network l3Network) {
if (userInput == null)
- userInput = new HashMap<String, String>();
+ userInput = new HashMap<>();
if (!userInput.containsKey("shared")) {
userInput.put("shared", Optional.ofNullable(l3Network.isIsSharedNetwork()).orElse(false).toString());
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
index 088ce1ac38..dd9ecbead4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingClientResponseValidator.java
@@ -31,7 +31,7 @@ import org.onap.namingservice.model.NameGenResponse;
import org.onap.namingservice.model.NameGenResponseError;
import org.onap.namingservice.model.Respelement;
import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java
index 3d3058da0b..362f64d720 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -24,7 +26,7 @@ import java.util.HashMap;
public class NamingRequestObject {
- private HashMap<String, String> namingRequestMap = new HashMap<String, String>();
+ private HashMap<String, String> namingRequestMap = new HashMap<>();
public HashMap<String, String> getNamingRequestObjectMap() {
return this.namingRequestMap;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
index 8b939940fa..47be2f5bd6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
@@ -24,7 +24,6 @@ import java.util.Optional;
import javax.ws.rs.core.UriBuilder;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
-import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
@@ -239,10 +238,4 @@ public class AAIConfigurationResources {
injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration);
}
- public boolean checkConfigurationNameInUse(String configurationName) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
- .queryParam("configuration-name", configurationName);
- return injectionHelper.getAaiClient().exists(uri);
- }
-
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
index 296d052315..12c1d5572f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java
@@ -28,6 +28,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -87,7 +88,7 @@ public class AAIInstanceGroupResources {
}
public boolean checkInstanceGroupNameInUse(String instanceGroupName) {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
.queryParam("instance-group-name", instanceGroupName);
return injectionHelper.getAaiClient().exists(uri);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
index 3af65815a6..f040627155 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
@@ -38,6 +38,8 @@ import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -103,11 +105,11 @@ public class AAINetworkResources {
return injectionHelper.getAaiClient().get(netBindingUri.depth(Depth.TWO)).asBean(VpnBinding.class);
}
- public Optional<NetworkPolicy> getNetworkPolicy(AAIResourceUri netPolicyUri) {
+ public Optional<NetworkPolicy> getNetworkPolicy(AAIBaseResourceUri netPolicyUri) {
return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class);
}
- public Optional<NetworkPolicies> getNetworkPolicies(AAIResourceUri netPoliciesUri) {
+ public Optional<NetworkPolicies> getNetworkPolicies(AAIBaseResourceUri netPoliciesUri) {
return injectionHelper.getAaiClient().get(netPoliciesUri).asBean(NetworkPolicies.class);
}
@@ -227,7 +229,7 @@ public class AAINetworkResources {
}
public boolean checkNetworkNameInUse(String networkName) {
- AAIResourceUri uri =
+ AAIPluralResourceUri uri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName);
return injectionHelper.getAaiClient().exists(uri);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
index fc1528526c..0879e24bfb 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
@@ -6,6 +6,8 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -33,18 +35,16 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class AAIServiceInstanceResources {
- private static final Logger logger = LoggerFactory.getLogger(AAIServiceInstanceResources.class);
@Autowired
private InjectionHelper injectionHelper;
@@ -116,7 +116,7 @@ public class AAIServiceInstanceResources {
}
public boolean existsOwningEntityName(String owningEntityName) {
- AAIResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
+ AAIPluralResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
.queryParam("owning-entity-name", owningEntityName);
AAIResourcesClient aaiRC = injectionHelper.getAaiClient();
return aaiRC.exists(owningEntityUri);
@@ -124,7 +124,7 @@ public class AAIServiceInstanceResources {
public org.onap.aai.domain.yang.OwningEntity getOwningEntityByName(String owningEntityName)
throws AAIEntityNotFoundException {
- AAIResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
+ AAIPluralResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY)
.queryParam("owning-entity-name", owningEntityName);
AAIResourcesClient aaiRC = injectionHelper.getAaiClient();
Optional<OwningEntities> owningEntities = aaiRC.get(OwningEntities.class, owningEntityUri);
@@ -179,7 +179,7 @@ public class AAIServiceInstanceResources {
}
public boolean checkInstanceServiceNameInUse(ServiceInstance serviceInstance) {
- AAIResourceUri uriSI = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ AAIPluralResourceUri uriSI = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
.queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
return injectionHelper.getAaiClient().exists(uriSI);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
index 4d1a6dce38..f750cf2453 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
@@ -23,7 +23,6 @@
package org.onap.so.client.orchestration;
import java.util.Optional;
-import org.onap.aai.domain.yang.VfModules;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -31,13 +30,11 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -114,9 +111,9 @@ public class AAIVfModuleResources {
public boolean checkNameInUse(VfModule vfModule) {
boolean nameInUse = false;
- AAIResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
.queryParam("vf-module-name", vfModule.getVfModuleName());
- AAIResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
+ AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
vfModule.getModelInfoVfModule().getModelCustomizationUUID());
if (injectionHelper.getAaiClient().exists(vfModuleUriWithCustomization)) {
// assume it's a resume case and return false
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
index 7ad74a6d86..cd0a584218 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
@@ -36,6 +36,7 @@ import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIRestClientImpl;
import org.onap.so.client.aai.AAIValidatorImpl;
import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -159,7 +160,7 @@ public class AAIVnfResources {
}
public boolean checkNameInUse(String vnfName) {
- AAIResourceUri vnfUri =
+ AAIPluralResourceUri vnfUri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName);
return injectionHelper.getAaiClient().exists(vnfUri);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
index b9e4aeb888..152dd0dad2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
@@ -28,12 +28,11 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -96,7 +95,7 @@ public class AAIVolumeGroupResources {
}
public boolean checkNameInUse(VolumeGroup volumeGroup) {
- AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
.queryParam("volume-group-name", volumeGroup.getVolumeGroupName());
return injectionHelper.getAaiClient().exists(volumeGroupUri);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java
index 168d370521..4cdb5adfd4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java
@@ -27,6 +27,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -55,7 +56,7 @@ public class AAIVpnBindingResources {
* @return
*/
public Optional<VpnBindings> getVpnBindingByCustomerVpnId(String customerVpnId) {
- AAIResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VPN_BINDING)
+ AAIPluralResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VPN_BINDING)
.queryParam("customer-vpn-id", customerVpnId);
return injectionHelper.getAaiClient().get(VpnBindings.class, aaiVpnBindingsResourceUri);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
index 5513122560..dba1693e5d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
@@ -6,6 +6,8 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -33,14 +35,11 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.namingservice.NamingClient;
import org.onap.so.client.namingservice.NamingRequestObject;
import org.onap.so.client.namingservice.NamingRequestObjectBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class NamingServiceResources {
- private static final Logger logger = LoggerFactory.getLogger(NamingServiceResources.class);
private static final String NAMING_TYPE = "instanceGroup";
@Autowired
@@ -53,14 +52,14 @@ public class NamingServiceResources {
throws BadResponseException, IOException {
Element element = namingRequestObjectBuilder.elementMapper(instanceGroup.getId(), policyInstanceName,
NAMING_TYPE, nfNamingCode, instanceGroup.getInstanceGroupName());
- List<Element> elements = new ArrayList<Element>();
+ List<Element> elements = new ArrayList<>();
elements.add(element);
return (namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements)));
}
public String deleteInstanceGroupName(InstanceGroup instanceGroup) throws BadResponseException, IOException {
Deleteelement deleteElement = namingRequestObjectBuilder.deleteElementMapper(instanceGroup.getId());
- List<Deleteelement> deleteElements = new ArrayList<Deleteelement>();
+ List<Deleteelement> deleteElements = new ArrayList<>();
deleteElements.add(deleteElement);
return (namingClient
.deleteNameGenRequest(namingRequestObjectBuilder.nameGenDeleteRequestMapper(deleteElements)));
@@ -70,8 +69,8 @@ public class NamingServiceResources {
throws BadResponseException, IOException {
HashMap<String, String> nsRequestObject = namingRequestObject.getNamingRequestObjectMap();
Element element = new Element();
- nsRequestObject.forEach((k, v) -> element.put(k, v));
- List<Element> elements = new ArrayList<Element>();
+ nsRequestObject.forEach(element::put);
+ List<Element> elements = new ArrayList<>();
elements.add(element);
return (namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements)));
}
@@ -81,7 +80,7 @@ public class NamingServiceResources {
HashMap<String, String> nsRequestObject = namingRequestObject.getNamingRequestObjectMap();
Deleteelement delElement = new Deleteelement();
nsRequestObject.forEach((k, v) -> delElement.setExternalKey(v));
- List<Deleteelement> delElements = new ArrayList<Deleteelement>();
+ List<Deleteelement> delElements = new ArrayList<>();
delElements.add(delElement);
return (namingClient.deleteNameGenRequest(namingRequestObjectBuilder.nameGenDeleteRequestMapper(delElements)));
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
index e7e4e25af2..01ac675d83 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
@@ -30,7 +30,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
index a41c79b171..f6642ab76a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
@@ -48,7 +48,7 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
index a8f47fc763..6f96331e7f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
@@ -64,6 +64,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -586,7 +587,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
execution.setVariable("heatStackId", "testHeatStackId");
execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123");
NetworkPolicy networkPolicy = new NetworkPolicy();
- doReturn(Optional.of(networkPolicy)).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class));
+ doReturn(Optional.of(networkPolicy)).when(aaiNetworkResources).getNetworkPolicy(any(AAIBaseResourceUri.class));
doNothing().when(aaiNetworkResources).createNetworkPolicy(any(NetworkPolicy.class));
aaiCreateTasks.createNetworkPolicies(execution);
verify(aaiNetworkResources, times(0)).createNetworkPolicy(any(NetworkPolicy.class));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
index 855d935ae1..41589af067 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
@@ -40,7 +40,6 @@ import org.mockito.ArgumentMatchers;
import org.mockito.Captor;
import org.mockito.InjectMocks;
import org.onap.aai.domain.yang.NetworkPolicies;
-import org.onap.aai.domain.yang.NetworkPolicy;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -53,7 +52,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri;
import org.onap.so.client.exception.BBObjectNotFoundException;
@@ -223,7 +222,7 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
NetworkPolicies networkPolicies1 = aaiResultWrapper1.asBean(NetworkPolicies.class).get();
doReturn(Optional.of(networkPolicies0), Optional.of(networkPolicies1)).when(aaiNetworkResources)
- .getNetworkPolicies(any(AAIResourceUri.class));
+ .getNetworkPolicies(any(AAIBaseResourceUri.class));
doNothing().when(aaiNetworkResources).deleteNetworkPolicy(any(String.class));
aaiDeleteTasks.deleteNetworkPolicies(execution);
verify(aaiNetworkResources, times(2)).deleteNetworkPolicy(stringCaptor.capture());
@@ -235,7 +234,7 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
public void deleteNetworkPolicyNeedToDeleteNoneTest() throws Exception {
execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123");
Optional<NetworkPolicies> networkPolicies = Optional.empty();
- doReturn(networkPolicies).when(aaiNetworkResources).getNetworkPolicies(any(AAIResourceUri.class));
+ doReturn(networkPolicies).when(aaiNetworkResources).getNetworkPolicies(any(AAIBaseResourceUri.class));
aaiDeleteTasks.deleteNetworkPolicies(execution);
verify(aaiNetworkResources, times(0)).deleteNetworkPolicy(any(String.class));
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
index 5bd4df74bb..9adae88a5a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
@@ -24,10 +24,15 @@ package org.onap.so.bpmn.infrastructure.adapter.network.tasks;
import java.util.HashMap;
import java.util.Map;
+import java.util.Optional;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
import javax.xml.bind.JAXBException;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.glassfish.jersey.message.internal.OutboundJaxrsResponse;
+import org.glassfish.jersey.message.internal.OutboundMessageContext;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
@@ -39,8 +44,8 @@ import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
import org.onap.so.adapters.nwrest.UpdateNetworkError;
import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
-import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.NetworkAdapterResources;
import org.onap.so.utils.Components;
import org.onap.logging.filter.base.ONAPComponents;
import static org.junit.Assert.assertTrue;
@@ -54,13 +59,19 @@ import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
-public class NetworkAdapterRestV1Test extends BaseTaskTest {
+public class NetworkAdapterRestV1Test {
- @InjectMocks
- NetworkAdapterRestV1 networkAdapterRestV1Tasks = new NetworkAdapterRestV1();
@Mock
- ExceptionBuilder exceptionBuilder = new ExceptionBuilder();
+ private ExceptionBuilder exceptionBuilder;
+ @Mock
+ private NetworkAdapterResources networkAdapterResources;
+ @InjectMocks
+ private NetworkAdapterRestV1 networkAdapterRestV1Tasks;
+
+ private DelegateExecution delegateExecution;
private static final String CREATE_NETWORK_RESPONSE = "createNetworkResponse";
private static final String DELETE_NETWORK_RESPONSE = "deleteNetworkResponse";
@@ -73,6 +84,7 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
@Before
public void setup() {
+ initMocks(this);
delegateExecution = new DelegateExecutionFake();
}
@@ -187,6 +199,53 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
}
}
+ @Test
+ public void callNetworkAdapter_CreateNetworkRequestSuccess() throws Exception {
+ // given
+ String messageId = "createNetReqMessageId";
+ CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
+ createNetworkRequest.setMessageId(messageId);
+ delegateExecution.setVariable("networkAdapterRequest", createNetworkRequest);
+ Status status = Status.OK;
+ String responseEntity = "createNetworkResponse";
+ Optional<Response> response = Optional.of(createResponse(status, responseEntity));
+ when(networkAdapterResources.createNetworkAsync(createNetworkRequest)).thenReturn(response);
+ // when
+ networkAdapterRestV1Tasks.callNetworkAdapter(delegateExecution);
+ // then
+ verifyExecutionContent(status, responseEntity, messageId);
+ }
+
+ @Test
+ public void callNetworkAdapter_DeleteNetworkRequestSuccess() throws Exception {
+ // given
+ String messageId = "DeleteNetReqMessageId";
+ DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest();
+ deleteNetworkRequest.setMessageId(messageId);
+ delegateExecution.setVariable("networkAdapterRequest", deleteNetworkRequest);
+ Status status = Status.OK;
+ String responseEntity = "createNetworkResponse";
+ Optional<Response> response = Optional.of(createResponse(status, responseEntity));
+ when(networkAdapterResources.deleteNetworkAsync(deleteNetworkRequest)).thenReturn(response);
+ // when
+ networkAdapterRestV1Tasks.callNetworkAdapter(delegateExecution);
+ // then
+ verifyExecutionContent(status, responseEntity, messageId);
+ }
+
+ private void verifyExecutionContent(Status status, String responseEntity, String messageId) {
+ assertEquals(delegateExecution.getVariable("NETWORKREST_networkAdapterStatusCode"),
+ Integer.toString(status.getStatusCode()));
+ assertEquals(delegateExecution.getVariable("NETWORKREST_networkAdapterResponse"), responseEntity);
+ assertEquals(delegateExecution.getVariable("NetworkAResponse_CORRELATOR"), messageId);
+ }
+
+ private Response createResponse(Status status, String responseEntity) {
+ OutboundMessageContext outboundMessageContext = new OutboundMessageContext();
+ outboundMessageContext.setEntity(responseEntity);
+ return new OutboundJaxrsResponse(status, outboundMessageContext);
+ }
+
private String createNetworkResponse(String networkResponseType, String networkId) {
return "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><" + networkResponseType + "><networkId>"
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/ControllerExecutionDETestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/ControllerExecutionDETestIT.java
index 860780a2fc..d2f52dac4c 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/ControllerExecutionDETestIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/ControllerExecutionDETestIT.java
@@ -19,50 +19,63 @@
package org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.AssertionsForClassTypes.fail;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.MODEL_UUID;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.MSO_REQUEST_ID;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_BLUEPRINT_NAME;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_BLUEPRINT_VERSION;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_CUSTOMIZATION_UUID;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
import com.google.protobuf.Struct;
-import java.util.List;
import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader;
import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
import org.onap.so.BaseIntegrationTest;
import org.onap.so.GrpcNettyServer;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.client.aai.AAIVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.junit4.rules.SpringClassRule;
+import org.springframework.test.context.junit4.rules.SpringMethodRule;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.AssertionsForClassTypes.fail;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.*;
+@RunWith(Parameterized.class)
public class ControllerExecutionDETestIT extends BaseIntegrationTest {
private Logger logger = LoggerFactory.getLogger(this.getClass());
+ @ClassRule
+ public static final SpringClassRule springClassRule = new SpringClassRule();
+
+ @Rule
+ public final SpringMethodRule smr = new SpringMethodRule();
+
+ private static final String DOWNLOAD_ACTION = "downloadNESw";
+ private static final String ACTIVATE_ACTION = "activateNESw";
+ private static final String PRECHECK_ACTION = "precheck";
+ private static final String POSTCHECK_ACTION = "postcheck";
+ private static final String ASSIGN_ACTION = "config-assign";
+ private static final String DEPLOY_ACTION = "config-deploy";
+ private static final String CDS_ACTOR = "cds";
+
@Autowired
private ControllerExecutionDE controllerExecutionDE;
@Autowired
private GrpcNettyServer grpcNettyServer;
- private GenericVnf genericVnf;
-
private static String TEST_MODEL_UUID = "6bc0b04d-1873-4721-b53d-6615225b2a28";
private static String TEST_SERVICE_INSTANCE_ID = "test_service_id";
private static String TEST_PROCESS_KEY = "processKey1";
private static String TEST_MSO_REQUEST_ID = "ff874603-4222-11e7-9252-005056850d2e";
- private static String TEST_CDS_ACTION = "config-assign";
- private static String TEST_APPC_ACTION = "HealthCheck";
+ private static final AAIVersion VERSION = AAIVersion.LATEST;
private static String TEST_PNF_RESOURCE_INSTANCE_NAME = "PNF_demo_resource";
private static String TEST_PNF_CORRELATION_ID = "PNFDemo";
@@ -70,75 +83,112 @@ public class ControllerExecutionDETestIT extends BaseIntegrationTest {
private static String TEST_PNF_RESOURCE_BLUEPRINT_VERSION = "1.0.1";
private static String TEST_PNF_RESOURCE_CUSTOMIZATION_UUID = "9acb3a83-8a52-412c-9a45-901764938144";
private static String TEST_PNF_UUID = "5df8b6de-2083-11e7-93ae-92361f002671";
+ private static String TEST_SOFTWARE_VERSION = "demo-sw-ver2.0.0";
+
+ private String description;
+ private String action;
+ private String scope;
+
+ public ControllerExecutionDETestIT(String desc, String action, String scope) {
+ this.description = desc;
+ this.action = action;
+ this.scope = scope;
+
+ }
+
+ @Parameterized.Parameters(name = "index {0}")
+ public static Collection<String[]> data() {
+ return Arrays.asList(
+ new String[][] {{"Test JSON for action:" + ACTIVATE_ACTION + " scope:pnf", ACTIVATE_ACTION, "pnf"},
+ {"Test JSON for action:" + DOWNLOAD_ACTION + " scope:pnf", DOWNLOAD_ACTION, "pnf"},
+ {"Test JSON for action:" + ASSIGN_ACTION + " scope:pnf", ASSIGN_ACTION, "pnf"},
+ {"Test JSON for action:" + DEPLOY_ACTION + " scope:pnf", DEPLOY_ACTION, "pnf"},
+ {"Test JSON for action:" + PRECHECK_ACTION + " scope:pnf", PRECHECK_ACTION, "pnf"},
+ {"Test JSON for action:" + POSTCHECK_ACTION + " scope:pnf", POSTCHECK_ACTION, "pnf"}});
+ }
@Before
public void setUp() {
+ delegateExecution.setVariable("testProcessKey", TEST_PROCESS_KEY);
+ delegateExecution.setVariable(PNF_CORRELATION_ID, TEST_PNF_CORRELATION_ID);
delegateExecution.setVariable(MODEL_UUID, TEST_MODEL_UUID);
delegateExecution.setVariable(SERVICE_INSTANCE_ID, TEST_SERVICE_INSTANCE_ID);
delegateExecution.setVariable(MSO_REQUEST_ID, TEST_MSO_REQUEST_ID);
- delegateExecution.setVariable("testProcessKey", TEST_PROCESS_KEY);
+ delegateExecution.setVariable(PNF_UUID, TEST_PNF_UUID);
+ delegateExecution.setVariable(PRC_INSTANCE_NAME, TEST_PNF_RESOURCE_INSTANCE_NAME);
+ delegateExecution.setVariable(PRC_CUSTOMIZATION_UUID, TEST_PNF_RESOURCE_CUSTOMIZATION_UUID);
+ delegateExecution.setVariable(PRC_BLUEPRINT_NAME, TEST_PNF_RESOURCE_BLUEPRINT_NAME);
+ delegateExecution.setVariable(PRC_BLUEPRINT_VERSION, TEST_PNF_RESOURCE_BLUEPRINT_VERSION);
+ delegateExecution.setVariable("targetSoftwareVersion", TEST_SOFTWARE_VERSION);
+
+ delegateExecution.setVariable("actor", CDS_ACTOR);
+ delegateExecution.setVariable("action", this.action);
+ delegateExecution.setVariable("scope", this.scope);
+
+
+ /**
+ * Get the PNF entry from AAI.
+ */
+ if (action.equalsIgnoreCase(DEPLOY_ACTION)) {
+ final String aaiPnfEntry = "{ \n" + " \"pnf-name\":\"PNFDemo\",\n" + " \"pnf-id\":\"testtest\",\n"
+ + " \"in-maint\":true,\n" + " \"resource-version\":\"1541720264047\",\n"
+ + " \"ipaddress-v4-oam\":\"1.1.1.1\",\n" + " \"ipaddress-v6-oam\":\"::/128\"\n" + "}";
+ wireMockServer.stubFor(
+ get(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")).willReturn(okJson(aaiPnfEntry)));
+ }
grpcNettyServer.cleanMessage();
}
@Test
- public void testExecution_cdsConfigAssign_actionExecuted() {
-
- configureCdsConfigAssign();
+ public void testExecution_cds_actions() {
controllerExecutionDE.execute(delegateExecution);
List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages();
assertThat(detailedMessages).hasSize(1);
try {
- checkConfigAssign(detailedMessages.get(0));
+ verifyRequestContentForAction(detailedMessages.get(0));
} catch (Exception e) {
e.printStackTrace();
- fail("ConfigAssign request exception", e);
+ fail(this.action + " request exception", e);
}
}
- private void configureCdsConfigAssign() {
- delegateExecution.setVariable("actor", "cds");
- delegateExecution.setVariable("action", TEST_CDS_ACTION);
- delegateExecution.setVariable("scope", "pnf");
+ private void verifyRequestContentForAction(ExecutionServiceInput executionServiceInput) {
- delegateExecution.setVariable(PNF_CORRELATION_ID, TEST_PNF_CORRELATION_ID);
- delegateExecution.setVariable(PNF_UUID, TEST_PNF_UUID);
- delegateExecution.setVariable(PRC_INSTANCE_NAME, TEST_PNF_RESOURCE_INSTANCE_NAME);
- delegateExecution.setVariable(PRC_CUSTOMIZATION_UUID, TEST_PNF_RESOURCE_CUSTOMIZATION_UUID);
- delegateExecution.setVariable(PRC_BLUEPRINT_NAME, TEST_PNF_RESOURCE_BLUEPRINT_NAME);
- delegateExecution.setVariable(PRC_BLUEPRINT_VERSION, TEST_PNF_RESOURCE_BLUEPRINT_VERSION);
- }
-
- private void checkConfigAssign(ExecutionServiceInput executionServiceInput) {
-
- logger.info("Checking the configAssign request");
+ logger.info("Checking the " + this.action + " request");
ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
- /**
- * the fields of actionIdentifiers should match the one in the
- * response/createVcpeResCustServiceSimplifiedTest_catalogdb.json.
- */
assertThat(actionIdentifiers.getBlueprintName()).isEqualTo(TEST_PNF_RESOURCE_BLUEPRINT_NAME);
assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo(TEST_PNF_RESOURCE_BLUEPRINT_VERSION);
- assertThat(actionIdentifiers.getActionName()).isEqualTo(TEST_CDS_ACTION);
- assertThat(actionIdentifiers.getMode()).isEqualTo("sync");
+ assertThat(actionIdentifiers.getActionName()).isEqualTo(this.action);
CommonHeader commonHeader = executionServiceInput.getCommonHeader();
assertThat(commonHeader.getOriginatorId()).isEqualTo("SO");
assertThat(commonHeader.getRequestId()).isEqualTo(TEST_MSO_REQUEST_ID);
Struct payload = executionServiceInput.getPayload();
- Struct requeststruct = payload.getFieldsOrThrow("config-assign-request").getStructValue();
+ Struct requeststruct = payload.getFieldsOrThrow(this.action + "-request").getStructValue();
assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue())
.isEqualTo(TEST_PNF_CORRELATION_ID);
- Struct propertiesStruct = requeststruct.getFieldsOrThrow("config-assign-properties").getStructValue();
+ Struct propertiesStruct = requeststruct.getFieldsOrThrow(this.action + "-properties").getStructValue();
assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo(TEST_PNF_CORRELATION_ID);
assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue()).isEqualTo(TEST_MODEL_UUID);
assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
.isEqualTo(TEST_PNF_RESOURCE_CUSTOMIZATION_UUID);
+ if (action.equalsIgnoreCase(DEPLOY_ACTION)) {
+ assertThat(actionIdentifiers.getMode()).isEqualTo("async");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv4-address").getStringValue()).isEqualTo("1.1.1.1");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-ipv6-address").getStringValue()).isEqualTo("::/128");
+ } else if (!action.equalsIgnoreCase(ASSIGN_ACTION)) {
+ assertThat(actionIdentifiers.getMode()).isEqualTo("sync");
+ assertThat(propertiesStruct.getFieldsOrThrow("target-software-version").getStringValue())
+ .isEqualTo(TEST_SOFTWARE_VERSION);
+ } else {
+ assertThat(actionIdentifiers.getMode()).isEqualTo("sync");
+ }
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/CdsControllerDETest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/PnfConfigCdsControllerDETest.java
index 79bce8a1f4..d8f607f6d9 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/CdsControllerDETest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/cds/PnfConfigCdsControllerDETest.java
@@ -26,8 +26,10 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.controller.ControllerPreparable;
+import org.onap.so.client.cds.AbstractCDSProcessingBBUtils;
import org.onap.so.client.exception.ExceptionBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
@@ -35,11 +37,12 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {CdsControllerDE.class, ExceptionBuilder.class})
-public class CdsControllerDETest {
+@ContextConfiguration(
+ classes = {PnfConfigCdsControllerDE.class, ExceptionBuilder.class, AbstractCDSProcessingBBUtils.class})
+public class PnfConfigCdsControllerDETest {
@Autowired
- private CdsControllerDE cdsControllerDE;
+ private PnfConfigCdsControllerDE pnfConfigCdsControllerDE;
@MockBean
private ControllerContext controllerContext;
@@ -47,20 +50,49 @@ public class CdsControllerDETest {
@MockBean
private ControllerPreparable<DelegateExecution> preparable;
- @Before
- public void setUp() {
+ @Mock
+ private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils;
+
+ @Test
+ public void testUnderstand_action_assign_TrueReturned() {
+ // when
when(controllerContext.getControllerActor()).thenReturn("cds");
+ when(controllerContext.getControllerScope()).thenReturn("pnf");
+ when(controllerContext.getControllerAction()).thenReturn("config-assign");
+
+ // verify
+ assertTrue(pnfConfigCdsControllerDE.understand(controllerContext));
}
@Test
- public void testUnderstand_validContext_TrueReturned() {
- assertTrue(cdsControllerDE.understand(controllerContext));
+ public void testUnderstand_action_deploy_TrueReturned() {
+ // when
+ when(controllerContext.getControllerActor()).thenReturn("cds");
+ when(controllerContext.getControllerScope()).thenReturn("pnf");
+ when(controllerContext.getControllerAction()).thenReturn("config-deploy");
+
+ // verify
+ assertTrue(pnfConfigCdsControllerDE.understand(controllerContext));
+ }
+
+ @Test
+ public void testUnderstand_action_any_FalseReturned() {
+ // when
+ when(controllerContext.getControllerActor()).thenReturn("cds");
+ when(controllerContext.getControllerScope()).thenReturn("pnf");
+ when(controllerContext.getControllerAction()).thenReturn("any-action");
+
+ // verify
+ assertFalse(pnfConfigCdsControllerDE.understand(controllerContext));
}
@Test
public void testUnderstand_invalidContext_FalseReturned() {
+ // when
when(controllerContext.getControllerActor()).thenReturn("appc");
- assertFalse(cdsControllerDE.understand(controllerContext));
+
+ // verify
+ assertFalse(pnfConfigCdsControllerDE.understand(controllerContext));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SDNCLcmPayloadBuilderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SDNCLcmPayloadBuilderTest.java
new file mode 100644
index 0000000000..61f2ee3432
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SDNCLcmPayloadBuilderTest.java
@@ -0,0 +1,135 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.sdnc;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Before;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.junit.runner.RunWith;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.REQUEST_PAYLOAD;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.common.SoPropertyConstants;
+import org.onap.so.client.sdnc.lcm.beans.payload.*;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+public class SDNCLcmPayloadBuilderTest {
+ private static Logger logger = LoggerFactory.getLogger(SDNCLcmPayloadBuilderTest.class);
+
+ protected static String payload = "{" + "\"ipaddressV4Oam\": \"192.168.1.10\"," + "\"oldSwVersion\": \"v1\","
+ + "\"preCheckRuleName\": \"r101\"," + "\"preCheckAdditionalData\": \"{}\","
+ + "\"preCheckPlaybook\": \"precheck_playbook\"," + "\"swToBeDownloaded\": \"[{"
+ + "\\\"swLocation\\\": \\\"http://192.168.1.20/test.zip\\\"," + "\\\"swFileSize\\\": 123456,"
+ + "\\\"swFileCompression\\\": \\\"ZIP\\\"," + "\\\"swFileFormat\\\": \\\"binary\\\"}]\","
+ + "\"downloadNESwPlaybook\": \"downloadnesw_playbook\","
+ + "\"activateNESwPlaybook\": \"activatenesw_playbook\"," + "\"postCheckRuleName\": \"r102\","
+ + "\"postCheckAdditionalData\": \"{}\"," + "\"postCheckPlaybook\": \"postcheck_playbook\"" + "}";
+ protected String targetSoftwareVersion = "v2";
+
+ @MockBean
+ private DelegateExecution execution;
+
+ public static String getRequestPayload() {
+ return payload;
+ }
+
+ @Before
+ public void setUp() {
+ when(execution.getVariable(REQUEST_PAYLOAD)).thenReturn(payload);
+ when(execution.getVariable(SoPropertyConstants.TARGET_SOFTWARE_VERSION)).thenReturn(targetSoftwareVersion);
+ }
+
+
+ @Test
+ public final void testBuildActivateNESwPayload() {
+ String expectedPayload = "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\","
+ + "\"playbook-name\":\"activatenesw_playbook\"," + "\"swVersionToBeActivated\":\"v2\"" + "}";
+
+ ActivateNESwPayload activateNESwPayload = SDNCLcmPayloadBuilder.buildActivateNESwPayload(execution);
+ try {
+ String payload = SDNCLcmPayloadBuilder.convertToSting(activateNESwPayload);
+ logger.debug("ActivateNESwPayload:\n" + payload);
+
+ assertEquals(expectedPayload, payload);
+ } catch (JsonProcessingException e) {
+ fail("Convert ActivateNESwPayload to String error: " + e.toString());
+ }
+ }
+
+ @Test
+ public final void testBuildDownloadNESwPayload() {
+ String expectedSwToBeDownloadedElement = "{" + "\"swLocation\":\"http://192.168.1.20/test.zip\","
+ + "\"swFileSize\":123456," + "\"swFileCompression\":\"ZIP\"," + "\"swFileFormat\":\"binary\"" + "}";
+ String expectedPayload =
+ "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\"," + "\"playbook-name\":\"downloadnesw_playbook\","
+ + "\"swToBeDownloaded\":[" + expectedSwToBeDownloadedElement + "]" + "}";
+
+ DownloadNESwPayload downloadNESwPayload = SDNCLcmPayloadBuilder.buildDownloadNESwPayload(execution);
+ try {
+ String payload = SDNCLcmPayloadBuilder.convertToSting(downloadNESwPayload);
+ logger.debug("DownloadNESwPayload:\n" + payload);
+
+ assertEquals(expectedPayload, payload);
+ } catch (JsonProcessingException e) {
+ fail("Convert DownloadNESwPayload to String error: " + e.toString());
+ }
+ }
+
+ @Test
+ public final void testBuildUpgradePostCheckPayload() {
+ String expectedPayload = "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\","
+ + "\"playbook-name\":\"postcheck_playbook\"," + "\"oldSwVersion\":\"v1\","
+ + "\"targetSwVersion\":\"v2\"," + "\"ruleName\":\"r102\"," + "\"additionalData\":\"{}\"" + "}";
+
+ UpgradePostCheckPayload upgradePostCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePostCheckPayload(execution);
+ try {
+ String payload = SDNCLcmPayloadBuilder.convertToSting(upgradePostCheckPayload);
+ logger.debug("UpgradePostCheckPayload:\n" + payload);
+
+ assertEquals(expectedPayload, payload);
+ } catch (JsonProcessingException e) {
+ fail("Convert UpgradePostCheckPayload to String error: " + e.toString());
+ }
+ }
+
+ @Test
+ public final void testBuildUpgradePreCheckPayload() {
+ String expectedPayload = "{" + "\"ipaddress-v4-oam\":\"192.168.1.10\","
+ + "\"playbook-name\":\"precheck_playbook\"," + "\"oldSwVersion\":\"v1\","
+ + "\"targetSwVersion\":\"v2\"," + "\"ruleName\":\"r101\"," + "\"additionalData\":\"{}\"" + "}";
+
+ UpgradePreCheckPayload upgradePreCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePreCheckPayload(execution);
+ try {
+ String payload = SDNCLcmPayloadBuilder.convertToSting(upgradePreCheckPayload);
+ logger.debug("UpgradePreCheckPayload:\n" + payload);
+
+ assertEquals(expectedPayload, payload);
+ } catch (JsonProcessingException e) {
+ fail("Convert UpgradePreCheckPayload to String error: " + e.toString());
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDETest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDETest.java
index 674167624e..02c7dca9ae 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDETest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDETest.java
@@ -28,7 +28,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
import org.onap.so.bpmn.infrastructure.decisionpoint.api.controller.ControllerPreparable;
-import org.onap.so.client.appc.ApplicationControllerAction;
import org.onap.so.client.exception.ExceptionBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
@@ -48,9 +47,6 @@ public class SdncControllerDETest {
@MockBean
private ControllerPreparable<DelegateExecution> preparable;
- @MockBean
- protected ApplicationControllerAction client;
-
@Before
public void setUp() {
when(controllerContext.getControllerActor()).thenReturn("sdnc");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBBTest.java
new file mode 100644
index 0000000000..24bbc78afb
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericCDSProcessingBBTest.java
@@ -0,0 +1,197 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Bell Canada.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.*;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.Resources;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.Vnfs;
+import org.springframework.beans.factory.annotation.Autowired;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.*;
+
+public class GenericCDSProcessingBBTest extends BaseTaskTest {
+
+ private static final String VNF_SCOPE = "vnf";
+ private static final String TEST_VNF_MODEL_CUSTOMIZATION_UUID = "23ce9ac4-e5dd-11e9-81b4-2a2ae2dbcce4";
+ private static final String DEPLOY_ACTION_FOR_CDS = "configDeploy";
+ private static final String GENERAL_BLOCK_EXECUTION_MAP_KEY = "gBBInput";
+ private static final String BUILDING_BLOCK = "buildingBlock";
+ private static final String TEST_MSO_REQUEST_ID = "ff874603-4222-11e7-9252-005056850d2e";
+ private static final String EXECUTION_OBJECT = "executionObject";
+ private static final String BLUEPRINT_NAME = "test";
+ private static final String BLUEPRINT_VERSION = "1.0.0";
+
+ @InjectMocks
+ private GenericCDSProcessingBB controllerRunnable;
+
+ @Mock
+ private AbstractCDSProcessingBBUtils cdsDispather;
+
+ @Mock
+ private GeneratePayloadForCds generatePayloadForCds;
+
+ private BuildingBlockExecution buildingBlockExecution;
+
+ private ExecuteBuildingBlock executeBuildingBlock;
+
+ @Before
+ public void setUp() {
+ buildingBlockExecution = createBuildingBlockExecution();
+ executeBuildingBlock = new ExecuteBuildingBlock();
+ }
+
+ @Test
+ public void testExecutionObjectCreationForVnf() throws Exception {
+ // given
+ ControllerContext<BuildingBlockExecution> controllerContext = new ControllerContext<>();
+ controllerContext.setExecution(buildingBlockExecution);
+ controllerContext.setControllerActor("CDS");
+ controllerContext.setControllerScope("vnf");
+ setScopeAndAction(VNF_SCOPE, DEPLOY_ACTION_FOR_CDS);
+ AbstractCDSPropertiesBean cdsBean = prepareCDSBean();
+
+ doReturn(cdsBean).when(generatePayloadForCds).buildCdsPropertiesBean(buildingBlockExecution);
+ doNothing().when(cdsDispather).constructExecutionServiceInputObject(buildingBlockExecution);
+ doNothing().when(cdsDispather).sendRequestToCDSClient(buildingBlockExecution);
+
+ // when
+ Boolean isUnderstandable = controllerRunnable.understand(controllerContext);
+ Boolean isReady = controllerRunnable.ready(controllerContext);
+ controllerRunnable.prepare(controllerContext);
+ controllerRunnable.run(controllerContext);
+
+ // verify
+ assertEquals(isUnderstandable, true);
+ assertEquals(isReady, true);
+ AbstractCDSPropertiesBean executionObject = buildingBlockExecution.getVariable(EXECUTION_OBJECT);
+ assertNotNull(executionObject);
+ assertThat(executionObject).isInstanceOf(AbstractCDSPropertiesBean.class);
+ assertEquals(BLUEPRINT_NAME, executionObject.getBlueprintName());
+ assertEquals(BLUEPRINT_VERSION, executionObject.getBlueprintVersion());
+ assertEquals(TEST_MSO_REQUEST_ID, executionObject.getRequestId());
+ assertNotNull(executionObject.getRequestObject());
+ }
+
+ private AbstractCDSPropertiesBean prepareCDSBean() {
+ AbstractCDSPropertiesBean cdsBean = new AbstractCDSPropertiesBean();
+ cdsBean.setBlueprintName(BLUEPRINT_NAME);
+ cdsBean.setBlueprintVersion(BLUEPRINT_VERSION);
+ cdsBean.setRequestId(TEST_MSO_REQUEST_ID);
+ cdsBean.setRequestObject("requestObject");
+
+ return cdsBean;
+ }
+
+ private GeneralBuildingBlock createGeneralBuildingBlock() {
+ GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock();
+ RequestContext requestContext = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUserParams(createRequestParameters());
+ requestContext.setRequestParameters(requestParameters);
+ requestContext.setMsoRequestId(TEST_MSO_REQUEST_ID);
+ generalBuildingBlock.setRequestContext(requestContext);
+ return generalBuildingBlock;
+ }
+
+ private List<Map<String, Object>> createRequestParameters() {
+ List<Map<String, Object>> userParams = new ArrayList<>();
+ Map<String, Object> userParamMap = new HashMap<>();
+ userParamMap.put("service", getUserParams());
+ userParams.add(userParamMap);
+ return userParams;
+ }
+
+ private Service getUserParams() {
+ Service service = new Service();
+ Resources resources = new Resources();
+ resources.setVnfs(createVnfList());
+ service.setResources(resources);
+ return service;
+ }
+
+ private List<Vnfs> createVnfList() {
+ List<Map<String, String>> instanceParamsListSearchedVnf = new ArrayList<>();
+ Map<String, String> instanceParam = new HashMap<>();
+ instanceParam.put("sec_group", "sec_group");
+ instanceParam.put("net_id", "acl-cloud-region");
+ instanceParamsListSearchedVnf.add(instanceParam);
+ Vnfs searchedVnf = createVnf(instanceParamsListSearchedVnf);
+ List<Vnfs> vnfList = new ArrayList<>();
+ vnfList.add(searchedVnf);
+ return vnfList;
+ }
+
+ private Vnfs createVnf(List<Map<String, String>> instanceParamsList) {
+ Vnfs vnf = new Vnfs();
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationId(TEST_VNF_MODEL_CUSTOMIZATION_UUID);
+ vnf.setModelInfo(modelInfo);
+ vnf.setInstanceParams(instanceParamsList);
+ return vnf;
+ }
+
+ private BuildingBlockExecution createBuildingBlockExecution() {
+ DelegateExecution execution = new DelegateExecutionFake();
+ execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY, createGeneralBuildingBlock());
+ return new DelegateExecutionImpl(execution);
+ }
+
+ private void setScopeAndAction(String scope, String action) {
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnScope(scope);
+ buildingBlock.setBpmnAction(action);
+ executeBuildingBlock.setBuildingBlock(buildingBlock);
+ buildingBlockExecution.setVariable(BUILDING_BLOCK, executeBuildingBlock);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java
new file mode 100644
index 0000000000..d6a28cba25
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java
@@ -0,0 +1,156 @@
+/*
+ * ============LICENSE_START======================================================= Copyright (C) 2020 Nokia. 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.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl;
+import org.json.JSONObject;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.EXECUTION_OBJECT;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.MSO_REQUEST_ID;
+import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_NAME;
+import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_VERSION;
+import static org.onap.so.client.cds.PayloadConstants.SCOPE;
+
+@RunWith(MockitoJUnitRunner.class)
+public class GenericPnfCDSControllerRunnableBBTest {
+
+ @Mock
+ private ExtractPojosForBB extractPojosForBB;
+
+ @InjectMocks
+ private GenericPnfCDSControllerRunnableBB genericPnfCDSControllerRunnableBB;
+
+ private ControllerContext<BuildingBlockExecution> controllerContext;
+ private BuildingBlockExecution execution;
+
+ private final static String blueprintName = "blueprint_name";
+ private final static String blueprintVersion = "blueprint_version";
+ private final static String msoRequestId = "mso_request_id";
+ private final static String pnfID = "5df8b6de-2083-11e7-93ae-92361f002671";
+ private final static String serviceInstanceID = "test_service_id";
+ private final static String pnfName = "PNFDemo";
+ private final static String serviceModelUUID = "6bc0b04d-1873-4721-b53d-6615225b2a28";
+ private final static String pnfCustomizationUUID = "9acb3a83-8a52-412c-9a45-901764938144";
+ private final static String action = "action";
+
+ @Before
+ public void setUp() {
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
+ BuildingBlock buildingBlock = new BuildingBlock();
+
+ buildingBlock.setBpmnAction(action);
+ executeBuildingBlock.setBuildingBlock(buildingBlock);
+
+ execution = new DelegateExecutionImpl(new ExecutionImpl());
+ execution.setVariable("buildingBlock", executeBuildingBlock);
+ execution.setVariable(PRC_BLUEPRINT_NAME, blueprintName);
+ execution.setVariable(PRC_BLUEPRINT_VERSION, blueprintVersion);
+ execution.setVariable(MSO_REQUEST_ID, msoRequestId);
+ execution.setVariable(SCOPE, "scope");
+
+ controllerContext = new ControllerContext<>();
+ controllerContext.setExecution(execution);
+ }
+
+ @Test
+ public void understandTest() {
+ // given
+ controllerContext.setControllerScope("pnf");
+ controllerContext.setControllerActor("cds");
+
+ // when, then
+ assertTrue(genericPnfCDSControllerRunnableBB.understand(controllerContext));
+ }
+
+ @Test
+ public void readyTest() {
+ // when, then
+ assertTrue(genericPnfCDSControllerRunnableBB.ready(controllerContext));
+ }
+
+ @Test
+ public void prepareTest() throws BBObjectNotFoundException {
+ // given
+ prepareData();
+
+ // when
+ genericPnfCDSControllerRunnableBB.prepare(controllerContext);
+
+ // then
+ final AbstractCDSPropertiesBean abstractCDSPropertiesBean = execution.getVariable(EXECUTION_OBJECT);
+ final JSONObject actionProperties = new JSONObject(abstractCDSPropertiesBean.getRequestObject())
+ .getJSONObject("action-request").getJSONObject("action-properties");
+
+ assertThat(abstractCDSPropertiesBean).isNotNull();
+ assertThat(abstractCDSPropertiesBean.getRequestObject()).isNotNull();
+ assertThat(abstractCDSPropertiesBean.getRequestObject()).isInstanceOf(String.class);
+
+ assertEquals(blueprintName, abstractCDSPropertiesBean.getBlueprintName());
+ assertEquals(blueprintVersion, abstractCDSPropertiesBean.getBlueprintVersion());
+ assertEquals(msoRequestId, abstractCDSPropertiesBean.getRequestId());
+ assertEquals(action, abstractCDSPropertiesBean.getActionName());
+ assertEquals("sync", abstractCDSPropertiesBean.getMode());
+ assertEquals("SO", abstractCDSPropertiesBean.getOriginatorId());
+
+ assertEquals(pnfID, actionProperties.get("pnf-id"));
+ assertEquals(serviceInstanceID, actionProperties.get("service-instance-id"));
+ assertEquals(serviceModelUUID, actionProperties.get("service-model-uuid"));
+ assertEquals(pnfName, actionProperties.get("pnf-name"));
+ assertEquals(pnfCustomizationUUID, actionProperties.get("pnf-customization-uuid"));
+ }
+
+ private void prepareData() throws BBObjectNotFoundException {
+ Pnf pnf = new Pnf();
+ ServiceInstance serviceInstance = new ServiceInstance();
+
+ pnf.setPnfName(pnfName);
+ pnf.setPnfId(pnfID);
+ ModelInfoPnf modelInfoPnf = new ModelInfoPnf();
+ modelInfoPnf.setModelCustomizationUuid(pnfCustomizationUUID);
+ pnf.setModelInfoPnf(modelInfoPnf);
+
+ serviceInstance.setServiceInstanceId(serviceInstanceID);
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelUuid(serviceModelUUID);
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.PNF))).thenReturn(pnf);
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDETest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDETest.java
new file mode 100644
index 0000000000..ae5f4370e6
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDETest.java
@@ -0,0 +1,139 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.client.cds.AbstractCDSProcessingBBUtils;
+import org.onap.so.client.cds.GeneratePayloadForCds;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.springframework.test.context.junit4.rules.SpringClassRule;
+import org.springframework.test.context.junit4.rules.SpringMethodRule;
+import java.util.Arrays;
+import java.util.Collection;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.fail;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.*;
+
+@RunWith(Parameterized.class)
+public class GenericPnfCDSProcessingDETest extends BaseTaskTest {
+
+ @ClassRule
+ public static final SpringClassRule springClassRule = new SpringClassRule();
+
+ @Rule
+ public final SpringMethodRule smr = new SpringMethodRule();
+
+ @InjectMocks
+ private GenericPnfCDSProcessingDE controllerRunnable;
+
+ @Mock
+ private GeneratePayloadForCds generatePayloadForCds;
+
+ @Mock
+ private AbstractCDSProcessingBBUtils cdsDispather;
+
+ private static final String PRECHECK_ACTION = "precheck";
+ private static final String DOWNLOAD_ACTION = "downloadNESw";
+ private static final String ACTIVATE_ACTION = "activateNESw";
+ private static final String POSTCHECK_ACTION = "postcheck";
+
+ private String description;
+ private String action;
+ private String scope;
+ private String expectedJson;
+
+ public GenericPnfCDSProcessingDETest(String desc, String action, String scope, String expectedJson) {
+ this.description = desc;
+ this.action = action;
+ this.scope = scope;
+ this.expectedJson = expectedJson;
+
+ }
+
+ @Parameterized.Parameters(name = "index {0}")
+ public static Collection<String[]> data() {
+ return Arrays.asList(new String[][] {
+ {"Test JSON for action:" + PRECHECK_ACTION + " scope:pnf", PRECHECK_ACTION, "pnf",
+ buildExpectedJson(PRECHECK_ACTION, "pnf")},
+ {"Test JSON for action:" + DOWNLOAD_ACTION + " scope:pnf", DOWNLOAD_ACTION, "pnf",
+ buildExpectedJson(DOWNLOAD_ACTION, "pnf")},
+ {"Test JSON for action:" + ACTIVATE_ACTION + " scope:pnf", ACTIVATE_ACTION, "pnf",
+ buildExpectedJson(ACTIVATE_ACTION, "pnf")},
+ {"Test JSON for action:" + POSTCHECK_ACTION + " scope:pnf", POSTCHECK_ACTION, "pnf",
+ buildExpectedJson(POSTCHECK_ACTION, "pnf")},});
+ }
+
+ private static String buildExpectedJson(String action, String scope) {
+ return "{\"" + action + "-request\":" + "{\"" + action + "-" + "properties\":"
+ + "{\"service-instance-id\":\"test_service_id\","
+ + "\"pnf-customization-uuid\":\"9acb3a83-8a52-412c-9a45-901764938144\","
+ + "\"pnf-id\":\"5df8b6de-2083-11e7-93ae-92361f002671\","
+ + "\"target-software-version\":\"demo-sw-ver2.0.0\"," + "\"pnf-name\":\"PNFDemo\","
+ + "\"service-model-uuid\":\"6bc0b04d-1873-4721-b53d-6615225b2a28\"}," + "\"resolution-key\":\"PNFDemo\""
+ + "}" + "}";
+ }
+
+ private DelegateExecution execution = new DelegateExecutionFake();
+
+ @Test
+ public void testExecution_validPnf_action_executionObjectCreated() {
+ try {
+
+ // given
+ ControllerContext controllerContext = new ControllerContext();
+ controllerContext.setExecution(execution);
+ controllerContext.setControllerActor("cds");
+ controllerContext.setControllerAction(this.action);
+ controllerContext.setControllerScope(this.scope);
+ AbstractCDSPropertiesBean bean = new AbstractCDSPropertiesBean();
+ doNothing().when(cdsDispather).constructExecutionServiceInputObject(execution);
+ doNothing().when(cdsDispather).sendRequestToCDSClient(execution);
+ doReturn(bean).when(generatePayloadForCds).buildCdsPropertiesBean(execution);
+
+ // when
+ Boolean isUnderstandable = controllerRunnable.understand(controllerContext);
+ Boolean isReady = controllerRunnable.ready(controllerContext);
+ controllerRunnable.prepare(controllerContext);
+ controllerRunnable.run(controllerContext);
+
+ // verify
+ assertEquals(isUnderstandable, true);
+ assertEquals(isReady, true);
+ Object executionObject = execution.getVariable(EXECUTION_OBJECT);
+ assertThat(executionObject).isNotNull();
+ assertThat(executionObject).isInstanceOf(AbstractCDSPropertiesBean.class);
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Exception thrown" + e.getMessage());
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java
new file mode 100644
index 0000000000..fb162f857b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java
@@ -0,0 +1,202 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Tech Mahindra
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.bpmn.infrastructure.workflow.tasks.listeners;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.List;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class SkipCDSBuildingBlockListenerTest {
+
+ private static final String VNF_SCOPE = "VNF";
+ private static final String VF_SCOPE = "VFModule";
+ private static final String TEST_MODELUUID = "123456789";
+ private static final String VNF_TEST_ACTION = "VnfConfigAssign";
+ private static final String VFModule_TEST_ACTION = "VfModuleConfigAssign";
+ private static final String MODELCUSTOMIZATIONUUID = "123456789";
+ private static final String BBNAME = "ControllerExecutionBB";
+ private static final boolean ISFIRST = true;
+
+ private int actual;
+ private List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+ private List<VnfResourceCustomization> vnfResourceCustomization;
+ private List<VfModuleCustomization> vfModuleCustomization;
+ private ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
+ private RequestDetails reqDetail = new RequestDetails();
+ private BuildingBlockExecution buildingBlockExecution = new DelegateExecutionImpl(new DelegateExecutionFake());
+ private VnfResourceCustomization vnfCust = new VnfResourceCustomization();
+ private VfModuleCustomization vfCust = new VfModuleCustomization();
+ private BuildingBlock buildingBlock = new BuildingBlock();
+
+ @InjectMocks
+ private SkipCDSBuildingBlockListener skipCDSBuildingBlockListener;
+ @Mock
+ private CatalogDbClient catalogDbClient;
+
+ @Before
+ public void before() {
+ ModelInfo model = new ModelInfo();
+ model.setModelUuid(TEST_MODELUUID);
+ reqDetail.setModelInfo(model);
+ executeBuildingBlock.setRequestDetails(reqDetail);
+ }
+
+ @Test
+ public void testTrigger() {
+ BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
+ skipCDSBuildingBlockListener.shouldRunFor(BBNAME, ISFIRST, execution);
+ assertEquals("ControllerExecutionBB", BBNAME);
+ }
+
+ @Test
+ public void testProcessForVNFToSkipCDSBB() {
+ // given
+ setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, 0);
+ vnfResourceCustomization = getVnfResourceCustomizationList(true);
+
+ when(catalogDbClient.getVnfResourceCustomizationByModelUuid(
+ executeBuildingBlock.getRequestDetails().getModelInfo().getModelUuid()))
+ .thenReturn(vnfResourceCustomization);
+ when(catalogDbClient.findVnfResourceCustomizationInList(executeBuildingBlock.getBuildingBlock().getKey(),
+ vnfResourceCustomization)).thenReturn(vnfCust);
+
+ // when
+ skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
+
+ // then
+ actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ assertEquals(1, actual);
+
+ }
+
+ @Test
+ public void testProcessForVNFNotToSkipCDSBB() {
+ // given
+ setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, 0);
+ vnfResourceCustomization = getVnfResourceCustomizationList(false);
+
+ when(catalogDbClient.getVnfResourceCustomizationByModelUuid(
+ executeBuildingBlock.getRequestDetails().getModelInfo().getModelUuid()))
+ .thenReturn(vnfResourceCustomization);
+ when(catalogDbClient.findVnfResourceCustomizationInList(executeBuildingBlock.getBuildingBlock().getKey(),
+ vnfResourceCustomization)).thenReturn(vnfCust);
+
+ // when
+ skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
+
+ // then
+ actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ assertEquals(0, actual);
+
+ }
+
+
+ @Test
+ public void testProcessForVFToSkipCDSBB() {
+ // given
+ setBuildingBlockAndCurrentSequence(VF_SCOPE, VFModule_TEST_ACTION, 0);
+ vfModuleCustomization = getVfModuleCustomizationList(true);
+
+ when(catalogDbClient
+ .getVfModuleCustomizationByModelCuztomizationUUID(executeBuildingBlock.getBuildingBlock().getKey()))
+ .thenReturn(vfCust);
+
+ // when
+ skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
+
+ // then
+ actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ assertEquals(1, actual);
+
+ }
+
+ @Test
+ public void testProcessForVFNotToSkipCDSBB() {
+ // given
+ setBuildingBlockAndCurrentSequence(VF_SCOPE, VFModule_TEST_ACTION, 0);
+ vfModuleCustomization = getVfModuleCustomizationList(false);
+
+ when(catalogDbClient
+ .getVfModuleCustomizationByModelCuztomizationUUID(executeBuildingBlock.getBuildingBlock().getKey()))
+ .thenReturn(vfCust);
+
+ // when
+ skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
+
+ // then
+ actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ assertEquals(0, actual);
+
+ }
+
+ /**
+ * setting scope action in buildingBlock and BB current sequence in BuildingBlockExecution
+ *
+ * @param scope
+ * @param action
+ * @param squence
+ */
+ private void setBuildingBlockAndCurrentSequence(String scope, String action, int sequence) {
+ buildingBlock.setBpmnScope(scope);
+ buildingBlock.setBpmnAction(action);
+ buildingBlock.setBpmnFlowName("ControllerExecutionBB");
+ buildingBlock.setKey(MODELCUSTOMIZATIONUUID);
+ executeBuildingBlock.setBuildingBlock(buildingBlock);
+ buildingBlockExecution.setVariable(BBConstants.G_CURRENT_SEQUENCE, sequence);
+
+ }
+
+ private List<VnfResourceCustomization> getVnfResourceCustomizationList(boolean setSkippost) {
+ List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>();
+ vnfCust.setModelCustomizationUUID(MODELCUSTOMIZATIONUUID);
+ vnfCust.setSkipPostInstConf(setSkippost);
+ vnfResourceCustomizations.add(vnfCust);
+ return vnfResourceCustomizations;
+ }
+
+ private List<VfModuleCustomization> getVfModuleCustomizationList(boolean setSkippost) {
+ List<VfModuleCustomization> vfModuleCustomizations = new ArrayList<>();
+ vfCust.setModelCustomizationUUID(MODELCUSTOMIZATIONUUID);
+ vfCust.setSkipPostInstConf(setSkippost);
+ vfModuleCustomizations.add(vfCust);
+ return vfModuleCustomizations;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
new file mode 100644
index 0000000000..0d68cf362b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Nokia 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.onap.so.bpmn.infrastructure.workflow.tasks.utils;
+
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
+import java.util.function.Supplier;
+import static org.junit.Assert.assertEquals;
+
+
+public class WorkflowResourceIdsUtilsTest {
+
+ private static final String SERVICE_ID = "serviceId";
+ private static final String NETWORK_ID = "networkId";
+ private static final String VF_MODULE_ID = "vfModuleId";
+ private static final String VNF_ID = "vnfId";
+ private static final String VOLUME_GROUP_ID = "volumeGroupId";
+ private static final String INSTANCE_GROUP_ID = "instanceGroupId";
+ private static final String PNF_ID = "pnfId";
+ private static final String NETWORK_COLLECTION_ID = "networkCollectionId";
+ private static final String CONFIGURATION_ID = "configurationId";
+
+ private WorkflowResourceIds workflowResourceIds;
+
+ @Before
+ public void setUp() {
+ workflowResourceIds = new WorkflowResourceIds();
+ }
+
+ @Test
+ public void shouldProperlySetFieldsFromExecution() {
+ DelegateExecutionFake execution = new DelegateExecutionFake();
+ execution.setVariable("serviceInstanceId", SERVICE_ID);
+ execution.setVariable("networkId", NETWORK_ID);
+ execution.setVariable("vfModuleId", VF_MODULE_ID);
+ execution.setVariable("vnfId", VNF_ID);
+ execution.setVariable("volumeGroupId", VOLUME_GROUP_ID);
+ execution.setVariable("instanceGroupId", INSTANCE_GROUP_ID);
+
+ workflowResourceIds = WorkflowResourceIdsUtils.getWorkflowResourceIdsFromExecution(execution);
+
+ assertEquals(SERVICE_ID, workflowResourceIds.getServiceInstanceId());
+ assertEquals(NETWORK_ID, workflowResourceIds.getNetworkId());
+ assertEquals(VF_MODULE_ID, workflowResourceIds.getVfModuleId());
+ assertEquals(VNF_ID, workflowResourceIds.getVnfId());
+ assertEquals(VOLUME_GROUP_ID, workflowResourceIds.getVolumeGroupId());
+ assertEquals(INSTANCE_GROUP_ID, workflowResourceIds.getInstanceGroupId());
+ }
+
+ @Test
+ public void shouldProperlySetServiceInstanceId() {
+ assertFieldSetProperly(WorkflowType.SERVICE, SERVICE_ID, workflowResourceIds::getServiceInstanceId);
+ }
+
+ @Test
+ public void shouldProperlySetVnfId() {
+ assertFieldSetProperly(WorkflowType.VNF, VNF_ID, workflowResourceIds::getVnfId);
+
+ }
+
+ @Test
+ public void shouldProperlySetPnfId() {
+ assertFieldSetProperly(WorkflowType.PNF, PNF_ID, workflowResourceIds::getPnfId);
+ }
+
+ @Test
+ public void shouldProperlySetVfModuleId() {
+ assertFieldSetProperly(WorkflowType.VFMODULE, VF_MODULE_ID, workflowResourceIds::getVfModuleId);
+ }
+
+ @Test
+ public void shouldProperlySetVolumeGroupId() {
+ assertFieldSetProperly(WorkflowType.VOLUMEGROUP, VOLUME_GROUP_ID, workflowResourceIds::getVolumeGroupId);
+ }
+
+ @Test
+ public void shouldProperlySetNetworkId() {
+ assertFieldSetProperly(WorkflowType.NETWORK, NETWORK_ID, workflowResourceIds::getNetworkId);
+ }
+
+ @Test
+ public void shouldProperlySetNetworkCollectionId() {
+ assertFieldSetProperly(WorkflowType.NETWORKCOLLECTION, NETWORK_COLLECTION_ID,
+ workflowResourceIds::getNetworkCollectionId);
+
+ }
+
+ @Test
+ public void shouldProperlySetConfigurationId() {
+ assertFieldSetProperly(WorkflowType.CONFIGURATION, CONFIGURATION_ID, workflowResourceIds::getConfigurationId);
+ }
+
+ @Test
+ public void shouldProperlySetInstanceGroupId() {
+ assertFieldSetProperly(WorkflowType.INSTANCE_GROUP, INSTANCE_GROUP_ID, workflowResourceIds::getInstanceGroupId);
+ }
+
+ private void assertFieldSetProperly(WorkflowType workflowType, String expectedId,
+ Supplier<String> testedObjectField) {
+ WorkflowResourceIdsUtils.setResourceIdByWorkflowType(workflowResourceIds, workflowType, expectedId);
+ assertEquals(expectedId, testedObjectField.get());
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
index 9855c8587a..8b08afdb44 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -20,8 +20,6 @@
package org.onap.so.client.orchestration;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
@@ -37,8 +35,8 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
@@ -46,7 +44,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
-import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
@@ -54,7 +51,6 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-import org.onap.so.bpmn.common.data.TestDataSetup;
@RunWith(MockitoJUnitRunner.Silent.class)
@@ -242,22 +238,4 @@ public class AAIConfigurationResourcesTest extends TestDataSetup {
any(org.onap.aai.domain.yang.Configuration.class));
}
- @Test
- public void checkConfigurationNameInUseTrueTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
- .queryParam("configuration-name", "configurationName");
- doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
- boolean nameInUse = aaiConfigurationResources.checkConfigurationNameInUse("configurationName");
- assertTrue(nameInUse);
- }
-
- @Test
- public void checkConfigurationNameInUseFalseTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
- .queryParam("configuration-name", "configurationName");
- doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
- boolean nameInUse = aaiConfigurationResources.checkConfigurationNameInUse("configurationName");
- assertFalse(nameInUse);
- }
-
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
index cb5683d9d8..0995af058e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
@@ -20,11 +20,10 @@
package org.onap.so.client.orchestration;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
@@ -37,8 +36,8 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -46,10 +45,10 @@ import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
-import org.onap.so.db.catalog.beans.OrchestrationStatus;
@RunWith(MockitoJUnitRunner.Silent.class)
public class AAIInstanceGroupResourcesTest extends TestDataSetup {
@@ -136,7 +135,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseTrueTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
.queryParam("instance-group-name", "instanceGroupName");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName");
@@ -145,7 +144,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseFalseTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
.queryParam("instance-group-name", "instanceGroupName");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
index b6161d7669..e744e7d0df 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
@@ -61,6 +61,7 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.Relationships;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -203,11 +204,11 @@ public class AAINetworkResourcesTest extends TestDataSetup {
new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicies.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
Optional<org.onap.aai.domain.yang.NetworkPolicies> oNetPolicies = Optional.empty();
- AAIResourceUri netPoliciesUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ AAIPluralResourceUri netPoliciesUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
- doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
+ doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIPluralResourceUri.class));
oNetPolicies = aaiNetworkResources.getNetworkPolicies(netPoliciesUri);
- verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class));
+ verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIPluralResourceUri.class));
if (oNetPolicies.isPresent()) {
org.onap.aai.domain.yang.NetworkPolicies networkPolicies = oNetPolicies.get();
assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.NetworkPolicies.class).get(),
@@ -428,7 +429,7 @@ public class AAINetworkResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseTrueTest() throws Exception {
- AAIResourceUri uri =
+ AAIPluralResourceUri uri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName");
@@ -437,7 +438,7 @@ public class AAINetworkResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseFalseTest() throws Exception {
- AAIResourceUri uri =
+ AAIPluralResourceUri uri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
index ea98ee0169..d2a1f77922 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
@@ -24,8 +24,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
@@ -39,8 +39,8 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
@@ -48,6 +48,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -194,7 +195,7 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup {
@Test
public void checkInstanceServiceNameInUseTrueTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
.queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiServiceInstanceResources.checkInstanceServiceNameInUse(serviceInstance);
@@ -203,7 +204,7 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup {
@Test
public void checkInstanceServiceNameInUseFalseTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
.queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiServiceInstanceResources.checkInstanceServiceNameInUse(serviceInstance);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
index 9e3bc4f552..7bae50a0a9 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
@@ -38,14 +38,15 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -162,9 +163,9 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseTrueTest() throws Exception {
- AAIResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
.queryParam("vf-module-name", vfModule.getVfModuleName());
- AAIResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
+ AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
vfModule.getModelInfoVfModule().getModelCustomizationUUID());
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUriWithCustomization));
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUri));
@@ -174,9 +175,9 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseIsResumeTest() throws Exception {
- AAIResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
.queryParam("vf-module-name", vfModule.getVfModuleName());
- AAIResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
+ AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
vfModule.getModelInfoVfModule().getModelCustomizationUUID());
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUriWithCustomization));
boolean nameInUse = aaiVfModuleResources.checkNameInUse(vfModule);
@@ -185,9 +186,9 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseTest() throws Exception {
- AAIResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
+ AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE)
.queryParam("vf-module-name", vfModule.getVfModuleName());
- AAIResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
+ AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id",
vfModule.getModelInfoVfModule().getModelCustomizationUUID());
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUriWithCustomization));
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUri));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
index 425b595686..b1bacb8add 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
@@ -43,8 +43,8 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
@@ -56,6 +56,7 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.AAIRestClientImpl;
import org.onap.so.client.aai.AAIValidatorImpl;
import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -243,7 +244,7 @@ public class AAIVnfResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseTrueTest() {
- AAIResourceUri vnfUri =
+ AAIPluralResourceUri vnfUri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(vnfUri));
boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName");
@@ -252,7 +253,7 @@ public class AAIVnfResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseTest() {
- AAIResourceUri vnfUri =
+ AAIPluralResourceUri vnfUri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vnfUri));
boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
index 5772cab995..31a0e34a26 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
@@ -37,14 +37,14 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -155,7 +155,7 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseTrueTest() {
- AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
.queryParam("volume-group-name", "testVolumeGroupName1");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri));
boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup);
@@ -164,7 +164,7 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseTest() {
- AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
.queryParam("volume-group-name", "testVolumeGroupName1");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri));
boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java
index 0cbdee396f..2688b33e51 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java
@@ -37,6 +37,7 @@ import org.onap.aai.domain.yang.VpnBindings;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
@@ -90,12 +91,12 @@ public class AAIVpnBindingResourcesTest extends BaseTaskTest {
@Test
public void getVpnBindingByCustomerVpnIdTest() {
- when(MOCK_aaiResourcesClient.get(eq(VpnBindings.class), isA(AAIResourceUri.class)))
+ when(MOCK_aaiResourcesClient.get(eq(VpnBindings.class), isA(AAIPluralResourceUri.class)))
.thenReturn(Optional.of(new VpnBindings()));
Optional<VpnBindings> vpnBindings = aaiVpnBindingResources.getVpnBindingByCustomerVpnId("testCustomerVpnId");
assertNotNull(vpnBindings.get());
verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.VpnBindings.class),
- isA(AAIResourceUri.class));
+ isA(AAIPluralResourceUri.class));
}
@Test
diff --git a/cloudify-client/pom.xml b/cloudify-client/pom.xml
index 6f4ea03ca5..6bb9357c38 100644
--- a/cloudify-client/pom.xml
+++ b/cloudify-client/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so</groupId>
diff --git a/common/pom.xml b/common/pom.xml
index 04deacf129..e36001833d 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>common</artifactId>
<name>MSO Common classes</name>
@@ -16,7 +16,7 @@
<protobuf.version>3.6.1</protobuf.version>
<grpc.netty.version>4.1.30.Final</grpc.netty.version>
<ccsdk.version>0.4.2</ccsdk.version>
- <appc.client.version>1.6.0-SNAPSHOT</appc.client.version>
+ <appc.client.version>1.7.1-SNAPSHOT</appc.client.version>
</properties>
<dependencies>
@@ -59,7 +59,7 @@
<dependency>
<groupId>org.onap.aai.schema-service</groupId>
<artifactId>aai-schema</artifactId>
- <version>1.6.3</version>
+ <version>1.6.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.modelmapper</groupId>
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ActDeActNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/ActDeActNssi.java
new file mode 100644
index 0000000000..8d45048ee4
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ActDeActNssi.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class ActDeActNssi {
+
+ public final static String ACT_URL = "/api/rest/provMns/v1/NSS/%s" + "/activation";
+
+ public final static String DE_ACT_URL = "/api/rest/provMns/v1/NSS/%s" + "/deactivation";
+
+ private String nsiId;
+
+ private String nssiId;
+
+ public String getNsiId() {
+ return nsiId;
+ }
+
+ public void setNsiId(String nsiId) {
+ this.nsiId = nsiId;
+ }
+
+ public String getNssiId() {
+ return nssiId;
+ }
+
+ public void setNssiId(String nssiId) {
+ this.nssiId = nssiId;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java
new file mode 100644
index 0000000000..484f5b42b1
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class AllocateAnNssi {
+
+ public final static String URL = "/api/rest/provMns/v1/an/NSS" + "/SliceProfiles";
+
+ private String nsstId;
+
+ private String flavorId;
+
+ private String nssiId;
+
+ private String nssiName;
+
+ private AnSliceProfile sliceProfile;
+
+ private String scriptName;
+
+ private Object extension;
+
+ private NsiInfo nsiInfo;
+
+ public String getNsstId() {
+ return nsstId;
+ }
+
+ public void setNsstId(String nsstId) {
+ this.nsstId = nsstId;
+ }
+
+ public String getFlavorId() {
+ return flavorId;
+ }
+
+ public void setFlavorId(String flavorId) {
+ this.flavorId = flavorId;
+ }
+
+ public String getNssiId() {
+ return nssiId;
+ }
+
+ public void setNssiId(String nssiId) {
+ this.nssiId = nssiId;
+ }
+
+ public String getNssiName() {
+ return nssiName;
+ }
+
+ public void setNssiName(String nssiName) {
+ this.nssiName = nssiName;
+ }
+
+ public AnSliceProfile getSliceProfile() {
+ return sliceProfile;
+ }
+
+ public void setSliceProfile(AnSliceProfile sliceProfile) {
+ this.sliceProfile = sliceProfile;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public void setScriptName(String scriptName) {
+ this.scriptName = scriptName;
+ }
+
+ public Object getExtension() {
+ return extension;
+ }
+
+ public void setExtension(Object extension) {
+ this.extension = extension;
+ }
+
+ public NsiInfo getNsiInfo() {
+ return nsiInfo;
+ }
+
+ public void setNsiInfo(NsiInfo nsiInfo) {
+ this.nsiInfo = nsiInfo;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AllocateCnNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/AllocateCnNssi.java
new file mode 100644
index 0000000000..d03673368c
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AllocateCnNssi.java
@@ -0,0 +1,110 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class AllocateCnNssi implements Serializable {
+
+ public final static String URL = "/api/rest/provMns/v1/NSS/SliceProfiles";
+
+ private String nsstId;
+
+ private String flavorId;
+
+ private String nssiId;
+
+ private String nssiName;
+
+ private CnSliceProfile sliceProfile;
+
+ private String scriptName;
+
+ private Object extension;
+
+ private NsiInfo nsiInfo;
+
+ public NsiInfo getNsiInfo() {
+ return nsiInfo;
+ }
+
+ public void setNsiInfo(NsiInfo nsiInfo) {
+ this.nsiInfo = nsiInfo;
+ }
+
+ public String getNsstId() {
+ return nsstId;
+ }
+
+ public void setNsstId(String nsstId) {
+ this.nsstId = nsstId;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public void setScriptName(String scriptName) {
+ this.scriptName = scriptName;
+ }
+
+ public CnSliceProfile getSliceProfile() {
+ return sliceProfile;
+ }
+
+ public void setSliceProfile(CnSliceProfile sliceProfile) {
+ this.sliceProfile = sliceProfile;
+ }
+
+ public String getFlavorId() {
+ return flavorId;
+ }
+
+ public void setFlavorId(String flavorId) {
+ this.flavorId = flavorId;
+ }
+
+ public String getNssiId() {
+ return nssiId;
+ }
+
+ public void setNssiId(String nssiId) {
+ this.nssiId = nssiId;
+ }
+
+ public String getNssiName() {
+ return nssiName;
+ }
+
+ public void setNssiName(String nssiName) {
+ this.nssiName = nssiName;
+ }
+
+ public void setExtension(Object extension) {
+ this.extension = extension;
+ }
+
+ public Object getExtension() {
+ return extension;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AllocateTnNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/AllocateTnNssi.java
new file mode 100644
index 0000000000..b66fb133d2
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AllocateTnNssi.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class AllocateTnNssi {
+
+ public final static String URL = "/api/rest/provMns/v1/tn/NSS" + "/SliceProfiles";
+
+ private String nsstId;
+
+ private String flavorId;
+
+ private String nssiId;
+
+ private String nssiName;
+
+ private TnSliceProfile sliceProfile;
+
+ private String scriptName;
+
+ private Object extension;
+
+ private NsiInfo nsiInfo;
+
+ public String getNsstId() {
+ return nsstId;
+ }
+
+ public void setNsstId(String nsstId) {
+ this.nsstId = nsstId;
+ }
+
+ public String getFlavorId() {
+ return flavorId;
+ }
+
+ public void setFlavorId(String flavorId) {
+ this.flavorId = flavorId;
+ }
+
+ public String getNssiId() {
+ return nssiId;
+ }
+
+ public void setNssiId(String nssiId) {
+ this.nssiId = nssiId;
+ }
+
+ public String getNssiName() {
+ return nssiName;
+ }
+
+ public void setNssiName(String nssiName) {
+ this.nssiName = nssiName;
+ }
+
+ public TnSliceProfile getSliceProfile() {
+ return sliceProfile;
+ }
+
+ public void setSliceProfile(TnSliceProfile sliceProfile) {
+ this.sliceProfile = sliceProfile;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public void setScriptName(String scriptName) {
+ this.scriptName = scriptName;
+ }
+
+ public Object getExtension() {
+ return extension;
+ }
+
+ public void setExtension(Object extension) {
+ this.extension = extension;
+ }
+
+ public NsiInfo getNsiInfo() {
+ return nsiInfo;
+ }
+
+ public void setNsiInfo(NsiInfo nsiInfo) {
+ this.nsiInfo = nsiInfo;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
new file mode 100644
index 0000000000..3d60949385
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class AnSliceProfile {
+
+ @JsonProperty("5QI")
+ private String qi;
+
+ private List<String> coverageAreaTAList;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int latency;
+
+ public String getQi() {
+ return qi;
+ }
+
+ public void setQi(String qi) {
+ this.qi = qi;
+ }
+
+ public List<String> getCoverageAreaTAList() {
+ return coverageAreaTAList;
+ }
+
+ public void setCoverageAreaTAList(List<String> coverageAreaTAList) {
+ this.coverageAreaTAList = coverageAreaTAList;
+ }
+
+ public int getLatency() {
+ return latency;
+ }
+
+ public void setLatency(int latency) {
+ this.latency = latency;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java
new file mode 100644
index 0000000000..3bd155d512
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java
@@ -0,0 +1,120 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import java.util.List;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class CnSliceProfile {
+
+ private List<String> snssaiList;
+
+ private String sliceProfileId;
+
+ private List<String> plmnIdList;
+
+ private PerfReq perfReq;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int maxNumberofUEs;
+
+ private List<String> coverageAreaTAList;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int latency;
+
+ private UeMobilityLevel ueMobilityLevel;
+
+ private ResourceSharingLevel resourceSharingLevel;
+
+ public String getSliceProfileId() {
+ return sliceProfileId;
+ }
+
+ public void setSliceProfileId(String sliceProfileId) {
+ this.sliceProfileId = sliceProfileId;
+ }
+
+ public List<String> getPlmnIdList() {
+ return plmnIdList;
+ }
+
+ public void setPlmnIdList(List<String> plmnIdList) {
+ this.plmnIdList = plmnIdList;
+ }
+
+ public PerfReq getPerfReq() {
+ return perfReq;
+ }
+
+ public void setPerfReq(PerfReq perfReq) {
+ this.perfReq = perfReq;
+ }
+
+ public int getMaxNumberofUEs() {
+ return maxNumberofUEs;
+ }
+
+ public void setMaxNumberofUEs(int maxNumberofUEs) {
+ this.maxNumberofUEs = maxNumberofUEs;
+ }
+
+ public List<String> getCoverageAreaTAList() {
+ return coverageAreaTAList;
+ }
+
+ public void setCoverageAreaTAList(List<String> coverageAreaTAList) {
+ this.coverageAreaTAList = coverageAreaTAList;
+ }
+
+ public int getLatency() {
+ return latency;
+ }
+
+ public void setLatency(int latency) {
+ this.latency = latency;
+ }
+
+ public UeMobilityLevel getUeMobilityLevel() {
+ return ueMobilityLevel;
+ }
+
+ public void setUeMobilityLevel(UeMobilityLevel ueMobilityLevel) {
+ this.ueMobilityLevel = ueMobilityLevel;
+ }
+
+ public ResourceSharingLevel getResourceSharingLevel() {
+ return resourceSharingLevel;
+ }
+
+ public void setResourceSharingLevel(ResourceSharingLevel resourceSharingLevel) {
+ this.resourceSharingLevel = resourceSharingLevel;
+ }
+
+ public List<String> getSnssaiList() {
+ return snssaiList;
+ }
+
+ public void setSnssaiList(List<String> snssaiList) {
+ this.snssaiList = snssaiList;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/CreateCnNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/CreateCnNssi.java
new file mode 100644
index 0000000000..424966948e
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/CreateCnNssi.java
@@ -0,0 +1,89 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class CreateCnNssi {
+
+ public final static String URL = "/api/rest/provMns/v1/NSS/nssi";
+
+ private String nsstId;
+
+ private String flavorId;
+
+ private String nssiName;
+
+ private String scriptName;
+
+ private String extension;
+
+ private NsiInfo nsiInfo;
+
+ public String getNsstId() {
+ return nsstId;
+ }
+
+ public void setNsstId(String nsstId) {
+ this.nsstId = nsstId;
+ }
+
+ public String getFlavorId() {
+ return flavorId;
+ }
+
+ public void setFlavorId(String flavorId) {
+ this.flavorId = flavorId;
+ }
+
+ public String getNssiName() {
+ return nssiName;
+ }
+
+ public void setNssiName(String nssiName) {
+ this.nssiName = nssiName;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public void setScriptName(String scriptName) {
+ this.scriptName = scriptName;
+ }
+
+ public String getExtension() {
+ return extension;
+ }
+
+ public void setExtension(String extension) {
+ this.extension = extension;
+ }
+
+ public NsiInfo getNsiInfo() {
+ return nsiInfo;
+ }
+
+ public void setNsiInfo(NsiInfo nsiInfo) {
+ this.nsiInfo = nsiInfo;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
new file mode 100644
index 0000000000..648fd4985f
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import java.util.List;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class DeAllocateNssi {
+
+ public final static String URL = "/api/rest/provMns/v1/NSS" + "/SliceProfiles/%s";
+
+ private String nsiId;
+
+ private String nssiId;
+
+ private List<String> snssaiList;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int terminateNssiOption;
+
+ private String scriptName;
+
+ private String extension;
+
+ public String getNsiId() {
+ return nsiId;
+ }
+
+ public void setNsiId(String nsiId) {
+ this.nsiId = nsiId;
+ }
+
+ public String getNssiId() {
+ return nssiId;
+ }
+
+ public void setNssiId(String nssiId) {
+ this.nssiId = nssiId;
+ }
+
+ public List<String> getSnssaiList() {
+ return snssaiList;
+ }
+
+ public void setSnssaiList(List<String> snssaiList) {
+ this.snssaiList = snssaiList;
+ }
+
+ public int getTerminateNssiOption() {
+ return terminateNssiOption;
+ }
+
+ public void setTerminateNssiOption(int terminateNssiOption) {
+ this.terminateNssiOption = terminateNssiOption;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public void setScriptName(String scriptName) {
+ this.scriptName = scriptName;
+ }
+
+ public String getExtension() {
+ return extension;
+ }
+
+ public void setExtension(String extension) {
+ this.extension = extension;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/EsrInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/EsrInfo.java
new file mode 100644
index 0000000000..d720399293
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/EsrInfo.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class EsrInfo implements Serializable {
+
+ private String vendor;
+
+ private NetworkType networkType;
+
+ public String getVendor() {
+ return vendor;
+ }
+
+ public void setVendor(String vendor) {
+ this.vendor = vendor;
+ }
+
+ public NetworkType getNetworkType() {
+ return networkType;
+ }
+
+ public void setNetworkType(NetworkType networkType) {
+ this.networkType = networkType;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/JobStatusRequest.java b/common/src/main/java/org/onap/so/beans/nsmf/JobStatusRequest.java
new file mode 100644
index 0000000000..cc8503c250
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/JobStatusRequest.java
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class JobStatusRequest {
+
+ public final static String URL = "/api/rest/provMns/v1/NSS/jobs/%s";
+
+ private String nsiId;
+
+ private String nssiId;
+
+ private String responseId;
+
+ private EsrInfo esrInfo;
+
+ public String getNsiId() {
+ return nsiId;
+ }
+
+ public void setNsiId(String nsiId) {
+ this.nsiId = nsiId;
+ }
+
+ public String getNssiId() {
+ return nssiId;
+ }
+
+ public void setNssiId(String nssiId) {
+ this.nssiId = nssiId;
+ }
+
+
+ public String getResponseId() {
+ return responseId;
+ }
+
+ public void setResponseId(String responseId) {
+ this.responseId = responseId;
+ }
+
+ public EsrInfo getEsrInfo() {
+ return esrInfo;
+ }
+
+ public void setEsrInfo(EsrInfo esrInfo) {
+ this.esrInfo = esrInfo;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/JobStatusResponse.java b/common/src/main/java/org/onap/so/beans/nsmf/JobStatusResponse.java
new file mode 100644
index 0000000000..9259d51591
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/JobStatusResponse.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class JobStatusResponse {
+
+ private ResponseDescriptor responseDescriptor;
+
+ public ResponseDescriptor getResponseDescriptor() {
+ return responseDescriptor;
+ }
+
+ public void setResponseDescriptor(ResponseDescriptor responseDescriptor) {
+ this.responseDescriptor = responseDescriptor;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NSSI.java b/common/src/main/java/org/onap/so/beans/nsmf/NSSI.java
new file mode 100644
index 0000000000..a57458f2cf
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NSSI.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in 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.onap.so.beans.nsmf;
+
+public class NSSI {
+
+ private String nssiId;
+
+ private String modelInvariantId;
+
+ private String modelVersionId;
+
+ public NSSI(String nssiId, String modelInvariantId, String modelVersionId) {
+ this.nssiId = nssiId;
+ this.modelInvariantId = modelInvariantId;
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getNssiId() {
+ return nssiId;
+ }
+
+ public void setNssiId(String nssiId) {
+ this.nssiId = nssiId;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NetworkType.java b/common/src/main/java/org/onap/so/beans/nsmf/NetworkType.java
new file mode 100644
index 0000000000..2e10fe5746
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NetworkType.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+public enum NetworkType {
+
+ ACCESS("an"),
+
+ CORE("cn"),
+
+ TRANSPORT("tn");
+
+ private String networkType;
+
+ NetworkType(String networkType) {
+ this.networkType = networkType;
+ }
+
+ @JsonValue
+ public String getNetworkType() {
+ return networkType;
+ }
+
+ @JsonCreator
+ public NetworkType forValue(String value) {
+ return valueOf(value);
+ }
+
+ public static NetworkType fromString(String value) {
+ for (NetworkType nType : NetworkType.values()) {
+ if (nType.networkType.equalsIgnoreCase(value)) {
+ return nType;
+ }
+ }
+ return null;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NewNsst.java b/common/src/main/java/org/onap/so/beans/nsmf/NewNsst.java
new file mode 100644
index 0000000000..68aebf2df2
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NewNsst.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NewNsst {
+
+ private String nsstId;
+
+ private String flavorId;
+
+ public String getNsstId() {
+ return nsstId;
+ }
+
+ public void setNsstId(String nsstId) {
+ this.nsstId = nsstId;
+ }
+
+ public String getFlavorId() {
+ return flavorId;
+ }
+
+ public void setFlavorId(String flavorId) {
+ this.flavorId = flavorId;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java
new file mode 100644
index 0000000000..0ff554d10d
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NsiInfo.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NsiInfo {
+
+ private String nsiName;
+
+ private String nsiId;
+
+ public String getNsiName() {
+ return nsiName;
+ }
+
+ public void setNsiName(String nsiName) {
+ this.nsiName = nsiName;
+ }
+
+ public void setNsiId(String nsiId) {
+ this.nsiId = nsiId;
+ }
+
+ public String getNsiId() {
+ return nsiId;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssiActDeActRequest.java b/common/src/main/java/org/onap/so/beans/nsmf/NssiActDeActRequest.java
new file mode 100644
index 0000000000..fbba8c77b1
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssiActDeActRequest.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NssiActDeActRequest {
+
+ private EsrInfo esrInfo;
+
+ private ActDeActNssi actDeActNssi;
+
+ public ActDeActNssi getActDeActNssi() {
+ return actDeActNssi;
+ }
+
+ public void setActDeActNssi(ActDeActNssi actDeActNssi) {
+ this.actDeActNssi = actDeActNssi;
+ }
+
+ public EsrInfo getEsrInfo() {
+ return esrInfo;
+ }
+
+ public void setEsrInfo(EsrInfo esrInfo) {
+ this.esrInfo = esrInfo;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssiAllocateRequest.java b/common/src/main/java/org/onap/so/beans/nsmf/NssiAllocateRequest.java
new file mode 100644
index 0000000000..f72a74a063
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssiAllocateRequest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NssiAllocateRequest {
+
+ private EsrInfo esrInfo;
+
+ private AllocateCnNssi allocateCnNssi;
+
+ private AllocateTnNssi allocateTnNssi;
+
+ private AllocateAnNssi allocateAnNssi;
+
+ public EsrInfo getEsrInfo() {
+ return esrInfo;
+ }
+
+ public void setEsrInfo(EsrInfo esrInfo) {
+ this.esrInfo = esrInfo;
+ }
+
+ public AllocateCnNssi getAllocateCnNssi() {
+ return allocateCnNssi;
+ }
+
+ public void setAllocateCnNssi(AllocateCnNssi allocateCnNssi) {
+ this.allocateCnNssi = allocateCnNssi;
+ }
+
+ public AllocateTnNssi getAllocateTnNssi() {
+ return allocateTnNssi;
+ }
+
+ public void setAllocateTnNssi(AllocateTnNssi allocateTnNssi) {
+ this.allocateTnNssi = allocateTnNssi;
+ }
+
+ public AllocateAnNssi getAllocateAnNssi() {
+ return allocateAnNssi;
+ }
+
+ public void setAllocateAnNssi(AllocateAnNssi allocateAnNssi) {
+ this.allocateAnNssi = allocateAnNssi;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssiCreateRequest.java b/common/src/main/java/org/onap/so/beans/nsmf/NssiCreateRequest.java
new file mode 100644
index 0000000000..ca26e9f0cb
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssiCreateRequest.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NssiCreateRequest {
+
+ private EsrInfo esrInfo;
+
+ private CreateCnNssi createCnNssi;
+
+ public EsrInfo getEsrInfo() {
+ return esrInfo;
+ }
+
+ public void setEsrInfo(EsrInfo esrInfo) {
+ this.esrInfo = esrInfo;
+ }
+
+ public CreateCnNssi getCreateCnNssi() {
+ return createCnNssi;
+ }
+
+ public void setCreateCnNssi(CreateCnNssi createCnNssi) {
+ this.createCnNssi = createCnNssi;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssiDeAllocateRequest.java b/common/src/main/java/org/onap/so/beans/nsmf/NssiDeAllocateRequest.java
new file mode 100644
index 0000000000..bbfc30c37a
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssiDeAllocateRequest.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NssiDeAllocateRequest {
+
+ private DeAllocateNssi deAllocateNssi;
+
+ private EsrInfo esrInfo;
+
+ public DeAllocateNssi getDeAllocateNssi() {
+ return deAllocateNssi;
+ }
+
+ public void setDeAllocateNssi(DeAllocateNssi deAllocateNssi) {
+ this.deAllocateNssi = deAllocateNssi;
+ }
+
+ public EsrInfo getEsrInfo() {
+ return esrInfo;
+ }
+
+ public void setEsrInfo(EsrInfo esrInfo) {
+ this.esrInfo = esrInfo;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java b/common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java
new file mode 100644
index 0000000000..66368be6b8
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NssiResponse {
+
+ private String nssiId;
+
+ private String jobId;
+
+ public String getNssiId() {
+ return nssiId;
+ }
+
+ public void setNssiId(String nssiId) {
+ this.nssiId = nssiId;
+ }
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssiTerminateRequest.java b/common/src/main/java/org/onap/so/beans/nsmf/NssiTerminateRequest.java
new file mode 100644
index 0000000000..df0a463584
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssiTerminateRequest.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NssiTerminateRequest {
+
+ private TerminateNssi terminateNssi;
+
+ private EsrInfo esrInfo;
+
+ public TerminateNssi getTerminateNssi() {
+ return terminateNssi;
+ }
+
+ public void setTerminateNssi(TerminateNssi terminateNssi) {
+ this.terminateNssi = terminateNssi;
+ }
+
+ public EsrInfo getEsrInfo() {
+ return esrInfo;
+ }
+
+ public void setEsrInfo(EsrInfo esrInfo) {
+ this.esrInfo = esrInfo;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssiUpdateRequest.java b/common/src/main/java/org/onap/so/beans/nsmf/NssiUpdateRequest.java
new file mode 100644
index 0000000000..6642734b7f
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssiUpdateRequest.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NssiUpdateRequest {
+
+ private UpdateCnNssi updateCnNssi;
+
+ private EsrInfo esrInfo;
+
+ public EsrInfo getEsrInfo() {
+ return esrInfo;
+ }
+
+ public void setEsrInfo(EsrInfo esrInfo) {
+ this.esrInfo = esrInfo;
+ }
+
+ public UpdateCnNssi getUpdateCnNssi() {
+ return updateCnNssi;
+ }
+
+ public void setUpdateCnNssi(UpdateCnNssi updateCnNssi) {
+ this.updateCnNssi = updateCnNssi;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssiUpdateRequestById.java b/common/src/main/java/org/onap/so/beans/nsmf/NssiUpdateRequestById.java
new file mode 100644
index 0000000000..0554d2fcfd
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssiUpdateRequestById.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NssiUpdateRequestById {
+
+ private UpdateCnNssiById updateCnNssiById;
+
+ private EsrInfo esrInfo;
+
+ public EsrInfo getEsrInfo() {
+ return esrInfo;
+ }
+
+ public void setEsrInfo(EsrInfo esrInfo) {
+ this.esrInfo = esrInfo;
+ }
+
+ public UpdateCnNssiById getUpdateCnNssiById() {
+ return updateCnNssiById;
+ }
+
+ public void setUpdateCnNssiById(UpdateCnNssiById updateCnNssiById) {
+ this.updateCnNssiById = updateCnNssiById;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssmiReqInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/NssmiReqInfo.java
new file mode 100644
index 0000000000..093825f0ff
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssmiReqInfo.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NssmiReqInfo {
+
+ private String nsiId;
+
+ private String nssiId;
+
+ private EsrInfo esrInfo;
+
+ public String getNsiId() {
+ return nsiId;
+ }
+
+ public void setNsiId(String nsiId) {
+ this.nsiId = nsiId;
+ }
+
+ public String getNssiId() {
+ return nssiId;
+ }
+
+ public void setNssiId(String nssiId) {
+ this.nssiId = nssiId;
+ }
+
+ public EsrInfo getEsrInfo() {
+ return esrInfo;
+ }
+
+ public void setEsrInfo(EsrInfo esrInfo) {
+ this.esrInfo = esrInfo;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssmiResInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/NssmiResInfo.java
new file mode 100644
index 0000000000..e75934a7a9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssmiResInfo.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class NssmiResInfo {
+
+ private String jobId;
+
+ private String status;
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/PerfReq.java b/common/src/main/java/org/onap/so/beans/nsmf/PerfReq.java
new file mode 100644
index 0000000000..4aabc3f26f
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/PerfReq.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import java.util.List;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class PerfReq {
+
+ private List<PerfReqEmbbList> perfReqEmbbList;
+
+ private List<PerfReqUrllcList> perfReqUrllcList;
+
+ public List<PerfReqEmbbList> getPerfReqEmbbList() {
+ return perfReqEmbbList;
+ }
+
+ public void setPerfReqEmbbList(List<PerfReqEmbbList> perfReqEmbbList) {
+ this.perfReqEmbbList = perfReqEmbbList;
+ }
+
+ public List<PerfReqUrllcList> getPerfReqUrllcList() {
+ return perfReqUrllcList;
+ }
+
+ public void setPerfReqUrllcList(List<PerfReqUrllcList> perfReqUrllcList) {
+ this.perfReqUrllcList = perfReqUrllcList;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbbList.java b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbbList.java
new file mode 100644
index 0000000000..9e9fcaa19e
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbbList.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class PerfReqEmbbList {
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int expDataRateDL;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int expDataRateUL;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int areaTrafficCapDL;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int areaTrafficCapUL;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int activityFactor;
+
+ public int getExpDataRateDL() {
+ return expDataRateDL;
+ }
+
+ public void setExpDataRateDL(int expDataRateDL) {
+ this.expDataRateDL = expDataRateDL;
+ }
+
+ public int getExpDataRateUL() {
+ return expDataRateUL;
+ }
+
+ public void setExpDataRateUL(int expDataRateUL) {
+ this.expDataRateUL = expDataRateUL;
+ }
+
+ public int getAreaTrafficCapDL() {
+ return areaTrafficCapDL;
+ }
+
+ public void setAreaTrafficCapDL(int areaTrafficCapDL) {
+ this.areaTrafficCapDL = areaTrafficCapDL;
+ }
+
+ public int getAreaTrafficCapUL() {
+ return areaTrafficCapUL;
+ }
+
+ public void setAreaTrafficCapUL(int areaTrafficCapUL) {
+ this.areaTrafficCapUL = areaTrafficCapUL;
+ }
+
+ public int getActivityFactor() {
+ return activityFactor;
+ }
+
+ public void setActivityFactor(int activityFactor) {
+ this.activityFactor = activityFactor;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllcList.java b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllcList.java
new file mode 100644
index 0000000000..00f0a917aa
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllcList.java
@@ -0,0 +1,135 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class PerfReqUrllcList {
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int e2eLatency;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int jitter;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int survivalTime;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private float csAvailability;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private float reliability;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int expDataRate;
+
+ private String payloadSize;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int trafficDensity;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int connDensity;
+
+ private String serviceAreaDimension;
+
+ public int getE2eLatency() {
+ return e2eLatency;
+ }
+
+ public void setE2eLatency(int e2eLatency) {
+ this.e2eLatency = e2eLatency;
+ }
+
+ public int getJitter() {
+ return jitter;
+ }
+
+ public void setJitter(int jitter) {
+ this.jitter = jitter;
+ }
+
+ public int getSurvivalTime() {
+ return survivalTime;
+ }
+
+ public void setSurvivalTime(int survivalTime) {
+ this.survivalTime = survivalTime;
+ }
+
+ public float getReliability() {
+ return reliability;
+ }
+
+ public void setReliability(float reliability) {
+ this.reliability = reliability;
+ }
+
+ public int getExpDataRate() {
+ return expDataRate;
+ }
+
+ public void setExpDataRate(int expDataRate) {
+ this.expDataRate = expDataRate;
+ }
+
+ public String getPayloadSize() {
+ return payloadSize;
+ }
+
+ public void setPayloadSize(String payloadSize) {
+ this.payloadSize = payloadSize;
+ }
+
+ public int getTrafficDensity() {
+ return trafficDensity;
+ }
+
+ public void setTrafficDensity(int trafficDensity) {
+ this.trafficDensity = trafficDensity;
+ }
+
+ public int getConnDensity() {
+ return connDensity;
+ }
+
+ public void setConnDensity(int connDensity) {
+ this.connDensity = connDensity;
+ }
+
+ public String getServiceAreaDimension() {
+ return serviceAreaDimension;
+ }
+
+ public void setServiceAreaDimension(String serviceAreaDimension) {
+ this.serviceAreaDimension = serviceAreaDimension;
+ }
+
+ public float getCsAvailability() {
+ return csAvailability;
+ }
+
+ public void setCsAvailability(float csAvailability) {
+ this.csAvailability = csAvailability;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/PnfErrorList.java b/common/src/main/java/org/onap/so/beans/nsmf/PnfErrorList.java
new file mode 100644
index 0000000000..66bfbdcea9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/PnfErrorList.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class PnfErrorList {
+
+ private String pnfId;
+
+ private String pnfErrorDesc;
+
+ public String getPnfId() {
+ return pnfId;
+ }
+
+ public void setPnfId(String pnfId) {
+ this.pnfId = pnfId;
+ }
+
+ public String getPnfErrorDesc() {
+ return pnfErrorDesc;
+ }
+
+ public void setPnfErrorDesc(String pnfErrorDesc) {
+ this.pnfErrorDesc = pnfErrorDesc;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ResourceSharingLevel.java b/common/src/main/java/org/onap/so/beans/nsmf/ResourceSharingLevel.java
new file mode 100644
index 0000000000..405429c34d
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ResourceSharingLevel.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+public enum ResourceSharingLevel {
+
+ SHARED("shared"),
+
+ NON_SHARED("non-shared");
+
+ private String resourceSharingLevel;
+
+ ResourceSharingLevel(String resourceSharingLevel) {
+ this.resourceSharingLevel = resourceSharingLevel;
+ }
+
+ @JsonValue
+ public String getResourceSharingLevel() {
+ return resourceSharingLevel;
+ }
+
+ @JsonCreator
+ public ResourceSharingLevel forValue(String value) {
+ return valueOf(value);
+ }
+
+ public static ResourceSharingLevel fromString(String value) {
+ for (ResourceSharingLevel rscLvl : ResourceSharingLevel.values()) {
+ if (rscLvl.resourceSharingLevel.equalsIgnoreCase(value)) {
+ return rscLvl;
+ }
+ }
+ return null;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java b/common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java
new file mode 100644
index 0000000000..469d212ef9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import java.util.List;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class ResponseDescriptor {
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int progress;
+
+ private String status;
+
+ private String statusDescription;
+
+ private String errorCode;
+
+ private List<VnfErrorList> vnfErrorList;
+
+ private List<PnfErrorList> pnfErrorList;
+
+ private String responseId;
+
+ private List<ResponseHistory> responseHistoryList;
+
+ public int getProgress() {
+ return progress;
+ }
+
+ public void setProgress(int progress) {
+ this.progress = progress;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusDescription() {
+ return statusDescription;
+ }
+
+ public void setStatusDescription(String statusDescription) {
+ this.statusDescription = statusDescription;
+ }
+
+ public String getResponseId() {
+ return responseId;
+ }
+
+ public void setResponseId(String responseId) {
+ this.responseId = responseId;
+ }
+
+ public List<ResponseHistory> getResponseHistoryList() {
+ return responseHistoryList;
+ }
+
+ public void setResponseHistoryList(List<ResponseHistory> responseHistoryList) {
+ this.responseHistoryList = responseHistoryList;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ResponseHistory.java b/common/src/main/java/org/onap/so/beans/nsmf/ResponseHistory.java
new file mode 100644
index 0000000000..c71441a80a
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ResponseHistory.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import java.util.List;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class ResponseHistory {
+
+ private int progress;
+
+ private String status;
+
+ private String errorCode;
+
+ private String statusDescription;
+
+ private String responseId;
+
+ private List<VnfErrorList> vnfErrorList;
+
+ private List<PnfErrorList> pnfErrorList;
+
+ public int getProgress() {
+ return progress;
+ }
+
+ public void setProgress(int progress) {
+ this.progress = progress;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusDescription() {
+ return statusDescription;
+ }
+
+ public void setStatusDescription(String statusDescription) {
+ this.statusDescription = statusDescription;
+ }
+
+ public String getResponseId() {
+ return responseId;
+ }
+
+ public void setResponseId(String responseId) {
+ this.responseId = responseId;
+ }
+
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public List<VnfErrorList> getVnfErrorList() {
+ return vnfErrorList;
+ }
+
+ public List<PnfErrorList> getPnfErrorList() {
+ return pnfErrorList;
+ }
+
+ public void setPnfErrorList(List<PnfErrorList> pnfErrorList) {
+ this.pnfErrorList = pnfErrorList;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ServiceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/ServiceProfile.java
new file mode 100644
index 0000000000..cc6c9bbb82
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ServiceProfile.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"service-profile"})
+public class ServiceProfile implements Serializable {
+
+ @JsonProperty("service-profile")
+ private Map<String, Object> serviceProfile;
+
+ @JsonProperty("service-profile")
+ public Map<String, Object> getServiceProfile() {
+ return serviceProfile;
+ }
+
+ @JsonProperty("service-profile")
+ public void setServiceProfile(Map<String, Object> serviceProfile) {
+ this.serviceProfile = serviceProfile;
+ }
+}
+
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParams.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParams.java
new file mode 100644
index 0000000000..bf881c0f19
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParams.java
@@ -0,0 +1,413 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.JsonObject;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+public class SliceTaskParams implements Serializable {
+
+ private static final long serialVersionUID = -4389946152970978423L;
+
+ private String serviceId;
+
+ private String serviceName;
+
+ private String nstId;
+
+ private String nstName;
+
+ private String tnScriptName;
+
+ private String anScriptName;
+
+ private String cnScriptName;
+
+ private Map<String, Object> serviceProfile;
+
+ private String suggestNsiId;
+
+ private String suggestNsiName;
+
+ private Map<String, Object> sliceProfileTn;
+
+ private Map<String, Object> sliceProfileCn;
+
+ private Map<String, Object> sliceProfileAn;
+
+ private String tnSuggestNssiId;
+
+ private String tnSuggestNssiName;
+
+ private String tnProgress;
+
+ private String tnStatus;
+
+ private String tnStatusDescription;
+
+ private String cnSuggestNssiId;
+
+ private String cnSuggestNssiName;
+
+ private String cnProgress;
+
+ private String cnStatus;
+
+ private String cnStatusDescription;
+
+ private String anSuggestNssiId;
+
+ private String anSuggestNssiName;
+
+ private String anProgress;
+
+ private String anStatus;
+
+ private String anStatusDescription;
+
+ public String getNstId() {
+ return nstId;
+ }
+
+ public void setNstId(String nstId) {
+ this.nstId = nstId;
+ }
+
+ public String getNstName() {
+ return nstName;
+ }
+
+ public void setNstName(String nstName) {
+ this.nstName = nstName;
+ }
+
+ public String getTnScriptName() {
+ return tnScriptName;
+ }
+
+ public void setTnScriptName(String tnScriptName) {
+ this.tnScriptName = tnScriptName;
+ }
+
+ public String getAnScriptName() {
+ return anScriptName;
+ }
+
+ public void setAnScriptName(String anScriptName) {
+ this.anScriptName = anScriptName;
+ }
+
+ public String getCnScriptName() {
+ return cnScriptName;
+ }
+
+ public void setCnScriptName(String cnScriptName) {
+ this.cnScriptName = cnScriptName;
+ }
+
+ public String getServiceId() {
+ return serviceId;
+ }
+
+ public void setServiceId(String serviceId) {
+ this.serviceId = serviceId;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public Map<String, Object> getServiceProfile() {
+ return serviceProfile;
+ }
+
+ public void setServiceProfile(Map<String, Object> serviceProfile) {
+ this.serviceProfile = serviceProfile;
+ }
+
+ public String getSuggestNsiId() {
+ return suggestNsiId;
+ }
+
+ public void setSuggestNsiId(String suggestNsiId) {
+ this.suggestNsiId = suggestNsiId;
+ }
+
+ public String getSuggestNsiName() {
+ return suggestNsiName;
+ }
+
+ public void setSuggestNsiName(String suggestNsiName) {
+ this.suggestNsiName = suggestNsiName;
+ }
+
+ public Map<String, Object> getSliceProfileTn() {
+ return sliceProfileTn;
+ }
+
+ public void setSliceProfileTn(Map<String, Object> sliceProfileTn) {
+ this.sliceProfileTn = sliceProfileTn;
+ }
+
+ public Map<String, Object> getSliceProfileCn() {
+ return sliceProfileCn;
+ }
+
+ public void setSliceProfileCn(Map<String, Object> sliceProfileCn) {
+ this.sliceProfileCn = sliceProfileCn;
+ }
+
+ public Map<String, Object> getSliceProfileAn() {
+ return sliceProfileAn;
+ }
+
+ public void setSliceProfileAn(Map<String, Object> sliceProfileAn) {
+ this.sliceProfileAn = sliceProfileAn;
+ }
+
+ public String getTnSuggestNssiId() {
+ return tnSuggestNssiId;
+ }
+
+ public void setTnSuggestNssiId(String tnSuggestNssiId) {
+ this.tnSuggestNssiId = tnSuggestNssiId;
+ }
+
+ public String getTnSuggestNssiName() {
+ return tnSuggestNssiName;
+ }
+
+ public void setTnSuggestNssiName(String tnSuggestNssiName) {
+ this.tnSuggestNssiName = tnSuggestNssiName;
+ }
+
+ public String getTnProgress() {
+ return tnProgress;
+ }
+
+ public void setTnProgress(String tnProgress) {
+ this.tnProgress = tnProgress;
+ }
+
+ public String getTnStatus() {
+ return tnStatus;
+ }
+
+ public void setTnStatus(String tnStatus) {
+ this.tnStatus = tnStatus;
+ }
+
+ public String getTnStatusDescription() {
+ return tnStatusDescription;
+ }
+
+ public void setTnStatusDescription(String tnStatusDescription) {
+ this.tnStatusDescription = tnStatusDescription;
+ }
+
+ public String getCnSuggestNssiId() {
+ return cnSuggestNssiId;
+ }
+
+ public void setCnSuggestNssiId(String cnSuggestNssiId) {
+ this.cnSuggestNssiId = cnSuggestNssiId;
+ }
+
+ public String getCnSuggestNssiName() {
+ return cnSuggestNssiName;
+ }
+
+ public void setCnSuggestNssiName(String cnSuggestNssiName) {
+ this.cnSuggestNssiName = cnSuggestNssiName;
+ }
+
+ public String getCnProgress() {
+ return cnProgress;
+ }
+
+ public void setCnProgress(String cnProgress) {
+ this.cnProgress = cnProgress;
+ }
+
+ public String getCnStatus() {
+ return cnStatus;
+ }
+
+ public void setCnStatus(String cnStatus) {
+ this.cnStatus = cnStatus;
+ }
+
+ public String getCnStatusDescription() {
+ return cnStatusDescription;
+ }
+
+ public void setCnStatusDescription(String cnStatusDescription) {
+ this.cnStatusDescription = cnStatusDescription;
+ }
+
+ public String getAnSuggestNssiId() {
+ return anSuggestNssiId;
+ }
+
+ public void setAnSuggestNssiId(String anSuggestNssiId) {
+ this.anSuggestNssiId = anSuggestNssiId;
+ }
+
+ public String getAnSuggestNssiName() {
+ return anSuggestNssiName;
+ }
+
+ public void setAnSuggestNssiName(String anSuggestNssiName) {
+ this.anSuggestNssiName = anSuggestNssiName;
+ }
+
+ public String getAnProgress() {
+ return anProgress;
+ }
+
+ public void setAnProgress(String anProgress) {
+ this.anProgress = anProgress;
+ }
+
+ public String getAnStatus() {
+ return anStatus;
+ }
+
+ public void setAnStatus(String anStatus) {
+ this.anStatus = anStatus;
+ }
+
+ public String getAnStatusDescription() {
+ return anStatusDescription;
+ }
+
+ public void setAnStatusDescription(String anStatusDescription) {
+ this.anStatusDescription = anStatusDescription;
+ }
+
+ public String convertToJson() {
+ JsonObject jsonObject = new JsonObject();
+ jsonObject.addProperty("ServiceId", serviceId);
+ jsonObject.addProperty("ServiceName", serviceName);
+ jsonObject.addProperty("NSTId", nstId);
+ jsonObject.addProperty("NSTName", nstName);
+ jsonObject.addProperty("TN.ScriptName", tnScriptName);
+ jsonObject.addProperty("AN.ScriptName", anScriptName);
+ jsonObject.addProperty("CN.ScriptName", cnScriptName);
+ for (Map.Entry<String, Object> entry : serviceProfile.entrySet()) {
+ jsonObject.addProperty("ServiceProfile." + entry.getKey(), entry.getValue().toString());
+ }
+ jsonObject.addProperty("suggestNSIId", suggestNsiId);
+ jsonObject.addProperty("suggestNSIName", suggestNsiName);
+ for (Map.Entry<String, Object> entry : sliceProfileTn.entrySet()) {
+ jsonObject.addProperty("SliceProfile.TN." + entry.getKey(), entry.getValue().toString());
+ }
+ for (Map.Entry<String, Object> entry : sliceProfileCn.entrySet()) {
+ jsonObject.addProperty("SliceProfile.CN." + entry.getKey(), entry.getValue().toString());
+ }
+ for (Map.Entry<String, Object> entry : sliceProfileAn.entrySet()) {
+ jsonObject.addProperty("SliceProfile.AN." + entry.getKey(), entry.getValue().toString());
+ }
+ jsonObject.addProperty("TN.SuggestNSSIId", tnSuggestNssiId);
+ jsonObject.addProperty("TN.SuggestNSSIName", tnSuggestNssiName);
+ jsonObject.addProperty("TN.progress", tnProgress);
+ jsonObject.addProperty("TN.status", tnStatus);
+ jsonObject.addProperty("TN.statusDescription", tnStatusDescription);
+ jsonObject.addProperty("CN.SuggestNSSIId", cnSuggestNssiId);
+ jsonObject.addProperty("CN.SuggestNSSIName", cnSuggestNssiName);
+ jsonObject.addProperty("CN.progress", cnProgress);
+ jsonObject.addProperty("CN.status", cnStatus);
+ jsonObject.addProperty("CN.statusDescription", cnStatusDescription);
+ jsonObject.addProperty("AN.SuggestNSSIId", anSuggestNssiId);
+ jsonObject.addProperty("AN.SuggestNSSIName", anSuggestNssiName);
+ jsonObject.addProperty("AN.progress", anProgress);
+ jsonObject.addProperty("AN.status", anStatus);
+ jsonObject.addProperty("AN.statusDescription", anStatusDescription);
+
+ return jsonObject.toString();
+ }
+
+ public void convertFromJson(String jsonString) throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ Map<String, String> paramMap = (Map<String, String>) mapper.readValue(jsonString, Map.class);
+ this.setServiceId(paramMap.get("ServiceId"));
+ this.setServiceName(paramMap.get("ServiceName"));
+ this.setNstId(paramMap.get("NSTId"));
+ this.setNstName(paramMap.get("NSTName"));
+ this.setTnScriptName(paramMap.get("TN.ScriptName"));
+ this.setAnScriptName(paramMap.get("AN.ScriptName"));
+ this.setCnScriptName(paramMap.get("CN.ScriptName"));
+ Map<String, Object> serviceProfileMap = new HashMap<>();
+ for (Map.Entry<String, String> entry : paramMap.entrySet()) {
+ if (entry.getKey().startsWith("ServiceProfile.")) {
+ serviceProfileMap.put(entry.getKey().replaceFirst("^ServiceProfile.", ""), entry.getValue());
+ }
+ }
+ this.setServiceProfile(serviceProfileMap);
+ this.setSuggestNsiId(paramMap.get("suggestNSIId"));
+ this.setSuggestNsiName(paramMap.get("suggestNSIName"));
+ Map<String, Object> sliceProfileTnMap = new HashMap<>();
+ for (Map.Entry<String, String> entry : paramMap.entrySet()) {
+ if (entry.getKey().startsWith("SliceProfile.TN.")) {
+ sliceProfileTnMap.put(entry.getKey().replaceFirst("^SliceProfile.TN.", ""), entry.getValue());
+ }
+ }
+ this.setSliceProfileTn(sliceProfileTnMap);
+ Map<String, Object> sliceProfileCnMap = new HashMap<>();
+ for (Map.Entry<String, String> entry : paramMap.entrySet()) {
+ if (entry.getKey().startsWith("SliceProfile.CN.")) {
+ sliceProfileCnMap.put(entry.getKey().replaceFirst("^SliceProfile.CN.", ""), entry.getValue());
+ }
+ }
+ this.setSliceProfileCn(sliceProfileCnMap);
+ Map<String, Object> sliceProfileAnMap = new HashMap<>();
+ for (Map.Entry<String, String> entry : paramMap.entrySet()) {
+ if (entry.getKey().startsWith("SliceProfile.AN.")) {
+ sliceProfileAnMap.put(entry.getKey().replaceFirst("^SliceProfile.AN.", ""), entry.getValue());
+ }
+ }
+ this.setSliceProfileAn(sliceProfileAnMap);
+ this.setTnSuggestNssiId(paramMap.get("TN.SuggestNSSIId"));
+ this.setTnSuggestNssiName(paramMap.get("TN.SuggestNSSIName"));
+ this.setTnProgress(paramMap.get("TN.progress"));
+ this.setTnStatus(paramMap.get("TN.status"));
+ this.setTnStatusDescription(paramMap.get("TN.statusDescription"));
+ this.setCnSuggestNssiId(paramMap.get("CN.SuggestNSSIId"));
+ this.setCnSuggestNssiName(paramMap.get("CN.SuggestNSSIName"));
+ this.setCnProgress(paramMap.get("CN.progress"));
+ this.setCnStatus(paramMap.get("CN.status"));
+ this.setCnStatusDescription(paramMap.get("CN.statusDescription"));
+ this.setAnSuggestNssiId(paramMap.get("AN.SuggestNSSIId"));
+ this.setAnSuggestNssiName(paramMap.get("AN.SuggestNSSIName"));
+ this.setAnProgress(paramMap.get("AN.progress"));
+ this.setAnStatus(paramMap.get("AN.status"));
+ this.setAnStatusDescription(paramMap.get("AN.statusDescription"));
+ }
+}
+
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/TerminateNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/TerminateNssi.java
new file mode 100644
index 0000000000..28cc565272
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/TerminateNssi.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class TerminateNssi {
+
+ public final static String URL = "/api/rest/provMns/v1/NSS/nssi/%s";
+
+ private String nsiId;
+
+ private String scriptName;
+
+ private String extension;
+
+ public String getNsiId() {
+ return nsiId;
+ }
+
+ public void setNsiId(String nsiId) {
+ this.nsiId = nsiId;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public void setScriptName(String scriptName) {
+ this.scriptName = scriptName;
+ }
+
+ public String getExtension() {
+ return extension;
+ }
+
+ public void setExtension(String extension) {
+ this.extension = extension;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java
new file mode 100644
index 0000000000..c3548f15af
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class TnSliceProfile {
+
+ private String bandwidth;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int latency;
+
+ public String getBandwidth() {
+ return bandwidth;
+ }
+
+ public void setBandwidth(String bandwidth) {
+ this.bandwidth = bandwidth;
+ }
+
+ public int getLatency() {
+ return latency;
+ }
+
+ public void setLatency(int latency) {
+ this.latency = latency;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/UeMobilityLevel.java b/common/src/main/java/org/onap/so/beans/nsmf/UeMobilityLevel.java
new file mode 100644
index 0000000000..ffb7229838
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/UeMobilityLevel.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+public enum UeMobilityLevel {
+
+ STATIONARY("stationary"),
+
+ NOMADIC("nomadic"),
+
+ RESTRICTED_MOBILITY("restricted mobility"),
+
+ FULLY_MOBILITY("fully mobility");
+
+ private String ueMobilityLevel;
+
+ UeMobilityLevel(String ueMobilityLevel) {
+ this.ueMobilityLevel = ueMobilityLevel;
+ }
+
+ @JsonValue
+ public String getUeMobilityLevel() {
+ return ueMobilityLevel;
+ }
+
+ @JsonCreator
+ public UeMobilityLevel forValue(String value) {
+ return valueOf(value);
+ }
+
+ public static UeMobilityLevel fromString(String value) {
+ for (UeMobilityLevel ueLvl : UeMobilityLevel.values()) {
+ if (ueLvl.ueMobilityLevel.equalsIgnoreCase(value)) {
+ return ueLvl;
+ }
+ }
+ return null;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/UpdateCnNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/UpdateCnNssi.java
new file mode 100644
index 0000000000..9fb8f26440
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/UpdateCnNssi.java
@@ -0,0 +1,119 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class UpdateCnNssi {
+
+ public final static String URL = "/api/rest/provMns/v1/NSS/SliceProfiles/%s";
+
+ private String snssai;
+
+ private String nssiId;
+
+ private String nsstId;
+
+ private String flavorId;
+
+ private UpdateSliceProfile sliceProfile;
+
+ private String scriptName;
+
+ private String extension;
+
+ private NsiInfo nsiInfo;
+
+ private NewNsst newNsst;
+
+ public String getSnssai() {
+ return snssai;
+ }
+
+ public void setSnssai(String snssai) {
+ this.snssai = snssai;
+ }
+
+ public String getNssiId() {
+ return nssiId;
+ }
+
+ public void setNssiId(String nssiId) {
+ this.nssiId = nssiId;
+ }
+
+ public String getNsstId() {
+ return nsstId;
+ }
+
+ public void setNsstId(String nsstId) {
+ this.nsstId = nsstId;
+ }
+
+ public String getFlavorId() {
+ return flavorId;
+ }
+
+ public void setFlavorId(String flavorId) {
+ this.flavorId = flavorId;
+ }
+
+ public UpdateSliceProfile getSliceProfile() {
+ return sliceProfile;
+ }
+
+ public void setSliceProfile(UpdateSliceProfile sliceProfile) {
+ this.sliceProfile = sliceProfile;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public void setScriptName(String scriptName) {
+ this.scriptName = scriptName;
+ }
+
+ public String getExtension() {
+ return extension;
+ }
+
+ public void setExtension(String extension) {
+ this.extension = extension;
+ }
+
+ public NsiInfo getNsiInfo() {
+ return nsiInfo;
+ }
+
+ public void setNsiInfo(NsiInfo nsiInfo) {
+ this.nsiInfo = nsiInfo;
+ }
+
+ public NewNsst getNewNsst() {
+ return newNsst;
+ }
+
+ public void setNewNsst(NewNsst newNsst) {
+ this.newNsst = newNsst;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/UpdateCnNssiById.java b/common/src/main/java/org/onap/so/beans/nsmf/UpdateCnNssiById.java
new file mode 100644
index 0000000000..26e6ca02bb
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/UpdateCnNssiById.java
@@ -0,0 +1,89 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class UpdateCnNssiById {
+
+ public final static String URL = "/api/rest/provMns/v1/NSS/nssi/%s";
+
+ private String nsstId;
+
+ private String flavorId;
+
+ private String scriptName;
+
+ private String extension;
+
+ private NsiInfo nsiInfo;
+
+ private NewNsst newNsst;
+
+ public String getNsstId() {
+ return nsstId;
+ }
+
+ public void setNsstId(String nsstId) {
+ this.nsstId = nsstId;
+ }
+
+ public String getFlavorId() {
+ return flavorId;
+ }
+
+ public void setFlavorId(String flavorId) {
+ this.flavorId = flavorId;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public void setScriptName(String scriptName) {
+ this.scriptName = scriptName;
+ }
+
+ public String getExtension() {
+ return extension;
+ }
+
+ public void setExtension(String extension) {
+ this.extension = extension;
+ }
+
+ public NsiInfo getNsiInfo() {
+ return nsiInfo;
+ }
+
+ public void setNsiInfo(NsiInfo nsiInfo) {
+ this.nsiInfo = nsiInfo;
+ }
+
+ public NewNsst getNewNsst() {
+ return newNsst;
+ }
+
+ public void setNewNsst(NewNsst newNsst) {
+ this.newNsst = newNsst;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/UpdateSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/UpdateSliceProfile.java
new file mode 100644
index 0000000000..74ea7ae424
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/UpdateSliceProfile.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import java.util.List;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class UpdateSliceProfile {
+
+ private List<String> plmnIdList;
+
+ private PerfReq perfReq;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int maxNumberofUEs;
+
+ private List<String> coverageAreaTAList;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int latency;
+
+ @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ private int ueMobilityLevel;
+
+ private String resourceSharingLevel;
+
+ public List<String> getPlmnIdList() {
+ return plmnIdList;
+ }
+
+ public void setPlmnIdList(List<String> plmnIdList) {
+ this.plmnIdList = plmnIdList;
+ }
+
+ public PerfReq getPerfReq() {
+ return perfReq;
+ }
+
+ public void setPerfReq(PerfReq perfReq) {
+ this.perfReq = perfReq;
+ }
+
+ public int getMaxNumberofUEs() {
+ return maxNumberofUEs;
+ }
+
+ public void setMaxNumberofUEs(int maxNumberofUEs) {
+ this.maxNumberofUEs = maxNumberofUEs;
+ }
+
+ public List<String> getCoverageAreaTAList() {
+ return coverageAreaTAList;
+ }
+
+ public void setCoverageAreaTAList(List<String> coverageAreaTAList) {
+ this.coverageAreaTAList = coverageAreaTAList;
+ }
+
+ public int getLatency() {
+ return latency;
+ }
+
+ public void setLatency(int latency) {
+ this.latency = latency;
+ }
+
+ public int getUeMobilityLevel() {
+ return ueMobilityLevel;
+ }
+
+ public void setUeMobilityLevel(int ueMobilityLevel) {
+ this.ueMobilityLevel = ueMobilityLevel;
+ }
+
+ public String getResourceSharingLevel() {
+ return resourceSharingLevel;
+ }
+
+ public void setResourceSharingLevel(String resourceSharingLevel) {
+ this.resourceSharingLevel = resourceSharingLevel;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/VnfErrorList.java b/common/src/main/java/org/onap/so/beans/nsmf/VnfErrorList.java
new file mode 100644
index 0000000000..6388ca6106
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/VnfErrorList.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. 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.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class VnfErrorList {
+
+ private String vnfInstanceId;
+
+ private String vnfErrorDesc;
+
+ public String getVnfInstanceId() {
+ return vnfInstanceId;
+ }
+
+ public void setVnfInstanceId(String vnfInstanceId) {
+ this.vnfInstanceId = vnfInstanceId;
+ }
+
+ public String getVnfErrorDesc() {
+ return vnfErrorDesc;
+ }
+
+ public void setVnfErrorDesc(String vnfErrorDesc) {
+ this.vnfErrorDesc = vnfErrorDesc;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClient.java b/common/src/main/java/org/onap/so/client/aai/AAIClient.java
index a1e0d7c102..d376d85a83 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIClient.java
@@ -25,7 +25,6 @@ import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.UriBuilder;
import org.onap.so.client.RestClient;
import org.onap.so.client.graphinventory.GraphInventoryClient;
-import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -46,14 +45,15 @@ public class AAIClient extends GraphInventoryClient {
}
@Override
- protected URI constructPath(GraphInventoryUri uri) {
+ protected URI constructPath(URI uri) {
- return UriBuilder.fromUri(AAI_ROOT + "/" + this.getVersion().toString() + uri.build().toString()).build();
+ return UriBuilder.fromUri(AAI_ROOT + "/" + this.getVersion().toString() + uri.toString()).build();
}
@Override
- public RestClient createClient(GraphInventoryUri uri) {
+ protected RestClient createClient(URI uri) {
try {
+
return new AAIRestClient(getRestProperties(), constructPath(uri));
} catch (GraphInventoryUriComputationException | NotFoundException e) {
logger.debug("failed to construct A&AI uri", e);
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectBase.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectBase.java
new file mode 100644
index 0000000000..dab3cda32b
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectBase.java
@@ -0,0 +1,7 @@
+package org.onap.so.client.aai;
+
+import org.onap.so.client.graphinventory.GraphInventoryObjectBase;
+
+public interface AAIObjectBase extends GraphInventoryObjectBase {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java
index e42a2a2383..d14a4bedc3 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectPlurals.java
@@ -25,63 +25,64 @@ import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
import org.onap.so.constants.Defaults;
import com.google.common.base.CaseFormat;
-public class AAIObjectPlurals implements GraphInventoryObjectPlurals, Serializable {
+public class AAIObjectPlurals implements AAIObjectBase, GraphInventoryObjectPlurals, Serializable {
private static final long serialVersionUID = 5312713297525740746L;
public static final AAIObjectPlurals CUSTOMER =
- new AAIObjectPlurals(AAINamespaceConstants.BUSINESS, "/customers", "customer");
+ new AAIObjectPlurals(AAIObjectType.CUSTOMER, AAINamespaceConstants.BUSINESS, "/customers");
public static final AAIObjectPlurals GENERIC_VNF =
- new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/generic-vnfs", "generic-vnf");
+ new AAIObjectPlurals(AAIObjectType.GENERIC_VNF, AAINamespaceConstants.NETWORK, "/generic-vnfs");
public static final AAIObjectPlurals PORT_GROUP =
- new AAIObjectPlurals(AAIObjectType.VCE.uriTemplate(), "/port-groups", "port-group");
+ new AAIObjectPlurals(AAIObjectType.PORT_GROUP, AAIObjectType.VCE.uriTemplate(), "/port-groups");
public static final AAIObjectPlurals PSERVER =
- new AAIObjectPlurals(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers", "pserver");
+ new AAIObjectPlurals(AAIObjectType.PSERVER, AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers");
public static final AAIObjectPlurals P_INTERFACE =
- new AAIObjectPlurals(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces", "p-interface");
+ new AAIObjectPlurals(AAIObjectType.P_INTERFACE, AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces");
public static final AAIObjectPlurals L3_NETWORK =
- new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/l3-networks", "l3-network");
+ new AAIObjectPlurals(AAIObjectType.L3_NETWORK, AAINamespaceConstants.NETWORK, "/l3-networks");
public static final AAIObjectPlurals NETWORK_POLICY =
- new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/network-policies", "network-policy");
+ new AAIObjectPlurals(AAIObjectType.NETWORK_POLICY, AAINamespaceConstants.NETWORK, "/network-policies");
public static final AAIObjectPlurals VPN_BINDING =
- new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/vpn-bindings", "vpn-binding");
- public static final AAIObjectPlurals SERVICE_SUBSCRIPTION = new AAIObjectPlurals(
- AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions", "service-subscription");
- public static final AAIObjectPlurals SERVICE_INSTANCE = new AAIObjectPlurals(
- AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances", "service-instance");
+ new AAIObjectPlurals(AAIObjectType.VPN_BINDING, AAINamespaceConstants.NETWORK, "/vpn-bindings");
+ public static final AAIObjectPlurals SERVICE_SUBSCRIPTION = new AAIObjectPlurals(AAIObjectType.SERVICE_SUBSCRIPTION,
+ AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions");
+ public static final AAIObjectPlurals SERVICE_INSTANCE = new AAIObjectPlurals(AAIObjectType.SERVICE_INSTANCE,
+ AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances");
public static final AAIObjectPlurals OWNING_ENTITY =
- new AAIObjectPlurals(AAINamespaceConstants.BUSINESS, "/owning-entities", "owning-entity");
- public static final AAIObjectPlurals VOLUME_GROUP =
- new AAIObjectPlurals(AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups", "volume-group");
- public static final AAIObjectPlurals AVAILIBILITY_ZONE =
- new AAIObjectPlurals(AAIObjectType.CLOUD_REGION.uriTemplate(), "/availability-zones", "availability-zone");
+ new AAIObjectPlurals(AAIObjectType.OWNING_ENTITY, AAINamespaceConstants.BUSINESS, "/owning-entities");
+ public static final AAIObjectPlurals VOLUME_GROUP = new AAIObjectPlurals(AAIObjectType.VOLUME_GROUP,
+ AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups");
+ public static final AAIObjectPlurals AVAILIBILITY_ZONE = new AAIObjectPlurals(AAIObjectType.AVAILIBILITY_ZONE,
+ AAIObjectType.CLOUD_REGION.uriTemplate(), "/availability-zones");
public static final AAIObjectPlurals VF_MODULE =
- new AAIObjectPlurals(AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules", "vf-module");
+ new AAIObjectPlurals(AAIObjectType.VF_MODULE, AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules");
public static final AAIObjectPlurals CONFIGURATION =
- new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/configurations", "configuration");
+ new AAIObjectPlurals(AAIObjectType.CONFIGURATION, AAINamespaceConstants.NETWORK, "/configurations");
public static final AAIObjectPlurals DEFAULT_TENANT =
- new AAIObjectPlurals(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/"
- + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants", "default-tenant");
- public static final AAIObjectPlurals NETWORK_TECHNOLOGY = new AAIObjectPlurals(
- AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/network-technologies", "network-technology");
+ new AAIObjectPlurals(AAIObjectType.DEFAULT_TENANT, AAINamespaceConstants.CLOUD_INFRASTRUCTURE
+ + "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants");
+ public static final AAIObjectPlurals NETWORK_TECHNOLOGY = new AAIObjectPlurals(AAIObjectType.NETWORK_TECHNOLOGY,
+ AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/network-technologies");
public static final AAIObjectPlurals LOGICAL_LINK =
- new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/logical-links", "logical-link");
+ new AAIObjectPlurals(AAIObjectType.LOGICAL_LINK, AAINamespaceConstants.NETWORK, "/logical-links");
public static final AAIObjectPlurals L_INTERFACE =
- new AAIObjectPlurals(AAIObjectType.VSERVER.uriTemplate(), "/l-interfaces", "l-interface");
+ new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.VSERVER.uriTemplate(), "/l-interfaces");
public static final AAIObjectPlurals SUB_L_INTERFACE =
- new AAIObjectPlurals(AAIObjectType.L_INTERFACE.uriTemplate(), "/l-interfaces", "l-interface");
+ new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.L_INTERFACE.uriTemplate(), "/l-interfaces");
public static final AAIObjectPlurals INSTANCE_GROUP =
- new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/instance-groups", "instance-group");
- public static final AAIObjectPlurals PNF = new AAIObjectPlurals(AAINamespaceConstants.NETWORK, "/pnfs", "pnfs");
+ new AAIObjectPlurals(AAIObjectType.INSTANCE_GROUP, AAINamespaceConstants.NETWORK, "/instance-groups");
+ public static final AAIObjectPlurals PNF =
+ new AAIObjectPlurals(AAIObjectType.PNF, AAINamespaceConstants.NETWORK, "/pnfs");
private final String uriTemplate;
private final String partialUri;
- private final String name;
+ private final AAIObjectType type;
- protected AAIObjectPlurals(String parentUri, String partialUri, String name) {
+ protected AAIObjectPlurals(AAIObjectType type, String parentUri, String partialUri) {
this.uriTemplate = parentUri + partialUri;
this.partialUri = partialUri;
- this.name = name;
+ this.type = type;
}
@Override
@@ -100,12 +101,17 @@ public class AAIObjectPlurals implements GraphInventoryObjectPlurals, Serializab
}
@Override
+ public AAIObjectType getType() {
+ return this.type;
+ }
+
+ @Override
public String typeName() {
- return this.typeName(CaseFormat.LOWER_HYPHEN);
+ return this.getType().typeName();
}
@Override
public String typeName(CaseFormat format) {
- return CaseFormat.LOWER_HYPHEN.to(format, this.name);
+ return this.getType().typeName(format);
}
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
index c2c8e933b1..c9b69cd9e4 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
@@ -20,17 +20,14 @@
package org.onap.so.client.aai;
-import java.io.Serializable;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
+import com.google.common.base.CaseFormat;
import org.onap.aai.annotations.Metadata;
import org.onap.aai.domain.yang.AggregateRoute;
import org.onap.aai.domain.yang.AllottedResource;
+import org.onap.aai.domain.yang.AvailabilityZone;
import org.onap.aai.domain.yang.CloudRegion;
import org.onap.aai.domain.yang.Collection;
+import org.onap.aai.domain.yang.CommunicationServiceProfile;
import org.onap.aai.domain.yang.Complex;
import org.onap.aai.domain.yang.Configuration;
import org.onap.aai.domain.yang.Connector;
@@ -45,6 +42,7 @@ import org.onap.aai.domain.yang.InstanceGroup;
import org.onap.aai.domain.yang.L3Network;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LineOfBusiness;
+import org.onap.aai.domain.yang.LogicalLink;
import org.onap.aai.domain.yang.ModelVer;
import org.onap.aai.domain.yang.NetworkPolicy;
import org.onap.aai.domain.yang.NetworkTechnology;
@@ -58,8 +56,11 @@ import org.onap.aai.domain.yang.PortGroup;
import org.onap.aai.domain.yang.Project;
import org.onap.aai.domain.yang.Pserver;
import org.onap.aai.domain.yang.RouteTableReference;
+import org.onap.aai.domain.yang.Service;
import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.ServiceProfile;
import org.onap.aai.domain.yang.ServiceSubscription;
+import org.onap.aai.domain.yang.SliceProfile;
import org.onap.aai.domain.yang.SpPartner;
import org.onap.aai.domain.yang.SriovPf;
import org.onap.aai.domain.yang.Subnet;
@@ -79,9 +80,14 @@ import org.reflections.Reflections;
import org.reflections.scanners.SubTypesScanner;
import org.reflections.util.ClasspathHelper;
import org.reflections.util.ConfigurationBuilder;
-import com.google.common.base.CaseFormat;
+import java.io.Serializable;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
-public class AAIObjectType implements GraphInventoryObjectType, Serializable {
+public class AAIObjectType implements AAIObjectBase, GraphInventoryObjectType, Serializable {
private static final long serialVersionUID = -2877184776691514600L;
private static Map<String, AAIObjectType> map = new HashMap<>();
@@ -122,6 +128,8 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
public static final AAIObjectType SERVICE_INSTANCE_METADATA = new AAIObjectType(
AAIObjectType.SERVICE_INSTANCE + "/metadata", org.onap.aai.domain.yang.v13.Metadata.class);
+ public static final AAIObjectType SERVICE = new AAIObjectType(
+ AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/services/service/{service-id}", Service.class);
public static final AAIObjectType SERVICE_INSTANCE =
new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceInstance.class);
public static final AAIObjectType PROJECT = new AAIObjectType(AAINamespaceConstants.BUSINESS, Project.class);
@@ -132,6 +140,8 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
new AAIObjectType(AAINamespaceConstants.BUSINESS, OwningEntity.class);
public static final AAIObjectType ALLOTTED_RESOURCE =
new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), AllottedResource.class);
+ public static final AAIObjectType ALLOTTED_RESOURCE_ALL =
+ new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources", "allottedResources");
public static final AAIObjectType PNF = new AAIObjectType(AAINamespaceConstants.NETWORK, Pnf.class);
public static final AAIObjectType OPERATIONAL_ENVIRONMENT =
new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, OperationalEnvironment.class);
@@ -150,6 +160,8 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
new AAIObjectType(AAIObjectType.PSERVER.uriTemplate(), PInterface.class);
public static final AAIObjectType SRIOV_PF =
new AAIObjectType(AAIObjectType.P_INTERFACE.uriTemplate(), SriovPf.class);
+ public static final AAIObjectType LOGICAL_LINK =
+ new AAIObjectType(AAINamespaceConstants.NETWORK, LogicalLink.class);
public static final AAIObjectType PHYSICAL_LINK =
new AAIObjectType(AAINamespaceConstants.NETWORK, PhysicalLink.class);
public static final AAIObjectType INSTANCE_GROUP =
@@ -176,7 +188,15 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
public static final AAIObjectType IMAGE = new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Image.class);
public static final AAIObjectType FLAVOR =
new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Flavor.class);
- public static final AAIObjectType UNKNOWN = new AAIObjectType("", "", "unknown");
+ public static final AAIObjectType UNKNOWN = new AAIObjectType("", "", "unknown") {
+
+ private static final long serialVersionUID = 9208984071038447607L;
+
+ @Override
+ public boolean passThrough() {
+ return true;
+ }
+ };
public static final AAIObjectType DSL = new AAIObjectType("/dsl", "", "dsl");
public static final AAIObjectType VNFM = new AAIObjectType(
AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list/esr-vnfm/{vnfm-id}", EsrVnfm.class);
@@ -188,6 +208,27 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
public static final AAIObjectType CLOUD_ESR_SYSTEM_INFO_LIST = new AAIObjectType(
AAIObjectType.CLOUD_REGION.uriTemplate(), "/esr-system-info-list", "cloud-esr-system-info-list");
public static final AAIObjectType ZONE = new AAIObjectType(AAINamespaceConstants.NETWORK, Zone.class);
+ public static final AAIObjectType AVAILIBILITY_ZONE =
+ new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), AvailabilityZone.class);
+ public static final AAIObjectType THIRDPARTY_SDNC_LIST = new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM,
+ "/esr-thirdparty-sdnc-list", "thirdparty-sdnc-list");
+ public static final AAIObjectType THIRDPARTY_SDNC_SYSTEM_INFO_LIST =
+ new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-thirdparty-sdnc-list",
+ "/esr-thirdparty-sdnc/{sdnc-id}/esr-system-info-list", "thirdparty-sdnc-system-info-list");
+ public static final AAIObjectType COMMUNICATION_SERVICE_PROFILE =
+ new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), CommunicationServiceProfile.class);
+ public static final AAIObjectType SERVICE_PROFILE =
+ new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceProfile.class);
+ public static final AAIObjectType SERVICE_PROFILE_ALL =
+ new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/service-profiles", "serviceProfiles");
+ public static final AAIObjectType SLICE_PROFILE =
+ new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), SliceProfile.class);
+ public static final AAIObjectType SLICE_PROFILE_ALL =
+ new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/slice-profiles", "sliceProfiles");
+ public static final AAIObjectType COMMUNICATION_PROFILE_ALL = new AAIObjectType(
+ AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/communication-service-profiles", "communicationProfiles");
+ public static final AAIObjectType QUERY_ALLOTTED_RESOURCE =
+ new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "?depth=2", "service-Instance");
private final String uriTemplate;
private final String parentUri;
@@ -202,12 +243,13 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
new Reflections(new ConfigurationBuilder().setUrls(packages).setScanners(new SubTypesScanner()));
Set<Class<? extends AAIObjectType>> resources = r.getSubTypesOf(AAIObjectType.class);
- try {
- for (Class<? extends AAIObjectType> customTypeClass : resources) {
- AAIObjectType customType;
+
+ for (Class<? extends AAIObjectType> customTypeClass : resources) {
+ AAIObjectType customType;
+ try {
customType = customTypeClass.newInstance();
+ } catch (InstantiationException | IllegalAccessException e) {
}
- } catch (InstantiationException | IllegalAccessException e) {
}
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
index a89bea6975..8e334de396 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIResourcesClient.java
@@ -24,13 +24,14 @@ import java.util.Optional;
import org.onap.aai.domain.yang.Relationship;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.graphinventory.GraphInventoryResourcesClient;
import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
-import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
public class AAIResourcesClient extends
- GraphInventoryResourcesClient<AAIResourcesClient, AAIResourceUri, AAIEdgeLabel, AAIResultWrapper, AAITransactionalClient, AAISingleTransactionClient> {
+ GraphInventoryResourcesClient<AAIResourcesClient, AAIBaseResourceUri<?, ?>, AAIResourceUri, AAIPluralResourceUri, AAIEdgeLabel, AAIResultWrapper, AAITransactionalClient, AAISingleTransactionClient> {
private AAIClient aaiClient;
@@ -55,6 +56,11 @@ public class AAIResourcesClient extends
}
@Override
+ public AAIResultWrapper createWrapper(Object obj) {
+ return new AAIResultWrapper(obj);
+ }
+
+ @Override
public AAITransactionalClient beginTransaction() {
return new AAITransactionalClient(this, aaiClient);
}
@@ -65,17 +71,17 @@ public class AAIResourcesClient extends
}
@Override
- protected Relationship buildRelationship(GraphInventoryResourceUri uri) {
+ protected Relationship buildRelationship(AAIResourceUri uri) {
return super.buildRelationship(uri, Optional.empty());
}
@Override
- protected Relationship buildRelationship(GraphInventoryResourceUri uri, GraphInventoryEdgeLabel label) {
+ protected Relationship buildRelationship(AAIResourceUri uri, GraphInventoryEdgeLabel label) {
return super.buildRelationship(uri, Optional.of(label));
}
@Override
- protected Relationship buildRelationship(GraphInventoryResourceUri uri, Optional<GraphInventoryEdgeLabel> label) {
+ protected Relationship buildRelationship(AAIResourceUri uri, Optional<GraphInventoryEdgeLabel> label) {
return super.buildRelationship(uri, label);
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java
index 8bc709b276..2698bc347f 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java
@@ -38,4 +38,6 @@ public interface AAIRestClientI {
Optional<Pnf> getPnfByName(String pnfId);
void createPnf(String pnfId, Pnf pnf);
+
+ void updatePnf(String pnfId, Pnf pnf);
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java
index 03e2eaea1f..f2f96ca905 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java
@@ -92,4 +92,9 @@ public class AAIRestClientImpl implements AAIRestClientI {
new AAIResourcesClient().createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId),
Optional.of(pnf));
}
+
+ @Override
+ public void updatePnf(String pnfId, Pnf pnf) {
+ new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId), pnf);
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
index 3f9715bdef..b1d29f445b 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAISingleTransactionClient.java
@@ -32,6 +32,7 @@ import org.onap.so.client.aai.entities.singletransaction.OperationBodyRequest;
import org.onap.so.client.aai.entities.singletransaction.OperationBodyResponse;
import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRequest;
import org.onap.so.client.aai.entities.singletransaction.SingleTransactionResponse;
+import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
@@ -40,8 +41,8 @@ import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Joiner;
-public class AAISingleTransactionClient
- extends GraphInventoryTransactionClient<AAISingleTransactionClient, AAIResourceUri, AAIEdgeLabel> {
+public class AAISingleTransactionClient extends
+ GraphInventoryTransactionClient<AAISingleTransactionClient, AAIBaseResourceUri<?, ?>, AAIResourceUri, AAIEdgeLabel> {
private final SingleTransactionRequest request;
private AAIResourcesClient resourcesClient;
@@ -137,12 +138,12 @@ public class AAISingleTransactionClient
}
@Override
- protected <T> Optional<T> get(GenericType<T> genericType, AAIResourceUri clone) {
+ protected <T> Optional<T> get(GenericType<T> genericType, AAIBaseResourceUri<?, ?> clone) {
return resourcesClient.get(genericType, clone);
}
@Override
- protected boolean exists(AAIResourceUri uri) {
+ protected boolean exists(AAIBaseResourceUri<?, ?> uri) {
return resourcesClient.exists(uri);
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
index e621566e5a..7b7dccc999 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAITransactionalClient.java
@@ -35,6 +35,7 @@ import org.onap.so.client.aai.entities.AAIError;
import org.onap.so.client.aai.entities.bulkprocess.OperationBody;
import org.onap.so.client.aai.entities.bulkprocess.Transaction;
import org.onap.so.client.aai.entities.bulkprocess.Transactions;
+import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
@@ -45,8 +46,8 @@ import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Joiner;
-public class AAITransactionalClient
- extends GraphInventoryTransactionClient<AAITransactionalClient, AAIResourceUri, AAIEdgeLabel> {
+public class AAITransactionalClient extends
+ GraphInventoryTransactionClient<AAITransactionalClient, AAIBaseResourceUri<?, ?>, AAIResourceUri, AAIEdgeLabel> {
private final Transactions transactions;
private Transaction currentTransaction;
@@ -189,12 +190,12 @@ public class AAITransactionalClient
}
@Override
- protected <T> Optional<T> get(GenericType<T> genericType, AAIResourceUri clone) {
+ protected <T> Optional<T> get(GenericType<T> genericType, AAIBaseResourceUri<?, ?> clone) {
return resourcesClient.get(genericType, clone);
}
@Override
- protected boolean exists(AAIResourceUri uri) {
+ protected boolean exists(AAIBaseResourceUri<?, ?> uri) {
return resourcesClient.exists(uri);
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIBaseResourceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIBaseResourceUri.java
new file mode 100644
index 0000000000..67f858a2bf
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIBaseResourceUri.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.client.aai.entities.uri;
+
+import org.onap.so.client.aai.AAIObjectBase;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
+
+public interface AAIBaseResourceUri<T extends AAIBaseResourceUri<?, ?>, OT extends AAIObjectBase>
+ extends AAIUri<T, OT>, GraphInventoryResourceUri<T, OT> {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIPluralResourceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIPluralResourceUri.java
new file mode 100644
index 0000000000..2cec021c95
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIPluralResourceUri.java
@@ -0,0 +1,9 @@
+package org.onap.so.client.aai.entities.uri;
+
+import org.onap.so.client.aai.AAIObjectPlurals;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri;
+
+public interface AAIPluralResourceUri extends AAIBaseResourceUri<AAIPluralResourceUri, AAIObjectPlurals>,
+ GraphInventoryPluralResourceUri<AAIPluralResourceUri, AAIObjectPlurals> {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java
index 70dfd581e8..e93d52889a 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIResourceUri.java
@@ -1,64 +1,10 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.onap.so.client.aai.entities.uri;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.graphinventory.Format;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
-import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
-
-public interface AAIResourceUri extends AAIUri, GraphInventoryResourceUri {
-
- public AAIResourceUri relationshipAPI();
-
- public AAIResourceUri relatedTo(AAIObjectPlurals plural);
-
- public AAIResourceUri relatedTo(AAIObjectType type, String... values);
-
- public AAIResourceUri resourceVersion(String version);
-
- public AAIResourceUri format(Format format);
-
- @Override
- public AAIResourceUri depth(Depth depth);
-
- @Override
- public AAIResourceUri nodesOnly(boolean nodesOnly);
-
- @Override
- public AAIResourceUri queryParam(String name, String... values);
-
- @Override
- public AAIResourceUri replaceQueryParam(String name, String... values);
-
- @Override
- public AAIResourceUri resultIndex(int index);
-
- @Override
- public AAIResourceUri resultSize(int size);
+import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri;
- @Override
- public AAIResourceUri limit(int size);
+public interface AAIResourceUri extends AAIBaseResourceUri<AAIResourceUri, AAIObjectType>,
+ GraphInventorySingleResourceUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals> {
- @Override
- public AAIResourceUri clone();
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimplePluralUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimplePluralUri.java
new file mode 100644
index 0000000000..9ab45a8aa9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimplePluralUri.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.onap.so.client.aai.entities.uri;
+
+import javax.ws.rs.core.UriBuilder;
+import org.onap.so.client.aai.AAIObjectPlurals;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.graphinventory.entities.uri.SimplePluralUri;
+
+public class AAISimplePluralUri
+ extends SimplePluralUri<AAIPluralResourceUri, AAIResourceUri, AAIObjectPlurals, AAIObjectType>
+ implements AAIPluralResourceUri {
+
+ private static final long serialVersionUID = -6397024057188453229L;
+
+ protected AAISimplePluralUri(AAIObjectPlurals type, UriBuilder builder, Object... values) {
+ super(type, builder, values);
+ }
+
+ protected AAISimplePluralUri(AAIObjectPlurals type) {
+ super(type);
+ }
+
+ protected AAISimplePluralUri(AAIObjectPlurals type, Object... values) {
+ super(type, values);
+ }
+
+ protected AAISimplePluralUri(AAIObjectPlurals type, AAIResourceUri uri) {
+ super(type, uri);
+ }
+
+ protected AAISimplePluralUri(AAIResourceUri parentUri, AAIObjectPlurals childType) {
+ super(parentUri, childType);
+ }
+
+ protected AAISimplePluralUri(AAISimplePluralUri copy) {
+ super(copy);
+ }
+
+ @Override
+ public AAISimplePluralUri clone() {
+ return new AAISimplePluralUri(this);
+ }
+
+ @Override
+ public AAIObjectPlurals getObjectType() {
+ return this.pluralType;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
index 1fe9da984f..49dab59fc1 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
@@ -21,15 +21,13 @@
package org.onap.so.client.aai.entities.uri;
import java.net.URI;
-import java.util.regex.Pattern;
import javax.ws.rs.core.UriBuilder;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.graphinventory.Format;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
-public class AAISimpleUri extends SimpleUri implements AAIResourceUri {
+public class AAISimpleUri extends SimpleUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals>
+ implements AAIResourceUri {
private static final long serialVersionUID = -6397024057188453229L;
@@ -46,102 +44,30 @@ public class AAISimpleUri extends SimpleUri implements AAIResourceUri {
super(type, builder, values);
}
- protected AAISimpleUri(AAIObjectPlurals type, UriBuilder builder, Object... values) {
- super(type, builder, values);
- }
-
- protected AAISimpleUri(AAIObjectPlurals type) {
- super(type);
- }
-
- protected AAISimpleUri(AAIObjectPlurals type, Object... values) {
- super(type, values);
- }
-
protected AAISimpleUri(AAIResourceUri parentUri, AAIObjectType childType, Object... childValues) {
super(parentUri, childType, childValues);
}
- protected AAISimpleUri(AAIResourceUri parentUri, AAIObjectPlurals childType) {
- super(parentUri, childType);
- }
-
- @Override
- public AAISimpleUri relationshipAPI() {
- return (AAISimpleUri) super.relationshipAPI();
- }
-
- @Override
- public AAISimpleUri relatedTo(AAIObjectPlurals plural) {
- return (AAISimpleUri) super.relatedTo(plural);
- }
-
- @Override
- public AAISimpleUri relatedTo(AAIObjectType type, String... values) {
- return (AAISimpleUri) super.relatedTo(type, values);
- }
-
- @Override
- public AAISimpleUri resourceVersion(String version) {
- return (AAISimpleUri) super.resourceVersion(version);
- }
-
- @Override
- public AAISimpleUri queryParam(String name, String... values) {
- return (AAISimpleUri) super.queryParam(name, values);
- }
-
- @Override
- public AAISimpleUri replaceQueryParam(String name, String... values) {
- return (AAISimpleUri) super.replaceQueryParam(name, values);
- }
-
- @Override
- public AAISimpleUri resultIndex(int index) {
- return (AAISimpleUri) super.resultIndex(index);
- }
-
- @Override
- public AAISimpleUri resultSize(int size) {
- return (AAISimpleUri) super.resultSize(size);
- }
-
- @Override
- public AAISimpleUri limit(int size) {
- return (AAISimpleUri) super.limit(size);
+ // copy constructor
+ protected AAISimpleUri(AAISimpleUri copy) {
+ super(copy);
}
@Override
public AAISimpleUri clone() {
- if (this.type != null) {
- return new AAISimpleUri((AAIObjectType) this.type, this.internalURI.clone(), values);
- } else {
- return new AAISimpleUri((AAIObjectPlurals) this.pluralType, this.internalURI.clone(), values);
- }
- }
-
- @Override
- public AAIObjectType getObjectType() {
- return (AAIObjectType) this.type;
+ return new AAISimpleUri(this);
}
@Override
- public AAISimpleUri depth(Depth depth) {
- return (AAISimpleUri) super.depth(depth);
- }
-
- @Override
- public AAISimpleUri nodesOnly(boolean nodesOnly) {
- return (AAISimpleUri) super.nodesOnly(nodesOnly);
+ public AAISimpleUri relatedTo(AAIObjectType type, String... values) {
+ this.internalURI = internalURI.path(relatedTo);
+ return new AAISimpleUri(this, type, values);
}
@Override
- public AAISimpleUri format(Format format) {
- return (AAISimpleUri) super.format(format);
+ public AAISimplePluralUri relatedTo(AAIObjectPlurals plural) {
+ this.internalURI.path(relatedTo);
+ return new AAISimplePluralUri(this, plural);
}
- @Override
- protected Pattern getPrefixPattern() {
- return Pattern.compile("/aai/v\\d+");
- }
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java
index 6a4c90a6ee..8101643b78 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUri.java
@@ -20,52 +20,13 @@
package org.onap.so.client.aai.entities.uri;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
+import java.util.regex.Pattern;
+import org.onap.so.client.aai.AAIObjectBase;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
-public interface AAIUri extends GraphInventoryUri {
+public interface AAIUri<T extends AAIUri<?, ?>, OP extends AAIObjectBase> extends GraphInventoryUri<T, OP> {
- /**
- * By default A&AI enforces a depth of 1. Some objects can be told to retrieve objects nested beneath them by
- * increasing this number.
- *
- * You can use 0 to restrict the returned information to only the object you requested You can use all to retrieve
- * all nested objects (this should only be used if you really need a massive amount of information and are caching
- * the retrieval)
- *
- * @param depth
- * @return
- */
- @Override
- public AAIUri depth(Depth depth);
-
- /**
- * Makes client only return object fields, no relationships
- *
- * @return
- */
- @Override
- public AAIUri nodesOnly(boolean nodesOnly);
-
- @Override
- public AAIUri queryParam(String name, String... values);
-
- @Override
- public AAIUri replaceQueryParam(String name, String... values);
-
- @Override
- public AAIUri resultIndex(int index);
-
- @Override
- public AAIUri resultSize(int size);
-
- @Override
- public AAIUri limit(int size);
-
- @Override
- public AAIUri clone();
-
- @Override
- public AAIObjectType getObjectType();
+ public default Pattern getPrefixPattern() {
+ return Pattern.compile("/aai/v\\d+");
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java
index 406ff09952..bdd3921851 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java
@@ -47,13 +47,13 @@ public class AAIUriFactory {
}
}
- public static AAIResourceUri createNodesUri(AAIObjectType type, Object... values) {
- return new NodesUri(type, values);
+ public static NodesSingleUri createNodesUri(AAIObjectType type, Object... values) {
+ return new NodesSingleUri(type, values);
}
- public static AAIResourceUri createNodesUri(AAIObjectPlurals type) {
- return new NodesUri(type);
+ public static NodesPluralUri createNodesUri(AAIObjectPlurals type) {
+ return new NodesPluralUri(type);
}
@@ -64,7 +64,7 @@ public class AAIUriFactory {
* @param uri
* @return
*/
- public static AAIResourceUri createResourceFromExistingURI(AAIObjectType type, URI uri) {
+ public static AAISimpleUri createResourceFromExistingURI(AAIObjectType type, URI uri) {
return new AAISimpleUri(type, uri);
}
@@ -77,15 +77,15 @@ public class AAIUriFactory {
* @param childValues
* @return
*/
- public static AAIResourceUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType,
+ public static AAISimpleUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType,
Object... childValues) {
return new AAISimpleUri(parentUri, childType, childValues);
}
- public static AAIResourceUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectPlurals childType) {
+ public static AAISimplePluralUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectPlurals childType) {
- return new AAISimpleUri(parentUri, childType);
+ return new AAISimplePluralUri(parentUri, childType);
}
/**
@@ -94,9 +94,9 @@ public class AAIUriFactory {
* @param type
* @return
*/
- public static AAIResourceUri createResourceUri(AAIObjectPlurals type) {
+ public static AAISimplePluralUri createResourceUri(AAIObjectPlurals type) {
- return new AAISimpleUri(type);
+ return new AAISimplePluralUri(type);
}
@@ -106,9 +106,9 @@ public class AAIUriFactory {
* @param type
* @return
*/
- public static AAIResourceUri createResourceUri(AAIObjectPlurals type, Object... values) {
+ public static AAISimplePluralUri createResourceUri(AAIObjectPlurals type, Object... values) {
- return new AAISimpleUri(type, values);
+ return new AAISimplePluralUri(type, values);
}
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java
index 37d21b375e..a0f1962706 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java
@@ -111,8 +111,24 @@ public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri
try {
if (this.values.length == 1) {
String uri = getObjectById(this.values[0]);
- Map<String, String> map = getURIKeys(uri);
- return super.build(map.values().toArray(values));
+ Map<String, String> map = super.getURIKeys(uri);
+ this.values = map.values().toArray(values);
+ return super.build(values);
+ }
+ } catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) {
+ throw new GraphInventoryUriComputationException(e);
+ }
+ return super.build();
+ }
+
+ @Override
+ public URI locateAndBuild() {
+ try {
+ if (this.values.length == 1) {
+ String uri = getObjectById(this.values[0]);
+ Map<String, String> map = super.getURIKeys(uri);
+ this.values = map.values().toArray(values);
+ return super.build(values);
}
} catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) {
throw new GraphInventoryUriComputationException(e);
@@ -155,7 +171,4 @@ public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri
}
}
-
- @Override
- public abstract URI buildNoNetwork();
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesPluralUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesPluralUri.java
new file mode 100644
index 0000000000..8545fc96fb
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesPluralUri.java
@@ -0,0 +1,19 @@
+package org.onap.so.client.aai.entities.uri;
+
+import javax.ws.rs.core.UriBuilder;
+import org.onap.so.client.aai.AAIObjectPlurals;
+import org.onap.so.client.graphinventory.GraphInventoryObjectBase;
+
+public class NodesPluralUri extends AAISimplePluralUri implements NodesUri {
+
+ private static final long serialVersionUID = -6743170679667245998L;
+
+ protected NodesPluralUri(AAIObjectPlurals type) {
+ super(type);
+ }
+
+ @Override
+ public String getTemplate(GraphInventoryObjectBase type) {
+ return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate();
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesSingleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesSingleUri.java
new file mode 100644
index 0000000000..7274b1f3b9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesSingleUri.java
@@ -0,0 +1,21 @@
+package org.onap.so.client.aai.entities.uri;
+
+import javax.ws.rs.core.UriBuilder;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.graphinventory.GraphInventoryObjectBase;
+
+public class NodesSingleUri extends AAISimpleUri implements NodesUri {
+
+ private static final long serialVersionUID = 2721165364903444248L;
+
+ protected NodesSingleUri(AAIObjectType type, Object... values) {
+ super(type, values);
+ }
+
+
+ @Override
+ public String getTemplate(GraphInventoryObjectBase type) {
+ return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate();
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java
index 4b4b5d92a2..6e5fa77f76 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java
@@ -20,32 +20,7 @@
package org.onap.so.client.aai.entities.uri;
-import javax.ws.rs.core.UriBuilder;
-import org.onap.so.client.aai.AAIObjectPlurals;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
-import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+public interface NodesUri {
-public class NodesUri extends AAISimpleUri {
- private static final long serialVersionUID = 8818689895730182042L;
-
- protected NodesUri(AAIObjectType type, Object... values) {
- super(type, values);
- }
-
- protected NodesUri(AAIObjectPlurals type) {
- super(type);
- }
-
-
- @Override
- protected String getTemplate(GraphInventoryObjectType type) {
- return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate();
- }
-
- @Override
- protected String getTemplate(GraphInventoryObjectPlurals type) {
- return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate();
- }
}
diff --git a/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
index 4de546e9da..cbad59e968 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java
@@ -20,12 +20,12 @@
package org.onap.so.client.dmaap;
-import com.google.common.base.Stopwatch;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.onap.so.client.dmaap.exceptions.DMaaPConsumerFailure;
import org.onap.so.client.dmaap.exceptions.ExceededMaximumPollingTime;
import org.onap.so.client.dmaap.rest.RestConsumer;
+import com.google.common.base.Stopwatch;
public abstract class DmaapConsumer extends DmaapClient {
static final int MAX_ELAPSED_TIME = 180000;
@@ -40,7 +40,6 @@ public abstract class DmaapConsumer extends DmaapClient {
public boolean consume() throws Exception {
Consumer mrConsumer = this.getConsumer();
- boolean accepted = false;
Stopwatch stopwatch = Stopwatch.createUnstarted();
try {
while (this.continuePolling()) {
@@ -54,20 +53,17 @@ public abstract class DmaapConsumer extends DmaapClient {
Iterable<String> itr = mrConsumer.fetch();
stopwatch.stop();
for (String message : itr) {
- if (!accepted && this.isAccepted(message)) {
+ if (this.isAccepted(message)) {
logger.info("accepted message found for " + this.getRequestId() + " on " + this.getTopic());
- accepted = true;
}
- if (accepted) {
- logger.info("received dmaap message: " + message);
- if (this.isFailure(message)) {
- this.stopProcessingMessages();
- final String errorMsg = "failure received from dmaap topic " + this.getTopic();
- logger.error(errorMsg);
- throw new DMaaPConsumerFailure(errorMsg);
- } else {
- this.processMessage(message);
- }
+ logger.info("received dmaap message: " + message);
+ if (this.isFailure(message)) {
+ this.stopProcessingMessages();
+ final String errorMsg = "failure received from dmaap topic " + this.getTopic();
+ logger.error(errorMsg);
+ throw new DMaaPConsumerFailure(errorMsg);
+ } else {
+ this.processMessage(message);
}
}
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java
index 98d48ec3a8..09efb5a48d 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryClient.java
@@ -25,6 +25,7 @@ import org.onap.so.client.RestClient;
import org.onap.so.client.RestProperties;
import org.onap.so.client.RestPropertiesLoader;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
+import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri;
public abstract class GraphInventoryClient {
@@ -36,9 +37,22 @@ public abstract class GraphInventoryClient {
this.props = props;
}
- protected abstract URI constructPath(GraphInventoryUri uri);
+ protected abstract URI constructPath(URI uri);
+
+ protected abstract RestClient createClient(URI uri);
+
+ public RestClient createClient(GraphInventoryUri uri) {
+ final URI result;
+ if (uri instanceof HttpAwareUri) {
+ result = ((HttpAwareUri) uri).locateAndBuild();
+ } else {
+ result = uri.build();
+ }
+
+ return createClient(result);
+
+ }
- public abstract RestClient createClient(GraphInventoryUri uri);
public <T extends RestProperties> T getRestProperties() {
if (props == null) {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectBase.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectBase.java
new file mode 100644
index 0000000000..72de833884
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectBase.java
@@ -0,0 +1,9 @@
+package org.onap.so.client.graphinventory;
+
+public interface GraphInventoryObjectBase
+ extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial {
+
+ public default boolean passThrough() {
+ return false;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java
index 42f4733e47..84604a76cf 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectPlurals.java
@@ -20,7 +20,8 @@
package org.onap.so.client.graphinventory;
-public interface GraphInventoryObjectPlurals
- extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial {
+public interface GraphInventoryObjectPlurals extends GraphInventoryObjectBase {
+
+ public GraphInventoryObjectType getType();
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java
index c11a08e867..d09a83a644 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryObjectType.java
@@ -20,7 +20,6 @@
package org.onap.so.client.graphinventory;
-public interface GraphInventoryObjectType
- extends GraphInventoryObjectName, GraphInventoryObjectUriTemplate, GraphInventoryObjectUriPartial {
+public interface GraphInventoryObjectType extends GraphInventoryObjectBase {
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java
index c7cdb2ff58..f446e5ac4c 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java
@@ -21,6 +21,11 @@
package org.onap.so.client.graphinventory;
import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.ws.rs.NotFoundException;
@@ -32,9 +37,13 @@ import org.onap.so.client.RestClient;
import org.onap.so.client.RestProperties;
import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
import org.onap.so.client.graphinventory.entities.GraphInventoryResultWrapper;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri;
+import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri;
+import org.onap.so.client.graphinventory.exceptions.GraphInventoryMultipleItemsException;
-public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> {
+public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PluralUri extends GraphInventoryPluralResourceUri<?, ?>, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> {
protected GraphInventoryClient client;
@@ -49,7 +58,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param uri
* @return
*/
- public void create(Uri uri, Object obj) {
+ public void create(SingleUri uri, Object obj) {
RestClient giRC = client.createClient(uri);
giRC.put(obj);
}
@@ -60,7 +69,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param uri
* @return
*/
- public void createEmpty(Uri uri) {
+ public void createEmpty(SingleUri uri) {
RestClient giRC = client.createClient(uri);
giRC.put("");
}
@@ -72,7 +81,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @return
*/
public boolean exists(Uri uri) {
- GraphInventoryResourceUri forceMinimal = uri.clone();
+ GraphInventoryResourceUri<?, ?> forceMinimal = (Uri) uri.clone();
forceMinimal.format(Format.COUNT);
forceMinimal.limit(1);
try {
@@ -91,8 +100,8 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param uriB
* @return
*/
- public void connect(Uri uriA, Uri uriB) {
- GraphInventoryResourceUri uriAClone = uriA.clone();
+ public void connect(SingleUri uriA, SingleUri uriB) {
+ GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
RestClient giRC = client.createClient(uriAClone.relationshipAPI());
giRC.put(this.buildRelationship(uriB));
}
@@ -105,8 +114,8 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param edge label
* @return
*/
- public void connect(Uri uriA, Uri uriB, EdgeLabel label) {
- GraphInventoryResourceUri uriAClone = uriA.clone();
+ public void connect(SingleUri uriA, SingleUri uriB, EdgeLabel label) {
+ GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
RestClient giRC = client.createClient(uriAClone.relationshipAPI());
giRC.put(this.buildRelationship(uriB, label));
}
@@ -118,8 +127,8 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param uriB
* @return
*/
- public void disconnect(Uri uriA, Uri uriB) {
- GraphInventoryResourceUri uriAClone = uriA.clone();
+ public void disconnect(SingleUri uriA, SingleUri uriB) {
+ GraphInventorySingleResourceUri<?, ?, ?, ?> uriAClone = (SingleUri) uriA.clone();
RestClient giRC = client.createClient(uriAClone.relationshipAPI());
giRC.delete(this.buildRelationship(uriB));
}
@@ -130,8 +139,8 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param uri
* @return
*/
- public void delete(Uri uri) {
- GraphInventoryResourceUri clone = uri.clone();
+ public void delete(SingleUri uri) {
+ GraphInventorySingleResourceUri<?, ?, ?, ?> clone = (SingleUri) uri.clone();
RestClient giRC = client.createClient(clone);
Map<String, Object> result = giRC.get(new GenericType<Map<String, Object>>() {}).orElseThrow(
() -> new NotFoundException(clone.build() + " does not exist in " + client.getGraphDBName()));
@@ -145,7 +154,7 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param uri
* @return
*/
- public void update(Uri uri, Object obj) {
+ public void update(SingleUri uri, Object obj) {
RestClient giRC = client.createClient(uri);
giRC.patch(obj);
}
@@ -206,6 +215,88 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
}
}
+ public <T, R> Optional<R> getOne(Class<T> pluralClass, Class<R> resultClass, PluralUri uri) {
+ Optional<List<R>> result = unwrapPlural(pluralClass, resultClass, uri);
+
+ if (result.isPresent()) {
+ if (result.get().size() == 1) {
+ return Optional.of(result.get().get(0));
+ } else {
+ throw new GraphInventoryMultipleItemsException(result.get().size(), uri);
+ }
+ }
+
+ return Optional.empty();
+ }
+
+ public <T, R> Optional<R> getFirst(Class<T> pluralClass, Class<R> resultClass, PluralUri uri) {
+ Optional<List<R>> result = unwrapPlural(pluralClass, resultClass, uri);
+
+ if (result.isPresent() && !result.get().isEmpty()) {
+ return Optional.of(result.get().get(0));
+ }
+
+ return Optional.empty();
+ }
+
+ public <T, R> Optional<Wrapper> getFirstWrapper(Class<T> pluralClass, Class<R> resultClass, PluralUri uri) {
+
+ Optional<R> result = getFirst(pluralClass, resultClass, uri);
+ if (result.isPresent()) {
+ return Optional.of(this.createWrapper(result.get()));
+ } else {
+ return Optional.empty();
+ }
+ }
+
+ public <T, R> Optional<Wrapper> getOneWrapper(Class<T> pluralClass, Class<R> resultClass, PluralUri uri) {
+
+ Optional<R> result = getOne(pluralClass, resultClass, uri);
+ if (result.isPresent()) {
+ return Optional.of(this.createWrapper(result.get()));
+ } else {
+ return Optional.empty();
+ }
+ }
+
+ protected <T, R> Optional<List<R>> unwrapPlural(Class<T> pluralClass, Class<R> resultClass, PluralUri uri) {
+ try {
+ PluralUri clone = (PluralUri) uri.clone().limit(1);
+ Optional<T> obj = client.createClient(clone).get(pluralClass);
+ if (obj.isPresent()) {
+ Optional<Method> listMethod = Arrays.stream(obj.get().getClass().getMethods()).filter(method -> {
+
+ Type returnType = method.getGenericReturnType();
+ if (returnType instanceof ParameterizedType) {
+ Type[] types = ((ParameterizedType) returnType).getActualTypeArguments();
+ if (types != null && types[0] instanceof Class) {
+ Class<?> listClass = (Class<?>) types[0];
+ return resultClass.equals(listClass);
+ }
+ }
+
+ return false;
+ }).findFirst();
+ if (listMethod.isPresent()) {
+ try {
+ return Optional.of((List<R>) listMethod.get().invoke(obj.get()));
+
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ return Optional.empty();
+
+ } catch (NotFoundException e) {
+ if (this.getRestProperties().mapNotFoundToEmpty()) {
+ return Optional.empty();
+ } else {
+ throw e;
+ }
+ }
+ }
+
/**
* Retrieves an object from GraphInventory wrapped in a helper class which offer additional features
*
@@ -269,8 +360,8 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
* @param uri
* @return
*/
- public Self createIfNotExists(Uri uri, Optional<Object> obj) {
- if (!this.exists(uri)) {
+ public Self createIfNotExists(SingleUri uri, Optional<Object> obj) {
+ if (!this.exists((Uri) uri)) {
if (obj.isPresent()) {
this.create(uri, obj.get());
} else {
@@ -281,17 +372,21 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
return (Self) this;
}
- protected Relationship buildRelationship(GraphInventoryResourceUri uri) {
+ protected Relationship buildRelationship(SingleUri uri) {
return buildRelationship(uri, Optional.empty());
}
- protected Relationship buildRelationship(GraphInventoryResourceUri uri, GraphInventoryEdgeLabel label) {
+ protected Relationship buildRelationship(SingleUri uri, GraphInventoryEdgeLabel label) {
return buildRelationship(uri, Optional.of(label));
}
- protected Relationship buildRelationship(GraphInventoryResourceUri uri, Optional<GraphInventoryEdgeLabel> label) {
+ protected Relationship buildRelationship(SingleUri uri, Optional<GraphInventoryEdgeLabel> label) {
final Relationship result = new Relationship();
- result.setRelatedLink(uri.build().toString());
+ if (uri instanceof HttpAwareUri) {
+ result.setRelatedLink(((HttpAwareUri) uri).locateAndBuild().toString());
+ } else {
+ result.setRelatedLink(uri.build().toString());
+ }
if (label.isPresent()) {
result.setRelationshipLabel(label.get().toString());
}
@@ -300,6 +395,8 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven
public abstract Wrapper createWrapper(String json);
+ public abstract Wrapper createWrapper(Object json);
+
/**
* Starts a transaction which encloses multiple GraphInventory mutations
*
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
index 45ac1f741d..3469d73599 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java
@@ -29,11 +29,12 @@ import javax.ws.rs.core.GenericType;
import org.onap.aai.domain.yang.Relationship;
import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri;
import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel> {
+public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInventoryResourceUri<?, ?>, SingleUri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, EdgeLabel extends GraphInventoryEdgeLabel> {
protected static Logger logger = LoggerFactory.getLogger(GraphInventoryTransactionClient.class);
@@ -50,7 +51,7 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uri
* @return
*/
- public Self create(Uri uri, Object obj) {
+ public Self create(SingleUri uri, Object obj) {
this.put(uri.build().toString(), obj);
incrementActionAmount();
return (Self) this;
@@ -62,7 +63,7 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uri
* @return
*/
- public Self createEmpty(Uri uri) {
+ public Self createEmpty(SingleUri uri) {
this.put(uri.build().toString(), new HashMap<String, String>());
incrementActionAmount();
return (Self) this;
@@ -75,8 +76,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uri
* @return
*/
- public Self createIfNotExists(Uri uri, Optional<Object> obj) {
- if (!this.exists(uri)) {
+ public Self createIfNotExists(SingleUri uri, Optional<Object> obj) {
+ if (!this.exists((Uri) uri)) {
if (obj.isPresent()) {
this.create(uri, obj.get());
} else {
@@ -94,8 +95,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uriB
* @return
*/
- public Self connect(Uri uriA, Uri uriB) {
- GraphInventoryResourceUri uriAClone = uriA.clone();
+ public Self connect(SingleUri uriA, SingleUri uriB) {
+ GraphInventorySingleResourceUri uriAClone = uriA.clone();
this.put(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB));
incrementActionAmount();
return (Self) this;
@@ -108,8 +109,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uris
* @return
*/
- public Self connect(Uri uriA, List<Uri> uris) {
- for (Uri uri : uris) {
+ public Self connect(SingleUri uriA, List<SingleUri> uris) {
+ for (SingleUri uri : uris) {
this.connect(uriA, uri);
}
return (Self) this;
@@ -122,8 +123,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uris
* @return
*/
- public Self connect(Uri uriA, Uri uriB, EdgeLabel label) {
- GraphInventoryResourceUri uriAClone = uriA.clone();
+ public Self connect(SingleUri uriA, SingleUri uriB, EdgeLabel label) {
+ GraphInventorySingleResourceUri uriAClone = uriA.clone();
this.put(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB, label));
return (Self) this;
}
@@ -135,8 +136,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uris
* @return
*/
- public Self connect(Uri uriA, List<Uri> uris, EdgeLabel label) {
- for (Uri uri : uris) {
+ public Self connect(SingleUri uriA, List<SingleUri> uris, EdgeLabel label) {
+ for (SingleUri uri : uris) {
this.connect(uriA, uri, label);
}
return (Self) this;
@@ -149,8 +150,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uriB
* @return
*/
- public Self disconnect(Uri uriA, Uri uriB) {
- GraphInventoryResourceUri uriAClone = uriA.clone();
+ public Self disconnect(SingleUri uriA, SingleUri uriB) {
+ GraphInventorySingleResourceUri uriAClone = uriA.clone();
this.delete(uriAClone.relationshipAPI().build().toString(), this.buildRelationship(uriB));
incrementActionAmount();
return (Self) this;
@@ -163,8 +164,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uris
* @return
*/
- public Self disconnect(Uri uriA, List<Uri> uris) {
- for (Uri uri : uris) {
+ public Self disconnect(SingleUri uriA, List<SingleUri> uris) {
+ for (SingleUri uri : uris) {
this.disconnect(uriA, uri);
}
return (Self) this;
@@ -176,8 +177,8 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
* @param uri
* @return
*/
- public Self delete(Uri uri) {
- Map<String, Object> result = this.get(new GenericType<Map<String, Object>>() {}, (Uri) uri.clone())
+ public Self delete(SingleUri uri) {
+ Map<String, Object> result = this.get(new GenericType<Map<String, Object>>() {}, (Uri) uri)
.orElseThrow(() -> new NotFoundException(uri.build() + " does not exist in " + this.getGraphDBName()));
String resourceVersion = (String) result.get("resource-version");
this.delete(uri.resourceVersion(resourceVersion).build().toString());
@@ -223,15 +224,15 @@ public abstract class GraphInventoryTransactionClient<Self, Uri extends GraphInv
*/
public abstract void execute() throws BulkProcessFailed;
- private Relationship buildRelationship(Uri uri) {
+ private Relationship buildRelationship(SingleUri uri) {
return buildRelationship(uri, Optional.empty());
}
- private Relationship buildRelationship(Uri uri, EdgeLabel label) {
+ private Relationship buildRelationship(SingleUri uri, EdgeLabel label) {
return buildRelationship(uri, Optional.of(label));
}
- private Relationship buildRelationship(Uri uri, Optional<EdgeLabel> label) {
+ private Relationship buildRelationship(SingleUri uri, Optional<EdgeLabel> label) {
final Relationship result = new Relationship();
result.setRelatedLink(uri.build().toString());
if (label.isPresent()) {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java
index 6703416832..6e7b9c9f08 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java
@@ -30,12 +30,12 @@ import java.util.function.Predicate;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.client.graphinventory.GraphInventoryObjectName;
import org.onap.so.client.graphinventory.GraphInventoryObjectType;
-import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri;
+import org.onap.so.client.graphinventory.entities.uri.GraphInventorySingleResourceUri;
import org.onap.so.jsonpath.JsonPathUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-public abstract class GraphInventoryRelationships<Wrapper extends GraphInventoryResultWrapper, Uri extends GraphInventoryResourceUri, Type extends GraphInventoryObjectType> {
+public abstract class GraphInventoryRelationships<Wrapper extends GraphInventoryResultWrapper<?>, Uri extends GraphInventorySingleResourceUri<?, ?, ?, ?>, Type extends GraphInventoryObjectType> {
protected final ObjectMapper mapper;
protected Map<String, Object> map;
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java
new file mode 100644
index 0000000000..aa09702be8
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryPluralResourceUri.java
@@ -0,0 +1,8 @@
+package org.onap.so.client.graphinventory.entities.uri;
+
+import org.onap.so.client.graphinventory.GraphInventoryObjectBase;
+
+public interface GraphInventoryPluralResourceUri<T extends GraphInventoryResourceUri<?, ?>, OT extends GraphInventoryObjectBase>
+ extends GraphInventoryResourceUri<T, OT> {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java
index c579a285d2..64933863d5 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryResourceUri.java
@@ -21,42 +21,11 @@
package org.onap.so.client.graphinventory.entities.uri;
import org.onap.so.client.graphinventory.Format;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
-import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
-import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+import org.onap.so.client.graphinventory.GraphInventoryObjectBase;
-public interface GraphInventoryResourceUri extends GraphInventoryUri {
- public GraphInventoryResourceUri relationshipAPI();
+public interface GraphInventoryResourceUri<T extends GraphInventoryResourceUri<?, ?>, OT extends GraphInventoryObjectBase>
+ extends GraphInventoryUri<T, OT> {
- public GraphInventoryResourceUri relatedTo(GraphInventoryObjectPlurals plural);
+ public T format(Format format);
- public GraphInventoryResourceUri relatedTo(GraphInventoryObjectType type, String... values);
-
- public GraphInventoryResourceUri resourceVersion(String version);
-
- public GraphInventoryResourceUri format(Format format);
-
- @Override
- public GraphInventoryResourceUri depth(Depth depth);
-
- @Override
- public GraphInventoryResourceUri nodesOnly(boolean nodesOnly);
-
- @Override
- public GraphInventoryResourceUri queryParam(String name, String... values);
-
- @Override
- public GraphInventoryResourceUri replaceQueryParam(String name, String... values);
-
- @Override
- public GraphInventoryResourceUri resultIndex(int index);
-
- @Override
- public GraphInventoryResourceUri resultSize(int size);
-
- @Override
- public GraphInventoryResourceUri limit(int size);
-
- @Override
- public GraphInventoryResourceUri clone();
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java
new file mode 100644
index 0000000000..e45ff14a5e
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventorySingleResourceUri.java
@@ -0,0 +1,16 @@
+package org.onap.so.client.graphinventory.entities.uri;
+
+import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+
+public interface GraphInventorySingleResourceUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?>, P extends GraphInventoryPluralResourceUri<?, ?>, SingleObject extends GraphInventoryObjectType, PluralObject extends GraphInventoryObjectPlurals>
+ extends GraphInventoryResourceUri<T, SingleObject> {
+
+ public T resourceVersion(String version);
+
+ public T relationshipAPI();
+
+ public P relatedTo(PluralObject plural);
+
+ public T relatedTo(SingleObject type, String... values);
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java
index 6b48ad44ef..e3fda2fa23 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java
@@ -20,11 +20,15 @@
package org.onap.so.client.graphinventory.entities.uri;
+import java.io.Serializable;
import java.net.URI;
import java.util.Map;
+import java.util.regex.Pattern;
+import org.onap.so.client.graphinventory.GraphInventoryObjectBase;
import org.onap.so.client.graphinventory.GraphInventoryObjectType;
-public interface GraphInventoryUri {
+public interface GraphInventoryUri<T extends GraphInventoryUri<?, ?>, OT extends GraphInventoryObjectBase>
+ extends Serializable {
public URI build();
@@ -39,26 +43,26 @@ public interface GraphInventoryUri {
* @param depth
* @return
*/
- public GraphInventoryUri depth(Depth depth);
+ public T depth(Depth depth);
/**
* Makes client only return object fields, no relationships
*
* @return
*/
- public GraphInventoryUri nodesOnly(boolean nodesOnly);
+ public T nodesOnly(boolean nodesOnly);
- public GraphInventoryUri queryParam(String name, String... values);
+ public T queryParam(String name, String... values);
- public GraphInventoryUri replaceQueryParam(String name, String... values);
+ public T replaceQueryParam(String name, String... values);
- public GraphInventoryUri resultIndex(int index);
+ public T resultIndex(int index);
- public GraphInventoryUri resultSize(int size);
+ public T resultSize(int size);
- public GraphInventoryUri limit(int size);
+ public T limit(int size);
- public GraphInventoryUri clone();
+ public T clone();
/**
* returns all key values of the URI as a map. Key names can be found in {@link GraphInventoryObjectType}
@@ -67,9 +71,11 @@ public interface GraphInventoryUri {
*/
public Map<String, String> getURIKeys();
- public GraphInventoryObjectType getObjectType();
+ public OT getObjectType();
public boolean equals(Object o);
public int hashCode();
+
+ public Pattern getPrefixPattern();
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java
index fcfde74b33..1ee3d57b6c 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java
@@ -21,9 +21,12 @@
package org.onap.so.client.graphinventory.entities.uri;
import java.net.URI;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-public interface HttpAwareUri {
+public interface HttpAwareUri extends AAIResourceUri {
public URI buildNoNetwork();
+
+ public URI locateAndBuild();
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleBaseUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleBaseUri.java
new file mode 100644
index 0000000000..fc1a008466
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleBaseUri.java
@@ -0,0 +1,237 @@
+package org.onap.so.client.graphinventory.entities.uri;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.URI;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import javax.ws.rs.core.UriBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.graphinventory.GraphInventoryObjectBase;
+import org.onap.so.client.graphinventory.entities.uri.parsers.UriParser;
+import org.onap.so.client.graphinventory.entities.uri.parsers.UriParserSpringImpl;
+import org.onap.so.client.graphinventory.exceptions.IncorrectNumberOfUriKeys;
+import org.springframework.web.util.UriUtils;
+
+public abstract class SimpleBaseUri<T extends GraphInventoryResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?>, S extends GraphInventoryObjectBase>
+ implements GraphInventoryResourceUri<T, S> {
+
+ private static final long serialVersionUID = -1011069933894179423L;
+ protected transient UriBuilder internalURI;
+ protected static final String relationshipAPI = "/relationship-list/relationship";
+ protected static final String relatedTo = "/related-to";
+ protected Object[] values;
+ protected final S type;
+ protected final Parent parentUri;
+ protected final Map<String, Set<String>> queryParams = new HashMap<>();
+
+ protected SimpleBaseUri(S type, Object... values) {
+ this.type = type;
+ this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
+ this.values = values;
+ this.parentUri = null;
+ validateValuesSize(this.getTemplate(type), values);
+ }
+
+ protected SimpleBaseUri(S type, URI uri) {
+ if (!type.passThrough()) {
+ this.type = type;
+ this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
+ this.values =
+ this.getURIKeys(uri.getRawPath().replaceAll(getPrefixPattern().toString(), "")).values().toArray();
+ this.parentUri = null;
+ } else {
+ this.type = type;
+ this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll(getPrefixPattern().toString(), ""));
+ this.values = new Object[0];
+ this.parentUri = null;
+ }
+
+ }
+
+ protected SimpleBaseUri(S type, UriBuilder builder, Object... values) {
+ this.internalURI = builder;
+ this.values = values;
+ this.type = type;
+ this.parentUri = null;
+
+ }
+
+ protected SimpleBaseUri(Parent parentUri, S childType, Object... childValues) {
+ this.type = childType;
+ this.internalURI = UriBuilder.fromUri(type.partialUri());
+ this.values = childValues;
+ this.parentUri = parentUri;
+
+ validateValuesSize(childType.partialUri(), values);
+ }
+
+ protected SimpleBaseUri(SimpleBaseUri<T, Parent, S> copy) {
+ this.type = copy.type;
+ this.internalURI = copy.internalURI.clone();
+ this.values = copy.values.clone();
+ if (copy.parentUri != null) {
+ this.parentUri = (Parent) copy.parentUri.clone();
+ } else {
+ this.parentUri = null;
+ }
+ }
+
+ protected void setInternalURI(UriBuilder builder) {
+ this.internalURI = builder;
+ }
+
+ @Override
+ public T queryParam(String name, String... values) {
+ this.internalURI = internalURI.queryParam(name, values);
+ if (queryParams.containsKey(name)) {
+ queryParams.get(name).addAll(Arrays.asList(values));
+ } else {
+ queryParams.put(name, Stream.of(values).collect(Collectors.toSet()));
+ }
+ return (T) this;
+ }
+
+ @Override
+ public T replaceQueryParam(String name, String... values) {
+ this.internalURI = internalURI.replaceQueryParam(name, values);
+ queryParams.put(name, Stream.of(values).collect(Collectors.toSet()));
+ return (T) this;
+ }
+
+ @Override
+ public T resultIndex(int index) {
+ this.internalURI = internalURI.replaceQueryParam("resultIndex", index);
+ return (T) this;
+ }
+
+ @Override
+ public T resultSize(int size) {
+ this.internalURI = internalURI.replaceQueryParam("resultSize", size);
+ return (T) this;
+ }
+
+ @Override
+ public T limit(int size) {
+ this.resultIndex(0).resultSize(size);
+ return (T) this;
+ }
+
+ @Override
+ public URI build() {
+ return build(this.values);
+ }
+
+ protected URI build(Object... values) {
+
+ // This is a workaround because resteasy does not encode URIs correctly
+ final String[] encoded = new String[values.length];
+ for (int i = 0; i < values.length; i++) {
+ encoded[i] = UriUtils.encode(values[i].toString(), StandardCharsets.UTF_8.toString());
+ }
+ if (this.parentUri != null) {
+ return UriBuilder
+ .fromUri(this.parentUri.build().toString() + internalURI.buildFromEncoded(encoded).toString())
+ .build();
+ } else {
+ return internalURI.buildFromEncoded(encoded);
+ }
+ }
+
+ @Override
+ public Map<String, String> getURIKeys() {
+ return this.getURIKeys(this.build().toString());
+ }
+
+ protected Map<String, String> getURIKeys(String uri) {
+ UriParser parser;
+ if (!("".equals(this.getTemplate(type)))) {
+ parser = new UriParserSpringImpl(this.getTemplate(type));
+ } else {
+ return new HashMap<>();
+ }
+
+
+ return parser.parse(uri);
+ }
+
+ @Override
+ public abstract T clone();
+
+ @Override
+ public S getObjectType() {
+ return this.type;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o != null) {
+ return this.toString().equals(o.toString());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(this.toString()).toHashCode();
+ }
+
+
+ @Override
+ public T depth(Depth depth) {
+ this.internalURI.replaceQueryParam("depth", depth.toString());
+ return (T) this;
+ }
+
+ @Override
+ public T nodesOnly(boolean nodesOnly) {
+ if (nodesOnly) {
+ this.internalURI.replaceQueryParam("nodes-only", "");
+ }
+ return (T) this;
+ }
+
+ @Override
+ public T format(Format format) {
+ this.internalURI.replaceQueryParam("format", format);
+ return (T) this;
+ }
+
+ public void validateValuesSize(String template, Object... values) {
+ UriParser parser = new UriParserSpringImpl(template);
+ Set<String> variables = parser.getVariables();
+ if (variables.size() != values.length) {
+ throw new IncorrectNumberOfUriKeys(String.format("Expected %s variables: %s", variables.size(), variables));
+ }
+ }
+
+ protected String getTemplate(GraphInventoryObjectBase type) {
+ return type.uriTemplate();
+ }
+
+ private void writeObject(ObjectOutputStream oos) throws IOException {
+ oos.defaultWriteObject();
+ oos.writeUTF(this.internalURI.toTemplate());
+ }
+
+ private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+ ois.defaultReadObject();
+ String uri = ois.readUTF();
+ this.setInternalURI(UriBuilder.fromUri(uri));
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(null, ToStringStyle.NO_CLASS_NAME_STYLE).append("type", type)
+ .append("parentUri", parentUri).append("values", values).append("queryParams", queryParams).toString();
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimplePluralUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimplePluralUri.java
new file mode 100644
index 0000000000..c0b6d573c1
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimplePluralUri.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.so.client.graphinventory.entities.uri;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import javax.ws.rs.core.UriBuilder;
+import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+
+public abstract class SimplePluralUri<T extends GraphInventoryPluralResourceUri<?, ?>, Parent extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PT extends GraphInventoryObjectPlurals, OT extends GraphInventoryObjectType>
+ extends SimpleBaseUri<T, Parent, PT> implements GraphInventoryPluralResourceUri<T, PT>, Serializable {
+
+ private static final long serialVersionUID = -337701171277616439L;
+
+ protected final PT pluralType;
+
+ protected SimplePluralUri(PT type, UriBuilder builder, Object... values) {
+ super(type, builder, values);
+ this.pluralType = type;
+ }
+
+ protected SimplePluralUri(PT type) {
+ super(type, new Object[0]);
+ this.pluralType = type;
+ }
+
+ protected SimplePluralUri(PT type, Object... values) {
+ super(type, values);
+ this.pluralType = type;
+ }
+
+ protected SimplePluralUri(Parent parentUri, PT childType) {
+ super(parentUri, childType, new Object[0]);
+ this.pluralType = childType;
+ }
+
+ public SimplePluralUri(SimplePluralUri<T, Parent, PT, OT> copy) {
+ super(copy);
+ this.pluralType = copy.pluralType;
+ }
+
+ protected void setInternalURI(UriBuilder builder) {
+ this.internalURI = builder;
+ }
+
+ private void writeObject(ObjectOutputStream oos) throws IOException {
+ oos.defaultWriteObject();
+ oos.writeUTF(this.internalURI.toTemplate());
+ }
+
+ private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+ ois.defaultReadObject();
+ String uri = ois.readUTF();
+ this.setInternalURI(UriBuilder.fromUri(uri));
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
index ffe47c5c51..aff7392efe 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
@@ -23,254 +23,50 @@ package org.onap.so.client.graphinventory.entities.uri;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.io.Serializable;
import java.net.URI;
-import java.nio.charset.StandardCharsets;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Pattern;
import javax.ws.rs.core.UriBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.onap.so.client.graphinventory.Format;
import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
import org.onap.so.client.graphinventory.GraphInventoryObjectType;
-import org.onap.so.client.graphinventory.entities.uri.parsers.UriParser;
-import org.onap.so.client.graphinventory.entities.uri.parsers.UriParserSpringImpl;
-import org.onap.so.client.graphinventory.exceptions.IncorrectNumberOfUriKeys;
-import org.springframework.web.util.UriUtils;
-public class SimpleUri implements GraphInventoryResourceUri, Serializable {
+public abstract class SimpleUri<T extends GraphInventorySingleResourceUri<?, ?, ?, ?>, PT extends GraphInventoryPluralResourceUri<?, ?>, S extends GraphInventoryObjectType, P extends GraphInventoryObjectPlurals>
+ extends SimpleBaseUri<T, T, S> implements GraphInventorySingleResourceUri<T, PT, S, P> {
private static final long serialVersionUID = -337701171277616439L;
-
- protected transient UriBuilder internalURI;
protected static final String relationshipAPI = "/relationship-list/relationship";
protected static final String relatedTo = "/related-to";
- protected final Object[] values;
- protected final GraphInventoryObjectType type;
- protected final GraphInventoryObjectPlurals pluralType;
-
- protected SimpleUri(GraphInventoryObjectType type, Object... values) {
- this.type = type;
- this.pluralType = null;
- this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
- this.values = values;
- validateValuesSize(this.getTemplate(type), values);
- }
-
- protected SimpleUri(GraphInventoryObjectType type, URI uri) {
- this.type = type;
- this.pluralType = null;
- this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll(getPrefixPattern().toString(), ""));
- this.values = new Object[0];
- }
- protected SimpleUri(GraphInventoryObjectType type, UriBuilder builder, Object... values) {
- this.internalURI = builder;
- this.values = values;
- this.type = type;
- this.pluralType = null;
+ protected SimpleUri(S type, Object... values) {
+ super(type, values);
}
- protected SimpleUri(GraphInventoryObjectPlurals type, UriBuilder builder, Object... values) {
- this.internalURI = builder;
- this.values = values;
- this.type = null;
- this.pluralType = type;
- }
+ protected SimpleUri(S type, URI uri) {
+ super(type, uri);
- protected SimpleUri(GraphInventoryObjectPlurals type) {
- this.type = null;
- this.pluralType = type;
- this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
- this.values = new Object[0];
}
- protected SimpleUri(GraphInventoryObjectPlurals type, Object... values) {
- this.type = null;
- this.pluralType = type;
- this.internalURI = UriBuilder.fromPath(this.getTemplate(type));
- this.values = values;
- validateValuesSize(this.getTemplate(type), values);
- }
+ protected SimpleUri(S type, UriBuilder builder, Object... values) {
+ super(type, builder, values);
- protected SimpleUri(GraphInventoryResourceUri parentUri, GraphInventoryObjectType childType,
- Object... childValues) {
- this.type = childType;
- this.pluralType = null;
- this.internalURI = UriBuilder.fromUri(parentUri.build()).path(childType.partialUri());
- this.values = childValues;
- validateValuesSize(childType.partialUri(), values);
}
- protected SimpleUri(GraphInventoryResourceUri parentUri, GraphInventoryObjectPlurals childType) {
- this.type = null;
- this.pluralType = childType;
- this.internalURI = UriBuilder.fromUri(parentUri.build()).path(childType.partialUri());
- this.values = new Object[0];
+ protected SimpleUri(T parentUri, S childType, Object... childValues) {
+ super(parentUri, childType, childValues);
}
- protected void setInternalURI(UriBuilder builder) {
- this.internalURI = builder;
+ protected SimpleUri(SimpleBaseUri<T, T, S> copy) {
+ super(copy);
}
@Override
- public SimpleUri relationshipAPI() {
- this.internalURI = internalURI.path(relationshipAPI);
- return this;
- }
-
- @Override
- public SimpleUri relatedTo(GraphInventoryObjectPlurals plural) {
-
- this.internalURI = internalURI.path(relatedTo).path(plural.partialUri());
- return this;
- }
-
- @Override
- public SimpleUri relatedTo(GraphInventoryObjectType type, String... values) {
- this.internalURI =
- internalURI.path(relatedTo).path(UriBuilder.fromPath(type.partialUri()).build(values).toString());
- return this;
- }
-
- @Override
- public SimpleUri resourceVersion(String version) {
+ public T resourceVersion(String version) {
this.internalURI = internalURI.replaceQueryParam("resource-version", version);
- return this;
- }
-
- @Override
- public SimpleUri queryParam(String name, String... values) {
- this.internalURI = internalURI.queryParam(name, values);
- return this;
- }
-
- @Override
- public SimpleUri replaceQueryParam(String name, String... values) {
- this.internalURI = internalURI.replaceQueryParam(name, values);
- return this;
- }
-
- @Override
- public SimpleUri resultIndex(int index) {
- this.internalURI = internalURI.replaceQueryParam("resultIndex", index);
- return this;
- }
-
- @Override
- public SimpleUri resultSize(int size) {
- this.internalURI = internalURI.replaceQueryParam("resultSize", size);
- return this;
- }
-
- @Override
- public SimpleUri limit(int size) {
- return this.resultIndex(0).resultSize(size);
- }
-
- @Override
- public URI build() {
- return build(this.values);
- }
-
- protected Pattern getPrefixPattern() {
- return Pattern.compile("/.*?/v\\d+");
- }
-
- protected URI build(Object... values) {
- // This is a workaround because resteasy does not encode URIs correctly
- final String[] encoded = new String[values.length];
- for (int i = 0; i < values.length; i++) {
- encoded[i] = UriUtils.encode(values[i].toString(), StandardCharsets.UTF_8.toString());
- }
- return internalURI.buildFromEncoded(encoded);
- }
-
- @Override
- public Map<String, String> getURIKeys() {
- return this.getURIKeys(this.build().toString());
- }
-
- protected Map<String, String> getURIKeys(String uri) {
- UriParser parser;
- if (this.type != null) {
- if (!("".equals(this.getTemplate(type)))) {
- parser = new UriParserSpringImpl(this.getTemplate(type));
- } else {
- return new HashMap<>();
- }
- } else {
- parser = new UriParserSpringImpl(this.getTemplate(pluralType));
- }
-
-
- return parser.parse(uri);
- }
-
- @Override
- public SimpleUri clone() {
- if (this.type != null) {
- return new SimpleUri(this.type, this.internalURI.clone(), values);
- } else {
- return new SimpleUri(this.pluralType, this.internalURI.clone(), values);
- }
- }
-
- @Override
- public GraphInventoryObjectType getObjectType() {
- return this.type;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof GraphInventoryUri) {
- return this.build().equals(((GraphInventoryUri) o).build());
- }
- return false;
+ return (T) this;
}
@Override
- public int hashCode() {
- return new HashCodeBuilder().append(this.build()).toHashCode();
- }
-
-
- @Override
- public SimpleUri depth(Depth depth) {
- this.internalURI.replaceQueryParam("depth", depth.toString());
- return this;
- }
-
- @Override
- public SimpleUri nodesOnly(boolean nodesOnly) {
- if (nodesOnly) {
- this.internalURI.replaceQueryParam("nodes-only", "");
- }
- return this;
- }
-
- @Override
- public SimpleUri format(Format format) {
- this.internalURI.replaceQueryParam("format", format);
- return this;
- }
-
- public void validateValuesSize(String template, Object... values) {
- UriParser parser = new UriParserSpringImpl(template);
- Set<String> variables = parser.getVariables();
- if (variables.size() != values.length) {
- throw new IncorrectNumberOfUriKeys(String.format("Expected %s variables: %s", variables.size(), variables));
- }
- }
-
- protected String getTemplate(GraphInventoryObjectType type) {
- return type.uriTemplate();
- }
-
- protected String getTemplate(GraphInventoryObjectPlurals type) {
- return type.uriTemplate();
+ public T relationshipAPI() {
+ this.internalURI = internalURI.path(relationshipAPI);
+ return (T) this;
}
private void writeObject(ObjectOutputStream oos) throws IOException {
@@ -283,4 +79,5 @@ public class SimpleUri implements GraphInventoryResourceUri, Serializable {
String uri = ois.readUTF();
this.setInternalURI(UriBuilder.fromUri(uri));
}
+
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java
new file mode 100644
index 0000000000..d3c17ce9e9
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryMultipleItemsException.java
@@ -0,0 +1,13 @@
+package org.onap.so.client.graphinventory.exceptions;
+
+import org.onap.so.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri;
+
+public class GraphInventoryMultipleItemsException extends RuntimeException {
+
+ private static final long serialVersionUID = -1596266941681036917L;
+
+ public GraphInventoryMultipleItemsException(int size, GraphInventoryPluralResourceUri uri) {
+ super(String.format("Found %s objects at %s when we only expected to find one.", size, uri.build()));
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java b/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java
index 641bbb28c7..141352edce 100644
--- a/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java
+++ b/common/src/main/java/org/onap/so/constants/OrchestrationRequestFormat.java
@@ -21,5 +21,5 @@
package org.onap.so.constants;
public enum OrchestrationRequestFormat {
- DETAIL, STATUSDETAIL, SIMPLE
+ DETAIL, STATUSDETAIL, SIMPLE, SIMPLENOTASKINFO
}
diff --git a/common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java b/common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java
index 40acac57aa..725da97d5b 100644
--- a/common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java
+++ b/common/src/main/java/org/onap/so/db/connections/ScheduledDnsLookup.java
@@ -8,11 +8,9 @@ import javax.management.JMX;
import javax.management.MBeanServer;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
-import org.jboss.logging.MDC;
-import org.onap.logging.filter.base.ONAPComponents;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.logger.ErrorCode;
-import org.onap.so.logger.ScheduledTasksMDCSetup;
+import org.onap.logging.filter.base.ErrorCode;
+import org.onap.logging.filter.base.ScheduledLogging;
+import org.onap.logging.filter.base.ScheduledTaskException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,23 +30,16 @@ public class ScheduledDnsLookup {
@Autowired
private DbDnsIpAddress dnsIpAddress;
- @Autowired
- private ScheduledTasksMDCSetup scheduledMDCSetup;
-
private static Logger logger = LoggerFactory.getLogger(ScheduledDnsLookup.class);
+ @ScheduledLogging
@Scheduled(fixedRate = 15000)
- public void performDnsLookup() {
- scheduledMDCSetup.mdcSetup(ONAPComponents.SO, "performDnsLookup");
+ public void performDnsLookup() throws ScheduledTaskException {
String dnsUrl = System.getenv(DB_HOST);
-
try {
if (dnsUrl == null) {
- scheduledMDCSetup.errorMDCSetup(ErrorCode.DataError, "Database DNS is not provided.");
- logger.error("Database DNS is not provided. Please verify the configuration");
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString());
- scheduledMDCSetup.exitAndClearMDC();
- return;
+ throw new ScheduledTaskException(ErrorCode.DataError,
+ "Database DNS is not provided. Please verify the configuration");
}
InetAddress inetAddress = java.net.InetAddress.getByName(dnsUrl);
@@ -57,7 +48,6 @@ public class ScheduledDnsLookup {
/* This is in initial state */
if (currentIpAddress == null) {
dnsIpAddress.setIpAddress(ipAddress);
- scheduledMDCSetup.exitAndClearMDC();
return;
}
@@ -69,7 +59,6 @@ public class ScheduledDnsLookup {
} catch (UnknownHostException e) {
logger.warn("Database DNS %s is not resolvable to an IP Address", dnsUrl);
}
- scheduledMDCSetup.exitAndClearMDC();
}
private void softEvictConnectionPool() {
diff --git a/common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java b/common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java
deleted file mode 100644
index 41c4b4bfae..0000000000
--- a/common/src/main/java/org/onap/so/logger/ScheduledTasksMDCSetup.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2019 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.onap.so.logger;
-
-import java.util.UUID;
-import org.onap.logging.filter.base.Constants;
-import org.onap.logging.filter.base.MDCSetup;
-import org.onap.logging.filter.base.ONAPComponentsList;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.slf4j.MDC;
-import org.springframework.stereotype.Component;
-
-@Component
-public class ScheduledTasksMDCSetup extends MDCSetup {
-
- public void mdcSetup(ONAPComponentsList targetEntity, String serviceName) {
- try {
- setEntryTimeStamp();
- setServerFQDN();
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, UUID.randomUUID().toString());
- MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, targetEntity.toString());
- MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, Constants.DefaultValues.UNKNOWN);
- MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, serviceName);
- setLogTimestamp();
- setElapsedTime();
- MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, getProperty(Constants.Property.PARTNER_NAME));
- logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
- } catch (Exception e) {
- logger.warn("Error in ScheduledTasksMDCSetup mdcSetup: {}", e.getMessage());
- }
- }
-
- public void errorMDCSetup(ErrorCode errorCode, String errorDescription) {
- MDC.put(ONAPLogConstants.MDCs.ERROR_CODE, String.valueOf(errorCode.getValue()));
- MDC.put(ONAPLogConstants.MDCs.ERROR_DESC, errorDescription);
- }
-
- public void exitAndClearMDC() {
- try {
- setStatusCode();
- setLogTimestamp();
- setElapsedTime();
- logger.info(ONAPLogConstants.Markers.EXIT, "Exiting.");
- } catch (Exception e) {
- logger.warn("Error in ScheduledTasksMDCSetup clear MDC: {}", e.getMessage());
- }
- MDC.clear();
- }
-
- public void setStatusCode() {
- String currentStatusCode = MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE);
- if (currentStatusCode == null || !currentStatusCode.equals(ONAPLogConstants.ResponseStatus.ERROR.toString())) {
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.COMPLETE.toString());
- }
- }
-}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java
index 5ae1082464..3e85cc5ec6 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java
@@ -3,6 +3,7 @@ package org.onap.so.logging.jaxrs.filter;
import javax.annotation.Priority;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
+import javax.ws.rs.container.PreMatching;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.logger.HttpHeadersConstants;
import org.onap.so.logger.LogConstants;
@@ -11,6 +12,7 @@ import org.springframework.stereotype.Component;
import org.onap.logging.filter.base.AuditLogContainerFilter;
@Priority(1)
+@PreMatching
@Component
public class SOAuditLogContainerFilter extends AuditLogContainerFilter {
@@ -26,9 +28,4 @@ public class SOAuditLogContainerFilter extends AuditLogContainerFilter {
}
MDC.put(LogConstants.URI_BASE, request.getUriInfo().getBaseUri().toString());
}
-
- @Override
- protected void additionalPostHandling(ContainerResponseContext response) {
- // override to add additional post handling
- }
}
diff --git a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java
index 69046a2eba..4434dce4e3 100644
--- a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java
+++ b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProvider.java
@@ -21,6 +21,7 @@
package org.onap.so.rest.service;
import com.google.common.base.Optional;
+import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
/**
@@ -39,6 +40,16 @@ public interface HttpRestServiceProvider {
/**
* Execute the HTTP GET to the given URI template
+ *
+ * @param url the URL
+ * @param headers request headers
+ * @param clazz the type of the return value
+ * @return Returns the body of this entity.
+ */
+ <T> Optional<T> get(final String url, final HttpHeaders headers, final Class<T> clazz);
+
+ /**
+ * Execute the HTTP GET to the given URI template
*
* @param url the URL
* @param clazz the type of the return value
@@ -46,6 +57,15 @@ public interface HttpRestServiceProvider {
*/
<T> ResponseEntity<T> getHttpResponse(final String url, final Class<T> clazz);
+ /**
+ * Execute the HTTP GET to the given URI template
+ *
+ * @param url the URL
+ * @param headers request headers
+ * @param clazz the type of the return value
+ * @return Returns the {@link ResponseEntity}.
+ */
+ <T> ResponseEntity<T> getHttpResponse(final String url, final HttpHeaders headers, final Class<T> clazz);
/**
* Execute the HTTP POST to the given URI template
@@ -68,6 +88,18 @@ public interface HttpRestServiceProvider {
<T> ResponseEntity<T> postHttpRequest(final Object object, final String url, final Class<T> clazz);
/**
+ * Execute the HTTP POST to the given URI template
+ *
+ * @param object the entity (i.e. body) to write to the request
+ * @param url the URL
+ * @param clazz the type of the return value
+ * @param headers request headers
+ * @return Returns the {@link ResponseEntity}.
+ */
+ <T> ResponseEntity<T> postHttpRequest(final Object object, final String url, final HttpHeaders headers,
+ final Class<T> clazz);
+
+ /**
* Execute the HTTP PUT to the given URI template
*
* @param object the entity (i.e. body) to write to the request
diff --git a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
index b82d73bbbf..04dd0bbb7a 100644
--- a/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
+++ b/common/src/main/java/org/onap/so/rest/service/HttpRestServiceProviderImpl.java
@@ -20,8 +20,6 @@
package org.onap.so.rest.service;
-import com.google.common.base.Optional;
-import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.configuration.rest.HttpHeadersProvider;
import org.onap.so.rest.exceptions.HttpResouceNotFoundException;
import org.onap.so.rest.exceptions.InvalidRestRequestException;
@@ -36,6 +34,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
+import com.google.common.base.Optional;
/**
* A Service to perform HTTP requests
@@ -46,16 +45,27 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(HttpRestServiceProviderImpl.class);
private final RestTemplate restTemplate;
- private final HttpHeadersProvider httpHeadersProvider;
+ private final HttpHeaders defaultHttpHeaders;
public HttpRestServiceProviderImpl(final RestTemplate restTemplate) {
this.restTemplate = restTemplate;
- this.httpHeadersProvider = new BasicHttpHeadersProvider();
+ this.defaultHttpHeaders = new HttpHeaders();
}
+ public HttpRestServiceProviderImpl(final RestTemplate restTemplate, final HttpHeaders defaultHttpHeaders) {
+ this.restTemplate = restTemplate;
+ this.defaultHttpHeaders = defaultHttpHeaders;
+ }
+
+ /**
+ *
+ * @deprecated this constructor is deprecated in favor of using {@link HttpRestServiceProviderImpl(RestTemplate
+ * restTemplate, HttpHeaders defaultHttpHeaders)}
+ */
+ @Deprecated
public HttpRestServiceProviderImpl(final RestTemplate restTemplate, final HttpHeadersProvider httpHeadersProvider) {
this.restTemplate = restTemplate;
- this.httpHeadersProvider = httpHeadersProvider;
+ this.defaultHttpHeaders = httpHeadersProvider.getHttpHeaders();
}
@Override
@@ -64,10 +74,21 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
return createOptional(response, url, HttpMethod.GET);
}
+ @Override
+ public <T> Optional<T> get(final String url, final HttpHeaders headers, final Class<T> clazz) {
+ final ResponseEntity<T> response = invokeHttpRequest(new HttpEntity<>(headers), HttpMethod.GET, url, clazz);
+ return createOptional(response, url, HttpMethod.GET);
+ }
@Override
public <T> ResponseEntity<T> getHttpResponse(final String url, final Class<T> clazz) {
- final HttpEntity<?> request = new HttpEntity<>(getHttpHeaders());
+ final HttpEntity<?> request = new HttpEntity<>(getDefaultHttpHeaders());
+ return invokeHttpRequest(request, HttpMethod.GET, url, clazz);
+ }
+
+ @Override
+ public <T> ResponseEntity<T> getHttpResponse(final String url, final HttpHeaders headers, final Class<T> clazz) {
+ final HttpEntity<?> request = new HttpEntity<>(headers);
return invokeHttpRequest(request, HttpMethod.GET, url, clazz);
}
@@ -79,7 +100,14 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
@Override
public <T> ResponseEntity<T> postHttpRequest(final Object object, final String url, final Class<T> clazz) {
- final HttpEntity<?> request = new HttpEntity<>(object, getHttpHeaders());
+ final HttpEntity<?> request = new HttpEntity<>(object, getDefaultHttpHeaders());
+ return invokeHttpRequest(request, HttpMethod.POST, url, clazz);
+ }
+
+ @Override
+ public <T> ResponseEntity<T> postHttpRequest(final Object object, final String url, final HttpHeaders headers,
+ final Class<T> clazz) {
+ final HttpEntity<?> request = new HttpEntity<>(object, headers);
return invokeHttpRequest(request, HttpMethod.POST, url, clazz);
}
@@ -91,7 +119,7 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
@Override
public <T> ResponseEntity<T> putHttpRequest(final Object object, final String url, final Class<T> clazz) {
- final HttpEntity<?> request = new HttpEntity<>(object, getHttpHeaders());
+ final HttpEntity<?> request = new HttpEntity<>(object, getDefaultHttpHeaders());
return invokeHttpRequest(request, HttpMethod.PUT, url, clazz);
}
@@ -140,9 +168,21 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
@Override
public <T> ResponseEntity<T> deleteHttpRequest(final String url, final Class<T> clazz) {
try {
- final HttpEntity<?> request = new HttpEntity<>(getHttpHeaders());
+ final HttpEntity<?> request = new HttpEntity<>(getDefaultHttpHeaders());
return restTemplate.exchange(url, HttpMethod.DELETE, request, clazz);
+ } catch (final HttpStatusCodeException httpStatusCodeException) {
+ final String message = "Unable to invoke HTTP " + HttpMethod.DELETE + " using url: " + url + ", Response: "
+ + httpStatusCodeException.getRawStatusCode();
+ LOGGER.error(message, httpStatusCodeException);
+ final int rawStatusCode = httpStatusCodeException.getRawStatusCode();
+ if (rawStatusCode == HttpStatus.BAD_REQUEST.value()) {
+ throw new InvalidRestRequestException("No result found for given url: " + url);
+ } else if (rawStatusCode == HttpStatus.NOT_FOUND.value()) {
+ throw new HttpResouceNotFoundException("No result found for given url: " + url);
+ }
+ throw new RestProcessingException("Unable to invoke HTTP " + HttpMethod.DELETE + " using URL: " + url,
+ httpStatusCodeException, rawStatusCode);
} catch (final RestClientException restClientException) {
LOGGER.error("Unable to invoke HTTP DELETE using url: " + url, restClientException);
throw new InvalidRestRequestException("Unable to invoke HTTP DELETE using URL: " + url,
@@ -150,7 +190,7 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
}
}
- private HttpHeaders getHttpHeaders() {
- return httpHeadersProvider.getHttpHeaders();
+ private HttpHeaders getDefaultHttpHeaders() {
+ return defaultHttpHeaders;
}
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java
index 4a284b55ec..777dcc6171 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudConfiguration.java
@@ -37,6 +37,8 @@ public class CloudConfiguration implements Serializable {
protected String aicNodeClli;
@JsonProperty("tenantId")
protected String tenantId;
+ @JsonProperty("tenantName")
+ protected String tenantName;
@JsonProperty("cloudOwner")
protected String cloudOwner = Defaults.CLOUD_OWNER.toString();
@JsonProperty("lcpCloudRegionId")
@@ -82,6 +84,13 @@ public class CloudConfiguration implements Serializable {
this.tenantId = value;
}
+ public String getTenantName() {
+ return tenantName;
+ }
+
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
public String getLcpCloudRegionId() {
return lcpCloudRegionId;
@@ -102,7 +111,8 @@ public class CloudConfiguration implements Serializable {
@Override
public String toString() {
return new ToStringBuilder(this).append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId())
- .append("cloudOwner", getCloudOwner()).append("lcpCloudRegionId", getLcpCloudRegionId()).toString();
+ .append("tenantName", getTenantName()).append("cloudOwner", getCloudOwner())
+ .append("lcpCloudRegionId", getLcpCloudRegionId()).toString();
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java
index 250c5df5ce..026db1e644 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestInfo.java
@@ -43,6 +43,8 @@ public class RequestInfo implements Serializable {
protected String orderNumber;
@JsonProperty("productFamilyId")
protected String productFamilyId;
+ @JsonProperty("productFamilyName")
+ protected String productFamilyName;
@JsonProperty("orderVersion")
protected Integer orderVersion;
@JsonSerialize(include = Inclusion.ALWAYS)
@@ -180,6 +182,14 @@ public class RequestInfo implements Serializable {
public void setProductFamilyId(String productFamilyId) {
this.productFamilyId = productFamilyId;
+ };
+
+ public String getProductFamilyName() {
+ return productFamilyName;
+ }
+
+ public void setProductFamilyName(String productFamilyName) {
+ this.productFamilyName = productFamilyName;
}
/**
@@ -215,9 +225,9 @@ public class RequestInfo implements Serializable {
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 + ", applicationId="
- + applicationId + "]";
+ + ", productFamilyName=" + productFamilyName + ", orderVersion=" + orderVersion + ", source=" + source
+ + ", instanceName=" + instanceName + ", suppressRollback=" + suppressRollback + ", requestorId="
+ + requestorId + ", applicationId=" + applicationId + "]";
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
index 3ada984b58..f39aa3656a 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestStatus.java
+++ b/common/src/main/java/org/onap/so/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.
@@ -32,6 +32,8 @@ public class RequestStatus {
protected String requestState;
@JsonProperty("statusMessage")
protected String statusMessage;
+ @JsonProperty("resourceStatusMessage")
+ protected String resourceStatusMessage;
@JsonProperty("percentProgress")
protected Integer percentProgress;
@JsonProperty("timestamp")
@@ -95,6 +97,14 @@ public class RequestStatus {
this.statusMessage = statusMessage;
}
+ public String getResourceStatusMessage() {
+ return resourceStatusMessage;
+ }
+
+ public void setResourceStatusMessage(String resourceStatusMessage) {
+ this.resourceStatusMessage = resourceStatusMessage;
+ }
+
public Integer getPercentProgress() {
return percentProgress;
}
@@ -122,8 +132,8 @@ public class RequestStatus {
@Override
public String toString() {
return new ToStringBuilder(this).append("requestState", requestState).append("statusMessage", statusMessage)
- .append("percentProgress", percentProgress).append("timestamp", timeStamp)
- .append("extSystemErrorSource", extSystemErrorSource)
+ .append("resourceStatusMessage", resourceStatusMessage).append("percentProgress", percentProgress)
+ .append("timestamp", timeStamp).append("extSystemErrorSource", extSystemErrorSource)
.append("rollbackExtSystemErrorSource", rollbackExtSystemErrorSource).append("flowStatus", flowStatus)
.append("retryStatusMessage", retryStatusMessage).append("rollbackStatusMessage", rollbackStatusMessage)
.toString();
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java
index 5bcdcb181b..05e69b7b19 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ServiceInstancesRequest.java
@@ -32,8 +32,8 @@ public class ServiceInstancesRequest implements Serializable {
private String serviceInstanceId;
@JsonProperty("vnfInstanceId")
private String vnfInstanceId;
- @JsonProperty("pnfId")
- private String pnfId;
+ @JsonProperty("pnfName")
+ private String pnfName;
@JsonProperty("networkInstanceId")
private String networkInstanceId;
@JsonProperty("volumeGroupInstanceId")
@@ -69,12 +69,12 @@ public class ServiceInstancesRequest implements Serializable {
this.vnfInstanceId = vnfInstanceId;
}
- public String getPnfId() {
- return pnfId;
+ public String getPnfName() {
+ return pnfName;
}
- public void setPnfId(String pnfId) {
- this.pnfId = pnfId;
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
}
public String getNetworkInstanceId() {
@@ -123,7 +123,7 @@ public class ServiceInstancesRequest implements Serializable {
sb.append("requestDetails=").append(requestDetails);
sb.append(", serviceInstanceId='").append(serviceInstanceId).append('\'');
sb.append(", vnfInstanceId='").append(vnfInstanceId).append('\'');
- sb.append(", pnfId='").append(pnfId).append('\'');
+ sb.append(", pnfName='").append(pnfName).append('\'');
sb.append(", networkInstanceId='").append(networkInstanceId).append('\'');
sb.append(", volumeGroupInstanceId='").append(volumeGroupInstanceId).append('\'');
sb.append(", vfModuleInstanceId='").append(vfModuleInstanceId).append('\'');
diff --git a/common/src/main/java/org/onap/so/utils/CryptoUtils.java b/common/src/main/java/org/onap/so/utils/CryptoUtils.java
index 1c38dfb774..eecee4c83f 100644
--- a/common/src/main/java/org/onap/so/utils/CryptoUtils.java
+++ b/common/src/main/java/org/onap/so/utils/CryptoUtils.java
@@ -24,7 +24,7 @@ package org.onap.so.utils;
import org.onap.so.logger.LoggingAnchor;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
index 4f13cec8f4..035ad1dc81 100644
--- a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
+++ b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
@@ -6,6 +6,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.camunda.bpm.client.ExternalTaskClient;
import org.camunda.bpm.client.interceptor.ClientRequestInterceptor;
import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider;
+import org.onap.logging.filter.base.ScheduledLogging;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -53,6 +54,7 @@ public class ExternalTaskServiceUtils {
return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "3"));
}
+ @ScheduledLogging
@Scheduled(fixedDelay = 30000)
public void checkAllClientsActive() {
getClients().stream().filter(client -> !client.isActive()).forEach(ExternalTaskClient::start);
diff --git a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
index 0ff3ccfa9c..3ae644be6b 100644
--- a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
+++ b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java
@@ -34,7 +34,7 @@ import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.sax.SAXSource;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.exceptions.MarshallerException;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java b/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
index 8f449c21f3..20a6678386 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
@@ -22,7 +22,7 @@ package org.onap.so.client.aai;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.onap.so.client.aai.entities.uri.AAIUri;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
public class AAIObjectTypeTest {
@@ -56,14 +56,14 @@ public class AAIObjectTypeTest {
@Test
public void instanceGroupObjectTypeTest() {
final String id = "test1";
- AAIUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, id);
+ AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, id);
assertEquals("/network/instance-groups/instance-group/test1", aaiUri.build().toString());
}
@Test
public void collectionObjectTypeTest() {
final String id = "test1";
- AAIUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, id);
+ AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, id);
assertEquals("/network/collections/collection/test1", aaiUri.build().toString());
}
@@ -85,7 +85,7 @@ public class AAIObjectTypeTest {
@Test
public void networkPolicyObjectTypeTest() {
final String id = "test1";
- AAIUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, id);
+ AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, id);
assertEquals("/network/network-policies/network-policy/test1", aaiUri.build().toString());
}
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
index 5b2bff277d..c70f16eb83 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
@@ -48,7 +48,6 @@ import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.CustomQuery;
import org.onap.so.client.aai.entities.Results;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.Format;
import org.onap.so.client.graphinventory.GraphInventoryClient;
@@ -83,10 +82,10 @@ public class AAIQueryClientTest {
Format format = Format.SIMPLE;
CustomQuery query = new CustomQuery(uris);
- doReturn(restClient).when(client).createClient(isA(AAIUri.class));
+ doReturn(restClient).when(client).createClient(isA(AAIResourceUri.class));
aaiQueryClient.query(format, query);
- verify(client, times(1)).createClient(
- AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).queryParam("format", format.toString()));
+ verify(client, times(1))
+ .createClient(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).format(format));
verify(restClient, times(1)).put(query, String.class);
}
@@ -99,7 +98,7 @@ public class AAIQueryClientTest {
aaiQueryClient.nodesOnly();
aaiQueryClient.subgraph(subgraph);
- AAIUri aaiUri = spy(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY));
+ AAIResourceUri aaiUri = spy(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY));
doReturn(aaiUri).when(aaiUri).clone();
aaiQueryClient.setupQueryParams(aaiUri);
@@ -133,7 +132,7 @@ public class AAIQueryClientTest {
@Test
public void querySingleTypeTest() throws IOException {
- when(client.createClient(isA(AAIUri.class))).thenReturn(restClient);
+ when(client.createClient(isA(AAIResourceUri.class))).thenReturn(restClient);
when(restClient.put(any(Object.class), any(GenericType.class))).thenReturn(
mapper.readValue(getJson("pathed-result.json"), new TypeReference<Results<Map<String, Object>>>() {}));
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
index 94d14684c7..a7fd6e904e 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
@@ -31,8 +31,12 @@ import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMoc
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import java.util.Optional;
import javax.ws.rs.BadRequestException;
import org.junit.Before;
import org.junit.Rule;
@@ -42,12 +46,17 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Relationship;
+import org.onap.so.client.RestClient;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
+import org.onap.so.client.graphinventory.exceptions.GraphInventoryMultipleItemsException;
import com.github.tomakehurst.wiremock.admin.NotFoundException;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
@@ -198,4 +207,102 @@ public class AAIResourcesClientTest {
}
+ @Test
+ public void testGetOne() {
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("my-vnf-id");
+ GenericVnfs vnfs = new GenericVnfs();
+ vnfs.getGenericVnf().add(vnf);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+ RestClient restClientMock = mock(RestClient.class);
+ doReturn(restClientMock).when(client).createClient(uri);
+ when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs));
+
+ Optional<GenericVnf> result = aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri);
+
+ assertEquals("my-vnf-id", result.get().getVnfId());
+ }
+
+ @Test
+ public void testGetOneMultipleResults() {
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("my-vnf-id");
+ GenericVnf vnf2 = new GenericVnf();
+ vnf.setVnfId("my-vnf-id2");
+ GenericVnfs vnfs = new GenericVnfs();
+ vnfs.getGenericVnf().add(vnf);
+ vnfs.getGenericVnf().add(vnf2);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+ RestClient restClientMock = mock(RestClient.class);
+ doReturn(restClientMock).when(client).createClient(uri);
+ when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs));
+
+ thrown.expect(GraphInventoryMultipleItemsException.class);
+ aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri);
+ }
+
+ @Test
+ public void testGetFirstMultipleResults() {
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("my-vnf-id");
+ GenericVnf vnf2 = new GenericVnf();
+ vnf2.setVnfId("my-vnf-id2");
+ GenericVnfs vnfs = new GenericVnfs();
+ vnfs.getGenericVnf().add(vnf);
+ vnfs.getGenericVnf().add(vnf2);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+ RestClient restClientMock = mock(RestClient.class);
+ doReturn(restClientMock).when(client).createClient(uri);
+ when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs));
+
+ Optional<GenericVnf> result = aaiClient.getFirst(GenericVnfs.class, GenericVnf.class, uri);
+
+ assertEquals("my-vnf-id", result.get().getVnfId());
+ }
+
+ @Test
+ public void testGetOneNoResults() {
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("my-vnf-id");
+ GenericVnfs vnfs = new GenericVnfs();
+ vnfs.getGenericVnf().add(vnf);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+ RestClient restClientMock = mock(RestClient.class);
+ doReturn(restClientMock).when(client).createClient(uri);
+ when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.empty());
+
+ Optional<GenericVnf> result = aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri);
+
+ assertFalse(result.isPresent());
+ }
+
+ @Test
+ public void testGetFirstNoResults() {
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("my-vnf-id");
+ GenericVnfs vnfs = new GenericVnfs();
+ vnfs.getGenericVnf().add(vnf);
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+ RestClient restClientMock = mock(RestClient.class);
+ doReturn(restClientMock).when(client).createClient(uri);
+ when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.empty());
+
+ Optional<GenericVnf> result = aaiClient.getFirst(GenericVnfs.class, GenericVnf.class, uri);
+
+ assertFalse(result.isPresent());
+ }
+
+ @Test
+ public void testGetFirstWrongPluralClass() {
+ GenericVnf vnf = new GenericVnf();
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+ RestClient restClientMock = mock(RestClient.class);
+ doReturn(restClientMock).when(client).createClient(uri);
+ when(restClientMock.get(GenericVnf.class)).thenReturn(Optional.of(vnf));
+
+ Optional<GenericVnf> result = aaiClient.getFirst(GenericVnf.class, GenericVnf.class, uri);
+
+ assertFalse(result.isPresent());
+ }
+
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
index 305cdf59cc..cbcb60513b 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
@@ -95,7 +95,7 @@ public class AAITransactionalClientTest {
@Test
public void testConnect() throws IOException {
- List<AAIResourceUri> uris = new ArrayList<AAIResourceUri>();
+ List<AAIResourceUri> uris = new ArrayList<>();
uris.add(uriB);
Map<String, Object> map = new HashMap<>();
@@ -117,7 +117,7 @@ public class AAITransactionalClientTest {
@Test
public void testDisconnect() throws IOException {
- List<AAIResourceUri> uris = new ArrayList<AAIResourceUri>();
+ List<AAIResourceUri> uris = new ArrayList<>();
uris.add(uriB);
AAITransactionalClient transactions = aaiClient.beginTransaction().disconnect(uriA, uris);
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIURITest.java b/common/src/test/java/org/onap/so/client/aai/AAIURITest.java
index 556b4429d4..8971f91602 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIURITest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIURITest.java
@@ -23,7 +23,7 @@ package org.onap.so.client.aai;
import static org.junit.Assert.assertEquals;
import javax.ws.rs.core.UriBuilder;
import org.junit.Test;
-import org.onap.so.client.aai.entities.uri.AAIUri;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
public class AAIURITest {
@@ -33,7 +33,7 @@ public class AAIURITest {
@Test
public void verifyTemplateReplacement() {
final String id = "test1";
- AAIUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, id);
+ AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, id);
String manualReplace = AAIObjectType.CONFIGURATION.toString().replaceAll("\\{configuration-id\\}", id);
assertEquals("uri template replaced", aaiUri.build(), UriBuilder.fromPath(manualReplace).build());
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java b/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java
index ec7c6434a7..039bbb3614 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java
@@ -43,15 +43,12 @@ public class RelationshipsTest {
Relationships relationships = wrapper.getRelationships().get();
List<AAIResourceUri> test = relationships.getRelatedUris(AAIObjectType.VCE);
-
- System.out.println(test.get(0).build());
List<AAIResourceUri> uris = Arrays.asList(
AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a9fec18e-1ea3-40e4-a6c0-a89b3de07053"),
AAIUriFactory.createResourceUri(AAIObjectType.VCE, "8ae1e5f8-61f1-4c71-913a-b40cc4593cb9"),
AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a2935fa9-b743-49f4-9813-a127f13c4e93"),
AAIUriFactory.createResourceUri(AAIObjectType.VCE, "c7fe7698-8063-4e26-8bd3-ca3edde0b0d4"));
-
assertTrue(uris.containsAll(test) && test.containsAll(uris));
}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java
index d26ff8d507..0249bea794 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java
@@ -33,7 +33,7 @@ public class AAISimpleUriFromParentUriTest {
AAIResourceUri parentUri =
AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "key1", "key2", "key3");
- AAIUri uri = new AAISimpleUri(parentUri, AAIObjectType.ALLOTTED_RESOURCE, "key4");
+ AAIResourceUri uri = new AAISimpleUri(parentUri, AAIObjectType.ALLOTTED_RESOURCE, "key4");
assertEquals("path appended",
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4",
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java
index ab1529d3ba..6bf67ffce8 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java
@@ -24,7 +24,6 @@ import static org.junit.Assert.assertEquals;
import javax.ws.rs.core.UriBuilder;
import org.junit.Test;
import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
public class AAISimpleUriFromUriTest {
@@ -33,7 +32,7 @@ public class AAISimpleUriFromUriTest {
@Test
public void removeHost() {
- AAIUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
+ AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
UriBuilder
.fromUri("https://localhost:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053")
.build());
@@ -46,7 +45,7 @@ public class AAISimpleUriFromUriTest {
@Test
public void noChange() {
- AAIUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
+ AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
UriBuilder.fromUri("/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053").build());
assertEquals("no change", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString());
@@ -56,11 +55,22 @@ public class AAISimpleUriFromUriTest {
@Test
public void encodingPreserved() {
- AAIUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
+ AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build());
assertEquals("encoding preserved", "/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053",
uri.build().toString());
}
+
+ @Test
+ public void beforeBuildEquality() {
+
+ AAIResourceUri uri = new AAISimpleUri(AAIObjectType.VCE,
+ UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build());
+
+ AAIResourceUri uri2 = new AAISimpleUri(AAIObjectType.VCE, "a9f ec18e-1ea3-40e4-a6c0-a89b3de07053");
+ assertEquals("are equal", uri2, uri);
+
+ }
}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java
index 4e9d5aa8e8..6c1b3d69a2 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java
@@ -20,14 +20,10 @@
package org.onap.so.client.aai.entities.uri;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.collection.IsEmptyCollection.empty;
-import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
@@ -36,7 +32,6 @@ import org.junit.Test;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.graphinventory.entities.uri.Depth;
-import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
public class AAISimpleUriTest {
@@ -44,34 +39,52 @@ public class AAISimpleUriTest {
@Test
public void relatedToTestPlural() {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
- uri.relatedTo(AAIObjectPlurals.PSERVER);
+ AAIPluralResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1").relatedTo(AAIObjectPlurals.PSERVER);
String uriOutput = uri.build().toString();
- assertEquals(true, uriOutput.contains("related-to"));
+ assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers", uriOutput);
}
@Test
public void relatedToTestSingular() {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
- uri.relatedTo(AAIObjectType.PSERVER, "test2");
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1")
+ .relatedTo(AAIObjectType.PSERVER, "test2");
String uriOutput = uri.build().toString();
- assertEquals(true, uriOutput.contains("related-to"));
+ assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2", uriOutput);
}
@Test
public void cloneTestSingular() {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
AAIResourceUri cloned = uri.clone();
- Map<String, String> keys = cloned.getURIKeys();
- assertThat(keys.values(), contains("test1"));
+ assertEquals("/network/generic-vnfs/generic-vnf/test1", cloned.build().toString());
+
+ cloned.limit(2);
+
+ assertNotEquals(uri.build().toString(), cloned.build().toString());
}
@Test
public void cloneTestPlural() {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
- AAIResourceUri cloned = uri.clone();
- Map<String, String> keys = cloned.getURIKeys();
- assertThat(keys.values(), empty());
+ AAISimplePluralUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
+ AAISimplePluralUri cloned = uri.clone();
+ assertEquals("/network/generic-vnfs", cloned.build().toString());
+ }
+
+ @Test
+ public void cloneTestWithRelatedTo() {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1")
+ .relatedTo(AAIObjectType.PSERVER, "test2");
+ String uriOutput = uri.clone().build().toString();
+ assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2", uriOutput);
+ }
+
+ @Test
+ public void cloneTestPluralWithRelatedTo() {
+ AAIPluralResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1").relatedTo(AAIObjectPlurals.PSERVER);
+ String uriOutput = uri.clone().build().toString();
+ assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers", uriOutput);
}
@Test
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java
index 9b4f5dafb5..8a203f6439 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java
@@ -24,14 +24,13 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
public class AAIUriFactoryTest {
@Test
public void testCreateResourceUri() {
- AAIUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
String expected = "/network/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29";
assertEquals(expected, uri.build().toString());
@@ -40,7 +39,7 @@ public class AAIUriFactoryTest {
@Test
public void testCreateNodesUri() {
- AAIUri uri = AAIUriFactory.createNodesUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
+ AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
String expected = "/nodes/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29";
assertEquals(expected, uri.build().toString());
@@ -49,8 +48,8 @@ public class AAIUriFactoryTest {
@Test
public void testCreateResourceFromExistingURI() {
- AAIUri uri = new AAISimpleUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
- AAIUri uri2 = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.GENERIC_VNF, uri.build());
+ AAIResourceUri uri = new AAISimpleUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
+ AAIResourceUri uri2 = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.GENERIC_VNF, uri.build());
String expected = "/network/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29";
assertEquals(expected, uri2.build().toString());
@@ -59,7 +58,8 @@ public class AAIUriFactoryTest {
@Test
public void testCreateResourceURIForPluralsWithValues() {
- AAIUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, "customerId", "serviceType");
+ AAIPluralResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, "customerId", "serviceType");
String expected =
"/business/customers/customer/customerId/service-subscriptions/service-subscription/serviceType/service-instances";
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java
index 4be6753894..a92a7c3c1a 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java
@@ -44,7 +44,7 @@ public class AllottedResourceLookupUriTest {
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4")
.when(spy).getObjectById(any(Object.class));
- final URI result = spy.build();
+ final URI result = spy.locateAndBuild();
final URI expected = UriBuilder.fromPath(
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4")
.build();
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java
index 86ee08c4e6..3fbbc7c110 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java
@@ -21,8 +21,6 @@
package org.onap.so.client.aai.entities.uri;
import static org.hamcrest.CoreMatchers.equalTo;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -48,7 +46,7 @@ public class IncorrectNumberOfUriKeysTest {
public void verifyIncorrectNumberOfKeysPlural() {
thrown.expect(IncorrectNumberOfUriKeys.class);
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, "my-cloud-owner");
+ AAISimplePluralUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, "my-cloud-owner");
}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
index 9bef35e3b5..71d65b6f45 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
@@ -56,11 +56,11 @@ import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.client.aai.AAIClient;
-import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundException;
@@ -111,7 +111,7 @@ public class ServiceInstanceUriTest {
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
.when(spy).getObjectById(any(Object.class));
- final URI result = spy.build();
+ final URI result = spy.locateAndBuild();
final URI expected = UriBuilder.fromPath(
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
.build();
@@ -129,7 +129,7 @@ public class ServiceInstanceUriTest {
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
.when(spy).getObjectById(any(Object.class));
- final URI result = spy.resourceVersion("1234").build();
+ final URI result = ((HttpAwareUri) spy.resourceVersion("1234")).locateAndBuild();
final URI expected = UriBuilder.fromUri(
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234")
.build();
@@ -147,7 +147,7 @@ public class ServiceInstanceUriTest {
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space")
.when(spy).getObjectById(any(Object.class));
- final URI result = spy.build();
+ final URI result = spy.locateAndBuild();
final URI expected = UriBuilder.fromUri(
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space")
.build();
@@ -175,9 +175,8 @@ public class ServiceInstanceUriTest {
ServiceInstanceUri spy = spy(instance);
String uri =
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3";
- doReturn(uri).when(spy).getObjectById(any(Object.class));
doReturn(Optional.of(uri)).when(spy).getCachedValue();
- final URI result = spy.resourceVersion("1234").clone().build();
+ final URI result = ((HttpAwareUri) spy.resourceVersion("1234").clone()).locateAndBuild();
final URI expected = UriBuilder.fromUri(
"/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234")
.build();
@@ -210,7 +209,7 @@ public class ServiceInstanceUriTest {
when(wrapper.getJson()).thenReturn(content);
when(spy.getResourcesClient()).thenReturn(mockResourcesClient);
exception.expect(GraphInventoryUriComputationException.class);
- spy.build();
+ spy.locateAndBuild();
}
@@ -233,7 +232,7 @@ public class ServiceInstanceUriTest {
.stubFor(get(urlPathMatching("/aai/v[0-9]+/nodes/service-instances/service-instance/key3")).willReturn(
aResponse().withStatus(404).withHeader("Content-Type", "application/json").withBodyFile("")));
exception.expect(NotFoundException.class);
- spy.build();
+ spy.locateAndBuild();
}
@Test
@@ -250,7 +249,7 @@ public class ServiceInstanceUriTest {
ArgumentMatchers.<Class<NotFoundException>>any())).thenReturn(wrapper);
when(wrapper.getJson()).thenReturn(content);
when(spy.getResourcesClient()).thenReturn(mockResourcesClient);
- spy.build();
+ spy.locateAndBuild();
instance = spy.clone();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
@@ -271,6 +270,32 @@ public class ServiceInstanceUriTest {
// use the cached value do not call out to external system
verify(spy2, times(0)).getResourcesClient();
+ }
+
+ @Test
+ public void relatedToTest() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
+ ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+ ServiceInstanceUri spy = spy(instance);
+ doReturn(
+ "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
+ .when(spy).getObjectById(any(Object.class));
+
+ final URI result = spy.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "my-vnf-name").build();
+ final URI expected = UriBuilder.fromUri(
+ "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/related-to/generic-vnfs?vnf-name=my-vnf-name")
+ .build();
+ assertEquals("result is equal", expected, result);
+ }
+
+ @Test
+ public void relatedToEqualityTestBeforeBuildTest()
+ throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
+ ServiceInstanceUri instance = new ServiceInstanceUri("key1");
+ ServiceInstanceUri spy = spy(instance);
+
+ final AAIPluralResourceUri result =
+ spy.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "my-vnf-name");
+ assertEquals("result is equal", result, result);
}
}
diff --git a/common/src/test/java/org/onap/so/logger/ScheduledTasksMDCSetupTest.java b/common/src/test/java/org/onap/so/logger/ScheduledTasksMDCSetupTest.java
deleted file mode 100644
index f232781871..0000000000
--- a/common/src/test/java/org/onap/so/logger/ScheduledTasksMDCSetupTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2019 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.onap.so.logger;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import org.junit.After;
-import org.junit.Test;
-import org.onap.logging.filter.base.Constants;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.utils.Components;
-import org.onap.so.utils.UUIDChecker;
-import org.slf4j.MDC;
-
-public class ScheduledTasksMDCSetupTest {
- private ScheduledTasksMDCSetup tasksMDCSetup = new ScheduledTasksMDCSetup();
-
- @After
- public void tearDown() {
- MDC.clear();
- System.clearProperty("partnerName");
- }
-
- @Test
- public void mdcSetupTest() {
- System.setProperty("partnerName", Components.APIH.toString());
- tasksMDCSetup.mdcSetup(Components.APIH, "mdcSetupTest");
-
- assertTrue(UUIDChecker.isValidUUID(MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)));
- assertEquals(Components.APIH.toString(), MDC.get(ONAPLogConstants.MDCs.TARGET_ENTITY));
- assertEquals(Components.APIH.toString(), MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME));
- assertEquals("mdcSetupTest", MDC.get(ONAPLogConstants.MDCs.SERVICE_NAME));
- assertEquals(Constants.DefaultValues.UNKNOWN, MDC.get(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME));
- assertNotNull(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(MDC.get(ONAPLogConstants.MDCs.ELAPSED_TIME));
- assertNotNull(MDC.get(ONAPLogConstants.MDCs.LOG_TIMESTAMP));
- assertNotNull(MDC.get(ONAPLogConstants.MDCs.SERVER_FQDN));
- }
-
- @Test
- public void errorMDCSetupTest() {
- tasksMDCSetup.errorMDCSetup(ErrorCode.UnknownError, "Error");
-
- assertEquals("900", MDC.get(ONAPLogConstants.MDCs.ERROR_CODE));
- assertEquals("Error", MDC.get(ONAPLogConstants.MDCs.ERROR_DESC));
- }
-
- @Test
- public void setStatusCodeTest() {
- tasksMDCSetup.setStatusCode();
-
- assertEquals(ONAPLogConstants.ResponseStatus.COMPLETE.toString(),
- MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
- }
-
- @Test
- public void setStatusCodeErrorTest() {
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString());
- tasksMDCSetup.setStatusCode();
-
- assertEquals(ONAPLogConstants.ResponseStatus.ERROR.toString(),
- MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
- }
-}
diff --git a/cxf-logging/pom.xml b/cxf-logging/pom.xml
index f0c969aeb1..c056daf6f8 100644
--- a/cxf-logging/pom.xml
+++ b/cxf-logging/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<name>CXFLogging</name>
<description>Common CXF Logging Classes</description>
diff --git a/deployment-configs/pom.xml b/deployment-configs/pom.xml
index 6935a15955..002cd19f81 100644
--- a/deployment-configs/pom.xml
+++ b/deployment-configs/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>deployment-configs</artifactId>
<name>deployment-configs</name>
diff --git a/deployment-configs/src/main/resources/logger/logback-spring.xml b/deployment-configs/src/main/resources/logger/logback-spring.xml
index 831a33a490..3f022f55fb 100644
--- a/deployment-configs/src/main/resources/logger/logback-spring.xml
+++ b/deployment-configs/src/main/resources/logger/logback-spring.xml
@@ -27,7 +27,7 @@
<property name="currentTimeStamp" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;,UTC}"/>
<property name="errorPattern"
- value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName:-Unknown}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode:-900}|%X{ErrorDesc:-UnknownError}|%msg%n" />
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName:-Unknown}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode:-900}|%X{ErrorDesc:-UnknownError}|%msg%nopex%n" />
<property name="debugPattern"
value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%logger{50} - %msg%n" />
diff --git a/mso-api-handlers/mso-api-handler-common/pom.xml b/mso-api-handlers/mso-api-handler-common/pom.xml
index a3fd37ce2b..865de7998f 100644
--- a/mso-api-handlers/mso-api-handler-common/pom.xml
+++ b/mso-api-handlers/mso-api-handler-common/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>mso-api-handlers</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
index 3cf3907424..2101252ad0 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
@@ -45,6 +45,7 @@ public class RequestClientParameter {
private String requestUri;
private String instanceGroupId;
private boolean generateIdsOnly;
+ private String operationType;
private RequestClientParameter(Builder builder) {
requestId = builder.requestId;
@@ -69,6 +70,11 @@ public class RequestClientParameter {
requestUri = builder.requestUri;
instanceGroupId = builder.instanceGroupId;
generateIdsOnly = builder.generateIdsOnly;
+ operationType = builder.operationType;
+ }
+
+ public String getOperationType() {
+ return operationType;
}
public String getRequestId() {
@@ -186,6 +192,12 @@ public class RequestClientParameter {
private String requestUri;
private String instanceGroupId;
private boolean generateIdsOnly;
+ private String operationType;
+
+ public Builder setOperationType(String operationType) {
+ this.operationType = operationType;
+ return this;
+ }
public Builder setRequestId(String requestId) {
this.requestId = requestId;
@@ -302,4 +314,6 @@ public class RequestClientParameter {
}
}
+
+
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
index bedce185c5..806646022c 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
@@ -34,7 +34,7 @@ import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java
index a896078d44..dd51032300 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java
@@ -22,7 +22,7 @@ package org.onap.so.apihandlerinfra.logging;
import java.io.Serializable;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
index 2cdf4f1a3f..7bd371c974 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
@@ -27,7 +27,7 @@ import org.junit.rules.ExpectedException;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.exceptions.*;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import java.io.IOException;
import java.util.LinkedList;
diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml
index 84a80e6617..3a7c7ad477 100644
--- a/mso-api-handlers/mso-api-handler-infra/pom.xml
+++ b/mso-api-handlers/mso-api-handler-infra/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>mso-api-handlers</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
@@ -98,6 +98,10 @@
<artifactId>spring-retry</artifactId>
</dependency>
<dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-webflux</artifactId>
+ </dependency>
+ <dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java
index 17377d881a..f30b66c6b5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/CamundaRequestHandler.java
@@ -9,9 +9,11 @@ import javax.ws.rs.core.UriBuilder;
import javax.xml.bind.DatatypeConverter;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricActivityInstanceEntity;
import org.camunda.bpm.engine.impl.persistence.entity.HistoricProcessInstanceEntity;
+import org.json.JSONObject;
import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.onap.so.utils.CryptoUtils;
+import org.onap.so.apihandlerinfra.exceptions.ContactCamundaException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -29,6 +31,9 @@ import org.springframework.stereotype.Component;
import org.springframework.web.client.ResourceAccessException;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
+import org.springframework.web.reactive.function.BodyInserters;
+import org.springframework.web.reactive.function.client.WebClient;
+import reactor.core.publisher.Flux;
@Component
public class CamundaRequestHandler {
@@ -202,6 +207,20 @@ public class CamundaRequestHandler {
return retryTemplate;
}
+ protected void sendCamundaMessages(JSONObject msgJson) {
+ String url = env.getProperty("mso.camundaURL") + "/sobpmnengine/message";
+ HttpHeaders headers =
+ setCamundaHeaders(env.getRequiredProperty("mso.camundaAuth"), env.getRequiredProperty("mso.msoKey"));
+ headers.setContentType(org.springframework.http.MediaType.APPLICATION_JSON);
+ // Workflow may take a long time so use non-blocking request
+ Flux<String> flux = WebClient.create().post().uri(url).headers(httpHeaders -> {
+ httpHeaders.set(httpHeaders.AUTHORIZATION, headers.get(httpHeaders.AUTHORIZATION).get(0));
+ httpHeaders.set(httpHeaders.ACCEPT, headers.get(httpHeaders.ACCEPT).get(0));
+ httpHeaders.set(httpHeaders.CONTENT_TYPE, headers.get(httpHeaders.CONTENT_TYPE).get(0));
+ }).body(BodyInserters.fromObject(msgJson.toString())).retrieve().bodyToFlux(String.class);
+ flux.subscribe(res -> logger.debug("Send Camunda Message: " + res));
+ }
+
protected RestTemplate getRestTemplate(boolean retry) {
int timeout;
if (retry) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
index 0bcb0f1c86..d4bc4fd165 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
@@ -23,11 +23,7 @@
package org.onap.so.apihandlerinfra;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
@@ -38,6 +34,12 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.*;
+import org.onap.aai.domain.yang.v16.ServiceInstance;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
@@ -62,7 +64,7 @@ import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.OperationStatus;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
@@ -174,6 +176,30 @@ public class E2EServiceInstances {
return deleteE2EserviceInstances(request, Action.deleteInstance, instanceIdMap, version);
}
+ /**
+ * Activate Requests for 5G slice Service on a specified version and serviceId
+ *
+ * @throws ApiException
+ */
+
+ @POST
+ @Path("/{version:[vV][3-5]}/{serviceId}/{operationType}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Activate 5G slice Service on a specified version and serviceId", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ public Response Activate5GSliceServiceInstance(String request, @PathParam("version") String version,
+ @PathParam("operationType") String operationType, @PathParam(SERVICE_ID) String serviceId)
+ throws ApiException {
+ if (operationType.equals("activate")) {
+ instanceIdMap.put("operationType", "activation");
+ } else {
+ instanceIdMap.put("operationType", "deactivation");
+ }
+ instanceIdMap.put(SERVICE_ID, serviceId);
+ return Activate5GSliceServiceInstances(request, Action.activateInstance, instanceIdMap, version);
+ }
+
@GET
@Path("/{version:[vV][3-5]}/{serviceId}/operations/{operationId}")
@Operation(description = "Find e2eServiceInstances Requests for a given serviceId and operationId",
@@ -345,6 +371,116 @@ public class E2EServiceInstances {
return builder.buildResponse(HttpStatus.SC_OK, null, e2eServiceResponse, apiVersion);
}
+ private Response Activate5GSliceServiceInstances(String requestJSON, Action action,
+ HashMap<String, String> instanceIdMap, String version) throws ApiException {
+ // TODO should be a new one or the same service instance Id
+ E2ESliceServiceActivateRequest e2eActReq;
+
+ ObjectMapper mapper = new ObjectMapper();
+ try {
+ e2eActReq = mapper.readValue(requestJSON, E2ESliceServiceActivateRequest.class);
+
+ } catch (Exception e) {
+
+ logger.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, version);
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.SchemaError.getValue(), requestJSON, e);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
+ }
+
+ String requestId = UUID.randomUUID().toString();
+ RecipeLookupResult recipeLookupResult;
+ try {
+ // TODO Get the service template model version uuid from AAI.
+ String modelVersionId = null;
+ AAIResourcesClient client = new AAIResourcesClient();
+ AAIResourceUri url = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ e2eActReq.getGlobalSubscriberId(), e2eActReq.getServiceType(), instanceIdMap.get(SERVICE_ID));
+ Optional<ServiceInstance> serviceInstanceOpt = client.get(ServiceInstance.class, url);
+ if (serviceInstanceOpt.isPresent()) {
+ modelVersionId = serviceInstanceOpt.get().getModelVersionId();
+ }
+ recipeLookupResult = getServiceInstanceOrchestrationURI(modelVersionId, action);
+ } catch (Exception e) {
+ logger.error(MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
+
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
+
+ msoRequest.createErrorRequestRecord(Status.FAILED, requestId,
+ "Exception while communciate with " + "Catalog DB", action, ModelType.service.name(), requestJSON);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
+ }
+ if (recipeLookupResult == null) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB");
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "Recipe does not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
+
+ msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "Recipe does not exist in catalog DB", action,
+ ModelType.service.name(), requestJSON);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
+ }
+
+ RequestClient requestClient;
+ HttpResponse response;
+
+ try {
+ requestClient = requestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI());
+
+ JSONObject jjo = new JSONObject(requestJSON);
+ jjo.put("operationId", requestId);
+
+ String bpmnRequest = jjo.toString();
+
+ // Capture audit event
+ logger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl());
+ String serviceId = instanceIdMap.get(SERVICE_ID);
+ String operationType = instanceIdMap.get("operationType");
+ String serviceInstanceType = e2eActReq.getServiceType();
+ RequestClientParameter clientParam = new RequestClientParameter.Builder().setRequestId(requestId)
+ .setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
+ .setRequestAction(action.name()).setServiceInstanceId(serviceId).setOperationType(operationType)
+ .setServiceType(serviceInstanceType).setRequestDetails(bpmnRequest).setApiVersion(version)
+ .setALaCarte(false).setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build();
+ response = requestClient.post(clientParam);
+
+ } catch (Exception e) {
+ Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY,
+ MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.AvailabilityError.getValue(),
+ "Exception while communicate with BPMN engine");
+ logger.debug("End of the transaction, the final response is: " + resp.getEntity());
+ return resp;
+ }
+
+ if (response == null) {
+ Response resp =
+ msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,
+ "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcessError.getValue(), "Null response from BPEL");
+ logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
+ return resp;
+ }
+
+ ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType());
+ int bpelStatus = respHandler.getStatus();
+
+ return beplStatusUpdate(requestClient, respHandler, bpelStatus, version);
+ }
+
private Response deleteE2EserviceInstances(String requestJSON, Action action, HashMap<String, String> instanceIdMap,
String version) throws ApiException {
// TODO should be a new one or the same service instance Id
@@ -370,7 +506,15 @@ public class E2EServiceInstances {
RecipeLookupResult recipeLookupResult;
try {
// TODO Get the service template model version uuid from AAI.
- recipeLookupResult = getServiceInstanceOrchestrationURI(null, action);
+ String modelVersionId = null;
+ AAIResourcesClient client = new AAIResourcesClient();
+ AAIResourceUri url = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ e2eDelReq.getGlobalSubscriberId(), e2eDelReq.getServiceType(), instanceIdMap.get(SERVICE_ID));
+ Optional<ServiceInstance> serviceInstanceOpt = client.get(ServiceInstance.class, url);
+ if (serviceInstanceOpt.isPresent()) {
+ modelVersionId = serviceInstanceOpt.get().getModelVersionId();
+ }
+ recipeLookupResult = getServiceInstanceOrchestrationURI(modelVersionId, action);
} catch (Exception e) {
logger.error(MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
index 028abd6d25..3007ddd7c9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
@@ -39,7 +39,7 @@ import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.RequestReferences;
@@ -95,7 +95,7 @@ public class InstanceManagement {
@Path("/{version:[vV][1]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/workflows/{workflowUuid}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @Operation(description = "Execute custom workflow", responses = @ApiResponse(
+ @Operation(description = "Execute custom VNF workflow", responses = @ApiResponse(
content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response executeVNFCustomWorkflow(String request, @PathParam("version") String version,
@@ -112,20 +112,20 @@ public class InstanceManagement {
}
@POST
- @Path("/{version:[vV][1]}/serviceInstances/{serviceInstanceId}/pnfs/{pnfId}/workflows/{workflowUuid}")
+ @Path("/{version:[vV][1]}/serviceInstances/{serviceInstanceId}/pnfs/{pnfName}/workflows/{workflowUuid}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @Operation(description = "Execute custom workflow", responses = @ApiResponse(
+ @Operation(description = "Execute custom PNF workflow", responses = @ApiResponse(
content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response executePNFCustomWorkflow(String request, @PathParam("version") String version,
- @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("pnfId") String pnfId,
+ @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("pnfName") String pnfName,
@PathParam("workflowUuid") String workflowUuid, @Context ContainerRequestContext requestContext)
throws ApiException {
String requestId = requestHandlerUtils.getRequestId(requestContext);
HashMap<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
- instanceIdMap.put("pnfId", pnfId);
+ instanceIdMap.put("pnfName", pnfName);
instanceIdMap.put("workflowUuid", workflowUuid);
return processPNFCustomWorkflowRequest(request, Action.forCustomWorkflow, instanceIdMap, version, requestId,
requestContext);
@@ -255,18 +255,18 @@ public class InstanceManagement {
String apiVersion = version.substring(1);
String serviceInstanceId = "";
- String pnfId = "";
+ String pnfName = "";
String workflowUuid = "";
if (instanceIdMap != null) {
serviceInstanceId = instanceIdMap.get("serviceInstanceId");
- pnfId = instanceIdMap.get("pnfId");
+ pnfName = instanceIdMap.get("pnfName");
workflowUuid = instanceIdMap.get("workflowUuid");
}
String requestUri = requestHandlerUtils.getRequestUri(requestContext, uriPrefix);
sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, requestId, requestUri);
sir.setServiceInstanceId(serviceInstanceId);
- sir.setPnfId(pnfId);
+ sir.setPnfName(pnfName);
String requestScope = ModelType.pnf.name();
InfraActiveRequests currentActiveReq =
msoRequest.createRequestObject(sir, action, requestId, Status.IN_PROGRESS, requestJSON, requestScope);
@@ -299,7 +299,7 @@ public class InstanceManagement {
try {
requestClientParameter = new RequestClientParameter.Builder().setRequestId(requestId)
.setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.toString())
- .setServiceInstanceId(serviceInstanceId).setPnfCorrelationId(pnfId)
+ .setServiceInstanceId(serviceInstanceId).setPnfCorrelationId(pnfName)
.setRequestDetails(requestHandlerUtils.mapJSONtoMSOStyle(requestJSON, null, aLaCarte, action))
.setApiVersion(apiVersion).setRequestUri(requestUri).build();
} catch (IOException e) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
index b7288e4c91..0afc272b0a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
@@ -92,6 +92,7 @@ public class JerseyConfiguration extends ResourceConfig {
register(NoRecipeExceptionMapper.class);
register(RequestConflictMapper.class);
register(WorkflowEngineConnectionMapper.class);
+ register(OrchestrationTasks.class);
// this registration seems to be needed to get predictable
// execution behavior for the above JSON Exception Mappers
register(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.class);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
index 34eca2f266..0ec61785fd 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
@@ -50,7 +50,7 @@ import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest;
import org.onap.so.apihandlerinfra.tasksbeans.Value;
import org.onap.so.apihandlerinfra.tasksbeans.Variables;
import org.onap.so.exceptions.ValidationException;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
index 5c81f4e6a5..ce371203ab 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
@@ -42,7 +42,11 @@ import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.Tenant;
import org.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
import org.onap.so.apihandlerinfra.tasksbeans.TasksRequest;
import org.onap.so.apihandlerinfra.validation.ApplyUpdatedConfigValidation;
import org.onap.so.apihandlerinfra.validation.CloudConfigurationValidation;
@@ -97,7 +101,6 @@ import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-
@Component
public class MsoRequest {
@@ -107,6 +110,9 @@ public class MsoRequest {
@Autowired
private ResponseBuilder builder;
+ @Autowired
+ private AAIDataRetrieval aaiDataRet;
+
@Value("${mso.enforceDLP:false}")
private boolean enforceDLP;
@@ -311,11 +317,30 @@ public class MsoRequest {
aq.setVnfId(servInsReq.getVnfInstanceId());
}
- if (servInsReq.getPnfId() != null) {
+ if (servInsReq.getPnfName() != null) {
aq.setRequestScope(requestScope);
- aq.setPnfId(servInsReq.getPnfId());
+ aq.setPnfName(servInsReq.getPnfName());
}
+ if (servInsReq.getRequestDetails() != null && servInsReq.getRequestDetails().getRequestInfo() != null
+ && servInsReq.getRequestDetails().getRequestInfo().getProductFamilyId() != null) {
+ logger.debug("Retrieving productFamilyName to put into requests db");
+
+ org.onap.aai.domain.yang.Service service =
+ aaiDataRet.getService(servInsReq.getRequestDetails().getRequestInfo().getProductFamilyId());
+ if (service != null) {
+ logger.debug("Found service by service-id");
+ String productFamilyName = service.getServiceDescription();
+ if (productFamilyName != null) {
+ aq.setProductFamilyName(productFamilyName);
+ }
+ }
+ }
+
+ aq.setProductFamilyName(getProductFamilyNameFromAAI(servInsReq));
+
+ aq.setTenantName(getTenantNameFromAAI(servInsReq));
+
if (ModelType.service.name().equalsIgnoreCase(requestScope)) {
if (servInsReq.getRequestDetails().getRequestInfo() != null) {
if (servInsReq.getRequestDetails().getRequestInfo().getInstanceName() != null) {
@@ -683,4 +708,31 @@ public class MsoRequest {
return vnfType;
}
+ protected String getTenantNameFromAAI(ServiceInstancesRequest servInsReq) {
+ String tenantName = null;
+ if (servInsReq.getRequestDetails() != null && servInsReq.getRequestDetails().getCloudConfiguration() != null
+ && servInsReq.getRequestDetails().getCloudConfiguration().getTenantId() != null) {
+ Tenant tenant = aaiDataRet.getTenant(servInsReq.getRequestDetails().getCloudConfiguration().getCloudOwner(),
+ servInsReq.getRequestDetails().getCloudConfiguration().getLcpCloudRegionId(),
+ servInsReq.getRequestDetails().getCloudConfiguration().getTenantId());
+ if (tenant != null) {
+ tenantName = tenant.getTenantName();
+ }
+ }
+ return tenantName;
+ }
+
+ protected String getProductFamilyNameFromAAI(ServiceInstancesRequest servInsReq) {
+ String productFamilyName = null;
+ if (servInsReq.getRequestDetails() != null && servInsReq.getRequestDetails().getRequestInfo() != null
+ && servInsReq.getRequestDetails().getRequestInfo().getProductFamilyId() != null) {
+ org.onap.aai.domain.yang.Service service =
+ aaiDataRet.getService(servInsReq.getRequestDetails().getRequestInfo().getProductFamilyId());
+ if (service != null) {
+ productFamilyName = service.getServiceDescription();
+ }
+ }
+ return productFamilyName;
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
index ae68cc6032..c43a050500 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
@@ -28,6 +28,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
import javax.transaction.Transactional;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
@@ -57,7 +58,7 @@ import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.RequestProcessingData;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.serviceinstancebeans.CloudRequestData;
import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse;
@@ -73,6 +74,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
@@ -105,8 +107,11 @@ public class OrchestrationRequests {
@Autowired
private CamundaRequestHandler camundaRequestHandler;
+ @Autowired
+ private Environment env;
+
@GET
- @Path("/{version:[vV][4-7]}/{requestId}")
+ @Path("/{version:[vV][4-8]}/{requestId}")
@Operation(description = "Find Orchestrated Requests for a given requestId", responses = @ApiResponse(
content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Produces(MediaType.APPLICATION_JSON)
@@ -115,7 +120,6 @@ public class OrchestrationRequests {
@PathParam("version") String version, @QueryParam("includeCloudRequest") boolean includeCloudRequest,
@QueryParam(value = "format") String format) throws ApiException {
- String apiVersion = version.substring(1);
GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse();
InfraActiveRequests infraActiveRequest = null;
@@ -152,7 +156,7 @@ public class OrchestrationRequests {
}
}
- Request request = mapInfraActiveRequestToRequest(infraActiveRequest, includeCloudRequest, format);
+ Request request = mapInfraActiveRequestToRequest(infraActiveRequest, includeCloudRequest, format, version);
if (null != requestProcessingData && !requestProcessingData.isEmpty()) {
request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
@@ -161,11 +165,11 @@ public class OrchestrationRequests {
orchestrationResponse.setRequest(request);
return builder.buildResponse(HttpStatus.SC_OK, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID), orchestrationResponse,
- apiVersion);
+ version);
}
@GET
- @Path("/{version:[vV][4-7]}")
+ @Path("/{version:[vV][4-8]}")
@Operation(description = "Find Orchestrated Requests for a URI Information", responses = @ApiResponse(
content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Produces(MediaType.APPLICATION_JSON)
@@ -206,7 +210,7 @@ public class OrchestrationRequests {
for (InfraActiveRequests infraActive : activeRequests) {
RequestList requestList = new RequestList();
- Request request = mapInfraActiveRequestToRequest(infraActive, includeCloudRequest, format);
+ Request request = mapInfraActiveRequestToRequest(infraActive, includeCloudRequest, format, version);
if (isRequestProcessingDataRequired(format)) {
List<RequestProcessingData> requestProcessingData =
@@ -292,7 +296,7 @@ public class OrchestrationRequests {
}
protected Request mapInfraActiveRequestToRequest(InfraActiveRequests iar, boolean includeCloudRequest,
- String format) throws ApiException {
+ String format, String version) throws ApiException {
String requestBody = iar.getRequestBody();
Request request = new Request();
@@ -328,8 +332,6 @@ public class OrchestrationRequests {
ir.setVolumeGroupInstanceId(iar.getVolumeGroupId());
if (iar.getVolumeGroupName() != null)
ir.setVolumeGroupInstanceName(iar.getVolumeGroupName());
- if (iar.getRequestorId() != null)
- ir.setRequestorId(iar.getRequestorId());
if (iar.getInstanceGroupId() != null)
ir.setInstanceGroupId(iar.getInstanceGroupId());
if (iar.getInstanceGroupName() != null)
@@ -347,6 +349,13 @@ public class OrchestrationRequests {
} else {
requestDetails = mapper.readValue(requestBody, RequestDetails.class);
}
+ if (requestDetails.getRequestInfo() != null && iar.getProductFamilyName() != null) {
+ requestDetails.getRequestInfo().setProductFamilyName(iar.getProductFamilyName());
+ }
+ if (requestDetails.getCloudConfiguration() != null && iar.getTenantName() != null) {
+ requestDetails.getCloudConfiguration().setTenantName(iar.getTenantName());
+ }
+
} catch (IOException e) {
logger.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo =
@@ -397,7 +406,7 @@ public class OrchestrationRequests {
});
}
- mapRequestStatusAndExtSysErrSrcToRequest(iar, status, format);
+ mapRequestStatusAndExtSysErrSrcToRequest(iar, status, format, version);
request.setRequestStatus(status);
return request;
@@ -426,17 +435,21 @@ public class OrchestrationRequests {
}
protected void mapRequestStatusAndExtSysErrSrcToRequest(InfraActiveRequests iar, RequestStatus status,
- String format) {
+ String format, String version) {
String rollbackStatusMessage = iar.getRollbackStatusMessage();
String flowStatusMessage = iar.getFlowStatus();
String retryStatusMessage = iar.getRetryStatusMessage();
String taskName = null;
- if (flowStatusMessage != null && !flowStatusMessage.equals("Successfully completed all Building Blocks")
- && !flowStatusMessage.equals("All Rollback flows have completed successfully")) {
- taskName = camundaRequestHandler.getTaskName(iar.getRequestId());
- if (taskName != null) {
- flowStatusMessage = flowStatusMessage + " TASK INFORMATION: " + taskName;
+ if (daysSinceRequest(iar) <= camundaCleanupInterval()) {
+ if (format == null || !format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLENOTASKINFO.toString())) {
+ if (flowStatusMessage != null && !flowStatusMessage.equals("Successfully completed all Building Blocks")
+ && !flowStatusMessage.equals("All Rollback flows have completed successfully")) {
+ taskName = camundaRequestHandler.getTaskName(iar.getRequestId());
+ if (taskName != null) {
+ flowStatusMessage = flowStatusMessage + " TASK INFORMATION: " + taskName;
+ }
+ }
}
}
@@ -460,6 +473,12 @@ public class OrchestrationRequests {
if (rollbackStatusMessage != null) {
status.setRollbackStatusMessage(rollbackStatusMessage);
}
+ if (version.matches("v[8-9]|v[1-9][0-9]")) {
+ if (iar.getResourceStatusMessage() != null) {
+ status.setResourceStatusMessage(iar.getResourceStatusMessage());
+ }
+ }
+
status.setExtSystemErrorSource(iar.getExtSystemErrorSource());
status.setRollbackExtSystemErrorSource(iar.getRollbackExtSystemErrorSource());
} else {
@@ -485,6 +504,13 @@ public class OrchestrationRequests {
statusMessages = "ROLLBACK STATUS: " + rollbackStatusMessage;
}
}
+ if (iar.getResourceStatusMessage() != null) {
+ if (statusMessages != null) {
+ statusMessages = statusMessages + " " + "RESOURCE STATUS: " + iar.getResourceStatusMessage();
+ } else {
+ statusMessages = "RESOURCE STATUS: " + iar.getResourceStatusMessage();
+ }
+ }
}
if (statusMessages != null) {
@@ -537,7 +563,8 @@ public class OrchestrationRequests {
}
protected boolean isRequestProcessingDataRequired(String format) {
- if (StringUtils.isNotEmpty(format) && format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLE.name())) {
+ if (StringUtils.isNotEmpty(format) && (format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLE.name())
+ || format.equalsIgnoreCase(OrchestrationRequestFormat.SIMPLENOTASKINFO.toString()))) {
return false;
} else {
return true;
@@ -574,4 +601,20 @@ public class OrchestrationRequests {
}
return infraActiveRequest;
}
+
+ protected long daysSinceRequest(InfraActiveRequests request) {
+ long startTime = request.getStartTime().getTime();
+ long now = System.currentTimeMillis();
+
+ return TimeUnit.MILLISECONDS.toDays(now - startTime);
+ }
+
+ protected int camundaCleanupInterval() {
+ String cleanupInterval = env.getProperty("mso.camundaCleanupInterval");
+ int days = 30;
+ if (cleanupInterval != null) {
+ days = Integer.parseInt(cleanupInterval);
+ }
+ return days;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java
new file mode 100644
index 0000000000..836f08adb5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java
@@ -0,0 +1,300 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.onap.so.apihandlerinfra;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import org.apache.http.HttpStatus;
+import org.json.JSONObject;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.db.request.beans.OrchestrationTask;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.logging.filter.base.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
+import org.onap.so.logger.MessageEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import javax.transaction.Transactional;
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import static org.onap.so.apihandlerinfra.Constants.MSO_PROP_APIHANDLER_INFRA;
+
+@Path("/onap/so/infra/orchestrationTasks")
+@OpenAPIDefinition(
+ info = @Info(title = "onap/so/infra/orchestrationTasks", description = "API Requests for Orchestration Task"))
+@Component
+public class OrchestrationTasks {
+
+ private static Logger logger = LoggerFactory.getLogger(OrchestrationTasks.class);
+
+ @Autowired
+ private MsoRequest msoRequest;
+
+ @Autowired
+ private CamundaRequestHandler camundaRequestHandler;
+
+ @Autowired
+ private RequestsDbClient requestsDbClient;
+
+ @Autowired
+ private ResponseBuilder builder;
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @GET
+ @Path("/{version:[vV][4-7]}/")
+ @Operation(description = "Find All Orchestrated Task", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response getAllOrchestrationTasks(@QueryParam("status") String status,
+ @PathParam("version") String version) {
+ List<OrchestrationTask> orchestrationTaskList = requestsDbClient.getAllOrchestrationTasks();
+ if (status != null && !status.isEmpty()) {
+ for (Iterator<OrchestrationTask> it = orchestrationTaskList.iterator(); it.hasNext();) {
+ OrchestrationTask task = it.next();
+ if (!status.equals(task.getStatus())) {
+ it.remove();
+ }
+ }
+ }
+ return builder.buildResponse(HttpStatus.SC_OK, null, orchestrationTaskList, version);
+ }
+
+ @GET
+ @Path("/{version:[vV][4-7]}/{taskId}")
+ @Operation(description = "Find Orchestrated Task for a given TaskId", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response getOrchestrationTask(@PathParam("taskId") String taskId, @PathParam("version") String version)
+ throws ApiException {
+ try {
+ OrchestrationTask orchestrationTask = requestsDbClient.getOrchestrationTask(taskId);
+ return builder.buildResponse(HttpStatus.SC_OK, null, orchestrationTask, version);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Lookup", e);
+ Response response =
+ msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null, version);
+ return response;
+ }
+ }
+
+ @POST
+ @Path("/{version:[vV][4-7]}/")
+ @Operation(description = "Create an Orchestrated Task", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response CreateOrchestrationTask(String requestJson, @PathParam("version") String version) {
+ try {
+ OrchestrationTask orchestrationTask = mapper.readValue(requestJson, OrchestrationTask.class);
+ requestsDbClient.createOrchestrationTask(orchestrationTask);
+ return builder.buildResponse(HttpStatus.SC_OK, null, orchestrationTask, version);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Create", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, e.getMessage(), ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB, null,
+ version);
+ return response;
+ }
+ }
+
+ @PUT
+ @Path("/{version:[vV][4-7]}/{taskId}")
+ @Operation(description = "Update an Orchestrated Task", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response UpdateOrchestrationTask(@PathParam("taskId") String taskId, String requestJson,
+ @PathParam("version") String version) {
+ try {
+ OrchestrationTask orchestrationTask = requestsDbClient.getOrchestrationTask(taskId);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Update", e);
+ Response response =
+ msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null, version);
+ return response;
+ }
+
+ try {
+ OrchestrationTask orchestrationTask = mapper.readValue(requestJson, OrchestrationTask.class);
+ requestsDbClient.updateOrchestrationTask(taskId, orchestrationTask);
+ return builder.buildResponse(HttpStatus.SC_OK, null, orchestrationTask, version);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Update", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null,
+ version);
+ return response;
+ }
+ }
+
+ @DELETE
+ @Path("/{version:[vV][4-7]}/{taskId}")
+ @Operation(description = "Delete an Orchestrated Task", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response DeleteOrchestrationTask(@PathParam("taskId") String taskId, @PathParam("version") String version) {
+ try {
+ OrchestrationTask orchestrationTask = requestsDbClient.getOrchestrationTask(taskId);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Delete", e);
+ Response response =
+ msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null, version);
+ return response;
+ }
+
+ try {
+ requestsDbClient.deleteOrchestrationTask(taskId);
+ return builder.buildResponse(HttpStatus.SC_OK, null, null, version);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Delete", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, e.getMessage(), ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB, null,
+ version);
+ return response;
+ }
+ }
+
+ @POST
+ @Path("/{version:[vV][4-7]}/{taskId}/commit")
+ @Operation(description = "Commit an Orchestrated Task", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response CommitOrchestrationTask(@PathParam("taskId") String taskId, @PathParam("version") String version) {
+ OrchestrationTask orchestrationTask;
+ try {
+ orchestrationTask = requestsDbClient.getOrchestrationTask(taskId);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Commit", e);
+ Response response =
+ msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null, version);
+ return response;
+ }
+ try {
+ String taskName = orchestrationTask.getName();
+ Map<String, String> commitVar = new HashMap<>();
+ commitVar.put("taskAction", "commit");
+ JSONObject msgJson = createMessageBody(taskId, taskName, commitVar);
+ camundaRequestHandler.sendCamundaMessages(msgJson);
+ return builder.buildResponse(HttpStatus.SC_OK, null, orchestrationTask, version);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Delete", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, e.getMessage(), ErrorNumbers.ERROR_FROM_BPEL, null, version);
+ return response;
+ }
+
+ }
+
+ @POST
+ @Path("/{version:[vV][4-7]}/{taskId}/abort")
+ @Operation(description = "Commit an Orchestrated Task", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response AbortOrchestrationTask(@PathParam("taskId") String taskId, @PathParam("version") String version) {
+ OrchestrationTask orchestrationTask;
+ try {
+ orchestrationTask = requestsDbClient.getOrchestrationTask(taskId);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Commit", e);
+ Response response =
+ msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
+ e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null, version);
+ return response;
+ }
+ try {
+ String taskName = orchestrationTask.getName();
+ Map<String, String> commitVar = new HashMap<>();
+ commitVar.put("taskAction", "abort");
+ JSONObject msgJson = createMessageBody(taskId, taskName, commitVar);
+ camundaRequestHandler.sendCamundaMessages(msgJson);
+ return builder.buildResponse(HttpStatus.SC_OK, null, orchestrationTask, version);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Delete", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, e.getMessage(), ErrorNumbers.ERROR_FROM_BPEL, null, version);
+ return response;
+ }
+
+ }
+
+ private JSONObject createMessageBody(String taskId, String taskName, Map<String, ?> variables) {
+ JSONObject msgJson = new JSONObject();
+ msgJson.put("messageName", taskName);
+ msgJson.put("businessKey", taskId);
+ JSONObject processVariables = new JSONObject();
+ for (Map.Entry<String, ?> entry : variables.entrySet()) {
+ JSONObject valueInfo = new JSONObject();
+ String key = entry.getKey();
+ Object value = entry.getValue();
+ valueInfo.put("value", value.toString());
+ valueInfo.put("type", value.getClass().getSimpleName());
+ processVariables.put(key, valueInfo);
+ }
+ msgJson.put("processVariables", processVariables);
+ return msgJson;
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
index 75b7e74d49..9b37043b2d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
@@ -76,7 +76,7 @@ import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LogConstants;
import org.onap.so.logger.MessageEnum;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
@@ -506,8 +506,8 @@ public class RequestHandlerUtils extends AbstractRestHandler {
if (instanceIdMap.get(CommonConstants.INSTANCE_GROUP_INSTANCE_ID) != null) {
currentActiveReq.setInstanceGroupId(instanceIdMap.get(CommonConstants.INSTANCE_GROUP_INSTANCE_ID));
}
- if (instanceIdMap.get("PnfId") != null) {
- currentActiveReq.setPnfId(instanceIdMap.get("PnfId"));
+ if (instanceIdMap.get("pnfName") != null) {
+ currentActiveReq.setPnfName(instanceIdMap.get("pnfName"));
}
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
index a15d9cfd48..6132815cf6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
@@ -43,7 +43,7 @@ import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.HttpHeadersConstants;
import org.onap.so.logger.LogConstants;
import org.onap.so.logger.MdcConstants;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index 33eae43e44..f1e8e711c4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
@@ -56,7 +56,7 @@ import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
index edc287ce0a..418c702768 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
@@ -50,7 +50,7 @@ import org.onap.so.apihandlerinfra.tasksbeans.TaskList;
import org.onap.so.apihandlerinfra.tasksbeans.TaskVariableValue;
import org.onap.so.apihandlerinfra.tasksbeans.TaskVariables;
import org.onap.so.apihandlerinfra.tasksbeans.TasksGetResponse;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
index 0d0e6ee92f..357497591d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
@@ -6,6 +6,8 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nordix
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -21,53 +23,39 @@
*/
package org.onap.so.apihandlerinfra;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.TreeSet;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import javax.transaction.Transactional;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Response;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
import org.apache.http.HttpStatus;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.ResponseBuilder;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
-import org.onap.so.apihandlerinfra.workflowspecificationbeans.ActivitySequence;
-import org.onap.so.apihandlerinfra.workflowspecificationbeans.ArtifactInfo;
-import org.onap.so.apihandlerinfra.workflowspecificationbeans.Validation;
-import org.onap.so.apihandlerinfra.workflowspecificationbeans.WorkflowInputParameter;
-import org.onap.so.apihandlerinfra.workflowspecificationbeans.WorkflowSpecification;
-import org.onap.so.apihandlerinfra.workflowspecificationbeans.WorkflowSpecificationList;
-import org.onap.so.apihandlerinfra.workflowspecificationbeans.WorkflowSpecifications;
-import org.onap.so.db.catalog.beans.ActivitySpec;
-import org.onap.so.db.catalog.beans.ActivitySpecUserParameters;
-import org.onap.so.db.catalog.beans.UserParameters;
-import org.onap.so.db.catalog.beans.Workflow;
-import org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence;
+import org.onap.so.apihandlerinfra.workflowspecificationbeans.*;
+import org.onap.so.db.catalog.beans.*;
import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.v3.oas.annotations.OpenAPIDefinition;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.info.Info;
-import io.swagger.v3.oas.annotations.media.ArraySchema;
-import io.swagger.v3.oas.annotations.media.Content;
-import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import javax.transaction.Transactional;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Response;
+import java.util.*;
+import java.util.stream.Collectors;
+
@Path("onap/so/infra/workflowSpecifications")
@OpenAPIDefinition(info = @Info(title = "onap/so/infra/workflowSpecifications",
@@ -84,6 +72,7 @@ public class WorkflowSpecificationsHandler {
private static Logger logger = LoggerFactory.getLogger(WorkflowSpecificationsHandler.class);
private static final String ARTIFACT_TYPE_WORKFLOW = "workflow";
private static final String NATIVE_WORKFLOW = "native";
+ private static final String EMPTY_BODY = "";
@Path("/{version:[vV]1}/workflows")
@GET
@@ -125,24 +114,29 @@ public class WorkflowSpecificationsHandler {
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Workflow::getArtifactUUID))),
ArrayList::new));
- WorkflowSpecifications workflowSpecifications = mapWorkflowsToWorkflowSpecifications(retWorkflows);
+ Optional<String> optional = getResponseByWorkflowSpec(retWorkflows);
+ return builder.buildResponse(HttpStatus.SC_OK, "", optional.isPresent() ? optional.get() : EMPTY_BODY,
+ apiVersion);
+ }
- String jsonResponse;
- try {
- ObjectMapper mapper = new ObjectMapper();
- jsonResponse = mapper.writeValueAsString(workflowSpecifications);
- } catch (JsonProcessingException e) {
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
- .build();
- ValidateException validateException =
- new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
- HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
- .errorInfo(errorLoggerInfo).build();
- throw validateException;
- }
+ @Path("/{version:[vV]1}/pnfWorkflows")
+ @GET
+ @Operation(description = "Finds pnf workflow specifications", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Transactional
+ public Response getWorkflowsSpecForPnf(@PathParam("version") String version) throws Exception {
+
+ final String pnf_resource = "pnf";
+ String apiVersion = version.substring(1);
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- return builder.buildResponse(HttpStatus.SC_OK, "", jsonResponse, apiVersion);
+ List<Workflow> workflows = catalogDbClient.findWorkflowByResourceTarget(pnf_resource);
+
+ Optional<String> optional = getResponseByWorkflowSpec(workflows);
+ return builder.buildResponse(HttpStatus.SC_OK, "", optional.isPresent() ? optional.get() : EMPTY_BODY,
+ apiVersion);
}
protected WorkflowSpecifications mapWorkflowsToWorkflowSpecifications(List<Workflow> workflows) {
@@ -165,6 +159,28 @@ public class WorkflowSpecificationsHandler {
return workflowSpecifications;
}
+ private Optional<String> getResponseByWorkflowSpec(List<Workflow> workflows) throws ValidateException {
+ WorkflowSpecifications workflowSpecifications = mapWorkflowsToWorkflowSpecifications(workflows);
+
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ return Optional.of(mapper.writeValueAsString(workflowSpecifications));
+ } catch (JsonProcessingException e) {
+ catchAndThrowValidationEx(e);
+ }
+ return Optional.empty();
+ }
+
+ private Response catchAndThrowValidationEx(JsonProcessingException e) throws ValidateException {
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).build();
+ ValidateException validateException =
+ new ValidateException.Builder("Mapping of request to JSON object failed : " + e.getMessage(),
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo)
+ .build();
+ throw validateException;
+ }
+
private ArtifactInfo buildArtifactInfo(Workflow workflow) {
ArtifactInfo artifactInfo = new ArtifactInfo();
artifactInfo.setArtifactType(ARTIFACT_TYPE_WORKFLOW);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2ESliceServiceActivateRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2ESliceServiceActivateRequest.java
new file mode 100644
index 0000000000..2fb219c182
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2ESliceServiceActivateRequest.java
@@ -0,0 +1,23 @@
+package org.onap.so.apihandlerinfra.e2eserviceinstancebeans;
+
+public class E2ESliceServiceActivateRequest {
+ private String globalSubscriberId;
+
+ private String serviceType;
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
index 344e5438c9..fee7a3a8f4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
@@ -3,7 +3,9 @@ package org.onap.so.apihandlerinfra.infra.rest;
import java.util.Optional;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.Service;
import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.Tenant;
import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
@@ -34,7 +36,6 @@ public class AAIDataRetrieval {
});
}
-
public VfModule getAAIVfModule(String vnfId, String vfModuleId) {
return this.getAaiResourcesClient()
.get(VfModule.class, AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId))
@@ -75,6 +76,24 @@ public class AAIDataRetrieval {
});
}
+ public Service getService(String serviceId) {
+ return this.getAaiResourcesClient()
+ .get(Service.class, AAIUriFactory.createResourceUri(AAIObjectType.SERVICE, serviceId)).orElseGet(() -> {
+ logger.debug("No Service found in A&AI ServiceId: {}", serviceId);
+ return null;
+ });
+ }
+
+ public Tenant getTenant(String cloudOwner, String cloudRegion, String tenantId) {
+ return this.getAaiResourcesClient()
+ .get(Tenant.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId))
+ .orElseGet(() -> {
+ logger.debug("No Tenant found in A&AI TenantId: {}", tenantId);
+ return null;
+ });
+ }
+
protected AAIResourcesClient getAaiResourcesClient() {
if (aaiResourcesClient == null) {
aaiResourcesClient = new AAIResourcesClient();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
index 20e27a5265..3fd672bf42 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
@@ -45,7 +45,7 @@ import org.onap.so.constants.Status;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LogConstants;
import org.onap.so.logger.MessageEnum;
import org.onap.so.serviceinstancebeans.ModelType;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
index 877376cc79..bb2b89ca82 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
@@ -54,7 +54,7 @@ import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
index 43f957174c..59c0694ea2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
@@ -55,7 +55,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestStatus;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
index 2f922220c9..e11635370c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
@@ -44,7 +44,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Status;
import org.onap.so.exceptions.ValidationException;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.serviceinstancebeans.RequestError;
import org.onap.so.serviceinstancebeans.ServiceException;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
index b2596f9013..398e168800 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
@@ -34,7 +34,7 @@ import org.onap.so.apihandlerinfra.tenantisolation.process.CreateVnfOperationalE
import org.onap.so.apihandlerinfra.tenantisolation.process.DeactivateVnfOperationalEnvironment;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java
index e9ce0bf99a..2df0a1ff21 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/dmaap/DmaapOperationalEnvClient.java
@@ -27,7 +27,7 @@ import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
index 65d3109445..f0943393ed 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
@@ -35,7 +35,7 @@ import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.utils.CryptoUtils;
import org.onap.logging.filter.base.ONAPComponents;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
index 0005d26016..9b24a14f68 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
@@ -42,7 +42,7 @@ import org.onap.so.client.aai.entities.Relationships;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
index 624a7f6945..77579817ff 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
@@ -43,7 +43,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java
index 3812aa9edf..e78823593e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java
@@ -31,7 +31,7 @@ import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
import org.onap.so.apihandlerinfra.tenantisolation.dmaap.DmaapOperationalEnvClient;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientObjectBuilder;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
index 5eb4a67fa6..d6969a9851 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironment.java
@@ -45,7 +45,7 @@ import org.onap.so.client.grm.beans.ServiceEndPoint;
import org.onap.so.client.grm.beans.ServiceEndPointList;
import org.onap.so.client.grm.beans.ServiceEndPointRequest;
import org.onap.so.client.grm.beans.Version;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java
index e8ea153a6a..59f7621b90 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironment.java
@@ -33,7 +33,7 @@ import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.requestsdb.RequestsDBHelper;
import org.slf4j.Logger;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java
index c05ef98fbb..01c7fd33f9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/CustomWorkflowValidation.java
@@ -29,20 +29,13 @@ import com.google.common.base.Strings;
public class CustomWorkflowValidation implements ValidationRule {
+ /**
+ * This function should be generic both for custom VNF workflow and PNF workflow
+ */
@Override
public ValidationInformation validate(ValidationInformation info) throws ValidationException {
RequestParameters requestParameters = info.getSir().getRequestDetails().getRequestParameters();
- CloudConfiguration cloudConfiguration = info.getSir().getRequestDetails().getCloudConfiguration();
- if (cloudConfiguration == null) {
- // throw new ValidationException("cloudConfiguration");
- } else if (Strings.isNullOrEmpty((cloudConfiguration.getCloudOwner()))) {
- // throw new ValidationException("cloudOwner");
- } else if (Strings.isNullOrEmpty((cloudConfiguration.getLcpCloudRegionId()))) {
- // throw new ValidationException("lcpCloudRegionId");
- } else if (Strings.isNullOrEmpty((cloudConfiguration.getTenantId()))) {
- // throw new ValidationException("tenantId");
- }
if (requestParameters == null) {
throw new ValidationException("requestParameters");
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml
index baa7af77a5..b46690f2a7 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml
@@ -30,6 +30,7 @@ mso:
uri: /sobpmnengine/history/activity-instance
camundaURL: http://localhost:8089
camundaAuth: E8E19DD16CC90D2E458E8FF9A884CC0452F8F3EB8E321F96038DE38D5C1B0B02DFAE00B88E2CF6E2A4101AB2C011FC161212EE
+ camundaCleanupInterval: 30
spring:
datasource:
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
index bc867503f2..3d80ec230e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
@@ -27,7 +27,7 @@ import org.junit.rules.ExpectedException;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.exceptions.*;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import java.io.IOException;
import java.util.LinkedList;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
index 5c78af3601..ba7fe2b9cb 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
@@ -192,11 +192,12 @@ public class InstanceManagementTest extends BaseTest {
requestReferences.setRequestSelfLink(createExpectedSelfLink("v1", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
expectedResponse.setRequestReferences(requestReferences);
uri = instanceManagementUri + "v1"
- + "/serviceInstances/5df8b6de-2083-11e7-93ae-92361f002676/pnfs/testpnfcId/workflows/81526781-e55c-4cb7-adb3-97e09d9c76bf";
+ + "/serviceInstances/5df8b6de-2083-11e7-93ae-92361f002676/pnfs/testPnfName/workflows/81526781-e55c-4cb7-adb3-97e09d9c76bf";
ResponseEntity<String> response =
sendRequest(inputStream("/ExecutePNFCustomWorkflow.json"), uri, HttpMethod.POST, headers);
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
index f1d5a5487f..d1e5dc717e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/MsoRequestTest.java
@@ -22,6 +22,7 @@ package org.onap.so.apihandlerinfra;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.doReturn;
import java.io.IOException;
import java.io.StringReader;
import java.nio.file.Files;
@@ -34,12 +35,19 @@ import javax.ws.rs.core.Response;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.http.HttpStatus;
+import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.aai.domain.yang.Service;
+import org.onap.aai.domain.yang.Tenant;
import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.infra.rest.AAIDataRetrieval;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.springframework.test.context.junit4.rules.SpringClassRule;
@@ -75,6 +83,17 @@ public class MsoRequestTest extends BaseTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
+ @Mock
+ private AAIDataRetrieval aaiDataRet;
+
+ @InjectMocks
+ private MsoRequest msoRequestMock;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ }
+
public String inputStream(String JsonInput) throws IOException {
JsonInput = "src/test/resources/MsoRequestTest" + JsonInput;
String input = new String(Files.readAllBytes(Paths.get(JsonInput)));
@@ -1056,5 +1075,37 @@ public class MsoRequestTest extends BaseTest {
assertNotNull(result);
}
+ @Test
+ public void getTenantNameFromAAITest() throws Exception {
+ this.sir = mapper.readValue(inputStream("/SuccessfulValidation/ServiceAssign.json"),
+ ServiceInstancesRequest.class);
+ String tenantId = "88a6ca3ee0394ade9403f075db23167e";
+ String tenantNameFromAAI = "testTenantName";
+ String cloudRegion = "mdt1";
+ String cloudOwner = "cloudOwner";
+ this.sir.getRequestDetails().getCloudConfiguration().setCloudOwner(cloudOwner);
+ Tenant tenant = new Tenant();
+ tenant.setTenantId(tenantId);
+ tenant.setTenantName(tenantNameFromAAI);
+ doReturn(tenant).when(aaiDataRet).getTenant(cloudOwner, cloudRegion, tenantId);
+ String tenantName = msoRequestMock.getTenantNameFromAAI(this.sir);
+ assertEquals(tenantNameFromAAI, tenantName);
+ }
+
+
+ @Test
+ public void getProductFamilyNameFromAAITest() throws Exception {
+ this.sir = mapper.readValue(inputStream("/SuccessfulValidation/ServiceAssign.json"),
+ ServiceInstancesRequest.class);
+ String serviceId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb";
+ String serviceDescription = "testServiceDescription";
+ Service service = new Service();
+ service.setServiceId(serviceId);
+ service.setServiceDescription(serviceDescription);
+ doReturn(service).when(aaiDataRet).getService(serviceId);
+ String productFamilyName = msoRequestMock.getProductFamilyNameFromAAI(this.sir);
+ assertEquals(serviceDescription, productFamilyName);
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
index 46fd2f9025..9b892af869 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
@@ -32,6 +32,7 @@ import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@@ -155,6 +156,7 @@ public class OrchestrationRequestsTest extends BaseTest {
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
assertThat(response.getBody(), sameBeanAs(testResponse).ignoring("request.startTime")
.ignoring("request.finishTime").ignoring("request.requestStatus.timeStamp"));
+ assertNull(response.getBody().getRequest().getInstanceReferences().getRequestorId());
assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
index 47aa3cccb5..3db2b2d96d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.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,9 +25,15 @@ import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.when;
+import java.sql.Timestamp;
+import java.text.SimpleDateFormat;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
import javax.ws.rs.core.Response;
import org.apache.commons.lang.StringUtils;
import org.junit.Before;
@@ -40,6 +46,7 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.apihandler.common.ResponseBuilder;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ContactCamundaException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.constants.OrchestrationRequestFormat;
import org.onap.so.constants.Status;
@@ -48,6 +55,7 @@ import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.InstanceReferences;
import org.onap.so.serviceinstancebeans.Request;
import org.onap.so.serviceinstancebeans.RequestStatus;
+import org.springframework.core.env.Environment;
@RunWith(MockitoJUnitRunner.class)
public class OrchestrationRequestsUnitTest {
@@ -61,6 +69,8 @@ public class OrchestrationRequestsUnitTest {
private Response response;
@Mock
private CamundaRequestHandler camundaRequestHandler;
+ @Mock
+ private Environment env;
@Rule
public ExpectedException thrown = ExpectedException.none();
@InjectMocks
@@ -78,6 +88,7 @@ public class OrchestrationRequestsUnitTest {
private InfraActiveRequests iar;
boolean includeCloudRequest = false;
private static final String ROLLBACK_EXT_SYSTEM_ERROR_SOURCE = "SDNC";
+ private Timestamp startTime = new Timestamp(System.currentTimeMillis());
@Before
@@ -91,6 +102,8 @@ public class OrchestrationRequestsUnitTest {
iar.setFlowStatus(FLOW_STATUS);
iar.setRollbackStatusMessage(ROLLBACK_STATUS_MESSAGE);
iar.setRetryStatusMessage(RETRY_STATUS_MESSAGE);
+ iar.setResourceStatusMessage("The vf module already exist");
+ iar.setStartTime(startTime);
}
@Test
@@ -100,8 +113,10 @@ public class OrchestrationRequestsUnitTest {
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
RequestStatus requestStatus = new RequestStatus();
requestStatus.setRequestState(iar.getRequestStatus());
- requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s",
- FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE));
+ requestStatus.setStatusMessage(
+ String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s RESOURCE STATUS: %s",
+ FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE,
+ "The vf module already exist"));
Request expected = new Request();
expected.setRequestId(REQUEST_ID);
@@ -109,11 +124,12 @@ public class OrchestrationRequestsUnitTest {
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
iar.setOriginalRequestId(ORIGINAL_REQUEST_ID);
Request result = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
- OrchestrationRequestFormat.DETAIL.toString());
+ OrchestrationRequestFormat.DETAIL.toString(), "v7");
assertThat(result, sameBeanAs(expected));
}
@@ -124,16 +140,20 @@ public class OrchestrationRequestsUnitTest {
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
RequestStatus requestStatus = new RequestStatus();
requestStatus.setRequestState(iar.getRequestStatus());
- requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s",
- FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE));
+ requestStatus.setStatusMessage(
+ String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s RESOURCE STATUS: %s",
+ FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE,
+ "The vf module already exist"));
+
Request expected = new Request();
expected.setRequestId(REQUEST_ID);
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
Request result = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
- OrchestrationRequestFormat.DETAIL.toString());
+ OrchestrationRequestFormat.DETAIL.toString(), "v7");
assertThat(result, sameBeanAs(expected));
}
@@ -144,19 +164,22 @@ public class OrchestrationRequestsUnitTest {
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
RequestStatus requestStatus = new RequestStatus();
requestStatus.setRequestState(iar.getRequestStatus());
- requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s",
- FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE));
+ requestStatus.setStatusMessage(
+ String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s RESOURCE STATUS: %s",
+ FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE,
+ "The vf module already exist"));
Request expected = new Request();
expected.setRequestId(REQUEST_ID);
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
- OrchestrationRequestFormat.DETAIL.toString());
+ OrchestrationRequestFormat.DETAIL.toString(), "v7");
assertThat(actual, sameBeanAs(expected));
}
@@ -178,34 +201,112 @@ public class OrchestrationRequestsUnitTest {
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
- OrchestrationRequestFormat.STATUSDETAIL.toString());
+ OrchestrationRequestFormat.STATUSDETAIL.toString(), "v7");
assertThat(actual, sameBeanAs(expected));
}
@Test
+ public void mapRequestStatusAndExtSysErrSrcToRequestStatusDetailV8Test() throws ApiException {
+ doReturn(null).when(camundaRequestHandler).getTaskName(REQUEST_ID);
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setExtSystemErrorSource(EXT_SYSTEM_ERROR_SOURCE);
+ requestStatus.setRollbackExtSystemErrorSource(ROLLBACK_EXT_SYSTEM_ERROR_SOURCE);
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setFlowStatus(FLOW_STATUS);
+ requestStatus.setRollbackStatusMessage(ROLLBACK_STATUS_MESSAGE);
+ requestStatus.setRetryStatusMessage(RETRY_STATUS_MESSAGE);
+ requestStatus.setResourceStatusMessage("The vf module already exist");
+
+ Request expected = new Request();
+ expected.setRequestId(REQUEST_ID);
+ expected.setInstanceReferences(instanceReferences);
+ expected.setRequestStatus(requestStatus);
+ expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
+
+ includeCloudRequest = false;
+
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.STATUSDETAIL.toString(), "v8");
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
+ public void mapRequestStatusNoTaskInfoTest() throws ApiException {
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setStatusMessage(
+ "FLOW STATUS: FlowStatus RETRY STATUS: RetryStatusMessage ROLLBACK STATUS: RollbackStatusMessage RESOURCE STATUS: The vf module already exist");
+
+ Request expected = new Request();
+ expected.setRequestId(REQUEST_ID);
+ expected.setInstanceReferences(instanceReferences);
+ expected.setRequestStatus(requestStatus);
+ expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
+
+ includeCloudRequest = false;
+
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
+ OrchestrationRequestFormat.SIMPLENOTASKINFO.toString(), "v7");
+ assertThat(expected, sameBeanAs(actual));
+ }
+
+ @Test
+ public void mapRequestStatusNullFormatTest() throws ApiException {
+ doReturn("TaskName").when(camundaRequestHandler).getTaskName(REQUEST_ID);
+ InstanceReferences instanceReferences = new InstanceReferences();
+ instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ RequestStatus requestStatus = new RequestStatus();
+ requestStatus.setRequestState(iar.getRequestStatus());
+ requestStatus.setStatusMessage(
+ "FLOW STATUS: FlowStatus TASK INFORMATION: TaskName RETRY STATUS: RetryStatusMessage ROLLBACK STATUS: RollbackStatusMessage RESOURCE STATUS: The vf module already exist");
+
+ Request expected = new Request();
+ expected.setRequestId(REQUEST_ID);
+ expected.setInstanceReferences(instanceReferences);
+ expected.setRequestStatus(requestStatus);
+ expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
+
+ includeCloudRequest = false;
+
+ Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest, null, "v7");
+ assertThat(expected, sameBeanAs(actual));
+ }
+
+ @Test
public void mapRequestStatusAndExtSysErrSrcToRequestDetailTest() throws ApiException {
doReturn("Last task executed: Call SDNC").when(camundaRequestHandler).getTaskName(REQUEST_ID);
InstanceReferences instanceReferences = new InstanceReferences();
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
RequestStatus requestStatus = new RequestStatus();
requestStatus.setRequestState(iar.getRequestStatus());
- requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s",
- FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE));
+ requestStatus.setStatusMessage(
+ String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s RESOURCE STATUS: %s",
+ FLOW_STATUS + TASK_INFORMATION, RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE,
+ "The vf module already exist"));
Request expected = new Request();
expected.setRequestId(REQUEST_ID);
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
- OrchestrationRequestFormat.DETAIL.toString());
+ OrchestrationRequestFormat.DETAIL.toString(), "v7");
assertThat(actual, sameBeanAs(expected));
}
@@ -224,12 +325,14 @@ public class OrchestrationRequestsUnitTest {
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
iar.setFlowStatus(null);
+ iar.setResourceStatusMessage(null);
Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
- OrchestrationRequestFormat.DETAIL.toString());
+ OrchestrationRequestFormat.DETAIL.toString(), "v7");
assertThat(actual, sameBeanAs(expected));
}
@@ -243,7 +346,7 @@ public class OrchestrationRequestsUnitTest {
iar.setStatusMessage("Error retrieving cloud region from AAI");
Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
- OrchestrationRequestFormat.DETAIL.toString());
+ OrchestrationRequestFormat.DETAIL.toString(), "v7");
assertTrue(actual.getRequestStatus().getStatusMessage()
.contains("Error Source: " + ROLLBACK_EXT_SYSTEM_ERROR_SOURCE));
@@ -255,20 +358,23 @@ public class OrchestrationRequestsUnitTest {
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
RequestStatus requestStatus = new RequestStatus();
requestStatus.setRequestState(iar.getRequestStatus());
- requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s",
- "Successfully completed all Building Blocks", RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE));
+ requestStatus.setStatusMessage(
+ String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s RESOURCE STATUS: %s",
+ "Successfully completed all Building Blocks", RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE,
+ "The vf module already exist"));
Request expected = new Request();
expected.setRequestId(REQUEST_ID);
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
iar.setFlowStatus("Successfully completed all Building Blocks");
Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
- OrchestrationRequestFormat.DETAIL.toString());
+ OrchestrationRequestFormat.DETAIL.toString(), "v7");
assertThat(actual, sameBeanAs(expected));
}
@@ -279,20 +385,23 @@ public class OrchestrationRequestsUnitTest {
instanceReferences.setServiceInstanceId(SERVICE_INSTANCE_ID);
RequestStatus requestStatus = new RequestStatus();
requestStatus.setRequestState(iar.getRequestStatus());
- requestStatus.setStatusMessage(String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s",
- "All Rollback flows have completed successfully", RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE));
+ requestStatus.setStatusMessage(
+ String.format("FLOW STATUS: %s RETRY STATUS: %s ROLLBACK STATUS: %s RESOURCE STATUS: %s",
+ "All Rollback flows have completed successfully", RETRY_STATUS_MESSAGE, ROLLBACK_STATUS_MESSAGE,
+ "The vf module already exist"));
Request expected = new Request();
expected.setRequestId(REQUEST_ID);
expected.setInstanceReferences(instanceReferences);
expected.setRequestStatus(requestStatus);
expected.setRequestScope(SERVICE);
+ expected.setStartTime(new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss").format(startTime) + " GMT");
includeCloudRequest = false;
iar.setFlowStatus("All Rollback flows have completed successfully");
Request actual = orchestrationRequests.mapInfraActiveRequestToRequest(iar, includeCloudRequest,
- OrchestrationRequestFormat.DETAIL.toString());
+ OrchestrationRequestFormat.DETAIL.toString(), "v7");
assertThat(actual, sameBeanAs(expected));
}
@@ -338,4 +447,41 @@ public class OrchestrationRequestsUnitTest {
orchestrationRequests.infraActiveRequestLookup(iar.getRequestId());
}
+ @Test
+ public void isRequestProcessingDataRequiredTest() {
+ boolean required = orchestrationRequests.isRequestProcessingDataRequired("simpleNoTaskInfo");
+ assertFalse(required);
+ }
+
+ @Test
+ public void taskNameLookup() throws ContactCamundaException {
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setRequestId("70debc2a-d6bc-4795-87ba-38a94d9b0b99");
+ Instant startInstant = Instant.now().minus(1, ChronoUnit.DAYS);
+ req.setStartTime(Timestamp.from(startInstant));
+ when(env.getProperty("mso.camundaCleanupInterval")).thenReturn(null);
+ when(camundaRequestHandler.getTaskName("70debc2a-d6bc-4795-87ba-38a94d9b0b99")).thenReturn("taskName");
+
+ RequestStatus requestStatus = new RequestStatus();
+ req.setFlowStatus("Building blocks 1 of 3 completed.");
+
+ orchestrationRequests.mapRequestStatusAndExtSysErrSrcToRequest(req, requestStatus, null, "v7");
+ assertEquals("FLOW STATUS: Building blocks 1 of 3 completed. TASK INFORMATION: taskName",
+ requestStatus.getStatusMessage());
+ }
+
+ @Test
+ public void noCamundaLookupAfterInterval() throws ContactCamundaException {
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setRequestId("70debc2a-d6bc-4795-87ba-38a94d9b0b99");
+ Instant startInstant = Instant.now().minus(36, ChronoUnit.DAYS);
+ req.setStartTime(Timestamp.from(startInstant));
+ when(env.getProperty("mso.camundaCleanupInterval")).thenReturn("35");
+
+ RequestStatus requestStatus = new RequestStatus();
+ req.setFlowStatus("Building blocks 1 of 3 completed.");
+
+ orchestrationRequests.mapRequestStatusAndExtSysErrSrcToRequest(req, requestStatus, null, "v7");
+ assertEquals("FLOW STATUS: Building blocks 1 of 3 completed.", requestStatus.getStatusMessage());
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index f566628ee3..1332ffd913 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -441,6 +441,10 @@ public class ServiceInstancesTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK)));
+
wireMockServer.stubFor(get(urlMatching(".*/service/search/.*"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
@@ -483,6 +487,10 @@ public class ServiceInstancesTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK)));
+
wireMockServer.stubFor(get(urlMatching(".*/service/search/.*"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
@@ -524,6 +532,10 @@ public class ServiceInstancesTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK)));
+
wireMockServer.stubFor(get(urlMatching(".*/service/search/.*"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
@@ -1939,6 +1951,10 @@ public class ServiceInstancesTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK)));
+
wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceRecipe)).withStatus(HttpStatus.SC_OK)));
@@ -2114,6 +2130,10 @@ public class ServiceInstancesTest extends BaseTest {
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(get(urlMatching(".*/service-design-and-creation/services/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("/aai/ServiceFromAAI.json").withStatus(HttpStatus.SC_OK)));
+
wireMockServer.stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(serviceRecipe)).withStatus(HttpStatus.SC_OK)));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
index 7af92cb8ef..21e6d53c14 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2020 Nordix
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -20,30 +22,15 @@
package org.onap.so.apihandlerinfra;
-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.urlMatching;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.List;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.json.JSONException;
import org.junit.Test;
import org.onap.so.apihandlerinfra.workflowspecificationbeans.WorkflowInputParameter;
import org.onap.so.apihandlerinfra.workflowspecificationbeans.WorkflowSpecifications;
-import org.onap.so.db.catalog.beans.ActivitySpec;
-import org.onap.so.db.catalog.beans.ActivitySpecUserParameters;
-import org.onap.so.db.catalog.beans.UserParameters;
-import org.onap.so.db.catalog.beans.Workflow;
-import org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence;
+import org.onap.so.db.catalog.beans.*;
import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -53,10 +40,19 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.util.UriComponentsBuilder;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
public class WorkflowSpecificationsHandlerTest extends BaseTest {
@Autowired
@@ -65,12 +61,13 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
@Value("${wiremock.server.port}")
private String wiremockPort;
- private final String basePath = "onap/so/infra/workflowSpecifications/v1/workflows";
+ private final String basePath = "onap/so/infra/workflowSpecifications";
@Test
public void queryWorkflowSpecificationsByVnfModelUUID_Test_Success()
throws ParseException, JSONException, JsonParseException, JsonMappingException, IOException {
+ final String urlPath = basePath + "/v1/workflows";
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
@@ -147,7 +144,7 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
.withBody(getWiremockResponseForCatalogdb("UserParameters6_Response.json"))
.withStatus(org.apache.http.HttpStatus.SC_OK)));
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath))
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(urlPath))
.queryParam("vnfModelVersionId", "b5fa707a-f55a-11e7-a796-005056856d52");
ResponseEntity<String> response =
@@ -174,7 +171,7 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
@Test
public void mapWorkflowsToWorkflowSpecifications_Test_Success() throws Exception {
- List<Workflow> workflows = new ArrayList<Workflow>();
+ List<Workflow> workflows = new ArrayList<>();
Workflow workflow = new Workflow();
workflow.setArtifactUUID("ab6478e4-ea33-3346-ac12-ab121484a333");
workflow.setArtifactName("inPlaceSoftwareUpdate-1_0.bpmn");
@@ -267,8 +264,7 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
activitySpecUserParameter6.setUserParameters(userParameter6);
activitySpecUserParameters.add(activitySpecUserParameter6);
- List<WorkflowActivitySpecSequence> workflowActivitySpecSequences =
- new ArrayList<WorkflowActivitySpecSequence>();
+ List<WorkflowActivitySpecSequence> workflowActivitySpecSequences = new ArrayList<>();
ActivitySpec activitySpec1 = new ActivitySpec();
activitySpec1.setName("VNFQuiesceTrafficActivity");
@@ -325,9 +321,9 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
}
@Test
- public void queryWorkflowSpecificationsByPnfModelUUID_Test_Success()
- throws ParseException, JSONException, JsonParseException, JsonMappingException, IOException {
+ public void queryWorkflowSpecificationsByPnfModelUUID_Test_Success() throws JSONException, IOException {
+ final String urlPath = basePath + "/v1/workflows";
HttpHeaders headers = new HttpHeaders();
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
@@ -345,7 +341,7 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
.withBody(getWiremockResponseForCatalogdb("Empty_workflowActivitySpecSequence_Response.json"))
.withStatus(org.apache.http.HttpStatus.SC_OK)));
- UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath))
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(urlPath))
.queryParam("pnfModelVersionId", "f2d1f2b2-88bb-49da-b716-36ae420ccbff");
ResponseEntity<String> response =
@@ -370,6 +366,54 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0));
}
+ @Test
+ public void testWorkflowSpecificationsForPnf_Success() throws JSONException, IOException {
+
+ final String urlPath = basePath + "/v1/pnfWorkflows";
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ HttpEntity<String> entity = new HttpEntity(null, headers);
+
+ wireMockServer.stubFor(get(urlMatching("/workflow/search/findByResourceTarget[?]resource_target=pnf"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(
+ getWiremockResponseForCatalogdb("WorkflowSpecificationsForPnfWorkflows_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ wireMockServer.stubFor(get(urlMatching("/infraActiveRequests.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ wireMockServer.stubFor(get(urlMatching("/workflow/1/workflowActivitySpecSequence"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("Empty_workflowActivitySpecSequence_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(urlPath));
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+
+ WorkflowSpecifications expectedResponse = mapper.readValue(
+ new String(Files.readAllBytes(
+ Paths.get("src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json"))),
+ WorkflowSpecifications.class);
+ WorkflowSpecifications realResponse = mapper.readValue(response.getBody(), WorkflowSpecifications.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(expectedResponse, sameBeanAs(realResponse));
+ assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
+ assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
+ assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
+ assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0));
+ }
+
private String getWiremockResponseForCatalogdb(String file) {
try {
File resource = ResourceUtils.getFile("classpath:__files/catalogdb/" + file);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java
index 8d8f4969d7..0f096ee374 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java
@@ -46,7 +46,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestInfo;
import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters;
import org.onap.so.client.aai.AAIVersion;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.springframework.beans.factory.annotation.Autowired;
import com.fasterxml.jackson.core.JsonProcessingException;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
index 96fed36d45..3b2eca7ce2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
@@ -61,7 +61,7 @@
},
"requestStatus": {
"requestState": "COMPLETE",
- "statusMessage": "STATUS: Vf Module has been deleted successfully. FLOW STATUS: Building blocks 1 of 3 completed. TASK INFORMATION: Last task executed: BB to Execute ROLLBACK STATUS: Rollback has been completed successfully.",
+ "statusMessage": "STATUS: Vf Module has been deleted successfully. FLOW STATUS: Building blocks 1 of 3 completed. ROLLBACK STATUS: Rollback has been completed successfully.",
"percentProgress": 100,
"timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
index 801841313a..baddb21617 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
@@ -58,7 +58,7 @@
},
"requestStatus":{
"requestState":"PENDING",
- "statusMessage":"FLOW STATUS: Building blocks 1 of 3 completed. TASK INFORMATION: Last task executed: BB to Execute RETRY STATUS: Retry 2/5 will be started in 8 min. ROLLBACK STATUS: Rollback has been completed successfully.",
+ "statusMessage":"FLOW STATUS: Building blocks 1 of 3 completed. RETRY STATUS: Retry 2/5 will be started in 8 min. ROLLBACK STATUS: Rollback has been completed successfully.",
"percentProgress":0,
"timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
}
@@ -321,7 +321,7 @@
},
"requestStatus":{
"requestState":"PENDING",
- "statusMessage":"STATUS: Adding members. FLOW STATUS: Building blocks 1 of 3 completed. TASK INFORMATION: Last task executed: BB to Execute RETRY STATUS: Retry 2/5 will be started in 8 min. ROLLBACK STATUS: Rollback has been completed successfully.",
+ "statusMessage":"STATUS: Adding members. FLOW STATUS: Building blocks 1 of 3 completed. RETRY STATUS: Retry 2/5 will be started in 8 min. ROLLBACK STATUS: Rollback has been completed successfully.",
"percentProgress":0,
"timestamp": "Thu, 22 Dec 2016 08:30:28 GMT"
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json
index 8953dfdfe0..e50aed7a33 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequest.json
@@ -37,7 +37,7 @@
"networkId": null,
"networkName": null,
"networkType": null,
- "requestorId": null,
+ "requestorId": "xxxxxx",
"configurationId": null,
"configurationName": null,
"operationalEnvId": null,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json
index 63021b611f..09f94b61a4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecutePNFCustomWorkflow.json
@@ -1,20 +1,47 @@
{
- "requestDetails": {
- "requestParameters": {
- "userParams": [{
- "nrmObj": {
- "EUtranGenericCell" : [
- {"cellLocalId":1, "pci":5},
- {"cellLocalId":2, "pci":6}
- ],
- "ExternalEUtranCell" : [
- {"cellLocalId":3, "eNBId": "x"},
- {"cellLocalId":4, "eNBId": "y"}
- ],
- "EUtranRelation": [{"scellLocalId":5, "tcellLocalId":6}]
- }
- }],
- "payload": "[{\"GNBDUFunction\":{\"gNBId\":1,\"gNBDUId\":5}}]"
- }
- }
+ "requestDetails":{
+ "subscriberInfo":{
+ "globalSubscriberId":"Test"
+ },
+ "requestInfo":{
+ "suppressRollback": false,
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "requestorId": "tester",
+ "instanceName":"testInstanceName",
+ "source":"test"
+ },
+ "cloudConfiguration":{
+ "lcpCloudRegionId": "RegionOne",
+ "tenantId": "7320ec4a5b9d4589ba7c4412ccfd290f",
+ "cloudOwner": "CloudOwner"
+ },
+ "requestParameters":{
+ "subscriptionServiceType": "test",
+ "userParams":[
+ {
+ "name": "key1",
+ "value": "val1"
+ },
+ {
+ "name": "key2",
+ "value": "val2"
+ }],
+ "aLaCarte": false,
+ "payload": "{\"k1\": \"v1\"}"
+ },
+ "project":{
+ "projectName": "Test"
+ },
+ "owningEntity":{
+ "owningEntityId":"67f2e84c-734d-4e90-a1e4-d2ffa2e75849",
+ "owningEntityName":"OE-Test"
+ },
+ "modelInfo":{
+ "modelVersion": "2.0",
+ "modelVersionId": "test-version-id",
+ "modelInvariantId": "test-invariantUUID",
+ "modelName": "test-name",
+ "modelType": "pnf"
+ }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/ServiceFromAAI.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/ServiceFromAAI.json
new file mode 100644
index 0000000000..f0d511789f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/aai/ServiceFromAAI.json
@@ -0,0 +1,4 @@
+{
+ "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "service-description": "testServiceDescription"
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json
index 89675e8f02..6779c1f3e4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json
@@ -2,4 +2,4 @@
"_embedded": {
"workflowActivitySpecSequence": []
}
-}
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json
index 257b9dc843..b5b93873c8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json
@@ -17,4 +17,4 @@
}
}
]
-}
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfWorkflows_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfWorkflows_Response.json
new file mode 100644
index 0000000000..2447617897
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfWorkflows_Response.json
@@ -0,0 +1,41 @@
+{
+ "_embedded": {
+ "workflow": [
+ {
+ "artifactChecksum": "MANUAL RECORD",
+ "artifactName": "DummyPnfWorkflow",
+ "artifactUUID": "b2fd5627-55e4-4f4f-8064-9e6f443e9152",
+ "body": null,
+ "created": "2020-02-18T08:28:15.000+0000",
+ "description": "Dummy Pnf Workflow to test custom Pnf workflow",
+ "id": 4,
+ "name": "Dummy Pnf Workflow",
+ "operationName": "DummyPnfWorkflow",
+ "pnfResourceWorkflow": null,
+ "resourceTarget": "pnf",
+ "source": "native",
+ "timeoutMinutes": null,
+ "version": 1.0,
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/workflow/search/findByResourceTarget?resource_target=pnf"
+ },
+ "workflow": {
+ "href": "http://localhost:8090/workflow/4"
+ },
+ "workflowActivitySpecSequence": {
+ "href": "http://localhost:8090/workflow/4/workflowActivitySpecSequence"
+ }
+ }
+ }
+ ]
+ },
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/workflow/search/findByResourceTarget?resource_target=pnf"
+ },
+ "workflowActivitySpecSequence": {
+ "href": "http://localhost:8090/workflow/4/workflowActivitySpecSequence"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
index 050780c9a2..19855bc85e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
@@ -1262,7 +1262,7 @@ CREATE TABLE `infra_active_requests` (
`END_TIME` datetime DEFAULT NULL,
`SOURCE` varchar(45) DEFAULT NULL,
`VNF_ID` varchar(45) DEFAULT NULL,
- `PNF_ID` varchar(45) DEFAULT NULL,
+ `PNF_NAME` varchar(45) DEFAULT NULL,
`VNF_NAME` varchar(80) DEFAULT NULL,
`VNF_TYPE` varchar(200) DEFAULT NULL,
`SERVICE_TYPE` varchar(45) DEFAULT NULL,
@@ -1297,6 +1297,9 @@ CREATE TABLE `infra_active_requests` (
`ORIGINAL_REQUEST_ID` varchar(45) DEFAULT NULL,
`EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL,
`ROLLBACK_EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL,
+ `TENANT_NAME` varchar(200) DEFAULT NULL,
+ `PRODUCT_FAMILY_NAME` varchar(200) DEFAULT NULL,
+ `RESOURCE_STATUS_MESSAGE` longtext,
PRIMARY KEY (`REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
@@ -1340,6 +1343,7 @@ CREATE TABLE `archived_infra_requests` (
`OPERATIONAL_ENV_ID` varchar(45) DEFAULT NULL,
`OPERATIONAL_ENV_NAME` varchar(200) DEFAULT NULL,
`REQUEST_URL` varchar(500) DEFAULT NULL,
+ `RESOURCE_STATUS_MESSAGE` longtext,
PRIMARY KEY (`REQUEST_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
diff --git a/mso-api-handlers/mso-requests-db-repositories/pom.xml b/mso-api-handlers/mso-requests-db-repositories/pom.xml
index 4dbf22cd87..efc81384d4 100644
--- a/mso-api-handlers/mso-requests-db-repositories/pom.xml
+++ b/mso-api-handlers/mso-requests-db-repositories/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>mso-api-handlers</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>mso-requests-db-repositories</artifactId>
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
index bba0ad4696..b669b7d837 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
@@ -245,8 +245,8 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
mapKey = "serviceInstanceName";
} else if ("vnfInstanceId".equalsIgnoreCase(mapKey)) {
mapKey = "vnfId";
- } else if ("pnfId".equalsIgnoreCase(mapKey)) {
- mapKey = "pnfId";
+ } else if ("pnfName".equalsIgnoreCase(mapKey)) {
+ mapKey = "pnfName";
} else if ("vnfInstanceName".equalsIgnoreCase(mapKey)) {
mapKey = "vnfName";
} else if ("vfModuleInstanceId".equalsIgnoreCase(mapKey)) {
@@ -277,17 +277,22 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
mapKey = "startTime";
}
+ final String operator = entry.getValue().get(0);
final String propertyValue = entry.getValue().get(1);
if ("startTime".equals(mapKey)) {
final SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy");
try {
final Date thisDate = format.parse(propertyValue);
final Timestamp minTime = new Timestamp(thisDate.getTime());
- final Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1));
+ Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1));
- if ("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) {
+ if ("DOES_NOT_EQUAL".equalsIgnoreCase(operator)) {
predicates.add(cb.or(cb.lessThan(tableRoot.get(mapKey), minTime),
cb.greaterThanOrEqualTo(tableRoot.get(mapKey), maxTime)));
+ } else if ("BETWEEN_DATES".equalsIgnoreCase(operator)) {
+ Date endDate = format.parse(entry.getValue().get(2));
+ maxTime = new Timestamp(endDate.getTime());
+ predicates.add(cb.between(tableRoot.get(mapKey), minTime, maxTime));
} else {
predicates.add(cb.between(tableRoot.get(mapKey), minTime, maxTime));
}
@@ -295,7 +300,7 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
logger.debug("Exception in getOrchestrationFiltersFromInfraActive(): {}", e.getMessage(), e);
return null;
}
- } else if ("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) {
+ } else if ("DOES_NOT_EQUAL".equalsIgnoreCase(operator)) {
predicates.add(cb.notEqual(tableRoot.get(mapKey), propertyValue));
} else {
predicates.add(cb.equal(tableRoot.get(mapKey), propertyValue));
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InstanceNfvoMappingRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InstanceNfvoMappingRepository.java
new file mode 100644
index 0000000000..2e2c0872b6
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InstanceNfvoMappingRepository.java
@@ -0,0 +1,28 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.db.request.data.repository;
+
+import org.onap.so.db.request.beans.InstanceNfvoMapping;
+import org.onap.so.db.request.beans.OperationStatus;
+import org.onap.so.db.request.beans.OperationStatusId;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource(collectionResourceRel = "instanceNfvoMapping", path = "instanceNfvoMapping")
+public interface InstanceNfvoMappingRepository extends JpaRepository<InstanceNfvoMapping, String> {
+
+ public InstanceNfvoMapping findOneByInstanceId(String instanceId);
+
+ public InstanceNfvoMapping findOneByJobId(String jobId);
+
+}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OrchestrationTaskTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OrchestrationTaskTest.java
new file mode 100644
index 0000000000..0b2aae6730
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OrchestrationTaskTest.java
@@ -0,0 +1,75 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.onap.so.db.request;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.TestApplication;
+import org.onap.so.db.request.beans.OrchestrationTask;
+import org.onap.so.db.request.data.repository.OrchestrationTaskRepository;
+import org.onap.so.db.request.exceptions.NoEntityFoundException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+import javax.transaction.Transactional;
+import java.util.Date;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class OrchestrationTaskTest {
+
+ @Autowired
+ private OrchestrationTaskRepository repository;
+
+ @Test
+ @Transactional
+ public void timeStampCreated() throws NoEntityFoundException {
+
+ final String testTaskId = "test-task-id";
+ final String testRequestId = "test-request-id";
+ final String testTaskName = "test-task-name";
+ final String testTaskStatus = "test-task-status";
+ final String testIsManual = "test-is-manual";
+ OrchestrationTask task = new OrchestrationTask();
+
+ task.setTaskId(testTaskId);
+ task.setRequestId(testRequestId);
+ task.setName(testTaskName);
+ task.setStatus(testTaskStatus);
+ task.setIsManual(testIsManual);
+ repository.saveAndFlush(task);
+
+ OrchestrationTask found =
+ repository.findById(testTaskId).orElseThrow(() -> new NoEntityFoundException("Cannot Find Task"));
+
+ Date createdTime = found.getCreatedTime();
+ assertNotNull(createdTime);
+ assertEquals(testTaskId, found.getTaskId());
+ assertEquals(testRequestId, found.getRequestId());
+ assertEquals(testTaskName, found.getName());
+ assertEquals(testTaskStatus, found.getStatus());
+ assertEquals(testIsManual, found.getIsManual());
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java
index 3df30c0f49..070457d9f1 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java
@@ -19,26 +19,6 @@
*/
package org.onap.so.db.request.data.repository;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.REQUEST_ID;
-import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.SERVICE_INSTANCE_ID;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.TestApplication;
@@ -47,6 +27,22 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.REQUEST_ID;
+import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.SERVICE_INSTANCE_ID;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@@ -171,4 +167,13 @@ public class InfraActiveRequestsRepositoryImplTest {
actualRequests.stream().map(item -> item.getServiceInstanceName()).collect(Collectors.joining(",")));
}
+ @Test
+ public void test_getOrchestrationFiltersFromInfraActive_between_dates() {
+ Map<String, List<String>> orchestrationMap = new HashMap<>();
+ orchestrationMap.put("startTime", Arrays.asList("BETWEEN_DATES", "12-01-2018", "12-31-2018"));
+ List<InfraActiveRequests> result = objUnderTest.getOrchestrationFiltersFromInfraActive(orchestrationMap);
+
+ assertEquals(1, result.size());
+ }
+
}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
index 4f6c19f4d0..4c376c7af8 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
@@ -64,7 +64,7 @@ CREATE TABLE IF NOT EXISTS PUBLIC.INFRA_ACTIVE_REQUESTS(
END_TIME VARCHAR,
SOURCE VARCHAR SELECTIVITY 2,
VNF_ID VARCHAR SELECTIVITY 15,
- PNF_ID VARCHAR SELECTIVITY 15,
+ PNF_NAME VARCHAR SELECTIVITY 15,
VNF_NAME VARCHAR SELECTIVITY 11,
VNF_TYPE VARCHAR SELECTIVITY 5,
SERVICE_TYPE VARCHAR SELECTIVITY 1,
@@ -100,7 +100,11 @@ CREATE TABLE IF NOT EXISTS PUBLIC.INFRA_ACTIVE_REQUESTS(
REQUEST_URL VARCHAR SELECTIVITY 1,
ORIGINAL_REQUEST_ID VARCHAR SELECTIVITY 1,
EXT_SYSTEM_ERROR_SOURCE VARCHAR SELECTIVITY 1,
- ROLLBACK_EXT_SYSTEM_ERROR_SOURCE VARCHAR SELECTIVITY 1
+ ROLLBACK_EXT_SYSTEM_ERROR_SOURCE VARCHAR SELECTIVITY 1,
+ TENANT_NAME VARCHAR SELECTIVITY 1,
+ PRODUCT_FAMILY_NAME VARCHAR SELECTIVITY 1,
+ RESOURCE_STATUS_MESSAGE VARCHAR SELECTIVITY 36
+
);
INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, TENANT_ID, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
@@ -115,6 +119,7 @@ INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, REQUEST_STATUS, STATUS_MESS
('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"MSOTADevInfra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarte":false},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, 'mtn6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances');
INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, REQUEST_STATUS, START_TIME, END_TIME, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME ) VALUES
+('abc506af-7d09-41e2-9aa8-42b326414510', 'FAILED', '2018-12-24 13:37:00', null, '842be4e5-419d-4b51-a077-895dd16d6653', 'ShouldReturnInDatesQuery'),
('a5294d37-21db-4e3a-ae04-57412adcb4ac', 'COMPLETE', '2019-01-01 12:45:00', '2019-01-01 12:50:00', 'f7712652-b516-4925-a243-64550d26fd84', 'ShouldReturnInSearchQuery_1'),
('9383dc81-7a6c-4673-8082-650d50a82a1a', 'IN_PROGRESS', '2019-01-01 12:55:00', null, 'f7712652-b516-4925-a243-64550d26fd84', 'ShouldReturnInSearchQuery_2'),
('a1abeab2-f8ef-43ab-b76c-9c3c2cb9980f', 'FAILED', '2019-01-01 13:00:00', '2019-01-01 14:00:00', 'f7712652-b516-4925-a243-64550d26fd84', 'ShouldReturnInSearchQuery_3'),
@@ -169,7 +174,10 @@ CREATE CACHED TABLE PUBLIC.ARCHIVED_INFRA_REQUESTS(
OPERATIONAL_ENV_NAME VARCHAR SELECTIVITY 1,
INSTANCE_GROUP_ID VARCHAR SELECTIVITY 1,
INSTANCE_GROUP_NAME VARCHAR SELECTIVITY 1,
- REQUEST_URL VARCHAR SELECTIVITY 1
+ REQUEST_URL VARCHAR SELECTIVITY 1,
+ TENANT_NAME VARCHAR SELECTIVITY 1,
+ PRODUCT_FAMILY_NAME VARCHAR SELECTIVITY 1,
+ RESOURCE_STATUS_MESSAGE VARCHAR SELECTIVITY 36
);
CREATE TABLE IF NOT EXISTS cloud_api_requests(
@@ -246,14 +254,14 @@ CREATE CACHED TABLE PUBLIC.WATCHDOG_SERVICE_MOD_VER_ID_LOOKUP(
INSERT INTO PUBLIC.WATCHDOG_SERVICE_MOD_VER_ID_LOOKUP(DISTRIBUTION_ID, SERVICE_MODEL_VERSION_ID, CREATE_TIME, MODIFY_TIME) VALUES
('1533c4bd-a3e3-493f-a16d-28c20614415e', '7e813ab5-88d3-4fcb-86c0-498c5d7eef9a', '2017-11-30 15:48:08', '2017-11-30 15:48:08'),
('55429711-809b-4a3b-9ee5-5120d46d9de0', 'cc031e75-4442-4d1a-b774-8a2b434e0a50', '2017-11-30 16:35:36', '2017-11-30 16:35:36'),
-('67f0b2d1-9013-4b2b-9914-bbe2288284fb', 'eade1e9d-c1ec-4ef3-bc31-60570fba1573', '2017-11-30 15:54:39', '2017-11-30 15:54:39');
+('67f0b2d1-9013-4b2b-9914-bbe2288284fb', 'eade1e9d-c1ec-4ef3-bc31-60570fba1573', '2017-11-30 15:54:39', '2017-11-30 15:54:39');
-ALTER TABLE PUBLIC.INFRA_ACTIVE_REQUESTS ADD CONSTRAINT PUBLIC.CONSTRAINT_E PRIMARY KEY(REQUEST_ID);
-ALTER TABLE PUBLIC.SITE_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_C PRIMARY KEY(SITE_NAME);
+ALTER TABLE PUBLIC.INFRA_ACTIVE_REQUESTS ADD CONSTRAINT PUBLIC.CONSTRAINT_E PRIMARY KEY(REQUEST_ID);
+ALTER TABLE PUBLIC.SITE_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_C PRIMARY KEY(SITE_NAME);
ALTER TABLE PUBLIC.WATCHDOG_DISTRIBUTIONID_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_7 PRIMARY KEY(DISTRIBUTION_ID);
ALTER TABLE PUBLIC.WATCHDOG_PER_COMPONENT_DISTRIBUTION_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_D PRIMARY KEY(DISTRIBUTION_ID, COMPONENT_NAME);
-ALTER TABLE PUBLIC.WATCHDOG_SERVICE_MOD_VER_ID_LOOKUP ADD CONSTRAINT PUBLIC.CONSTRAINT_6 PRIMARY KEY(DISTRIBUTION_ID, SERVICE_MODEL_VERSION_ID);
-ALTER TABLE PUBLIC.WATCHDOG_PER_COMPONENT_DISTRIBUTION_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_DE FOREIGN KEY(DISTRIBUTION_ID) REFERENCES PUBLIC.WATCHDOG_DISTRIBUTIONID_STATUS(DISTRIBUTION_ID) NOCHECK;
+ALTER TABLE PUBLIC.WATCHDOG_SERVICE_MOD_VER_ID_LOOKUP ADD CONSTRAINT PUBLIC.CONSTRAINT_6 PRIMARY KEY(DISTRIBUTION_ID, SERVICE_MODEL_VERSION_ID);
+ALTER TABLE PUBLIC.WATCHDOG_PER_COMPONENT_DISTRIBUTION_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_DE FOREIGN KEY(DISTRIBUTION_ID) REFERENCES PUBLIC.WATCHDOG_DISTRIBUTIONID_STATUS(DISTRIBUTION_ID) NOCHECK;
CREATE TABLE `orchestration_task` (
`TASK_ID` varchar(200) NOT NULL,
diff --git a/mso-api-handlers/mso-requests-db/pom.xml b/mso-api-handlers/mso-requests-db/pom.xml
index 031f86282a..37bb4175a5 100644
--- a/mso-api-handlers/mso-requests-db/pom.xml
+++ b/mso-api-handlers/mso-requests-db/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>mso-api-handlers</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>mso-requests-db</artifactId>
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
index 5848f3b3d9..750fa13c77 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
@@ -72,15 +72,15 @@ public class InfraActiveRequests extends InfraRequests {
.append("statusMessage", getStatusMessage()).append("progress", getProgress())
.append("startTime", getStartTime()).append("endTime", getEndTime()).append("source", getSource())
.append("vnfId", getVnfId()).append("vnfName", getVnfName()).append("vnfType", getVnfType())
- .append("pnfId", getPnfId()).append("serviceType", getServiceType()).append("tenantId", getTenantId())
- .append("vnfParams", getVnfParams()).append("vnfOutputs", getVnfOutputs())
- .append("requestBody", getRequestBody()).append("responseBody", getResponseBody())
- .append("lastModifiedBy", getLastModifiedBy()).append("modifyTime", getModifyTime())
- .append("volumeGroupId", getVolumeGroupId()).append("volumeGroupName", getVolumeGroupName())
- .append("vfModuleId", getVfModuleId()).append("vfModuleName", getVfModuleName())
- .append("vfModuleModelName", getVfModuleModelName()).append("CloudRegion", getCloudRegion())
- .append("callBackUrl", getCallBackUrl()).append("correlator", getCorrelator())
- .append("serviceInstanceId", getServiceInstanceId())
+ .append("pnfName", getPnfName()).append("serviceType", getServiceType())
+ .append("tenantId", getTenantId()).append("vnfParams", getVnfParams())
+ .append("vnfOutputs", getVnfOutputs()).append("requestBody", getRequestBody())
+ .append("responseBody", getResponseBody()).append("lastModifiedBy", getLastModifiedBy())
+ .append("modifyTime", getModifyTime()).append("volumeGroupId", getVolumeGroupId())
+ .append("volumeGroupName", getVolumeGroupName()).append("vfModuleId", getVfModuleId())
+ .append("vfModuleName", getVfModuleName()).append("vfModuleModelName", getVfModuleModelName())
+ .append("CloudRegion", getCloudRegion()).append("callBackUrl", getCallBackUrl())
+ .append("correlator", getCorrelator()).append("serviceInstanceId", getServiceInstanceId())
.append("serviceInstanceName", getServiceInstanceName()).append("requestScope", getRequestScope())
.append("requestAction", getRequestAction()).append("networkId", getNetworkId())
.append("networkName", getNetworkName()).append("networkType", getNetworkType())
@@ -89,6 +89,7 @@ public class InfraActiveRequests extends InfraRequests {
.append("operationalEnvName", getOperationalEnvName()).append("requestUrl", getRequestUrl())
.append("originalRequestId", getOriginalRequestId())
.append("extSystemErrorSource", getExtSystemErrorSource())
- .append("rollbackExtSystemErrorSource", getRollbackExtSystemErrorSource()).toString();
+ .append("rollbackExtSystemErrorSource", getRollbackExtSystemErrorSource())
+ .append("tenantName", getTenantName()).append("productFamilyName", getProductFamilyName()).toString();
}
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
index 8f798a207c..a6d6af8a07 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/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.
@@ -55,6 +55,8 @@ public abstract class InfraRequests implements java.io.Serializable {
private String requestId;
@Column(name = "REQUEST_STATUS", length = 20)
private String requestStatus;
+ @Column(name = "RESOURCE_STATUS_MESSAGE", length = 2000)
+ private String resourceStatusMessage;
@Column(name = "STATUS_MESSAGE", length = 2000)
private String statusMessage;
@Column(name = "ROLLBACK_STATUS_MESSAGE", length = 2000)
@@ -74,8 +76,8 @@ public abstract class InfraRequests implements java.io.Serializable {
private String source;
@Column(name = "VNF_ID", length = 45)
private String vnfId;
- @Column(name = "PNF_ID", length = 45)
- private String pnfId;
+ @Column(name = "PNF_NAME", length = 45)
+ private String pnfName;
@Column(name = "VNF_NAME", length = 80)
private String vnfName;
@Column(name = "VNF_TYPE", length = 200)
@@ -149,6 +151,10 @@ public abstract class InfraRequests implements java.io.Serializable {
private String extSystemErrorSource;
@Column(name = "ROLLBACK_EXT_SYSTEM_ERROR_SOURCE", length = 80)
private String rollbackExtSystemErrorSource;
+ @Column(name = "TENANT_NAME", length = 80)
+ private String tenantName;
+ @Column(name = "PRODUCT_FAMILY_NAME", length = 80)
+ private String productFamilyName;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name = "SO_REQUEST_ID", referencedColumnName = "REQUEST_ID", updatable = false)
@@ -175,6 +181,14 @@ public abstract class InfraRequests implements java.io.Serializable {
this.requestStatus = requestStatus;
}
+ public String getResourceStatusMessage() {
+ return resourceStatusMessage;
+ }
+
+ public void setResourceStatusMessage(String resourceStatusMessage) {
+ this.resourceStatusMessage = resourceStatusMessage;
+ }
+
public String getStatusMessage() {
return this.statusMessage;
}
@@ -249,12 +263,12 @@ public abstract class InfraRequests implements java.io.Serializable {
this.vnfId = vnfId;
}
- public String getPnfId() {
- return this.pnfId;
+ public String getPnfName() {
+ return this.pnfName;
}
- public void setPnfId(String pnfId) {
- this.pnfId = pnfId;
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
}
public String getVnfName() {
@@ -550,6 +564,22 @@ public abstract class InfraRequests implements java.io.Serializable {
this.rollbackExtSystemErrorSource = rollbackExtSystemErrorSource;
}
+ public String getTenantName() {
+ return tenantName;
+ }
+
+ public void setTenantName(String tenantName) {
+ this.tenantName = tenantName;
+ }
+
+ public String getProductFamilyName() {
+ return productFamilyName;
+ }
+
+ public void setProductFamilyName(String productFamilyName) {
+ this.productFamilyName = productFamilyName;
+ }
+
@PrePersist
protected void onCreate() {
if (requestScope == null)
@@ -588,11 +618,12 @@ public abstract class InfraRequests implements java.io.Serializable {
@Override
public String toString() {
return new ToStringBuilder(this).append("requestId", getRequestId()).append("requestStatus", getRequestStatus())
- .append("statusMessage", getStatusMessage()).append("rollbackStatusMessage", getRollbackStatusMessage())
- .append("flowStatus", getFlowStatus()).append("retryStatusMessage", getRetryStatusMessage())
- .append("progress", getProgress()).append("startTime", getStartTime()).append("endTime", getEndTime())
- .append("source", getSource()).append("vnfId", getVnfId()).append("vnfName", getVnfName())
- .append("pnfId", getPnfId()).append("vnfType", getVnfType()).append("serviceType", getServiceType())
+ .append("resourceStatusMessage", getResourceStatusMessage()).append("statusMessage", getStatusMessage())
+ .append("rollbackStatusMessage", getRollbackStatusMessage()).append("flowStatus", getFlowStatus())
+ .append("retryStatusMessage", getRetryStatusMessage()).append("progress", getProgress())
+ .append("startTime", getStartTime()).append("endTime", getEndTime()).append("source", getSource())
+ .append("vnfId", getVnfId()).append("vnfName", getVnfName()).append("pnfName", getPnfName())
+ .append("vnfType", getVnfType()).append("serviceType", getServiceType())
.append("tenantId", getTenantId()).append("vnfParams", getVnfParams())
.append("vnfOutputs", getVnfOutputs()).append("requestBody", getRequestBody())
.append("responseBody", getResponseBody()).append("lastModifiedBy", getLastModifiedBy())
@@ -609,6 +640,7 @@ public abstract class InfraRequests implements java.io.Serializable {
.append("operationalEnvName", getOperationalEnvName()).append("instanceGroupId", getInstanceGroupId())
.append("instanceGroupName", getInstanceGroupName()).append("requestUrl", getRequestUrl())
.append("originalRequestId", originalRequestId).append("extSystemErrorSource", extSystemErrorSource)
- .append("rollbackExtSystemErrorSource", rollbackExtSystemErrorSource).toString();
+ .append("rollbackExtSystemErrorSource", rollbackExtSystemErrorSource).append("tenantName", tenantName)
+ .append("productFamilyName", productFamilyName).toString();
}
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InstanceNfvoMapping.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InstanceNfvoMapping.java
new file mode 100644
index 0000000000..53b3fcde55
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InstanceNfvoMapping.java
@@ -0,0 +1,123 @@
+/***
+ * Copyright (C) 2019 Verizon. 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.
+ */
+
+package org.onap.so.db.request.beans;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.util.Objects;
+
+@Entity
+@Table(name = "instance_nfvo_mapping")
+public class InstanceNfvoMapping implements java.io.Serializable {
+
+ private static final long serialVersionUID = 1L;
+ @Id
+ @Column(name = "INSTANCE_ID")
+ private String instanceId;
+ @Column(name = "NFVO_NAME", length = 256)
+ private String nfvoName;
+ @Column(name = "ENDPOINT", length = 256)
+ private String endpoint;
+ @Column(name = "USERNAME", length = 256)
+ private String username;
+ @Column(name = "PASSWORD", length = 256)
+ private String password;
+ @Column(name = "API_ROOT", length = 256)
+ private String apiRoot;
+ @Column(name = "JOB_ID", length = 256)
+ private String jobId;
+
+ public InstanceNfvoMapping() {}
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof InstanceNfvoMapping)) {
+ return false;
+ }
+ final InstanceNfvoMapping castOther = (InstanceNfvoMapping) other;
+ return Objects.equals(getInstanceId(), castOther.getInstanceId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(getInstanceId());
+ }
+
+
+ public String getJobId() {
+ return jobId;
+ }
+
+ public void setJobId(String jobId) {
+ this.jobId = jobId;
+ }
+
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ public String getNfvoName() {
+ return nfvoName;
+ }
+
+ public void setNfvoName(String nfvoName) {
+ this.nfvoName = nfvoName;
+ }
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getApiRoot() {
+ return apiRoot;
+ }
+
+ public void setApiRoot(String apiRoot) {
+ this.apiRoot = apiRoot;
+ }
+
+ @Override
+ public String toString() {
+ return "InstanceNfvoMapping{" + "instanceId='" + instanceId + '\'' + ", nfvoName='" + nfvoName + '\''
+ + ", endpoint='" + endpoint + '\'' + ", username='" + username + '\'' + ", password='" + password + '\''
+ + ", apiRoot='" + apiRoot + '\'' + '}';
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
index 334eb73da4..6aa00caeed 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
@@ -45,6 +45,7 @@ import org.onap.so.db.request.beans.SiteStatus;
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
+import org.onap.so.db.request.beans.OrchestrationTask;
import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest;
import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.springframework.beans.factory.annotation.Autowired;
@@ -119,6 +120,8 @@ public class RequestsDbClient {
private String getInProgressVolumeGroupsAndVfModules = "/infraActiveRequests/getInProgressVolumeGroupsAndVfModules";
+ private String orchestrationTasksURI = "/orchestrationTask";
+
private static final String findBySoRequestIdAndGroupIdAndName =
"/requestProcessingData/search/findOneBySoRequestIdAndGroupingIdAndName";
@@ -156,6 +159,7 @@ public class RequestsDbClient {
findAllByOperationalEnvIdAndRequestIdURI =
endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findAllByOperationalEnvIdAndRequestIdURI;
findOneByRequestId = endpoint + findOneByRequestId;
+ orchestrationTasksURI = endpoint + orchestrationTasksURI;
}
protected String getEndpoint() {
@@ -356,6 +360,7 @@ public class RequestsDbClient {
restTemplate.postForLocation(uri, entity);
}
+ // TODO really this should be called save as its doing a put
public void updateInfraActiveRequests(InfraActiveRequests request) {
HttpHeaders headers = getHttpHeaders();
URI uri = getUri(infraActiveRequestURI + request.getRequestId());
@@ -367,8 +372,7 @@ public class RequestsDbClient {
HttpHeaders headers = getHttpHeaders();
URI uri = getUri(infraActiveRequestURI + request.getRequestId());
HttpEntity<InfraActiveRequests> entity = new HttpEntity<>(request, headers);
- restTemplate.exchange(uri, HttpMethod.PATCH, new HttpEntity<InfraActiveRequests>(request, headers),
- String.class);
+ restTemplate.exchange(uri, HttpMethod.PATCH, entity, String.class);
}
public InfraActiveRequests getInfraActiveRequests(String requestId, String basicAuth, String host) {
@@ -520,6 +524,40 @@ public class RequestsDbClient {
.getBody();
}
+ public List<OrchestrationTask> getAllOrchestrationTasks() {
+ String url = UriBuilder.fromUri(getUri(orchestrationTasksURI)).build().toString();
+ HttpEntity<?> entity = getHttpEntity();
+ return restTemplate
+ .exchange(url, HttpMethod.GET, entity, new ParameterizedTypeReference<List<OrchestrationTask>>() {})
+ .getBody();
+ }
+
+ public OrchestrationTask getOrchestrationTask(String taskId) {
+ String url = UriBuilder.fromUri(getUri(orchestrationTasksURI + "/" + taskId)).build().toString();
+ HttpEntity<?> entity = getHttpEntity();
+ return restTemplate.exchange(url, HttpMethod.GET, entity, OrchestrationTask.class).getBody();
+ }
+
+ public OrchestrationTask createOrchestrationTask(OrchestrationTask orchestrationTask) {
+ String url = UriBuilder.fromUri(getUri(orchestrationTasksURI + "/")).build().toString();
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<OrchestrationTask> entity = new HttpEntity<>(orchestrationTask, headers);
+ return restTemplate.exchange(url, HttpMethod.POST, entity, OrchestrationTask.class).getBody();
+ }
+
+ public OrchestrationTask updateOrchestrationTask(String taskId, OrchestrationTask orchestrationTask) {
+ String url = getUri(orchestrationTasksURI + "/" + taskId).toString();
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<OrchestrationTask> entity = new HttpEntity<>(orchestrationTask, headers);
+ return restTemplate.exchange(url, HttpMethod.PUT, entity, OrchestrationTask.class).getBody();
+ }
+
+ public void deleteOrchestrationTask(String taskId) {
+ String url = getUri(orchestrationTasksURI + "/" + taskId).toString();
+ HttpEntity<?> entity = getHttpEntity();
+ restTemplate.exchange(url, HttpMethod.DELETE, entity, Void.class).getBody();
+ }
+
@Component
static class ClassURLMapper {
private static final Map<Class, String> classURLMap = new HashMap<>();
diff --git a/mso-api-handlers/pom.xml b/mso-api-handlers/pom.xml
index b4d5c7070a..5c84ab1d77 100644
--- a/mso-api-handlers/pom.xml
+++ b/mso-api-handlers/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>mso-api-handlers</artifactId>
diff --git a/mso-catalog-db/pom.xml b/mso-catalog-db/pom.xml
index 6a4a6774e6..7444866315 100644
--- a/mso-catalog-db/pom.xml
+++ b/mso-catalog-db/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>mso-catalog-db</artifactId>
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
index ab40cefb4e..0d7a6dbd1f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
@@ -136,6 +136,9 @@ public class Service implements Serializable {
@JoinColumn(name = "TOSCA_CSAR_ARTIFACT_UUID")
private ToscaCsar csar;
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "service")
+ private List<ServiceArtifact> serviceArtifactList;
+
@Column(name = "NAMING_POLICY")
private String namingPolicy;
@@ -371,6 +374,17 @@ public class Service implements Serializable {
this.csar = csar;
}
+ public List<ServiceArtifact> getServiceArtifactList() {
+ if (serviceArtifactList == null) {
+ serviceArtifactList = new ArrayList<>();
+ }
+ return serviceArtifactList;
+ }
+
+ public void setServiceArtifactList(List<ServiceArtifact> serviceArtifactList) {
+ this.serviceArtifactList = serviceArtifactList;
+ }
+
public String getWorkloadContext() {
return this.workloadContext;
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceArtifact.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceArtifact.java
new file mode 100644
index 0000000000..a8884a81bb
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceArtifact.java
@@ -0,0 +1,168 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.db.catalog.beans;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Objects;
+
+@Entity
+@Table(name = "service_artifact")
+public class ServiceArtifact implements Serializable {
+
+ private static final long serialVersionUID = 768026109321305392L;
+
+ @BusinessKey
+ @Id
+ @Column(name = "ARTIFACT_UUID")
+ private String artifactUUID;
+
+ @Column(name = "TYPE")
+ private String type;
+
+ @Column(name = "NAME")
+ private String name;
+
+ @Column(name = "VERSION")
+ private String version;
+
+ @Column(name = "DESCRIPTION")
+ private String description;
+
+ @Column(name = "CONTENT", columnDefinition = "LONGTEXT")
+ private String content;
+
+ @Column(name = "CHECKSUM")
+ private String checksum;
+
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date creationTimestamp;
+
+ @ManyToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "SERVICE_MODEL_UUID")
+ private Service service;
+
+ @PrePersist
+ protected void onCreate() {
+ this.creationTimestamp = new Date();
+ }
+
+ public String getArtifactUUID() {
+ return artifactUUID;
+ }
+
+ public void setArtifactUUID(String artifactUUID) {
+ this.artifactUUID = artifactUUID;
+ }
+
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public String getChecksum() {
+ return checksum;
+ }
+
+ public void setChecksum(String checksum) {
+ this.checksum = checksum;
+ }
+
+ public Date getCreationTimestamp() {
+ return creationTimestamp;
+ }
+
+ public void setCreationTimestamp(Date creationTimestamp) {
+ this.creationTimestamp = creationTimestamp;
+ }
+
+ public Service getService() {
+ return service;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("artifactUUID", artifactUUID).append("type", type).append("name", name)
+ .append("version", version).append("description", description).append("content", content)
+ .append("checksum", checksum).append("creationTimestamp", creationTimestamp).toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ ServiceArtifact that = (ServiceArtifact) o;
+ return artifactUUID.equals(that.artifactUUID);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(artifactUUID);
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java
new file mode 100644
index 0000000000..f9c95767f6
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceInfo.java
@@ -0,0 +1,106 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.db.catalog.beans;
+
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import uk.co.blackpepper.bowman.annotation.LinkedResource;
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Objects;
+
+@Entity
+@Table(name = "service_info")
+public class ServiceInfo implements Serializable {
+
+ private static final long serialVersionUID = 768026109321305392L;
+
+ @Id
+ @BusinessKey
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "ID")
+ private Integer id;
+
+ @Column(name = "SERVICE_INPUT")
+ private String serviceInput;
+
+ @Column(name = "SERVICE_PROPERTIES")
+ private String serviceProperties;
+
+ @OneToOne(cascade = CascadeType.ALL)
+ @JoinTable(name = "service_to_service_info", joinColumns = @JoinColumn(name = "SERVICE_INFO_ID"),
+ inverseJoinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"))
+ private Service service;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer serviceInfoId) {
+ this.id = serviceInfoId;
+ }
+
+ public String getServiceInput() {
+ return serviceInput;
+ }
+
+ public void setServiceInput(String serviceInput) {
+ this.serviceInput = serviceInput;
+ }
+
+ public String getServiceProperties() {
+ return serviceProperties;
+ }
+
+ public void setServiceProperties(String serviceProperties) {
+ this.serviceProperties = serviceProperties;
+ }
+
+ @LinkedResource
+ public Service getService() {
+ return service;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("id", id).append("serviceProperties", serviceProperties)
+ .append("serviceInput", serviceInput).toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ ServiceInfo that = (ServiceInfo) o;
+ return id.equals(that.id);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id);
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index cf066f9721..26c33941ed 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.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.
@@ -158,6 +158,7 @@ public class CatalogDbClient {
protected static final String HOMING_INSTANCE = "/homingInstance";
protected static final String ARTIFACT_UUID = "artifactUUID";
protected static final String SOURCE = "source";
+ protected static final String RESOURCE_TARGET = "resource_target";
private static final String TARGET_ENTITY = "SO:CatalogDB";
private static final String ASTERISK = "*";
@@ -209,6 +210,7 @@ public class CatalogDbClient {
private String findVnfResourceCustomizationByModelUuid = "/findVnfResourceCustomizationByModelUuid";
private String findBBNameSelectionReferenceByControllerActorAndScopeAndAction =
"/findBBNameSelectionReferenceByControllerActorAndScopeAndAction";
+ private String findWorkflowByResourceTarget = "/findByResourceTarget";
private String serviceURI;
private String vfModuleURI;
@@ -348,6 +350,7 @@ public class CatalogDbClient {
findWorkflowByVnfModelUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByVnfModelUUID;
findWorkflowByPnfModelUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByPnfModelUUID;
findWorkflowBySource = endpoint + WORKFLOW + SEARCH + findWorkflowBySource;
+ findWorkflowByResourceTarget = endpoint + WORKFLOW + SEARCH + findWorkflowByResourceTarget;
findVnfResourceCustomizationByModelUuid =
endpoint + VNF_RESOURCE_CUSTOMIZATION + SEARCH + findVnfResourceCustomizationByModelUuid;
@@ -1084,6 +1087,11 @@ public class CatalogDbClient {
getUri(UriBuilder.fromUri(findWorkflowBySource).queryParam(SOURCE, source).build().toString()));
}
+ public List<Workflow> findWorkflowByResourceTarget(String resourceTarget) {
+ return this.getMultipleResources(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByResourceTarget)
+ .queryParam(RESOURCE_TARGET, resourceTarget).build().toString()));
+ }
+
public String getEndpoint() {
return endpoint;
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java
new file mode 100644
index 0000000000..e3a4ca264e
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceInfoRepository.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2019, CMCC Technologies Co., Ltd.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in 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.onap.so.db.catalog.data.repository;
+
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceInfo;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource(collectionResourceRel = "serviceInfo", path = "serviceInfo")
+public interface ServiceInfoRepository extends JpaRepository<ServiceInfo, Integer> {
+
+ ServiceInfo findByService(Service service);
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java
index 91c6940e95..93ec54a2eb 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.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,6 +33,8 @@ public interface WorkflowRepository extends JpaRepository<Workflow, Integer> {
List<Workflow> findBySource(String source);
+ List<Workflow> findByResourceTarget(String resourceTarget);
+
/**
* Used to fetch the @{link Workflow} by the Model UUID.
*
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java
index f9cbb0d462..ec4e922c8f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/rest/beans/ServiceMacroHolder.java
@@ -20,14 +20,10 @@
package org.onap.so.db.catalog.rest.beans;
+import com.openpojo.business.annotation.BusinessKey;
+import org.onap.so.db.catalog.beans.*;
import java.io.Serializable;
import java.util.ArrayList;
-import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
-import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
-import org.onap.so.db.catalog.beans.Service;
-import org.onap.so.db.catalog.beans.VnfResource;
-import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import com.openpojo.business.annotation.BusinessKey;
/*
* A simple holder for Service and its associated elements: VnfResource, 1-n VfModule, Network TBD
@@ -42,6 +38,8 @@ public class ServiceMacroHolder implements Serializable {
private ArrayList<NetworkResourceCustomization> networkResourceCustomizations;
private ArrayList<AllottedResourceCustomization> allottedResourceCustomizations;
private ArrayList<VnfResourceCustomization> vnfResourceCustomizations;
+ private ArrayList<ServiceProxyResourceCustomization> serviceProxyResourceCustomizations;
+ private ServiceInfo serviceInfo;
public ServiceMacroHolder() {
@@ -51,6 +49,8 @@ public class ServiceMacroHolder implements Serializable {
this.networkResourceCustomizations = new ArrayList<>();
this.allottedResourceCustomizations = new ArrayList<>();
this.vnfResourceCustomizations = new ArrayList<>();
+ this.serviceProxyResourceCustomizations = new ArrayList<>();
+ this.serviceInfo = null;
}
public ServiceMacroHolder(Service service) {
@@ -66,6 +66,14 @@ public class ServiceMacroHolder implements Serializable {
this.service = service;
}
+ public ServiceInfo getServiceInfo() {
+ return serviceInfo;
+ }
+
+ public void setServiceInfo(ServiceInfo serviceInfo) {
+ this.serviceInfo = serviceInfo;
+ }
+
public void setVnfResources(ArrayList<VnfResource> vnfResources) {
this.vnfResources = vnfResources;
}
@@ -139,6 +147,15 @@ public class ServiceMacroHolder implements Serializable {
}
}
+ public void addServiceProxyResourceCustomization(ServiceProxyResourceCustomization sprc) {
+ if (this.serviceProxyResourceCustomizations != null) {
+ this.serviceProxyResourceCustomizations.add(sprc);
+ } else {
+ this.serviceProxyResourceCustomizations = new ArrayList<>();
+ this.serviceProxyResourceCustomizations.add(sprc);
+ }
+ }
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -148,6 +165,11 @@ public class ServiceMacroHolder implements Serializable {
} else {
sb.append("service: null");
}
+ if (this.serviceInfo != null) {
+ sb.append("serviceInfo: " + this.serviceInfo.toString());
+ } else {
+ sb.append("serviceInfo: null");
+ }
if (this.vnfResourceCustomizations != null && this.vnfResourceCustomizations.size() > 0) {
int i = 0;
sb.append("VnfResources: ");
@@ -180,6 +202,13 @@ public class ServiceMacroHolder implements Serializable {
sb.append("ARC[" + i++ + "]: " + arc.toString());
}
}
+ if (this.serviceProxyResourceCustomizations != null && this.serviceProxyResourceCustomizations.size() > 0) {
+ int i = 0;
+ sb.append("ServiceProxyResourceCustomizations:");
+ for (ServiceProxyResourceCustomization sprc : this.serviceProxyResourceCustomizations) {
+ sb.append("SPRC[" + i++ + "]: " + sprc.toString());
+ }
+ }
return sb.toString();
}
@@ -202,6 +231,12 @@ public class ServiceMacroHolder implements Serializable {
this.allottedResourceCustomizations = allottedResourceCustomizations;
}
+ public ArrayList<ServiceProxyResourceCustomization> getServiceProxyResourceCustomizations() {
+ return serviceProxyResourceCustomizations;
+ }
-
+ public void setServiceProxyResourceCustomizations(
+ ArrayList<ServiceProxyResourceCustomization> serviceProxyResourceCustomizations) {
+ this.serviceProxyResourceCustomizations = serviceProxyResourceCustomizations;
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index 66fc0f5dc5..79e3cbcc08 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2020 Nordix
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -179,7 +181,7 @@ public class CatalogDbClientTest {
}
@Test
- public final void testFindWorkflowByPnfModelUUID() throws Exception {
+ public final void testFindWorkflowByPnfModelUUID() {
String pnfResourceModelUUID = "f2d1f2b2-88bb-49da-b716-36ae420ccbff";
doReturn(new ArrayList()).when(catalogDbClient).getMultipleResources(any(), any());
@@ -190,4 +192,16 @@ public class CatalogDbClientTest {
}
+ @Test
+ public final void testFindWorkflowByResourceTarget() {
+ // when
+ final String pnf_resource = "pnf";
+ doReturn(new ArrayList()).when(catalogDbClient).getMultipleResources(any(), any());
+ catalogDbClient.findWorkflowByResourceTarget(pnf_resource);
+
+ // verify
+ verify(catalogDbClient).getMultipleResources(any(Client.class), eq(UriBuilder.fromUri("/findByResourceTarget")
+ .queryParam(CatalogDbClient.RESOURCE_TARGET, pnf_resource).build()));
+ }
+
}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java
index b07e82b8a8..e47c61d8b4 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java
@@ -55,4 +55,14 @@ public class WorkflowRepositoryTest extends BaseTest {
Assert.assertTrue("testingWorkflow.bpmn".equals(workflows.get(0).getArtifactName()));
}
+ @Test
+ public void findByResourceTargetTest() {
+ List<Workflow> workflows = workflowRepository.findByResourceTarget("pnf");
+
+ Assert.assertTrue(workflows != null);
+ Assert.assertTrue(workflows.size() == 1);
+
+ Assert.assertTrue("DummyPnfWorkflow".equals(workflows.get(0).getArtifactName()));
+ }
+
}
diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml
index c78979eccb..b231dedf91 100644
--- a/packages/docker/pom.xml
+++ b/packages/docker/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>packages</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<packaging>pom</packaging>
@@ -77,16 +77,14 @@
<name>${docker.image.prefix}/base-image:1.0</name>
<build>
<cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-base-image</dockerFile>
+ <dockerFile>docker-files/Dockerfile.so-base-image</dockerFile>
</build>
</image>
<image>
<name>${docker.image.prefix}/vnfm-adapter</name>
<build>
<cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
+ <dockerFile>docker-files/Dockerfile.so-app</dockerFile>
<tags>
<tag>${project.version}</tag>
<tag>${project.version}-${maven.build.timestamp}</tag>
@@ -110,8 +108,7 @@
<name>${docker.image.prefix}/ve-vnfm-adapter</name>
<build>
<cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
+ <dockerFile>docker-files/Dockerfile.so-app</dockerFile>
<tags>
<tag>${project.version}</tag>
<tag>${project.version}-${maven.build.timestamp}</tag>
@@ -135,8 +132,7 @@
<name>${docker.image.prefix}/catalog-db-adapter</name>
<build>
<cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
+ <dockerFile>docker-files/Dockerfile.so-app</dockerFile>
<tags>
<tag>${project.version}</tag>
<tag>${project.version}-${maven.build.timestamp}</tag>
@@ -160,8 +156,7 @@
<name>${docker.image.prefix}/request-db-adapter</name>
<build>
<cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
+ <dockerFile>docker-files/Dockerfile.so-app</dockerFile>
<tags>
<tag>${project.version}</tag>
<tag>${project.version}-${maven.build.timestamp}</tag>
@@ -185,8 +180,7 @@
<name>${docker.image.prefix}/sdnc-adapter</name>
<build>
<cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
+ <dockerFile>docker-files/Dockerfile.so-app</dockerFile>
<tags>
<tag>${project.version}</tag>
<tag>${project.version}-${maven.build.timestamp}</tag>
@@ -210,8 +204,7 @@
<name>${docker.image.prefix}/openstack-adapter</name>
<build>
<cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
+ <dockerFile>docker-files/Dockerfile.so-app</dockerFile>
<tags>
<tag>${project.version}</tag>
<tag>${project.version}-${maven.build.timestamp}</tag>
@@ -235,8 +228,7 @@
<name>${docker.image.prefix}/vfc-adapter</name>
<build>
<cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
+ <dockerFile>docker-files/Dockerfile.so-app</dockerFile>
<tags>
<tag>${project.version}</tag>
<tag>${project.version}-${maven.build.timestamp}</tag>
@@ -257,11 +249,34 @@
</build>
</image>
<image>
+ <name>${docker.image.prefix}/nssmf-adapter</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFile>docker-files/Dockerfile.so-app</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.so.adapters:mso-nssmf-adapter</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ <image>
<name>${docker.image.prefix}/so-appc-orchestrator</name>
<build>
<cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
+ <dockerFile>docker-files/Dockerfile.so-app</dockerFile>
<tags>
<tag>${project.version}</tag>
<tag>${project.version}-${maven.build.timestamp}</tag>
@@ -285,8 +300,7 @@
<name>${docker.image.prefix}/sdc-controller</name>
<build>
<cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
+ <dockerFile>docker-files/Dockerfile.so-app</dockerFile>
<tags>
<tag>${project.version}</tag>
<tag>${project.version}-${maven.build.timestamp}</tag>
@@ -310,8 +324,7 @@
<name>${docker.image.prefix}/bpmn-infra</name>
<build>
<cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
+ <dockerFile>docker-files/Dockerfile.so-app</dockerFile>
<tags>
<tag>${project.version}</tag>
<tag>${project.version}-${maven.build.timestamp}</tag>
@@ -335,8 +348,7 @@
<name>${docker.image.prefix}/api-handler-infra</name>
<build>
<cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
+ <dockerFile>docker-files/Dockerfile.so-app</dockerFile>
<tags>
<tag>${project.version}</tag>
<tag>${project.version}-${maven.build.timestamp}</tag>
@@ -360,8 +372,7 @@
<name>${docker.image.prefix}/so-monitoring</name>
<build>
<cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
+ <dockerFile>docker-files/Dockerfile.so-app</dockerFile>
<tags>
<tag>${project.version}</tag>
<tag>${project.version}-${maven.build.timestamp}</tag>
@@ -385,8 +396,7 @@
<name>${docker.image.prefix}/so-simulator</name>
<build>
<cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
+ <dockerFile>docker-files/Dockerfile.so-app</dockerFile>
<tags>
<tag>${project.version}</tag>
<tag>${project.version}-${maven.build.timestamp}</tag>
@@ -437,7 +447,7 @@
<goal>push</goal>
</goals>
<configuration>
- <image>${docker.image.prefix}/catalog-db-adapter,${docker.image.prefix}/request-db-adapter,${docker.image.prefix}/sdnc-adapter,${docker.image.prefix}/openstack-adapter,${docker.image.prefix}/vfc-adapter,${docker.image.prefix}/sdc-controller,${docker.image.prefix}/bpmn-infra,${docker.image.prefix}/api-handler-infra,${docker.image.prefix}/so-monitoring,${docker.image.prefix}/so-simulator</image>
+ <image>${docker.image.prefix}/catalog-db-adapter,${docker.image.prefix}/request-db-adapter,${docker.image.prefix}/sdnc-adapter,${docker.image.prefix}/openstack-adapter,${docker.image.prefix}/vfc-adapter,${docker.image.prefix}/sdc-controller,${docker.image.prefix}/bpmn-infra,${docker.image.prefix}/api-handler-infra,${docker.image.prefix}/so-monitoring,${docker.image.prefix}/so-simulator,${docker.image.prefix}/mso-nssmf-adapter</image>
</configuration>
</execution>
</executions>
@@ -492,6 +502,11 @@
</dependency>
<dependency>
<groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-nssmf-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
<artifactId>so-appc-orchestrator</artifactId>
<version>${project.version}</version>
</dependency>
diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-app b/packages/docker/src/main/docker/docker-files/Dockerfile.so-app
index 90f0a6627d..dc86ff8290 100644
--- a/packages/docker/src/main/docker/docker-files/Dockerfile.so-app
+++ b/packages/docker/src/main/docker/docker-files/Dockerfile.so-app
@@ -7,24 +7,20 @@ ARG https_proxy
ENV HTTPS_PROXY=$https_proxy
ENV https_proxy=$HTTPS_PROXY
-RUN mkdir /app && mkdir /app/config && mkdir /app/certificates && mkdir /app/logs && mkdir /app/ca-certificates
+USER root
+RUN mkdir -p /app/config
+RUN mkdir -p /app/certificates
+RUN mkdir -p /app/logs
+RUN mkdir -p /app/ca-certificates
COPY maven/app.jar /app
COPY configs/logging/logback-spring.xml /app
COPY scripts/start-app.sh /app
COPY scripts/wait-for.sh /app
COPY ca-certificates/onap-ca.crt /app/ca-certificates/onap-ca.crt
-COPY certs/* /app/
-
-RUN chown -R so:so /app && chmod 700 /app/*.sh
-
-## TODO for Casablanca: install this in the openstack-adapter container
-## Install heatbridge
-#RUN apt-get install -y python && apt-get install -y python-pip && echo 'PIP Installed, doing upgrade' && pip install --upgrade pip
-#RUN mkdir /opt/mso/heatbridge
-#COPY heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl /opt/mso/heatbridge
-#RUN pip install /opt/mso/heatbridge/heatbridge-0.3.0.dev0-py2-none-any.whl
+RUN chown -R so:so /app
+USER so
# Springboot configuration (required)
VOLUME /app/config
@@ -32,4 +28,4 @@ VOLUME /app/config
VOLUME /app/ca-certificates
WORKDIR /app
-CMD ["/app/start-app.sh"]
+ENTRYPOINT ["/app/start-app.sh"]
diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image b/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image
index c0b298e778..031142f216 100644
--- a/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image
+++ b/packages/docker/src/main/docker/docker-files/Dockerfile.so-base-image
@@ -7,11 +7,8 @@ ENV HTTPS_PROXY=$https_proxy
ENV http_proxy=$HTTP_PROXY
ENV https_proxy=$HTTPS_PROXY
-# Update the package list and upgrade installed packages
-RUN apk update && apk upgrade
-
# Install commonly needed tools
-RUN apk --no-cache add curl netcat-openbsd sudo nss
+RUN apk --no-cache add curl netcat-openbsd nss
# Create 'so' user
RUN addgroup -g 1000 so && adduser -S -u 1000 -G so -s /bin/sh so
diff --git a/packages/docker/src/main/docker/docker-files/certs/org.onap.so.jks b/packages/docker/src/main/docker/docker-files/certs/org.onap.so.jks
deleted file mode 100644
index 1e849afb5e..0000000000
--- a/packages/docker/src/main/docker/docker-files/certs/org.onap.so.jks
+++ /dev/null
Binary files differ
diff --git a/packages/docker/src/main/docker/docker-files/certs/org.onap.so.keyfile b/packages/docker/src/main/docker/docker-files/certs/org.onap.so.keyfile
deleted file mode 100644
index 9000ed29fb..0000000000
--- a/packages/docker/src/main/docker/docker-files/certs/org.onap.so.keyfile
+++ /dev/null
@@ -1,27 +0,0 @@
-xVdhDotWIx2RB3f8RxAFQb9mkHVVdIzv8eiij9cDjg_5ea5HWPS7OzLR5lv4NA0vStrAMfSAaS2e
-j4rzvrlserM9bTRco3JHb-i6ZGYMoTL6kuFJ9JMveSqg-fkwvrm7VcYQJBs1FIE3hRLNqiGJ34ud
-hDRp-cGUvNRLIImksKT2fmUyEawLLuE0Lo5aX46y0ibjIMe7clMxLHIS5-WggvkgIOPkVDcxqLT2
-OteGptqW1cjrm1ydbTkLYN6dd7ZmRsT3ULPYLEtPTlZ2vCh7bFBBvP_tjp2cZf4uSPM6EClYAikn
-dnTqivOfCZn25r0xeXuectoXbq12fws_jaCH05ZK1wJwAF_cQNfpvaiM457rE672YV3Ev4yhXCyM
-1jVL2P9Chl1sSBkZujCftvaj1rlippP9P_eohcLv84mtApEyV49rBFRMtkX9ZVdPyb8shFSoXJxk
-M6DentRzY1g37mVJ1B1YMKPNQj95nOD4gLvjbUZ7dATuroENsG7oUWkfaV6dokfTmh504ZbyeqGh
-xa7yfr3326fMQBhQMpsyqD2o_Obe5wN57p-vb469w65pUmK7iJDa0Fgxaxy8XNNnw6gCurbbsvyU
-nB8UdfhTvL5mJew_tKUvtq_KH9ajnA8giSxuFd9KM6YHJWiFMXIROEQT7hKjTJka1ghERBjcH_pY
-hbKtHdvbrS7T2hGwY_MQEUXYQBirtjaEwAvI960hXQt1K-MC8PNLRYtdLKE2Aq3amMt7ZKtrHSeN
-33I1MjXc3wRUeOi5A6qImge1Q_Wmn1SURAn9KbEv9eoMUbQUkN1z2iyw4x94BZpBk5GjDypKKOyg
-guec0UY3y9wqm5gGW7XvT3v1lZqo5180VgK49iFgA4IhWZ7dnDFQmq6IHTr1pM4kuvJ9dka9saIh
-9xCk_KINPp5_dqJ2Lhak2IeRg_Zm3belm1jvYGCyRRqfoi9WGrDh3LLZeK8MHrrfzLI4Toy_n6DG
-UNXPrXqrZPREfW2lhYLRfrivOBYWPq9JidQXn1UctSmWdNoMH7XuikBpAwmlInNA_5j9J-L-gf9D
-cw2zoby3_wvcm5vxndnocEdhqVVdo7uMmXasQqphuyJP8rgCJf_I1v0Qe5F-JXsj6xDvarOUPOTj
-Z93a64EO0KI0OznolRyBqHpIXffbGh7e1EpAE0LMESKJC3Mjmsgz1ld3s7WfdeDK-IxUEHJLHlhY
-IjBlY6q3OJDrgvPLkwoWPbI48tmRUJX1BCafvDU6W8crl4VQKhL_l5ANAX5oaKwh-0ZJAZ15tna5
-6fjWcWrtQSdNQxj0jXV7uEcBtRtyPyOk2uw4HJDBLQyyOglUUxcQZJFCFp2fCHmNyttmUJQ5U9cu
-yw9lKhsyBJ5TB4psbp64_0EalITeAGrpuH1I1N2m1O5ZY8pmrpPtA1Mb5rQ4IJqiVbZgHTcvSiN5
-Z2SilurhI1vq4_aN_UZJQvEnw9U5WU3ysphsQk8RZKbFH4W9GDtmEGbAkRkTy17KrDIuMpe--XJF
-SQHUd4tzxbiYVYHKdF6Ce1kfQ-DEFXEf7RddwuKbc7tw2pSjy1MVH4HSRoTOQQpewZRTfG-4d3MX
-B99-QgufEk1OBkfemuDhdnPty5qkOLUEG_uQKPpD0QDVf-t4OxZqk_8G_dCJcXbmY4VT3V7pdN_I
-qp2xP98wGcIPuLGlEB8px94jKdUolkqeV_UTmmkTGz-szLzgK_YhnnVJn8VeyNsPTwAFUlqiPTyT
-n_7rCb_6nNKlriadaHu6IuJWehv03ZR9jS0P1Y3YLM286deCLFu93lN3nY4yf-SEguASdHJNCBFJ
-RQViYm8Tfuim5F0KQGafheGcdZxTvBFihnDduQWNBR_bDB9zfD6OtvvkseyyWHt3gHkJm5QeCjWK
-RzRvbjLpUnA31cJeEXmnmhB5qMAvjn8yORKcotn3u4MXdHEk-s8vR_SKykS6IcaYE1xxbowtg-UG
-d1iaky1NFYa2VZ4pGx9lD93GDTDynmOSfzVeVsxhTu_5rAanpDkUYVuxOzajmRh55I8a6dRk \ No newline at end of file
diff --git a/packages/docker/src/main/docker/docker-files/certs/org.onap.so.trust.jks b/packages/docker/src/main/docker/docker-files/certs/org.onap.so.trust.jks
deleted file mode 100644
index 71c6e776a3..0000000000
--- a/packages/docker/src/main/docker/docker-files/certs/org.onap.so.trust.jks
+++ /dev/null
Binary files differ
diff --git a/packages/docker/src/main/docker/docker-files/scripts/.gitattributes b/packages/docker/src/main/docker/docker-files/scripts/.gitattributes
new file mode 100644
index 0000000000..b905d1de69
--- /dev/null
+++ b/packages/docker/src/main/docker/docker-files/scripts/.gitattributes
@@ -0,0 +1,5 @@
+# Default behavior
+* text=auto
+
+# Files to have unix style line endings on checkout
+*.sh text eol=lf \ No newline at end of file
diff --git a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh
index 75d64fefa0..74d17fc9b7 100644..100755
--- a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh
+++ b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh
@@ -16,7 +16,7 @@ then
update-ca-certificates --fresh
fi
- # Re-exec this script as the 'so' user.
+ # Re-exec this script as the 'onap' user.
this=`readlink -f $0`
exec su so -c "$this"
fi
@@ -46,7 +46,7 @@ fi
if [ ${APP} = "bpmn-infra" ]; then
ln -s ${LOG_PATH} BPMN
-fi
+fi
if [ ${APP} = "so-monitoring" ]; then
ln -s ${LOG_PATH} MONITORING
diff --git a/packages/pom.xml b/packages/pom.xml
index 029fa3d446..af302405cc 100644
--- a/packages/pom.xml
+++ b/packages/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>packages</artifactId>
diff --git a/pom.xml b/pom.xml
index 0955338a4e..277d60d938 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
<packaging>pom</packaging>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
<name>so</name>
<description>This Maven project is responsible to build and package all child projects - contributions in the MSO project.
This build can be configured to run Functional tests and to start/stop a jboss server + Mysql DB.
@@ -49,7 +49,7 @@
<sonar.cpd.exclusions>**/*</sonar.cpd.exclusions>
<jacoco.version>0.8.5</jacoco.version>
<org.apache.maven.user-settings />
- <openstack.version>1.5.1</openstack.version>
+ <openstack.version>1.5.2-SNAPSHOT</openstack.version>
<maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
<originalClassifier>original</originalClassifier>
<docker.skip>true</docker.skip>
@@ -337,28 +337,28 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <version>${jacoco.version}</version>
- <executions>
- <execution>
- <id>prepare-agent</id>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </execution>
- <execution>
- <id>report</id>
- <goals>
- <goal>report</goal>
- </goals>
- <configuration>
- <dataFile>${project.build.directory}/code-coverage/jacoco.exec</dataFile>
- <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>${jacoco.version}</version>
+ <executions>
+ <execution>
+ <id>prepare-agent</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>report</id>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <dataFile>${project.build.directory}/code-coverage/jacoco.exec</dataFile>
+ <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
@@ -670,17 +670,17 @@
<dependency>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-slf4j</artifactId>
- <version>1.6.3-SNAPSHOT</version>
+ <version>1.6.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-filter-base</artifactId>
- <version>1.6.2-SNAPSHOT</version>
+ <version>1.6.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-filter-spring</artifactId>
- <version>1.6.3-SNAPSHOT</version>
+ <version>1.6.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
diff --git a/so-monitoring/pom.xml b/so-monitoring/pom.xml
index 243073554e..206a0f2851 100644
--- a/so-monitoring/pom.xml
+++ b/so-monitoring/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.so.monitoring</groupId>
diff --git a/so-monitoring/so-monitoring-handler/pom.xml b/so-monitoring/so-monitoring-handler/pom.xml
index 59546861c5..176328a434 100644
--- a/so-monitoring/so-monitoring-handler/pom.xml
+++ b/so-monitoring/so-monitoring-handler/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.so.monitoring</groupId>
<artifactId>so-monitoring</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>so-monitoring-handler</artifactId>
<name>${project.artifactId}</name>
diff --git a/so-monitoring/so-monitoring-service/pom.xml b/so-monitoring/so-monitoring-service/pom.xml
index 762e3a5ee6..110c3fe863 100644
--- a/so-monitoring/so-monitoring-service/pom.xml
+++ b/so-monitoring/so-monitoring-service/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.so.monitoring</groupId>
<artifactId>so-monitoring</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>so-monitoring-service</artifactId>
<name>${project.artifactId}</name>
diff --git a/so-monitoring/so-monitoring-ui/pom.xml b/so-monitoring/so-monitoring-ui/pom.xml
index c362a83a9b..6488c7d7df 100644
--- a/so-monitoring/so-monitoring-ui/pom.xml
+++ b/so-monitoring/so-monitoring-ui/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.so.monitoring</groupId>
<artifactId>so-monitoring</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>so-monitoring-ui</artifactId>
diff --git a/so-simulator/pom.xml b/so-simulator/pom.xml
index 6e0d125ddb..35964d6de6 100644
--- a/so-simulator/pom.xml
+++ b/so-simulator/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-simulator</artifactId>
@@ -17,8 +17,19 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<citrus.simulator.version>1.1.0</citrus.simulator.version>
+ <spring.boot.version>2.0.9.RELEASE</spring.boot.version>
</properties>
-
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${spring.boot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
diff --git a/version.properties b/version.properties
index 9eb3b93ac9..a0756adf2b 100644
--- a/version.properties
+++ b/version.properties
@@ -3,8 +3,8 @@
# because they are used in Jenkins, whose plug-in doesn't support
major=1
-minor=5
-patch=3
+minor=6
+patch=0
base_version=${major}.${minor}.${patch}