aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-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
254 files changed, 14835 insertions, 440 deletions
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>