aboutsummaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/etsi-sol002-adapter/pom.xml (renamed from adapters/mso-ve-vnfm-adapter/pom.xml)12
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/Application.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/Application.java)0
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java212
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiPropertiesExt.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiPropertiesExt.java)16
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/EsrId.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/EsrId.java)0
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java)0
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ConfigProperties.java134
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java)15
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/constant/NotificationVnfFilterType.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/package-info.java)32
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java)20
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java)13
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java)7
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java)0
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java)0
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapConditionalSender.java93
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java)36
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java)11
-rw-r--r--adapters/etsi-sol002-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/service/SubscribeSender.java)15
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java)49
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java (renamed from adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java)9
-rw-r--r--adapters/etsi-sol002-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties (renamed from adapters/mso-ve-vnfm-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties)0
-rw-r--r--adapters/etsi-sol002-adapter/src/main/resources/application.yaml (renamed from adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml)4
-rw-r--r--adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/aai/AaiConnectionTest.java65
-rw-r--r--adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java (renamed from adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java)28
-rw-r--r--adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java (renamed from adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java)0
-rw-r--r--adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/DmaapConditionalSenderTest.java151
-rw-r--r--adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java (renamed from adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java)4
-rw-r--r--adapters/etsi-sol002-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/service/SubscribeSenderTest.java)19
-rw-r--r--adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java (renamed from adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java)0
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/Readme.txt (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt)0
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/pom.xml86
-rwxr-xr-xadapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/java/org/onap/so/adapters/etsisol003adapter/Application.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java)16
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/java/org/onap/so/adapters/etsisol003adapter/EtsiSol003AdapterBasicHttpSecurityConfigurer.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmBasicHttpSecurityConfigurer.java)7
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/application-aaf.yaml (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application-aaf.yaml)0
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/application-basic.yaml (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application-basic.yaml)0
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/application.yaml (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml)0
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/org.onap.so.trust.jks (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/org.onap.so.trust.jks)bin1413 -> 1413 bytes
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/so-vnfm-adapter.p12 (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/so-vnfm-adapter.p12)bin4079 -> 4079 bytes
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/pom.xml24
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/common/CommonConstants.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java)19
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/common/VnfmAdapterUrlProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterUrlProvider.java)10
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/common/configuration/MessageConverterConfiguration.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java)32
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/oauth/configuration/AuthorizationServerConfig.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/AuthorizationServerConfig.java)4
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/oauth/configuration/OAuth2AccessTokenAdapter.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2AccessTokenAdapter.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/oauth/configuration/OAuth2ResourceServer.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2ResourceServer.java)7
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/pom.xml (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml)78
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/LifeCycleManagementConstants.java33
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/NvfmAdapterUtils.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/NvfmAdapterUtils.java)26
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/AbstractServiceProviderConfiguration.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/AbstractServiceProviderConfiguration.java)6
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/SdcPackageProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java)16
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiClientProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiClientProvider.java)4
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiHelper.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java)10
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiPropertiesImpl.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiPropertiesImpl.java)6
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiServiceProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java)4
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiServiceProviderImpl.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java)10
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/OamIpAddressSource.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/OamIpAddressSource.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vim/model/AccessInfo.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/AccessInfo.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vim/model/InterfaceInfo.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/InterfaceInfo.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vim/model/VimCredentials.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/VimCredentials.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmHelper.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java)42
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmServiceProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java)18
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmServiceProviderConfiguration.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java)10
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmServiceProviderImpl.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java)32
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmUrlProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java)6
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/jobmanagement/JobManager.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java)28
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/jobmanagement/VnfmOperation.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/VnfmOperation.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/lifecycle/LifecycleManager.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java)50
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/notificationhandling/NotificationHandler.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java)30
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/EtsiSol003AdapterController.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java)28
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003GrantController.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java)22
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003LcnContoller.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java)32
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/exceptions/JobNotFoundException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/JobNotFoundException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/exceptions/TenantNotFoundException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/TenantNotFoundException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/exceptions/VnfNotFoundException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfNotFoundException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/exceptions/VnfmNotFoundException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfmNotFoundException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/exceptions/VnfmRequestFailureException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfmRequestFailureException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties1
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/EtsiSol003AdapterControllerTest.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java)70
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/HealthCheckTest.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java)9
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003GrantControllerTest.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java)28
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003LcnControllerTest.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java)50
-rwxr-xr-xadapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/TestApplication.java38
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/resources/application.yaml (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application.yaml)0
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/pom.xml (renamed from adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml)68
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/src/main/resources/SOL003-VNFLifecycleManagementNotification-API.json (renamed from adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFLifecycleManagementNotification-API.json)0
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/src/main/resources/SOL003-VNFLifecycleOperationGranting-API.json (renamed from adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFLifecycleOperationGranting-API.json)0
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/src/main/resources/etsisol003adapter.yaml (renamed from adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/vnfmadapter.yaml)0
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-ext-clients/pom.xml173
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-ext-clients/src/main/resources/SOL003-VNFLifecycleManagement-API.json (renamed from adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFLifecycleManagement-API.json)0
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/pom.xml17
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/pom.xml109
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/ConversionServiceConfiguration.java55
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/PackageManagementConstants.java39
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/cache/AbstractCacheServiceProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/AbstractCacheServiceProvider.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/cache/CacheManagerConfiguration.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/CacheManagerConfiguration.java)6
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/cache/CacheNotFoundException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/CacheNotFoundException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/cache/PkgmCacheServiceProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/PackageManagementCacheServiceProvider.java)6
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/cache/PkgmCacheServiceProviderImpl.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/PackageManagementCacheServiceProviderImpl.java)15
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/converters/etsicatalog/sol003/AbstractPkgNotificationConverter.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/AbstractPkgNotificationConverter.java)21
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/converters/etsicatalog/sol003/PkgChangeNotificationConverter.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/PkgChangeNotificationConverter.java)14
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/converters/etsicatalog/sol003/PkgOnboardingNotificationConverter.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/PkgOnboardingNotificationConverter.java)15
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/converters/etsicatalog/sol003/VnfPkgInfoConverter.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/VnfPkgInfoConverter.java)26
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java)56
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/AbstractServiceProviderConfiguration.java56
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProvider.java)4
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogServiceProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java)21
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java)26
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogSubscriptionServiceProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogSubscriptionServiceProvider.java)8
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogUrlProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogUrlProvider.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java)4
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/EtsiSubscriptionNotificationController.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java)59
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/Sol003PackageManagementController.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java)12
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/Sol003PackageManagementSubscriptionController.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java)12
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/AuthenticationTypeNotSupportedException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/AuthenticationTypeNotSupportedException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/ConversionFailedException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/ConversionFailedException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/EtsiCatalogManagerBadRequestException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/EtsiCatalogManagerBadRequestException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/EtsiCatalogManagerRequestFailureException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/EtsiCatalogManagerRequestFailureException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/EtsiSubscriptionNotificationControllerExceptionHandler.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/EtsiSubscriptionNotificationControllerExceptionHandler.java)6
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/InternalServerErrorException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/InternalServerErrorException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/NotificationTypeNotSupportedException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/NotificationTypeNotSupportedException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/Sol003PackageManagementControllerExceptionHandler.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/Sol003PackageManagementControllerExceptionHandler.java)6
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/SubscriptionNotFoundException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/SubscriptionNotFoundException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/VnfPkgBadRequestException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfPkgBadRequestException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/VnfPkgConflictException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfPkgConflictException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/VnfPkgNotFoundException.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfPkgNotFoundException.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/AbstractNotificationServiceProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java)4
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/BasicAuthNotificationServiceProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java)6
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/NotificationManager.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationManager.java)24
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/NotificationServiceProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationServiceProvider.java)6
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/NotificationServiceProviderFactory.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationServiceProviderFactory.java)6
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/OAuthNotificationServiceProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java)9
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/OAuthTokenResponse.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthTokenResponse.java)2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/SubscriptionManager.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java)44
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/TlsNotificationServiceProvider.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/TlsNotificationServiceProvider.java)9
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/EtsiSubscriptionNotificationControllerTest.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java)198
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/Sol003PackageManagementControllerTest.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java)106
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/Sol003PackageManagementSubscriptionControllerTest.java (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java)66
-rwxr-xr-xadapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/TestApplication.java38
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/resources/application.yaml61
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/resources/requests/SubscriptionRequest.json (renamed from adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/requests/SubscriptionRequest.json)0
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/pom.xml196
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/src/main/resources/ETSI-Catalog-Notification-API.json (renamed from adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/ETSI-Catalog-Notification-API.json)0
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/src/main/resources/SOL003-VNFPackageManagement-API.json (renamed from adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFPackageManagement-API.json)0
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/pom.xml197
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/src/main/resources/ETSI-Catalog-API.json (renamed from adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json)0
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/src/main/resources/SOL003-VNFPackageManagement-Notification-API.json (renamed from adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/SOL003-VNFPackageManagement-Notification-API.json)0
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/pom.xml17
-rw-r--r--adapters/etsi-sol003-adapter/pom.xml35
-rw-r--r--adapters/mso-adapter-utils/pom.xml8
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java21
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java22
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java1
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java12
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaCacheConfig.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotificationResponse.java)53
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClient.java52
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClientImpl.java64
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyExceptionTest.java1
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTest.java1
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeoutTest.java1
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/MsoTenantTest.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameterTest.java2
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVolumeGroupResponse.java96
-rw-r--r--adapters/mso-catalog-db-adapter/pom.xml28
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java14
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfo.java1
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java112
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java7
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java1
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql38
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7.1__Update_Optical_Service_Recipe.sql6
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7__AddProcessingFlags.sql13
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java42
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java8
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql6
-rw-r--r--adapters/mso-nssmf-adapter/pom.xml18
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientPropertiesImpl.java4
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiClientProvider.java2
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/extclients/aai/AaiServiceProviderImpl.java4
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/application-aaf.yaml0
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/application-basic.yaml0
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/application.yaml16
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/nssmf.jksbin1386 -> 0 bytes
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/nssmf.p12bin1616 -> 0 bytes
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.jksbin1386 -> 0 bytes
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.p12bin1616 -> 4095 bytes
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.trust.jksbin0 -> 1413 bytes
-rw-r--r--adapters/mso-openstack-adapters/pom.xml15
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java12
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java79
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryService.java52
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryTask.java106
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java7
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java104
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java605
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java552
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java660
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotification.java394
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotificationResponse.java53
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotification.java162
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotificationResponse.java53
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoExceptionCategory.java61
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoRequest.java97
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify.java170
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java110
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkRollback.java325
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkStatus.java63
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java311
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotification.java447
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotification.java139
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotificationResponse.java53
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotification.java350
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotificationResponse.java53
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java46
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java3
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java14
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java116
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java41
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java36
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java16
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java189
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java150
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java33
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java250
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java238
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java1142
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java1169
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java578
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java104
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java626
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java626
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java606
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java5
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java92
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java23
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java94
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java1
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java8
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java150
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java269
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java364
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java13
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java49
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java3
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java58
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java308
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java231
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java166
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java110
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java557
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java194
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java190
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java129
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java107
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java7
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml15
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java2
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomController.java16
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java7
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java21
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/OrchestrationTaskRepositoryCustomController.java10
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.3__Add_Columns_Workflow_Name_Operation_Name.sql7
-rw-r--r--adapters/mso-sdnc-adapter/pom.xml30
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java103
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/InstantiatedVnfInfo.java1
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsLinkPortInfo.java1
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java1
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml325
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties1
-rw-r--r--adapters/mso-vnfm-adapter/pom.xml21
-rw-r--r--adapters/pom.xml9
-rw-r--r--adapters/so-appc-orchestrator/pom.xml16
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java2
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java2
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java2
290 files changed, 4492 insertions, 14688 deletions
diff --git a/adapters/mso-ve-vnfm-adapter/pom.xml b/adapters/etsi-sol002-adapter/pom.xml
index 3d054d9eca..b419d8806b 100644
--- a/adapters/mso-ve-vnfm-adapter/pom.xml
+++ b/adapters/etsi-sol002-adapter/pom.xml
@@ -12,11 +12,10 @@
</parent>
<groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-ve-vnfm-adapter</artifactId>
+ <artifactId>etsi-sol002-adapter</artifactId>
<packaging>jar</packaging>
- <name>mso-ve-vnfm-adapter</name>
- <description>Ve-Vnfm (SOL002) Adapter</description>
+ <name>ETSI SOL002 Application Jar</name>
<properties>
<java.version>1.8</java.version>
@@ -35,7 +34,12 @@
</dependency>
<dependency>
<groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-vnfm-adapter-ext-clients</artifactId>
+ <artifactId>etsi-sol003-lcm-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>etsi-sol003-lcm-ext-clients</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/Application.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/Application.java
index 875fddd7f0..875fddd7f0 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/Application.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/Application.java
diff --git a/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
new file mode 100644
index 0000000000..3995185f23
--- /dev/null
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
@@ -0,0 +1,212 @@
+/*-
+ * ============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 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.*;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
+import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AaiConnection {
+
+ private static final Logger logger = LoggerFactory.getLogger(AaiConnection.class);
+ private static final String VSERVER = "vserver";
+ private static final String CLOUD_OWNER = "cloud-region.cloud-owner";
+ private static final String CLOUD_REGION_ID = "cloud-region.cloud-region-id";
+ private static final String TENANT_ID = "tenant.tenant-id";
+ private static final String VSERVER_ID = "vserver.vserver-id";
+ private static final String VSERVER_NAME = "vserver.vserver-name";
+ private static final String SELFLINK = "selflink";
+ private static final int FIRST_INDEX = 0;
+
+ private AAIResourcesClient resourcesClient = null;
+
+ 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");
+ }
+ }
+
+ static String getRelationshipData(final Relationship relationship, final String relationshipDataKey) {
+ if (relationship != null && relationship.getRelationshipData() != null) {
+ for (final RelationshipData relationshipData : relationship.getRelationshipData()) {
+ if (relationshipDataKey.equals(relationshipData.getRelationshipKey())) {
+ return relationshipData.getRelationshipValue();
+ }
+ }
+ }
+
+ return null;
+ }
+
+ static String getRelatedToProperty(final Relationship relationship, final String propertyKey) {
+ if (relationship != null && relationship.getRelatedToProperty() != null) {
+ for (final RelatedToProperty relatedToProperty : relationship.getRelatedToProperty()) {
+ if (propertyKey.equals(relatedToProperty.getPropertyKey())) {
+ return relatedToProperty.getPropertyValue();
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private AAIResourcesClient getResourcesClient() {
+ if (resourcesClient == null) {
+ resourcesClient = new AAIResourcesClient();
+ }
+
+ return resourcesClient;
+ }
+
+ 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 AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VNFM_LIST);
+ final Optional<EsrVnfmList> response = getResourcesClient().get(EsrVnfmList.class, resourceUri);
+
+ if (response.isPresent()) {
+ final EsrVnfmList esrVnfmList = response.get();
+ logger.info("The AAI ESR replied with: {}", esrVnfmList);
+ final List<EsrVnfm> esrVnfm = esrVnfmList.getEsrVnfm();
+
+ final List<EsrSystemInfo> infos = new LinkedList<>();
+
+ for (final EsrVnfm vnfm : esrVnfm) {
+ final String vnfmId = vnfm.getVnfmId();
+ infos.addAll(receiveVnfmServiceUrl(vnfmId));
+ }
+
+ return infos;
+ }
+
+ return null;
+ }
+
+ private List<EsrSystemInfo> receiveVnfmServiceUrl(final String vnfmId) {
+ final Optional<EsrVnfm> response = getResourcesClient().get(EsrVnfm.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId).depth(Depth.ONE));
+
+ if (response.isPresent()) {
+ final EsrVnfm esrVnfm = response.get();
+ logger.info("The AAI ESR replied with: {}", esrVnfm);
+ final EsrSystemInfoList esrSystemInfoList = esrVnfm.getEsrSystemInfoList();
+
+ if (esrSystemInfoList != null) {
+ return esrSystemInfoList.getEsrSystemInfo();
+ }
+ }
+
+ return Collections.emptyList();
+ }
+
+ public String receiveGenericVnfId(final String href) {
+ final AAIResourceUri resourceUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNFS).queryParam(SELFLINK, href);
+ final Optional<GenericVnfs> response = getResourcesClient().get(GenericVnfs.class, resourceUri);
+
+ if (response.isPresent()) {
+ final GenericVnfs vnfs = response.get();
+ logger.info("The AAI replied with: {}", vnfs);
+ final List<GenericVnf> genericVnfList = vnfs.getGenericVnf();
+ final int size = genericVnfList.size();
+
+ if (size == 1) {
+ final GenericVnf genericVnf = genericVnfList.get(FIRST_INDEX);
+ return genericVnf.getVnfId();
+ } else if (size > 1) {
+ logger.warn("more generic vnfs available");
+ }
+ }
+
+ return null;
+ }
+
+ public String receiveVserverName(final String genericId) {
+ final AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericId);
+ final Optional<GenericVnf> response = getResourcesClient().get(GenericVnf.class, resourceUri);
+
+ if (response.isPresent()) {
+ final GenericVnf genericVnf = response.get();
+ final RelationshipList relationshipList = genericVnf.getRelationshipList();
+
+ if (relationshipList == null || relationshipList.getRelationship() == null) {
+ return null;
+ }
+
+ for (final Relationship relationship : relationshipList.getRelationship()) {
+ if (VSERVER.equals(relationship.getRelatedTo())) {
+ final String vserverName = getRelatedToProperty(relationship, VSERVER_NAME);
+
+ if (vserverName == null) {
+ final String cloudOwner = getRelationshipData(relationship, CLOUD_OWNER);
+ final String cloudId = getRelationshipData(relationship, CLOUD_REGION_ID);
+ final String tenantId = getRelationshipData(relationship, TENANT_ID);
+ final String vserverId = getRelationshipData(relationship, VSERVER_ID);
+ return receiveVserverNameFromParams(cloudOwner, cloudId, tenantId, vserverId);
+ }
+
+ return vserverName;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private String receiveVserverNameFromParams(final String cloudOwner, final String cloudId, final String tenantId,
+ final String vserverId) {
+ final AAIResourceUri resourceUri =
+ AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudId, tenantId, vserverId);
+ final Optional<Vserver> response = getResourcesClient().get(Vserver.class, resourceUri);
+
+ if (response.isPresent()) {
+ final Vserver vserver = response.get();
+ return vserver.getVserverName();
+ }
+
+ return null;
+ }
+}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiPropertiesExt.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiPropertiesExt.java
index aa8c7f68c9..5e3212a225 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiPropertiesExt.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiPropertiesExt.java
@@ -22,22 +22,26 @@ package org.onap.so.adapters.vevnfm.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.adapters.vevnfm.configuration.ConfigProperties;
+import org.onap.aaiclient.client.aai.AAIProperties;
+import org.onap.aaiclient.client.aai.AAIVersion;
import org.onap.so.spring.SpringContextHelper;
import org.springframework.context.ApplicationContext;
public class AaiPropertiesExt implements AAIProperties {
+ private static final String MSO = "MSO";
+
private final String endpoint;
private final String encryptedBasicAuth;
private final String encryptionKey;
public AaiPropertiesExt() {
final ApplicationContext context = SpringContextHelper.getAppContext();
- this.endpoint = context.getEnvironment().getProperty("aai.endpoint");
- this.encryptedBasicAuth = context.getEnvironment().getProperty("aai.auth");
- this.encryptionKey = context.getEnvironment().getProperty("mso.key");
+ final ConfigProperties configProperties = context.getBean(ConfigProperties.class);
+ this.endpoint = configProperties.getAaiEndpoint();
+ this.encryptedBasicAuth = configProperties.getAaiAuth();
+ this.encryptionKey = configProperties.getMsoKey();
}
@Override
@@ -47,7 +51,7 @@ public class AaiPropertiesExt implements AAIProperties {
@Override
public String getSystemName() {
- return "MSO";
+ return MSO;
}
@Override
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/EsrId.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/EsrId.java
index 13ff2b6397..13ff2b6397 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/EsrId.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/EsrId.java
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java
index 411572ff5b..411572ff5b 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java
diff --git a/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ConfigProperties.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ConfigProperties.java
new file mode 100644
index 0000000000..d4ca5af0f2
--- /dev/null
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ConfigProperties.java
@@ -0,0 +1,134 @@
+/*-
+ * ============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.configuration;
+
+import org.onap.so.adapters.vevnfm.constant.NotificationVnfFilterType;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class ConfigProperties {
+
+ @Value("${vevnfmadapter.vnf-filter-json}")
+ private String vevnfmadapterVnfFilterJson;
+
+ @Value("${vevnfmadapter.endpoint}")
+ private String vevnfmadapterEndpoint;
+
+ @Value("${mso.key}")
+ private String msoKey;
+
+ @Value("${aai.endpoint}")
+ private String aaiEndpoint;
+
+ @Value("${aai.auth}")
+ private String aaiAuth;
+
+ @Value("${vnfm.default-endpoint}")
+ private String vnfmDefaultEndpoint;
+
+ @Value("${vnfm.subscription}")
+ private String vnfmSubscription;
+
+ @Value("${vnfm.notification}")
+ private String vnfmNotification;
+
+ @Value("${notification.vnf-filter-type}")
+ private NotificationVnfFilterType notificationVnfFilterType;
+
+ @Value("${dmaap.endpoint}")
+ private String dmaapEndpoint;
+
+ @Value("${dmaap.topic}")
+ private String dmaapTopic;
+
+ @Value("${dmaap.closed-loop.control.name}")
+ private String dmaapClosedLoopControlName;
+
+ @Value("${dmaap.version}")
+ private String dmaapVersion;
+
+ @Value("${spring.security.usercredentials[0].username}")
+ private String springSecurityUsername;
+
+ @Value("${spring.security.usercredentials[0].openpass}")
+ private String springSecurityOpenpass;
+
+ public String getVevnfmadapterVnfFilterJson() {
+ return vevnfmadapterVnfFilterJson;
+ }
+
+ public String getVevnfmadapterEndpoint() {
+ return vevnfmadapterEndpoint;
+ }
+
+ public String getMsoKey() {
+ return msoKey;
+ }
+
+ public String getAaiEndpoint() {
+ return aaiEndpoint;
+ }
+
+ public String getAaiAuth() {
+ return aaiAuth;
+ }
+
+ public String getVnfmDefaultEndpoint() {
+ return vnfmDefaultEndpoint;
+ }
+
+ public String getVnfmSubscription() {
+ return vnfmSubscription;
+ }
+
+ public String getVnfmNotification() {
+ return vnfmNotification;
+ }
+
+ public NotificationVnfFilterType getNotificationVnfFilterType() {
+ return notificationVnfFilterType;
+ }
+
+ public String getDmaapEndpoint() {
+ return dmaapEndpoint;
+ }
+
+ public String getDmaapTopic() {
+ return dmaapTopic;
+ }
+
+ public String getDmaapClosedLoopControlName() {
+ return dmaapClosedLoopControlName;
+ }
+
+ public String getDmaapVersion() {
+ return dmaapVersion;
+ }
+
+ public String getSpringSecurityUsername() {
+ return springSecurityUsername;
+ }
+
+ public String getSpringSecurityOpenpass() {
+ return springSecurityOpenpass;
+ }
+}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java
index c033fc3f96..8b5afbf6a1 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/StartupConfiguration.java
@@ -36,14 +36,17 @@ public class StartupConfiguration {
public static final String TEST_PROFILE = "test";
- @Autowired
- private Environment environment;
-
- @Autowired
- private StartupService startupService;
+ private final Environment environment;
+ private final StartupService startupService;
+ private final SubscriptionScheduler subscriptionScheduler;
@Autowired
- private SubscriptionScheduler subscriptionScheduler;
+ public StartupConfiguration(final Environment environment, final StartupService startupService,
+ final SubscriptionScheduler subscriptionScheduler) {
+ this.environment = environment;
+ this.startupService = startupService;
+ this.subscriptionScheduler = subscriptionScheduler;
+ }
@EventListener(ApplicationReadyEvent.class)
public void onApplicationReadyEvent() throws Exception {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/package-info.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/constant/NotificationVnfFilterType.java
index fdd8711170..57935a9fda 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/package-info.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/constant/NotificationVnfFilterType.java
@@ -1,15 +1,15 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP - SO
+ * SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -17,5 +17,25 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.onap.so/networkNotify")
-package org.onap.so.adapters.network.async.client;
+
+package org.onap.so.adapters.vevnfm.constant;
+
+/**
+ * Select which incoming Notification with particular VNF id should be supported
+ */
+public enum NotificationVnfFilterType {
+ /**
+ * None
+ */
+ NONE,
+
+ /**
+ * Only those which are valid in AAI
+ */
+ AAI_CHECKED,
+
+ /**
+ * All
+ */
+ ALL
+}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java
index cb324c32a9..1162ee5605 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/controller/NotificationController.java
@@ -20,11 +20,10 @@
package org.onap.so.adapters.vevnfm.controller;
-import org.onap.so.adapters.vevnfm.service.DmaapService;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification;
+import org.onap.so.adapters.vevnfm.service.DmaapConditionalSender;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -35,13 +34,22 @@ public class NotificationController {
private static final Logger logger = LoggerFactory.getLogger(NotificationController.class);
- @Autowired
- private DmaapService dmaapService;
+ private final DmaapConditionalSender dmaapConditionalSender;
+
+ public NotificationController(final DmaapConditionalSender dmaapConditionalSender) {
+ this.dmaapConditionalSender = dmaapConditionalSender;
+ }
@PostMapping("${vnfm.notification}")
public ResponseEntity receiveNotification(@RequestBody final VnfLcmOperationOccurrenceNotification notification) {
logger.info("Notification received {}", notification);
- dmaapService.send(notification);
+
+ try {
+ dmaapConditionalSender.send(notification);
+ } catch (NullPointerException e) {
+ logger.warn("NullPointerException caught while sending to DMaaP", e);
+ }
+
return ResponseEntity.ok().build();
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java
index ceabb8a020..6c7aaf8f5c 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/AaiEvent.java
@@ -25,11 +25,13 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class AaiEvent {
private final boolean vserverIsClosedLoopDisabled;
+ private final String vserverName;
private final String genericVnfVnfId;
- public AaiEvent(final boolean cld, final String id) {
- this.vserverIsClosedLoopDisabled = cld;
- this.genericVnfVnfId = id;
+ public AaiEvent(final boolean vserverIsClosedLoopDisabled, final String vserverName, final String genericVnfVnfId) {
+ this.vserverIsClosedLoopDisabled = vserverIsClosedLoopDisabled;
+ this.vserverName = vserverName;
+ this.genericVnfVnfId = genericVnfVnfId;
}
@JsonProperty("vserver.is-closed-loop-disabled")
@@ -37,6 +39,11 @@ public class AaiEvent {
return vserverIsClosedLoopDisabled;
}
+ @JsonProperty("vserver.vserver-name")
+ public String getVserverName() {
+ return vserverName;
+ }
+
@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/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java
index dc0c5502dd..55a36a5d85 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/event/DmaapEvent.java
@@ -24,7 +24,7 @@ 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;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification;
public class DmaapEvent {
@@ -47,7 +47,8 @@ public class DmaapEvent {
private final VnfLcmOperationOccurrenceNotification etsiLcmEvent;
public DmaapEvent(final String closedLoopControlName, final String version,
- final VnfLcmOperationOccurrenceNotification etsiLcmEvent) {
+ final VnfLcmOperationOccurrenceNotification etsiLcmEvent, final String vserverName,
+ final String genericId) {
this.closedLoopControlName = closedLoopControlName;
this.closedLoopAlarmStart = Instant.now().getLong(INSTANT_SECONDS);
this.closedLoopEventClient = MSERVICE;
@@ -55,7 +56,7 @@ public class DmaapEvent {
this.requestId = UUID.randomUUID().toString();
this.targetType = VNF;
this.target = VNFID;
- this.aaiEvent = new AaiEvent(false, etsiLcmEvent.getId());
+ this.aaiEvent = (genericId == null) ? null : new AaiEvent(false, vserverName, genericId);
this.from = ETSI;
this.version = version;
this.etsiLcmEvent = etsiLcmEvent;
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java
index a0c1c1e9db..a0c1c1e9db 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/exception/VeVnfmException.java
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
index 838a67d115..838a67d115 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
diff --git a/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapConditionalSender.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapConditionalSender.java
new file mode 100644
index 0000000000..13cc5d3a1e
--- /dev/null
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapConditionalSender.java
@@ -0,0 +1,93 @@
+/*-
+ * ============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.apache.logging.log4j.util.Strings;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification;
+import org.onap.so.adapters.vevnfm.aai.AaiConnection;
+import org.onap.so.adapters.vevnfm.configuration.ConfigProperties;
+import org.onap.so.adapters.vevnfm.constant.NotificationVnfFilterType;
+import org.onap.so.adapters.vevnfm.event.DmaapEvent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+@Service
+public class DmaapConditionalSender {
+
+ private static final Logger logger = LoggerFactory.getLogger(DmaapConditionalSender.class);
+
+ private final NotificationVnfFilterType notificationVnfFilterType;
+ private final AaiConnection aaiConnection;
+ private final DmaapService dmaapService;
+
+ public DmaapConditionalSender(final ConfigProperties configProperties, final AaiConnection aaiConnection,
+ final DmaapService dmaapService) {
+ this.notificationVnfFilterType = configProperties.getNotificationVnfFilterType();
+ this.aaiConnection = aaiConnection;
+ this.dmaapService = dmaapService;
+ }
+
+ public void send(final VnfLcmOperationOccurrenceNotification notification) {
+ final String href = notification.getLinks().getVnfInstance().getHref();
+ DmaapEvent dmaapEvent = null;
+
+ switch (notificationVnfFilterType) {
+ case ALL:
+ dmaapEvent = conditionalSend(true, notification, href);
+ break;
+ case AAI_CHECKED:
+ dmaapEvent = conditionalSend(false, notification, href);
+ break;
+ case NONE:
+ break;
+ default:
+ throw new IllegalArgumentException(
+ "The value of VnfNotificationFilterType is not supported: " + notificationVnfFilterType);
+ }
+
+ final String vnfInstanceId = notification.getVnfInstanceId();
+
+ if (dmaapEvent == null) {
+ logger.info("The info with the VNF id '{}' is not sent to DMaaP", vnfInstanceId);
+ } else {
+ dmaapService.send(dmaapEvent);
+ logger.info("The info with the VNF id '{}' is sent to DMaaP", vnfInstanceId);
+ }
+ }
+
+ private DmaapEvent conditionalSend(final boolean allowAll, final VnfLcmOperationOccurrenceNotification notification,
+ final String href) {
+ final String genericId = aaiConnection.receiveGenericVnfId(href);
+ final boolean idNotBlank = Strings.isNotBlank(genericId);
+ String vserverName = null;
+
+ if (idNotBlank) {
+ vserverName = aaiConnection.receiveVserverName(genericId);
+ }
+
+ if (allowAll || idNotBlank) {
+ return dmaapService.createDmaapEvent(notification, vserverName, genericId);
+ }
+
+ return null;
+ }
+}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java
index c685ae815a..435e8e0593 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/DmaapService.java
@@ -20,13 +20,13 @@
package org.onap.so.adapters.vevnfm.service;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification;
+import org.onap.so.adapters.vevnfm.configuration.ConfigProperties;
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;
import org.slf4j.LoggerFactory;
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.Service;
@@ -36,24 +36,28 @@ public class DmaapService {
private static final Logger logger = LoggerFactory.getLogger(DmaapService.class);
- @Value("${dmaap.endpoint}")
- private String endpoint;
-
- @Value("${dmaap.topic}")
- private String topic;
-
- @Value("${dmaap.closed-loop.control.name}")
- private String closedLoopControlName;
-
- @Value("${dmaap.version}")
- private String version;
+ private final String endpoint;
+ private final String topic;
+ private final String closedLoopControlName;
+ private final String version;
+ private final HttpRestServiceProvider restProvider;
@Autowired
- private HttpRestServiceProvider restProvider;
+ public DmaapService(final ConfigProperties configProperties, final HttpRestServiceProvider restProvider) {
+ this.endpoint = configProperties.getDmaapEndpoint();
+ this.topic = configProperties.getDmaapTopic();
+ this.closedLoopControlName = configProperties.getDmaapClosedLoopControlName();
+ this.version = configProperties.getDmaapVersion();
+ this.restProvider = restProvider;
+ }
+
+ public DmaapEvent createDmaapEvent(final VnfLcmOperationOccurrenceNotification notification,
+ final String vserverName, final String genericId) {
+ return new DmaapEvent(closedLoopControlName, version, notification, vserverName, genericId);
+ }
- public void send(final VnfLcmOperationOccurrenceNotification notification) {
+ public void send(final DmaapEvent event) {
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();
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
index 92906ef35c..c128275e43 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
@@ -24,11 +24,11 @@ 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.configuration.ConfigProperties;
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;
@@ -41,11 +41,14 @@ public class StartupService {
private static final Logger logger = LoggerFactory.getLogger(StartupService.class);
- @Value("${vnfm.default-endpoint}")
- private String vnfmDefaultEndpoint;
+ private final String vnfmDefaultEndpoint;
+ private final AaiConnection aaiConnection;
@Autowired
- private AaiConnection aaiConnection;
+ public StartupService(final ConfigProperties configProperties, final AaiConnection aaiConnection) {
+ this.vnfmDefaultEndpoint = configProperties.getVnfmDefaultEndpoint();
+ this.aaiConnection = aaiConnection;
+ }
@Retryable(value = {Exception.class}, maxAttempts = 5, backoff = @Backoff(delay = 5000, multiplier = 2))
public List<EsrSystemInfo> receiveVnfm() throws VeVnfmException {
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscribeSender.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscribeSender.java
index d01c3c8f66..576d58f7be 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscribeSender.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscribeSender.java
@@ -20,18 +20,18 @@
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.etsisol003adapter.lcm.extclients.vnfm.model.LccnSubscriptionRequest;
+import org.onap.so.adapters.vevnfm.configuration.ConfigProperties;
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;
import org.slf4j.LoggerFactory;
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.Service;
+import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.ToString;
@Service
@@ -41,11 +41,14 @@ public class SubscribeSender {
private static final Logger logger = LoggerFactory.getLogger(SubscribeSender.class);
- @Value("${vnfm.subscription}")
- private String vnfmSubscription;
+ private final String vnfmSubscription;
+ private final HttpRestServiceProvider restProvider;
@Autowired
- private HttpRestServiceProvider restProvider;
+ public SubscribeSender(final ConfigProperties configProperties, final HttpRestServiceProvider restProvider) {
+ this.vnfmSubscription = configProperties.getVnfmSubscription();
+ this.restProvider = restProvider;
+ }
public String send(final EsrSystemInfo info, final LccnSubscriptionRequest request) throws VeVnfmException {
final ResponseEntity<SubscribeToManoResponse> response =
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
index 9760584d7a..e9e288b224 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
@@ -20,39 +20,45 @@
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.etsisol003adapter.lcm.extclients.vnfm.model.LccnSubscriptionRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.SubscriptionsAuthentication;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.SubscriptionsAuthenticationParamsBasic;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.SubscriptionsFilter;
+import org.onap.so.adapters.vevnfm.configuration.ConfigProperties;
import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
import org.onap.so.adapters.vevnfm.provider.AuthorizationHeadersProvider;
-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;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
+import com.google.gson.Gson;
+import com.squareup.okhttp.Credentials;
@Service
public class SubscriberService {
- @Value("${vevnfmadapter.endpoint}")
- private String endpoint;
-
- @Value("${vnfm.notification}")
- private String notification;
+ private static final Gson gson = new Gson();
- @Value("${spring.security.usercredentials[0].username}")
- private String username;
-
- @Value("${spring.security.usercredentials[0].openpass}")
- private String openpass;
+ private final String vnfFilter;
+ private final String endpoint;
+ private final String notification;
+ private final String username;
+ private final String openpass;
+ private final AuthorizationHeadersProvider headersProvider;
+ private final SubscribeSender sender;
@Autowired
- private AuthorizationHeadersProvider headersProvider;
-
- @Autowired
- private SubscribeSender sender;
+ public SubscriberService(final ConfigProperties configProperties,
+ final AuthorizationHeadersProvider headersProvider, final SubscribeSender sender) {
+ this.vnfFilter = configProperties.getVevnfmadapterVnfFilterJson();
+ this.endpoint = configProperties.getVevnfmadapterEndpoint();
+ this.notification = configProperties.getVnfmNotification();
+ this.username = configProperties.getSpringSecurityUsername();
+ this.openpass = configProperties.getSpringSecurityOpenpass();
+ this.headersProvider = headersProvider;
+ this.sender = sender;
+ }
private static String getAuthorization(final EsrSystemInfo info) {
if (info == null) {
@@ -91,6 +97,7 @@ public class SubscriberService {
private LccnSubscriptionRequest createRequest() {
final LccnSubscriptionRequest request = new LccnSubscriptionRequest();
+ request.filter(getFilter());
request.callbackUri(getCallbackUri());
final SubscriptionsAuthenticationParamsBasic paramsBasic = new SubscriptionsAuthenticationParamsBasic();
final SubscriptionsAuthentication authentication = new SubscriptionsAuthentication();
@@ -103,6 +110,10 @@ public class SubscriberService {
return request;
}
+ private SubscriptionsFilter getFilter() {
+ return gson.fromJson(vnfFilter, SubscriptionsFilter.class);
+ }
+
private String getCallbackUri() {
return endpoint + notification;
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java
index d9f3acc3df..a696336011 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriptionScheduler.java
@@ -38,11 +38,14 @@ public class SubscriptionScheduler {
private static final Logger logger = LoggerFactory.getLogger(SubscriptionScheduler.class);
- @Autowired
- private SubscriberService subscriberService;
-
+ private final SubscriberService subscriberService;
private List<EsrId> esrIds;
+ @Autowired
+ public SubscriptionScheduler(final SubscriberService subscriberService) {
+ this.subscriberService = subscriberService;
+ }
+
public void setInfos(final List<EsrSystemInfo> infos) {
esrIds = new LinkedList<>();
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties b/adapters/etsi-sol002-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
index 9fc8e62cf5..9fc8e62cf5 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
+++ b/adapters/etsi-sol002-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml b/adapters/etsi-sol002-adapter/src/main/resources/application.yaml
index a2a33bfb5c..c69c95187a 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/resources/application.yaml
+++ b/adapters/etsi-sol002-adapter/src/main/resources/application.yaml
@@ -18,6 +18,7 @@ server:
port: 9098
vevnfmadapter:
+ vnf-filter-json: '{notificationTypes:[VnfLcmOperationOccurrenceNotification],operationStates:[COMPLETED]}'
endpoint: http://so-ve-vnfm-adapter.onap:9098
mso:
@@ -32,6 +33,9 @@ vnfm:
subscription: /vnflcm/v1/subscriptions
notification: /lcm/v1/vnf/instances/notifications
+notification:
+ vnf-filter-type: NONE
+
dmaap:
endpoint: http://message-router.onap:30227
topic: /events/unauthenticated.DCAE_CL_OUTPUT
diff --git a/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/aai/AaiConnectionTest.java b/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/aai/AaiConnectionTest.java
new file mode 100644
index 0000000000..12928ae9ed
--- /dev/null
+++ b/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/aai/AaiConnectionTest.java
@@ -0,0 +1,65 @@
+/*-
+ * ============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 static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import org.onap.aai.domain.yang.RelatedToProperty;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.aai.domain.yang.RelationshipData;
+
+public class AaiConnectionTest {
+
+ private static final String KEY = "key";
+ private static final String VALUE = "value";
+
+ @Test
+ public void testRelationshipData() {
+ // given
+ final Relationship relationship = new Relationship();
+ final RelationshipData data = new RelationshipData();
+ data.setRelationshipKey(KEY);
+ data.setRelationshipValue(VALUE);
+ relationship.getRelationshipData().add(data);
+
+ // when
+ final String value = AaiConnection.getRelationshipData(relationship, KEY);
+
+ // then
+ assertEquals(VALUE, value);
+ }
+
+ @Test
+ public void testRelatedToProperty() {
+ // given
+ final Relationship relationship = new Relationship();
+ final RelatedToProperty property = new RelatedToProperty();
+ property.setPropertyKey(KEY);
+ property.setPropertyValue(VALUE);
+ relationship.getRelatedToProperty().add(property);
+
+ // when
+ final String value = AaiConnection.getRelatedToProperty(relationship, KEY);
+
+ // then
+ assertEquals(VALUE, value);
+ }
+}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java b/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java
index 974e6ec544..9406b299ea 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java
+++ b/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/controller/NotificationControllerTest.java
@@ -21,28 +21,23 @@
package org.onap.so.adapters.vevnfm.controller;
import static org.junit.Assert.assertEquals;
-import static org.springframework.test.web.client.ExpectedCount.once;
-import static org.springframework.test.web.client.match.MockRestRequestMatchers.anything;
-import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.so.adapters.vevnfm.configuration.ConfigProperties;
import org.onap.so.adapters.vevnfm.configuration.StartupConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockHttpServletResponse;
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.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
-import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.WebApplicationContext;
@SpringBootTest
@@ -50,34 +45,30 @@ import org.springframework.web.context.WebApplicationContext;
@ActiveProfiles(StartupConfiguration.TEST_PROFILE)
public class NotificationControllerTest {
- private static final String MINIMAL_JSON_CONTENT = "{}";
- private static final int ZERO = 0;
+ private static final String JSON = "{\"_links\":{\"vnfInstance\":{\"href\":null}}}";
- @Value("${vnfm.notification}")
- private String notification;
+ private static final int ZERO = 0;
@Autowired
- private WebApplicationContext webApplicationContext;
+ private ConfigProperties configProperties;
@Autowired
- private RestTemplate restTemplate;
+ private WebApplicationContext webApplicationContext;
+ private String notification;
private MockMvc mvc;
- private MockRestServiceServer mockRestServer;
@Before
public void init() {
+ notification = configProperties.getVnfmNotification();
mvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
- mockRestServer = MockRestServiceServer.bindTo(restTemplate).build();
}
@Test
public void testReceiveNotification() throws Exception {
// given
- final MockHttpServletRequestBuilder request = MockMvcRequestBuilders.post(notification)
- .contentType(MediaType.APPLICATION_JSON).content(MINIMAL_JSON_CONTENT);
-
- mockRestServer.expect(once(), anything()).andRespond(withSuccess());
+ final MockHttpServletRequestBuilder request =
+ MockMvcRequestBuilders.post(notification).contentType(MediaType.APPLICATION_JSON).content(JSON);
// when
final MvcResult mvcResult = mvc.perform(request).andReturn();
@@ -86,6 +77,5 @@ public class NotificationControllerTest {
final MockHttpServletResponse response = mvcResult.getResponse();
assertEquals(HttpStatus.OK.value(), response.getStatus());
assertEquals(ZERO, response.getContentLength());
- mockRestServer.verify();
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java b/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java
index f9ae427086..f9ae427086 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java
+++ b/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java
diff --git a/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/DmaapConditionalSenderTest.java b/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/DmaapConditionalSenderTest.java
new file mode 100644
index 0000000000..428ccad054
--- /dev/null
+++ b/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/DmaapConditionalSenderTest.java
@@ -0,0 +1,151 @@
+/*-
+ * ============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.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.*;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationLinks;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationLinksVnfInstance;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification;
+import org.onap.so.adapters.vevnfm.aai.AaiConnection;
+import org.onap.so.adapters.vevnfm.configuration.ConfigProperties;
+import org.onap.so.adapters.vevnfm.constant.NotificationVnfFilterType;
+import org.onap.so.adapters.vevnfm.event.DmaapEvent;
+
+@RunWith(MockitoJUnitRunner.class)
+public class DmaapConditionalSenderTest {
+
+ private static final String VSERVER_NAME = "vsn";
+ private static final String GENERIC_ID = "gener77";
+ private static final String INSTANCE_ID = "insta44";
+ private static final String HREF = "/href";
+
+ @Mock
+ private ConfigProperties configProperties;
+
+ @Mock
+ private AaiConnection aaiConnection;
+
+ @Mock
+ private DmaapService dmaapService;
+
+ private static VnfLcmOperationOccurrenceNotification createNotification() {
+ final VnfLcmOperationOccurrenceNotification notification = new VnfLcmOperationOccurrenceNotification();
+ final LcnVnfLcmOperationOccurrenceNotificationLinks links = new LcnVnfLcmOperationOccurrenceNotificationLinks();
+ final LcnVnfLcmOperationOccurrenceNotificationLinksVnfInstance vnfInstance =
+ new LcnVnfLcmOperationOccurrenceNotificationLinksVnfInstance();
+
+ notification.setVnfInstanceId(INSTANCE_ID);
+ notification.setLinks(links);
+ links.setVnfInstance(vnfInstance);
+ vnfInstance.setHref(HREF);
+
+ return notification;
+ }
+
+ private static DmaapEvent createDmaapEvent() {
+ return new DmaapEvent(null, null, null, null, null);
+ }
+
+ @Test
+ public void testSendNone() {
+ // given
+ when(configProperties.getNotificationVnfFilterType()).thenReturn(NotificationVnfFilterType.NONE);
+
+ final DmaapConditionalSender sender = new DmaapConditionalSender(configProperties, aaiConnection, dmaapService);
+ final VnfLcmOperationOccurrenceNotification notification = createNotification();
+
+ // when
+ sender.send(notification);
+
+ // then
+ verify(aaiConnection, never()).receiveGenericVnfId(any());
+ verify(dmaapService, never()).createDmaapEvent(any(), any(), any());
+ verify(dmaapService, never()).send(any());
+ }
+
+ @Test
+ public void testSendAll() {
+ // given
+ final VnfLcmOperationOccurrenceNotification notification = createNotification();
+ final DmaapEvent dmaapEvent = createDmaapEvent();
+
+ when(configProperties.getNotificationVnfFilterType()).thenReturn(NotificationVnfFilterType.ALL);
+ when(aaiConnection.receiveGenericVnfId(eq(HREF))).thenReturn(GENERIC_ID);
+ when(aaiConnection.receiveVserverName(eq(GENERIC_ID))).thenReturn(VSERVER_NAME);
+ when(dmaapService.createDmaapEvent(eq(notification), eq(VSERVER_NAME), eq(GENERIC_ID))).thenReturn(dmaapEvent);
+
+ final DmaapConditionalSender sender = new DmaapConditionalSender(configProperties, aaiConnection, dmaapService);
+
+ // when
+ sender.send(notification);
+
+ // then
+ verify(aaiConnection).receiveGenericVnfId(eq(HREF));
+ verify(dmaapService).createDmaapEvent(eq(notification), eq(VSERVER_NAME), eq(GENERIC_ID));
+ verify(dmaapService).send(eq(dmaapEvent));
+ }
+
+ @Test
+ public void testSendAaiCheckedPresent() {
+ // given
+ final DmaapEvent dmaapEvent = createDmaapEvent();
+ final VnfLcmOperationOccurrenceNotification notification = createNotification();
+
+ when(configProperties.getNotificationVnfFilterType()).thenReturn(NotificationVnfFilterType.AAI_CHECKED);
+ when(aaiConnection.receiveGenericVnfId(eq(HREF))).thenReturn(GENERIC_ID);
+ when(aaiConnection.receiveVserverName(eq(GENERIC_ID))).thenReturn(VSERVER_NAME);
+ when(dmaapService.createDmaapEvent(eq(notification), eq(VSERVER_NAME), eq(GENERIC_ID))).thenReturn(dmaapEvent);
+
+ final DmaapConditionalSender sender = new DmaapConditionalSender(configProperties, aaiConnection, dmaapService);
+
+ // when
+ sender.send(notification);
+
+ // then
+ verify(aaiConnection).receiveGenericVnfId(eq(HREF));
+ verify(dmaapService).createDmaapEvent(eq(notification), eq(VSERVER_NAME), eq(GENERIC_ID));
+ verify(dmaapService).send(eq(dmaapEvent));
+ }
+
+ @Test
+ public void testSendAaiCheckedAbsent() {
+ // given
+ when(configProperties.getNotificationVnfFilterType()).thenReturn(NotificationVnfFilterType.AAI_CHECKED);
+ when(aaiConnection.receiveGenericVnfId(eq(HREF))).thenReturn(null);
+
+ final DmaapConditionalSender sender = new DmaapConditionalSender(configProperties, aaiConnection, dmaapService);
+ final VnfLcmOperationOccurrenceNotification notification = createNotification();
+
+ // when
+ sender.send(notification);
+
+ // then
+ verify(aaiConnection).receiveGenericVnfId(eq(HREF));
+ verify(dmaapService, never()).createDmaapEvent(any(), any(), any());
+ verify(dmaapService, never()).send(any());
+ }
+}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java b/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java
index 9b18cf96dc..78d6ba899d 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java
+++ b/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/StartupServiceTest.java
@@ -34,6 +34,7 @@ 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.configuration.ConfigProperties;
@RunWith(MockitoJUnitRunner.class)
public class StartupServiceTest {
@@ -44,6 +45,9 @@ public class StartupServiceTest {
public ExpectedException thrown = ExpectedException.none();
@Mock
+ private ConfigProperties configProperties;
+
+ @Mock
private AaiConnection aaiConnection;
@InjectMocks
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java b/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java
index b7f1f982a2..265bce043c 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java
+++ b/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscribeSenderTest.java
@@ -24,20 +24,21 @@ 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.*;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.content;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.header;
+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 com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
import org.hamcrest.CoreMatchers;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.LccnSubscriptionRequest;
+import org.onap.so.adapters.vevnfm.configuration.ConfigProperties;
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;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
@@ -46,6 +47,8 @@ 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 com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
@SpringBootTest
@RunWith(SpringRunner.class)
@@ -64,8 +67,8 @@ public class SubscribeSenderTest {
GSON = builder.create();
}
- @Value("${vnfm.subscription}")
- private String vnfmSubscription;
+ @Autowired
+ private ConfigProperties configProperties;
@Autowired
private SubscribeSender sender;
@@ -73,10 +76,12 @@ public class SubscribeSenderTest {
@Autowired
private RestTemplate restTemplate;
+ private String vnfmSubscription;
private MockRestServiceServer mockRestServer;
@Before
public void init() {
+ vnfmSubscription = configProperties.getVnfmSubscription();
mockRestServer = MockRestServiceServer.bindTo(restTemplate).build();
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java b/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java
index d3da7c86ec..d3da7c86ec 100644
--- a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java
+++ b/adapters/etsi-sol002-adapter/src/test/java/org/onap/so/adapters/vevnfm/service/SubscriptionSchedulerTest.java
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/Readme.txt
index aaad60320d..aaad60320d 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/Readme.txt
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/pom.xml
new file mode 100644
index 0000000000..f1f8bb5a70
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/pom.xml
@@ -0,0 +1,86 @@
+<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.adapters</groupId>
+ <artifactId>etsi-sol003-adapter</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>etsi-sol003-adapter-application</artifactId>
+ <name>ETSI SOL003 Application Jar</name>
+ <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.etsisol003adapter.Application</mainClass>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>original</id>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <so.log.level>DEBUG</so.log.level>
+ </systemPropertyVariables>
+ <rerunFailingTestsCount>2</rerunFailingTestsCount>
+ <parallel>suites</parallel>
+ <useUnlimitedThreads>false</useUnlimitedThreads>
+ <threadCount>1</threadCount>
+ </configuration>
+ </plugin>
+ </plugins>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <excludes>
+ <exclude>**/*.p12</exclude>
+ <exclude>**/*.jks</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*.p12</include>
+ <include>**/*.jks</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>etsi-sol003-lcm-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>etsi-sol003-pkgm-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/java/org/onap/so/adapters/etsisol003adapter/Application.java
index 405bf896ef..261d2244d7 100755
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterApplication.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/java/org/onap/so/adapters/etsisol003adapter/Application.java
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter;
+package org.onap.so.adapters.etsisol003adapter;
import static org.slf4j.LoggerFactory.getLogger;
-import org.onap.so.adapters.vnfmadapter.rest.VnfmAdapterController;
+import org.onap.so.adapters.etsisol003adapter.lcm.rest.EtsiSol003AdapterController;
import org.slf4j.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -30,10 +30,10 @@ import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.cache.annotation.EnableCaching;
/**
- * The spring boot application for the VNFM (Virtual Network Function Manager) Adapter.
+ * The spring boot application for the ETSI SOL003 Adapter.
* <p>
- * The VNFM Adapter receives requests through its REST API {@link VnfmAdapterController} which it adapts into ETSI
- * SOL003 compliant LCM (Life Cycle Management) calls towards an ETSI compliant VNFM.
+ * The ETSI SOL003 Adapter receives requests through its REST API {@link EtsiSol003AdapterController} which it adapts
+ * into ETSI SOL003 compliant LCM (Life Cycle Management) calls towards an ETSI compliant VNFM.
*
* @see <a href= "https://www.etsi.org/deliver/etsi_gs/NFV-SOL/001_099/003/02.05.01_60/gs_nfv-sol003v020501p.pdf">ETSI
* SOL003 v2.5.1</a>
@@ -41,8 +41,8 @@ import org.springframework.cache.annotation.EnableCaching;
@EnableCaching
@SpringBootApplication(scanBasePackages = {"org.onap.so"})
@EnableAutoConfiguration(exclude = {JacksonAutoConfiguration.class})
-public class VnfmAdapterApplication {
- private static final Logger logger = getLogger(VnfmAdapterApplication.class);
+public class Application {
+ private static final Logger logger = getLogger(Application.class);
/**
* Entry point for the Spring boot application
@@ -50,7 +50,7 @@ public class VnfmAdapterApplication {
* @param args arguments for the application
*/
public static void main(final String[] args) {
- new SpringApplication(VnfmAdapterApplication.class).run(args);
+ new SpringApplication(Application.class).run(args);
logger.info("VnfmAdapterApplication started!");
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmBasicHttpSecurityConfigurer.java b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/java/org/onap/so/adapters/etsisol003adapter/EtsiSol003AdapterBasicHttpSecurityConfigurer.java
index f1815054e3..618b4f6116 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmBasicHttpSecurityConfigurer.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/java/org/onap/so/adapters/etsisol003adapter/EtsiSol003AdapterBasicHttpSecurityConfigurer.java
@@ -20,8 +20,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter;
+package org.onap.so.adapters.etsisol003adapter;
+import org.onap.so.adapters.etsi.sol003.adapter.common.CommonConstants;
import org.onap.so.security.HttpSecurityConfigurer;
import org.onap.so.security.SoUserCredentialConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
@@ -38,7 +39,7 @@ import org.springframework.util.StringUtils;
*/
@Primary
@Component
-public class VnfmBasicHttpSecurityConfigurer implements HttpSecurityConfigurer {
+public class EtsiSol003AdapterBasicHttpSecurityConfigurer implements HttpSecurityConfigurer {
@Autowired
private SoUserCredentialConfiguration soUserCredentialConfiguration;
@@ -52,7 +53,7 @@ public class VnfmBasicHttpSecurityConfigurer implements HttpSecurityConfigurer {
http.csrf().disable().authorizeRequests().anyRequest().permitAll();
} else {
http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
- .antMatchers(HttpMethod.GET, Constants.ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL).permitAll()
+ .antMatchers(HttpMethod.GET, CommonConstants.ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL).permitAll()
.antMatchers("/**")
.hasAnyRole(StringUtils.collectionToDelimitedString(soUserCredentialConfiguration.getRoles(), ","))
.and().httpBasic();
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application-aaf.yaml b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/application-aaf.yaml
index e69de29bb2..e69de29bb2 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application-aaf.yaml
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/application-aaf.yaml
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application-basic.yaml b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/application-basic.yaml
index e69de29bb2..e69de29bb2 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application-basic.yaml
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/application-basic.yaml
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/application.yaml
index 57dc08f3b5..57dc08f3b5 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/application.yaml
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/org.onap.so.trust.jks b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/org.onap.so.trust.jks
index 1f0d8a550a..1f0d8a550a 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/org.onap.so.trust.jks
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/org.onap.so.trust.jks
Binary files differ
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/so-vnfm-adapter.p12 b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/so-vnfm-adapter.p12
index ae4fddc684..ae4fddc684 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/so-vnfm-adapter.p12
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-application/src/main/resources/so-vnfm-adapter.p12
Binary files differ
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/pom.xml
new file mode 100644
index 0000000000..9c88f6a546
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/pom.xml
@@ -0,0 +1,24 @@
+<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.adapters</groupId>
+ <artifactId>etsi-sol003-adapter</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>etsi-sol003-adapter-common</artifactId>
+ <name>ETSI SOL003 Adapter Common</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.security.oauth</groupId>
+ <artifactId>spring-security-oauth2</artifactId>
+ <version>${spring-security-oauth2-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/common/CommonConstants.java
index d798267918..dbe4dac321 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/common/CommonConstants.java
@@ -18,33 +18,30 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter;
+package org.onap.so.adapters.etsi.sol003.adapter.common;
/**
- * VNFM Adapter constants
+ * VNFM Adapter Common constants
*
- * @author Ronan Kenny (ronan.kenny@est.tech)
+ * @author Waqas Ikram (waqas.ikram@est.tech)
* @author Gareth Roper (gareth.roper@est.tech)
*/
-public class Constants {
+public class CommonConstants {
public static final String SERVICE_NAME = "vnfm-adapter";
public static final String SERVICE_VERSION = "v1";
public static final String BASE_URL = "/so/" + SERVICE_NAME + "/" + SERVICE_VERSION;
+
public static final String PACKAGE_MANAGEMENT_BASE_URL = BASE_URL + "/vnfpkgm/v1";
+
public static final String ETSI_CATALOG_MANAGER_BASE_ENDPOINT = "/etsicatalogmanager";
public static final String ETSI_SUBSCRIPTION_NOTIFICATION_ENDPOINT = "/notification";
public static final String ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL =
BASE_URL + ETSI_CATALOG_MANAGER_BASE_ENDPOINT;
public static final String ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL =
ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL + ETSI_SUBSCRIPTION_NOTIFICATION_ENDPOINT;
- public static final String APPLICATION_ZIP = "application/zip";
- public static final String OPERATION_NOTIFICATION_ENDPOINT = "/lcn/VnfLcmOperationOccurrenceNotification";
- /**
- * Name of the subscription cache
- */
- public static final String PACKAGE_MANAGEMENT_SUBSCRIPTION_CACHE = "PackageManagementSubscriptionCache";
+ public static final String OPERATION_NOTIFICATION_ENDPOINT = "/lcn/VnfLcmOperationOccurrenceNotification";
- private Constants() {}
+ private CommonConstants() {}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterUrlProvider.java b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/common/VnfmAdapterUrlProvider.java
index 411a57069f..855b5a454f 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmAdapterUrlProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/common/VnfmAdapterUrlProvider.java
@@ -17,12 +17,12 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter;
+package org.onap.so.adapters.etsi.sol003.adapter.common;
-import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
-import static org.onap.so.adapters.vnfmadapter.Constants.ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL;
-import static org.onap.so.adapters.vnfmadapter.Constants.OPERATION_NOTIFICATION_ENDPOINT;
-import static org.onap.so.adapters.vnfmadapter.Constants.PACKAGE_MANAGEMENT_BASE_URL;
+import static org.onap.so.adapters.etsi.sol003.adapter.common.CommonConstants.BASE_URL;
+import static org.onap.so.adapters.etsi.sol003.adapter.common.CommonConstants.ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL;
+import static org.onap.so.adapters.etsi.sol003.adapter.common.CommonConstants.OPERATION_NOTIFICATION_ENDPOINT;
+import static org.onap.so.adapters.etsi.sol003.adapter.common.CommonConstants.PACKAGE_MANAGEMENT_BASE_URL;
import static org.slf4j.LoggerFactory.getLogger;
import java.net.URI;
import java.security.GeneralSecurityException;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/common/configuration/MessageConverterConfiguration.java
index bb2730bd2b..25c37b9016 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/MessageConverterConfiguration.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/common/configuration/MessageConverterConfiguration.java
@@ -17,26 +17,19 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter;
+package org.onap.so.adapters.etsi.sol003.adapter.common.configuration;
-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;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.onap.so.adapters.etsi.sol003.adapter.oauth.configuration.OAuth2AccessTokenAdapter;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.core.convert.ConversionService;
-import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
/**
* Configures message converter
@@ -44,23 +37,6 @@ import org.springframework.security.oauth2.common.OAuth2AccessToken;
@Configuration
public class MessageConverterConfiguration {
- private final VnfmAdapterUrlProvider vnfmAdapterUrlProvider;
-
- @Autowired
- public MessageConverterConfiguration(final VnfmAdapterUrlProvider vnfmAdapterUrlProvider) {
- this.vnfmAdapterUrlProvider = vnfmAdapterUrlProvider;
- }
-
- @Bean
- public ConversionService conversionService() {
- final DefaultConversionService service = new DefaultConversionService();
- service.addConverter(new VnfPkgInfoConverter(vnfmAdapterUrlProvider));
- service.addConverter(new PkgmSubscriptionRequestConverter());
- service.addConverter(new PkgChangeNotificationConverter());
- service.addConverter(new PkgOnboardingNotificationConverter());
- return service;
- }
-
@Bean
public HttpMessageConverters customConverters() {
final Collection<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/AuthorizationServerConfig.java b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/oauth/configuration/AuthorizationServerConfig.java
index 7f71b2e9d6..3a3287535e 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/AuthorizationServerConfig.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/oauth/configuration/AuthorizationServerConfig.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.oauth;
+package org.onap.so.adapters.etsi.sol003.adapter.oauth.configuration;
import org.onap.so.utils.CryptoUtils;
import org.springframework.beans.factory.annotation.Value;
@@ -46,7 +46,7 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
@Override
public void configure(final ClientDetailsServiceConfigurer clients) throws Exception {
final String[] decrypedAuth = CryptoUtils.decrypt(vnfmAdapterAuth, msoEncryptionKey).split(":");
- BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
+ final BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
clients.inMemory().withClient(decrypedAuth[0]).secret(passwordEncoder.encode(decrypedAuth[1]))
.authorizedGrantTypes("client_credentials").scopes("write").accessTokenValiditySeconds(ONE_DAY)
.refreshTokenValiditySeconds(ONE_DAY);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2AccessTokenAdapter.java b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/oauth/configuration/OAuth2AccessTokenAdapter.java
index 2f51406e23..4be5b8a86a 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2AccessTokenAdapter.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/oauth/configuration/OAuth2AccessTokenAdapter.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.oauth;
+package org.onap.so.adapters.etsi.sol003.adapter.oauth.configuration;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2ResourceServer.java b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/oauth/configuration/OAuth2ResourceServer.java
index 1f0594e811..2dcfea4045 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/oauth/OAuth2ResourceServer.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/oauth/configuration/OAuth2ResourceServer.java
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.oauth;
+package org.onap.so.adapters.etsi.sol003.adapter.oauth.configuration;
import javax.servlet.http.HttpServletRequest;
-import org.onap.so.adapters.vnfmadapter.Constants;
+import org.onap.so.adapters.etsi.sol003.adapter.common.CommonConstants;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
@@ -38,7 +38,8 @@ public class OAuth2ResourceServer extends ResourceServerConfigurerAdapter {
@Override
public void configure(final HttpSecurity http) throws Exception {
http.requestMatcher(new OAuth2ResourceServerRequestMatcher()).authorizeRequests()
- .antMatchers(Constants.BASE_URL + "/grants/**", Constants.BASE_URL + "/lcn/**").authenticated();
+ .antMatchers(CommonConstants.BASE_URL + "/grants/**", CommonConstants.BASE_URL + "/lcn/**")
+ .authenticated();
}
private static class OAuth2ResourceServerRequestMatcher implements RequestMatcher {
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/pom.xml
index 66b1d2e12e..560cd87bee 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/pom.xml
@@ -3,44 +3,15 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-vnfm-adapter</artifactId>
+ <artifactId>etsi-sol003-lcm</artifactId>
<version>1.6.0-SNAPSHOT</version>
</parent>
- <artifactId>mso-vnfm-etsi-adapter</artifactId>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- </properties>
- <name>mso-vnfm-etsi-adapter</name>
- <description>MSO ETSI compliant VNFM Adapter</description>
+ <artifactId>etsi-sol003-lcm-adapter</artifactId>
+ <name>ETSI SOL003 Life Cycle Management Adapter</name>
<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.vnfmadapter.VnfmAdapterApplication</mainClass>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>repackage</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>original</id>
- </execution>
- </executions>
- </plugin>
- <plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
@@ -58,24 +29,6 @@
</configuration>
</plugin>
</plugins>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <excludes>
- <exclude>**/*.p12</exclude>
- <exclude>**/*.jks</exclude>
- </excludes>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>false</filtering>
- <includes>
- <include>**/*.p12</include>
- <include>**/*.jks</include>
- </includes>
- </resource>
- </resources>
</build>
<dependencies>
<dependency>
@@ -108,23 +61,23 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.springframework.security.oauth</groupId>
- <artifactId>spring-security-oauth2</artifactId>
- <version>2.3.6.RELEASE</version>
+ <groupId>org.onap.so</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-adapters-rest-interface</artifactId>
+ <artifactId>etsi-sol003-adapter-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-vnfm-adapter-api</artifactId>
+ <artifactId>etsi-sol003-lcm-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-vnfm-adapter-ext-clients</artifactId>
+ <artifactId>etsi-sol003-lcm-ext-clients</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -136,13 +89,8 @@
<artifactId>jersey-common</artifactId>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-client</artifactId>
- </dependency>
- <dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
- <version>2.26</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
@@ -151,7 +99,11 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
- <version>1.23</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
</dependency>
</dependencies>
-</project>
+</project> \ No newline at end of file
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/LifeCycleManagementConstants.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/LifeCycleManagementConstants.java
new file mode 100644
index 0000000000..d9804072b7
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/LifeCycleManagementConstants.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 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.etsisol003adapter.lcm;
+
+/**
+ * ETSI SOL003 Life Cycle Management Adapter constants
+ *
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ */
+public class LifeCycleManagementConstants {
+
+ public static final String OPERATION_NOTIFICATION_ENDPOINT = "/lcn/VnfLcmOperationOccurrenceNotification";
+
+ private LifeCycleManagementConstants() {}
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/NvfmAdapterUtils.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/NvfmAdapterUtils.java
index db34cbf3f2..a46ad8ffd4 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/NvfmAdapterUtils.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/NvfmAdapterUtils.java
@@ -18,33 +18,33 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter;
+package org.onap.so.adapters.etsisol003adapter.lcm;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import org.slf4j.Logger;
+import static org.slf4j.LoggerFactory.getLogger;
import java.util.ArrayList;
import java.util.Collection;
-import static org.slf4j.LoggerFactory.getLogger;
+import org.slf4j.Logger;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
public class NvfmAdapterUtils {
private static Logger logger = getLogger(NvfmAdapterUtils.class);
- public static JsonObject child(JsonObject parent, String name) {
+ public static JsonObject child(final JsonObject parent, final String name) {
return childElement(parent, name).getAsJsonObject();
}
- public static JsonElement childElement(JsonObject parent, String name) {
- JsonElement child = parent.get(name);
+ public static JsonElement childElement(final JsonObject parent, final String name) {
+ final JsonElement child = parent.get(name);
if (child == null) {
throw abortOperation("Missing child " + name);
}
return child;
}
- public static Collection<JsonObject> children(JsonObject parent) {
- ArrayList<JsonObject> childElements = new ArrayList<>();
- for (String childKey : parent.keySet()) {
+ public static Collection<JsonObject> children(final JsonObject parent) {
+ final ArrayList<JsonObject> childElements = new ArrayList<>();
+ for (final String childKey : parent.keySet()) {
if (parent.get(childKey).isJsonObject()) {
childElements.add(parent.get(childKey).getAsJsonObject());
}
@@ -52,12 +52,12 @@ public class NvfmAdapterUtils {
return childElements;
}
- public static RuntimeException abortOperation(String msg, Exception e) {
+ public static RuntimeException abortOperation(final String msg, final Exception e) {
logger.error(msg, e);
return new RuntimeException(msg, e);
}
- public static RuntimeException abortOperation(String msg) {
+ public static RuntimeException abortOperation(final String msg) {
logger.error(msg);
return new RuntimeException(msg);
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/AbstractServiceProviderConfiguration.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/AbstractServiceProviderConfiguration.java
index 8f6d853997..b9ce641096 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/AbstractServiceProviderConfiguration.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/AbstractServiceProviderConfiguration.java
@@ -18,15 +18,15 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients;
-import com.google.gson.Gson;
import java.util.Iterator;
-import org.onap.vnfmadapter.v1.JSON;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.JSON;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.client.RestTemplate;
+import com.google.gson.Gson;
/**
* A base class that can be extended by classes for configuring HttpRestServiceProvider classes. Provides common methods
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/SdcPackageProvider.java
index 735e1f9d42..497de2874c 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/SdcPackageProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/SdcPackageProvider.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients;
import static com.google.common.base.Splitter.on;
import static com.google.common.collect.Iterables.filter;
@@ -28,15 +28,12 @@ import static com.google.common.io.ByteStreams.toByteArray;
import static java.lang.String.format;
import static org.apache.http.HttpHeaders.ACCEPT;
import static org.apache.http.HttpHeaders.AUTHORIZATION;
-import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.abortOperation;
-import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.child;
-import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.childElement;
-import static org.onap.so.adapters.vnfmadapter.NvfmAdapterUtils.children;
+import static org.onap.so.adapters.etsisol003adapter.lcm.NvfmAdapterUtils.abortOperation;
+import static org.onap.so.adapters.etsisol003adapter.lcm.NvfmAdapterUtils.child;
+import static org.onap.so.adapters.etsisol003adapter.lcm.NvfmAdapterUtils.childElement;
+import static org.onap.so.adapters.etsisol003adapter.lcm.NvfmAdapterUtils.children;
import static org.slf4j.LoggerFactory.getLogger;
import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM_VALUE;
-import com.google.common.io.ByteStreams;
-import com.google.gson.Gson;
-import com.google.gson.JsonObject;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -61,6 +58,9 @@ import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.yaml.snakeyaml.Yaml;
+import com.google.common.io.ByteStreams;
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
@Component
public class SdcPackageProvider {
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiClientProvider.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiClientProvider.java
index 674314d9da..529be0eb2e 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiClientProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiClientProvider.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.aai;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai;
-import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiHelper.java
index fc9efef947..958d2ebca8 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiHelper.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.aai;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai;
import java.util.Collections;
import java.util.HashMap;
@@ -32,10 +32,10 @@ import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipData;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.TenantNotFoundException;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmNotFoundException;
-import org.onap.vnfmadapter.v1.model.Tenant;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs;
+import org.onap.so.adapters.etsisol003adapter.lcm.rest.exceptions.TenantNotFoundException;
+import org.onap.so.adapters.etsisol003adapter.lcm.rest.exceptions.VnfmNotFoundException;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.Tenant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiPropertiesImpl.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiPropertiesImpl.java
index cfaad3fd04..b3b22e239d 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiPropertiesImpl.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiPropertiesImpl.java
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.aai;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai;
-import org.onap.so.client.aai.AAIProperties;
-import org.onap.so.client.aai.AAIVersion;
+import org.onap.aaiclient.client.aai.AAIProperties;
+import org.onap.aaiclient.client.aai.AAIVersion;
import org.onap.so.spring.SpringContextHelper;
import org.springframework.context.ApplicationContext;
import java.net.MalformedURLException;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiServiceProvider.java
index d19190d88e..f527b6cd97 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiServiceProvider.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.aai;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai;
import org.onap.aai.domain.yang.EsrSystemInfoList;
import org.onap.aai.domain.yang.EsrVnfm;
@@ -26,7 +26,7 @@ import org.onap.aai.domain.yang.EsrVnfmList;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.vnfmadapter.v1.model.Tenant;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.Tenant;
/**
* Provides methods for invoking REST calls to AAI.
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiServiceProviderImpl.java
index 6dc6020834..d9450b3472 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/AaiServiceProviderImpl.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.aai;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai;
import org.onap.aai.domain.yang.EsrSystemInfoList;
import org.onap.aai.domain.yang.EsrVnfm;
@@ -26,10 +26,10 @@ import org.onap.aai.domain.yang.EsrVnfmList;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
-import org.onap.vnfmadapter.v1.model.Tenant;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.Tenant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/OamIpAddressSource.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/OamIpAddressSource.java
index 311c4de8bd..b81925241c 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/OamIpAddressSource.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/aai/OamIpAddressSource.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.aai;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai;
/**
* Represents the source of the value to use as the AAI OAM IP address of a VNF
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/AccessInfo.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vim/model/AccessInfo.java
index 9ab7618ee3..139df248d4 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/AccessInfo.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vim/model/AccessInfo.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.vim.model;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients.vim.model;
import java.util.Objects;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/InterfaceInfo.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vim/model/InterfaceInfo.java
index ae28ea589c..9d4355a0c4 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/InterfaceInfo.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vim/model/InterfaceInfo.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.vim.model;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients.vim.model;
import java.util.Objects;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/VimCredentials.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vim/model/VimCredentials.java
index 63b00b4ef2..fd1a9078bb 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/VimCredentials.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vim/model/VimCredentials.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.vim.model;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients.vim.model;
import java.util.Objects;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmHelper.java
index fabf8839a6..9155261bd2 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmHelper.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
@@ -26,26 +26,26 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.onap.aai.domain.yang.EsrSystemInfo;
-import org.onap.so.adapters.vnfmadapter.VnfmAdapterUrlProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.vim.model.AccessInfo;
-import org.onap.so.adapters.vnfmadapter.extclients.vim.model.InterfaceInfo;
-import org.onap.so.adapters.vnfmadapter.extclients.vim.model.VimCredentials;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201VimConnections;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
-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.SubscriptionsAuthentication.AuthTypeEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsBasic;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsAuthenticationParamsOauth2ClientCredentials;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilter;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilter.NotificationTypesEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.SubscriptionsFilterVnfInstanceSubscriptionFilter;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateExtVirtualLinks;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo;
-import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
-import org.onap.vnfmadapter.v1.model.ExternalVirtualLink;
-import org.onap.vnfmadapter.v1.model.Tenant;
+import org.onap.so.adapters.etsi.sol003.adapter.common.VnfmAdapterUrlProvider;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.AaiServiceProvider;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vim.model.AccessInfo;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vim.model.InterfaceInfo;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vim.model.VimCredentials;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InstantiateVnfRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.LccnSubscriptionRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.SubscriptionsAuthentication;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.SubscriptionsAuthentication.AuthTypeEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.SubscriptionsAuthenticationParamsBasic;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.SubscriptionsAuthenticationParamsOauth2ClientCredentials;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.SubscriptionsFilter;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.SubscriptionsFilter.NotificationTypesEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.SubscriptionsFilterVnfInstanceSubscriptionFilter;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateExtVirtualLinks;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo;
+import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.InlineResponse201VimConnections;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.ExternalVirtualLink;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.Tenant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmServiceProvider.java
index cb8c7c4e56..a6c6740235 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmServiceProvider.java
@@ -18,17 +18,17 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm;
-import com.google.common.base.Optional;
import org.onap.aai.domain.yang.EsrVnfm;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.TerminateVnfRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.CreateVnfRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse200;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse2001;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse201;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InstantiateVnfRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.LccnSubscriptionRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.TerminateVnfRequest;
+import com.google.common.base.Optional;
/**
* Provides methods for invoking REST calls to a VNFM.
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmServiceProviderConfiguration.java
index eaaa8d8544..e35dafb4ea 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmServiceProviderConfiguration.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
import java.io.IOException;
@@ -39,7 +39,7 @@ import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.aai.domain.yang.EsrVnfm;
-import org.onap.so.adapters.vnfmadapter.extclients.AbstractServiceProviderConfiguration;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.AbstractServiceProviderConfiguration;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
@@ -63,7 +63,7 @@ import org.springframework.web.client.RestTemplate;
public class VnfmServiceProviderConfiguration extends AbstractServiceProviderConfiguration {
private static final Logger logger = LoggerFactory.getLogger(VnfmServiceProviderConfiguration.class);
- private Map<String, HttpRestServiceProvider> mapOfVnfmIdToHttpRestServiceProvider = new ConcurrentHashMap<>();
+ private final Map<String, HttpRestServiceProvider> mapOfVnfmIdToHttpRestServiceProvider = new ConcurrentHashMap<>();
@Value("${http.client.ssl.trust-store:#{null}}")
private Resource trustStore;
@@ -82,7 +82,7 @@ public class VnfmServiceProviderConfiguration extends AbstractServiceProviderCon
private String oauthEndpoint;
@Qualifier(CONFIGURABLE_REST_TEMPLATE)
- @Autowired()
+ @Autowired
private RestTemplate defaultRestTemplate;
public HttpRestServiceProvider getHttpRestServiceProvider(final EsrVnfm vnfm) {
@@ -130,7 +130,7 @@ public class VnfmServiceProviderConfiguration extends AbstractServiceProviderCon
SSLContext sslContext;
try {
if (keyStoreResource != null) {
- KeyStore keystore = KeyStore.getInstance("pkcs12");
+ final KeyStore keystore = KeyStore.getInstance("pkcs12");
keystore.load(keyStoreResource.getInputStream(), keyStorePassword.toCharArray());
sslContext =
new SSLContextBuilder().loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray())
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmServiceProviderImpl.java
index d898de3ad0..6ad5c16e4c 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmServiceProviderImpl.java
@@ -18,20 +18,19 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm;
-import com.google.common.base.Optional;
import org.onap.aai.domain.yang.EsrVnfm;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201.InstantiationStateEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.TerminateVnfRequest;
-import org.onap.so.adapters.vnfmadapter.jobmanagement.JobManager;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmRequestFailureException;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.CreateVnfRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse200;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse2001;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse201;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse201.InstantiationStateEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InstantiateVnfRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.LccnSubscriptionRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.TerminateVnfRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.jobmanagement.JobManager;
+import org.onap.so.adapters.etsisol003adapter.lcm.rest.exceptions.VnfmRequestFailureException;
import org.onap.so.rest.exceptions.RestProcessingException;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.slf4j.Logger;
@@ -40,6 +39,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
+import com.google.common.base.Optional;
@Service
public class VnfmServiceProviderImpl implements VnfmServiceProvider {
@@ -50,7 +50,7 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
@Autowired
public VnfmServiceProviderImpl(final VnfmUrlProvider urlProvider,
- VnfmServiceProviderConfiguration vnfmServiceProviderConfiguration) {
+ final VnfmServiceProviderConfiguration vnfmServiceProviderConfiguration) {
this.vnfmServiceProviderConfiguration = vnfmServiceProviderConfiguration;
this.urlProvider = urlProvider;
}
@@ -120,7 +120,7 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
Void.class);
} catch (final RestProcessingException restProcessingException) {
if (restProcessingException.getStatusCode() == HttpStatus.CONFLICT.value()) {
- InlineResponse201 vnf = getVnf(vnfm, vnfSelfLink).get();
+ final InlineResponse201 vnf = getVnf(vnfm, vnfSelfLink).get();
if (vnf.getInstantiationState().equals(InstantiationStateEnum.NOT_INSTANTIATED)) {
return JobManager.ALREADY_COMPLETED_OPERATION_ID;
} else {
@@ -171,8 +171,8 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
}
}
- private void checkIfResponseIsAcceptable(ResponseEntity<Void> response, String vnfSelfLink,
- TerminateVnfRequest terminateVnfRequest) {
+ private void checkIfResponseIsAcceptable(final ResponseEntity<Void> response, final String vnfSelfLink,
+ final TerminateVnfRequest terminateVnfRequest) {
if (response == null) {
final String errorMessage =
"Terminate request to " + vnfSelfLink + ", response is null, " + "request: " + terminateVnfRequest;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmUrlProvider.java
index 9c760b44b1..a9319c07fe 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmUrlProvider.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
+package org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm;
import static org.slf4j.LoggerFactory.getLogger;
import java.net.URI;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.aai.domain.yang.EsrSystemInfoList;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmNotFoundException;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.AaiServiceProvider;
+import org.onap.so.adapters.etsisol003adapter.lcm.rest.exceptions.VnfmNotFoundException;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/jobmanagement/JobManager.java
index 3de94ebe05..5ac0179176 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/jobmanagement/JobManager.java
@@ -18,25 +18,25 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.jobmanagement;
+package org.onap.so.adapters.etsisol003adapter.lcm.jobmanagement;
import static org.slf4j.LoggerFactory.getLogger;
-import com.google.common.base.Optional;
-import com.google.common.collect.Maps;
import java.util.Map;
import java.util.UUID;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmServiceProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.JobNotFoundException;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.AaiServiceProvider;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.VnfmServiceProvider;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse200;
+import org.onap.so.adapters.etsisol003adapter.lcm.rest.exceptions.JobNotFoundException;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.OperationEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.OperationStateEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.OperationStatusRetrievalStatusEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.QueryJobResponse;
import org.onap.so.rest.exceptions.HttpResouceNotFoundException;
-import org.onap.vnfmadapter.v1.model.OperationEnum;
-import org.onap.vnfmadapter.v1.model.OperationStateEnum;
-import org.onap.vnfmadapter.v1.model.OperationStatusRetrievalStatusEnum;
-import org.onap.vnfmadapter.v1.model.QueryJobResponse;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.google.common.base.Optional;
+import com.google.common.collect.Maps;
/**
* Manages jobs enabling the status of jobs to be queried. A job is associated with an operation on a VNFM.
@@ -134,11 +134,11 @@ public class JobManager {
final InlineResponse200 operationResponse) {
switch (vnfmOperation.getNotificationStatus()) {
case NOTIFICATION_PROCESSING_PENDING:
- return org.onap.vnfmadapter.v1.model.OperationStateEnum.PROCESSING;
+ return org.onap.so.adapters.etsisol003adapter.lcm.v1.model.OperationStateEnum.PROCESSING;
case NOTIFICATION_PROCEESING_SUCCESSFUL:
- return org.onap.vnfmadapter.v1.model.OperationStateEnum.COMPLETED;
+ return org.onap.so.adapters.etsisol003adapter.lcm.v1.model.OperationStateEnum.COMPLETED;
case NOTIFICATION_PROCESSING_FAILED:
- return org.onap.vnfmadapter.v1.model.OperationStateEnum.FAILED;
+ return org.onap.so.adapters.etsisol003adapter.lcm.v1.model.OperationStateEnum.FAILED;
default:
if (operationResponse == null || operationResponse.getOperationState() == null)
return null;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/VnfmOperation.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/jobmanagement/VnfmOperation.java
index 3bfe48af12..8cb9197d44 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/VnfmOperation.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/jobmanagement/VnfmOperation.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.jobmanagement;
+package org.onap.so.adapters.etsisol003adapter.lcm.jobmanagement;
/**
* Represents an operation on a VNFM.
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/lifecycle/LifecycleManager.java
index a885721b76..8ba56c5051 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/lifecycle/LifecycleManager.java
@@ -18,36 +18,36 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.lifecycle;
+package org.onap.so.adapters.etsisol003adapter.lcm.lifecycle;
-import com.google.common.base.Optional;
import java.util.Map;
import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.Relationship;
-import org.onap.so.adapters.vnfmadapter.extclients.SdcPackageProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiHelper;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.OamIpAddressSource;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.OamIpAddressSource.OamIpAddressType;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmHelper;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmServiceProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.TerminateVnfRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.TerminateVnfRequest.TerminationTypeEnum;
-import org.onap.so.adapters.vnfmadapter.jobmanagement.JobManager;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfNotFoundException;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmNotFoundException;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmRequestFailureException;
-import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
-import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
-import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.SdcPackageProvider;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.AaiHelper;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.AaiServiceProvider;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.OamIpAddressSource;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.OamIpAddressSource.OamIpAddressType;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.VnfmHelper;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.VnfmServiceProvider;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse201;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InstantiateVnfRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.LccnSubscriptionRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.TerminateVnfRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.TerminateVnfRequest.TerminationTypeEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.jobmanagement.JobManager;
+import org.onap.so.adapters.etsisol003adapter.lcm.rest.exceptions.VnfNotFoundException;
+import org.onap.so.adapters.etsisol003adapter.lcm.rest.exceptions.VnfmNotFoundException;
+import org.onap.so.adapters.etsisol003adapter.lcm.rest.exceptions.VnfmRequestFailureException;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfResponse;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.DeleteVnfResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.google.common.base.Optional;
/**
* Manages lifecycle operations towards the VNFMs.
@@ -82,7 +82,7 @@ public class LifecycleManager {
* @return the response to the request
*/
public CreateVnfResponse createVnf(final String vnfIdInAai, final CreateVnfRequest request) {
- GenericVnf genericVnf = getGenericVnfFromAai(vnfIdInAai);
+ final GenericVnf genericVnf = getGenericVnfFromAai(vnfIdInAai);
EsrVnfm vnfm = aaiHelper.getAssignedVnfm(genericVnf);
checkIfVnfAlreadyExistsInVnfm(vnfm, genericVnf);
@@ -96,7 +96,7 @@ public class LifecycleManager {
genericVnf.setSelflink(getSelfLink(vnfmResponse, vnfm));
- GenericVnf genericVnfPatch = new GenericVnf();
+ final GenericVnf genericVnfPatch = new GenericVnf();
genericVnfPatch.setVnfId(genericVnf.getVnfId());
genericVnfPatch.setSelflink(genericVnf.getSelflink());
aaiServiceProvider.invokePatchGenericVnf(genericVnfPatch);
@@ -155,8 +155,8 @@ public class LifecycleManager {
private InlineResponse201 sendCreateRequestToVnfm(final CreateVnfRequest aaiRequest, final GenericVnf genericVnf,
final String vnfIdInAai, final EsrVnfm vnfm) {
logger.debug("Sending a create request to SVNFM " + aaiRequest);
- final org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest vnfmRequest =
- new org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest();
+ final org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.CreateVnfRequest vnfmRequest =
+ new org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.CreateVnfRequest();
final String vnfdId = packageProvider.getVnfdId(genericVnf.getModelVersionId());
vnfmRequest.setVnfdId(vnfdId);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/notificationhandling/NotificationHandler.java
index 63ec4ccc57..f23fac8115 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/notificationhandling/NotificationHandler.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.notificationhandling;
+package org.onap.so.adapters.etsisol003adapter.lcm.notificationhandling;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.HashMap;
@@ -29,18 +29,18 @@ import org.json.JSONObject;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiHelper;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.OamIpAddressSource;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.OamIpAddressSource.OamIpAddressType;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmServiceProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs.ChangeTypeEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationStateEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201VimConnectionInfo;
-import org.onap.so.adapters.vnfmadapter.jobmanagement.JobManager;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.AaiHelper;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.AaiServiceProvider;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.OamIpAddressSource;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.OamIpAddressSource.OamIpAddressType;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.VnfmServiceProvider;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse201;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse201VimConnectionInfo;
+import org.onap.so.adapters.etsisol003adapter.lcm.jobmanagement.JobManager;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs.ChangeTypeEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationStateEnum;
import org.slf4j.Logger;
/**
@@ -220,11 +220,11 @@ public class NotificationHandler implements Runnable {
}
}
- private boolean deleteVnfIdentifierOnVnfm(GenericVnf genericVnf) {
+ private boolean deleteVnfIdentifierOnVnfm(final GenericVnf genericVnf) {
try {
vnfmServiceProvider.deleteVnf(aaiHelper.getAssignedVnfm(genericVnf), genericVnf.getSelflink());
return true;
- } catch (Exception exception) {
+ } catch (final Exception exception) {
logger.error("Exception deleting the identifier " + genericVnf.getSelflink()
+ " from the VNFM. The VNF has been terminated successfully but the identifier will remain on the VNFM.",
exception);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/EtsiSol003AdapterController.java
index 8eccc476d2..70131c89a5 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/EtsiSol003AdapterController.java
@@ -18,16 +18,18 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest;
+package org.onap.so.adapters.etsisol003adapter.lcm.rest;
-import io.swagger.annotations.ApiParam;
+import static org.onap.so.adapters.etsi.sol003.adapter.common.CommonConstants.BASE_URL;
+import javax.validation.Valid;
+import javax.ws.rs.core.MediaType;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.adapters.vnfmadapter.jobmanagement.JobManager;
-import org.onap.so.adapters.vnfmadapter.lifecycle.LifecycleManager;
-import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
-import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
-import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
-import org.onap.vnfmadapter.v1.model.QueryJobResponse;
+import org.onap.so.adapters.etsisol003adapter.lcm.jobmanagement.JobManager;
+import org.onap.so.adapters.etsisol003adapter.lcm.lifecycle.LifecycleManager;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfResponse;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.DeleteVnfResponse;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.QueryJobResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
@@ -42,9 +44,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
-import javax.validation.Valid;
-import javax.ws.rs.core.MediaType;
-import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
+import io.swagger.annotations.ApiParam;
/**
* Controller for handling requests to the VNFM (Virtual Network Function Manager) adapter REST API.
@@ -52,14 +52,14 @@ import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
@Controller
@RequestMapping(value = BASE_URL, produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
-public class VnfmAdapterController {
+public class EtsiSol003AdapterController {
- private static final Logger logger = LoggerFactory.getLogger(VnfmAdapterController.class);
+ private static final Logger logger = LoggerFactory.getLogger(EtsiSol003AdapterController.class);
private final LifecycleManager lifecycleManager;
private final JobManager jobManager;
@Autowired
- VnfmAdapterController(final LifecycleManager lifecycleManager, final JobManager jobManager) {
+ EtsiSol003AdapterController(final LifecycleManager lifecycleManager, final JobManager jobManager) {
this.lifecycleManager = lifecycleManager;
this.jobManager = jobManager;
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003GrantController.java
index 21b20b0134..8a17b68fae 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantController.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003GrantController.java
@@ -18,22 +18,22 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest;
+package org.onap.so.adapters.etsisol003adapter.lcm.rest;
-import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
+import static org.onap.so.adapters.etsi.sol003.adapter.common.CommonConstants.BASE_URL;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.ws.rs.core.MediaType;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiHelper;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmHelper;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201AddResources;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201VimConnections;
-import org.onap.vnfmadapter.v1.model.Tenant;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.AaiHelper;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.AaiServiceProvider;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.VnfmHelper;
+import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.GrantRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.GrantsAddResources;
+import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.InlineResponse201;
+import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.InlineResponse201AddResources;
+import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.InlineResponse201VimConnections;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.Tenant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003LcnContoller.java
index f97822a0cd..784fb8efa6 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003LcnContoller.java
@@ -18,27 +18,27 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest;
+package org.onap.so.adapters.etsisol003adapter.lcm.rest;
-import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
-import static org.onap.so.adapters.vnfmadapter.Constants.OPERATION_NOTIFICATION_ENDPOINT;
+import static org.onap.so.adapters.etsi.sol003.adapter.common.CommonConstants.BASE_URL;
+import static org.onap.so.adapters.etsisol003adapter.lcm.LifeCycleManagementConstants.OPERATION_NOTIFICATION_ENDPOINT;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.ws.rs.core.MediaType;
import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiHelper;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmServiceProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfIdentifierCreationNotification;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfIdentifierDeletionNotification;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationStateEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
-import org.onap.so.adapters.vnfmadapter.jobmanagement.JobManager;
-import org.onap.so.adapters.vnfmadapter.notificationhandling.NotificationHandler;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.AaiHelper;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.AaiServiceProvider;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.VnfmServiceProvider;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse201;
+import org.onap.so.adapters.etsisol003adapter.lcm.jobmanagement.JobManager;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfIdentifierCreationNotification;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfIdentifierDeletionNotification;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationStateEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.notificationhandling.NotificationHandler;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@@ -120,10 +120,10 @@ public class Sol003LcnContoller {
private InlineResponse201 getVnfInstance(
final VnfLcmOperationOccurrenceNotification vnfLcmOperationOccurrenceNotification) {
- GenericVnf vnfInAai = aaiServiceProvider
+ final GenericVnf vnfInAai = aaiServiceProvider
.invokeQueryGenericVnf(vnfLcmOperationOccurrenceNotification.getLinks().getVnfInstance().getHref())
.getGenericVnf().get(0);
- EsrVnfm vnfm = aaiHelper.getAssignedVnfm(vnfInAai);
+ final EsrVnfm vnfm = aaiHelper.getAssignedVnfm(vnfInAai);
return vnfmServiceProvider
.getVnf(vnfm, vnfLcmOperationOccurrenceNotification.getLinks().getVnfInstance().getHref()).get();
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/JobNotFoundException.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/exceptions/JobNotFoundException.java
index bc7c569231..2461631bc4 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/JobNotFoundException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/exceptions/JobNotFoundException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.lcm.rest.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/TenantNotFoundException.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/exceptions/TenantNotFoundException.java
index 215e68adcf..b7911c82e7 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/TenantNotFoundException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/exceptions/TenantNotFoundException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.lcm.rest.exceptions;
/**
* Exception for Tenant not found.
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfNotFoundException.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/exceptions/VnfNotFoundException.java
index 9b73293020..78232e2622 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfNotFoundException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/exceptions/VnfNotFoundException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.lcm.rest.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfmNotFoundException.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/exceptions/VnfmNotFoundException.java
index 4e494c14c6..6720d0bd92 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfmNotFoundException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/exceptions/VnfmNotFoundException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.lcm.rest.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfmRequestFailureException.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/exceptions/VnfmRequestFailureException.java
index 9f50a2cee1..10ada7ce18 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfmRequestFailureException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/exceptions/VnfmRequestFailureException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.lcm.rest.exceptions;
/**
* Exception indicating a request to a VNFM failed.
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
new file mode 100644
index 0000000000..bc6ef94f42
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
@@ -0,0 +1 @@
+org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.AaiPropertiesImpl \ No newline at end of file
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/EtsiSol003AdapterControllerTest.java
index fca50ea6f2..eaf40b546f 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/EtsiSol003AdapterControllerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest;
+package org.onap.so.adapters.etsisol003adapter.lcm.rest;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -33,7 +33,6 @@ import static org.springframework.test.web.client.match.MockRestRequestMatchers.
import static org.springframework.test.web.client.response.MockRestResponseCreators.withBadRequest;
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.net.URI;
import java.util.Optional;
import org.hamcrest.BaseMatcher;
@@ -52,26 +51,25 @@ import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipData;
import org.onap.aai.domain.yang.RelationshipList;
-import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
-import org.onap.so.adapters.vnfmadapter.extclients.SdcPackageProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.JSON;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201.InstantiationStateEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201Links;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201LinksSelf;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmNotFoundException;
-import org.onap.so.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.AAIVersion;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
-import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
-import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
-import org.onap.vnfmadapter.v1.model.OperationEnum;
-import org.onap.vnfmadapter.v1.model.OperationStateEnum;
-import org.onap.vnfmadapter.v1.model.QueryJobResponse;
-import org.onap.vnfmadapter.v1.model.Tenant;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.AAIVersion;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.SdcPackageProvider;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse200;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse2001;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse201;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse201.InstantiationStateEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse201Links;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse201LinksSelf;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.JSON;
+import org.onap.so.adapters.etsisol003adapter.lcm.rest.exceptions.VnfmNotFoundException;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.CreateVnfResponse;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.DeleteVnfResponse;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.OperationEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.OperationStateEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.QueryJobResponse;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.Tenant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
@@ -90,12 +88,12 @@ 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;
@RunWith(SpringRunner.class)
-@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
-
-public class VnfmAdapterControllerTest {
+public class EtsiSol003AdapterControllerTest {
private static final OffsetDateTime JAN_1_2019_12_00 =
OffsetDateTime.of(LocalDateTime.of(2019, 1, 1, 12, 0), ZoneOffset.UTC);
@@ -119,7 +117,7 @@ public class VnfmAdapterControllerTest {
SdcPackageProvider sdcPackageProvider;
@Autowired
- VnfmAdapterController controller;
+ EtsiSol003AdapterController controller;
Gson gson = new JSON().getGson();
@Before
@@ -153,14 +151,14 @@ public class VnfmAdapterControllerTest {
.location(new URI("http://vnfm2:8080/vnf_lcm_op_occs/123456")));
final InlineResponse200 firstOperationQueryResponse = createOperationQueryResponse(
- org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.INSTANTIATE,
- org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.PROCESSING);
+ org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse200.OperationEnum.INSTANTIATE,
+ org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse200.OperationStateEnum.PROCESSING);
mockRestServer.expect(requestTo("http://vnfm2:8080/vnf_lcm_op_occs/123456"))
.andRespond(withSuccess(gson.toJson(firstOperationQueryResponse), MediaType.APPLICATION_JSON));
final InlineResponse200 secondOperationQueryReponse = createOperationQueryResponse(
- org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.INSTANTIATE,
- org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.COMPLETED);
+ org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse200.OperationEnum.INSTANTIATE,
+ org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse200.OperationStateEnum.COMPLETED);
mockRestServer.expect(requestTo("http://vnfm2:8080/vnf_lcm_op_occs/123456"))
.andRespond(withSuccess(gson.toJson(secondOperationQueryReponse), MediaType.APPLICATION_JSON));
@@ -290,14 +288,14 @@ public class VnfmAdapterControllerTest {
.location(new URI("http://vnfm1:8080/vnf_lcm_op_occs/1234567")));
final InlineResponse200 firstOperationQueryResponse = createOperationQueryResponse(
- org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.TERMINATE,
- org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.PROCESSING);
+ org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse200.OperationEnum.TERMINATE,
+ org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse200.OperationStateEnum.PROCESSING);
mockRestServer.expect(requestTo("http://vnfm1:8080/vnf_lcm_op_occs/1234567"))
.andRespond(withSuccess(gson.toJson(firstOperationQueryResponse), MediaType.APPLICATION_JSON));
final InlineResponse200 secondOperationQueryReponse = createOperationQueryResponse(
- org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.TERMINATE,
- org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.COMPLETED);
+ org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse200.OperationEnum.TERMINATE,
+ org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse200.OperationStateEnum.COMPLETED);
mockRestServer.expect(requestTo("http://vnfm1:8080/vnf_lcm_op_occs/1234567"))
.andRespond(withSuccess(gson.toJson(secondOperationQueryReponse), MediaType.APPLICATION_JSON));
@@ -413,8 +411,8 @@ public class VnfmAdapterControllerTest {
}
private InlineResponse200 createOperationQueryResponse(
- final org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum operation,
- final org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum operationState) {
+ final org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse200.OperationEnum operation,
+ final org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse200.OperationStateEnum operationState) {
final InlineResponse200 response = new InlineResponse200();
response.setId("9876");
response.setOperation(operation);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/HealthCheckTest.java
index 07c471ec87..9fa16b5551 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/HealthCheckTest.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/HealthCheckTest.java
@@ -18,11 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest;
+package org.onap.so.adapters.etsisol003adapter.lcm.rest;
+import static org.junit.Assert.assertEquals;
+import java.net.URI;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
@@ -31,11 +32,9 @@ import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
-import java.net.URI;
-import static org.junit.Assert.assertEquals;
@RunWith(SpringRunner.class)
-@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
public class HealthCheckTest {
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003GrantControllerTest.java
index 69223d7922..21e56617cd 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003GrantControllerTest.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003GrantControllerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest;
+package org.onap.so.adapters.etsisol003adapter.lcm.rest;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -42,17 +42,16 @@ import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipData;
import org.onap.aai.domain.yang.RelationshipList;
-import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest.OperationEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources.TypeEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsLinks;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsLinksVnfLcmOpOcc;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201VimConnections;
-import org.onap.so.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.GrantRequest;
+import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.GrantRequest.OperationEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.GrantsAddResources;
+import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.GrantsAddResources.TypeEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.GrantsLinks;
+import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.GrantsLinksVnfLcmOpOcc;
+import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.InlineResponse201;
+import org.onap.so.adapters.etsisol003adapter.lcm.grant.model.InlineResponse201VimConnections;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
@@ -63,11 +62,10 @@ import org.springframework.http.HttpStatus;
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.web.client.RestTemplate;
@RunWith(SpringRunner.class)
-@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
public class Sol003GrantControllerTest {
@@ -82,7 +80,6 @@ public class Sol003GrantControllerTest {
@Autowired
@Qualifier(CONFIGURABLE_REST_TEMPLATE)
private RestTemplate testRestTemplate;
- private MockRestServiceServer mockRestServer;
@MockBean
private AAIResourcesClient aaiResourcesClient;
@@ -92,7 +89,6 @@ public class Sol003GrantControllerTest {
@Before
public void setUp() throws Exception {
- mockRestServer = MockRestServiceServer.bindTo(testRestTemplate).build();
setUpVimInMockAai();
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003LcnControllerTest.java
index cd92d987d7..ab6ae83896 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/Sol003LcnControllerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest;
+package org.onap.so.adapters.etsisol003adapter.lcm.rest;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.eq;
@@ -30,7 +30,6 @@ import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
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.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
@@ -54,27 +53,25 @@ import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipData;
import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiHelper;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.OamIpAddressSource;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.OamIpAddressSource.OamIpAddressType;
-import org.onap.so.adapters.vnfmadapter.extclients.vim.model.AccessInfo;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs.ChangeTypeEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationComputeResource;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationLinks;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationLinksVnfInstance;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfIdentifierCreationNotification;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationStateEnum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201Links;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201LinksSelf;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201VimConnectionInfo;
-import org.onap.so.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.AAIVersion;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.AaiHelper;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.OamIpAddressSource;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.aai.OamIpAddressSource.OamIpAddressType;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vim.model.AccessInfo;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse201;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse201Links;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse201LinksSelf;
+import org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model.InlineResponse201VimConnectionInfo;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs.ChangeTypeEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationComputeResource;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationLinks;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationLinksVnfInstance;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfIdentifierCreationNotification;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationEnum;
+import org.onap.so.adapters.etsisol003adapter.lcm.lcn.model.VnfLcmOperationOccurrenceNotification.OperationStateEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
@@ -88,9 +85,10 @@ 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 com.google.gson.Gson;
@RunWith(SpringRunner.class)
-@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
public class Sol003LcnControllerTest {
@@ -180,7 +178,7 @@ public class Sol003LcnControllerTest {
doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(GenericVnfs.class),
MockitoHamcrest.argThat(new AaiResourceUriMatcher(
"/network/generic-vnfs?selflink=http%3A%2F%2Fvnfm%3A8080%2Fvnfs%2FmyTestVnfIdOnVnfm")));
- EsrVnfm vnfm = new EsrVnfm();
+ final EsrVnfm vnfm = new EsrVnfm();
vnfm.setVnfmId("vnfm1");
final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
vnfm.setEsrSystemInfoList(esrSystemInfoList);
@@ -251,7 +249,7 @@ public class Sol003LcnControllerTest {
doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(GenericVnfs.class),
MockitoHamcrest.argThat(new AaiResourceUriMatcher(
"/network/generic-vnfs?selflink=http%3A%2F%2Fvnfm%3A8080%2Fvnfs%2FmyTestVnfIdOnVnfm")));
- EsrVnfm vnfm = new EsrVnfm();
+ final EsrVnfm vnfm = new EsrVnfm();
vnfm.setVnfmId("vnfm1");
final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
vnfm.setEsrSystemInfoList(esrSystemInfoList);
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/TestApplication.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/TestApplication.java
new file mode 100755
index 0000000000..b59bc025e8
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/lcm/rest/TestApplication.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 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.etsisol003adapter.lcm.rest;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
+import org.springframework.cache.annotation.EnableCaching;
+
+@EnableCaching
+@SpringBootApplication(scanBasePackages = {"org.onap.so"})
+@EnableAutoConfiguration(exclude = {JacksonAutoConfiguration.class})
+public class TestApplication {
+
+ public static void main(final String[] args) {
+ new SpringApplication(TestApplication.class).run(args);
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application.yaml b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/resources/application.yaml
index cdb6662191..cdb6662191 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application.yaml
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/test/resources/application.yaml
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/pom.xml
index 54f05859d9..f6789575c6 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/pom.xml
@@ -3,30 +3,17 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-vnfm-adapter</artifactId>
+ <artifactId>etsi-sol003-lcm</artifactId>
<version>1.6.0-SNAPSHOT</version>
</parent>
- <artifactId>mso-vnfm-adapter-api</artifactId>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <gson-fire-version>1.8.2</gson-fire-version>
- <retrofit-version>2.3.0</retrofit-version>
- <threetenbp-version>1.3.5</threetenbp-version>
- <oltu-version>1.0.1</oltu-version>
- <swagger-core-version>1.5.15</swagger-core-version>
- <okhttp3-version>3.14.0</okhttp3-version>
- <okhttp-version>2.7.5</okhttp-version>
- </properties>
- <name>mso-vnfm-adapter-api</name>
- <description>MSO VNFM adapter API</description>
-
+ <artifactId>etsi-sol003-lcm-api</artifactId>
+ <name>ETSI SOL003 Life Cycle Management Adapter API</name>
<build>
<plugins>
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
- <version>2.3.1</version>
+ <version>${version-swagger-codegen}</version>
<executions>
<execution>
<id>vnfmadapter</id>
@@ -34,12 +21,14 @@
<goal>generate</goal>
</goals>
<configuration>
- <inputSpec>${basedir}/src/main/resources/vnfmadapter.yaml</inputSpec>
+ <inputSpec>${basedir}/src/main/resources/etsisol003adapter.yaml</inputSpec>
<language>java</language>
<library>retrofit2</library>
- <output>${project.build.directory}/generated-sources/vnfmadapter</output>
- <apiPackage>org.onap.vnfmadapter.v1.api</apiPackage>
- <modelPackage>org.onap.vnfmadapter.v1.model</modelPackage>
+ <output>${project.build.directory}/generated-sources/etsisol003adapter</output>
+ <apiPackage>org.onap.so.adapters.etsisol003adapter.lcm.v1.api</apiPackage>
+ <modelPackage>org.onap.so.adapters.etsisol003adapter.lcm.v1.model</modelPackage>
+ <generateApiTests>false</generateApiTests>
+ <generateModelTests>false</generateModelTests>
<configOptions>
<jackson>true</jackson>
<sourceFolder>src/gen/java/main</sourceFolder>
@@ -50,17 +39,19 @@
</configuration>
</execution>
<execution>
- <id>sol003-packagemanagement-notification-api</id>
+ <id>sol003-vnf-lcn-api</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
- <inputSpec>${basedir}/src/main/resources/SOL003-VNFPackageManagement-Notification-API.json</inputSpec>
+ <inputSpec>${basedir}/src/main/resources/SOL003-VNFLifecycleManagementNotification-API.json</inputSpec>
<language>java</language>
<library>okhttp-gson</library>
- <output>${project.build.directory}/generated-sources/sol003-vnf-packagemanagement/notification</output>
- <apiPackage>org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.notification.api</apiPackage>
- <modelPackage>org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.notification.model</modelPackage>
+ <output>${project.build.directory}/generated-sources/sol003-vnf-lcn</output>
+ <apiPackage>org.onap.so.adapters.etsisol003adapter.lcm.lcn.api</apiPackage>
+ <modelPackage>org.onap.so.adapters.etsisol003adapter.lcm.lcn.model</modelPackage>
+ <generateApiTests>false</generateApiTests>
+ <generateModelTests>false</generateModelTests>
<configOptions>
<sourceFolder>src/gen/java/main</sourceFolder>
<withXml>true</withXml>
@@ -70,18 +61,21 @@
</configuration>
</execution>
<execution>
- <id>etsicatalog-notification-api</id>
+ <id>sol003-vnf-grant-api</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
- <inputSpec>${basedir}/src/main/resources/ETSI-Catalog-Notification-API.json</inputSpec>
+ <inputSpec>${basedir}/src/main/resources/SOL003-VNFLifecycleOperationGranting-API.json</inputSpec>
<language>java</language>
<library>okhttp-gson</library>
- <output>${project.build.directory}/generated-sources/etsicatalog/notification</output>
- <apiPackage>org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.notification.api</apiPackage>
- <modelPackage>org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.notification.model</modelPackage>
+ <output>${project.build.directory}/generated-sources/sol003-vnf-grant</output>
+ <apiPackage>org.onap.so.adapters.etsisol003adapter.lcm.grant.api</apiPackage>
+ <modelPackage>org.onap.so.adapters.etsisol003adapter.lcm.grant.model</modelPackage>
+ <generateApiTests>false</generateApiTests>
+ <generateModelTests>false</generateModelTests>
<configOptions>
+ <generateSupportingFiles>false</generateSupportingFiles>
<sourceFolder>src/gen/java/main</sourceFolder>
<withXml>true</withXml>
<useRxJava2>true</useRxJava2>
@@ -103,9 +97,9 @@
</goals>
<configuration>
<sources>
- <source>${project.basedir}/target/generated-sources/etsicatalog/notification/src/gen/java/main</source>
- <source>${project.basedir}/target/generated-sources/sol003-vnf-packagemanagement/notification/src/gen/java/main</source>
<source>${project.basedir}/target/generated-sources/vnfmadapter/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-grant/src/gen/java/main</source>
</sources>
</configuration>
</execution>
@@ -195,7 +189,7 @@
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
- <version>1.13.0</version>
+ <version>${okio-version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
@@ -222,9 +216,5 @@
<artifactId>logging-interceptor</artifactId>
<version>${okhttp-version}</version>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
</dependencies>
-</project>
+</project> \ No newline at end of file
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFLifecycleManagementNotification-API.json b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/src/main/resources/SOL003-VNFLifecycleManagementNotification-API.json
index d3b6ebaa7e..d3b6ebaa7e 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFLifecycleManagementNotification-API.json
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/src/main/resources/SOL003-VNFLifecycleManagementNotification-API.json
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFLifecycleOperationGranting-API.json b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/src/main/resources/SOL003-VNFLifecycleOperationGranting-API.json
index aab56ee2af..aab56ee2af 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFLifecycleOperationGranting-API.json
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/src/main/resources/SOL003-VNFLifecycleOperationGranting-API.json
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/vnfmadapter.yaml b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/src/main/resources/etsisol003adapter.yaml
index 9d0a5283af..9d0a5283af 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/vnfmadapter.yaml
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-api/src/main/resources/etsisol003adapter.yaml
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-ext-clients/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-ext-clients/pom.xml
new file mode 100644
index 0000000000..5452b578a7
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-ext-clients/pom.xml
@@ -0,0 +1,173 @@
+<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.adapters</groupId>
+ <artifactId>etsi-sol003-lcm</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>etsi-sol003-lcm-ext-clients</artifactId>
+ <name>ETSI SOL003 Life Cycle Management Adapter Ext Clients</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <version>${version-swagger-codegen}</version>
+ <executions>
+ <execution>
+ <id>sol003-vnf-lcm-api</id>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <inputSpec>${basedir}/src/main/resources/SOL003-VNFLifecycleManagement-API.json</inputSpec>
+ <language>java</language>
+ <library>okhttp-gson</library>
+ <output>${project.build.directory}/generated-sources/sol003-vnf-lcm</output>
+ <apiPackage>org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.api</apiPackage>
+ <modelPackage>org.onap.so.adapters.etsisol003adapter.lcm.extclients.vnfm.model</modelPackage>
+ <generateApiTests>false</generateApiTests>
+ <generateModelTests>false</generateModelTests>
+ <configOptions>
+ <jackson>true</jackson>
+ <sourceFolder>src/gen/java/main</sourceFolder>
+ <withXml>true</withXml>
+ <useRxJava2>true</useRxJava2>
+ <serializableModel>true</serializableModel>
+ </configOptions>
+ </configuration>
+ </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/sol003-vnf-lcm/src/gen/java/main</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <versionRange>[2.2.0,)</versionRange>
+ </pluginExecutionFilter>
+ <action>
+ <execute>
+ <runOnIncremental>false</runOnIncremental>
+ </execute>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>${swagger-core-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>converter-gson</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>retrofit</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>converter-scalars</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.oltu.oauth2</groupId>
+ <artifactId>org.apache.oltu.oauth2.client</artifactId>
+ <version>${oltu-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.gsonfire</groupId>
+ <artifactId>gson-fire</artifactId>
+ <version>${gson-fire-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.threeten</groupId>
+ <artifactId>threetenbp</artifactId>
+ <version>${threetenbp-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.reactivex.rxjava2</groupId>
+ <artifactId>rxjava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>adapter-rxjava2</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okio</groupId>
+ <artifactId>okio</artifactId>
+ <version>${okio-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>${okhttp3-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>logging-interceptor</artifactId>
+ <version>${okhttp3-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp</groupId>
+ <artifactId>logging-interceptor</artifactId>
+ <version>${okhttp-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>${okhttp-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp</groupId>
+ <artifactId>logging-interceptor</artifactId>
+ <version>${okhttp-version}</version>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFLifecycleManagement-API.json b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-ext-clients/src/main/resources/SOL003-VNFLifecycleManagement-API.json
index 2bc25a2d5b..2bc25a2d5b 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFLifecycleManagement-API.json
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-ext-clients/src/main/resources/SOL003-VNFLifecycleManagement-API.json
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/pom.xml
new file mode 100644
index 0000000000..e3f87680d8
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/pom.xml
@@ -0,0 +1,17 @@
+<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.adapters</groupId>
+ <artifactId>etsi-sol003-adapter</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>etsi-sol003-lcm</artifactId>
+ <name>ETSI SOL003 Life Cycle Management</name>
+ <packaging>pom</packaging>
+ <modules>
+ <module>etsi-sol003-lcm-api</module>
+ <module>etsi-sol003-lcm-ext-clients</module>
+ <module>etsi-sol003-lcm-adapter</module>
+ </modules>
+</project> \ No newline at end of file
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/pom.xml
new file mode 100644
index 0000000000..250ac504c7
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/pom.xml
@@ -0,0 +1,109 @@
+<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.adapters</groupId>
+ <artifactId>etsi-sol003-pkgm</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>etsi-sol003-pkgm-adapter</artifactId>
+ <name>ETSI SOL003 VNF Package Management Adapter</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <so.log.level>DEBUG</so.log.level>
+ </systemPropertyVariables>
+ <rerunFailingTestsCount>2</rerunFailingTestsCount>
+ <parallel>suites</parallel>
+ <useUnlimitedThreads>false</useUnlimitedThreads>
+ <threadCount>1</threadCount>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-security</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-tomcat</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</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>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>etsi-sol003-adapter-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>etsi-sol003-pkgm-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>etsi-sol003-pkgm-ext-clients</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.inject</groupId>
+ <artifactId>jersey-hk2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-json-jackson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/ConversionServiceConfiguration.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/ConversionServiceConfiguration.java
new file mode 100644
index 0000000000..fd19d0e0a1
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/ConversionServiceConfiguration.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Ericsson. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.adapters.etsisol003adapter.pkgm;
+
+import org.onap.so.adapters.etsi.sol003.adapter.common.VnfmAdapterUrlProvider;
+import org.onap.so.adapters.etsisol003adapter.pkgm.converters.etsicatalog.sol003.PkgChangeNotificationConverter;
+import org.onap.so.adapters.etsisol003adapter.pkgm.converters.etsicatalog.sol003.PkgOnboardingNotificationConverter;
+import org.onap.so.adapters.etsisol003adapter.pkgm.converters.etsicatalog.sol003.VnfPkgInfoConverter;
+import org.onap.so.adapters.etsisol003adapter.pkgm.converters.sol003.etsicatalog.PkgmSubscriptionRequestConverter;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.core.convert.ConversionService;
+import org.springframework.core.convert.support.DefaultConversionService;
+
+/**
+ * @author Waqas Ikram (waqas.ikram@est.tech)
+ *
+ */
+public class ConversionServiceConfiguration {
+
+ private final VnfmAdapterUrlProvider vnfmAdapterUrlProvider;
+
+ @Autowired
+ public ConversionServiceConfiguration(final VnfmAdapterUrlProvider vnfmAdapterUrlProvider) {
+ this.vnfmAdapterUrlProvider = vnfmAdapterUrlProvider;
+ }
+
+ @Bean
+ public ConversionService conversionService() {
+ final DefaultConversionService service = new DefaultConversionService();
+ service.addConverter(new VnfPkgInfoConverter(vnfmAdapterUrlProvider));
+ service.addConverter(new PkgmSubscriptionRequestConverter());
+ service.addConverter(new PkgChangeNotificationConverter(vnfmAdapterUrlProvider));
+ service.addConverter(new PkgOnboardingNotificationConverter(vnfmAdapterUrlProvider));
+ return service;
+ }
+
+}
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/PackageManagementConstants.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/PackageManagementConstants.java
new file mode 100644
index 0000000000..5922aab9ca
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/PackageManagementConstants.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 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.etsisol003adapter.pkgm;
+
+/**
+ * ETSI SOL003 VNF Package Management Adapter constants
+ *
+ * @author Ronan Kenny (ronan.kenny@est.tech)
+ * @author Gareth Roper (gareth.roper@est.tech)
+ */
+public class PackageManagementConstants {
+
+ public static final String APPLICATION_ZIP = "application/zip";
+
+ /**
+ * Name of the subscription cache
+ */
+ public static final String PACKAGE_MANAGEMENT_SUBSCRIPTION_CACHE = "PackageManagementSubscriptionCache";
+
+ private PackageManagementConstants() {}
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/AbstractCacheServiceProvider.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/cache/AbstractCacheServiceProvider.java
index e1e9b2307e..6dd67faa9e 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/AbstractCacheServiceProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/cache/AbstractCacheServiceProvider.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement.cache;
+package org.onap.so.adapters.etsisol003adapter.pkgm.cache;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/CacheManagerConfiguration.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/cache/CacheManagerConfiguration.java
index 830db39888..c184a25bef 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/CacheManagerConfiguration.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/cache/CacheManagerConfiguration.java
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement.cache;
+package org.onap.so.adapters.etsisol003adapter.pkgm.cache;
import java.util.Arrays;
-import org.onap.so.adapters.vnfmadapter.Constants;
+import org.onap.so.adapters.etsisol003adapter.pkgm.PackageManagementConstants;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.concurrent.ConcurrentMapCache;
@@ -39,7 +39,7 @@ public class CacheManagerConfiguration {
@Bean
public CacheManager cacheManager() {
final SimpleCacheManager manager = new SimpleCacheManager();
- manager.setCaches(Arrays.asList(getCache(Constants.PACKAGE_MANAGEMENT_SUBSCRIPTION_CACHE)));
+ manager.setCaches(Arrays.asList(getCache(PackageManagementConstants.PACKAGE_MANAGEMENT_SUBSCRIPTION_CACHE)));
return manager;
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/CacheNotFoundException.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/cache/CacheNotFoundException.java
index edd5982ab1..6b2f4710da 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/CacheNotFoundException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/cache/CacheNotFoundException.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement.cache;
+package org.onap.so.adapters.etsisol003adapter.pkgm.cache;
/**
* Exception for failure to find the cache.
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/PackageManagementCacheServiceProvider.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/cache/PkgmCacheServiceProvider.java
index 437d20e593..34ed1cfc0c 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/PackageManagementCacheServiceProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/cache/PkgmCacheServiceProvider.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement.cache;
+package org.onap.so.adapters.etsisol003adapter.pkgm.cache;
import java.util.Map;
import java.util.Optional;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.PkgmSubscriptionRequest;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.PkgmSubscriptionRequest;
/**
* Interface which provides methods for communicating with the cache
@@ -31,7 +31,7 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.
* @author Gareth Roper (gareth.roper@est.tech)
*
*/
-public interface PackageManagementCacheServiceProvider {
+public interface PkgmCacheServiceProvider {
/**
* Checks cache if subscription request Id is already present. If not, it adds the subscription to the cache.
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/PackageManagementCacheServiceProviderImpl.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/cache/PkgmCacheServiceProviderImpl.java
index ba57eb5e05..4811132e92 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/PackageManagementCacheServiceProviderImpl.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/cache/PkgmCacheServiceProviderImpl.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement.cache;
+package org.onap.so.adapters.etsisol003adapter.pkgm.cache;
import java.util.Collections;
import java.util.HashMap;
@@ -26,8 +26,8 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
-import org.onap.so.adapters.vnfmadapter.Constants;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.PkgmSubscriptionRequest;
+import org.onap.so.adapters.etsisol003adapter.pkgm.PackageManagementConstants;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.PkgmSubscriptionRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -42,14 +42,13 @@ import org.springframework.stereotype.Service;
* @author Gareth Roper (gareth.roper@est.tech)
*/
@Service
-public class PackageManagementCacheServiceProviderImpl extends AbstractCacheServiceProvider
- implements PackageManagementCacheServiceProvider {
+public class PkgmCacheServiceProviderImpl extends AbstractCacheServiceProvider implements PkgmCacheServiceProvider {
- private static final Logger LOGGER = LoggerFactory.getLogger(PackageManagementCacheServiceProviderImpl.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(PkgmCacheServiceProviderImpl.class);
@Autowired
- public PackageManagementCacheServiceProviderImpl(final CacheManager cacheManager) {
- super(Constants.PACKAGE_MANAGEMENT_SUBSCRIPTION_CACHE, cacheManager);
+ public PkgmCacheServiceProviderImpl(final CacheManager cacheManager) {
+ super(PackageManagementConstants.PACKAGE_MANAGEMENT_SUBSCRIPTION_CACHE, cacheManager);
}
@Override
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/converters/etsicatalog/sol003/AbstractPkgNotificationConverter.java
index e1c43098f8..5f2ee1d5ab 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/AbstractPkgNotificationConverter.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/converters/etsicatalog/sol003/AbstractPkgNotificationConverter.java
@@ -18,11 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003;
+package org.onap.so.adapters.etsisol003adapter.pkgm.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;
+import org.onap.so.adapters.etsi.sol003.adapter.common.VnfmAdapterUrlProvider;
+import org.onap.so.adapters.etsisol003adapter.etsicatalog.notification.model.PkgmLinks;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.vnfm.notification.model.URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinks;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.vnfm.notification.model.URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinksVnfPackage;
/**
* A base class that can be extended by classes for converting Etsi Catalog Manager Pkg Notification classes. Provides
@@ -32,18 +33,24 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.notifi
*/
abstract public class AbstractPkgNotificationConverter {
+ private final VnfmAdapterUrlProvider vnfmAdapterUrlProvider;
+
+ public AbstractPkgNotificationConverter(final VnfmAdapterUrlProvider vnfmAdapterUrlProvider) {
+ this.vnfmAdapterUrlProvider = vnfmAdapterUrlProvider;
+ }
+
protected URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinks convert(
- final PkgmLinks pkgmLinks) {
+ final PkgmLinks pkgmLinks, final String vnfPkgId, final String subscriptionId) {
final URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinksVnfPackage linksVnfPackage =
new URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinksVnfPackage();
if (pkgmLinks.getVnfPackage() != null) {
- linksVnfPackage.setHref(pkgmLinks.getVnfPackage().getHref());
+ linksVnfPackage.setHref(vnfmAdapterUrlProvider.getVnfPackageUrl(vnfPkgId));
}
final URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinksVnfPackage linksSubscription =
new URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinksVnfPackage();
if (pkgmLinks.getSubscription() != null) {
- linksSubscription.setHref(pkgmLinks.getSubscription().getHref());
+ linksSubscription.setHref(vnfmAdapterUrlProvider.getSubscriptionUriString(subscriptionId));
}
final URIisprovidedbytheclientwhencreatingthesubscriptionVnfPackageOnboardingNotificationLinks 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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/converters/etsicatalog/sol003/PkgChangeNotificationConverter.java
index 8c4168632b..5787d35b9a 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/PkgChangeNotificationConverter.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/converters/etsicatalog/sol003/PkgChangeNotificationConverter.java
@@ -18,11 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003;
+package org.onap.so.adapters.etsisol003adapter.pkgm.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.onap.so.adapters.etsi.sol003.adapter.common.VnfmAdapterUrlProvider;
+import org.onap.so.adapters.etsisol003adapter.etsicatalog.notification.model.PkgChangeNotification;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.vnfm.notification.model.VnfPackageChangeNotification;
import org.slf4j.Logger;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Service;
@@ -38,6 +39,10 @@ public class PkgChangeNotificationConverter extends AbstractPkgNotificationConve
implements Converter<PkgChangeNotification, VnfPackageChangeNotification> {
private static final Logger logger = getLogger(PkgChangeNotificationConverter.class);
+ public PkgChangeNotificationConverter(final VnfmAdapterUrlProvider vnfmAdapterUrlProvider) {
+ super(vnfmAdapterUrlProvider);
+ }
+
/**
* Convert a {@link PkgChangeNotification} Object to an {@link VnfPackageChangeNotification} Object
*
@@ -71,7 +76,8 @@ public class PkgChangeNotificationConverter extends AbstractPkgNotificationConve
.fromValue(pkgChangeNotification.getOperationalState().getValue()));
}
- vnfPackageChangeNotification.setLinks(convert((pkgChangeNotification.getLinks())));
+ vnfPackageChangeNotification.setLinks(convert(pkgChangeNotification.getLinks(),
+ pkgChangeNotification.getVnfPkgId(), pkgChangeNotification.getSubscriptionId()));
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/converters/etsicatalog/sol003/PkgOnboardingNotificationConverter.java
index 836acb6d36..96a5d827e6 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/PkgOnboardingNotificationConverter.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/converters/etsicatalog/sol003/PkgOnboardingNotificationConverter.java
@@ -18,11 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003;
+package org.onap.so.adapters.etsisol003adapter.pkgm.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.onap.so.adapters.etsi.sol003.adapter.common.VnfmAdapterUrlProvider;
+import org.onap.so.adapters.etsisol003adapter.etsicatalog.notification.model.PkgOnboardingNotification;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.vnfm.notification.model.VnfPackageOnboardingNotification;
import org.slf4j.Logger;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Service;
@@ -38,6 +39,11 @@ public class PkgOnboardingNotificationConverter extends AbstractPkgNotificationC
implements Converter<PkgOnboardingNotification, VnfPackageOnboardingNotification> {
private static final Logger logger = getLogger(PkgOnboardingNotificationConverter.class);
+ public PkgOnboardingNotificationConverter(final VnfmAdapterUrlProvider vnfmAdapterUrlProvider) {
+ super(vnfmAdapterUrlProvider);
+ }
+
+
/**
* Convert a {@link PkgOnboardingNotification} Object to an {@link VnfPackageOnboardingNotification} Object
*
@@ -61,7 +67,8 @@ public class PkgOnboardingNotificationConverter extends AbstractPkgNotificationC
vnfPackageOnboardingNotification.setVnfPkgId(pkgOnboardingNotification.getVnfPkgId());
vnfPackageOnboardingNotification.setVnfdId(pkgOnboardingNotification.getVnfdId());
- vnfPackageOnboardingNotification.setLinks(convert((pkgOnboardingNotification.getLinks())));
+ vnfPackageOnboardingNotification.setLinks(convert(pkgOnboardingNotification.getLinks(),
+ pkgOnboardingNotification.getVnfPkgId(), pkgOnboardingNotification.getSubscriptionId()));
return vnfPackageOnboardingNotification;
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/VnfPkgInfoConverter.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/converters/etsicatalog/sol003/VnfPkgInfoConverter.java
index ee941f6951..0121cc5885 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/etsicatalog/sol003/VnfPkgInfoConverter.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/converters/etsicatalog/sol003/VnfPkgInfoConverter.java
@@ -18,22 +18,22 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.converters.etsicatalog.sol003;
+package org.onap.so.adapters.etsisol003adapter.pkgm.converters.etsicatalog.sol003;
import java.util.ArrayList;
import java.util.List;
-import org.onap.so.adapters.vnfmadapter.VnfmAdapterUrlProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.Checksum;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VNFPKGMLinkSerializer;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageArtifactInfo;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageSoftwareImageInfo;
-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.extclients.vnfm.packagemanagement.model.VnfPackagesAdditionalArtifacts;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesChecksum;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesLinks;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesLinksSelf;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesSoftwareImages;
+import org.onap.so.adapters.etsi.sol003.adapter.common.VnfmAdapterUrlProvider;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.Checksum;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VNFPKGMLinkSerializer;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VnfPackageArtifactInfo;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VnfPackageSoftwareImageInfo;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VnfPkgInfo;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.InlineResponse2001;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.VnfPackagesAdditionalArtifacts;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.VnfPackagesChecksum;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.VnfPackagesLinks;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.VnfPackagesLinksSelf;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.VnfPackagesSoftwareImages;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.convert.converter.Converter;
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java
index caefe71993..f63ada9c75 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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java
@@ -18,22 +18,22 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.converters.sol003.etsicatalog;
+package org.onap.so.adapters.etsisol003adapter.pkgm.converters.sol003.etsicatalog;
import java.util.ArrayList;
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.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;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.Version;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VnfProducts;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VnfProductsProviders;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.PkgmSubscriptionRequest;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsFilter1;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsFilter1.NotificationTypesEnum;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsFilter1.OperationalStateEnum;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsFilter1.UsageStateEnum;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsFilterVersions;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsFilterVnfProducts;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsFilterVnfProductsFromProviders;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Service;
@@ -46,13 +46,13 @@ import org.springframework.stereotype.Service;
*/
@Service
public class PkgmSubscriptionRequestConverter implements
- Converter<PkgmSubscriptionRequest, org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest> {
+ Converter<PkgmSubscriptionRequest, org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscriptionRequest> {
@Override
- public org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest convert(
+ public org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscriptionRequest convert(
final PkgmSubscriptionRequest pkgmSubscriptionRequest) {
- final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest =
- new org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest();
+ final org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest =
+ new org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscriptionRequest();
etsiCatalogManagerSubscriptionRequest
.setFilter(getPkgmNotificationsFilter(pkgmSubscriptionRequest.getFilter()));
@@ -61,10 +61,10 @@ public class PkgmSubscriptionRequestConverter implements
}
- private org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter getPkgmNotificationsFilter(
+ private org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmNotificationsFilter getPkgmNotificationsFilter(
final SubscriptionsFilter1 sol003SubscriptionsFilter) {
- final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter etsiCatalogManagerFilters =
- new org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter();
+ final org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmNotificationsFilter etsiCatalogManagerFilters =
+ new org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmNotificationsFilter();
if (sol003SubscriptionsFilter.getNotificationTypes() != null) {
etsiCatalogManagerFilters.setNotificationTypes(
@@ -87,14 +87,14 @@ public class PkgmSubscriptionRequestConverter implements
}
- private List<org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.UsageStateEnum> getUsageState(
+ private List<org.onap.so.adapters.etsisol003adapter.pkgm.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 =
+ final List<org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmNotificationsFilter.UsageStateEnum> etsiCatalogUsageStates =
new ArrayList<>();
usageStates.stream().forEach(state -> {
etsiCatalogUsageStates.add(
- org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.UsageStateEnum
+ org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmNotificationsFilter.UsageStateEnum
.fromValue(state.getValue()));
});
return etsiCatalogUsageStates;
@@ -103,14 +103,14 @@ public class PkgmSubscriptionRequestConverter implements
}
- private List<org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.OperationalStateEnum> getOperationalState(
+ private List<org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmNotificationsFilter.OperationalStateEnum> getOperationalState(
final List<OperationalStateEnum> operationalStates) {
if (operationalStates != null) {
- final List<org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.OperationalStateEnum> etsiCatalogOperationalStates =
+ final List<org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmNotificationsFilter.OperationalStateEnum> etsiCatalogOperationalStates =
new ArrayList<>();
operationalStates.forEach(state -> {
etsiCatalogOperationalStates.add(
- org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.OperationalStateEnum
+ org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmNotificationsFilter.OperationalStateEnum
.fromValue(state.getValue()));
});
@@ -180,14 +180,14 @@ public class PkgmSubscriptionRequestConverter implements
return Collections.emptyList();
}
- private List<org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.NotificationTypesEnum> getPkgmNotificationsFilterNotificationTypes(
+ private List<org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmNotificationsFilter.NotificationTypesEnum> getPkgmNotificationsFilterNotificationTypes(
final List<NotificationTypesEnum> notificationTypes) {
if (notificationTypes != null && !notificationTypes.isEmpty()) {
- final List<org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.NotificationTypesEnum> etsiCatalogNotificationTypes =
+ final List<org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmNotificationsFilter.NotificationTypesEnum> etsiCatalogNotificationTypes =
new ArrayList<>();
notificationTypes.forEach(type -> etsiCatalogNotificationTypes.add(
- org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmNotificationsFilter.NotificationTypesEnum
+ org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmNotificationsFilter.NotificationTypesEnum
.fromValue(type.getValue())));
return etsiCatalogNotificationTypes;
}
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/AbstractServiceProviderConfiguration.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/AbstractServiceProviderConfiguration.java
new file mode 100644
index 0000000000..f9da6981c8
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/AbstractServiceProviderConfiguration.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 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.etsisol003adapter.pkgm.extclients;
+
+import java.time.LocalDateTime;
+import java.util.Iterator;
+import org.onap.so.adapters.etsisol003adapter.pkgm.JSON;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.EtsiSubscriptionNotificationController;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.GsonHttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.web.client.RestTemplate;
+import org.threeten.bp.OffsetDateTime;
+import com.google.gson.Gson;
+
+/**
+ * A base class that can be extended by classes for configuring HttpRestServiceProvider classes. Provides common methods
+ * that will be useful to some such classes.
+ *
+ * @author gareth.roper@est.tech
+ */
+public abstract class AbstractServiceProviderConfiguration {
+ private final JSON.OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new JSON.OffsetDateTimeTypeAdapter();
+
+ public void setGsonMessageConverter(final RestTemplate restTemplate) {
+ final Iterator<HttpMessageConverter<?>> iterator = restTemplate.getMessageConverters().iterator();
+ while (iterator.hasNext()) {
+ if (iterator.next() instanceof MappingJackson2HttpMessageConverter) {
+ iterator.remove();
+ }
+ }
+ final Gson gson = JSON.createGson().registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter)
+ .registerTypeAdapter(LocalDateTime.class,
+ new EtsiSubscriptionNotificationController.LocalDateTimeTypeAdapter())
+ .create();
+ restTemplate.getMessageConverters().add(new GsonHttpMessageConverter(gson));
+ }
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProvider.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProvider.java
index 95252218c8..db3c24bd1c 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogPackageManagementServiceProvider.java
@@ -17,10 +17,10 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
+package org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog;
import java.util.Optional;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2001;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.InlineResponse2001;
/**
* @author Waqas Ikram (waqas.ikram@est.tech)
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogServiceProvider.java
index 61db82f38c..f11fc5c39a 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogServiceProvider.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
+package org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog;
/**
* Provides methods for invoking REST calls to the ETSI Catalog Manager.
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
index 860dfbbe9c..5caeebe53d 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
@@ -18,13 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
+package org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
+import java.util.Iterator;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
@@ -39,7 +40,7 @@ import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.ssl.SSLContextBuilder;
import org.onap.logging.filter.spring.SpringClientPayloadFilter;
-import org.onap.so.adapters.vnfmadapter.extclients.AbstractServiceProviderConfiguration;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.AbstractServiceProviderConfiguration;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.configuration.rest.HttpClientConnectionConfiguration;
import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
@@ -55,7 +56,12 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.GsonHttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.client.RestTemplate;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
/**
* Configures the HttpRestServiceProvider to make REST calls to the ETSI Catalog Manager
@@ -167,4 +173,15 @@ public class EtsiCatalogServiceProviderConfiguration extends AbstractServiceProv
}
+ public void setGsonMessageConverter(final RestTemplate restTemplate) {
+ final Iterator<HttpMessageConverter<?>> iterator = restTemplate.getMessageConverters().iterator();
+ while (iterator.hasNext()) {
+ if (iterator.next() instanceof MappingJackson2HttpMessageConverter) {
+ iterator.remove();
+ }
+ }
+ final Gson gson = new GsonBuilder().create();
+ restTemplate.getMessageConverters().add(new GsonHttpMessageConverter(gson));
+ }
+
}
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
index cae413ce10..a4e5550061 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
@@ -18,20 +18,20 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
+package org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog;
-import static org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_SERVICE_PROVIDER_BEAN;
+import static org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_SERVICE_PROVIDER_BEAN;
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;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.NsdmSubscription;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscription;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VnfPkgInfo;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.InlineResponse2001;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.EtsiCatalogManagerBadRequestException;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.EtsiCatalogManagerRequestFailureException;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.SubscriptionNotFoundException;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.VnfPkgBadRequestException;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.VnfPkgConflictException;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.VnfPkgNotFoundException;
import org.onap.so.rest.exceptions.HttpResouceNotFoundException;
import org.onap.so.rest.exceptions.InvalidRestRequestException;
import org.onap.so.rest.exceptions.RestProcessingException;
@@ -183,7 +183,7 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
@Override
public Optional<PkgmSubscription> postSubscription(
- final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest) {
+ final org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest) {
try {
final ResponseEntity<PkgmSubscription> responseEntity =
httpServiceProvider.postHttpRequest(etsiCatalogManagerSubscriptionRequest,
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogSubscriptionServiceProvider.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogSubscriptionServiceProvider.java
index ed04ad7746..d561f8734b 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogSubscriptionServiceProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogSubscriptionServiceProvider.java
@@ -17,11 +17,11 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
+package org.onap.so.adapters.etsisol003adapter.pkgm.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.etsisol003adapter.pkgm.extclients.etsicatalog.model.NsdmSubscription;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscription;
/**
* @author Waqas Ikram (waqas.ikram@est.tech)
@@ -35,7 +35,7 @@ public interface EtsiCatalogSubscriptionServiceProvider {
* @return The ETSI Catalog Manager's PkgmSubscription object.
*/
Optional<PkgmSubscription> postSubscription(
- final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest);
+ final org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest);
/**
* Get the Subscription from ETSI Catalog.
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogUrlProvider.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogUrlProvider.java
index 3b4c4c3066..1725bf9fba 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogUrlProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogUrlProvider.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
+package org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog;
import static org.slf4j.LoggerFactory.getLogger;
import org.slf4j.Logger;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java
index 9ed17e4379..568c3df48b 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java
@@ -17,10 +17,10 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
+package org.onap.so.adapters.etsisol003adapter.pkgm.extclients.vnfm;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
-import org.onap.so.adapters.vnfmadapter.extclients.AbstractServiceProviderConfiguration;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.AbstractServiceProviderConfiguration;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/EtsiSubscriptionNotificationController.java
index a97f04bcc8..2b4b486fa8 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/EtsiSubscriptionNotificationController.java
@@ -18,18 +18,21 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest;
+package org.onap.so.adapters.etsisol003adapter.pkgm.rest;
-import static org.onap.so.adapters.vnfmadapter.Constants.ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL;
+import static org.onap.so.adapters.etsi.sol003.adapter.common.CommonConstants.ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL;
import static org.slf4j.LoggerFactory.getLogger;
+import java.io.IOException;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
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.onap.so.adapters.etsisol003adapter.etsicatalog.notification.model.PkgChangeNotification;
+import org.onap.so.adapters.etsisol003adapter.etsicatalog.notification.model.PkgOnboardingNotification;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.InternalServerErrorException;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.NotificationTypeNotSupportedException;
+import org.onap.so.adapters.etsisol003adapter.pkgm.subscriptionmgmt.NotificationManager;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
@@ -42,6 +45,9 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
+import com.google.gson.TypeAdapter;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
/**
* This controller handles the ETSI Subscription Notification Endpoints.
@@ -61,7 +67,7 @@ public class EtsiSubscriptionNotificationController {
@Autowired
public EtsiSubscriptionNotificationController(final NotificationManager notificationManager) {
this.notificationManager = notificationManager;
- this.gson = new GsonBuilder().create();
+ this.gson = new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeTypeAdapter()).create();
}
@GetMapping(value = "/notification")
@@ -72,15 +78,16 @@ public class EtsiSubscriptionNotificationController {
/**
* 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);
+ public ResponseEntity<?> postSubscriptionNotification(@RequestBody final Object notification) {
+ logger.info("Posting subscription notification class: {} \n{}", notification.getClass(), notification);
+ final String notificationString = gson.toJson(notification);
- final Entry<String, Object> notificationObject = getNotificationObject(notification);
+ final Entry<String, Object> notificationObject = getNotificationObject(notificationString);
if (notificationManager.processSubscriptionNotification(notificationObject.getValue(),
notificationObject.getKey())) {
logger.info("Notification Delivered Successfully");
@@ -92,6 +99,7 @@ public class EtsiSubscriptionNotificationController {
}
private Entry<String, Object> getNotificationObject(final String notification) {
+ logger.info("getNotificationObject() notification: {}", notification);
final String notificationType = getNotificationType(notification);
if (PkgOnboardingNotification.NotificationTypeEnum.VNFPACKAGEONBOARDINGNOTIFICATION.getValue()
.equals(notificationType)) {
@@ -118,6 +126,7 @@ public class EtsiSubscriptionNotificationController {
private String getNotificationType(final String notification) {
try {
+ logger.info("getNotificationType() notification: {}", notification);
final JsonParser parser = new JsonParser();
final JsonObject element = (JsonObject) parser.parse(notification);
return element.get("notificationType").getAsString();
@@ -128,4 +137,30 @@ public class EtsiSubscriptionNotificationController {
"Unable to parse notification type in object \n" + notification);
}
+ public static class LocalDateTimeTypeAdapter extends TypeAdapter<LocalDateTime> {
+
+ private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+ @Override
+ public void write(final JsonWriter out, final LocalDateTime localDateTime) throws IOException {
+ if (localDateTime == null) {
+ out.nullValue();
+ } else {
+ out.value(FORMATTER.format(localDateTime));
+ }
+ }
+
+ @Override
+ public LocalDateTime read(final JsonReader in) throws IOException {
+ switch (in.peek()) {
+ case NULL:
+ in.nextNull();
+ return null;
+ default:
+ final String dateTime = in.nextString();
+ return LocalDateTime.parse(dateTime, FORMATTER);
+ }
+ }
+ }
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/Sol003PackageManagementController.java
index 6d067902c5..6c1e5e5506 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementController.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/Sol003PackageManagementController.java
@@ -18,16 +18,16 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest;
+package org.onap.so.adapters.etsisol003adapter.pkgm.rest;
-import static org.onap.so.adapters.vnfmadapter.Constants.APPLICATION_ZIP;
-import static org.onap.so.adapters.vnfmadapter.Constants.PACKAGE_MANAGEMENT_BASE_URL;
+import static org.onap.so.adapters.etsi.sol003.adapter.common.CommonConstants.PACKAGE_MANAGEMENT_BASE_URL;
+import static org.onap.so.adapters.etsisol003adapter.pkgm.PackageManagementConstants.APPLICATION_ZIP;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.Optional;
import javax.ws.rs.core.MediaType;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogServiceProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.ProblemDetails;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2001;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.EtsiCatalogServiceProvider;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.ProblemDetails;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.InlineResponse2001;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/Sol003PackageManagementSubscriptionController.java
index 515e317496..7314f6aa2e 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/Sol003PackageManagementSubscriptionController.java
@@ -18,19 +18,19 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest;
+package org.onap.so.adapters.etsisol003adapter.pkgm.rest;
-import static org.onap.so.adapters.vnfmadapter.Constants.PACKAGE_MANAGEMENT_BASE_URL;
+import static org.onap.so.adapters.etsi.sol003.adapter.common.CommonConstants.PACKAGE_MANAGEMENT_BASE_URL;
import static org.slf4j.LoggerFactory.getLogger;
import java.net.URI;
import java.security.GeneralSecurityException;
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.InlineResponse201;
-import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.PkgmSubscriptionRequest;
-import org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement.SubscriptionManager;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.ProblemDetails;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.InlineResponse201;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.PkgmSubscriptionRequest;
+import org.onap.so.adapters.etsisol003adapter.pkgm.subscriptionmgmt.SubscriptionManager;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/AuthenticationTypeNotSupportedException.java
index 303420f1e8..6e1330140f 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/AuthenticationTypeNotSupportedException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/AuthenticationTypeNotSupportedException.java
@@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/ConversionFailedException.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/ConversionFailedException.java
index e19a53d1dc..9e9cb8e352 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/ConversionFailedException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/ConversionFailedException.java
@@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/EtsiCatalogManagerBadRequestException.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/EtsiCatalogManagerBadRequestException.java
index dbd098f7cd..7d9d5fc17a 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/EtsiCatalogManagerBadRequestException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/EtsiCatalogManagerBadRequestException.java
@@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/EtsiCatalogManagerRequestFailureException.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/EtsiCatalogManagerRequestFailureException.java
index dbdc354f4e..a07732f3fa 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/EtsiCatalogManagerRequestFailureException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/EtsiCatalogManagerRequestFailureException.java
@@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/EtsiSubscriptionNotificationControllerExceptionHandler.java
index e8e1ce35b9..645ef96326 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/EtsiSubscriptionNotificationControllerExceptionHandler.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/EtsiSubscriptionNotificationControllerExceptionHandler.java
@@ -18,11 +18,11 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.pkgm.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.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.ProblemDetails;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.EtsiSubscriptionNotificationController;
import org.onap.so.rest.exceptions.HttpResouceNotFoundException;
import org.onap.so.rest.exceptions.InvalidRestRequestException;
import org.onap.so.rest.exceptions.RestProcessingException;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/InternalServerErrorException.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/InternalServerErrorException.java
index 9b547d3c5a..9dd7f1b7b2 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/InternalServerErrorException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/InternalServerErrorException.java
@@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/NotificationTypeNotSupportedException.java
index dcc98864aa..7716037342 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/NotificationTypeNotSupportedException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/NotificationTypeNotSupportedException.java
@@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/Sol003PackageManagementControllerExceptionHandler.java
index 8091f35da6..9f97b4ae02 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/Sol003PackageManagementControllerExceptionHandler.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/Sol003PackageManagementControllerExceptionHandler.java
@@ -18,10 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.pkgm.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.etsisol003adapter.pkgm.extclients.etsicatalog.model.ProblemDetails;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.Sol003PackageManagementController;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/SubscriptionNotFoundException.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/SubscriptionNotFoundException.java
index 58c2ef050d..af409e7399 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/SubscriptionNotFoundException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/SubscriptionNotFoundException.java
@@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfPkgBadRequestException.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/VnfPkgBadRequestException.java
index 211131c2a4..5c318da89f 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfPkgBadRequestException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/VnfPkgBadRequestException.java
@@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfPkgConflictException.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/VnfPkgConflictException.java
index f9aa2a0e21..7cb7a0c860 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfPkgConflictException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/VnfPkgConflictException.java
@@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfPkgNotFoundException.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/VnfPkgNotFoundException.java
index c15e7052ab..5ed4847173 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfPkgNotFoundException.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/exceptions/VnfPkgNotFoundException.java
@@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+package org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/AbstractNotificationServiceProvider.java
index d6b7ae7201..b6ba1ede95 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/AbstractNotificationServiceProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/AbstractNotificationServiceProvider.java
@@ -17,9 +17,9 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+package org.onap.so.adapters.etsisol003adapter.pkgm.subscriptionmgmt;
-import static org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmHttpServiceProviderConfiguration.VNFM_ADAPTER_HTTP_SERVICE_PROVIDER_BEAN;
+import static org.onap.so.adapters.etsisol003adapter.pkgm.extclients.vnfm.VnfmHttpServiceProviderConfiguration.VNFM_ADAPTER_HTTP_SERVICE_PROVIDER_BEAN;
import java.nio.charset.StandardCharsets;
import org.apache.commons.codec.binary.Base64;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/BasicAuthNotificationServiceProvider.java
index cf0cdb085a..ffe8529c93 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/BasicAuthNotificationServiceProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/BasicAuthNotificationServiceProvider.java
@@ -17,11 +17,11 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+package org.onap.so.adapters.etsisol003adapter.pkgm.subscriptionmgmt;
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.etsisol003adapter.pkgm.model.SubscriptionsAuthentication;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsAuthentication.AuthTypeEnum;
import org.onap.so.configuration.rest.HttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.slf4j.Logger;
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/NotificationManager.java
index c1051d1c9d..82b1a7d4c3 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationManager.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/NotificationManager.java
@@ -18,22 +18,22 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+package org.onap.so.adapters.etsisol003adapter.pkgm.subscriptionmgmt;
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.onap.so.adapters.etsisol003adapter.etsicatalog.notification.model.PkgChangeNotification;
+import org.onap.so.adapters.etsisol003adapter.etsicatalog.notification.model.PkgOnboardingNotification;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.vnfm.notification.model.VnfPackageChangeNotification;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.vnfm.notification.model.VnfPackageOnboardingNotification;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.PkgmSubscriptionRequest;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsAuthentication;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsAuthentication.AuthTypeEnum;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.AuthenticationTypeNotSupportedException;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.ConversionFailedException;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.NotificationTypeNotSupportedException;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.SubscriptionNotFoundException;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.ConversionService;
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/NotificationServiceProvider.java
index 2be80eec75..2fc7e19eb6 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationServiceProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/NotificationServiceProvider.java
@@ -17,10 +17,10 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+package org.onap.so.adapters.etsisol003adapter.pkgm.subscriptionmgmt;
-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.etsisol003adapter.pkgm.model.SubscriptionsAuthentication;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsAuthentication.AuthTypeEnum;
/**
* Interface which lays out requirements for a Notification Service Provider
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/NotificationServiceProviderFactory.java
index ab67afed82..2b8e818c9c 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/NotificationServiceProviderFactory.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/NotificationServiceProviderFactory.java
@@ -17,14 +17,14 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+package org.onap.so.adapters.etsisol003adapter.pkgm.subscriptionmgmt;
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.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsAuthentication.AuthTypeEnum;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.AuthenticationTypeNotSupportedException;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/OAuthNotificationServiceProvider.java
index c065203cd8..81dc743a22 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthNotificationServiceProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/OAuthNotificationServiceProvider.java
@@ -17,12 +17,12 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+package org.onap.so.adapters.etsisol003adapter.pkgm.subscriptionmgmt;
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.adapters.etsisol003adapter.pkgm.model.SubscriptionsAuthentication;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsAuthentication.AuthTypeEnum;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.InternalServerErrorException;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.configuration.rest.HttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
@@ -45,6 +45,7 @@ public class OAuthNotificationServiceProvider extends AbstractNotificationServic
public boolean send(final Object notification, final SubscriptionsAuthentication subscriptionsAuthentication,
final String callbackUri) {
logger.info("Sending notification to uri: {}", callbackUri);
+ logger.info("Object: {}", notification);
final String token = getAccessToken(subscriptionsAuthentication);
if (token == null) {
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/OAuthTokenResponse.java
index 146641cc7c..3e6f7bde2b 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/OAuthTokenResponse.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/OAuthTokenResponse.java
@@ -17,7 +17,7 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+package org.onap.so.adapters.etsisol003adapter.pkgm.subscriptionmgmt;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlElement;
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/SubscriptionManager.java
index a63e14c899..edae41525e 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/SubscriptionManager.java
@@ -18,9 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+package org.onap.so.adapters.etsisol003adapter.pkgm.subscriptionmgmt;
-import static org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.SubscriptionAuthentication.AuthTypeEnum.BASIC;
+import static org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.SubscriptionAuthentication.AuthTypeEnum.BASIC;
import static org.slf4j.LoggerFactory.getLogger;
import java.net.URI;
import java.security.GeneralSecurityException;
@@ -30,19 +30,19 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.onap.so.adapters.vnfmadapter.VnfmAdapterUrlProvider;
-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.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.SubscriptionNotFoundException;
+import org.onap.so.adapters.etsi.sol003.adapter.common.VnfmAdapterUrlProvider;
+import org.onap.so.adapters.etsisol003adapter.pkgm.cache.PkgmCacheServiceProvider;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.EtsiCatalogServiceProvider;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.BasicAuth;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.NsdmSubscription;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscription;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.InlineResponse201;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.PkgmSubscriptionRequest;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsLinks;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.VnfPackagesLinksSelf;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.ConversionFailedException;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.InternalServerErrorException;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.exceptions.SubscriptionNotFoundException;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.ConversionService;
@@ -58,13 +58,13 @@ import org.springframework.stereotype.Service;
public class SubscriptionManager {
private static final Logger logger = getLogger(SubscriptionManager.class);
- private final PackageManagementCacheServiceProvider packageManagementCacheServiceProvider;
+ private final PkgmCacheServiceProvider packageManagementCacheServiceProvider;
private final ConversionService conversionService;
private final EtsiCatalogServiceProvider etsiCatalogServiceProvider;
private final VnfmAdapterUrlProvider vnfmAdapterUrlProvider;
@Autowired
- public SubscriptionManager(final PackageManagementCacheServiceProvider packageManagementCacheServiceProvider,
+ public SubscriptionManager(final PkgmCacheServiceProvider packageManagementCacheServiceProvider,
final ConversionService conversionService, final EtsiCatalogServiceProvider etsiCatalogServiceProvider,
final VnfmAdapterUrlProvider vnfmAdapterUrlProvider) {
this.packageManagementCacheServiceProvider = packageManagementCacheServiceProvider;
@@ -76,7 +76,7 @@ public class SubscriptionManager {
public Optional<InlineResponse201> createSubscription(final PkgmSubscriptionRequest pkgmSubscriptionRequest)
throws GeneralSecurityException {
- final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest =
+ final org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest =
buildEtsiCatalogManagerPkgmSubscriptionRequest(pkgmSubscriptionRequest);
final Optional<PkgmSubscription> optionalEtsiCatalogManagerSubscription =
@@ -172,13 +172,13 @@ public class SubscriptionManager {
.callbackUri(subscription.getCallbackUri());
}
- private org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest buildEtsiCatalogManagerPkgmSubscriptionRequest(
+ private org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscriptionRequest buildEtsiCatalogManagerPkgmSubscriptionRequest(
final PkgmSubscriptionRequest pkgmSubscriptionRequest) throws GeneralSecurityException {
- final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest;
+ final org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest;
try {
etsiCatalogManagerSubscriptionRequest = conversionService.convert(pkgmSubscriptionRequest,
- org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest.class);
+ org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscriptionRequest.class);
} catch (final org.springframework.core.convert.ConversionException conversionException) {
logger.error(conversionException.getMessage());
throw new ConversionFailedException(
@@ -196,7 +196,7 @@ public class SubscriptionManager {
final ImmutablePair<String, String> immutablePair = vnfmAdapterUrlProvider.getDecryptAuth();
if (!immutablePair.equals(ImmutablePair.nullPair())) {
etsiCatalogManagerSubscriptionRequest.setAuthentication(
- new org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.SubscriptionAuthentication()
+ new org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.SubscriptionAuthentication()
.addAuthTypeItem(BASIC).paramsBasic(new BasicAuth().userName(immutablePair.getLeft())
.password(immutablePair.getRight())));
}
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/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/TlsNotificationServiceProvider.java
index c9babbd345..69ff5da3ec 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/TlsNotificationServiceProvider.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/subscriptionmgmt/TlsNotificationServiceProvider.java
@@ -17,16 +17,17 @@
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement;
+package org.onap.so.adapters.etsisol003adapter.pkgm.subscriptionmgmt;
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.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsAuthentication;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsAuthentication.AuthTypeEnum;
+import org.onap.so.adapters.etsisol003adapter.pkgm.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)
*/
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/EtsiSubscriptionNotificationControllerTest.java
index 29afa8c549..efe6891f1e 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationControllerTest.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/EtsiSubscriptionNotificationControllerTest.java
@@ -18,17 +18,21 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest;
+package org.onap.so.adapters.etsisol003adapter.pkgm.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.adapters.etsi.sol003.adapter.common.CommonConstants.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.match.MockRestRequestMatchers.header;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.jsonPath;
+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 java.net.URI;
+import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@@ -36,45 +40,47 @@ 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.adapters.etsisol003adapter.etsicatalog.notification.model.NOTIFICATIONLINKSERIALIZER;
+import org.onap.so.adapters.etsisol003adapter.etsicatalog.notification.model.PkgChangeNotification;
+import org.onap.so.adapters.etsisol003adapter.etsicatalog.notification.model.PkgOnboardingNotification;
+import org.onap.so.adapters.etsisol003adapter.etsicatalog.notification.model.PkgmLinks;
+import org.onap.so.adapters.etsisol003adapter.pkgm.JSON;
+import org.onap.so.adapters.etsisol003adapter.pkgm.PackageManagementConstants;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.ProblemDetails;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.vnfm.notification.model.VnfPackageChangeNotification;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.vnfm.notification.model.VnfPackageOnboardingNotification;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.PkgmSubscriptionRequest;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsAuthentication;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsAuthenticationParamsBasic;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsAuthenticationParamsOauth2ClientCredentials;
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.client.RestTemplateBuilder;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
-import org.springframework.http.*;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.converter.json.GsonHttpMessageConverter;
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)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
@DirtiesContext(classMode = BEFORE_CLASS)
public class EtsiSubscriptionNotificationControllerTest {
@@ -95,20 +101,23 @@ public class EtsiSubscriptionNotificationControllerTest {
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 TIME_STAMP_STRING_EXPECTED_FROM_ETSI_CATALOG = "2020-01-01 01:01:01";
+ private static final java.time.LocalDateTime TIMESTAMP = java.time.LocalDateTime.of(2020, 1, 1, 1, 1, 1, 1);
private static final String VNFPKG_ID = UUID.randomUUID().toString();
private static final String VNFD_ID = UUID.randomUUID().toString();
+ private static final String EXPECTED_VNF_PACKAGE_HREF =
+ "https://so-vnfm-adapter.onap:30406/so/vnfm-adapter/v1/vnfpkgm/v1/vnf_packages/" + VNFPKG_ID;
+ private static final String EXPECTED_SUBSCRIPTION_HREF =
+ "https://so-vnfm-adapter.onap:30406/so/vnfm-adapter/v1/vnfpkgm/v1/subscriptions/" + SUBSCRIPTION_ID;
+
private BasicHttpHeadersProvider basicHttpHeadersProvider;
- private final Gson gson = new GsonBuilder().create();;
@Autowired
@Qualifier(CONFIGURABLE_REST_TEMPLATE)
private RestTemplate restTemplate;
- private MockRestServiceServer mockRestServer;
+ private MockRestServiceServer mockRestServiceServer;
- @Autowired
private TestRestTemplate testRestTemplate;
@Autowired
@@ -117,14 +126,21 @@ public class EtsiSubscriptionNotificationControllerTest {
@Before
public void setUp() {
- mockRestServer = MockRestServiceServer.bindTo(restTemplate).build();
+ mockRestServiceServer = MockRestServiceServer.bindTo(restTemplate).build();
basicHttpHeadersProvider = new BasicHttpHeadersProvider();
- cache = cacheServiceProvider.getCache(Constants.PACKAGE_MANAGEMENT_SUBSCRIPTION_CACHE);
+ cache = cacheServiceProvider.getCache(PackageManagementConstants.PACKAGE_MANAGEMENT_SUBSCRIPTION_CACHE);
cache.clear();
+
+ final Gson gson = JSON.createGson().registerTypeAdapter(LocalDateTime.class,
+ new EtsiSubscriptionNotificationController.LocalDateTimeTypeAdapter()).create();
+ testRestTemplate = new TestRestTemplate(
+ new RestTemplateBuilder().additionalMessageConverters(new GsonHttpMessageConverter(gson)));
}
+
@After
public void tearDown() {
+ mockRestServiceServer.reset();
cache.clear();
}
@@ -140,21 +156,20 @@ public class EtsiSubscriptionNotificationControllerTest {
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))
+ mockRestServiceServer.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(jsonPath("$.timeStamp").value(TIME_STAMP_STRING_EXPECTED_FROM_ETSI_CATALOG))
+ .andExpect(jsonPath("$.vnfPkgId").value(VNFPKG_ID)).andExpect(jsonPath("$.vnfdId").value(VNFD_ID))
+ .andExpect(jsonPath("$._links")
+ .value(buildPkgmLinks(EXPECTED_VNF_PACKAGE_HREF, EXPECTED_SUBSCRIPTION_HREF)))
.andExpect(header("Authorization", EXPECTED_BASIC_AUTHORIZATION)).andRespond(withSuccess());
- final ResponseEntity<?> response = sendHttpPost(notificationString);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode());
}
@@ -162,8 +177,7 @@ public class EtsiSubscriptionNotificationControllerTest {
@Test
public void testOnboardingNotificationNotSentOnToVnfmCallbackUri_SubscriptionRequestNotInCache_Fail() {
final PkgOnboardingNotification notification = buildPkgOnboardingNotification();
- final String notificationString = gson.toJson(notification);
- final ResponseEntity<?> response = sendHttpPost(notificationString);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
assertTrue(response.getBody() instanceof ProblemDetails);
@@ -181,12 +195,11 @@ public class EtsiSubscriptionNotificationControllerTest {
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))
+ mockRestServiceServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
.andRespond(withStatus(HttpStatus.BAD_REQUEST));
- final ResponseEntity<?> response = sendHttpPost(notificationString);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
assertTrue(response.getBody() instanceof ProblemDetails);
@@ -204,12 +217,11 @@ public class EtsiSubscriptionNotificationControllerTest {
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))
+ mockRestServiceServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
.andRespond(withStatus(HttpStatus.MOVED_PERMANENTLY));
- final ResponseEntity<?> response = sendHttpPost(notificationString);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
assertTrue(response.getBody() instanceof ProblemDetails);
@@ -226,12 +238,11 @@ public class EtsiSubscriptionNotificationControllerTest {
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))
+ mockRestServiceServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
.andRespond(withStatus(HttpStatus.NOT_FOUND));
- final ResponseEntity<?> response = sendHttpPost(notificationString);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
assertTrue(response.getBody() instanceof ProblemDetails);
@@ -249,12 +260,11 @@ public class EtsiSubscriptionNotificationControllerTest {
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))
+ mockRestServiceServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
.andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR));
- final ResponseEntity<?> response = sendHttpPost(notificationString);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
assertTrue(response.getBody() instanceof ProblemDetails);
@@ -273,24 +283,23 @@ public class EtsiSubscriptionNotificationControllerTest {
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))
+ mockRestServiceServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
.andExpect(jsonPath("$.id").value(NOTIFICATION_ID))
.andExpect(jsonPath("$.notificationType").value(
VnfPackageChangeNotification.NotificationTypeEnum.VNFPACKAGECHANGENOTIFICATION.getValue()))
.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("$.timeStamp").value(TIME_STAMP_STRING_EXPECTED_FROM_ETSI_CATALOG))
+ .andExpect(jsonPath("$.vnfPkgId").value(VNFPKG_ID)).andExpect(jsonPath("$.vnfdId").value(VNFD_ID))
.andExpect(
jsonPath("$.changeType").value(PkgChangeNotification.ChangeTypeEnum.OP_STATE_CHANGE.toString()))
.andExpect(jsonPath("$.operationalState")
.value(PkgChangeNotification.OperationalStateEnum.ENABLED.toString()))
- .andExpect(jsonPath("$._links").value(buildPkgmLinks()))
+ .andExpect(jsonPath("$._links")
+ .value(buildPkgmLinks(EXPECTED_VNF_PACKAGE_HREF, EXPECTED_SUBSCRIPTION_HREF)))
.andExpect(header("Authorization", EXPECTED_BASIC_AUTHORIZATION)).andRespond(withSuccess());
- final ResponseEntity<?> response = sendHttpPost(notificationString);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode());
}
@@ -298,8 +307,7 @@ public class EtsiSubscriptionNotificationControllerTest {
@Test
public void testChangeNotificationNotSentOnToVnfmCallbackUri_SubscriptionRequestNotInCache_Fail() {
final PkgChangeNotification notification = buildPkgChangeNotification();
- final String notificationString = gson.toJson(notification);
- final ResponseEntity<?> response = sendHttpPost(notificationString);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
assertTrue(response.getBody() instanceof ProblemDetails);
@@ -317,12 +325,11 @@ public class EtsiSubscriptionNotificationControllerTest {
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))
+ mockRestServiceServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
.andRespond(withStatus(HttpStatus.BAD_REQUEST));
- final ResponseEntity<?> response = sendHttpPost(notificationString);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
assertTrue(response.getBody() instanceof ProblemDetails);
@@ -340,12 +347,11 @@ public class EtsiSubscriptionNotificationControllerTest {
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))
+ mockRestServiceServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
.andRespond(withStatus(HttpStatus.NOT_FOUND));
- final ResponseEntity<?> response = sendHttpPost(notificationString);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
assertTrue(response.getBody() instanceof ProblemDetails);
@@ -363,12 +369,11 @@ public class EtsiSubscriptionNotificationControllerTest {
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))
+ mockRestServiceServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
.andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR));
- final ResponseEntity<?> response = sendHttpPost(notificationString);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
assertTrue(response.getBody() instanceof ProblemDetails);
@@ -387,21 +392,20 @@ public class EtsiSubscriptionNotificationControllerTest {
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))
+ mockRestServiceServer.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(jsonPath("$.timeStamp").value(TIME_STAMP_STRING_EXPECTED_FROM_ETSI_CATALOG))
+ .andExpect(jsonPath("$.vnfPkgId").value(VNFPKG_ID)).andExpect(jsonPath("$.vnfdId").value(VNFD_ID))
+ .andExpect(jsonPath("$._links")
+ .value(buildPkgmLinks(EXPECTED_VNF_PACKAGE_HREF, EXPECTED_SUBSCRIPTION_HREF)))
.andExpect(header("Authorization", EXPECTED_BASIC_AUTHORIZATION)).andRespond(withSuccess());
- final ResponseEntity<?> response = sendHttpPost(notificationString);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode());
}
@@ -412,13 +416,12 @@ public class EtsiSubscriptionNotificationControllerTest {
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))
+ mockRestServiceServer.expect(requestTo(CALLBACK_URI)).andExpect(method(HttpMethod.POST))
.andExpect(header("Authorization", EXPECTED_BASIC_AUTHORIZATION))
.andRespond(withStatus(HttpStatus.UNAUTHORIZED));
- final ResponseEntity<?> response = sendHttpPost(notificationString);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
assertTrue(response.getBody() instanceof ProblemDetails);
@@ -436,28 +439,28 @@ public class EtsiSubscriptionNotificationControllerTest {
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))
+ mockRestServiceServer.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))
+ mockRestServiceServer.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("$.timeStamp").value(TIME_STAMP_STRING_EXPECTED_FROM_ETSI_CATALOG))
+ .andExpect(jsonPath("$.vnfPkgId").value(VNFPKG_ID)).andExpect(jsonPath("$.vnfdId").value(VNFD_ID))
.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());
+ .andExpect(jsonPath("$._links")
+ .value(buildPkgmLinks(EXPECTED_VNF_PACKAGE_HREF, EXPECTED_SUBSCRIPTION_HREF)))
+ .andRespond(withSuccess());
- final ResponseEntity<?> response = sendHttpPost(notificationString);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.NO_CONTENT, response.getStatusCode());
}
@@ -468,12 +471,11 @@ public class EtsiSubscriptionNotificationControllerTest {
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))
+ mockRestServiceServer.expect(requestTo(TOKEN_ENDPOINT)).andExpect(method(HttpMethod.POST))
.andExpect(header("Authorization", EXPECTED_BASIC_AUTHORIZATION)).andRespond(withSuccess());
- final ResponseEntity<?> response = sendHttpPost(notificationString);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
assertTrue(response.getBody() instanceof ProblemDetails);
@@ -490,9 +492,8 @@ public class EtsiSubscriptionNotificationControllerTest {
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);
+ final ResponseEntity<?> response = sendHttpPost(notification);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, response.getStatusCode());
assertTrue(response.getBody() instanceof ProblemDetails);
@@ -532,17 +533,12 @@ public class EtsiSubscriptionNotificationControllerTest {
}
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 buildPkgmLinks("vnf_package_href", "subscription_href");
+ }
- return pkgmLinks;
+ private PkgmLinks buildPkgmLinks(final String vnfPkgHref, final String subscriptionHref) {
+ return new PkgmLinks().vnfPackage(new NOTIFICATIONLINKSERIALIZER().href(vnfPkgHref))
+ .subscription(new NOTIFICATIONLINKSERIALIZER().href(subscriptionHref));
}
private PkgmSubscriptionRequest buildPkgmSubscriptionRequest(
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/Sol003PackageManagementControllerTest.java
index be8b0c2e0b..10e4ea3a58 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementControllerTest.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/Sol003PackageManagementControllerTest.java
@@ -18,14 +18,14 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest;
+package org.onap.so.adapters.etsisol003adapter.pkgm.rest;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import static org.onap.so.adapters.vnfmadapter.Constants.PACKAGE_MANAGEMENT_BASE_URL;
-import static org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_REST_TEMPLATE_BEAN;
+import static org.onap.so.adapters.etsi.sol003.adapter.common.CommonConstants.PACKAGE_MANAGEMENT_BASE_URL;
+import static org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_REST_TEMPLATE_BEAN;
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;
@@ -33,19 +33,19 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.Checksum;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.ProblemDetails;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.UriLink;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VNFPKGMLinkSerializer;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageArtifactInfo;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPackageSoftwareImageInfo;
-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.extclients.vnfm.packagemanagement.model.VnfPackagesLinks;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.Checksum;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.ProblemDetails;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.UriLink;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VNFPKGMLinkSerializer;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VnfPackageArtifactInfo;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VnfPackageSoftwareImageInfo;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VnfPkgInfo;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.InlineResponse2001;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.VnfPackagesLinks;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -67,7 +67,7 @@ import com.google.gson.Gson;
* @author gareth.roper@est.tech
*/
@RunWith(SpringRunner.class)
-@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
public class Sol003PackageManagementControllerTest {
@@ -101,7 +101,7 @@ public class Sol003PackageManagementControllerTest {
private static final String EXPECTED_VNFD_HREF = EXPECTED_BASE_URL + VNF_PACKAGE_ID + "/vnfd";
private static final String EXPECTED_PACKAGE_CONTENT_HREF = EXPECTED_BASE_URL + VNF_PACKAGE_ID + "/package_content";
- private MockRestServiceServer mockRestServer;
+ private MockRestServiceServer mockRestServiceServer;
private BasicHttpHeadersProvider basicHttpHeadersProvider;
private final Gson gson = new Gson();
@@ -111,15 +111,20 @@ public class Sol003PackageManagementControllerTest {
public void setUp() {
final MockRestServiceServer.MockRestServiceServerBuilder builder = MockRestServiceServer.bindTo(restTemplate);
builder.ignoreExpectOrder(true);
- mockRestServer = builder.build();
+ mockRestServiceServer = builder.build();
basicHttpHeadersProvider = new BasicHttpHeadersProvider();
}
+ @After
+ public void after() {
+ mockRestServiceServer.reset();
+ }
+
@Test
public void testGetPackageContent_ValidArray_Success() {
final byte[] responseArray = buildByteArrayWithRandomData(10);
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
.andExpect(method(HttpMethod.GET))
.andRespond(withSuccess(responseArray, MediaType.APPLICATION_OCTET_STREAM));
@@ -136,7 +141,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageContent_Conflict_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.CONFLICT));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/package_content");
@@ -147,7 +152,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageContent_NotFound_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.NOT_FOUND));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/package_content");
@@ -161,7 +166,7 @@ public class Sol003PackageManagementControllerTest {
final String testURL = "http://localhost:" + port + PACKAGE_MANAGEMENT_BASE_URL + "/vnf_packages/"
+ VNF_PACKAGE_ID + "/package_content";
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.UNAUTHORIZED));
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
@@ -176,7 +181,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageContent_InternalServerError_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/package_content");
@@ -187,7 +192,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageContent_BadRequest_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.BAD_REQUEST));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/package_content");
@@ -198,7 +203,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageContent_UnauthorizedServer_InternalError_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.UNAUTHORIZED));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/package_content");
@@ -209,7 +214,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testGetPackageContent_SuccessResponseFromServerWithNullPackage_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/package_content"))
.andExpect(method(HttpMethod.GET)).andRespond(withSuccess());
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/package_content");
@@ -222,7 +227,7 @@ public class Sol003PackageManagementControllerTest {
public void testGetPackageArtifact_ValidArray_Success() {
final byte[] responseArray = buildByteArrayWithRandomData(10);
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
.andExpect(method(HttpMethod.GET))
.andRespond(withSuccess(responseArray, MediaType.APPLICATION_OCTET_STREAM));
@@ -239,7 +244,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageArtifact_Conflict_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.CONFLICT));
final ResponseEntity<ProblemDetails> responseEntity =
@@ -251,7 +256,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageArtifact_NotFound_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.NOT_FOUND));
final ResponseEntity<ProblemDetails> responseEntity =
@@ -266,7 +271,7 @@ public class Sol003PackageManagementControllerTest {
final String testURL = "http://localhost:" + port + PACKAGE_MANAGEMENT_BASE_URL + "/vnf_packages/"
+ VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH;
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.UNAUTHORIZED));
final HttpEntity<?> request = new HttpEntity<>(basicHttpHeadersProvider.getHttpHeaders());
@@ -279,7 +284,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageArtifact_InternalServerError_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR));
final ResponseEntity<ProblemDetails> responseEntity =
@@ -291,7 +296,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageArtifact_BadRequest_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.BAD_REQUEST));
final ResponseEntity<ProblemDetails> responseEntity =
@@ -303,7 +308,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageArtifact_UnauthorizedServer_InternalError_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.UNAUTHORIZED));
final ResponseEntity<ProblemDetails> responseEntity =
@@ -315,7 +320,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testGetPackageArtifact_SuccessResponseFromServerWithNullPackage_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/artifacts/" + ARTIFACT_PATH))
.andExpect(method(HttpMethod.GET)).andRespond(withSuccess());
final ResponseEntity<ProblemDetails> responseEntity =
@@ -329,7 +334,7 @@ public class Sol003PackageManagementControllerTest {
public void testVnfPackagesReceivedAsInlineResponse2001ListIfGetVnfPackagesSuccessful() {
final VnfPkgInfo[] responses = createVnfPkgArray();
- mockRestServer.expect(requestTo(MSB_BASE_URL)).andExpect(method(HttpMethod.GET))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL)).andExpect(method(HttpMethod.GET))
.andRespond(withSuccess(gson.toJson(responses), MediaType.APPLICATION_JSON));
final String testURL = localhostUrl + port + VNFPKGM_BASE_URL;
@@ -360,7 +365,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void test400BadRequestInfoReceivedAsProblemDetailsIfGetVnfPackagesIs400BadRequest() {
- mockRestServer.expect(requestTo(MSB_BASE_URL)).andExpect(method(HttpMethod.GET))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL)).andExpect(method(HttpMethod.GET))
.andRespond(withStatus(HttpStatus.BAD_REQUEST));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGES_URL);
@@ -373,7 +378,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void test404NotFoundInfoReceivedAsProblemDetailsIfGetVnfPackagesIs404NotFound() {
- mockRestServer.expect(requestTo(MSB_BASE_URL)).andExpect(method(HttpMethod.GET))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL)).andExpect(method(HttpMethod.GET))
.andRespond(withStatus(HttpStatus.NOT_FOUND));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGES_URL);
@@ -386,7 +391,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void test500InternalServerErrorProblemDetailsReceivedIfGetVnfPackagesReturns500InternalServerError() {
- mockRestServer.expect(requestTo(MSB_BASE_URL)).andExpect(method(HttpMethod.GET))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL)).andExpect(method(HttpMethod.GET))
.andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGES_URL);
@@ -399,7 +404,8 @@ public class Sol003PackageManagementControllerTest {
@Test
public void test500InternalServerErrorProblemDetailsReceivedIfGetVnfPackagesReturnsANullPackage() {
- mockRestServer.expect(requestTo(MSB_BASE_URL)).andExpect(method(HttpMethod.GET)).andRespond(withSuccess());
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL)).andExpect(method(HttpMethod.GET))
+ .andRespond(withSuccess());
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGES_URL);
assertEquals(HttpStatus.INTERNAL_SERVER_ERROR, responseEntity.getStatusCode());
@@ -415,7 +421,7 @@ public class Sol003PackageManagementControllerTest {
public void testVnfPackageReceivedAsInlineResponse2001IfGetVnfPackageByIdSuccessful() {
final VnfPkgInfo response = createVnfPkgInfo(VNF_PACKAGE_ID);
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID)).andExpect(method(HttpMethod.GET))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID)).andExpect(method(HttpMethod.GET))
.andRespond(withSuccess(gson.toJson(response), MediaType.APPLICATION_JSON));
final String testURL = localhostUrl + port + VNFPKGM_BASE_URL + "/" + VNF_PACKAGE_ID;
@@ -445,7 +451,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void test400BadRequestInfoReceivedAsProblemDetailsIfGetVnfPackageByIdIs400BadRequest() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID)).andExpect(method(HttpMethod.GET))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID)).andExpect(method(HttpMethod.GET))
.andRespond(withStatus(HttpStatus.BAD_REQUEST));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGE_BY_ID_URL);
@@ -458,7 +464,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void test404NotFoundInfoReceivedAsProblemDetailsIfGetVnfPackageByIdIs404NotFound() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID)).andExpect(method(HttpMethod.GET))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID)).andExpect(method(HttpMethod.GET))
.andRespond(withStatus(HttpStatus.NOT_FOUND));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGE_BY_ID_URL);
@@ -471,7 +477,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void test500InternalServerErrorProblemDetailsReceivedIfGetVnfPackageByIdReturns500InternalServerError() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID)).andExpect(method(HttpMethod.GET))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID)).andExpect(method(HttpMethod.GET))
.andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGE_BY_ID_URL);
@@ -484,7 +490,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void test500InternalServerErrorProblemDetailsReceivedIfGetVnfPackageByIdReturnsANullPackage() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID)).andExpect(method(HttpMethod.GET))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID)).andExpect(method(HttpMethod.GET))
.andRespond(withSuccess());
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(GET_VNF_PACKAGE_BY_ID_URL);
@@ -503,7 +509,7 @@ public class Sol003PackageManagementControllerTest {
public void testGetPackageVnfd_ValidArray_Success() {
final byte[] responseArray = buildByteArrayWithRandomData(10);
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
.andExpect(method(HttpMethod.GET))
.andRespond(withSuccess(responseArray, MediaType.APPLICATION_OCTET_STREAM));
@@ -520,7 +526,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageVnfd_Conflict_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.CONFLICT));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/vnfd");
@@ -531,7 +537,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageVnfd_NotFound_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.NOT_FOUND));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/vnfd");
@@ -542,7 +548,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageVnfd_UnauthorizedClient_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.UNAUTHORIZED));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/vnfd");
@@ -553,7 +559,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageVnfd_InternalServerError_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.INTERNAL_SERVER_ERROR));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/vnfd");
@@ -564,7 +570,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageVnfd_BadRequest_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.BAD_REQUEST));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/vnfd");
@@ -575,7 +581,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testOnGetPackageVnfd_UnauthorizedServer_InternalError_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
.andExpect(method(HttpMethod.GET)).andRespond(withStatus(HttpStatus.UNAUTHORIZED));
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/vnfd");
@@ -586,7 +592,7 @@ public class Sol003PackageManagementControllerTest {
@Test
public void testGetPackageVnfd_SuccessResponseFromServerWithNullPackage_Fail() {
- mockRestServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
+ mockRestServiceServer.expect(requestTo(MSB_BASE_URL + "/" + VNF_PACKAGE_ID + "/vnfd"))
.andExpect(method(HttpMethod.GET)).andRespond(withSuccess());
final ResponseEntity<ProblemDetails> responseEntity = sendHttpRequest(VNF_PACKAGE_ID + "/vnfd");
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/Sol003PackageManagementSubscriptionControllerTest.java
index c269af8e68..65be6a87f0 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/Sol003PackageManagementSubscriptionControllerTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnfmadapter.rest;
+package org.onap.so.adapters.etsisol003adapter.pkgm.rest;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
@@ -27,8 +27,9 @@ 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.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_REST_TEMPLATE_BEAN;
+import static org.onap.so.adapters.etsi.sol003.adapter.common.CommonConstants.ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL;
+import static org.onap.so.adapters.etsi.sol003.adapter.common.CommonConstants.PACKAGE_MANAGEMENT_BASE_URL;
+import static org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.EtsiCatalogServiceProviderConfiguration.ETSI_CATALOG_REST_TEMPLATE_BEAN;
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;
@@ -47,26 +48,25 @@ 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.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.onap.so.adapters.etsisol003adapter.pkgm.PackageManagementConstants;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.BasicAuth;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.LinkSelf;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.NsdmSubscription;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmNotificationsFilter;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscription;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.ProblemDetails;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.SubscriptionAuthentication;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.Version;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VnfProducts;
+import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.VnfProductsProviders;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.InlineResponse2002;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.InlineResponse201;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.PkgmSubscriptionRequest;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsAuthentication;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsFilter1;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsFilterVnfProductsFromProviders;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.SubscriptionsLinks;
+import org.onap.so.adapters.etsisol003adapter.pkgm.model.VnfPackagesLinksSelf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
@@ -91,14 +91,14 @@ import com.google.gson.Gson;
* @author Gareth Roper (gareth.roper@est.tech)
*/
@RunWith(SpringRunner.class)
-@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
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;
+ "https://so-vnfm-adapter.onap:30406" + ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL;
private static final String LOCALHOST_URL = "http://localhost:";
@Autowired
@@ -121,7 +121,8 @@ public class Sol003PackageManagementSubscriptionControllerTest {
@Before
public void setUp() {
mockRestServiceServer = MockRestServiceServer.bindTo(restTemplate).build();
- final Cache cache = cacheServiceProvider.getCache(Constants.PACKAGE_MANAGEMENT_SUBSCRIPTION_CACHE);
+ final Cache cache =
+ cacheServiceProvider.getCache(PackageManagementConstants.PACKAGE_MANAGEMENT_SUBSCRIPTION_CACHE);
cache.clear();
}
@@ -280,7 +281,8 @@ public class Sol003PackageManagementSubscriptionControllerTest {
(ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
.postSubscriptionRequest(pkgmSubscriptionRequest);
- final Cache cache = cacheServiceProvider.getCache(Constants.PACKAGE_MANAGEMENT_SUBSCRIPTION_CACHE);
+ final Cache cache =
+ cacheServiceProvider.getCache(PackageManagementConstants.PACKAGE_MANAGEMENT_SUBSCRIPTION_CACHE);
assertNotNull(cache.get(ID));
final ResponseEntity responseDelete = sol003PackageManagementSubscriptionController.deleteSubscription(ID);
@@ -310,9 +312,9 @@ public class Sol003PackageManagementSubscriptionControllerTest {
.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);
+ final ResponseEntity<InlineResponse201> responseEntity =
+ testRestTemplate.postForEntity(LOCALHOST_URL + port + PACKAGE_MANAGEMENT_BASE_URL + "/subscriptions",
+ request, InlineResponse201.class);
assertEquals(HttpStatus.CREATED, responseEntity.getStatusCode());
assertTrue(responseEntity.hasBody());
@@ -322,8 +324,8 @@ public class Sol003PackageManagementSubscriptionControllerTest {
}
- private org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest getEtsiCatalogPkgmSubscriptionRequest() {
- return new org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest()
+ private org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscriptionRequest getEtsiCatalogPkgmSubscriptionRequest() {
+ return new org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model.PkgmSubscriptionRequest()
.filter(new PkgmNotificationsFilter()
.addNotificationTypesItem(
PkgmNotificationsFilter.NotificationTypesEnum.VNFPACKAGEONBOARDINGNOTIFICATION)
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/TestApplication.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/TestApplication.java
new file mode 100755
index 0000000000..33535523d6
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/java/org/onap/so/adapters/etsisol003adapter/pkgm/rest/TestApplication.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 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.etsisol003adapter.pkgm.rest;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
+import org.springframework.cache.annotation.EnableCaching;
+
+@EnableCaching
+@SpringBootApplication(scanBasePackages = {"org.onap.so"})
+@EnableAutoConfiguration(exclude = {JacksonAutoConfiguration.class})
+public class TestApplication {
+
+ public static void main(final String[] args) {
+ new SpringApplication(TestApplication.class).run(args);
+ }
+
+}
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/resources/application.yaml b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/resources/application.yaml
new file mode 100644
index 0000000000..cdb6662191
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/resources/application.yaml
@@ -0,0 +1,61 @@
+# Copyright © 2019 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.
+spring:
+ security:
+ usercredentials:
+ - username: test
+ password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu'
+ role: BPEL-Client
+ - username: vnfm
+ password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
+ role: BPEL-Client
+ main:
+ allow-bean-definition-overriding: true
+
+mso:
+ key: 07a7159d3bf51a0e53be7a8f89699be7
+
+aai:
+ auth: 2A11B07DB6214A839394AA1EC5844695F5114FC407FF5422625FB00175A3DCB8A1FF745F22867EFA72D5369D599BBD88DA8BED4233CF5586
+ endpoint: https://aai.onap:8443
+ version: v15
+
+sdc:
+ username: sdcUser
+ password: sdcPassword
+ key: adadadadad
+ endpoint: http://sdc.onap/1234A
+
+
+vnfmadapter:
+ endpoint: https://so-vnfm-adapter.onap:30406
+
+
+#Actuator
+management:
+ endpoints:
+ web:
+ base-path: /manage
+ exposure:
+ include: "*"
+ metrics:
+ se-global-registry: false
+ export:
+ prometheus:
+ enabled: true # Whether exporting of metrics to Prometheus is enabled.
+ step: 1m # Step size (i.e. reporting frequency) to use.
+
+etsi-catalog-manager:
+ vnfpkgm:
+ endpoint: http://msb-iag.onap:80/api/vnfpkgm/v1
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/requests/SubscriptionRequest.json b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/resources/requests/SubscriptionRequest.json
index c38466f8e5..c38466f8e5 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/requests/SubscriptionRequest.json
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/test/resources/requests/SubscriptionRequest.json
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/pom.xml
new file mode 100644
index 0000000000..884419c550
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/pom.xml
@@ -0,0 +1,196 @@
+<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.adapters</groupId>
+ <artifactId>etsi-sol003-pkgm</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>etsi-sol003-pkgm-api</artifactId>
+ <name>ETSI SOL003 VNF Package Management Adapter API</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <version>${version-swagger-codegen}</version>
+ <executions>
+ <execution>
+ <id>etsicatalog-notification-api</id>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <inputSpec>${basedir}/src/main/resources/ETSI-Catalog-Notification-API.json</inputSpec>
+ <language>java</language>
+ <library>okhttp-gson</library>
+ <output>${project.build.directory}/generated-sources/etsicatalog/notification</output>
+ <apiPackage>org.onap.so.adapters.etsisol003adapter.etsicatalog.notification.api</apiPackage>
+ <modelPackage>org.onap.so.adapters.etsisol003adapter.etsicatalog.notification.model</modelPackage>
+ <generateApiTests>false</generateApiTests>
+ <generateModelTests>false</generateModelTests>
+ <configOptions>
+ <sourceFolder>src/gen/java/main</sourceFolder>
+ <withXml>true</withXml>
+ <useRxJava2>true</useRxJava2>
+ <serializableModel>true</serializableModel>
+ <dateLibrary>java8-localdatetime</dateLibrary>
+ </configOptions>
+ </configuration>
+ </execution>
+ <execution>
+ <id>sol003-vnf-packagemanagement-api</id>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <inputSpec>${basedir}/src/main/resources/SOL003-VNFPackageManagement-API.json</inputSpec>
+ <language>java</language>
+ <library>okhttp-gson</library>
+ <output>${project.build.directory}/generated-sources/sol003-vnf-packagemanagement</output>
+ <apiPackage>org.onap.so.adapters.etsisol003adapter.pkgm.api</apiPackage>
+ <modelPackage>org.onap.so.adapters.etsisol003adapter.pkgm.model</modelPackage>
+ <generateApiTests>false</generateApiTests>
+ <generateModelTests>false</generateModelTests>
+ <configOptions>
+ <sourceFolder>src/gen/java/main</sourceFolder>
+ <withXml>true</withXml>
+ <useRxJava2>true</useRxJava2>
+ <serializableModel>true</serializableModel>
+ </configOptions>
+ </configuration>
+ </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/notification/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/sol003-vnf-packagemanagement/src/gen/java/main</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <versionRange>[2.2.0,)</versionRange>
+ </pluginExecutionFilter>
+ <action>
+ <execute>
+ <runOnIncremental>false</runOnIncremental>
+ </execute>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>${swagger-core-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>converter-gson</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>retrofit</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>converter-scalars</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.oltu.oauth2</groupId>
+ <artifactId>org.apache.oltu.oauth2.client</artifactId>
+ <version>${oltu-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.gsonfire</groupId>
+ <artifactId>gson-fire</artifactId>
+ <version>${gson-fire-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.threeten</groupId>
+ <artifactId>threetenbp</artifactId>
+ <version>${threetenbp-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.reactivex.rxjava2</groupId>
+ <artifactId>rxjava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>adapter-rxjava2</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okio</groupId>
+ <artifactId>okio</artifactId>
+ <version>${okio-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>${okhttp3-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>logging-interceptor</artifactId>
+ <version>${okhttp3-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp</groupId>
+ <artifactId>logging-interceptor</artifactId>
+ <version>${okhttp-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>${okhttp-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp</groupId>
+ <artifactId>logging-interceptor</artifactId>
+ <version>${okhttp-version}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/ETSI-Catalog-Notification-API.json b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/src/main/resources/ETSI-Catalog-Notification-API.json
index 6db54435d2..6db54435d2 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/ETSI-Catalog-Notification-API.json
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/src/main/resources/ETSI-Catalog-Notification-API.json
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFPackageManagement-API.json b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/src/main/resources/SOL003-VNFPackageManagement-API.json
index 17d81f44c1..17d81f44c1 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/SOL003-VNFPackageManagement-API.json
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-api/src/main/resources/SOL003-VNFPackageManagement-API.json
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/pom.xml
new file mode 100644
index 0000000000..6e6de84b5f
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/pom.xml
@@ -0,0 +1,197 @@
+<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.adapters</groupId>
+ <artifactId>etsi-sol003-pkgm</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>etsi-sol003-pkgm-ext-clients</artifactId>
+ <name>ETSI SOL003 VNF Package Management Adapter Ext Clients</name>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <version>${version-swagger-codegen}</version>
+ <executions>
+ <execution>
+ <id>etsicatalog-api</id>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <inputSpec>${basedir}/src/main/resources/ETSI-Catalog-API.json</inputSpec>
+ <language>java</language>
+ <library>okhttp-gson</library>
+ <output>${project.build.directory}/generated-sources/etsicatalog</output>
+ <apiPackage>org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.api</apiPackage>
+ <modelPackage>org.onap.so.adapters.etsisol003adapter.pkgm.extclients.etsicatalog.model</modelPackage>
+ <generateApiTests>false</generateApiTests>
+ <generateModelTests>false</generateModelTests>
+ <configOptions>
+ <sourceFolder>src/gen/java/main</sourceFolder>
+ <withXml>true</withXml>
+ <useRxJava2>true</useRxJava2>
+ <serializableModel>true</serializableModel>
+ </configOptions>
+ </configuration>
+ </execution>
+ <execution>
+ <id>sol003-packagemanagement-notification-api</id>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <inputSpec>${basedir}/src/main/resources/SOL003-VNFPackageManagement-Notification-API.json</inputSpec>
+ <language>java</language>
+ <library>okhttp-gson</library>
+ <output>${project.build.directory}/generated-sources/sol003-vnf-packagemanagement/notification</output>
+ <apiPackage>org.onap.so.adapters.etsisol003adapter.pkgm.extclients.vnfm.notification.api</apiPackage>
+ <modelPackage>org.onap.so.adapters.etsisol003adapter.pkgm.extclients.vnfm.notification.model</modelPackage>
+ <generateApiTests>false</generateApiTests>
+ <generateModelTests>false</generateModelTests>
+ <configOptions>
+ <sourceFolder>src/gen/java/main</sourceFolder>
+ <withXml>true</withXml>
+ <useRxJava2>true</useRxJava2>
+ <serializableModel>true</serializableModel>
+ <dateLibrary>java8-localdatetime</dateLibrary>
+ </configOptions>
+ </configuration>
+ </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/sol003-vnf-packagemanagement/notification/src/gen/java/main</source>
+ <source>${project.basedir}/target/generated-sources/etsicatalog/src/gen/java/main</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <versionRange>[2.2.0,)</versionRange>
+ </pluginExecutionFilter>
+ <action>
+ <execute>
+ <runOnIncremental>false</runOnIncremental>
+ </execute>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>${swagger-core-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>converter-gson</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>retrofit</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>converter-scalars</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.oltu.oauth2</groupId>
+ <artifactId>org.apache.oltu.oauth2.client</artifactId>
+ <version>${oltu-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.gsonfire</groupId>
+ <artifactId>gson-fire</artifactId>
+ <version>${gson-fire-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.threeten</groupId>
+ <artifactId>threetenbp</artifactId>
+ <version>${threetenbp-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.reactivex.rxjava2</groupId>
+ <artifactId>rxjava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>adapter-rxjava2</artifactId>
+ <version>${retrofit-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okio</groupId>
+ <artifactId>okio</artifactId>
+ <version>${okio-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>${okhttp3-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>logging-interceptor</artifactId>
+ <version>${okhttp3-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp</groupId>
+ <artifactId>logging-interceptor</artifactId>
+ <version>${okhttp-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>${okhttp-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.okhttp</groupId>
+ <artifactId>logging-interceptor</artifactId>
+ <version>${okhttp-version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/src/main/resources/ETSI-Catalog-API.json
index 35a8c2bd3d..35a8c2bd3d 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/src/main/resources/ETSI-Catalog-API.json
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/SOL003-VNFPackageManagement-Notification-API.json b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/src/main/resources/SOL003-VNFPackageManagement-Notification-API.json
index 32e002f0e7..32e002f0e7 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/SOL003-VNFPackageManagement-Notification-API.json
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-ext-clients/src/main/resources/SOL003-VNFPackageManagement-Notification-API.json
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/pom.xml
new file mode 100644
index 0000000000..fb5b636ee4
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/pom.xml
@@ -0,0 +1,17 @@
+<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.adapters</groupId>
+ <artifactId>etsi-sol003-adapter</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>etsi-sol003-pkgm</artifactId>
+ <name>ETSI SOL003 VNF Package Management</name>
+ <packaging>pom</packaging>
+ <modules>
+ <module>etsi-sol003-pkgm-api</module>
+ <module>etsi-sol003-pkgm-ext-clients</module>
+ <module>etsi-sol003-pkgm-adapter</module>
+ </modules>
+</project> \ No newline at end of file
diff --git a/adapters/etsi-sol003-adapter/pom.xml b/adapters/etsi-sol003-adapter/pom.xml
new file mode 100644
index 0000000000..6c3a1f5b1c
--- /dev/null
+++ b/adapters/etsi-sol003-adapter/pom.xml
@@ -0,0 +1,35 @@
+<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>etsi-sol003-adapter</artifactId>
+ <name>ETSI SOL003 Adapter</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <version-swagger-codegen>2.3.1</version-swagger-codegen>
+ <gson-fire-version>1.8.2</gson-fire-version>
+ <retrofit-version>2.3.0</retrofit-version>
+ <threetenbp-version>1.3.5</threetenbp-version>
+ <oltu-version>1.0.1</oltu-version>
+ <swagger-core-version>1.5.15</swagger-core-version>
+ <okhttp3-version>3.14.0</okhttp3-version>
+ <okhttp-version>2.7.5</okhttp-version>
+ <okio-version>1.13.0</okio-version>
+ <spring-security-oauth2-version>2.3.6.RELEASE</spring-security-oauth2-version>
+ </properties>
+
+ <modules>
+ <module>etsi-sol003-adapter-common</module>
+ <module>etsi-sol003-pkgm</module>
+ <module>etsi-sol003-lcm</module>
+ <module>etsi-sol003-adapter-application</module>
+ </modules>
+</project> \ No newline at end of file
diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml
index b8dec73f80..a121d2d89b 100644
--- a/adapters/mso-adapter-utils/pom.xml
+++ b/adapters/mso-adapter-utils/pom.xml
@@ -152,5 +152,13 @@
<artifactId>mso-requests-db</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-cache</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.github.ben-manes.caffeine</groupId>
+ <artifactId>caffeine</artifactId>
+ </dependency>
</dependencies>
</project>
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
index 698b605be3..b614a92177 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/GlanceClientImpl.java
@@ -28,9 +28,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.glance.Glance;
+import com.woorea.openstack.glance.model.Image;
import com.woorea.openstack.glance.model.Images;
-
@Component
public class GlanceClientImpl extends MsoCommonUtils {
@@ -70,10 +70,27 @@ public class GlanceClientImpl extends MsoCommonUtils {
public Images queryImages(String cloudSiteId, String tenantId, int limit, String visibility, String marker,
String name) throws MsoCloudSiteNotFound, GlanceClientException {
try {
+ String encodedName = null;
+ if (name != null) {
+ encodedName = "in:\"" + name + "\"";
+ }
Glance glanceClient = getGlanceClient(cloudSiteId, tenantId);
// list is set to false, otherwise an invalid URL is appended
OpenStackRequest<Images> request = glanceClient.images().list(false).queryParam("visibility", visibility)
- .queryParam("limit", limit).queryParam("marker", marker).queryParam("name", name);
+ .queryParam("limit", limit).queryParam("marker", marker).queryParam("name", encodedName);
+ return executeAndRecordOpenstackRequest(request, false);
+ } catch (MsoException e) {
+ logger.error("Error building Glance Client", e);
+ throw new GlanceClientException("Error building Glance Client", e);
+ }
+ }
+
+ public Image queryImage(String cloudSiteId, String tenantId, String imageId)
+ throws MsoCloudSiteNotFound, GlanceClientException {
+ try {
+ Glance glanceClient = getGlanceClient(cloudSiteId, tenantId);
+ // list is set to false, otherwise an invalid URL is appended
+ OpenStackRequest<Image> request = glanceClient.images().show(imageId);
return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
logger.error("Error building Glance Client", e);
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 62d9f068f9..c33160d255 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
@@ -184,6 +184,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
if (CREATE_COMPLETE.equals(currentStack.getStackStatus())) {
new StackInfoMapper(currentStack).map();
} else if (CREATE_IN_PROGRESS.equals(currentStack.getStackStatus())) {
+ // TODO should check poll for completion right here
currentStack = processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout, currentStack,
createStack, true);
} else if (CREATE_FAILED.equals(currentStack.getStackStatus())
@@ -322,6 +323,27 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
}
}
+ public Stack postProcessStackUpdate(Stack updateStack) throws MsoOpenstackException {
+ if (!"UPDATE_COMPLETE".equals(updateStack.getStackStatus())) {
+ logger.error("{} Stack status: {} Stack status reason: {} {} Update Stack error",
+ MessageEnum.RA_UPDATE_STACK_ERR, updateStack.getStackStatus(), updateStack.getStackStatusReason(),
+ ErrorCode.DataError.getValue());
+
+ MsoOpenstackException me = null;
+ if ("UPDATE_IN_PROGRESS".equals(updateStack.getStackStatus())) {
+ me = new MsoOpenstackException(0, "", "Stack Update Timeout");
+ } else {
+ String error =
+ "Stack error (" + updateStack.getStackStatus() + "): " + updateStack.getStackStatusReason();
+ me = new MsoOpenstackException(0, "", error);
+ }
+ me.addContext("UpdateStack");
+ throw me;
+ } else {
+ return updateStack;
+ }
+ }
+
public Stack pollStackForStatus(int timeoutMinutes, Stack stack, String stackStatus, String cloudSiteId,
String tenantId, boolean notFoundIsSuccess) throws MsoException {
int pollingFrequency =
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 3e28e5c45a..9a9bccfb5d 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
@@ -24,7 +24,6 @@ package org.onap.so.openstack.utils;
import java.util.ArrayList;
-import java.util.Calendar;
import java.util.List;
import java.util.Optional;
import org.onap.so.cloud.CloudConfig;
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java
index 8f9dbd1f5a..96ed408c80 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NeutronClientImpl.java
@@ -20,6 +20,8 @@
package org.onap.so.openstack.utils;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
import org.onap.so.cloud.authentication.KeystoneAuthHolder;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
@@ -73,9 +75,17 @@ public class NeutronClientImpl extends MsoCommonUtils {
public Networks queryNetworks(String cloudSiteId, String tenantId, int limit, String marker, String name, String id)
throws MsoCloudSiteNotFound, NeutronClientException {
try {
+ String encodedName = null;
+ if (name != null) {
+ try {
+ encodedName = URLEncoder.encode(name, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ logger.error("error encoding query parameter: {}", encodedName);
+ }
+ }
Quantum neutronClient = getNeutronClient(cloudSiteId, tenantId);
OpenStackRequest<Networks> request = neutronClient.networks().list().queryParam("id", id)
- .queryParam("limit", limit).queryParam("marker", marker).queryParam("name", name);
+ .queryParam("limit", limit).queryParam("marker", marker).queryParam("name", encodedName);
return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
logger.error("Error building Neutron Client", e);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotificationResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaCacheConfig.java
index 2e18e05860..2f7d19ff1d 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotificationResponse.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaCacheConfig.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,37 +17,26 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+package org.onap.so.openstack.utils;
-package org.onap.so.adapters.network.async.client;
+import java.util.concurrent.TimeUnit;
+import org.springframework.cache.CacheManager;
+import org.springframework.cache.caffeine.CaffeineCacheManager;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import com.github.benmanes.caffeine.cache.Caffeine;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>
- * Java class for queryNetworkNotificationResponse complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="queryNetworkNotificationResponse">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "queryNetworkNotificationResponse")
-public class QueryNetworkNotificationResponse {
+@Configuration
+public class NovaCacheConfig {
+ @Bean
+ public CacheManager cacheManager() {
+ CaffeineCacheManager cacheManager = new CaffeineCacheManager("novaClient");
+ cacheManager.setCaffeine(caffeineCacheBuilder());
+ return cacheManager;
+ }
+ private Caffeine<Object, Object> caffeineCacheBuilder() {
+ return Caffeine.newBuilder().initialCapacity(100).maximumSize(500).expireAfterWrite(90, TimeUnit.MINUTES);
+ }
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClient.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClient.java
new file mode 100644
index 0000000000..c5eeb34157
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaClient.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.openstack.utils;
+
+import org.onap.so.cloud.authentication.KeystoneAuthHolder;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Component;
+import com.woorea.openstack.nova.Nova;
+
+
+@Component
+public class NovaClient extends MsoCommonUtils {
+
+ private static final Logger logger = LoggerFactory.getLogger(NovaClient.class);
+
+ /**
+ * Gets the Nova client
+ *
+ * @param cloudSiteId id of the cloud site
+ * @param tenantId the tenant id
+ * @return the Nova client
+ * @throws MsoException the mso exception
+ */
+ @Cacheable(value = "novaClient")
+ public Nova getNovaClient(String cloudSiteId, String tenantId) throws MsoException {
+ KeystoneAuthHolder keystone = getKeystoneAuthHolder(cloudSiteId, tenantId, "compute");
+ Nova novaClient = new Nova(keystone.getServiceUrl());
+ novaClient.token(keystone.getId());
+ return novaClient;
+ }
+}
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 4dc139f37d..dc276d9b8f 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
@@ -20,11 +20,12 @@
package org.onap.so.openstack.utils;
-import org.onap.so.cloud.authentication.KeystoneAuthHolder;
+import java.io.IOException;
import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -49,21 +50,8 @@ public class NovaClientImpl extends MsoCommonUtils {
/** The logger. */
private static final Logger logger = LoggerFactory.getLogger(NovaClientImpl.class);
- /**
- * Gets the Nova client
- *
- * @param cloudSiteId id of the cloud site
- * @param tenantId the tenant id
- * @return the Nova client
- * @throws MsoException the mso exception
- */
- private Nova getNovaClient(String cloudSiteId, String tenantId) throws MsoException {
- KeystoneAuthHolder keystone = getKeystoneAuthHolder(cloudSiteId, tenantId, "compute");
- Nova novaClient = new Nova(keystone.getServiceUrl());
- novaClient.token(keystone.getId());
- return novaClient;
- }
-
+ @Autowired
+ private NovaClient client;
/**
* Query Networks
@@ -82,7 +70,7 @@ public class NovaClientImpl extends MsoCommonUtils {
public Flavors queryFlavors(String cloudSiteId, String tenantId, int limit, String marker)
throws MsoCloudSiteNotFound, NovaClientException {
try {
- Nova novaClient = getNovaClient(cloudSiteId, tenantId);
+ Nova novaClient = client.getNovaClient(cloudSiteId, tenantId);
OpenStackRequest<Flavors> request =
novaClient.flavors().list(false).queryParam("limit", limit).queryParam("marker", marker);
return executeAndRecordOpenstackRequest(request, false);
@@ -107,8 +95,7 @@ public class NovaClientImpl extends MsoCommonUtils {
public Flavor queryFlavorById(String cloudSiteId, String tenantId, String id)
throws MsoCloudSiteNotFound, NovaClientException {
try {
- Nova novaClient = getNovaClient(cloudSiteId, tenantId);
- novaClient = getNovaClient(cloudSiteId, tenantId);
+ Nova novaClient = client.getNovaClient(cloudSiteId, tenantId);
OpenStackRequest<Flavor> request = novaClient.flavors().show(id);
return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
@@ -132,7 +119,7 @@ public class NovaClientImpl extends MsoCommonUtils {
public HostAggregates queryHostAggregates(String cloudSiteId, String tenantId, int limit, String marker)
throws MsoCloudSiteNotFound, NovaClientException {
try {
- Nova novaClient = getNovaClient(cloudSiteId, tenantId);
+ Nova novaClient = client.getNovaClient(cloudSiteId, tenantId);
OpenStackRequest<HostAggregates> request =
novaClient.aggregates().list().queryParam("limit", limit).queryParam("marker", marker);
return executeAndRecordOpenstackRequest(request, false);
@@ -157,7 +144,7 @@ public class NovaClientImpl extends MsoCommonUtils {
public HostAggregate queryHostAggregateById(String cloudSiteId, String tenantId, String id)
throws MsoCloudSiteNotFound, NovaClientException {
try {
- Nova novaClient = getNovaClient(cloudSiteId, tenantId);
+ Nova novaClient = client.getNovaClient(cloudSiteId, tenantId);
OpenStackRequest<HostAggregate> request = novaClient.aggregates().showAggregate(id);
return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
@@ -181,7 +168,7 @@ public class NovaClientImpl extends MsoCommonUtils {
public QuotaSet queryOSQuotaSet(String cloudSiteId, String tenantId)
throws MsoCloudSiteNotFound, NovaClientException {
try {
- Nova novaClient = getNovaClient(cloudSiteId, tenantId);
+ Nova novaClient = client.getNovaClient(cloudSiteId, tenantId);
OpenStackRequest<QuotaSet> request = novaClient.quotaSets().showQuota(tenantId);
return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
@@ -203,7 +190,7 @@ public class NovaClientImpl extends MsoCommonUtils {
public void deleteKeyPair(String cloudSiteId, String tenantId, String keyPairName)
throws MsoCloudSiteNotFound, NovaClientException {
try {
- Nova novaClient = getNovaClient(cloudSiteId, tenantId);
+ Nova novaClient = client.getNovaClient(cloudSiteId, tenantId);
OpenStackRequest<Void> request = novaClient.keyPairs().delete(keyPairName);
executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
@@ -214,7 +201,7 @@ public class NovaClientImpl extends MsoCommonUtils {
public Server queryServerById(String cloudSiteId, String tenantId, String id) throws NovaClientException {
try {
- Nova novaClient = getNovaClient(cloudSiteId, tenantId);
+ Nova novaClient = client.getNovaClient(cloudSiteId, tenantId);
OpenStackRequest<Server> request = novaClient.servers().show(id);
return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
@@ -224,27 +211,22 @@ public class NovaClientImpl extends MsoCommonUtils {
}
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);
- }
+ throws IOException, MsoException {
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode actualObj = mapper.readTree(request);
+ Entity<JsonNode> openstackEntity = new Entity<>(actualObj, "application/json");
+ CharSequence actionPath = "/servers/" + id + "/action";
+ Nova novaClient = client.getNovaClient(cloudSiteId, tenantId);
+ OpenStackRequest<Void> OSRequest =
+ new OpenStackRequest<>(novaClient, HttpMethod.POST, actionPath, openstackEntity, Void.class);
+ executeAndRecordOpenstackRequest(OSRequest, false);
}
public void attachVolume(String cloudSiteId, String tenantId, String serverId, VolumeAttachment volumeAttachment)
throws NovaClientException {
Nova novaClient;
try {
- novaClient = getNovaClient(cloudSiteId, tenantId);
+ novaClient = client.getNovaClient(cloudSiteId, tenantId);
OpenStackRequest<Void> request = novaClient.servers().attachVolume(serverId, volumeAttachment.getVolumeId(),
volumeAttachment.getDevice());
executeAndRecordOpenstackRequest(request, false);
@@ -258,7 +240,7 @@ public class NovaClientImpl extends MsoCommonUtils {
throws NovaClientException {
Nova novaClient;
try {
- novaClient = getNovaClient(cloudSiteId, tenantId);
+ novaClient = client.getNovaClient(cloudSiteId, tenantId);
OpenStackRequest<Void> request = novaClient.servers().detachVolume(serverId, volumeId);
executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
@@ -270,7 +252,7 @@ public class NovaClientImpl extends MsoCommonUtils {
public Hypervisors getHypervisorDetails(String cloudSiteId, String tenantId) throws NovaClientException {
Nova novaClient;
try {
- novaClient = getNovaClient(cloudSiteId, tenantId);
+ novaClient = client.getNovaClient(cloudSiteId, tenantId);
OpenStackRequest<Hypervisors> request = novaClient.hypervisors().listDetail();
return executeAndRecordOpenstackRequest(request, false);
} catch (MsoException e) {
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyExceptionTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyExceptionTest.java
index d45f685795..1506fda817 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyExceptionTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyExceptionTest.java
@@ -28,6 +28,7 @@ public class MsoCloudifyExceptionTest {
MsoCloudifyException mcl = new MsoCloudifyException(200, "message", "detail", e);
mce.setPendingWorkflow(pendingWorkflow);
assert (mcl.toString() != null);
+ assertNotNull(mce);
}
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTest.java
index 08b2356fdc..25dcae3c2c 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTest.java
@@ -24,6 +24,7 @@ public class MsoCloudifyTest {
MsoBlueprintAlreadyExists mbae = new MsoBlueprintAlreadyExists("blueprintId", "cloud");
MsoCloudifyManagerNotFound mcm = new MsoCloudifyManagerNotFound("cloudSiteId");
MsoDeploymentAlreadyExists mdae = new MsoDeploymentAlreadyExists("deploymentId", "cloud");
+ assertNotNull((mbae));
}
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeoutTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeoutTest.java
index 48c5c877a5..dc74d83d04 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeoutTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeoutTest.java
@@ -27,6 +27,7 @@ public class MsoCloudifyTimeoutTest {
MsoCloudifyTimeout mct = new MsoCloudifyTimeout(execution);
mct.getExecution();
assert (mct.toString() != null);
+ assertNotNull(mct);
}
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/MsoTenantTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/MsoTenantTest.java
index ece5b21f19..3f2a6263d3 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/MsoTenantTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/MsoTenantTest.java
@@ -15,6 +15,7 @@
package org.onap.so.openstack.beans;
+import static org.junit.Assert.*;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
@@ -32,5 +33,6 @@ public class MsoTenantTest {
assert (ms.getMetadata().equals(map));
assert (ms.getTenantId().equals("tenantId"));
assert (ms.getTenantName().equals("tenantName"));
+ assertNotNull(map);
}
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameterTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameterTest.java
index 954f237ffe..de39df7b35 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameterTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameterTest.java
@@ -17,6 +17,7 @@ package org.onap.so.openstack.utils;
import static org.mockito.Mockito.mock;
import org.junit.Test;
+import static org.junit.Assert.*;
public class MsoHeatEnvironmentParameterTest {
@@ -35,6 +36,7 @@ public class MsoHeatEnvironmentParameterTest {
// assertTrue(op.equals(hep));
meo.equals(op);
meo.hashCode();
+ assertNotNull(mea);
}
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVolumeGroupResponse.java
deleted file mode 100644
index a95df93a27..0000000000
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVolumeGroupResponse.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.vnfrest;
-
-
-import java.util.Map;
-import javax.xml.bind.annotation.XmlRootElement;
-import org.onap.so.openstack.beans.VnfStatus;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@XmlRootElement(name = "queryVolumeGroupResponse")
-public class QueryVolumeGroupResponse {
- private static final Logger logger = LoggerFactory.getLogger(QueryVolumeGroupResponse.class);
- private String volumeGroupId;
- private String volumeGroupStackId;
- private VnfStatus volumeGroupStatus;
- private Map<String, String> volumeGroupOutputs;
-
- public QueryVolumeGroupResponse() {}
-
- public QueryVolumeGroupResponse(String volumeGroupId, String volumeGroupStackId, VnfStatus volumeGroupStatus,
- Map<String, String> volumeGroupOutputs) {
- super();
- this.volumeGroupId = volumeGroupId;
- this.volumeGroupStackId = volumeGroupStackId;
- this.volumeGroupStatus = volumeGroupStatus;
- this.volumeGroupOutputs = volumeGroupOutputs;
- }
-
- public String getVolumeGroupId() {
- return volumeGroupId;
- }
-
- public void setVolumeGroupId(String volumeGroupId) {
- this.volumeGroupId = volumeGroupId;
- }
-
- public String getVolumeGroupStackId() {
- return volumeGroupStackId;
- }
-
- public void setVolumeGroupStackId(String volumeGroupStackId) {
- this.volumeGroupStackId = volumeGroupStackId;
- }
-
- public VnfStatus getVolumeGroupStatus() {
- return volumeGroupStatus;
- }
-
- public void setVolumeGroupStatus(VnfStatus volumeGroupStatus) {
- this.volumeGroupStatus = volumeGroupStatus;
- }
-
- public Map<String, String> getVolumeGroupOutputs() {
- return volumeGroupOutputs;
- }
-
- public void setVolumeGroupOutputs(Map<String, String> volumeGroupOutputs) {
- this.volumeGroupOutputs = volumeGroupOutputs;
- }
-
- public String toJsonString() {
- String jsonString = null;
- try {
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
- jsonString = mapper.writeValueAsString(this);
- } catch (Exception e) {
- logger.debug("Exception :", e);
- }
- return jsonString;
- }
-}
diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml
index bcc523ab98..8735f98804 100644
--- a/adapters/mso-catalog-db-adapter/pom.xml
+++ b/adapters/mso-catalog-db-adapter/pom.xml
@@ -44,7 +44,7 @@
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
- <artifactId>fabric8-maven-plugin</artifactId>
+ <artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>
@@ -84,7 +84,31 @@
</plugin>
</plugins>
<pluginManagement>
- <plugins>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <versionRange>[1.0.0,)</versionRange>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
index a98778bf5d..e8e3f34f28 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java
@@ -8,9 +8,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,13 +21,14 @@
package org.onap.so.adapters.catalogdb.catalogrest;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.fasterxml.jackson.databind.ObjectMapper;
public abstract class CatalogQuery {
protected static Logger logger = LoggerFactory.getLogger(CatalogQuery.class);
@@ -103,9 +104,10 @@ public abstract class CatalogQuery {
return false;
}
ObjectMapper mapper = new ObjectMapper();
- mapper.readValue(jsonInString, String.class);
+ mapper.readTree(jsonInString);
return true;
} catch (IOException e) {
+ logger.error("Invalid json: {}", jsonInString);
return false;
}
}
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
index 195ada37f7..d08c2e1444 100644
--- 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
@@ -26,7 +26,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import javax.xml.bind.annotation.XmlRootElement;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
index d6e7415a77..8cd6ada792 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
@@ -23,17 +23,16 @@
package org.onap.so.adapters.catalogdb.catalogrest;
/* should be called QueryVnfResource.java */
-import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
+import org.apache.commons.lang3.StringEscapeUtils;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.fasterxml.jackson.databind.ObjectMapper;
@XmlRootElement(name = "serviceVnfs")
public class QueryServiceVnfs extends CatalogQuery {
@@ -122,7 +121,7 @@ public class QueryServiceVnfs extends CatalogQuery {
put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode());
put(valueMap, "VNFC_INSTANCE_GROUP_ORDER", o.getVnfcInstanceGroupOrder());
put(valueMap, "MULTI_STEP_DESIGN", o.getMultiStageDesign());
- if (isJSONValid(o.getResourceInput())) {
+ if (isJSONValid(StringEscapeUtils.unescapeJava(o.getResourceInput()))) {
put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
index 98abf15645..f283af1ba6 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
@@ -27,6 +27,7 @@ package org.onap.so.adapters.catalogdb.rest;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
@@ -46,8 +47,34 @@ import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceMacroHolder;
import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceNetworks;
import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceVnfs;
import org.onap.so.adapters.catalogdb.catalogrest.QueryVfModule;
-import org.onap.so.db.catalog.beans.*;
-import org.onap.so.db.catalog.data.repository.*;
+import org.onap.so.db.catalog.beans.AllottedResource;
+import org.onap.so.db.catalog.beans.AllottedResourceCustomization;
+import org.onap.so.db.catalog.beans.InstanceGroup;
+import org.onap.so.db.catalog.beans.NetworkResource;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.ProcessingFlags;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ToscaCsar;
+import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfRecipe;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
+import org.onap.so.db.catalog.data.repository.ArRecipeRepository;
+import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
+import org.onap.so.db.catalog.data.repository.NetworkRecipeRepository;
+import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
+import org.onap.so.db.catalog.data.repository.ProcessingFlagsRepository;
+import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.db.catalog.data.repository.ToscaCsarRepository;
+import org.onap.so.db.catalog.data.repository.VFModuleRepository;
+import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.VnfRecipeRepository;
+import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -102,6 +129,9 @@ public class CatalogDbAdapterRest {
@Autowired
private InstanceGroupRepository instanceGroupRepository;
+ @Autowired
+ private ProcessingFlagsRepository processingFlagsRepo;
+
private static final String NO_MATCHING_PARAMETERS = "no matching parameters";
public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) {
@@ -547,4 +577,82 @@ public class CatalogDbAdapterRest {
.entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
}
}
+
+ @GET
+ @Path("processingFlags/{flag}")
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Response getProcessingFlags(@PathParam("flag") String flag) {
+ return getProcessingFlagsImpl(flag);
+ }
+
+ public Response getProcessingFlagsImpl(String flag) {
+ ProcessingFlags processingFlags = null;
+ logger.debug("Flag is: " + flag);
+ int respStatus = HttpStatus.SC_OK;
+ try {
+ processingFlags = processingFlagsRepo.findByFlag(flag);
+ if (processingFlags == null) {
+ logger.debug("ProcessingFlag not found");
+ respStatus = HttpStatus.SC_NOT_FOUND;
+
+ } else {
+
+ logger.debug("ProcessingFlags processingFlags = {}", processingFlags.toString());
+ }
+ return Response.status(respStatus).entity(processingFlags)
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).build();
+ } catch (Exception e) {
+ logger.error("Exception - queryProcesssingFlags", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
+ }
+ }
+
+ @PUT
+ @Path("processingFlags/{flag}")
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ @Transactional
+ public Response updateProcessingFlagsValue(@PathParam("flag") String flag, ProcessingFlags updatedProcessingFlag) {
+ return updateProcessingFlagsValueImpl(flag, updatedProcessingFlag);
+ }
+
+ public Response updateProcessingFlagsValueImpl(String flag, ProcessingFlags updatedProcessingFlag) {
+ ProcessingFlags processingFlags = null;
+ logger.debug("Flag is: " + flag);
+ int respStatus = HttpStatus.SC_OK;
+ try {
+ if (updatedProcessingFlag == null) {
+ logger.debug("No valid updatedProcessingFlag is provided");
+ throw new RuntimeException("No valid updatedProcessingFlag is provided");
+ }
+ String value = updatedProcessingFlag.getValue();
+ if (value == null || (!value.equalsIgnoreCase("YES") && !value.equalsIgnoreCase("NO"))) {
+ logger.debug("Value " + value + " is invalid, only yes/no are allowed");
+ throw new RuntimeException("Invalid value specified");
+ }
+ processingFlags = processingFlagsRepo.findByFlag(flag);
+ if (processingFlags == null) {
+ logger.debug("ProcessingFlag not found");
+ respStatus = HttpStatus.SC_NOT_FOUND;
+ } else {
+ logger.debug("ProcessingFlags processingFlags = {}", processingFlags.toString());
+ processingFlags.setValue(value);
+ processingFlagsRepo.saveAndFlush(processingFlags);
+ return Response.status(respStatus).entity(null)
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).build();
+ }
+ } catch (Exception e) {
+ logger.error("Exception - queryProcesssingFlags", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
+ }
+
+ return Response.status(HttpStatus.SC_NOT_FOUND).header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .build();
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java
index e74663dbba..09c790cc6a 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java
@@ -68,7 +68,7 @@ public class ServiceMapper {
private List<Vnf> mapVnfs(org.onap.so.db.catalog.beans.Service service, int depth) {
List<Vnf> vnfs = new ArrayList<>();
logger.info("Vnf Count : {}", service.getVnfCustomizations().size());
- service.getVnfCustomizations().parallelStream().forEach(vnf -> vnfs.add(mapVnf(vnf, depth)));
+ service.getVnfCustomizations().stream().forEach(vnf -> vnfs.add(mapVnf(vnf, depth)));
return vnfs;
}
@@ -104,7 +104,7 @@ public class ServiceMapper {
private List<VfModule> mapVfModules(VnfResourceCustomization vnfResourceCustomization, int depth) {
List<VfModule> vfModules = new ArrayList<>();
- vnfResourceCustomization.getVfModuleCustomizations().parallelStream()
+ vnfResourceCustomization.getVfModuleCustomizations().stream()
.forEach(vfModule -> vfModules.add(mapVfModule(vfModule, depth)));
return vfModules;
}
@@ -133,8 +133,7 @@ public class ServiceMapper {
private List<Cvnfc> mapCvnfcs(VfModuleCustomization vfModuleCustomization) {
List<Cvnfc> cvnfcs = new ArrayList<>();
- vfModuleCustomization.getCvnfcCustomization().parallelStream()
- .forEach(cvnfcCust -> cvnfcs.add(mapCvnfcCus(cvnfcCust)));
+ vfModuleCustomization.getCvnfcCustomization().stream().forEach(cvnfcCust -> cvnfcs.add(mapCvnfcCus(cvnfcCust)));
return cvnfcs;
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java
index 9202fd21d4..87526f7009 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java
@@ -34,7 +34,6 @@ import javax.ws.rs.core.Response;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
-import org.onap.so.rest.catalog.beans.Service;
import org.onap.so.rest.catalog.beans.Vnf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
index b70d409cd8..a5e546e093 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
@@ -632,7 +632,17 @@ VALUES
('VOLUME_GROUP', 'PENDING', 'DELETE', 'SILENT_SUCCESS'),
('VF_MODULE', 'PENDING', 'DELETE', 'FAIL'),
-('NETWORK', 'PENDING', 'DELETE', 'FAIL');
+('NETWORK', 'PENDING', 'DELETE', 'FAIL'),
+
+('VNF', 'CONFIGURED', 'ACTIVATE', 'CONTINUE'),
+('VNF', 'CONFIGURED', 'UNASSIGN', 'CONTINUE'),
+('VNF', 'CONFIGURED', 'DESACTIVATE', 'SILENT_SUCCESS'),
+
+('VNF', 'CONFIGURE', 'UNASSIGN', 'CONTINUE'),
+('VNF', 'CONFIGURE', 'DESACTIVATE', 'SILENT_SUCCESS'),
+
+('VNF', 'CONFIGASSIGNED', 'UNASSIGN', 'CONTINUE'),
+('VNF', 'CONFIGASSIGNED', 'DESACTIVATE', 'SILENT_SUCCESS');
UPDATE orchestration_flow_reference SET FLOW_NAME = 'HomingBB' WHERE FLOW_NAME = 'SniroHoming';
@@ -807,7 +817,8 @@ VALUES
('CONFIGURATION', 'PENDING CREATE', 'DEACTIVATE', 'FAIL'),
('CONFIGURATION', 'PENDING DELETE', 'DEACTIVATE', 'FAIL'),
('CONFIGURATION', 'PENDING ACTIVATION', 'DEACTIVATE', 'FAIL'),
-('CONFIGURATION', 'PENDING', 'DEACTIVATE', 'FAIL');
+('CONFIGURATION', 'PENDING', 'DEACTIVATE', 'FAIL'),
+('VNF','CONFIGDEPLOYED','ACTIVATE','CONTINUE');
UPDATE orchestration_flow_reference
SET SEQ_NO = SEQ_NO + 2 WHERE COMPOSITE_ACTION = 'Service-Macro-Create' AND SEQ_NO > 12;
@@ -876,7 +887,8 @@ UPDATE northbound_request_ref_lookup SET SERVICE_TYPE = '*' WHERE SERVICE_TYPE I
INSERT INTO building_block_detail(BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACTION)
VALUES
('ConfigAssignVnfBB', 'NO_VALIDATE', 'CUSTOM'),
-('ConfigDeployVnfBB', 'NO_VALIDATE', 'CUSTOM');
+('ConfigDeployVnfBB', 'NO_VALIDATE', 'CUSTOM'),
+('ControllerExecutionBB', 'NO_VALIDATE', 'CUSTOM');
UPDATE rainy_day_handler_macro SET reg_ex_error_message = '*' WHERE reg_ex_error_message IS null;
@@ -896,15 +908,15 @@ WHERE NF_ROLE = 'GR-API-DEFAULT' AND ACTION = 'applyUpdatedConfig';
INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY, SECONDARY_POLICY, REG_EX_ERROR_MESSAGE, SERVICE_ROLE)
VALUES
-('VNFCheckPserversLockedFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFCheckInMaintFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFSetInMaintFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFCheckClosedLoopDisabledFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFSetClosedLoopDisabledFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFLockActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFUpgradePreCheckActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFQuiesceTrafficActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFStopActivity','*','*','*','*','Manual','Abort','*', '*'),
+('VNFCheckPserversLockedFlagActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFCheckInMaintFlagActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFSetInMaintFlagActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFCheckClosedLoopDisabledFlagActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFSetClosedLoopDisabledFlagActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFLockActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFUpgradePreCheckActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFQuiesceTrafficActivity','*','*','*','*','Rollback','Abort','*', '*'),
+('VNFStopActivity','*','*','*','*','Rollback','Abort','*', '*'),
('VNFSnapShotActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFStartActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFUpgradeBackupActivity','*','*','*','*','Manual','Abort','*', '*'),
@@ -913,5 +925,7 @@ VALUES
('VNFResumeTrafficActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFUnlockActivity','*','*','*','*','Manual','Abort','*', '*'),
('SDNOVnfHealthCheckBB','*','*','*','*','Manual','Abort','*', '*'),
+('VNFHealthCheckActivity','*','*','*','*','Manual','Abort','*', '*'),
+('VNFConfigModifyActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFUnsetInMaintFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFUnsetClosedLoopDisabledActivity','*','*','*','*','Manual','Abort','*', '*');
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7.1__Update_Optical_Service_Recipe.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7.1__Update_Optical_Service_Recipe.sql
new file mode 100644
index 0000000000..e97df04ef6
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7.1__Update_Optical_Service_Recipe.sql
@@ -0,0 +1,6 @@
+use catalogdb;
+
+INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `NF_ROLE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (15,NULL,'createInstance',NULL,'2.0','UNI-UNI','OTN UNI-UNI resource create recipe','/mso/async/services/CreateSDNCNetworkResource',NULL,180,'2017-10-05 18:52:03');
+INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `NF_ROLE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (16,NULL,'deleteInstance',NULL,'2.0','UNI-UNI','OTN UNI-UNI resource delete recipe','/mso/async/services/DeleteSDNCNetworkResource',NULL,180,'2017-10-05 18:52:03');
+INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `NF_ROLE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (17,NULL,'createInstance',NULL,'2.0','UNI-ENNI','OTN UNI-ENNI resource create recipe','/mso/async/services/CreateSDNCNetworkResource',NULL,180,'2017-10-05 18:52:03');
+INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `NF_ROLE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (18,NULL,'deleteInstance',NULL,'2.0','UNI-ENNI','OTN UNI-ENNI resource delete recipe','/mso/async/services/DeleteSDNCNetworkResource',NULL,180,'2017-10-05 18:52:03');
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7__AddProcessingFlags.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7__AddProcessingFlags.sql
new file mode 100644
index 0000000000..2686df13a3
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.7__AddProcessingFlags.sql
@@ -0,0 +1,13 @@
+use catalogdb;
+
+CREATE TABLE IF NOT EXISTS `processing_flags` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `FLAG` varchar(200) NOT NULL,
+ `VALUE` varchar(200) NOT NULL,
+ `ENDPOINT` varchar(200) NOT NULL,
+ `DESCRIPTION` longtext NOT NULL,
+ `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(),
+ `UPDATE_TIMESTAMP` timestamp DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ PRIMARY KEY (`ID`),
+ UNIQUE KEY `UK_processing_flags` (`FLAG`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
index 69a23a0eba..04161e9df9 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
@@ -27,6 +27,7 @@ import javax.ws.rs.core.Response;
import org.json.JSONException;
import org.junit.Test;
import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest;
+import org.onap.so.db.catalog.beans.ProcessingFlags;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
@@ -36,6 +37,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.util.UriComponentsBuilder;
+import com.fasterxml.jackson.databind.ObjectMapper;
public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
@@ -55,6 +57,8 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
private static final String ECOMP_MSO_CATALOG_V2_SERVICE_RESOURCES = "ecomp/mso/catalog/v2/serviceResources";
+ private static final String ECOMP_MSO_CATALOG_PROCESSING_FLAGS = "ecomp/mso/catalog/v2/processingFlags";
+
TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
HttpHeaders headers = new HttpHeaders();
@@ -805,6 +809,44 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatusCode().value());
}
+ @Test
+ public void testGetProcessingFlagsByFlag() throws Exception {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_PROCESSING_FLAGS)).pathSegment("TESTFLAG");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ ObjectMapper mapper = new ObjectMapper();
+ ProcessingFlags processingFlagsResponse = mapper.readValue(response.getBody(), ProcessingFlags.class);
+
+ assertEquals(processingFlagsResponse.getFlag(), "TESTFLAG");
+ assertEquals(processingFlagsResponse.getValue(), "NO");
+ assertEquals(processingFlagsResponse.getEndpoint(), "TESTENDPOINT");
+ assertEquals(processingFlagsResponse.getDescription(), "TEST FLAG");
+ }
+
+ @Test
+ public void testSetProcessingFlagsFlagValue() throws JSONException {
+ ProcessingFlags updatedProcessingFlag = new ProcessingFlags();
+ updatedProcessingFlag.setFlag("TESTFLAG");
+ updatedProcessingFlag.setValue("YES");
+ HttpEntity<ProcessingFlags> entity = new HttpEntity<ProcessingFlags>(updatedProcessingFlag, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_PROCESSING_FLAGS)).pathSegment("TESTFLAG");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.PUT, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ }
+
private String createURLWithPort(String uri) {
return "http://localhost:" + port + uri;
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index 03ef24ded0..d6f2c6dbcc 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -43,6 +43,7 @@ import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.PnfResource;
import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.onap.so.db.catalog.beans.ProcessingFlags;
import org.onap.so.db.catalog.beans.ServerType;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
@@ -771,5 +772,12 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
}
+ @Test
+ public void testGetProcessingFlagsFromFlag() {
+ ProcessingFlags processingFlags = client.findProcessingFlagsByFlag("TESTFLAG");
+ assertNotNull(processingFlags);
+ assertEquals(processingFlags.getEndpoint(), "TESTENDPOINT");
+ }
+
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 8fd171bf64..31a4f126e8 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -253,4 +253,8 @@ insert into workflow(artifact_uuid, artifact_name, name, operation_name, version
('5b0c4322-643d-4c9f-b184-4516049e99b1', 'testingWorkflow.bpmn', 'testingWorkflow', 'create', 1, 'Test Workflow', null, 'vnf', 'sdc');
insert into vnf_resource_to_workflow(vnf_resource_model_uuid, workflow_id) values
-('ff2ae348-214a-11e7-93ae-92361f002671', '1'); \ No newline at end of file
+('ff2ae348-214a-11e7-93ae-92361f002671', '1');
+
+insert into processing_flags (flag,value,endpoint,description) values
+('TESTFLAG', 'NO', 'TESTENDPOINT', 'TEST FLAG');
+
diff --git a/adapters/mso-nssmf-adapter/pom.xml b/adapters/mso-nssmf-adapter/pom.xml
index 3e9c2fe6d7..b257adaa96 100644
--- a/adapters/mso-nssmf-adapter/pom.xml
+++ b/adapters/mso-nssmf-adapter/pom.xml
@@ -66,6 +66,24 @@
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
</plugins>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <excludes>
+ <exclude>**/*.p12</exclude>
+ <exclude>**/*.jks</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*.p12</include>
+ <include>**/*.jks</include>
+ </includes>
+ </resource>
+ </resources>
</build>
<dependencies>
<dependency>
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
index 3333c64cd8..61adfcf061 100644
--- 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
@@ -22,8 +22,8 @@ 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.aaiclient.client.aai.AAIProperties;
+import org.onap.aaiclient.client.aai.AAIVersion;
import org.onap.so.spring.SpringContextHelper;
import org.springframework.context.ApplicationContext;
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
index 48e3ef1666..5959b0e6d9 100644
--- 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
@@ -20,7 +20,7 @@
package org.onap.so.adapters.nssmf.extclients.aai;
-import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
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
index f8422e2a8f..8cb47ebf38 100644
--- 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
@@ -23,8 +23,8 @@ 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.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/application-aaf.yaml b/adapters/mso-nssmf-adapter/src/main/resources/application-aaf.yaml
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/resources/application-aaf.yaml
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/application-basic.yaml b/adapters/mso-nssmf-adapter/src/main/resources/application-basic.yaml
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/resources/application-basic.yaml
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/application.yaml b/adapters/mso-nssmf-adapter/src/main/resources/application.yaml
index f8b28efaf8..303d63d4a2 100644
--- a/adapters/mso-nssmf-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-nssmf-adapter/src/main/resources/application.yaml
@@ -44,6 +44,7 @@ spring:
- username: mso_admin
password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
role: ACTUATOR
+
server:
port: 8080
tomcat:
@@ -60,7 +61,14 @@ mso:
#Actuator
management:
- security:
- enabled: false
- basic:
- enabled: false \ No newline at end of file
+ endpoints:
+ web:
+ base-path: /manage
+ exposure:
+ include: "*"
+ metrics:
+ se-global-registry: false
+ export:
+ prometheus:
+ enabled: true # Whether exporting of metrics to Prometheus is enabled.
+ step: 1m # Step size (i.e. reporting frequency) to use.
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/nssmf.jks b/adapters/mso-nssmf-adapter/src/main/resources/nssmf.jks
deleted file mode 100644
index 2ecce5bd3d..0000000000
--- a/adapters/mso-nssmf-adapter/src/main/resources/nssmf.jks
+++ /dev/null
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
deleted file mode 100644
index 25e7fbfca9..0000000000
--- a/adapters/mso-nssmf-adapter/src/main/resources/nssmf.p12
+++ /dev/null
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
deleted file mode 100644
index f7cd9e8f86..0000000000
--- a/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.jks
+++ /dev/null
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
index 1927b1f13f..79631bf344 100644
--- a/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.p12
+++ b/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.p12
Binary files differ
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.trust.jks b/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.trust.jks
new file mode 100644
index 0000000000..6f8168d896
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/resources/org.onap.so.trust.jks
Binary files differ
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index a668b42106..53af40ca4b 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -140,7 +140,7 @@
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
- <artifactId>fabric8-maven-plugin</artifactId>
+ <artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>
@@ -193,6 +193,19 @@
</ignore>
</action>
</pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <versionRange>[1.0.0,)</versionRange>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute />
+ </action>
+ </pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java
index 380f42fa69..2849907e38 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java
@@ -5,12 +5,12 @@ import java.util.Optional;
import org.onap.aai.domain.yang.CloudRegion;
import org.onap.aai.domain.yang.Complex;
import org.onap.aai.domain.yang.NetworkTechnologies;
-import org.onap.so.client.aai.AAIObjectPlurals;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.AAIObjectPlurals;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.NetworkTechnologyReference;
import org.onap.so.db.catalog.client.CatalogDbClient;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java
new file mode 100644
index 0000000000..15c5eda054
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.inventory.delete;
+
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.so.cloud.CloudConfig;
+import org.onap.so.cloud.resource.beans.CloudInformation;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.heatbridge.HeatBridgeApi;
+import org.onap.so.heatbridge.HeatBridgeImpl;
+import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+public class DeleteAAIInventory {
+
+ private static final Logger logger = LoggerFactory.getLogger(DeleteAAIInventory.class);
+
+ private AAIResourcesClient aaiClient;
+
+ @Autowired
+ protected CloudConfig cloudConfig;
+
+ @Autowired
+ protected Environment env;
+
+ public void heatbridge(CloudInformation cloudInformation, boolean dryrun) {
+ try {
+ if (!dryrun) {
+ logger.debug("Heatbridge delete executing");
+
+ CloudSite cloudSite = cloudConfig.getCloudSite(cloudInformation.getRegionId())
+ .orElseThrow(() -> new MsoCloudSiteNotFound(cloudInformation.getRegionId()));
+ CloudIdentity cloudIdentity = cloudSite.getIdentityService();
+ HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity,
+ cloudInformation.getOwner(), cloudInformation.getRegionId(), cloudSite.getRegionId(),
+ cloudInformation.getTenantId());
+ heatBridgeClient.authenticate();
+ heatBridgeClient.deleteVfModuleData(cloudInformation.getVnfId(), cloudInformation.getVfModuleId());
+ }
+ } catch (Exception ex) {
+ logger.debug("Heatbrige failed for stackId: " + cloudInformation.getTemplateInstanceId(), ex);
+ }
+ }
+
+ protected AAIResourcesClient getAaiClient() {
+ if (aaiClient == null)
+ return new AAIResourcesClient();
+ else
+ return aaiClient;
+ }
+
+ protected void setAaiClient(AAIResourcesClient aaiResource) {
+ aaiClient = aaiResource;
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryService.java
new file mode 100644
index 0000000000..b104c3310c
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryService.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.inventory.delete;
+
+import javax.annotation.PostConstruct;
+import org.camunda.bpm.client.ExternalTaskClient;
+import org.onap.so.utils.ExternalTaskServiceUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Profile;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+@Profile("!test")
+public class DeleteInventoryService {
+
+ @Autowired
+ public Environment env;
+
+ @Autowired
+ private DeleteInventoryTask deleteInventory;
+
+ @Autowired
+ private ExternalTaskServiceUtils externalTaskServiceUtils;
+
+ @PostConstruct
+ public void auditAAIInventory() throws Exception {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
+ client.subscribe("InventoryDelete")
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .handler(deleteInventory::executeExternalTask).open();
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryTask.java
new file mode 100644
index 0000000000..c5feee2089
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryTask.java
@@ -0,0 +1,106 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ *
+ * Copyright (C) 2019 IBM
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.inventory.delete;
+
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.cloud.resource.beans.CloudInformation;
+import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.utils.ExternalTaskUtils;
+import org.onap.so.utils.RetrySequenceLevel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class DeleteInventoryTask extends ExternalTaskUtils {
+
+ private static final String UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI = "Unable to write all inventory to A&AI";
+
+ private static final Logger logger = LoggerFactory.getLogger(DeleteInventoryTask.class);
+
+ private static final String AAI_INVENTORY_FAILURE = "AAIInventoryFailure";
+
+ @Autowired
+ private DeleteAAIInventory deleteInventory;
+
+ @Autowired
+ private Environment env;
+
+ @Autowired
+ private AuditMDCSetup mdcSetup;
+
+ public DeleteInventoryTask() {
+ super(RetrySequenceLevel.SHORT);
+ }
+
+ protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ mdcSetup.setupMDC(externalTask);
+ boolean inventoryException = false;
+ String externalTaskId = externalTask.getId();
+ CloudInformation cloudInformation = externalTask.getVariable("cloudInformation");
+ boolean success = true;
+ if (cloudInformation != null) {
+ Integer retryCount = externalTask.getRetries();
+ try {
+ deleteInventory.heatbridge(cloudInformation, env.getProperty("heatBridgeDryrun", Boolean.class, true));
+ } catch (Exception e) {
+ logger.error("Error during inventory of stack", e);
+ success = false;
+ }
+ mdcSetup.setElapsedTime();
+ if (success) {
+ externalTaskService.complete(externalTask);
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
+ logger.debug("The External Task Id: {} Successful", externalTaskId);
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ mdcSetup.clearClientMDCs();
+ } else {
+ if (retryCount == null) {
+ logger.error("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
+ externalTaskId, getRetrySequence().length);
+ externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI,
+ UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, getRetrySequence().length, 10000);
+ } else if (retryCount != null && retryCount - 1 == 0) {
+ externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
+ logger.error("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId);
+ logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ } else {
+ logger.error("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
+ externalTaskId, retryCount - 1, calculateRetryDelay(retryCount));
+ externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI,
+ UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, retryCount - 1, calculateRetryDelay(retryCount));
+ }
+ logger.error("The External Task Id: {} Failed", externalTaskId);
+ }
+ } else {
+ logger.error("The External Task Id: {} Failed, No Cloud Information Provided", externalTaskId);
+ externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
+ }
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java
index 302a6d302b..010d91fec9 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java
@@ -191,13 +191,16 @@ public interface MsoNetworkAdapter {
@WebParam(name = "modelCustomizationUuid") String modelCustomizationUuid,
@WebParam(name = "networkId") @XmlElement(required = true) String networkId,
@WebParam(name = "request") MsoRequest msoRequest,
- @WebParam(name = "networkDeleted", mode = Mode.OUT) Holder<Boolean> networkDeleted) throws NetworkException;
+ @WebParam(name = "networkDeleted", mode = Mode.OUT) Holder<Boolean> networkDeleted,
+ @WebParam(name = "pollForCompletion") @XmlElement(required = false) Boolean pollForCompletion)
+ throws NetworkException;
/**
* This is the "Rollback Network" Web Service endpoint definition.
*/
@WebMethod
- public void rollbackNetwork(@WebParam(name = "rollback") @XmlElement(required = true) NetworkRollback rollback)
+ public void rollbackNetwork(@WebParam(name = "rollback") @XmlElement(required = true) NetworkRollback rollback,
+ @WebParam(name = "pollForCompletion") @XmlElement(required = false) Boolean pollForCompletion)
throws NetworkException;
@WebMethod
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java
deleted file mode 100644
index 5b7340e24f..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network;
-
-
-import java.util.List;
-import java.util.Map;
-import javax.jws.Oneway;
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebService;
-import javax.xml.bind.annotation.XmlElement;
-import org.onap.so.entity.MsoRequest;
-import org.onap.so.openstack.beans.NetworkRollback;
-import org.onap.so.openstack.beans.Subnet;
-
-/**
- * This webservice defines the Asynchronous versions of NETWORK adapter calls. The notification messages for final
- * responses are documented elsewhere (by the client service WSDL).
- *
- */
-@WebService(name = "NetworkAdapterAsync", targetNamespace = "http://org.onap.so/networkA")
-public interface MsoNetworkAdapterAsync {
- /**
- * This is the "Create NETWORK" Web Service Endpoint definition.
- */
- @WebMethod
- @Oneway
- public void createNetworkA(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
- @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
- @WebParam(name = "networkType") @XmlElement(required = true) String networkType,
- @WebParam(name = "modelCustomizationUuid") String modelCustomizationUuid,
- @WebParam(name = "networkName") @XmlElement(required = true) String networkName,
- @WebParam(name = "physicalNetworkName") String physicalNetworkName,
- @WebParam(name = "vlans") List<Integer> vlans, @WebParam(name = "failIfExists") Boolean failIfExists,
- @WebParam(name = "backout") Boolean backout, @WebParam(name = "subnets") List<Subnet> subnets,
- @WebParam(name = "networkParams") Map<String, String> networkParams,
- @WebParam(name = "messageId") @XmlElement(required = true) String messageId,
- @WebParam(name = "request") MsoRequest msoRequest,
- @WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl);
-
- @WebMethod
- @Oneway
- public void updateNetworkA(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
- @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
- @WebParam(name = "networkType") @XmlElement(required = true) String networkType,
- @WebParam(name = "modelCustomizationUuid") String modelCustomizationUuid,
- @WebParam(name = "networkId") @XmlElement(required = true) String networkId,
- @WebParam(name = "networkName") @XmlElement(required = true) String networkName,
- @WebParam(name = "physicalNetworkName") @XmlElement(required = true) String physicalNetworkName,
- @WebParam(name = "vlans") @XmlElement(required = true) List<Integer> vlans,
- @WebParam(name = "subnets") List<Subnet> subnets,
- @WebParam(name = "networkParams") Map<String, String> networkParams,
- @WebParam(name = "messageId") @XmlElement(required = true) String messageId,
- @WebParam(name = "request") MsoRequest msoRequest,
- @WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl);
-
- @WebMethod
- @Oneway
- public void queryNetworkA(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
- @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
- @WebParam(name = "networkNameOrId") @XmlElement(required = true) String networkNameOrId,
- @WebParam(name = "messageId") @XmlElement(required = true) String messageId,
- @WebParam(name = "request") MsoRequest msoRequest,
- @WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl);
-
- @WebMethod
- @Oneway
- public void deleteNetworkA(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
- @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
- @WebParam(name = "networkType") @XmlElement(required = true) String networkType,
- @WebParam(name = "modelCustomizationUuid") String modelCustomizationUuid,
- @WebParam(name = "networkId") @XmlElement(required = true) String networkId,
- @WebParam(name = "messageId") @XmlElement(required = true) String messageId,
- @WebParam(name = "request") MsoRequest msoRequest,
- @WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl);
-
- @WebMethod
- @Oneway
- public void rollbackNetworkA(@WebParam(name = "rollback") @XmlElement(required = true) NetworkRollback rollback,
- @WebParam(name = "messageId") @XmlElement(required = true) String messageId,
- @WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl);
-
- @WebMethod
- public void healthCheckA();
-}
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
deleted file mode 100644
index 8d75212f4e..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
+++ /dev/null
@@ -1,605 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Modifications Copyright (C) 2018 IBM.
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.network;
-
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.security.GeneralSecurityException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.jws.WebService;
-import javax.xml.bind.DatatypeConverter;
-import javax.xml.namespace.QName;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Holder;
-import javax.xml.ws.handler.MessageContext;
-import org.onap.so.adapters.network.async.client.CreateNetworkNotification;
-import org.onap.so.adapters.network.async.client.MsoExceptionCategory;
-import org.onap.so.adapters.network.async.client.NetworkAdapterNotify;
-import org.onap.so.adapters.network.async.client.NetworkAdapterNotify_Service;
-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.logging.filter.base.ErrorCode;
-import org.onap.so.logger.LoggingAnchor;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.openstack.beans.NetworkRollback;
-import org.onap.so.openstack.beans.NetworkStatus;
-import org.onap.so.openstack.beans.Subnet;
-import org.onap.so.utils.CryptoUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-
-@Component
-@WebService(serviceName = "NetworkAdapterAsync",
- endpointInterface = "org.onap.so.adapters.network.MsoNetworkAdapterAsync",
- targetNamespace = "http://org.onap.so/networkA")
-public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
-
- private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterAsyncImpl.class);
-
- private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.network.bpelauth";
- private static final String ENCRYPTION_KEY_PROP = "mso.msoKey";
- private static final String NETWORK_EXCEPTION_MSG = "Got a NetworkException on createNetwork: ";
- private static final String CREATE_NETWORK_ERROR_LOGMSG = "{} {} Error sending createNetwork notification {} ";
- private static final String FAULT_INFO_ERROR_LOGMSG = "{} {} Exception - fault info ";
- private static final String SHARED = "shared";
- private static final String EXTERNAL = "external";
-
- @Autowired
- private Environment environment;
-
- @Autowired
- private MsoNetworkAdapter networkAdapter;
-
- /**
- * Health Check web method. Does nothing but return to show the adapter is deployed.
- */
- @Override
- public void healthCheckA() {
- logger.debug("Health check call in Network Adapter");
- }
-
- /**
- * This is the "Create Network" web service implementation. It will create a new Network of the requested type in
- * the specified cloud and tenant. The tenant must exist at the time this service is called.
- *
- * If a network with the same name already exists, this can be considered a success or failure, depending on the
- * value of the 'failIfExists' parameter.
- *
- * There will be a pre-defined set of network types defined in the MSO Catalog. All such networks will have a
- * similar configuration, based on the allowable Openstack networking definitions. This includes basic networks,
- * provider networks (with a single VLAN), and multi-provider networks (one or more VLANs)
- *
- * Initially, all provider networks must be "vlan" type, and multiple segments in a multi-provider network must be
- * multiple VLANs on the same physical network.
- *
- * This service supports two modes of Network creation/update: - via Heat Templates - via Neutron API The network
- * orchestration mode for each network type is declared in its catalog definition. All Heat-based templates must
- * support some subset of the same input parameters: network_name, physical_network, vlan(s).
- *
- * The method returns the network ID and a NetworkRollback object. This latter object can be passed as-is to the
- * rollbackNetwork operation to undo everything that was created. This is useful if a network is successfully
- * created but the orchestration fails on a subsequent operation.
- */
- @Override
- public void createNetworkA(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid,
- String networkName, String physicalNetworkName, List<Integer> vlans, Boolean failIfExists, Boolean backout,
- List<Subnet> subnets, Map<String, String> networkParams, String messageId, MsoRequest msoRequest,
- String notificationUrl) {
-
- logger.debug("Async Create Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId);
-
- // Use the synchronous method to perform the actual Create
-
-
- // Synchronous Web Service Outputs
- Holder<String> networkId = new Holder<>();
- Holder<String> neutronNetworkId = new Holder<>();
- Holder<NetworkRollback> networkRollback = new Holder<>();
- Holder<Map<String, String>> subnetIdMap = new Holder<>();
-
- HashMap<String, String> params = (HashMap<String, String>) networkParams;
- if (params == null)
- params = new HashMap<>();
- String shared = null;
- String external = null;
- if (params.containsKey(SHARED))
- shared = params.get(SHARED);
- if (params.containsKey(EXTERNAL))
- external = params.get(EXTERNAL);
-
- try {
- networkAdapter.createNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkName,
- physicalNetworkName, vlans, shared, external, failIfExists, backout, subnets, params, msoRequest,
- networkId, neutronNetworkId, subnetIdMap, networkRollback);
- } catch (NetworkException e) {
- logger.debug(NETWORK_EXCEPTION_MSG, e);
- MsoExceptionCategory exCat = null;
- String eMsg = null;
- try {
- eMsg = e.getFaultInfo().getMessage();
- exCat = MsoExceptionCategory.fromValue(e.getFaultInfo().getCategory().name());
- } catch (Exception e1) {
- logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, ErrorCode.DataError.getValue(),
- e1);
- }
- // Build and send Asynchronous error response
- try {
- NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.createNetworkNotification(messageId, false, exCat, eMsg, null, null, null, null);
- } catch (Exception e1) {
- logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- ErrorCode.DataError.getValue(), e1.getMessage(), e1);
-
- }
- return;
- }
- logger.debug("Async Create Network:Name {} physicalNetworkName:{}", networkName, physicalNetworkName);
- // Build and send Asynchronous response
- try {
- NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.createNetworkNotification(messageId, true, null, null, networkId.value, neutronNetworkId.value,
- copyCreateSubnetIdMap(subnetIdMap), copyNrb(networkRollback));
- } catch (Exception e) {
- logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- ErrorCode.DataError.getValue(), e.getMessage(), e);
-
- }
- return;
- }
-
- /**
- * This is the "Update Network" web service implementation. It will update an existing Network of the requested type
- * in the specified cloud and tenant. The typical use will be to replace the VLANs with the supplied list (to add or
- * remove a VLAN), but other properties may be updated as well.
- *
- * There will be a pre-defined set of network types defined in the MSO Catalog. All such networks will have a
- * similar configuration, based on the allowable Openstack networking definitions. This includes basic networks,
- * provider networks (with a single VLAN), and multi-provider networks (one or more VLANs).
- *
- * Initially, all provider networks must currently be "vlan" type, and multi-provider networks must be multiple
- * VLANs on the same physical network.
- *
- * This service supports two modes of Network update: - via Heat Templates - via Neutron API The network
- * orchestration mode for each network type is declared in its catalog definition. All Heat-based templates must
- * support some subset of the same input parameters: network_name, physical_network, vlan, segments.
- *
- * The method returns a NetworkRollback object. This object can be passed as-is to the rollbackNetwork operation to
- * undo everything that was updated. This is useful if a network is successfully updated but orchestration fails on
- * a subsequent operation.
- */
- @Override
- public void updateNetworkA(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid,
- String networkId, String networkName, String physicalNetworkName, List<Integer> vlans, List<Subnet> subnets,
- Map<String, String> networkParams, String messageId, MsoRequest msoRequest, String notificationUrl) {
-
- logger.debug("Async Update Network: {} of type {} in {}/{}", networkId, networkType, cloudSiteId, tenantId);
-
- // Use the synchronous method to perform the actual Create
-
-
- // Synchronous Web Service Outputs
- Holder<NetworkRollback> networkRollback = new Holder<>();
- Holder<Map<String, String>> subnetIdMap = new Holder<>();
-
- HashMap<String, String> params = (HashMap<String, String>) networkParams;
- if (params == null)
- params = new HashMap<>();
- String shared = null;
- String external = null;
- if (params.containsKey(SHARED))
- shared = params.get(SHARED);
- if (params.containsKey(EXTERNAL))
- external = params.get(EXTERNAL);
-
- try {
- networkAdapter.updateNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId,
- networkName, physicalNetworkName, vlans, shared, external, subnets, params, msoRequest, subnetIdMap,
- networkRollback);
- } catch (NetworkException e) {
- logger.debug("Got a NetworkException on updateNetwork: ", e);
- MsoExceptionCategory exCat = null;
- String eMsg = null;
- try {
- eMsg = e.getFaultInfo().getMessage();
- exCat = MsoExceptionCategory.fromValue(e.getFaultInfo().getCategory().name());
- } catch (Exception e1) {
- logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, ErrorCode.DataError.getValue(),
- e1);
- }
- // Build and send Asynchronous error response
- try {
- NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.updateNetworkNotification(messageId, false, exCat, eMsg, null, copyNrb(networkRollback));
- } catch (Exception e1) {
- logger.error("{} {} Error sending updateNetwork notification {} ",
- MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, ErrorCode.DataError.getValue(), e1.getMessage(), e1);
-
- }
- return;
- }
- logger.debug("Async Update Network:Name {} NetworkId:{}", networkName, networkId);
- // Build and send Asynchronous response
- try {
- NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.updateNetworkNotification(messageId, true, null, null, copyUpdateSubnetIdMap(subnetIdMap),
- copyNrb(networkRollback));
- } catch (Exception e) {
- logger.error("{} {} Error sending updateNotification request {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- ErrorCode.DataError.getValue(), e.getMessage(), e);
- }
- return;
- }
-
- /**
- * This is the queryNetwork method. It returns the existence and status of the specified network, along with its
- * Neutron UUID and list of VLANs. This method attempts to find the network using both Heat and Neutron. Heat stacks
- * are first searched based on the provided network name/id. If none is found, the Neutron is directly queried.
- */
- @Override
- public void queryNetworkA(String cloudSiteId, String tenantId, String networkNameOrId, String messageId,
- MsoRequest msoRequest, String notificationUrl) {
-
- logger.debug("Async Query Network {} in {}/{}", networkNameOrId, cloudSiteId, tenantId);
- String errorCreateNetworkMessage = CREATE_NETWORK_ERROR_LOGMSG;
-
- // Use the synchronous method to perform the actual Create
-
-
- // Synchronous Web Service Outputs
- Holder<Boolean> networkExists = new Holder<>();
- Holder<String> networkId = new Holder<>();
- Holder<String> neutronNetworkId = new Holder<>();
- Holder<NetworkStatus> status = new Holder<>();
- Holder<List<Integer>> vlans = new Holder<>();
- Holder<Map<String, String>> subnetIdMap = new Holder<>();
-
- try {
- networkAdapter.queryNetwork(cloudSiteId, tenantId, networkNameOrId, msoRequest, networkExists, networkId,
- neutronNetworkId, status, vlans, subnetIdMap);
- } catch (NetworkException e) {
- logger.debug(NETWORK_EXCEPTION_MSG, e);
- MsoExceptionCategory exCat = null;
- String eMsg = null;
- try {
- eMsg = e.getFaultInfo().getMessage();
- exCat = MsoExceptionCategory.fromValue(e.getFaultInfo().getCategory().name());
- } catch (Exception e1) {
- logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, ErrorCode.DataError.getValue(),
- e1);
- }
- // Build and send Asynchronous error response
- try {
- NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.queryNetworkNotification(messageId, false, exCat, eMsg, null, null, null, null, null, null);
- } catch (Exception e1) {
- logger.error(errorCreateNetworkMessage, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- ErrorCode.DataError.getValue(), e1.getMessage(), e1);
- }
- return;
- }
- logger.debug("Async Query Network:NameOrId {} tenantId:{}", networkNameOrId, tenantId);
- // Build and send Asynchronous response
- try {
- NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- org.onap.so.adapters.network.async.client.NetworkStatus networkS =
- org.onap.so.adapters.network.async.client.NetworkStatus.fromValue(status.value.name());
- notifyPort.queryNetworkNotification(messageId, true, null, null, networkExists.value, networkId.value,
- neutronNetworkId.value, networkS, vlans.value, copyQuerySubnetIdMap(subnetIdMap));
- } catch (Exception e) {
- logger.error(errorCreateNetworkMessage, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- ErrorCode.DataError.getValue(), e.getMessage(), e);
- }
- return;
- }
-
- /**
- * This is the "Delete Network" web service implementation. It will delete a Network in the specified cloud and
- * tenant.
- *
- * If the network is not found, it is treated as a success.
- *
- * This service supports two modes of Network creation/update/delete: - via Heat Templates - via Neutron API The
- * network orchestration mode for each network type is declared in its catalog definition.
- *
- * For Heat-based orchestration, the networkId should be the stack ID. For Neutron-based orchestration, the
- * networkId should be the Neutron network UUID.
- *
- * The method returns nothing on success. Rollback is not possible for delete commands, so any failure on delete
- * will require manual fallout in the client.
- */
- @Override
- public void deleteNetworkA(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid,
- String networkId, String messageId, MsoRequest msoRequest, String notificationUrl) {
-
- String serviceName = "DeleteNetworkA";
- logger.debug("Async Delete Network {} in {}/{}", networkId, cloudSiteId, tenantId);
-
- // Use the synchronous method to perform the actual Create
-
-
- // Synchronous Web Service Outputs
- Holder<Boolean> networkDeleted = new Holder<>();
-
- try {
- networkAdapter.deleteNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId,
- msoRequest, networkDeleted);
- } catch (NetworkException e) {
- logger.debug(NETWORK_EXCEPTION_MSG, e);
- MsoExceptionCategory exCat = null;
- String eMsg = null;
- try {
- eMsg = e.getFaultInfo().getMessage();
- exCat = MsoExceptionCategory.fromValue(e.getFaultInfo().getCategory().name());
- } catch (Exception e1) {
- logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, ErrorCode.DataError.getValue(),
- e1);
- }
- // Build and send Asynchronous error response
- try {
- NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.deleteNetworkNotification(messageId, false, exCat, eMsg, null);
- } catch (Exception e1) {
- logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- ErrorCode.DataError.getValue(), e1.getMessage(), e1);
-
- }
- return;
- }
- logger.debug("Async Delete NetworkId: {} tenantId:{}", networkId, tenantId);
- // Build and send Asynchronous response
- try {
- NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.deleteNetworkNotification(messageId, true, null, null, networkDeleted.value);
- } catch (Exception e) {
- logger.error("{} {} Error sending deleteNetwork notification {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- ErrorCode.DataError.getValue(), e.getMessage(), e);
-
- }
- return;
- }
-
- /**
- * This web service endpoint will rollback a previous Create VNF operation. A rollback object is returned to the
- * client in a successful creation response. The client can pass that object as-is back to the rollbackNetwork
- * operation to undo the creation.
- *
- * The rollback includes removing the VNF and deleting the tenant if the tenant did not exist prior to the VNF
- * creation.
- */
- @Override
- public void rollbackNetworkA(NetworkRollback rollback, String messageId, String notificationUrl) {
- // rollback may be null (e.g. if network already existed when Create was called)
- if (rollback == null) {
- logger.warn("{} {} Rollback is null", MessageEnum.RA_ROLLBACK_NULL, ErrorCode.SchemaError.getValue());
- return;
- }
-
- logger.info(LoggingAnchor.TWO, MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId());
- // Use the synchronous method to perform the actual Create
-
-
- try {
- networkAdapter.rollbackNetwork(rollback);
- } catch (NetworkException e) {
- logger.debug("Got a NetworkException on rollbackNetwork: ", e);
- // Build and send Asynchronous error response
- MsoExceptionCategory exCat = null;
- String eMsg = null;
- try {
- eMsg = e.getFaultInfo().getMessage();
- exCat = MsoExceptionCategory.fromValue(e.getFaultInfo().getCategory().name());
- } catch (Exception e1) {
- logger.error("{} {} Exception in get fault info ", MessageEnum.RA_FAULT_INFO_EXC,
- ErrorCode.DataError.getValue(), e1);
- }
- // Build and send Asynchronous error response
- try {
- NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.rollbackNetworkNotification(rollback.getMsoRequest().getRequestId(), false, exCat, eMsg);
- } catch (Exception e1) {
- logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC,
- ErrorCode.DataError.getValue(), e1.getMessage(), e1);
-
- }
- return;
- }
- logger.debug("Async Rollback NetworkId: {} tenantId:{}", rollback.getNetworkStackId(), rollback.getTenantId());
- // Build and send Asynchronous response
- try {
- NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.rollbackNetworkNotification(rollback.getMsoRequest().getRequestId(), true, null, null);
- } catch (Exception e) {
- logger.error("{} {} Error sending rollbackNetwork notification {} ",
- MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, ErrorCode.DataError.getValue(), e.getMessage(), e);
-
- }
- return;
- }
-
- private org.onap.so.adapters.network.async.client.NetworkRollback copyNrb(Holder<NetworkRollback> hNrb) {
- org.onap.so.adapters.network.async.client.NetworkRollback cnrb =
- new org.onap.so.adapters.network.async.client.NetworkRollback();
-
- if (hNrb != null && hNrb.value != null) {
- org.onap.so.adapters.network.async.client.MsoRequest cmr =
- new org.onap.so.adapters.network.async.client.MsoRequest();
-
- cnrb.setCloudId(hNrb.value.getCloudId());
- cmr.setRequestId(hNrb.value.getMsoRequest().getRequestId());
- cmr.setServiceInstanceId(hNrb.value.getMsoRequest().getServiceInstanceId());
- cnrb.setMsoRequest(cmr);
- cnrb.setNetworkId(hNrb.value.getNetworkId());
- cnrb.setNetworkStackId(hNrb.value.getNetworkStackId());
- cnrb.setNeutronNetworkId(hNrb.value.getNeutronNetworkId());
- cnrb.setTenantId(hNrb.value.getTenantId());
- cnrb.setNetworkType(hNrb.value.getNetworkType());
- cnrb.setNetworkCreated(hNrb.value.getNetworkCreated());
- cnrb.setNetworkName(hNrb.value.getNetworkName());
- cnrb.setPhysicalNetwork(hNrb.value.getPhysicalNetwork());
- List<Integer> vlansc = cnrb.getVlans();
- List<Integer> vlansh = hNrb.value.getVlans();
- if (vlansh != null) {
- vlansc.addAll(vlansh);
- }
- }
- return cnrb;
- }
-
- private NetworkAdapterNotify getNotifyEP(String notificationUrl) {
-
- URL warWsdlLoc = null;
- try {
- warWsdlLoc = Thread.currentThread().getContextClassLoader().getResource("NetworkAdapterNotify.wsdl");
- } catch (Exception e) {
- logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND,
- ErrorCode.DataError.getValue(), e);
- }
- if (warWsdlLoc == null) {
- logger.error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND, ErrorCode.DataError.getValue());
- } else {
- try {
- logger.debug("NetworkAdpaterNotify.wsdl location: {}", warWsdlLoc.toURI().toString());
- } catch (Exception e) {
- logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC,
- ErrorCode.SchemaError.getValue(), e);
- }
- }
-
- NetworkAdapterNotify_Service notifySvc = new NetworkAdapterNotify_Service(warWsdlLoc,
- new QName("http://org.onap.so/networkNotify", "networkAdapterNotify"));
-
- NetworkAdapterNotify notifyPort = notifySvc.getMsoNetworkAdapterAsyncImplPort();
-
- BindingProvider bp = (BindingProvider) notifyPort;
-
- URL epUrl = null;
- try {
- epUrl = new URL(notificationUrl);
- } catch (MalformedURLException e1) {
- logger.error("{} {} Exception - init notification ", MessageEnum.RA_INIT_NOTIF_EXC,
- ErrorCode.DataError.getValue(), e1);
- }
-
- if (null != epUrl) {
- logger.debug("Notification Endpoint URL: {}", epUrl.toExternalForm());
- bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm());
- } else {
- logger.debug("Notification Endpoint URL is NULL: ");
- }
-
- // authentication
- try {
- Map<String, Object> reqCtx = bp.getRequestContext();
- Map<String, List<String>> headers = new HashMap<>();
-
- String userCredentials = this.getEncryptedProperty(BPEL_AUTH_PROP, "", ENCRYPTION_KEY_PROP);
-
- String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes());
- reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
- headers.put("Authorization", Collections.singletonList(basicAuth));
- } catch (Exception e) {
- logger.error("{} {} Unable to set authorization in callback request {} ",
- MessageEnum.RA_SET_CALLBACK_AUTH_EXC, ErrorCode.DataError.getValue(), e.getMessage(), e);
- }
-
- return notifyPort;
- }
-
- public String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
- try {
- return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey));
- } catch (GeneralSecurityException e) {
- logger.debug("Exception while decrypting property: {} ", this.environment.getProperty(key), e);
- }
- return defaultValue;
-
- }
-
- private CreateNetworkNotification.SubnetIdMap copyCreateSubnetIdMap(Holder<Map<String, String>> hMap) {
-
- CreateNetworkNotification.SubnetIdMap subnetIdMap = new CreateNetworkNotification.SubnetIdMap();
-
- if (hMap != null && hMap.value != null) {
- Map<String, String> sMap = hMap.value;
- CreateNetworkNotification.SubnetIdMap.Entry entry = new CreateNetworkNotification.SubnetIdMap.Entry();
-
- for (Map.Entry<String, String> mapEntry : sMap.entrySet()) {
- String key = mapEntry.getKey();
- String value = mapEntry.getValue();
- entry.setKey(key);
- entry.setValue(value);
- subnetIdMap.getEntry().add(entry);
- }
- }
- return subnetIdMap;
- }
-
- private UpdateNetworkNotification.SubnetIdMap copyUpdateSubnetIdMap(Holder<Map<String, String>> hMap) {
-
- UpdateNetworkNotification.SubnetIdMap subnetIdMap = new UpdateNetworkNotification.SubnetIdMap();
-
- if (hMap != null && hMap.value != null) {
- Map<String, String> sMap = hMap.value;
- UpdateNetworkNotification.SubnetIdMap.Entry entry = new UpdateNetworkNotification.SubnetIdMap.Entry();
-
- for (Map.Entry<String, String> mapEntry : sMap.entrySet()) {
- String key = mapEntry.getKey();
- String value = mapEntry.getValue();
- entry.setKey(key);
- entry.setValue(value);
- subnetIdMap.getEntry().add(entry);
- }
- }
- return subnetIdMap;
- }
-
- private QueryNetworkNotification.SubnetIdMap copyQuerySubnetIdMap(Holder<Map<String, String>> hMap) {
-
- QueryNetworkNotification.SubnetIdMap subnetIdMap = new QueryNetworkNotification.SubnetIdMap();
-
- if (hMap != null && hMap.value != null) {
- Map<String, String> sMap = hMap.value;
- QueryNetworkNotification.SubnetIdMap.Entry entry = new QueryNetworkNotification.SubnetIdMap.Entry();
-
- for (Map.Entry<String, String> mapEntry : sMap.entrySet()) {
- String key = mapEntry.getKey();
- String value = mapEntry.getValue();
- entry.setKey(key);
- entry.setValue(value);
- subnetIdMap.getEntry().add(entry);
- }
- }
- return subnetIdMap;
- }
-}
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 4728effdca..489585c04b 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
@@ -81,8 +81,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
targetNamespace = "http://org.onap.so/network")
public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
- private static final String AIC3_NW_PROPERTY = "org.onap.so.adapters.network.aic3nw";
- private static final String AIC3_NW = "OS::ContrailV2::VirtualNetwork";
+ private static final String OS3_NW_PROPERTY = "org.onap.so.adapters.network.aic3nw";
+ private static final String OS3_NW = "OS::ContrailV2::VirtualNetwork";
private static final String VLANS = "vlans";
private static final String PHYSICAL_NETWORK = "physical_network";
private static final String UPDATE_NETWORK_CONTEXT = "UpdateNetwork";
@@ -140,6 +140,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
* @see MsoNetworkAdapterImpl#MsoNetworkAdapterImpl(MsoPropertiesFactory)
*/
+ @Deprecated
@Override
public void createNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid,
String networkName, String physicalNetworkName, List<Integer> vlans, String shared, String external,
@@ -149,9 +150,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Holder<String> networkFqdn = new Holder<>();
createNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkName, physicalNetworkName,
vlans, null, shared, external, failIfExists, backout, subnets, null, null, msoRequest, networkId,
- neutronNetworkId, networkFqdn, subnetIdMap, rollback);
+ neutronNetworkId, networkFqdn, subnetIdMap, rollback, true);
}
+ @Deprecated
@Override
public void createNetworkContrail(String cloudSiteId, String tenantId, String networkType,
String modelCustomizationUuid, String networkName, List<RouteTarget> routeTargets, String shared,
@@ -162,7 +164,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
throws NetworkException {
createNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkName, null, null, routeTargets,
shared, external, failIfExists, backout, subnets, policyFqdns, routeTableFqdns, msoRequest, networkId,
- neutronNetworkId, networkFqdn, subnetIdMap, rollback);
+ neutronNetworkId, networkFqdn, subnetIdMap, rollback, true);
}
/**
@@ -188,12 +190,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
* created but the orchestration fails on a subsequent operation.
*/
- private void createNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid,
+ public void createNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid,
String networkName, String physicalNetworkName, List<Integer> vlans, List<RouteTarget> routeTargets,
String shared, String external, Boolean failIfExists, Boolean backout, List<Subnet> subnets,
List<String> policyFqdns, List<String> routeTableFqdns, MsoRequest msoRequest, Holder<String> networkId,
Holder<String> neutronNetworkId, Holder<String> networkFqdn, Holder<Map<String, String>> subnetIdMap,
- Holder<NetworkRollback> rollback) throws NetworkException {
+ Holder<NetworkRollback> rollback, Boolean pollForCompletion) throws NetworkException {
logger.debug("*** CREATE Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId);
// Will capture execution time for metrics
@@ -223,275 +225,208 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
NetworkResource networkResource = networkCheck(startTime, networkType, modelCustomizationUuid, networkName,
physicalNetworkName, vlans, routeTargets, cloudSiteId, cloudSiteOpt.get());
- String mode = networkResource.getOrchestrationMode();
NetworkType neutronNetworkType = NetworkType.valueOf(networkResource.getNeutronNetworkType());
- if (NEUTRON_MODE.equals(mode)) {
-
- // Use an MsoNeutronUtils for all neutron commands
-
- // See if the Network already exists (by name)
- NetworkInfo netInfo = null;
- try {
- netInfo = neutron.queryNetwork(networkName, tenantId, cloudSiteId);
- } catch (MsoException me) {
- logger.error(
- "{} {} Exception while querying network {} for CloudSite {} from Tenant {} from OpenStack ",
- MessageEnum.RA_QUERY_NETWORK_EXC, ErrorCode.BusinessProcessError.getValue(), networkName,
- cloudSiteId, tenantId, me);
- me.addContext(CREATE_NETWORK_CONTEXT);
- throw new NetworkException(me);
- }
-
- if (netInfo != null) {
- // Exists. If that's OK, return success with the network ID.
- // Otherwise, return an exception.
- if (failIfExists != null && failIfExists) {
- String error = String.format("Create Nework: Network %s already exists in %s/%s with ID %s",
- networkName, cloudSiteId, tenantId, netInfo.getId());
- logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_ALREADY_EXIST,
- ErrorCode.DataError.getValue(), error);
- throw new NetworkException(error, MsoExceptionCategory.USERDATA);
- } else {
- // Populate the outputs from the existing network.
- networkId.value = netInfo.getId();
- neutronNetworkId.value = netInfo.getId();
- rollback.value = networkRollback; // Default rollback - no updates performed
- 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;
- }
+ HeatTemplate heatTemplate = networkResource.getHeatTemplate();
+ if (heatTemplate == null) {
+ String error = String.format("Network error - undefined Heat Template. Network Type = %s", networkType);
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(), error);
+ throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
+ }
- try {
- netInfo = neutron.createNetwork(cloudSiteId, tenantId, neutronNetworkType, networkName,
- physicalNetworkName, vlans);
- } catch (MsoException me) {
- me.addContext(CREATE_NETWORK_CONTEXT);
- logger.error("{} {} Create Network: type {} in {}/{}: ", MessageEnum.RA_CREATE_NETWORK_EXC,
- ErrorCode.DataError.getValue(), neutronNetworkType, cloudSiteId, tenantId, me);
+ logger.debug("Got HEAT Template from DB: {}", heatTemplate);
- throw new NetworkException(me);
- }
+ // "Fix" the template if it has CR/LF (getting this from Oracle)
+ String template = heatTemplate.getHeatTemplate();
+ template = template.replaceAll("\r\n", "\n");
- // Note: ignoring MsoNetworkAlreadyExists because we already checked.
+ boolean os3template = false;
+ String os3nw = OS3_NW;
- // If reach this point, network creation is successful.
- // Since directly created via Neutron, networkId tracked by MSO is the same
- // as the neutron network ID.
- networkId.value = netInfo.getId();
- neutronNetworkId.value = netInfo.getId();
+ os3nw = environment.getProperty(OS3_NW_PROPERTY, OS3_NW);
- networkRollback.setNetworkCreated(true);
- networkRollback.setNetworkId(netInfo.getId());
- networkRollback.setNeutronNetworkId(netInfo.getId());
- networkRollback.setNetworkType(networkType);
+ if (template.contains(os3nw))
+ os3template = true;
- logger.debug("Network {} created, id = {}", networkName, netInfo.getId());
- } else if ("HEAT".equals(mode)) {
+ // First, look up to see if the Network already exists (by name).
+ // For HEAT orchestration of networks, the stack name will always match the network name
+ StackInfo heatStack = null;
+ try {
+ heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName);
+ } catch (MsoException me) {
+ me.addContext(CREATE_NETWORK_CONTEXT);
+ logger.error("{} {} Create Network (heat): query network {} in {}/{}: ", MessageEnum.RA_QUERY_NETWORK_EXC,
+ ErrorCode.DataError.getValue(), networkName, cloudSiteId, tenantId, me);
+ throw new NetworkException(me);
+ }
- HeatTemplate heatTemplate = networkResource.getHeatTemplate();
- if (heatTemplate == null) {
- String error = String.format("Network error - undefined Heat Template. Network Type = %s", networkType);
- logger.error(LoggingAnchor.THREE, MessageEnum.RA_PARAM_NOT_FOUND, ErrorCode.DataError.getValue(),
+ if (heatStack != null && (heatStack.getStatus() != HeatStatus.NOTFOUND)) {
+ // Stack exists. Return success or error depending on input directive
+ if (failIfExists != null && failIfExists) {
+ String error = String.format("CreateNetwork: Stack %s already exists in %s/%s as %s", networkName,
+ cloudSiteId, tenantId, heatStack.getCanonicalName());
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(),
error);
- throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
- }
-
- logger.debug("Got HEAT Template from DB: {}", heatTemplate);
-
- // "Fix" the template if it has CR/LF (getting this from Oracle)
- String template = heatTemplate.getHeatTemplate();
- template = template.replaceAll("\r\n", "\n");
-
- boolean aic3template = false;
- String aic3nw = AIC3_NW;
-
- aic3nw = environment.getProperty(AIC3_NW_PROPERTY, AIC3_NW);
-
- if (template.contains(aic3nw))
- aic3template = true;
-
- // First, look up to see if the Network already exists (by name).
- // For HEAT orchestration of networks, the stack name will always match the network name
- StackInfo heatStack = null;
- try {
- heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName);
- } catch (MsoException me) {
- me.addContext(CREATE_NETWORK_CONTEXT);
- logger.error("{} {} Create Network (heat): query network {} in {}/{}: ",
- MessageEnum.RA_QUERY_NETWORK_EXC, ErrorCode.DataError.getValue(), networkName, cloudSiteId,
- tenantId, me);
- throw new NetworkException(me);
- }
-
- if (heatStack != null && (heatStack.getStatus() != HeatStatus.NOTFOUND)) {
- // Stack exists. Return success or error depending on input directive
- if (failIfExists != null && failIfExists) {
- String error = String.format("CreateNetwork: Stack %s already exists in %s/%s as %s", networkName,
- cloudSiteId, tenantId, heatStack.getCanonicalName());
- logger.error(LoggingAnchor.THREE, MessageEnum.RA_NETWORK_ALREADY_EXIST,
- ErrorCode.DataError.getValue(), error);
- throw new NetworkException(error, MsoExceptionCategory.USERDATA);
- } else {
- // Populate the outputs from the existing stack.
- networkId.value = heatStack.getCanonicalName();
- Map<String, String> sMap = new HashMap<>();
- if (heatStack.getOutputs() != null) {
- neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
- rollback.value = networkRollback; // Default rollback - no updates performed
- if (aic3template) {
- networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
- }
- Map<String, Object> outputs = heatStack.getOutputs();
-
- for (Map.Entry<String, Object> entry : outputs.entrySet()) {
- String key = entry.getKey();
- if (key != null && key.startsWith("subnet")) {
- if (aic3template) // one subnet_id output
- {
- Map<String, String> map = getSubnetUUId(key, outputs, subnets);
- sMap.putAll(map);
- } else // multiples subnet_%aaid% outputs
- {
- String subnetUUId = (String) outputs.get(key);
- sMap.put(key.substring("subnet_id_".length()), subnetUUId);
- }
+ throw new NetworkException(error, MsoExceptionCategory.USERDATA);
+ } else {
+ // Populate the outputs from the existing stack.
+ networkId.value = heatStack.getCanonicalName();
+ Map<String, String> sMap = new HashMap<>();
+ if (heatStack.getOutputs() != null) {
+ neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
+ rollback.value = networkRollback; // Default rollback - no updates performed
+ if (os3template) {
+ networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
+ }
+ Map<String, Object> outputs = heatStack.getOutputs();
+
+ for (Map.Entry<String, Object> entry : outputs.entrySet()) {
+ String key = entry.getKey();
+ if (key != null && key.startsWith("subnet")) {
+ if (os3template) // one subnet_id output
+ {
+ Map<String, String> map = getSubnetUUId(key, outputs, subnets);
+ sMap.putAll(map);
+ } else // multiples subnet_%aaid% outputs
+ {
+ String subnetUUId = (String) outputs.get(key);
+ sMap.put(key.substring("subnet_id_".length()), subnetUUId);
}
}
}
- subnetIdMap.value = sMap;
- logger.warn("{} {} Found Existing network stack, status={} networkName={} for {}/{}",
- MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(), heatStack.getStatus(),
- networkName, cloudSiteId, tenantId);
}
- heat.updateResourceStatus(msoRequest.getRequestId(), NETWORK_EXIST_STATUS_MESSAGE);
- return;
+ subnetIdMap.value = sMap;
+ logger.warn("{} {} Found Existing network stack, status={} networkName={} for {}/{}",
+ MessageEnum.RA_NETWORK_ALREADY_EXIST, ErrorCode.DataError.getValue(), heatStack.getStatus(),
+ networkName, cloudSiteId, tenantId);
}
+ heat.updateResourceStatus(msoRequest.getRequestId(), NETWORK_EXIST_STATUS_MESSAGE);
+ return;
+ }
- // Ready to deploy the new Network
- // Build the common set of HEAT template parameters
- Map<String, Object> stackParams = populateNetworkParams(neutronNetworkType, networkName,
- physicalNetworkName, vlans, routeTargets, shared, external, aic3template);
-
- // Validate (and update) the input parameters against the DB definition
- // Shouldn't happen unless DB config is wrong, since all networks use same inputs
- // and inputs were already validated.
- try {
- stackParams = heat.validateStackParams(stackParams, heatTemplate);
- } catch (IllegalArgumentException e) {
- String error = "Create Network: Configuration Error: " + e.getMessage();
- logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error, e);
- // Input parameters were not valid
- throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
- }
+ // Ready to deploy the new Network
+ // Build the common set of HEAT template parameters
+ Map<String, Object> stackParams = populateNetworkParams(neutronNetworkType, networkName, physicalNetworkName,
+ vlans, routeTargets, shared, external, os3template);
- if (subnets != null) {
- try {
- if (aic3template) {
- template = mergeSubnetsAIC3(template, subnets, stackParams);
- } else {
- template = mergeSubnets(template, subnets);
- }
- } catch (MsoException me) {
- me.addContext(CREATE_NETWORK_CONTEXT);
- logger.error("{} {} Exception Create Network, merging subnets for network (heat) type {} in {}/{} ",
- MessageEnum.RA_CREATE_NETWORK_EXC, ErrorCode.DataError.getValue(),
- neutronNetworkType.toString(), cloudSiteId, tenantId, me);
- throw new NetworkException(me);
- }
- }
+ // Validate (and update) the input parameters against the DB definition
+ // Shouldn't happen unless DB config is wrong, since all networks use same inputs
+ // and inputs were already validated.
+ try {
+ stackParams = heat.validateStackParams(stackParams, heatTemplate);
+ } catch (IllegalArgumentException e) {
+ String error = "Create Network: Configuration Error: " + e.getMessage();
+ logger.error(LoggingAnchor.THREE, MessageEnum.RA_CONFIG_EXC, ErrorCode.DataError.getValue(), error, e);
+ // Input parameters were not valid
+ throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
+ }
- if (policyFqdns != null && !policyFqdns.isEmpty() && aic3template) {
- try {
- mergePolicyRefs(policyFqdns, stackParams);
- } catch (MsoException me) {
- me.addContext(CREATE_NETWORK_CONTEXT);
- logger.error("{} {} Exception Create Network, merging policyRefs type {} in {}/{} ",
- MessageEnum.RA_CREATE_NETWORK_EXC, ErrorCode.DataError.getValue(),
- neutronNetworkType.toString(), cloudSiteId, tenantId, me);
- throw new NetworkException(me);
+ if (subnets != null) {
+ try {
+ if (os3template) {
+ template = mergeSubnetsAIC3(template, subnets, stackParams);
+ } else {
+ template = mergeSubnets(template, subnets);
}
+ } catch (MsoException me) {
+ me.addContext(CREATE_NETWORK_CONTEXT);
+ logger.error("{} {} Exception Create Network, merging subnets for network (heat) type {} in {}/{} ",
+ MessageEnum.RA_CREATE_NETWORK_EXC, ErrorCode.DataError.getValue(),
+ neutronNetworkType.toString(), cloudSiteId, tenantId, me);
+ throw new NetworkException(me);
}
+ }
- if (routeTableFqdns != null && !routeTableFqdns.isEmpty() && aic3template) {
- try {
- mergeRouteTableRefs(routeTableFqdns, stackParams);
- } catch (MsoException me) {
- me.addContext(CREATE_NETWORK_CONTEXT);
- logger.error("{} {} Exception Create Network, merging routeTableRefs type {} in {}/{} ",
- MessageEnum.RA_CREATE_NETWORK_EXC, ErrorCode.DataError.getValue(),
- neutronNetworkType.toString(), cloudSiteId, tenantId, me);
- throw new NetworkException(me);
- }
+ if (policyFqdns != null && !policyFqdns.isEmpty() && os3template) {
+ try {
+ mergePolicyRefs(policyFqdns, stackParams);
+ } catch (MsoException me) {
+ me.addContext(CREATE_NETWORK_CONTEXT);
+ logger.error("{} {} Exception Create Network, merging policyRefs type {} in {}/{} ",
+ MessageEnum.RA_CREATE_NETWORK_EXC, ErrorCode.DataError.getValue(),
+ neutronNetworkType.toString(), cloudSiteId, tenantId, me);
+ throw new NetworkException(me);
}
+ }
- // Deploy the network stack
- // Ignore MsoStackAlreadyExists exception because we already checked.
+ if (routeTableFqdns != null && !routeTableFqdns.isEmpty() && os3template) {
try {
- if (backout == null)
- backout = true;
- heatStack = heat.createStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName, null, template,
- stackParams, true, heatTemplate.getTimeoutMinutes(), null, null, null, backout.booleanValue(),
- failIfExists);
+ mergeRouteTableRefs(routeTableFqdns, stackParams);
} catch (MsoException me) {
me.addContext(CREATE_NETWORK_CONTEXT);
- logger.error("{} {} Exception creating network type {} in {}/{} ", MessageEnum.RA_CREATE_NETWORK_EXC,
- ErrorCode.DataError.getValue(), networkName, cloudSiteId, tenantId, me);
+ logger.error("{} {} Exception Create Network, merging routeTableRefs type {} in {}/{} ",
+ MessageEnum.RA_CREATE_NETWORK_EXC, ErrorCode.DataError.getValue(),
+ neutronNetworkType.toString(), cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
+ }
- // Reach this point if createStack is successful.
+ // Deploy the network stack
+ // Ignore MsoStackAlreadyExists exception because we already checked.
+ try {
+ if (backout == null)
+ backout = true;
+ heatStack = heat.createStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName, null, template, stackParams,
+ pollForCompletion, heatTemplate.getTimeoutMinutes(), null, null, null, backout.booleanValue(),
+ failIfExists);
+ } catch (MsoException me) {
+ me.addContext(CREATE_NETWORK_CONTEXT);
+ logger.error("{} {} Exception creating network type {} in {}/{} ", MessageEnum.RA_CREATE_NETWORK_EXC,
+ ErrorCode.DataError.getValue(), networkName, cloudSiteId, tenantId, me);
+ throw new NetworkException(me);
+ }
- // For Heat-based orchestration, the MSO-tracked network ID is the heat stack,
- // and the neutronNetworkId is the network UUID returned in stack outputs.
- networkId.value = heatStack.getCanonicalName();
- if (heatStack.getOutputs() != null) {
- neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
- if (aic3template) {
- networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
- }
+ // Reach this point if createStack is successful.
+
+ // For Heat-based orchestration, the MSO-tracked network ID is the heat stack,
+ // and the neutronNetworkId is the network UUID returned in stack outputs.
+ networkId.value = heatStack.getCanonicalName();
+ if (heatStack.getOutputs() != null) {
+ neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
+ if (os3template) {
+ networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
}
- Map<String, Object> outputs = heatStack.getOutputs();
- Map<String, String> sMap = new HashMap<>();
- if (outputs != null) {
- for (Map.Entry<String, Object> entry : outputs.entrySet()) {
- String key = entry.getKey();
- if (key != null && key.startsWith("subnet")) {
- if (aic3template) // one subnet output expected
- {
- Map<String, String> map = getSubnetUUId(key, outputs, subnets);
- sMap.putAll(map);
- } else // multiples subnet_%aaid% outputs allowed
- {
- String subnetUUId = (String) outputs.get(key);
- sMap.put(key.substring("subnet_id_".length()), subnetUUId);
- }
+ }
+ Map<String, Object> outputs = heatStack.getOutputs();
+ Map<String, String> sMap = new HashMap<>();
+ if (outputs != null) {
+ for (Map.Entry<String, Object> entry : outputs.entrySet()) {
+ String key = entry.getKey();
+ if (key != null && key.startsWith("subnet")) {
+ if (os3template) // one subnet output expected
+ {
+ Map<String, String> map = getSubnetUUId(key, outputs, subnets);
+ sMap.putAll(map);
+ } else // multiples subnet_%aaid% outputs allowed
+ {
+ String subnetUUId = (String) outputs.get(key);
+ sMap.put(key.substring("subnet_id_".length()), subnetUUId);
}
}
- networkRollback.setNeutronNetworkId((String) outputs.get(NETWORK_ID));
}
- subnetIdMap.value = sMap;
-
- rollback.value = networkRollback;
- // Populate remaining rollback info and response parameters.
- networkRollback.setNetworkStackId(heatStack.getCanonicalName());
- networkRollback.setNetworkCreated(true);
- networkRollback.setNetworkType(networkType);
+ networkRollback.setNeutronNetworkId((String) outputs.get(NETWORK_ID));
+ }
+ subnetIdMap.value = sMap;
- try {
- heat.updateResourceStatus(msoRequest.getRequestId(), NETWORK_CREATED_STATUS_MESSAGE);
- } catch (Exception e) {
- logger.warn("Exception while updating infra active request", e);
- }
+ rollback.value = networkRollback;
+ // Populate remaining rollback info and response parameters.
+ networkRollback.setNetworkStackId(heatStack.getCanonicalName());
+ networkRollback.setNetworkCreated(true);
+ networkRollback.setNetworkType(networkType);
- logger.debug("Network {} successfully created via HEAT", networkName);
+ 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);
+
+
return;
}
+ @Deprecated
@Override
public void updateNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid,
String networkId, String networkName, String physicalNetworkName, List<Integer> vlans, String shared,
@@ -503,6 +438,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
+ @Deprecated
@Override
public void updateNetworkContrail(String cloudSiteId, String tenantId, String networkType,
String modelCustomizationUuid, String networkId, String networkName, List<RouteTarget> routeTargets,
@@ -534,7 +470,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
* undo everything that was updated. This is useful if a network is successfully updated but orchestration fails on
* a subsequent operation.
*/
- private void updateNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid,
+ public void updateNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid,
String networkId, String networkName, String physicalNetworkName, List<Integer> vlans,
List<RouteTarget> routeTargets, String shared, String external, List<Subnet> subnets,
List<String> policyFqdns, List<String> routeTableFqdns, MsoRequest msoRequest,
@@ -593,7 +529,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Does not exist. Throw an exception (can't update a non-existent network)
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
- long updateNetworkStarttime = System.currentTimeMillis();
try {
netInfo = neutron.updateNetwork(cloudSiteId, tenantId, networkId, neutronNetworkType,
physicalNetworkName, vlans);
@@ -674,17 +609,17 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String template = heatTemplate.getHeatTemplate();
template = template.replaceAll("\r\n", "\n");
- boolean aic3template = false;
- String aic3nw = AIC3_NW;
+ boolean os3template = false;
+ String os3nw = OS3_NW;
- aic3nw = environment.getProperty(AIC3_NW_PROPERTY, AIC3_NW);
+ os3nw = environment.getProperty(OS3_NW_PROPERTY, OS3_NW);
- if (template.contains(aic3nw))
- aic3template = true;
+ if (template.contains(os3nw))
+ os3template = true;
// Build the common set of HEAT template parameters
Map<String, Object> stackParams = populateNetworkParams(neutronNetworkType, networkName,
- physicalNetworkName, vlans, routeTargets, shared, external, aic3template);
+ physicalNetworkName, vlans, routeTargets, shared, external, os3template);
// Validate (and update) the input parameters against the DB definition
// Shouldn't happen unless DB config is wrong, since all networks use same inputs
@@ -698,7 +633,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (subnets != null) {
try {
- if (aic3template) {
+ if (os3template) {
template = mergeSubnetsAIC3(template, subnets, stackParams);
} else {
template = mergeSubnets(template, subnets);
@@ -712,7 +647,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
}
- if (policyFqdns != null && aic3template) {
+ if (policyFqdns != null && os3template) {
try {
mergePolicyRefs(policyFqdns, stackParams);
} catch (MsoException me) {
@@ -724,7 +659,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
}
- if (routeTableFqdns != null && !routeTableFqdns.isEmpty() && aic3template) {
+ if (routeTableFqdns != null && !routeTableFqdns.isEmpty() && os3template) {
try {
mergeRouteTableRefs(routeTableFqdns, stackParams);
} catch (MsoException me) {
@@ -740,7 +675,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Ignore MsoStackNotFound exception because we already checked.
try {
heatStack = heatWithUpdate.updateStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId, template,
- stackParams, true, heatTemplate.getTimeoutMinutes());
+ stackParams, false, heatTemplate.getTimeoutMinutes());
} catch (MsoException me) {
me.addContext(UPDATE_NETWORK_CONTEXT);
logger.error("{} {} Exception - update network {} in {}/{} ", MessageEnum.RA_UPDATE_NETWORK_ERR,
@@ -754,7 +689,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
for (Map.Entry<String, Object> entry : outputs.entrySet()) {
String key = entry.getKey();
if (key != null && key.startsWith("subnet")) {
- if (aic3template) // one subnet output expected
+ if (os3template) // one subnet output expected
{
Map<String, String> map = getSubnetUUId(key, outputs, subnets);
sMap.putAll(map);
@@ -837,14 +772,14 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
throw new NetworkException(error, MsoExceptionCategory.INTERNAL);
}
- MavenLikeVersioning aicV = new MavenLikeVersioning();
- aicV.setVersion(cloudSite.getCloudVersion());
- if ((aicV.isMoreRecentThan(networkResource.getAicVersionMin())
- || aicV.isTheSameVersion(networkResource.getAicVersionMin())) // aic
+ MavenLikeVersioning osV = new MavenLikeVersioning();
+ osV.setVersion(cloudSite.getCloudVersion());
+ if ((osV.isMoreRecentThan(networkResource.getAicVersionMin())
+ || osV.isTheSameVersion(networkResource.getAicVersionMin())) // os
// >=
// min
- && (aicV.isTheSameVersion(networkResource.getAicVersionMax())
- || !(aicV.isMoreRecentThan(networkResource.getAicVersionMax())))) // aic <= max
+ && (osV.isTheSameVersion(networkResource.getAicVersionMax())
+ || !(osV.isMoreRecentThan(networkResource.getAicVersionMax())))) // os <= max
{
logger.debug("Network Type:{} VersionMin:{} VersionMax:{} supported on Cloud:{} with AIC_Version:{}",
networkType, networkResource.getAicVersionMin(), networkResource.getAicVersionMax(), cloudSiteId,
@@ -921,7 +856,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Use MsoNeutronUtils for all NEUTRON commands
- String mode;
String neutronId = null;
// Try Heat first, since networks may be named the same as the Heat stack
StackInfo heatStack = null;
@@ -939,7 +873,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// Found it. Get the neutronNetworkId for further query
Map<String, String> sMap = new HashMap<>();
Map<String, Object> outputs = heatStack.getOutputs();
- mode = "HEAT";
if (outputs != null) {
neutronId = (String) outputs.get(NETWORK_ID);
@@ -957,10 +890,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
}
subnetIdMap.value = sMap;
- } else {
- // Input ID was not a Heat stack ID. Try it directly in Neutron
- neutronId = networkNameOrId;
- mode = NEUTRON_MODE;
}
// Query directly against the Neutron Network for the details
@@ -971,7 +900,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (netInfo != null) {
// Found. Populate the output elements
networkExists.value = Boolean.TRUE;
- if ("HEAT".equals(mode) && heatStack != null) {
+ if (heatStack != null) {
networkId.value = heatStack.getCanonicalName();
} else {
networkId.value = netInfo.getId();
@@ -981,8 +910,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (vlans != null)
vlans.value = netInfo.getVlans();
- logger.debug("Network {} found({}), ID = {}{}", networkNameOrId, mode, networkId.value,
- ("HEAT".equals(mode) ? ",NeutronId = " + neutronNetworkId.value : ""));
+ logger.debug("Network {}, ID = {}{}", networkNameOrId, networkId.value,
+ (",NeutronId = " + neutronNetworkId.value));
} else {
// Not found. Populate the status fields, leave the rest null
networkExists.value = Boolean.FALSE;
@@ -1019,7 +948,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
*/
@Override
public void deleteNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid,
- String networkId, MsoRequest msoRequest, Holder<Boolean> networkDeleted) throws NetworkException {
+ String networkId, MsoRequest msoRequest, Holder<Boolean> networkDeleted, Boolean pollForCompletion)
+ throws NetworkException {
logger.debug("*** DELETE Network adapter with Network: {} in {}/{}", networkId, cloudSiteId, tenantId);
if (commonUtils.isNullOrEmpty(cloudSiteId) || commonUtils.isNullOrEmpty(tenantId)
|| commonUtils.isNullOrEmpty(networkId)) {
@@ -1028,6 +958,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
throw new NetworkException(error, MsoExceptionCategory.USERDATA);
}
+ if (pollForCompletion == null) {
+ pollForCompletion = true;
+ }
+
// Retrieve the Network Resource definition
NetworkResource networkResource = null;
if (commonUtils.isNullOrEmpty(modelCustomizationUuid)) {
@@ -1043,10 +977,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
int timeoutMinutes = 118;
- String mode = "";
if (networkResource != null) {
logger.debug(LOG_DEBUG_MSG, networkResource.toString());
- mode = networkResource.getOrchestrationMode();
networkResource.getHeatTemplate().getTimeoutMinutes();
HeatTemplate heat = networkResource.getHeatTemplate();
if (heat != null && heat.getTimeoutMinutes() != null) {
@@ -1056,27 +988,17 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
}
- if (NEUTRON_MODE.equals(mode)) {
- try {
- boolean deleted = neutron.deleteNetwork(networkId, tenantId, cloudSiteId);
- networkDeleted.value = deleted;
- } catch (MsoException me) {
- me.addContext("DeleteNetwork");
- logger.error("{} {} Delete Network (neutron): {} in {}/{} ", MessageEnum.RA_DELETE_NETWORK_EXC,
- ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
- throw new NetworkException(me);
- }
- } else {
- try {
- 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,
- ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
- throw new NetworkException(me);
- }
+ try {
+ StackInfo stack =
+ heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, pollForCompletion, timeoutMinutes);
+ networkDeleted.value = stack.isOperationPerformed();
+ } catch (MsoException me) {
+ me.addContext("DeleteNetwork");
+ logger.error("{} {} Delete Network (heat): {} in {}/{} ", MessageEnum.RA_DELETE_NETWORK_EXC,
+ ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
+ throw new NetworkException(me);
}
+
try {
heat.updateResourceStatus(msoRequest.getRequestId(),
networkDeleted.value ? NETWORK_DELETED_STATUS_MESSAGE : NETWORK_NOT_EXIST_STATUS_MESSAGE);
@@ -1094,58 +1016,34 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
* creation.
*/
@Override
- public void rollbackNetwork(NetworkRollback rollback) throws NetworkException {
+ public void rollbackNetwork(NetworkRollback rollback, Boolean pollForCompletion) throws NetworkException {
if (rollback == null) {
logger.error("{} {} rollback is null", MessageEnum.RA_ROLLBACK_NULL, ErrorCode.DataError.getValue());
return;
}
+ if (pollForCompletion == null) {
+ pollForCompletion = true;
+ }
+
// Get the elements of the VnfRollback object for easier access
String cloudSiteId = rollback.getCloudId();
String tenantId = rollback.getTenantId();
String networkId = rollback.getNetworkStackId();
- String networkType = rollback.getNetworkType();
- String modelCustomizationUuid = rollback.getModelCustomizationUuid();
logger.debug("*** ROLLBACK Network {} in {}/{}", networkId, cloudSiteId, tenantId);
- // Retrieve the Network Resource definition
- NetworkResource networkResource = null;
- if (commonUtils.isNullOrEmpty(modelCustomizationUuid)) {
- networkResource = networkCustomRepo.findOneByNetworkType(networkType).getNetworkResource();
- } else {
- networkResource =
- networkCustomRepo.findOneByModelCustomizationUUID(modelCustomizationUuid).getNetworkResource();
- }
- String mode = "";
- if (networkResource != null) {
-
- logger.debug(LOG_DEBUG_MSG, networkResource);
-
- mode = networkResource.getOrchestrationMode();
- }
if (rollback.getNetworkCreated()) {
- if (NEUTRON_MODE.equals(mode)) {
- try {
- neutron.deleteNetwork(networkId, tenantId, cloudSiteId);
- } catch (MsoException me) {
- me.addContext("RollbackNetwork");
- logger.error("{} {} Exception - Rollback Network (neutron): {} in {}/{} ",
- MessageEnum.RA_DELETE_NETWORK_EXC, ErrorCode.BusinessProcessError.getValue(), networkId,
- cloudSiteId, tenantId, me);
- throw new NetworkException(me);
- }
- } else {
- try {
- heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true, 120);
- } catch (MsoException me) {
- me.addContext("RollbackNetwork");
- logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ",
- MessageEnum.RA_DELETE_NETWORK_EXC, ErrorCode.BusinessProcessError.getValue(), networkId,
- cloudSiteId, tenantId, me);
- throw new NetworkException(me);
- }
+ try {
+ heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, pollForCompletion, 120);
+ } catch (MsoException me) {
+ me.addContext("RollbackNetwork");
+ logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ",
+ MessageEnum.RA_DELETE_NETWORK_EXC, ErrorCode.BusinessProcessError.getValue(), networkId,
+ cloudSiteId, tenantId, me);
+ throw new NetworkException(me);
}
+
}
}
@@ -1173,7 +1071,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
private Map<String, Object> populateNetworkParams(NetworkType neutronNetworkType, String networkName,
String physicalNetwork, List<Integer> vlans, List<RouteTarget> routeTargets, String shared, String external,
- boolean aic3template) {
+ boolean os3template) {
// Build the common set of HEAT template parameters
Map<String, Object> stackParams = new HashMap<>();
stackParams.put("network_name", networkName);
@@ -1227,14 +1125,14 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if ("IMPORT".equalsIgnoreCase(role)) {
sep = rtImport.isEmpty() ? "" : ",";
- rtImport = aic3template ? rtImport + sep + "target:" + rtValue : rtImport + sep + rtValue;
+ rtImport = os3template ? rtImport + sep + "target:" + rtValue : rtImport + sep + rtValue;
} else if ("EXPORT".equalsIgnoreCase(role)) {
sep = rtExport.isEmpty() ? "" : ",";
- rtExport = aic3template ? rtExport + sep + "target:" + rtValue : rtExport + sep + rtValue;
+ rtExport = os3template ? rtExport + sep + "target:" + rtValue : rtExport + sep + rtValue;
} else // covers BOTH, empty etc
{
sep = rtGlobal.isEmpty() ? "" : ",";
- rtGlobal = aic3template ? rtGlobal + sep + "target:" + rtValue : rtGlobal + sep + rtValue;
+ rtGlobal = os3template ? rtGlobal + sep + "target:" + rtValue : rtGlobal + sep + rtValue;
}
}
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
deleted file mode 100644
index 09356d02c8..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
+++ /dev/null
@@ -1,660 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.network;
-
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.inject.Provider;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.GenericEntity;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.xml.ws.Holder;
-import org.apache.http.HttpStatus;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.adapters.network.exceptions.NetworkException;
-import org.onap.so.adapters.nwrest.ContrailNetwork;
-import org.onap.so.adapters.nwrest.CreateNetworkError;
-import org.onap.so.adapters.nwrest.CreateNetworkRequest;
-import org.onap.so.adapters.nwrest.CreateNetworkResponse;
-import org.onap.so.adapters.nwrest.DeleteNetworkError;
-import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
-import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
-import org.onap.so.adapters.nwrest.ProviderVlanNetwork;
-import org.onap.so.adapters.nwrest.QueryNetworkError;
-import org.onap.so.adapters.nwrest.QueryNetworkResponse;
-import org.onap.so.adapters.nwrest.RollbackNetworkError;
-import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
-import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
-import org.onap.so.adapters.nwrest.UpdateNetworkError;
-import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
-import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
-import org.onap.so.adapters.vnf.BpelRestClient;
-import org.onap.so.entity.MsoRequest;
-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;
-import org.onap.so.openstack.beans.RouteTarget;
-import org.onap.so.openstack.exceptions.MsoExceptionCategory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-
-@Path("/v1/networks")
-@Api(value = "/v1/networks", description = "root of network adapters restful web service")
-@Component
-@Transactional
-public class NetworkAdapterRest {
-
- private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterRest.class);
- private static final String TESTING_KEYWORD = "___TESTING___";
- private String exceptionMsg = "Exception:";
- private static final String SHARED = "shared";
- private static final String EXTERNAL = "external";
-
- @Autowired
- private MsoNetworkAdapterImpl adapter;
-
- @Autowired
- private Provider<BpelRestClient> bpelRestClientProvider;
-
-
- @POST
- @Path("")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "CreateNetwork", response = Response.class,
- notes = "Creates a new network, CreateNetworkRquest JSON is required")
- @ApiResponses({@ApiResponse(code = 200, message = "network has been successfully created"),
- @ApiResponse(code = 202, message = "create network request has been accepted (async only)"),
- @ApiResponse(code = 500, message = "create network failed, examine entity object for details")})
- public Response createNetwork(
- @ApiParam(value = "details of network being created", required = true) CreateNetworkRequest req) {
- logger.debug("createNetwork enter: {}", req.toJsonString());
- CreateNetworkTask task = new CreateNetworkTask(req);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} Exception while create network ", MessageEnum.RA_CREATE_NETWORK_EXC,
- ErrorCode.BusinessProcessError.getValue(), e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("createNetwork exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class CreateNetworkTask implements Runnable {
- private final CreateNetworkRequest req;
- private CreateNetworkResponse response = null;
- private CreateNetworkError eresp = null;
- private boolean sendxml;
-
- public CreateNetworkTask(CreateNetworkRequest req) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<CreateNetworkResponse>(response) {}
- : new GenericEntity<CreateNetworkError>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- logger.debug("CreateNetworkTask start");
- try {
- // Synchronous Web Service Outputs
- Holder<String> networkId = new Holder<>();
- Holder<String> neutronNetworkId = new Holder<>();
- Holder<String> networkFqdn = new Holder<>();
- Holder<Map<String, String>> subnetIdMap = new Holder<>();
- Holder<NetworkRollback> rollback = new Holder<>();
-
- HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams();
- if (params == null) {
- params = new HashMap<>();
- }
- String shared = null;
- String external = null;
-
- String cloudsite = req.getCloudSiteId();
- if (cloudsite != null && cloudsite.equals(TESTING_KEYWORD)) {
- String tenant = req.getTenantId();
- if (tenant != null && tenant.equals(TESTING_KEYWORD)) {
- throw new NetworkException("testing.");
- }
- networkId.value = "479D3D8B-6360-47BC-AB75-21CC91981484";
- neutronNetworkId.value = "55e55884-28fa-11e6-8971-0017f20fe1b8";
- networkFqdn.value = "086f70b6-28fb-11e6-8260-0017f20fe1b8";
- subnetIdMap.value = testMap();
- rollback.value = new NetworkRollback();
- } else if (req.isContrailRequest()) {
- ContrailNetwork ctn = req.getContrailNetwork();
- if (ctn == null) {
- ctn = new ContrailNetwork();
- req.setContrailNetwork(ctn);
- }
- if (params.containsKey(SHARED)) {
- shared = params.get(SHARED);
- } else {
- if (ctn.getShared() != null) {
- shared = ctn.getShared();
- }
- }
- if (params.containsKey(EXTERNAL)) {
- external = params.get(EXTERNAL);
- } else {
- if (ctn.getExternal() != null) {
- external = ctn.getExternal();
- }
- }
- adapter.createNetworkContrail(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
- req.getModelCustomizationUuid(), req.getNetworkName(),
- req.getContrailNetwork().getRouteTargets(), shared, external, req.getFailIfExists(),
- req.getBackout(), req.getSubnets(), params, req.getContrailNetwork().getPolicyFqdns(),
- req.getContrailNetwork().getRouteTableFqdns(), req.getMsoRequest(), networkId,
- neutronNetworkId, networkFqdn, subnetIdMap, rollback);
- } else {
- ProviderVlanNetwork pvn = req.getProviderVlanNetwork();
- if (pvn == null) {
- pvn = new ProviderVlanNetwork();
- req.setProviderVlanNetwork(pvn);
- }
- if (params.containsKey(SHARED))
- shared = params.get(SHARED);
- if (params.containsKey(EXTERNAL))
- external = params.get(EXTERNAL);
- adapter.createNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
- req.getModelCustomizationUuid(), req.getNetworkName(),
- req.getProviderVlanNetwork().getPhysicalNetworkName(),
- req.getProviderVlanNetwork().getVlans(), shared, external, req.getFailIfExists(),
- req.getBackout(), req.getSubnets(), params, req.getMsoRequest(), networkId,
- neutronNetworkId, subnetIdMap, rollback);
- }
- response = new CreateNetworkResponse(req.getNetworkId(), neutronNetworkId.value,
- rollback.value.getNetworkStackId(), networkFqdn.value, rollback.value.getNetworkCreated(),
- subnetIdMap.value, rollback.value, req.getMessageId());
- } catch (NetworkException e) {
- logger.debug(exceptionMsg, e);
- eresp = new CreateNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("CreateNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse());
- }
- }
-
- @DELETE
- @Path("{aaiNetworkId}")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "DeleteNetwork", response = Response.class,
- notes = "Deletes an existing network, aaiNetworkId and DeleteNetworkRequest JSON are required")
- @ApiResponses({@ApiResponse(code = 200, message = "network has been successfully deleted"),
- @ApiResponse(code = 202, message = "request to delete network has been accepted (async only)"),
- @ApiResponse(code = 500, message = "delete network failed, examine entity object for details")})
- public Response deleteNetwork(
- @ApiParam(value = "aaiNetworkId to be deleted ",
- required = true) @PathParam("aaiNetworkId") String aaiNetworkId,
- @ApiParam(value = "details of network being deleted", required = true) DeleteNetworkRequest req) {
- logger.debug("deleteNetwork enter: {}", req.toJsonString());
- if (aaiNetworkId == null || !aaiNetworkId.equals(req.getNetworkId())) {
- return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN).entity(
- "A&AI NetworkId in URL (" + aaiNetworkId + ") does not match content (" + req.getNetworkId() + ")")
- .build();
- }
- DeleteNetworkTask task = new DeleteNetworkTask(req);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} Exception while delete network ", MessageEnum.RA_DELETE_NETWORK_EXC,
- ErrorCode.BusinessProcessError.getValue(), e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("deleteNetwork exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class DeleteNetworkTask implements Runnable {
- private final DeleteNetworkRequest req;
- private DeleteNetworkResponse response = null;
- private DeleteNetworkError eresp = null;
- private boolean sendxml;
-
- public DeleteNetworkTask(DeleteNetworkRequest req) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<DeleteNetworkResponse>(response) {}
- : new GenericEntity<DeleteNetworkError>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- logger.debug("DeleteNetworkTask start");
- try {
- Holder<Boolean> networkDeleted = new Holder<>();
- if (req.getCloudSiteId().equals(TESTING_KEYWORD)) {
- networkDeleted.value = true;
- } else {
- adapter.deleteNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
- req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getMsoRequest(),
- networkDeleted);
- }
- response = new DeleteNetworkResponse(req.getNetworkId(), networkDeleted.value, req.getMessageId());
- } catch (NetworkException e) {
- logger.debug(exceptionMsg, e);
- eresp = new DeleteNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("DeleteNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse());
- }
- }
-
- @GET
- @Path("{aaiNetworkId}")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "QueryNetwork", response = Response.class, notes = "Queries an existing network")
- @ApiResponses({@ApiResponse(code = 200, message = "Query network successful"),
- @ApiResponse(code = 500, message = "Query network failed, examine entity object for details")})
- public Response queryNetwork(
- @ApiParam(value = "cloudSiteId", required = false) @QueryParam("cloudSiteId") String cloudSiteId,
- @ApiParam(value = "tenantId", required = false) @QueryParam("tenantId") String tenantId,
- @ApiParam(value = "networkStackId", required = false) @QueryParam("networkStackId") String networkStackId,
- @ApiParam(value = "skipAAI", required = false) @QueryParam("skipAAI") String skipAAI,
- @ApiParam(value = "msoRequest.requestId",
- required = false) @QueryParam("msoRequest.requestId") String requestId,
- @ApiParam(value = "msoRequest.serviceInstanceId",
- required = false) @QueryParam("msoRequest.serviceInstanceId") String serviceInstanceId,
- @ApiParam(value = "aaiNetworkId", required = false) @PathParam("aaiNetworkId") String aaiNetworkId) {
- // This request responds synchronously only
- logger.debug("Query network enter:{}" + aaiNetworkId);
- MsoRequest msoRequest = new MsoRequest(requestId, serviceInstanceId);
-
- try {
- int respStatus = HttpStatus.SC_OK;
- QueryNetworkResponse resp = new QueryNetworkResponse(networkStackId, null, networkStackId, null, null);
- Holder<Boolean> networkExists = new Holder<>();
- Holder<String> networkId = new Holder<>();
- Holder<String> neutronNetworkId = new Holder<>();
- Holder<NetworkStatus> status = new Holder<>();
- Holder<List<RouteTarget>> routeTargets = new Holder<>();
- Holder<Map<String, String>> subnetIdMap = new Holder<>();
-
- adapter.queryNetworkContrail(cloudSiteId, tenantId, aaiNetworkId, msoRequest, networkExists, networkId,
- neutronNetworkId, status, routeTargets, subnetIdMap);
-
- if (!networkExists.value) {
- logger.debug("network not found");
- respStatus = HttpStatus.SC_NOT_FOUND;
- } else {
- logger.debug("network found {}, status={}", networkId.value, status.value);
- resp.setNetworkExists(networkExists.value);
- resp.setNetworkId(networkId.value);
- resp.setNeutronNetworkId(neutronNetworkId.value);
- resp.setNetworkStatus(status.value);
- resp.setRouteTargets(routeTargets.value);
- resp.setSubnetIdMap(subnetIdMap.value);
- }
- logger.debug("Query network exit");
- return Response.status(respStatus).entity(new GenericEntity<QueryNetworkResponse>(resp) {}).build();
- } catch (NetworkException e) {
- logger.error("{} {} Exception when query VNF ", MessageEnum.RA_QUERY_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- QueryNetworkError err = new QueryNetworkError();
- err.setMessage(e.getMessage());
- err.setCategory(MsoExceptionCategory.INTERNAL);
- return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<QueryNetworkError>(err) {}).build();
- }
- }
-
- @DELETE
- @Path("{aaiNetworkId}/rollback")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "RollbackNetwork", response = Response.class, notes = "Rollback an existing network")
- @ApiResponses({@ApiResponse(code = 200, message = "Rollback network successful"),
- @ApiResponse(code = 202, message = "Rollback network request has been accepted (async only)"),
- @ApiResponse(code = 500, message = "Rollback network failed, examine entity object for details")})
- public Response rollbackNetwork(
- @ApiParam(value = "RollbackNetworkRequest in JSON format", required = true) RollbackNetworkRequest req) {
- logger.debug("rollbackNetwork enter: {}", req.toJsonString());
- RollbackNetworkTask task = new RollbackNetworkTask(req);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} Exception in rollbackNetwork ", MessageEnum.RA_ROLLBACK_NULL,
- ErrorCode.BusinessProcessError.getValue(), e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("rollbackNetwork exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class RollbackNetworkTask implements Runnable {
- private final RollbackNetworkRequest req;
- private RollbackNetworkResponse response = null;
- private RollbackNetworkError eresp = null;
- private boolean sendxml;
-
- public RollbackNetworkTask(RollbackNetworkRequest req) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<RollbackNetworkResponse>(response) {}
- : new GenericEntity<RollbackNetworkError>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getNetworkRollback().getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- logger.debug("RollbackNetworkTask start");
- try {
- NetworkRollback nwr = req.getNetworkRollback();
- adapter.rollbackNetwork(nwr);
- response = new RollbackNetworkResponse(true, req.getMessageId());
- } catch (NetworkException e) {
- logger.debug(exceptionMsg, e);
- eresp = new RollbackNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("RollbackNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse());
- }
- }
-
- @PUT
- @Path("{aaiNetworkId}")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "UpdateNetwork", response = Response.class, notes = "Update an existing network")
- @ApiResponses({@ApiResponse(code = 200, message = "Update network successful"),
- @ApiResponse(code = 202, message = "Update network request has been accepted (async only)"),
- @ApiResponse(code = 500, message = "Update network failed, examine entity object for details")})
- public Response updateNetwork(
- @ApiParam(value = "aaiNetworkId", required = true) @PathParam("aaiNetworkId") String aaiNetworkId,
- @ApiParam(value = "UpdateNetworkRequest in JSON format", required = true) UpdateNetworkRequest req) {
- logger.debug("updateNetwork enter: {}", req.toJsonString());
- if (aaiNetworkId == null || !aaiNetworkId.equals(req.getNetworkId())) {
- return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN).entity(
- "A&AI NetworkId in URL (" + aaiNetworkId + ") does not match content (" + req.getNetworkId() + ")")
- .build();
- }
- UpdateNetworkTask task = new UpdateNetworkTask(req);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} Exception in updateNetwork ", MessageEnum.RA_UPDATE_NETWORK_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("updateNetwork exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class UpdateNetworkTask implements Runnable {
- private final UpdateNetworkRequest req;
- private UpdateNetworkResponse response = null;
- private UpdateNetworkError eresp = null;
- private boolean sendxml;
-
- public UpdateNetworkTask(UpdateNetworkRequest req) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<UpdateNetworkResponse>(response) {}
- : new GenericEntity<UpdateNetworkError>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- logger.debug("UpdateNetworkTask start");
- try {
- Holder<Map<String, String>> subnetIdMap = new Holder<>();
- Holder<NetworkRollback> rollback = new Holder<>();
- HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams();
- if (params == null) {
- params = new HashMap<String, String>();
- }
- String shared = null;
- String external = null;
-
- if (req.getCloudSiteId().equals(TESTING_KEYWORD)) {
- subnetIdMap.value = testMap();
- NetworkRollback rb = new NetworkRollback();
- rb.setCloudId(req.getCloudSiteId());
- rb.setTenantId(req.getTenantId());
- rb.setMsoRequest(req.getMsoRequest());
- rollback.value = rb;
- } else if (req.isContrailRequest()) {
- ContrailNetwork ctn = req.getContrailNetwork();
- if (ctn == null) {
- ctn = new ContrailNetwork();
- req.setContrailNetwork(ctn);
- }
- if (params.containsKey(SHARED)) {
- shared = params.get(SHARED);
- } else {
- if (ctn.getShared() != null) {
- shared = ctn.getShared();
- }
- }
- if (params.containsKey(EXTERNAL)) {
- external = params.get(EXTERNAL);
- } else {
- if (ctn.getExternal() != null) {
- external = ctn.getExternal();
- }
- }
- adapter.updateNetworkContrail(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
- req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getNetworkName(),
- req.getContrailNetwork().getRouteTargets(), shared, external, req.getSubnets(), params,
- req.getContrailNetwork().getPolicyFqdns(), req.getContrailNetwork().getRouteTableFqdns(),
- req.getMsoRequest(), subnetIdMap, rollback);
- } else {
- ProviderVlanNetwork pvn = req.getProviderVlanNetwork();
- if (pvn == null) {
- pvn = new ProviderVlanNetwork();
- req.setProviderVlanNetwork(pvn);
- }
- if (params.containsKey(SHARED)) {
- shared = params.get(SHARED);
- }
- if (params.containsKey(EXTERNAL)) {
- external = params.get(EXTERNAL);
- }
- adapter.updateNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
- req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getNetworkName(),
- req.getProviderVlanNetwork().getPhysicalNetworkName(),
- req.getProviderVlanNetwork().getVlans(), shared, external, req.getSubnets(), params,
- req.getMsoRequest(), subnetIdMap, rollback);
- }
- response = new UpdateNetworkResponse(req.getNetworkId(), null, // NeutronNetworkId is not available from
- // an update
- subnetIdMap.value, req.getMessageId());
- } catch (NetworkException e) {
- logger.debug(exceptionMsg, e);
- eresp = new UpdateNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("UpdateNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse());
- }
- }
-
- public static Map<String, String> testMap() {
- Map<String, String> m = new HashMap<>();
- m.put("mickey", "7");
- m.put("clyde", "10");
- m.put("wayne", "99");
- return m;
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotification.java
deleted file mode 100644
index f30ccf2214..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotification.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (C) 2018 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.network.async.client;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>
- * Java class for createNetworkNotification complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="createNetworkNotification">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * &lt;element name="exception" type="{http://org.onap.so/networkNotify}msoExceptionCategory" minOccurs="0"/>
- * &lt;element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="networkId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="neutronNetworkId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="subnetIdMap" minOccurs="0">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;element name="rollback" type="{http://org.onap.so/networkNotify}networkRollback" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "createNetworkNotification", propOrder = {"messageId", "completed", "exception", "errorMessage",
- "networkId", "neutronNetworkId", "subnetIdMap", "rollback"})
-public class CreateNetworkNotification {
-
- @XmlElement(required = true)
- protected String messageId;
- protected boolean completed;
- protected MsoExceptionCategory exception;
- protected String errorMessage;
- protected String networkId;
- protected String neutronNetworkId;
- protected CreateNetworkNotification.SubnetIdMap subnetIdMap;
- protected NetworkRollback rollback;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the completed property.
- *
- */
- public boolean isCompleted() {
- return completed;
- }
-
- /**
- * Sets the value of the completed property.
- *
- */
- public void setCompleted(boolean value) {
- this.completed = value;
- }
-
- /**
- * Gets the value of the exception property.
- *
- * @return possible object is {@link MsoExceptionCategory }
- *
- */
- public MsoExceptionCategory getException() {
- return exception;
- }
-
- /**
- * Sets the value of the exception property.
- *
- * @param value allowed object is {@link MsoExceptionCategory }
- *
- */
- public void setException(MsoExceptionCategory value) {
- this.exception = value;
- }
-
- /**
- * Gets the value of the errorMessage property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Sets the value of the errorMessage property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setErrorMessage(String value) {
- this.errorMessage = value;
- }
-
- /**
- * Gets the value of the networkId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getNetworkId() {
- return networkId;
- }
-
- /**
- * Sets the value of the networkId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setNetworkId(String value) {
- this.networkId = value;
- }
-
- /**
- * Gets the value of the neutronNetworkId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getNeutronNetworkId() {
- return neutronNetworkId;
- }
-
- /**
- * Sets the value of the neutronNetworkId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setNeutronNetworkId(String value) {
- this.neutronNetworkId = value;
- }
-
- /**
- * Gets the value of the subnetIdMap property.
- *
- * @return possible object is {@link CreateNetworkNotification.SubnetIdMap }
- *
- */
- public CreateNetworkNotification.SubnetIdMap getSubnetIdMap() {
- return subnetIdMap;
- }
-
- /**
- * Sets the value of the subnetIdMap property.
- *
- * @param value allowed object is {@link CreateNetworkNotification.SubnetIdMap }
- *
- */
- public void setSubnetIdMap(CreateNetworkNotification.SubnetIdMap value) {
- this.subnetIdMap = value;
- }
-
- /**
- * Gets the value of the rollback property.
- *
- * @return possible object is {@link NetworkRollback }
- *
- */
- public NetworkRollback getRollback() {
- return rollback;
- }
-
- /**
- * Sets the value of the rollback property.
- *
- * @param value allowed object is {@link NetworkRollback }
- *
- */
- public void setRollback(NetworkRollback value) {
- this.rollback = value;
- }
-
-
- /**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {"entry"})
- public static class SubnetIdMap {
-
- protected List<CreateNetworkNotification.SubnetIdMap.Entry> entry;
-
- /**
- * Gets the value of the entry property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you
- * make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE>
- * method for the entry property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getEntry().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list {@link CreateNetworkNotification.SubnetIdMap.Entry }
- *
- *
- */
- public List<CreateNetworkNotification.SubnetIdMap.Entry> getEntry() {
- if (entry == null) {
- entry = new ArrayList<>();
- }
- return this.entry;
- }
-
-
- /**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {"key", "value"})
- public static class Entry {
-
- protected String key;
- protected String value;
-
- /**
- * Gets the value of the key property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getKey() {
- return key;
- }
-
- /**
- * Sets the value of the key property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setKey(String value) {
- this.key = value;
- }
-
- /**
- * Gets the value of the value property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets the value of the value property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setValue(String value) {
- this.value = value;
- }
-
- }
-
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotificationResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotificationResponse.java
deleted file mode 100644
index 4ade875193..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotificationResponse.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network.async.client;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>
- * Java class for createNetworkNotificationResponse complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="createNetworkNotificationResponse">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "createNetworkNotificationResponse")
-public class CreateNetworkNotificationResponse {
-
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotification.java
deleted file mode 100644
index ff94be9156..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotification.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network.async.client;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>
- * Java class for deleteNetworkNotification complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="deleteNetworkNotification">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * &lt;element name="exception" type="{http://org.onap.so/networkNotify}msoExceptionCategory" minOccurs="0"/>
- * &lt;element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="networkDeleted" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "deleteNetworkNotification",
- propOrder = {"messageId", "completed", "exception", "errorMessage", "networkDeleted"})
-public class DeleteNetworkNotification {
-
- @XmlElement(required = true)
- protected String messageId;
- protected boolean completed;
- protected MsoExceptionCategory exception;
- protected String errorMessage;
- protected Boolean networkDeleted;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the completed property.
- *
- */
- public boolean isCompleted() {
- return completed;
- }
-
- /**
- * Sets the value of the completed property.
- *
- */
- public void setCompleted(boolean value) {
- this.completed = value;
- }
-
- /**
- * Gets the value of the exception property.
- *
- * @return possible object is {@link MsoExceptionCategory }
- *
- */
- public MsoExceptionCategory getException() {
- return exception;
- }
-
- /**
- * Sets the value of the exception property.
- *
- * @param value allowed object is {@link MsoExceptionCategory }
- *
- */
- public void setException(MsoExceptionCategory value) {
- this.exception = value;
- }
-
- /**
- * Gets the value of the errorMessage property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Sets the value of the errorMessage property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setErrorMessage(String value) {
- this.errorMessage = value;
- }
-
- /**
- * Gets the value of the networkDeleted property.
- *
- * @return possible object is {@link Boolean }
- *
- */
- public Boolean isNetworkDeleted() {
- return networkDeleted;
- }
-
- /**
- * Sets the value of the networkDeleted property.
- *
- * @param value allowed object is {@link Boolean }
- *
- */
- public void setNetworkDeleted(Boolean value) {
- this.networkDeleted = value;
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotificationResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotificationResponse.java
deleted file mode 100644
index 7f7d0ae569..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotificationResponse.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network.async.client;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>
- * Java class for deleteNetworkNotificationResponse complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="deleteNetworkNotificationResponse">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "deleteNetworkNotificationResponse")
-public class DeleteNetworkNotificationResponse {
-
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoExceptionCategory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoExceptionCategory.java
deleted file mode 100644
index ad3c541730..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoExceptionCategory.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network.async.client;
-
-import javax.xml.bind.annotation.XmlEnum;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>
- * Java class for msoExceptionCategory.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- * <p>
- *
- * <pre>
- * &lt;simpleType name="msoExceptionCategory">
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
- * &lt;enumeration value="OPENSTACK"/>
- * &lt;enumeration value="IO"/>
- * &lt;enumeration value="INTERNAL"/>
- * &lt;enumeration value="USERDATA"/>
- * &lt;/restriction>
- * &lt;/simpleType>
- * </pre>
- *
- */
-@XmlType(name = "msoExceptionCategory")
-@XmlEnum
-public enum MsoExceptionCategory {
-
- OPENSTACK, IO, INTERNAL, USERDATA;
-
- public String value() {
- return name();
- }
-
- public static MsoExceptionCategory fromValue(String v) {
- return valueOf(v);
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoRequest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoRequest.java
deleted file mode 100644
index 90ae448660..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoRequest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network.async.client;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>
- * Java class for msoRequest complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="msoRequest">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="requestId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="serviceInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "msoRequest", propOrder = {"requestId", "serviceInstanceId"})
-public class MsoRequest {
-
- protected String requestId;
- protected String serviceInstanceId;
-
- /**
- * Gets the value of the requestId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getRequestId() {
- return requestId;
- }
-
- /**
- * Sets the value of the requestId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setRequestId(String value) {
- this.requestId = value;
- }
-
- /**
- * Gets the value of the serviceInstanceId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
-
- /**
- * Sets the value of the serviceInstanceId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setServiceInstanceId(String value) {
- this.serviceInstanceId = value;
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify.java
deleted file mode 100644
index 8fb62cc32e..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network.async.client;
-
-import java.util.List;
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebService;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.ws.Action;
-import javax.xml.ws.RequestWrapper;
-import javax.xml.ws.ResponseWrapper;
-
-
-/**
- * This class was generated by the JAX-WS RI. JAX-WS RI 2.2.9-b14002 Generated source version: 2.2
- *
- */
-@WebService(name = "networkAdapterNotify", targetNamespace = "http://org.onap.so/networkNotify")
-@XmlSeeAlso({ObjectFactory.class})
-public interface NetworkAdapterNotify {
-
-
- /**
- *
- * @param exception
- * @param errorMessage
- * @param messageId
- * @param completed
- */
- @WebMethod
- @RequestWrapper(localName = "rollbackNetworkNotification", targetNamespace = "http://org.onap.so/networkNotify",
- className = "org.onap.so.adapters.network.async.client.RollbackNetworkNotification")
- @ResponseWrapper(localName = "rollbackNetworkNotificationResponse",
- targetNamespace = "http://org.onap.so/networkNotify",
- className = "org.onap.so.adapters.network.async.client.RollbackNetworkNotificationResponse")
- @Action(input = "http://org.onap.so/notify/adapterNotify/rollbackNetworkNotificationRequest",
- output = "http://org.onap.so/notify/adapterNotify/rollbackNetworkNotificationResponse")
- public void rollbackNetworkNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
- @WebParam(name = "completed", targetNamespace = "") boolean completed,
- @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage);
-
- /**
- *
- * @param exception
- * @param vlans
- * @param networkExists
- * @param errorMessage
- * @param messageId
- * @param networkId
- * @param completed
- * @param neutronNetworkId
- * @param status
- * @param subnetIdMap
- */
- @WebMethod
- @RequestWrapper(localName = "queryNetworkNotification", targetNamespace = "http://org.onap.so/networkNotify",
- className = "org.onap.so.adapters.network.async.client.QueryNetworkNotification")
- @ResponseWrapper(localName = "queryNetworkNotificationResponse",
- targetNamespace = "http://org.onap.so/networkNotify",
- className = "org.onap.so.adapters.network.async.client.QueryNetworkNotificationResponse")
- @Action(input = "http://org.onap.so/notify/adapterNotify/queryNetworkNotificationRequest",
- output = "http://org.onap.so/notify/adapterNotify/queryNetworkNotificationResponse")
- public void queryNetworkNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
- @WebParam(name = "completed", targetNamespace = "") boolean completed,
- @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage,
- @WebParam(name = "networkExists", targetNamespace = "") Boolean networkExists,
- @WebParam(name = "networkId", targetNamespace = "") String networkId,
- @WebParam(name = "neutronNetworkId", targetNamespace = "") String neutronNetworkId,
- @WebParam(name = "status", targetNamespace = "") NetworkStatus status,
- @WebParam(name = "vlans", targetNamespace = "") List<Integer> vlans, @WebParam(name = "subnetIdMap",
- targetNamespace = "") org.onap.so.adapters.network.async.client.QueryNetworkNotification.SubnetIdMap subnetIdMap);
-
- /**
- *
- * @param exception
- * @param rollback
- * @param errorMessage
- * @param messageId
- * @param networkId
- * @param completed
- * @param neutronNetworkId
- * @param subnetIdMap
- */
- @WebMethod
- @RequestWrapper(localName = "createNetworkNotification", targetNamespace = "http://org.onap.so/networkNotify",
- className = "org.onap.so.adapters.network.async.client.CreateNetworkNotification")
- @ResponseWrapper(localName = "createNetworkNotificationResponse",
- targetNamespace = "http://org.onap.so/networkNotify",
- className = "org.onap.so.adapters.network.async.client.CreateNetworkNotificationResponse")
- @Action(input = "http://org.onap.so/notify/adapterNotify/createNetworkNotificationRequest",
- output = "http://org.onap.so/notify/adapterNotify/createNetworkNotificationResponse")
- public void createNetworkNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
- @WebParam(name = "completed", targetNamespace = "") boolean completed,
- @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage,
- @WebParam(name = "networkId", targetNamespace = "") String networkId,
- @WebParam(name = "neutronNetworkId", targetNamespace = "") String neutronNetworkId,
- @WebParam(name = "subnetIdMap",
- targetNamespace = "") org.onap.so.adapters.network.async.client.CreateNetworkNotification.SubnetIdMap subnetIdMap,
- @WebParam(name = "rollback", targetNamespace = "") NetworkRollback rollback);
-
- /**
- *
- * @param exception
- * @param networkDeleted
- * @param errorMessage
- * @param messageId
- * @param completed
- */
- @WebMethod
- @RequestWrapper(localName = "deleteNetworkNotification", targetNamespace = "http://org.onap.so/networkNotify",
- className = "org.onap.so.adapters.network.async.client.DeleteNetworkNotification")
- @ResponseWrapper(localName = "deleteNetworkNotificationResponse",
- targetNamespace = "http://org.onap.so/networkNotify",
- className = "org.onap.so.adapters.network.async.client.DeleteNetworkNotificationResponse")
- @Action(input = "http://org.onap.so/notify/adapterNotify/deleteNetworkNotificationRequest",
- output = "http://org.onap.so/notify/adapterNotify/deleteNetworkNotificationResponse")
- public void deleteNetworkNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
- @WebParam(name = "completed", targetNamespace = "") boolean completed,
- @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage,
- @WebParam(name = "networkDeleted", targetNamespace = "") Boolean networkDeleted);
-
- /**
- *
- * @param exception
- * @param rollback
- * @param errorMessage
- * @param messageId
- * @param completed
- * @param subnetIdMap
- */
- @WebMethod
- @RequestWrapper(localName = "updateNetworkNotification", targetNamespace = "http://org.onap.so/networkNotify",
- className = "org.onap.so.adapters.network.async.client.UpdateNetworkNotification")
- @ResponseWrapper(localName = "updateNetworkNotificationResponse",
- targetNamespace = "http://org.onap.so/networkNotify",
- className = "org.onap.so.adapters.network.async.client.UpdateNetworkNotificationResponse")
- @Action(input = "http://org.onap.so/notify/adapterNotify/updateNetworkNotificationRequest",
- output = "http://org.onap.so/notify/adapterNotify/updateNetworkNotificationResponse")
- public void updateNetworkNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId,
- @WebParam(name = "completed", targetNamespace = "") boolean completed,
- @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage,
- @WebParam(name = "subnetIdMap",
- targetNamespace = "") org.onap.so.adapters.network.async.client.UpdateNetworkNotification.SubnetIdMap subnetIdMap,
- @WebParam(name = "rollback", targetNamespace = "") NetworkRollback rollback);
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java
deleted file mode 100644
index 68142e6cc9..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (C) 2018 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.network.async.client;
-
-import java.net.URL;
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-import javax.xml.ws.WebEndpoint;
-import javax.xml.ws.WebServiceClient;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.WebServiceFeature;
-
-
-/**
- * This class was generated by the JAX-WS RI. JAX-WS RI 2.2.9-b14002 Generated source version: 2.2
- *
- */
-@WebServiceClient(name = "networkAdapterNotify", targetNamespace = "http://org.onap.so/networkNotify",
- wsdlLocation = "/NetworkAdapterNotify.wsdl")
-public class NetworkAdapterNotify_Service extends Service {
-
- private static final URL NETWORKADAPTERNOTIFY_WSDL_LOCATION;
- private static final WebServiceException NETWORKADAPTERNOTIFY_EXCEPTION;
- private static final String URL = "http://org.onap.so/networkNotify";
- private static final QName NETWORKADAPTERNOTIFY_QNAME = new QName(URL, "networkAdapterNotify");
-
- static {
- NETWORKADAPTERNOTIFY_WSDL_LOCATION =
- org.onap.so.adapters.network.async.client.NetworkAdapterNotify_Service.class
- .getResource("/NetworkAdapterNotify.wsdl");
- WebServiceException e = null;
- if (NETWORKADAPTERNOTIFY_WSDL_LOCATION == null) {
- e = new WebServiceException(
- "Cannot find '/NetworkAdapterNotify.wsdl' wsdl. Place the resource correctly in the classpath.");
- }
- NETWORKADAPTERNOTIFY_EXCEPTION = e;
- }
-
- public NetworkAdapterNotify_Service() {
- super(getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME);
- }
-
- public NetworkAdapterNotify_Service(WebServiceFeature... features) {
- super(getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME, features);
- }
-
- public NetworkAdapterNotify_Service(URL wsdlLocation) {
- super(wsdlLocation, NETWORKADAPTERNOTIFY_QNAME);
- }
-
- public NetworkAdapterNotify_Service(URL wsdlLocation, WebServiceFeature... features) {
- super(wsdlLocation, NETWORKADAPTERNOTIFY_QNAME, features);
- }
-
- public NetworkAdapterNotify_Service(URL wsdlLocation, QName serviceName) {
- super(wsdlLocation, serviceName);
- }
-
- public NetworkAdapterNotify_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {
- super(wsdlLocation, serviceName, features);
- }
-
- /**
- *
- * @return returns NetworkAdapterNotify
- */
- @WebEndpoint(name = "MsoNetworkAdapterAsyncImplPort")
- public NetworkAdapterNotify getMsoNetworkAdapterAsyncImplPort() {
- return super.getPort(new QName(URL, "MsoNetworkAdapterAsyncImplPort"), NetworkAdapterNotify.class);
- }
-
- /**
- *
- * @param features A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features
- * not in the <code>features</code> parameter will have their default values.
- * @return returns NetworkAdapterNotify
- */
- @WebEndpoint(name = "MsoNetworkAdapterAsyncImplPort")
- public NetworkAdapterNotify getMsoNetworkAdapterAsyncImplPort(WebServiceFeature... features) {
- return super.getPort(new QName(URL, "MsoNetworkAdapterAsyncImplPort"), NetworkAdapterNotify.class, features);
- }
-
- private static URL getWsdlLocation() {
- if (NETWORKADAPTERNOTIFY_EXCEPTION != null) {
- throw NETWORKADAPTERNOTIFY_EXCEPTION;
- }
- return NETWORKADAPTERNOTIFY_WSDL_LOCATION;
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkRollback.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkRollback.java
deleted file mode 100644
index c51a21d5f0..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkRollback.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (C) 2018 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.network.async.client;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>
- * Java class for networkRollback complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="networkRollback">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="cloudId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="msoRequest" type="{http://org.onap.so/networkNotify}msoRequest" minOccurs="0"/>
- * &lt;element name="networkCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * &lt;element name="networkId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="networkStackId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="networkName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="networkType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="networkUpdated" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * &lt;element name="neutronNetworkId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="physicalNetwork" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="tenantId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="vlans" type="{http://www.w3.org/2001/XMLSchema}int" maxOccurs="unbounded" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "networkRollback",
- propOrder = {"cloudId", "msoRequest", "networkCreated", "networkId", "networkStackId", "networkName",
- "networkType", "networkUpdated", "neutronNetworkId", "physicalNetwork", "tenantId", "vlans"})
-public class NetworkRollback {
-
- protected String cloudId;
- protected MsoRequest msoRequest;
- protected boolean networkCreated;
- protected String networkId;
- protected String networkStackId;
- protected String networkName;
- protected String networkType;
- protected boolean networkUpdated;
- protected String neutronNetworkId;
- protected String physicalNetwork;
- protected String tenantId;
- @XmlElement(nillable = true)
- protected List<Integer> vlans;
-
- /**
- * Gets the value of the cloudId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getCloudId() {
- return cloudId;
- }
-
- /**
- * Sets the value of the cloudId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setCloudId(String value) {
- this.cloudId = value;
- }
-
- /**
- * Gets the value of the msoRequest property.
- *
- * @return possible object is {@link MsoRequest }
- *
- */
- public MsoRequest getMsoRequest() {
- return msoRequest;
- }
-
- /**
- * Sets the value of the msoRequest property.
- *
- * @param value allowed object is {@link MsoRequest }
- *
- */
- public void setMsoRequest(MsoRequest value) {
- this.msoRequest = value;
- }
-
- /**
- * Gets the value of the networkCreated property.
- *
- */
- public boolean isNetworkCreated() {
- return networkCreated;
- }
-
- /**
- * Sets the value of the networkCreated property.
- *
- */
- public void setNetworkCreated(boolean value) {
- this.networkCreated = value;
- }
-
- /**
- * Gets the value of the networkId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getNetworkId() {
- return networkId;
- }
-
- /**
- * Sets the value of the networkId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setNetworkId(String value) {
- this.networkId = value;
- }
-
- /**
- * Gets the value of the networkStackId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getNetworkStackId() {
- return networkStackId;
- }
-
- /**
- * Sets the value of the networkStackId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setNetworkStackId(String value) {
- this.networkStackId = value;
- }
-
- /**
- * Gets the value of the networkName property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getNetworkName() {
- return networkName;
- }
-
- /**
- * Sets the value of the networkName property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setNetworkName(String value) {
- this.networkName = value;
- }
-
- /**
- * Gets the value of the networkType property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getNetworkType() {
- return networkType;
- }
-
- /**
- * Sets the value of the networkType property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setNetworkType(String value) {
- this.networkType = value;
- }
-
- /**
- * Gets the value of the networkUpdated property.
- *
- */
- public boolean isNetworkUpdated() {
- return networkUpdated;
- }
-
- /**
- * Sets the value of the networkUpdated property.
- *
- */
- public void setNetworkUpdated(boolean value) {
- this.networkUpdated = value;
- }
-
- /**
- * Gets the value of the neutronNetworkId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getNeutronNetworkId() {
- return neutronNetworkId;
- }
-
- /**
- * Sets the value of the neutronNetworkId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setNeutronNetworkId(String value) {
- this.neutronNetworkId = value;
- }
-
- /**
- * Gets the value of the physicalNetwork property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getPhysicalNetwork() {
- return physicalNetwork;
- }
-
- /**
- * Sets the value of the physicalNetwork property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setPhysicalNetwork(String value) {
- this.physicalNetwork = value;
- }
-
- /**
- * Gets the value of the tenantId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getTenantId() {
- return tenantId;
- }
-
- /**
- * Sets the value of the tenantId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setTenantId(String value) {
- this.tenantId = value;
- }
-
- /**
- * Gets the value of the vlans property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to
- * the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for
- * the vlans property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getVlans().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list {@link Integer }
- *
- *
- */
- public List<Integer> getVlans() {
- if (vlans == null) {
- vlans = new ArrayList<>();
- }
- return this.vlans;
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkStatus.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkStatus.java
deleted file mode 100644
index 36641477c0..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkStatus.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network.async.client;
-
-import javax.xml.bind.annotation.XmlEnum;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>
- * Java class for networkStatus.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- * <p>
- *
- * <pre>
- * &lt;simpleType name="networkStatus">
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
- * &lt;enumeration value="NOTFOUND"/>
- * &lt;enumeration value="ACTIVE"/>
- * &lt;enumeration value="DOWN"/>
- * &lt;enumeration value="BUILD"/>
- * &lt;enumeration value="ERROR"/>
- * &lt;enumeration value="UNKNOWN"/>
- * &lt;/restriction>
- * &lt;/simpleType>
- * </pre>
- *
- */
-@XmlType(name = "networkStatus")
-@XmlEnum
-public enum NetworkStatus {
-
- NOTFOUND, ACTIVE, DOWN, BUILD, ERROR, UNKNOWN;
-
- public String value() {
- return name();
- }
-
- public static NetworkStatus fromValue(String v) {
- return valueOf(v);
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java
deleted file mode 100644
index a7a2974660..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network.async.client;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.annotation.XmlElementDecl;
-import javax.xml.bind.annotation.XmlRegistry;
-import javax.xml.namespace.QName;
-
-
-/**
- * This object contains factory methods for each Java content interface and Java element interface generated in the
- * org.onap.so.adapters.network.async.client package.
- * <p>
- * An ObjectFactory allows you to programatically construct new instances of the Java representation for XML content.
- * The Java representation of XML content can consist of schema derived interfaces and classes representing the binding
- * of schema type definitions, element declarations and model groups. Factory methods for each of these are provided in
- * this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
- private static final String URL = "http://org.onap.so/networkNotify";
- private static final QName _RollbackNetworkNotification_QNAME = new QName(URL, "rollbackNetworkNotification");
- private static final QName _UpdateNetworkNotification_QNAME = new QName(URL, "updateNetworkNotification");
- private static final QName _QueryNetworkNotificationResponse_QNAME =
- new QName(URL, "queryNetworkNotificationResponse");
- private static final QName _UpdateNetworkNotificationResponse_QNAME =
- new QName(URL, "updateNetworkNotificationResponse");
- private static final QName _CreateNetworkNotificationResponse_QNAME =
- new QName(URL, "createNetworkNotificationResponse");
- private static final QName _DeleteNetworkNotification_QNAME = new QName(URL, "deleteNetworkNotification");
- private static final QName _DeleteNetworkNotificationResponse_QNAME =
- new QName(URL, "deleteNetworkNotificationResponse");
- private static final QName _CreateNetworkNotification_QNAME = new QName(URL, "createNetworkNotification");
- private static final QName _QueryNetworkNotification_QNAME = new QName(URL, "queryNetworkNotification");
- private static final QName _RollbackNetworkNotificationResponse_QNAME =
- new QName(URL, "rollbackNetworkNotificationResponse");
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package:
- * org.onap.so.adapters.network.async.client
- *
- */
- public ObjectFactory() {}
-
- /**
- * Create an instance of {@link QueryNetworkNotification }
- *
- */
- public QueryNetworkNotification createQueryNetworkNotification() {
- return new QueryNetworkNotification();
- }
-
- /**
- * Create an instance of {@link QueryNetworkNotification.SubnetIdMap }
- *
- */
- public QueryNetworkNotification.SubnetIdMap createQueryNetworkNotificationSubnetIdMap() {
- return new QueryNetworkNotification.SubnetIdMap();
- }
-
- /**
- * Create an instance of {@link CreateNetworkNotification }
- *
- */
- public CreateNetworkNotification createCreateNetworkNotification() {
- return new CreateNetworkNotification();
- }
-
- /**
- * Create an instance of {@link CreateNetworkNotification.SubnetIdMap }
- *
- */
- public CreateNetworkNotification.SubnetIdMap createCreateNetworkNotificationSubnetIdMap() {
- return new CreateNetworkNotification.SubnetIdMap();
- }
-
- /**
- * Create an instance of {@link UpdateNetworkNotification }
- *
- */
- public UpdateNetworkNotification createUpdateNetworkNotification() {
- return new UpdateNetworkNotification();
- }
-
- /**
- * Create an instance of {@link UpdateNetworkNotification.SubnetIdMap }
- *
- */
- public UpdateNetworkNotification.SubnetIdMap createUpdateNetworkNotificationSubnetIdMap() {
- return new UpdateNetworkNotification.SubnetIdMap();
- }
-
- /**
- * Create an instance of {@link UpdateNetworkNotificationResponse }
- *
- */
- public UpdateNetworkNotificationResponse createUpdateNetworkNotificationResponse() {
- return new UpdateNetworkNotificationResponse();
- }
-
- /**
- * Create an instance of {@link CreateNetworkNotificationResponse }
- *
- */
- public CreateNetworkNotificationResponse createCreateNetworkNotificationResponse() {
- return new CreateNetworkNotificationResponse();
- }
-
- /**
- * Create an instance of {@link RollbackNetworkNotification }
- *
- */
- public RollbackNetworkNotification createRollbackNetworkNotification() {
- return new RollbackNetworkNotification();
- }
-
- /**
- * Create an instance of {@link QueryNetworkNotificationResponse }
- *
- */
- public QueryNetworkNotificationResponse createQueryNetworkNotificationResponse() {
- return new QueryNetworkNotificationResponse();
- }
-
- /**
- * Create an instance of {@link RollbackNetworkNotificationResponse }
- *
- */
- public RollbackNetworkNotificationResponse createRollbackNetworkNotificationResponse() {
- return new RollbackNetworkNotificationResponse();
- }
-
- /**
- * Create an instance of {@link DeleteNetworkNotification }
- *
- */
- public DeleteNetworkNotification createDeleteNetworkNotification() {
- return new DeleteNetworkNotification();
- }
-
- /**
- * Create an instance of {@link DeleteNetworkNotificationResponse }
- *
- */
- public DeleteNetworkNotificationResponse createDeleteNetworkNotificationResponse() {
- return new DeleteNetworkNotificationResponse();
- }
-
- /**
- * Create an instance of {@link NetworkRollback }
- *
- */
- public NetworkRollback createNetworkRollback() {
- return new NetworkRollback();
- }
-
- /**
- * Create an instance of {@link MsoRequest }
- *
- */
- public MsoRequest createMsoRequest() {
- return new MsoRequest();
- }
-
- /**
- * Create an instance of {@link QueryNetworkNotification.SubnetIdMap.Entry }
- *
- */
- public QueryNetworkNotification.SubnetIdMap.Entry createQueryNetworkNotificationSubnetIdMapEntry() {
- return new QueryNetworkNotification.SubnetIdMap.Entry();
- }
-
- /**
- * Create an instance of {@link CreateNetworkNotification.SubnetIdMap.Entry }
- *
- */
- public CreateNetworkNotification.SubnetIdMap.Entry createCreateNetworkNotificationSubnetIdMapEntry() {
- return new CreateNetworkNotification.SubnetIdMap.Entry();
- }
-
- /**
- * Create an instance of {@link UpdateNetworkNotification.SubnetIdMap.Entry }
- *
- */
- public UpdateNetworkNotification.SubnetIdMap.Entry createUpdateNetworkNotificationSubnetIdMapEntry() {
- return new UpdateNetworkNotification.SubnetIdMap.Entry();
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link RollbackNetworkNotification }{@code >}}
- *
- */
- @XmlElementDecl(namespace = URL, name = "rollbackNetworkNotification")
- public JAXBElement<RollbackNetworkNotification> createRollbackNetworkNotification(
- RollbackNetworkNotification value) {
- return new JAXBElement<>(_RollbackNetworkNotification_QNAME, RollbackNetworkNotification.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link UpdateNetworkNotification }{@code >}}
- *
- */
- @XmlElementDecl(namespace = URL, name = "updateNetworkNotification")
- public JAXBElement<UpdateNetworkNotification> createUpdateNetworkNotification(UpdateNetworkNotification value) {
- return new JAXBElement<>(_UpdateNetworkNotification_QNAME, UpdateNetworkNotification.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link QueryNetworkNotificationResponse }{@code >}}
- *
- */
- @XmlElementDecl(namespace = URL, name = "queryNetworkNotificationResponse")
- public JAXBElement<QueryNetworkNotificationResponse> createQueryNetworkNotificationResponse(
- QueryNetworkNotificationResponse value) {
- return new JAXBElement<>(_QueryNetworkNotificationResponse_QNAME, QueryNetworkNotificationResponse.class, null,
- value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link UpdateNetworkNotificationResponse }{@code >}}
- *
- */
- @XmlElementDecl(namespace = URL, name = "updateNetworkNotificationResponse")
- public JAXBElement<UpdateNetworkNotificationResponse> createUpdateNetworkNotificationResponse(
- UpdateNetworkNotificationResponse value) {
- return new JAXBElement<>(_UpdateNetworkNotificationResponse_QNAME, UpdateNetworkNotificationResponse.class,
- null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link CreateNetworkNotificationResponse }{@code >}}
- *
- */
- @XmlElementDecl(namespace = URL, name = "createNetworkNotificationResponse")
- public JAXBElement<CreateNetworkNotificationResponse> createCreateNetworkNotificationResponse(
- CreateNetworkNotificationResponse value) {
- return new JAXBElement<>(_CreateNetworkNotificationResponse_QNAME, CreateNetworkNotificationResponse.class,
- null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link DeleteNetworkNotification }{@code >}}
- *
- */
- @XmlElementDecl(namespace = URL, name = "deleteNetworkNotification")
- public JAXBElement<DeleteNetworkNotification> createDeleteNetworkNotification(DeleteNetworkNotification value) {
- return new JAXBElement<>(_DeleteNetworkNotification_QNAME, DeleteNetworkNotification.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link DeleteNetworkNotificationResponse }{@code >}}
- *
- */
- @XmlElementDecl(namespace = URL, name = "deleteNetworkNotificationResponse")
- public JAXBElement<DeleteNetworkNotificationResponse> createDeleteNetworkNotificationResponse(
- DeleteNetworkNotificationResponse value) {
- return new JAXBElement<>(_DeleteNetworkNotificationResponse_QNAME, DeleteNetworkNotificationResponse.class,
- null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link CreateNetworkNotification }{@code >}}
- *
- */
- @XmlElementDecl(namespace = URL, name = "createNetworkNotification")
- public JAXBElement<CreateNetworkNotification> createCreateNetworkNotification(CreateNetworkNotification value) {
- return new JAXBElement<>(_CreateNetworkNotification_QNAME, CreateNetworkNotification.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link QueryNetworkNotification }{@code >}}
- *
- */
- @XmlElementDecl(namespace = URL, name = "queryNetworkNotification")
- public JAXBElement<QueryNetworkNotification> createQueryNetworkNotification(QueryNetworkNotification value) {
- return new JAXBElement<>(_QueryNetworkNotification_QNAME, QueryNetworkNotification.class, null, value);
- }
-
- /**
- * Create an instance of {@link JAXBElement }{@code <}{@link RollbackNetworkNotificationResponse }{@code >}}
- *
- */
- @XmlElementDecl(namespace = URL, name = "rollbackNetworkNotificationResponse")
- public JAXBElement<RollbackNetworkNotificationResponse> createRollbackNetworkNotificationResponse(
- RollbackNetworkNotificationResponse value) {
- return new JAXBElement<>(_RollbackNetworkNotificationResponse_QNAME, RollbackNetworkNotificationResponse.class,
- null, value);
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotification.java
deleted file mode 100644
index d9adbf2ad2..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotification.java
+++ /dev/null
@@ -1,447 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (C) 2018 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.network.async.client;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>
- * Java class for queryNetworkNotification complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="queryNetworkNotification">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * &lt;element name="exception" type="{http://org.onap.so/networkNotify}msoExceptionCategory" minOccurs="0"/>
- * &lt;element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="networkExists" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- * &lt;element name="networkId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="neutronNetworkId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="status" type="{http://org.onap.so/networkNotify}networkStatus" minOccurs="0"/>
- * &lt;element name="vlans" type="{http://www.w3.org/2001/XMLSchema}int" maxOccurs="unbounded" minOccurs="0"/>
- * &lt;element name="subnetIdMap" minOccurs="0">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "queryNetworkNotification", propOrder = {"messageId", "completed", "exception", "errorMessage",
- "networkExists", "networkId", "neutronNetworkId", "status", "vlans", "subnetIdMap"})
-public class QueryNetworkNotification {
-
- @XmlElement(required = true)
- protected String messageId;
- protected boolean completed;
- protected MsoExceptionCategory exception;
- protected String errorMessage;
- protected Boolean networkExists;
- protected String networkId;
- protected String neutronNetworkId;
- protected NetworkStatus status;
- @XmlElement(type = Integer.class)
- protected List<Integer> vlans;
- protected QueryNetworkNotification.SubnetIdMap subnetIdMap;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the completed property.
- *
- */
- public boolean isCompleted() {
- return completed;
- }
-
- /**
- * Sets the value of the completed property.
- *
- */
- public void setCompleted(boolean value) {
- this.completed = value;
- }
-
- /**
- * Gets the value of the exception property.
- *
- * @return possible object is {@link MsoExceptionCategory }
- *
- */
- public MsoExceptionCategory getException() {
- return exception;
- }
-
- /**
- * Sets the value of the exception property.
- *
- * @param value allowed object is {@link MsoExceptionCategory }
- *
- */
- public void setException(MsoExceptionCategory value) {
- this.exception = value;
- }
-
- /**
- * Gets the value of the errorMessage property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Sets the value of the errorMessage property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setErrorMessage(String value) {
- this.errorMessage = value;
- }
-
- /**
- * Gets the value of the networkExists property.
- *
- * @return possible object is {@link Boolean }
- *
- */
- public Boolean isNetworkExists() {
- return networkExists;
- }
-
- /**
- * Sets the value of the networkExists property.
- *
- * @param value allowed object is {@link Boolean }
- *
- */
- public void setNetworkExists(Boolean value) {
- this.networkExists = value;
- }
-
- /**
- * Gets the value of the networkId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getNetworkId() {
- return networkId;
- }
-
- /**
- * Sets the value of the networkId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setNetworkId(String value) {
- this.networkId = value;
- }
-
- /**
- * Gets the value of the neutronNetworkId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getNeutronNetworkId() {
- return neutronNetworkId;
- }
-
- /**
- * Sets the value of the neutronNetworkId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setNeutronNetworkId(String value) {
- this.neutronNetworkId = value;
- }
-
- /**
- * Gets the value of the status property.
- *
- * @return possible object is {@link NetworkStatus }
- *
- */
- public NetworkStatus getStatus() {
- return status;
- }
-
- /**
- * Sets the value of the status property.
- *
- * @param value allowed object is {@link NetworkStatus }
- *
- */
- public void setStatus(NetworkStatus value) {
- this.status = value;
- }
-
- /**
- * Gets the value of the vlans property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to
- * the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for
- * the vlans property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getVlans().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list {@link Integer }
- *
- *
- */
- public List<Integer> getVlans() {
- if (vlans == null) {
- vlans = new ArrayList<>();
- }
- return this.vlans;
- }
-
- /**
- * Gets the value of the subnetIdMap property.
- *
- * @return possible object is {@link QueryNetworkNotification.SubnetIdMap }
- *
- */
- public QueryNetworkNotification.SubnetIdMap getSubnetIdMap() {
- return subnetIdMap;
- }
-
- /**
- * Sets the value of the subnetIdMap property.
- *
- * @param value allowed object is {@link QueryNetworkNotification.SubnetIdMap }
- *
- */
- public void setSubnetIdMap(QueryNetworkNotification.SubnetIdMap value) {
- this.subnetIdMap = value;
- }
-
-
- /**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {"entry"})
- public static class SubnetIdMap {
-
- protected List<QueryNetworkNotification.SubnetIdMap.Entry> entry;
-
- /**
- * Gets the value of the entry property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you
- * make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE>
- * method for the entry property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getEntry().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list {@link QueryNetworkNotification.SubnetIdMap.Entry }
- *
- *
- */
- public List<QueryNetworkNotification.SubnetIdMap.Entry> getEntry() {
- if (entry == null) {
- entry = new ArrayList<>();
- }
- return this.entry;
- }
-
-
- /**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {"key", "value"})
- public static class Entry {
-
- protected String key;
- protected String value;
-
- /**
- * Gets the value of the key property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getKey() {
- return key;
- }
-
- /**
- * Sets the value of the key property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setKey(String value) {
- this.key = value;
- }
-
- /**
- * Gets the value of the value property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets the value of the value property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setValue(String value) {
- this.value = value;
- }
-
- }
-
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotification.java
deleted file mode 100644
index 7b5d0f0f2a..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotification.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network.async.client;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>
- * Java class for rollbackNetworkNotification complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="rollbackNetworkNotification">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * &lt;element name="exception" type="{http://org.onap.so/networkNotify}msoExceptionCategory" minOccurs="0"/>
- * &lt;element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "rollbackNetworkNotification", propOrder = {"messageId", "completed", "exception", "errorMessage"})
-public class RollbackNetworkNotification {
-
- @XmlElement(required = true)
- protected String messageId;
- protected boolean completed;
- protected MsoExceptionCategory exception;
- protected String errorMessage;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the completed property.
- *
- */
- public boolean isCompleted() {
- return completed;
- }
-
- /**
- * Sets the value of the completed property.
- *
- */
- public void setCompleted(boolean value) {
- this.completed = value;
- }
-
- /**
- * Gets the value of the exception property.
- *
- * @return possible object is {@link MsoExceptionCategory }
- *
- */
- public MsoExceptionCategory getException() {
- return exception;
- }
-
- /**
- * Sets the value of the exception property.
- *
- * @param value allowed object is {@link MsoExceptionCategory }
- *
- */
- public void setException(MsoExceptionCategory value) {
- this.exception = value;
- }
-
- /**
- * Gets the value of the errorMessage property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Sets the value of the errorMessage property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setErrorMessage(String value) {
- this.errorMessage = value;
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotificationResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotificationResponse.java
deleted file mode 100644
index 7ddc8d75de..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotificationResponse.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network.async.client;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>
- * Java class for rollbackNetworkNotificationResponse complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="rollbackNetworkNotificationResponse">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "rollbackNetworkNotificationResponse")
-public class RollbackNetworkNotificationResponse {
-
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotification.java
deleted file mode 100644
index 1a464d3250..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotification.java
+++ /dev/null
@@ -1,350 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (C) 2018 IBM.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.network.async.client;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>
- * Java class for updateNetworkNotification complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="updateNetworkNotification">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * &lt;element name="exception" type="{http://org.onap.so/networkNotify}msoExceptionCategory" minOccurs="0"/>
- * &lt;element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="subnetIdMap" minOccurs="0">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;element name="rollback" type="{http://org.onap.so/networkNotify}networkRollback" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "updateNetworkNotification",
- propOrder = {"messageId", "completed", "exception", "errorMessage", "subnetIdMap", "rollback"})
-public class UpdateNetworkNotification {
-
- @XmlElement(required = true)
- protected String messageId;
- protected boolean completed;
- protected MsoExceptionCategory exception;
- protected String errorMessage;
- protected UpdateNetworkNotification.SubnetIdMap subnetIdMap;
- protected NetworkRollback rollback;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the completed property.
- *
- */
- public boolean isCompleted() {
- return completed;
- }
-
- /**
- * Sets the value of the completed property.
- *
- */
- public void setCompleted(boolean value) {
- this.completed = value;
- }
-
- /**
- * Gets the value of the exception property.
- *
- * @return possible object is {@link MsoExceptionCategory }
- *
- */
- public MsoExceptionCategory getException() {
- return exception;
- }
-
- /**
- * Sets the value of the exception property.
- *
- * @param value allowed object is {@link MsoExceptionCategory }
- *
- */
- public void setException(MsoExceptionCategory value) {
- this.exception = value;
- }
-
- /**
- * Gets the value of the errorMessage property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Sets the value of the errorMessage property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setErrorMessage(String value) {
- this.errorMessage = value;
- }
-
- /**
- * Gets the value of the subnetIdMap property.
- *
- * @return possible object is {@link UpdateNetworkNotification.SubnetIdMap }
- *
- */
- public UpdateNetworkNotification.SubnetIdMap getSubnetIdMap() {
- return subnetIdMap;
- }
-
- /**
- * Sets the value of the subnetIdMap property.
- *
- * @param value allowed object is {@link UpdateNetworkNotification.SubnetIdMap }
- *
- */
- public void setSubnetIdMap(UpdateNetworkNotification.SubnetIdMap value) {
- this.subnetIdMap = value;
- }
-
- /**
- * Gets the value of the rollback property.
- *
- * @return possible object is {@link NetworkRollback }
- *
- */
- public NetworkRollback getRollback() {
- return rollback;
- }
-
- /**
- * Sets the value of the rollback property.
- *
- * @param value allowed object is {@link NetworkRollback }
- *
- */
- public void setRollback(NetworkRollback value) {
- this.rollback = value;
- }
-
-
- /**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {"entry"})
- public static class SubnetIdMap {
-
- protected List<UpdateNetworkNotification.SubnetIdMap.Entry> entry;
-
- /**
- * Gets the value of the entry property.
- *
- * <p>
- * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you
- * make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE>
- * method for the entry property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- *
- * <pre>
- * getEntry().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list {@link UpdateNetworkNotification.SubnetIdMap.Entry }
- *
- *
- */
- public List<UpdateNetworkNotification.SubnetIdMap.Entry> getEntry() {
- if (entry == null) {
- entry = new ArrayList<>();
- }
- return this.entry;
- }
-
-
- /**
- * <p>
- * Java class for anonymous complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {"key", "value"})
- public static class Entry {
-
- protected String key;
- protected String value;
-
- /**
- * Gets the value of the key property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getKey() {
- return key;
- }
-
- /**
- * Sets the value of the key property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setKey(String value) {
- this.key = value;
- }
-
- /**
- * Gets the value of the value property.
- *
- * @return possible object is {@link String }
- *
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets the value of the value property.
- *
- * @param value allowed object is {@link String }
- *
- */
- public void setValue(String value) {
- this.value = value;
- }
-
- }
-
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotificationResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotificationResponse.java
deleted file mode 100644
index 0ffcb5e9e6..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotificationResponse.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network.async.client;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>
- * Java class for updateNetworkNotificationResponse complex type.
- *
- * <p>
- * The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="updateNetworkNotificationResponse">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "updateNetworkNotificationResponse")
-public class UpdateNetworkNotificationResponse {
-
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java
index 68b8598267..12e416f43c 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java
@@ -22,8 +22,8 @@ package org.onap.so.adapters.openstack;
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.aaiclient.client.aai.AAIProperties;
+import org.onap.aaiclient.client.aai.AAIVersion;
import org.onap.so.spring.SpringContextHelper;
import org.springframework.context.ApplicationContext;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
index 9badd795eb..a7bca73fdd 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
@@ -33,18 +33,11 @@ import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.onap.so.adapters.cloudregion.CloudRegionRestV1;
-import org.onap.so.adapters.network.MsoNetworkAdapterAsyncImpl;
import org.onap.so.adapters.network.MsoNetworkAdapterImpl;
-import org.onap.so.adapters.network.NetworkAdapterRest;
import org.onap.so.adapters.tenant.MsoTenantAdapterImpl;
import org.onap.so.adapters.tenant.TenantAdapterRest;
import org.onap.so.adapters.vnf.MsoVnfAdapterAsyncImpl;
import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
-import org.onap.so.adapters.vnf.MsoVnfCloudifyAdapterImpl;
-import org.onap.so.adapters.vnf.VnfAdapterRest;
-import org.onap.so.adapters.vnf.VnfAdapterRestV2;
-import org.onap.so.adapters.vnf.VolumeAdapterRest;
-import org.onap.so.adapters.vnf.VolumeAdapterRestV2;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor;
@@ -60,30 +53,16 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
@Configuration
public class CXFConfiguration {
@Autowired
- private NetworkAdapterRest networkAdapterRest;
- @Autowired
private TenantAdapterRest tenantAdapterRest;
@Autowired
- private VnfAdapterRest vnfAdapterRest;
- @Autowired
- private VnfAdapterRestV2 vnfAdapterRestV2;
- @Autowired
- private VolumeAdapterRest volumeAdapterRest;
- @Autowired
- private VolumeAdapterRestV2 volumeAdapterRestV2;
- @Autowired
private MsoNetworkAdapterImpl networkAdapterImpl;
@Autowired
- private MsoNetworkAdapterAsyncImpl networkAdapterAsyncImpl;
- @Autowired
private MsoTenantAdapterImpl tenantAdapterImpl;
@Autowired
private MsoVnfAdapterImpl vnfAdapterImpl;
@Autowired
private MsoVnfAdapterAsyncImpl vnfAdapterAsyncImpl;
@Autowired
- private MsoVnfCloudifyAdapterImpl vnfCloudifyAdapterImpl;
- @Autowired
private CloudRegionRestV1 cloudRegionRestV1;
@Autowired
private JettisonStyleMapperProvider jettisonStyleObjectMapper;
@@ -119,17 +98,6 @@ public class CXFConfiguration {
return endpoint;
}
- @Bean
- public Endpoint networkAdapterAsyncEndpoint() {
- EndpointImpl endpoint = new EndpointImpl(springBus(), networkAdapterAsyncImpl);
- endpoint.publish("/NetworkAdapterAsync");
- endpoint.setWsdlLocation("NetworkAdapterAsync.wsdl");
- endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor());
- endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor());
- endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
- return endpoint;
- }
-
/*
* tenant adapter endpoint
*/
@@ -169,24 +137,12 @@ public class CXFConfiguration {
return endpoint;
}
- @Bean
- public Endpoint vnfCloudAdapterEndpoint() {
- EndpointImpl endpoint = new EndpointImpl(springBus(), vnfCloudifyAdapterImpl);
- endpoint.publish("/VnfCloudifyAdapterImpl");
- endpoint.setWsdlLocation("VnfCloudifyAdapterImpl.wsdl");
- endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor());
- endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor());
- endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
- return endpoint;
- }
-
// Uses Jettson Style marshalling semantics
@Bean
public Server rsServer() {
JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
endpoint.setBus(springBus());
- endpoint.setServiceBeans(Arrays.<Object>asList(networkAdapterRest, tenantAdapterRest, vnfAdapterRest,
- vnfAdapterRestV2, volumeAdapterRest, volumeAdapterRestV2));
+ endpoint.setServiceBeans(Arrays.<Object>asList(tenantAdapterRest));
endpoint.setAddress("/rest");
endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature()));
endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(jettisonStyleObjectMapper.getMapper()),
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java
index 7622c1ba28..0c6bb6f387 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAudit.java
@@ -20,7 +20,7 @@
package org.onap.so.adapters.tasks.audit;
-import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
public class AbstractAudit {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java
index 874823a7cd..010475c87a 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java
@@ -29,10 +29,9 @@ import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
-import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
-import org.onap.so.utils.RetrySequenceLevel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
index 2c76acdb1b..4e8443bf45 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
@@ -4,7 +4,7 @@ import java.io.IOException;
import java.util.List;
import java.util.Optional;
import org.onap.so.audit.beans.AuditInventory;
-import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.db.request.beans.RequestProcessingData;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.objects.audit.AAIObjectAuditList;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java
index 55cde4d174..a7fdc352cd 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDeleteStackService.java
@@ -27,7 +27,7 @@ import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
-import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java
index 63853c34fa..1445622357 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditVServer.java
@@ -27,13 +27,13 @@ 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;
+import org.onap.aaiclient.client.aai.AAIObjectPlurals;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
index 1554881193..3ff15ffe2f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/HeatStackAudit.java
@@ -37,8 +37,8 @@ import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vlan;
import org.onap.aai.domain.yang.Vlans;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.openstack.utils.MsoHeatUtils;
@@ -288,7 +288,7 @@ public class HeatStackAudit {
*/
protected List<Optional<Port>> retrieveNeutronPortDetails(Resources resources, String cloudSiteId,
String tenantId) {
- return resources.getList().parallelStream().filter(resource -> "OS::Neutron::Port".equals(resource.getType()))
+ return resources.getList().stream().filter(resource -> "OS::Neutron::Port".equals(resource.getType()))
.map(resource -> neutron.getNeutronPort(resource.getPhysicalResourceId(), tenantId, cloudSiteId))
.collect(Collectors.toList());
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
index a3cb99e3af..eab0451aa6 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
@@ -20,44 +20,104 @@
package org.onap.so.adapters.tasks.inventory;
-import java.util.Optional;
-import java.util.stream.Stream;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.objects.audit.AAIObjectAudit;
-import org.onap.so.objects.audit.AAIObjectAuditList;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.collections.CollectionUtils;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.so.cloud.CloudConfig;
+import org.onap.so.cloud.resource.beans.CloudInformation;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.heatbridge.HeatBridgeApi;
+import org.onap.so.heatbridge.HeatBridgeImpl;
+import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
+import org.openstack4j.model.compute.Flavor;
+import org.openstack4j.model.compute.Image;
+import org.openstack4j.model.compute.Server;
+import org.openstack4j.model.heat.Resource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
public class CreateAAIInventory {
+ private static final Logger logger = LoggerFactory.getLogger(CreateAAIInventory.class);
+
private AAIResourcesClient aaiClient;
- public void createInventory(AAIObjectAuditList auditList) throws InventoryException {
- if (didAuditFailVserverLInterfaces(auditList)) {
- throw new InventoryException("Audit failed for VServer or LInterface cannot write Sub-Interfaces");
- }
- auditList.getAuditList().parallelStream()
- .filter(auditObject -> !auditObject.isDoesObjectExist()
- && AAIObjectType.SUB_L_INTERFACE.typeName().equals(auditObject.getAaiObjectType()))
- .forEach(auditObject -> getAaiClient().createIfNotExists(AAIUriFactory.createResourceFromExistingURI(
- AAIObjectType.fromTypeName(auditObject.getAaiObjectType()), auditObject.getResourceURI()),
- Optional.of(auditObject.getAaiObject())));
- }
+ @Autowired
+ protected CloudConfig cloudConfig;
+
+ @Autowired
+ protected Environment env;
+
+ public void heatbridge(CloudInformation cloudInformation) {
+ try {
+ CloudSite cloudSite = cloudConfig.getCloudSite(cloudInformation.getRegionId())
+ .orElseThrow(() -> new MsoCloudSiteNotFound(cloudInformation.getRegionId()));
+ CloudIdentity cloudIdentity = cloudSite.getIdentityService();
+ String heatStackId = cloudInformation.getTemplateInstanceId().split("/")[1];
+
+ List<String> oobMgtNetNames = new ArrayList<>();
+
+ HeatBridgeApi heatBridgeClient =
+ new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, cloudInformation.getOwner(),
+ cloudInformation.getRegionId(), cloudSite.getRegionId(), cloudInformation.getTenantId());
+
+ heatBridgeClient.authenticate();
+ List<Resource> stackResources =
+ heatBridgeClient.queryNestedHeatStackResources(cloudInformation.getTemplateInstanceId());
- /**
- * @param auditHeatStackFailed
- * @param auditList
- * @return
- */
- protected boolean didAuditFailVserverLInterfaces(AAIObjectAuditList auditList) {
- Stream<AAIObjectAudit> issue = auditList.getAuditList().stream()
- .filter(auditObject -> auditObject.getAaiObjectType().equals(AAIObjectType.VSERVER.typeName())
- || auditObject.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName()));
+ List<Server> osServers = heatBridgeClient.getAllOpenstackServers(stackResources);
- return issue.filter(auditObject -> !auditObject.isDoesObjectExist()).findFirst().map(v -> true).orElse(false);
+ heatBridgeClient.createPserversAndPinterfacesIfNotPresentInAai(stackResources);
+
+ List<Image> osImages = heatBridgeClient.extractOpenstackImagesFromServers(osServers);
+
+ List<Flavor> osFlavors = heatBridgeClient.extractOpenstackFlavorsFromServers(osServers);
+
+ logger.debug("Successfully queried heat stack{} for resources.", heatStackId);
+ // os images
+ if (osImages != null && !osImages.isEmpty()) {
+ heatBridgeClient.buildAddImagesToAaiAction(osImages);
+ logger.debug("Successfully built AAI actions to add images.");
+ } else {
+ logger.debug("No images to update to AAI.");
+ }
+ // flavors
+ if (osFlavors != null && !osFlavors.isEmpty()) {
+ heatBridgeClient.buildAddFlavorsToAaiAction(osFlavors);
+ logger.debug("Successfully built AAI actions to add flavors.");
+ } else {
+ logger.debug("No flavors to update to AAI.");
+ }
+
+ // compute resources
+ heatBridgeClient.buildAddVserversToAaiAction(cloudInformation.getVnfId(), cloudInformation.getVfModuleId(),
+ osServers);
+ logger.debug("Successfully queried compute resources and built AAI vserver actions.");
+
+ // neutron resources
+ List<String> oobMgtNetIds = new ArrayList<>();
+
+ // if no network-id list is provided, however network-name list is
+ if (!CollectionUtils.isEmpty(oobMgtNetNames)) {
+ oobMgtNetIds = heatBridgeClient.extractNetworkIds(oobMgtNetNames);
+ }
+ heatBridgeClient.buildAddVserverLInterfacesToAaiAction(stackResources, oobMgtNetIds);
+ logger.debug(
+ "Successfully queried neutron resources and built AAI actions to add l-interfaces to vservers.");
+
+ // Update AAI
+ logger.debug("Current Dry Run Value: {}", env.getProperty("heatBridgeDryrun", Boolean.class, true));
+ heatBridgeClient.submitToAai(env.getProperty("heatBridgeDryrun", Boolean.class, true));
+ } catch (Exception ex) {
+ logger.debug("Heatbrige failed for stackId: " + cloudInformation.getTemplateInstanceId(), ex);
+ }
}
protected AAIResourcesClient getAaiClient() {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java
index 04dcd9ff61..317dae61b9 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTask.java
@@ -25,9 +25,8 @@ package org.onap.so.adapters.tasks.inventory;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.cloud.resource.beans.CloudInformation;
import org.onap.so.logging.tasks.AuditMDCSetup;
-import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.utils.ExternalTaskUtils;
import org.onap.so.utils.RetrySequenceLevel;
import org.slf4j.Logger;
@@ -35,6 +34,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+
@Component
public class CreateInventoryTask extends ExternalTaskUtils {
@@ -57,29 +57,16 @@ public class CreateInventoryTask extends ExternalTaskUtils {
public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
mdcSetup.setupMDC(externalTask);
- boolean success = true;
boolean inventoryException = false;
- String auditInventoryString = externalTask.getVariable("auditInventoryResult");
- AAIObjectAuditList auditInventory = null;
String externalTaskId = externalTask.getId();
- try {
- GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
- auditInventory = objectMapper.getMapper().readValue(auditInventoryString, AAIObjectAuditList.class);
- } catch (Exception e) {
- mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
- logger.error("Error Parsing Audit Results", e);
- }
- mdcSetup.setElapsedTime();
- if (auditInventory != null) {
+ CloudInformation cloudInformation = externalTask.getVariable("cloudInformation");
+ boolean success = true;
+ if (cloudInformation != null) {
Integer retryCount = externalTask.getRetries();
try {
- logger.info("Executing External Task Create Inventory, Retry Number: {} \n {}", auditInventory,
+ logger.info("Executing External Task Create Inventory, Retry Number: {} \n {}", cloudInformation,
retryCount);
- createInventory.createInventory(auditInventory);
- } catch (InventoryException e) {
- logger.error("Error during inventory of stack", e);
- success = false;
- inventoryException = true;
+ createInventory.heatbridge(cloudInformation);
} catch (Exception e) {
logger.error("Error during inventory of stack", e);
success = false;
@@ -91,31 +78,27 @@ public class CreateInventoryTask extends ExternalTaskUtils {
logger.debug("The External Task Id: {} Successful", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
mdcSetup.clearClientMDCs();
- } else if (inventoryException) {
- mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
- logger.debug("The External Task Id: {} Failed, Retry not needed", externalTaskId);
- externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
} else {
if (retryCount == null) {
- logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
+ logger.error("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
externalTaskId, getRetrySequence().length);
externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI,
UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, getRetrySequence().length, 10000);
} else if (retryCount != null && retryCount - 1 == 0) {
externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
- logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId);
+ logger.error("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
- logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
+ logger.error("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
externalTaskId, retryCount - 1, calculateRetryDelay(retryCount));
externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI,
UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, retryCount - 1, calculateRetryDelay(retryCount));
}
- logger.debug("The External Task Id: {} Failed", externalTaskId);
+ logger.error("The External Task Id: {} Failed", externalTaskId);
}
} else {
- logger.debug("The External Task Id: {} Failed, No Audit Results Written", externalTaskId);
+ logger.error("The External Task Id: {} Failed, No Cloud Information Provided", externalTaskId);
externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
index 6e181c4696..9ff50e8644 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
@@ -33,10 +33,13 @@ import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.commons.lang3.mutable.MutableBoolean;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
+import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
+import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.utils.MsoHeatUtils;
@@ -70,7 +73,7 @@ public class PollService extends ExternalTaskUtils {
MutableBoolean success = new MutableBoolean();
String errorMessage = null;
try {
- String xmlRequest = externalTask.getVariable("vnfAdapterTaskRequest");
+ String xmlRequest = externalTask.getVariable("openstackAdapterTaskRequest");
if (xmlRequest != null) {
Optional<String> requestType = findRequestType(xmlRequest);
if ("createVolumeGroupRequest".equals(requestType.get())) {
@@ -87,6 +90,15 @@ public class PollService extends ExternalTaskUtils {
DeleteVolumeGroupRequest req =
JAXB.unmarshal(new StringReader(xmlRequest), DeleteVolumeGroupRequest.class);
pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else if ("createNetworkRequest".equals(requestType.get())) {
+ determineCreateNetworkStatus(xmlRequest, externalTask, success);
+ } else if ("deleteNetworkRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Poll Service for Delete Network");
+ DeleteNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteNetworkRequest.class);
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else if ("updateNetworkRequest".equals(requestType.get())) {
+ UpdateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), UpdateNetworkRequest.class);
+ pollUpdateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
}
}
} catch (Exception e) {
@@ -143,6 +155,19 @@ public class PollService extends ExternalTaskUtils {
}
}
+ private void determineCreateNetworkStatus(String xmlRequest, ExternalTask externalTask, MutableBoolean success)
+ throws MsoException {
+ CreateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateNetworkRequest.class);
+ boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
+ if (pollRollbackStatus) {
+ logger.debug("Executing External Task Poll Service for Rollback Create Network");
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else {
+ logger.debug("Executing External Task Poll Service for Create Network");
+ pollCreateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ }
+ }
+
private void pollCreateResource(String cloudSiteId, String tenantId, ExternalTask externalTask,
MutableBoolean success) throws MsoException {
Stack currentStack = createCurrentStack(externalTask.getVariable("stackId"));
@@ -163,6 +188,15 @@ public class PollService extends ExternalTaskUtils {
success.setTrue();
}
+ private void pollUpdateResource(String cloudSiteId, String tenantId, ExternalTask externalTask,
+ MutableBoolean success) throws MsoException {
+ Stack currentStack = createCurrentStack(externalTask.getVariable("stackId"));
+ Stack stack =
+ msoHeatUtils.pollStackForStatus(1, currentStack, "UPDATE_IN_PROGRESS", cloudSiteId, tenantId, false);
+ msoHeatUtils.postProcessStackUpdate(stack);
+ success.setTrue();
+ }
+
protected Optional<String> findRequestType(String xmlString) {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java
index c302293169..15e6ff581d 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java
@@ -11,6 +11,8 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.ws.Holder;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.so.adapters.network.MsoNetworkAdapterImpl;
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
@@ -30,6 +32,9 @@ public class RollbackService extends ExternalTaskUtils {
private MsoVnfAdapterImpl vnfAdapterImpl;
@Autowired
+ private MsoNetworkAdapterImpl networkAdapterImpl;
+
+ @Autowired
private AuditMDCSetup mdcSetup;
public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
@@ -39,7 +44,7 @@ public class RollbackService extends ExternalTaskUtils {
boolean success = false;
boolean pollRollbackStatus = false;
try {
- String xmlRequest = externalTask.getVariable("vnfAdapterTaskRequest");
+ String xmlRequest = externalTask.getVariable("openstackAdapterTaskRequest");
if (xmlRequest != null) {
Optional<String> requestType = findRequestType(xmlRequest);
if ("createVolumeGroupRequest".equals(requestType.get())) {
@@ -59,6 +64,15 @@ public class RollbackService extends ExternalTaskUtils {
req.getMsoRequest(), new Holder<>());
pollRollbackStatus = true;
success = true;
+ } else if ("createNetworkRequest".equals(requestType.get())) {
+ logger.debug("Executing External Task Rollback Service for Create Network");
+ Holder<Boolean> networkDeleted = new Holder<>();
+ CreateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateNetworkRequest.class);
+ networkAdapterImpl.deleteNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
+ req.getModelCustomizationUuid(), req.getNetworkName(), req.getMsoRequest(), networkDeleted,
+ false);
+ pollRollbackStatus = true;
+ success = true;
}
}
} catch (Exception e) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
index 34952a056b..6b7ceedbb8 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
@@ -25,6 +25,7 @@ package org.onap.so.adapters.tasks.orchestration;
import java.io.ByteArrayInputStream;
import java.io.StringReader;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.xml.bind.JAXB;
@@ -34,6 +35,18 @@ import javax.xml.ws.Holder;
import org.apache.commons.lang3.mutable.MutableBoolean;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.so.adapters.network.MsoNetworkAdapterImpl;
+import org.onap.so.adapters.network.exceptions.NetworkException;
+import org.onap.so.adapters.nwrest.ContrailNetwork;
+import org.onap.so.adapters.nwrest.CreateNetworkRequest;
+import org.onap.so.adapters.nwrest.CreateNetworkResponse;
+import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
+import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
+import org.onap.so.adapters.nwrest.ProviderVlanNetwork;
+import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
+import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
+import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
+import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
@@ -47,6 +60,8 @@ import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
import org.onap.so.adapters.vnfrest.VfModuleRollback;
import org.onap.so.adapters.vnfrest.VolumeGroupRollback;
import org.onap.so.logging.tasks.AuditMDCSetup;
+import org.onap.so.openstack.beans.NetworkRollback;
+import org.onap.so.openstack.beans.RouteTarget;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.utils.ExternalTaskUtils;
import org.slf4j.Logger;
@@ -63,12 +78,19 @@ public class StackService extends ExternalTaskUtils {
private MsoVnfAdapterImpl vnfAdapterImpl;
@Autowired
+ private MsoNetworkAdapterImpl networkAdapterImpl;
+
+ @Autowired
private AuditMDCSetup mdcSetup;
+ private static final String SHARED = "shared";
+ private static final String EXTERNAL = "external";
+
+ // TODO set backout earlier in case of exception??
public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
Map<String, Object> variables = new HashMap<>();
mdcSetup.setupMDC(externalTask);
- String xmlRequest = externalTask.getVariable("vnfAdapterTaskRequest");
+ String xmlRequest = externalTask.getVariable("openstackAdapterTaskRequest");
logger.debug("Executing External Task Stack Service. {}", xmlRequest);
MutableBoolean success = new MutableBoolean();
MutableBoolean backout = new MutableBoolean();
@@ -80,6 +102,11 @@ public class StackService extends ExternalTaskUtils {
Holder<Map<String, String>> outputs = new Holder<>();
Holder<VnfRollback> vnfRollback = new Holder<>();
Optional<String> requestType = findRequestType(xmlRequest);
+ Holder<String> networkId = new Holder<>();
+ Holder<String> neutronNetworkId = new Holder<>();
+ Holder<String> networkFqdn = new Holder<>();
+ Holder<Map<String, String>> subnetIdMap = new Holder<>();
+ Holder<NetworkRollback> networkRollback = new Holder<>();
if ("createVolumeGroupRequest".equals(requestType.get())) {
logger.debug("Executing External Task Stack Service For Create Volume Group");
response = createVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
@@ -92,6 +119,16 @@ public class StackService extends ExternalTaskUtils {
} else if ("deleteVolumeGroupRequest".equals(requestType.get())) {
logger.debug("Executing External Task Stack Service For Delete Volume Group");
response = deleteVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ } else if ("createNetworkRequest".equals(requestType.get())) {
+ response = createNetwork(xmlRequest, networkId, neutronNetworkId, networkFqdn, subnetIdMap,
+ networkRollback, canonicalStackId, backout, success);
+ } else if ("deleteNetworkRequest".equals(requestType.get())) {
+ response = deleteNetwork(xmlRequest, canonicalStackId, backout, success);
+ } else if ("updateNetworkRequest".equals(requestType.get())) {
+ response =
+ updateNetwork(xmlRequest, subnetIdMap, networkRollback, canonicalStackId, backout, success);
+ } else if ("rollbackNetworkRequest".equals(requestType.get())) {
+ response = rollbackNetwork(xmlRequest, canonicalStackId, backout, success);
}
}
} catch (Exception e) {
@@ -192,6 +229,156 @@ public class StackService extends ExternalTaskUtils {
return deleteResponse.toXmlString();
}
+ private String createNetwork(String xmlRequest, Holder<String> networkId, Holder<String> neutronNetworkId,
+ Holder<String> networkFqdn, Holder<Map<String, String>> subnetIdMap,
+ Holder<NetworkRollback> networkRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws NetworkException {
+ CreateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateNetworkRequest.class);
+ HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams();
+ if (params == null) {
+ params = new HashMap<>();
+ }
+ String shared = null;
+ String external = null;
+ String physicalNetworkName = null;
+ List<Integer> vlans = null;
+ List<RouteTarget> routeTargets = null;
+ List<String> fqdns = null;
+ List<String> routeTable = null;
+ if (params.containsKey(SHARED))
+ shared = params.get(SHARED);
+ if (params.containsKey(EXTERNAL))
+ external = params.get(EXTERNAL);
+ if (req.isContrailRequest()) {
+ ContrailNetwork ctn = req.getContrailNetwork();
+ if (ctn == null) {
+ ctn = new ContrailNetwork();
+ req.setContrailNetwork(ctn);
+ }
+ if (shared == null && ctn.getShared() != null) {
+ shared = ctn.getShared();
+ }
+ if (shared == null && ctn.getExternal() != null) {
+ external = ctn.getExternal();
+ }
+ routeTargets = req.getContrailNetwork().getRouteTargets();
+ fqdns = req.getContrailNetwork().getPolicyFqdns();
+ routeTable = req.getContrailNetwork().getRouteTableFqdns();
+ } else {
+ ProviderVlanNetwork pvn = req.getProviderVlanNetwork();
+ if (pvn == null) {
+ pvn = new ProviderVlanNetwork();
+ req.setProviderVlanNetwork(pvn);
+ }
+ physicalNetworkName = req.getProviderVlanNetwork().getPhysicalNetworkName();
+ vlans = req.getProviderVlanNetwork().getVlans();
+ }
+ networkAdapterImpl.createNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
+ req.getModelCustomizationUuid(), req.getNetworkName(), physicalNetworkName, vlans, routeTargets, shared,
+ external, req.getFailIfExists(), false, req.getSubnets(), fqdns, routeTable, req.getMsoRequest(),
+ networkId, neutronNetworkId, networkFqdn, subnetIdMap, networkRollback, false);
+ success.setTrue();
+ backout.setValue(req.getBackout());
+ canonicalStackId.value = networkRollback.value.getNetworkStackId();
+
+ CreateNetworkResponse response = new CreateNetworkResponse(req.getNetworkId(), neutronNetworkId.value,
+ networkRollback.value.getNetworkStackId(), networkFqdn.value, networkRollback.value.getNetworkCreated(),
+ subnetIdMap.value, networkRollback.value, req.getMessageId());
+ return response.toXmlString();
+ }
+
+ private String deleteNetwork(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws NetworkException {
+ backout.setFalse();
+ DeleteNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteNetworkRequest.class);
+ Holder<Boolean> networkDeleted = new Holder<>();
+
+ networkAdapterImpl.deleteNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
+ req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getMsoRequest(), networkDeleted, false);
+
+ canonicalStackId.value = req.getNetworkStackId();
+ success.setTrue();
+
+ DeleteNetworkResponse response =
+ new DeleteNetworkResponse(req.getNetworkId(), networkDeleted.value, req.getMessageId());
+ return response.toXmlString();
+ }
+
+ private String rollbackNetwork(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws NetworkException {
+ backout.setFalse();
+ RollbackNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), RollbackNetworkRequest.class);
+
+ NetworkRollback rollback = req.getNetworkRollback();
+ networkAdapterImpl.rollbackNetwork(rollback, false);
+
+ canonicalStackId.value = rollback.getNetworkStackId();
+ success.setTrue();
+
+ RollbackNetworkResponse response = new RollbackNetworkResponse(true, req.getMessageId());
+ return response.toXmlString();
+ }
+
+ private String updateNetwork(String xmlRequest, Holder<Map<String, String>> subnetIdMap,
+ Holder<NetworkRollback> networkRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws NetworkException {
+ backout.setFalse();
+ UpdateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), UpdateNetworkRequest.class);
+ HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams();
+ if (params == null) {
+ params = new HashMap<>();
+ }
+ String shared = null;
+ String external = null;
+ String physicalNetworkName = null;
+ List<Integer> vlans = null;
+ List<RouteTarget> routeTargets = null;
+ List<String> fqdns = null;
+ List<String> routeTable = null;
+ if (params.containsKey(SHARED))
+ shared = params.get(SHARED);
+ if (params.containsKey(EXTERNAL))
+ external = params.get(EXTERNAL);
+ if (req.isContrailRequest()) {
+ ContrailNetwork ctn = req.getContrailNetwork();
+ if (ctn == null) {
+ ctn = new ContrailNetwork();
+ req.setContrailNetwork(ctn);
+ }
+ if (shared == null && ctn.getShared() != null) {
+ shared = ctn.getShared();
+ }
+ if (shared == null && ctn.getExternal() != null) {
+ external = ctn.getExternal();
+ }
+ routeTargets = req.getContrailNetwork().getRouteTargets();
+ fqdns = req.getContrailNetwork().getPolicyFqdns();
+ routeTable = req.getContrailNetwork().getRouteTableFqdns();
+ } else {
+ ProviderVlanNetwork pvn = req.getProviderVlanNetwork();
+ if (pvn == null) {
+ pvn = new ProviderVlanNetwork();
+ req.setProviderVlanNetwork(pvn);
+ }
+ physicalNetworkName = req.getProviderVlanNetwork().getPhysicalNetworkName();
+ vlans = req.getProviderVlanNetwork().getVlans();
+ }
+
+ networkAdapterImpl.updateNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(),
+ req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getNetworkName(), physicalNetworkName,
+ vlans, routeTargets, shared, external, req.getSubnets(), fqdns, routeTable, req.getMsoRequest(),
+ subnetIdMap, networkRollback);
+
+ success.setTrue();
+ canonicalStackId.value = req.getNetworkStackId();
+
+ UpdateNetworkResponse response =
+ new UpdateNetworkResponse(req.getNetworkId(), null, subnetIdMap.value, req.getMessageId());
+ return response.toXmlString();
+ }
+
+
+
protected Optional<String> findRequestType(String xmlString) {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java
deleted file mode 100644
index 0074dca03c..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.vnf;
-
-
-import java.util.Map;
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebParam.Mode;
-import javax.jws.WebService;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import javax.xml.ws.Holder;
-import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-import org.onap.so.entity.MsoRequest;
-import org.onap.so.openstack.beans.VnfRollback;
-import org.onap.so.openstack.beans.VnfStatus;
-import org.onap.so.openstack.mappers.MapAdapter;
-
-@WebService(name = "VnfAdapter", targetNamespace = "http://org.onap.so/vnf")
-public interface MsoVnfAdapter {
- /**
- * This is the "Create VNF" Web Service Endpoint definition.
- */
- @WebMethod
- public void createVnf(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
- @WebParam(name = "cloudOwner") @XmlElement(required = false) String cloudOwner,
- @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
- @WebParam(name = "vnfType") @XmlElement(required = true) String vnfType,
- @WebParam(name = "vnfVersion") @XmlElement(required = false) String vnfVersion,
- @WebParam(name = "vnfName") @XmlElement(required = true) String vnfName,
- @WebParam(name = "requestType") @XmlElement(required = false) String requestType,
- @WebParam(name = "volumeGroupHeatStackId") @XmlElement(required = false) String volumeGroupHeatStackId,
- @WebParam(name = "inputs") @XmlJavaTypeAdapter(MapAdapter.class) Map<String, Object> inputs,
- @WebParam(name = "failIfExists") Boolean failIfExists, @WebParam(name = "backout") Boolean backout,
- @WebParam(name = "enableBridge") Boolean enableBridge, @WebParam(name = "request") MsoRequest msoRequest,
- @WebParam(name = "vnfId", mode = Mode.OUT) Holder<String> vnfId,
- @WebParam(name = "outputs", mode = Mode.OUT) Holder<Map<String, String>> outputs,
- @WebParam(name = "rollback", mode = Mode.OUT) Holder<VnfRollback> rollback)
- throws VnfException, VnfAlreadyExists;
-
- @WebMethod
- public void updateVnf(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
- @WebParam(name = "cloudOwner") @XmlElement(required = false) String cloudOwner,
- @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
- @WebParam(name = "vnfType") @XmlElement(required = true) String vnfType,
- @WebParam(name = "vnfVersion") @XmlElement(required = false) String vnfVersion,
- @WebParam(name = "vnfName") @XmlElement(required = true) String vnfName,
- @WebParam(name = "requestType") @XmlElement(required = false) String requestType,
- @WebParam(name = "volumeGroupHeatStackId") @XmlElement(required = false) String volumeGroupHeatStackId,
- @WebParam(name = "inputs") @XmlJavaTypeAdapter(MapAdapter.class) Map<String, Object> inputs,
- @WebParam(name = "request") MsoRequest msoRequest,
- @WebParam(name = "outputs", mode = Mode.OUT) Holder<Map<String, String>> outputs,
- @WebParam(name = "rollback", mode = Mode.OUT) Holder<VnfRollback> rollback) throws VnfException;
-
- @WebMethod
- public void queryVnf(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
- @WebParam(name = "cloudOwner") @XmlElement(required = false) String cloudOwner,
- @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
- @WebParam(name = "vnfName") @XmlElement(required = true) String vnfName,
- @WebParam(name = "request") MsoRequest msoRequest,
- @WebParam(name = "vnfExists", mode = Mode.OUT) Holder<Boolean> vnfExists,
- @WebParam(name = "vnfId", mode = Mode.OUT) Holder<String> vnfId,
- @WebParam(name = "status", mode = Mode.OUT) Holder<VnfStatus> status,
- @WebParam(name = "outputs", mode = Mode.OUT) Holder<Map<String, String>> outputs) throws VnfException;
-
- @WebMethod
- public void deleteVnf(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
- @WebParam(name = "cloudOwner") @XmlElement(required = false) String cloudOwner,
- @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
- @WebParam(name = "vnfName") @XmlElement(required = true) String vnfName,
- @WebParam(name = "request") MsoRequest msoRequest) throws VnfException;
-
-
- @WebMethod
- public void rollbackVnf(@WebParam(name = "rollback") @XmlElement(required = true) VnfRollback rollback)
- throws VnfException;
-
- @WebMethod
- public void createVfModule(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
- @WebParam(name = "cloudOwner") @XmlElement(required = false) String cloudOwner,
- @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
- @WebParam(name = "vnfType") @XmlElement(required = true) String vnfType,
- @WebParam(name = "vnfVersion") @XmlElement(required = false) String vnfVersion,
- @WebParam(name = "genericVnfId") @XmlElement(required = true) String genericVnfId,
- @WebParam(name = "vnfName") @XmlElement(required = true) String vnfName,
- @WebParam(name = "vfModuleId") @XmlElement(required = true) String vfModuleId,
- @WebParam(name = "requestType") @XmlElement(required = false) String requestType,
- @WebParam(name = "volumeGroupHeatStackId") @XmlElement(required = false) String volumeGroupHeatStackId,
- @WebParam(name = "baseVfHeatStackId") @XmlElement(required = false) String baseVfHeatStackId,
- @WebParam(name = "modelCustomizationUuid") @XmlElement(required = false) String modelCustomizationUuid,
- @WebParam(name = "inputs") @XmlJavaTypeAdapter(MapAdapter.class) Map<String, Object> inputs,
- @WebParam(name = "failIfExists") Boolean failIfExists, @WebParam(name = "backout") Boolean backout,
- @WebParam(name = "enableBridge") Boolean enableBridge, @WebParam(name = "request") MsoRequest msoRequest,
- @WebParam(name = "vnfId", mode = Mode.OUT) Holder<String> vnfId,
- @WebParam(name = "outputs", mode = Mode.OUT) Holder<Map<String, String>> outputs,
- @WebParam(name = "rollback", mode = Mode.OUT) Holder<VnfRollback> rollback)
- throws VnfException, VnfAlreadyExists;
-
- @WebMethod
- public void deleteVfModule(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
- @WebParam(name = "cloudOwner") @XmlElement(required = false) String cloudOwner,
- @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
- @WebParam(name = "vfName") @XmlElement(required = true) String vfName,
- @WebParam(name = "vnfId") @XmlElement(required = true) String vnfId,
- @WebParam(name = "vfModuleId") @XmlElement(required = true) String vfModuleId,
- @WebParam(name = "modelCustomizationUuid") @XmlElement(required = false) String modelCustomizationUuid,
- @WebParam(name = "request") MsoRequest msoRequest,
- @WebParam(name = "vfModuleOutputs", mode = Mode.OUT) Holder<Map<String, String>> vfModuleOutputs)
- throws VnfException;
-
- @WebMethod
- public void updateVfModule(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
- @WebParam(name = "cloudOwner") @XmlElement(required = false) String cloudOwner,
- @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
- @WebParam(name = "vnfType") @XmlElement(required = true) String vnfType,
- @WebParam(name = "vnfVersion") @XmlElement(required = false) String vnfVersion,
- @WebParam(name = "vnfName") @XmlElement(required = true) String vnfName,
- @WebParam(name = "requestType") @XmlElement(required = false) String requestType,
- @WebParam(name = "volumeGroupHeatStackId") @XmlElement(required = false) String volumeGroupHeatStackId,
- @WebParam(name = "baseVfHeatStackId") @XmlElement(required = false) String baseVfHeatStackId,
- @WebParam(name = "vfModuleStackId") @XmlElement(required = false) String vfModuleStackId,
- @WebParam(name = "modelCustomizationUuid") @XmlElement(required = false) String modelCustomizationUuid,
- @WebParam(name = "inputs") @XmlJavaTypeAdapter(MapAdapter.class) Map<String, Object> inputs,
- @WebParam(name = "request") MsoRequest msoRequest,
- @WebParam(name = "outputs", mode = Mode.OUT) Holder<Map<String, String>> outputs,
- @WebParam(name = "rollback", mode = Mode.OUT) Holder<VnfRollback> rollback) throws VnfException;
-
- @WebMethod
- public void healthCheck();
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java
index 13ca78a1f5..4b9c36b7b7 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java
@@ -29,7 +29,6 @@ import javax.jws.WebService;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.mappers.MapAdapter;
/**
@@ -37,6 +36,7 @@ import org.onap.so.openstack.mappers.MapAdapter;
* are documented elsewhere (by the client service WSDL).
*
*/
+@Deprecated
@WebService(name = "VnfAdapterAsync", targetNamespace = "http://org.onap.so/vnfA")
public interface MsoVnfAdapterAsync {
/**
@@ -61,31 +61,6 @@ public interface MsoVnfAdapterAsync {
@WebMethod
@Oneway
- public void updateVnfA(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
- @WebParam(name = "cloudOwner") @XmlElement(required = false) String cloudOwner,
- @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
- @WebParam(name = "vnfType") @XmlElement(required = true) String vnfType,
- @WebParam(name = "vnfVersion") @XmlElement(required = false) String vnfVersion,
- @WebParam(name = "vnfName") @XmlElement(required = true) String vnfName,
- @WebParam(name = "requestType") @XmlElement(required = false) String requestType,
- @WebParam(name = "volumeGroupHeatStackId") @XmlElement(required = false) String volumeGroupHeatStackId,
- @WebParam(name = "inputs") @XmlJavaTypeAdapter(MapAdapter.class) Map<String, Object> inputs,
- @WebParam(name = "messageId") @XmlElement(required = true) String messageId,
- @WebParam(name = "request") MsoRequest msoRequest,
- @WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl);
-
- @WebMethod
- @Oneway
- public void queryVnfA(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
- @WebParam(name = "cloudOwner") @XmlElement(required = false) String cloudOwner,
- @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
- @WebParam(name = "vnfName") @XmlElement(required = true) String vnfName,
- @WebParam(name = "messageId") @XmlElement(required = true) String messageId,
- @WebParam(name = "request") MsoRequest msoRequest,
- @WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl);
-
- @WebMethod
- @Oneway
public void deleteVnfA(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
@WebParam(name = "cloudOwner") @XmlElement(required = false) String cloudOwner,
@WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
@@ -94,12 +69,6 @@ public interface MsoVnfAdapterAsync {
@WebParam(name = "request") MsoRequest msoRequest,
@WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl);
- @WebMethod
- @Oneway
- public void rollbackVnfA(@WebParam(name = "rollback") @XmlElement(required = true) VnfRollback rollback,
- @WebParam(name = "messageId") @XmlElement(required = true) String messageId,
- @WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl);
-
@WebMethod
public void healthCheckA();
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 68d1bebc51..3bea44b884 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
@@ -38,8 +38,6 @@ import javax.xml.ws.BindingProvider;
import javax.xml.ws.Holder;
import javax.xml.ws.handler.MessageContext;
import org.onap.so.adapters.vnf.async.client.CreateVnfNotification;
-import org.onap.so.adapters.vnf.async.client.QueryVnfNotification;
-import org.onap.so.adapters.vnf.async.client.UpdateVnfNotification;
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;
@@ -48,7 +46,6 @@ 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;
-import org.onap.so.openstack.beans.VnfStatus;
import org.onap.so.utils.CryptoUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -64,9 +61,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
private static final Logger logger = LoggerFactory.getLogger(MsoVnfAdapterAsyncImpl.class);
private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.vnf.bpelauth";
- private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey";
- private static final String UPDATE_VNFA = "{} UpdateVnfA";
- private static final String EXCEPTION_UPDATEVNF_NOTIFICATION = "{} {} Exception sending updateVnf notification ";
+ private static final String ENCRYPTION_KEY_PROP = "mso.msoKey";
@Autowired
private Environment environment;
@@ -122,15 +117,13 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
String notificationUrl) {
logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF);
- // Use the synchronous method to perform the actual Create
- MsoVnfAdapter vnfAdapter = vnfImpl;
// Synchronous Web Service Outputs
Holder<String> vnfId = new Holder<>();
Holder<Map<String, String>> outputs = new Holder<>();
Holder<VnfRollback> vnfRollback = new Holder<>();
try {
- vnfAdapter.createVnf(cloudSiteId, cloudOwner, tenantId, vnfType, vnfVersion, vnfName, requestType,
+ vnfImpl.createVnf(cloudSiteId, cloudOwner, tenantId, vnfType, vnfVersion, vnfName, requestType,
volumeGroupHeatStackId, inputs, failIfExists, backout, enableBridge, msoRequest, vnfId, outputs,
vnfRollback);
} catch (VnfException e) {
@@ -171,140 +164,6 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
return;
}
- @Override
- public void updateVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfType, String vnfVersion,
- String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs,
- String messageId, MsoRequest msoRequest, String notificationUrl) {
-
- logger.info(UPDATE_VNFA, MessageEnum.RA_ASYNC_UPDATE_VNF);
-
- // Use the synchronous method to perform the actual Create
- MsoVnfAdapter vnfAdapter = vnfImpl;
-
- // Synchronous Web Service Outputs
- Holder<String> vnfId = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
- Holder<VnfRollback> vnfRollback = new Holder<>();
-
- try {
- vnfAdapter.updateVnf(cloudSiteId, cloudOwner, tenantId, vnfType, vnfVersion, vnfName, requestType,
- volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback);
- } catch (VnfException e) {
- logger.error(EXCEPTION_UPDATEVNF_NOTIFICATION, MessageEnum.RA_UPDATE_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
- String eMsg = null;
- try {
- eMsg = e.getFaultInfo().getMessage();
- exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory
- .fromValue(e.getFaultInfo().getCategory().name());
- } catch (Exception e1) {
- logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
- ErrorCode.BusinessProcessError.getValue(), e1);
- }
- // Build and send Asynchronous error response
- try {
- VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.updateVnfNotification(messageId, false, exCat, eMsg, null, null);
- } catch (Exception e1) {
- logger.error(EXCEPTION_UPDATEVNF_NOTIFICATION, MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e1);
- }
- logger.info(UPDATE_VNFA, MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
- return;
- }
- logger.debug("Async Update VNF: {} VnfId:{}", vnfName, vnfId.value);
- // Build and send Asynchronous response
- try {
- VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.updateVnfNotification(messageId, true, null, null, copyUpdateOutputs(outputs),
- copyVrb(vnfRollback));
- } catch (Exception e) {
- logger.error(EXCEPTION_UPDATEVNF_NOTIFICATION, MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- }
- logger.info(UPDATE_VNFA, MessageEnum.RA_ASYNC_UPDATE_VNF_COMPLETE);
- return;
- }
-
- /**
- * This is the "Query VNF" web service implementation. It will look up a VNF by name or ID in the specified cloud
- * and tenant.
- *
- * The method returns an indicator that the VNF exists, its Openstack internal ID, its status, and the set of
- * outputs (from when the stack was created).
- *
- * @param cloudSiteId CLLI code of the cloud site in which to query
- * @param cloudOwner cloud owner of cloud site in which to query
- * @param tenantId Openstack tenant identifier
- * @param vnfName VNF Name or Openstack ID
- * @param msoRequest Request tracking information for logs
- * @param notificationURL the target URL for asynchronous response
- */
- @Override
- public void queryVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String messageId,
- MsoRequest msoRequest, String notificationUrl) {
-
- logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_QUERY_VNF);
-
- // Use the synchronous method to perform the actual query
- MsoVnfAdapter vnfAdapter = vnfImpl;
-
- // Synchronous Web Service Outputs
- Holder<Boolean> vnfExists = new Holder<>();
- Holder<String> vnfId = new Holder<>();
- Holder<VnfStatus> status = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
-
- try {
- vnfAdapter.queryVnf(cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest, vnfExists, vnfId, status,
- outputs);
- } catch (VnfException e) {
- logger.error("{} {} Exception sending queryVnfA notification ", MessageEnum.RA_QUERY_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
- String eMsg = null;
- try {
- eMsg = e.getFaultInfo().getMessage();
- exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory
- .fromValue(e.getFaultInfo().getCategory().name());
- } catch (Exception e1) {
- logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
- ErrorCode.BusinessProcessError.getValue(), e1);
- }
- // Build and send Asynchronous error response
- try {
- VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.queryVnfNotification(messageId, false, exCat, eMsg, null, null, null, null);
- } catch (Exception e1) {
- logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e1);
- }
- logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE);
- return;
- }
-
- if (!vnfExists.value) {
- logger.debug("Async Query, VNF not found");
- } else {
- logger.debug("Async Query, VNF={}, status={}", vnfId.value, status.value);
- }
- // Build and send Asynchronous response
- try {
- VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- org.onap.so.adapters.vnf.async.client.VnfStatus vnfS =
- org.onap.so.adapters.vnf.async.client.VnfStatus.fromValue(status.value.name());
- notifyPort.queryVnfNotification(messageId, true, null, null, vnfExists.value, vnfId.value, vnfS,
- copyQueryOutputs(outputs));
- } catch (Exception e) {
- logger.error("{} {} Exception sending queryVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- }
-
- logger.info("{} queryVnfA", MessageEnum.RA_ASYNC_QUERY_VNF_COMPLETE);
- return;
- }
-
/**
* This is the Asynchronous "Delete VNF" web service implementation. It will delete a VNF by name or ID in the
* specified cloud and tenant.
@@ -324,11 +183,8 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_DELETE_VNF);
- // Use the synchronous method to perform the actual delete
- MsoVnfAdapter vnfAdapter = vnfImpl;
-
try {
- vnfAdapter.deleteVnf(cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest);
+ vnfImpl.deleteVnf(cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest);
} catch (VnfException e) {
logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_DELETE_VNF_ERR,
ErrorCode.BusinessProcessError.getValue(), e);
@@ -369,65 +225,6 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
return;
}
- /**
- * This web service endpoint will rollback a previous Create VNF operation. A rollback object is returned to the
- * client in a successful creation response. The client can pass that object as-is back to the rollbackVnf operation
- * to undo the creation.
- */
- @Override
- public void rollbackVnfA(VnfRollback rollback, String messageId, String notificationUrl) {
- // rollback may be null (e.g. if stack already existed when Create was called)
- if (rollback == null) {
- logger.info("{} rollbackVnfA: Empty Rollback: No action to perform", MessageEnum.RA_ROLLBACK_NULL);
- return;
- }
-
- logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF);
-
- // Use the synchronous method to perform the actual rollback
- MsoVnfAdapter vnfAdapter = vnfImpl;
-
- try {
- vnfAdapter.rollbackVnf(rollback);
- } catch (VnfException e) {
- logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_ROLLBACK_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
- String eMsg = null;
- try {
- eMsg = e.getFaultInfo().getMessage();
- exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory
- .fromValue(e.getFaultInfo().getCategory().name());
- } catch (Exception e1) {
- logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
- ErrorCode.BusinessProcessError.getValue(), e1);
- }
- // Build and send Asynchronous error response
- try {
- VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.rollbackVnfNotification(messageId, false, exCat, eMsg);
- } catch (Exception e1) {
- logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e1);
- }
- logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE);
- return;
- }
-
- logger.debug("Async Rollback VNF:" + rollback.getVnfId());
- // Build and send Asynchronous response
- try {
- VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.rollbackVnfNotification(messageId, true, null, null);
- } catch (Exception e) {
- logger.error("{} {} Exception sending rollbackVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- }
-
- logger.info("{} rollbackVnfA", MessageEnum.RA_ASYNC_ROLLBACK_VNF_COMPLETE);
- return;
- }
-
private org.onap.so.adapters.vnf.async.client.VnfRollback copyVrb(Holder<VnfRollback> hVrb) {
org.onap.so.adapters.vnf.async.client.VnfRollback cvrb =
new org.onap.so.adapters.vnf.async.client.VnfRollback();
@@ -471,47 +268,6 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
return outputs;
}
- private UpdateVnfNotification.Outputs copyUpdateOutputs(Holder<Map<String, String>> hMap) {
-
- UpdateVnfNotification.Outputs outputs = new UpdateVnfNotification.Outputs();
-
- if (hMap != null && hMap.value != null) {
- Map<String, String> sMap;
- sMap = hMap.value;
- UpdateVnfNotification.Outputs.Entry entry = new UpdateVnfNotification.Outputs.Entry();
-
- for (Map.Entry<String, String> mapEntry : sMap.entrySet()) {
- String key = mapEntry.getKey();
- String value = mapEntry.getValue();
- entry.setKey(key);
- entry.setValue(value);
- outputs.getEntry().add(entry);
- }
- }
- return outputs;
- }
-
- private QueryVnfNotification.Outputs copyQueryOutputs(Holder<Map<String, String>> hMap) {
-
- QueryVnfNotification.Outputs outputs = new QueryVnfNotification.Outputs();
-
- if (hMap != null && hMap.value != null) {
- Map<String, String> sMap;
- sMap = hMap.value;
-
- QueryVnfNotification.Outputs.Entry entry = new QueryVnfNotification.Outputs.Entry();
-
- for (Map.Entry<String, String> mapEntry : sMap.entrySet()) {
- String key = mapEntry.getKey();
- String value = mapEntry.getValue();
- entry.setKey(key);
- entry.setValue(value);
- outputs.getEntry().add(entry);
- }
- }
- return outputs;
- }
-
private VnfAdapterNotify getNotifyEP(String notificationUrl) {
URL warWsdlLoc = null;
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 4617299f48..26bce5f362 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
@@ -30,15 +30,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import javax.jws.WebService;
import javax.xml.ws.Holder;
-import org.apache.commons.collections.CollectionUtils;
import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnf.exceptions.VnfNotFound;
-import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.HeatEnvironment;
import org.onap.so.db.catalog.beans.HeatFiles;
@@ -51,26 +47,17 @@ import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
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.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
import org.onap.so.openstack.beans.VnfRollback;
-import org.onap.so.openstack.beans.VnfStatus;
-import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.onap.so.openstack.exceptions.MsoHeatNotFoundException;
import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoHeatUtilsWithUpdate;
-import org.openstack4j.model.compute.Flavor;
-import org.openstack4j.model.compute.Image;
-import org.openstack4j.model.compute.Server;
-import org.openstack4j.model.heat.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -81,11 +68,9 @@ import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-@WebService(serviceName = "VnfAdapter", endpointInterface = "org.onap.so.adapters.vnf.MsoVnfAdapter",
- targetNamespace = "http://org.onap.so/vnf")
@Component
@Transactional
-public class MsoVnfAdapterImpl implements MsoVnfAdapter {
+public class MsoVnfAdapterImpl {
@Autowired
private CloudConfig cloudConfig;
@@ -96,7 +81,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
private static final Logger logger = LoggerFactory.getLogger(MsoVnfAdapterImpl.class);
- private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter.";
private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq";
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
@@ -139,7 +123,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
/**
* Health Check web method. Does nothing but return to show the adapter is deployed.
*/
- @Override
public void healthCheck() {
logger.debug("Health check call in VNF Adapter");
}
@@ -175,7 +158,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
* @param outputs Holder for Map of VNF outputs from heat (assigned IPs, etc)
* @param rollback Holder for returning VnfRollback object
*/
- @Override
public void createVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfType, String vnfVersion,
String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs,
Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId,
@@ -218,75 +200,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// End createVf shortcut
}
- @Override
- public void updateVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfType, String vnfVersion,
- String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs,
- MsoRequest msoRequest, Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback)
- throws VnfException {
- // As of 1707 - this method should no longer be called
- logger.debug("UpdateVnf called?? This should not be called any longer - update vfModule");
- }
-
- /**
- * This is the "Query VNF" web service implementation. It will look up a VNF by name or ID in the specified cloud
- * and tenant.
- *
- * The method returns an indicator that the VNF exists, its Openstack internal ID, its status, and the set of
- * outputs (from when the stack was created).
- *
- * @param cloudSiteId CLLI code of the cloud site in which to query
- * @param tenantId Openstack tenant identifier
- * @param vnfName VNF Name or Openstack ID
- * @param msoRequest Request tracking information for logs
- * @param vnfExists Flag reporting the result of the query
- * @param vnfId Holder for output VNF Openstack ID
- * @param outputs Holder for Map of VNF outputs from heat (assigned IPs, etc)
- */
- @Override
- public void queryVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest,
- Holder<Boolean> vnfExists, Holder<String> vnfId, Holder<VnfStatus> status,
- Holder<Map<String, String>> outputs) throws VnfException {
-
- logger.debug("Querying VNF {} in {}/{}", vnfName, cloudSiteId, tenantId);
-
- // Will capture execution time for metrics
-
- StackInfo heatStack;
- try {
- heatStack = msoHeatUtils.queryStack(cloudSiteId, cloudOwner, tenantId, vnfName);
- } catch (MsoException me) {
- me.addContext("QueryVNF");
- // Failed to query the Stack due to an openstack exception.
- // Convert to a generic VnfException
- String error =
- "Query VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, tenantId,
- OPENSTACK, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - " + QUERY_STACK, me);
- logger.debug(error);
- throw new VnfException(me);
- }
-
- // Populate the outputs based on the returned Stack information
- //
- if (heatStack == null || heatStack.getStatus() == HeatStatus.NOTFOUND) {
- // Not Found
- vnfExists.value = Boolean.FALSE;
- status.value = VnfStatus.NOTFOUND;
- vnfId.value = null;
- outputs.value = new HashMap<>(); // Return as an empty map
-
- logger.debug("VNF {} not found", vnfName);
- } else {
- vnfExists.value = Boolean.TRUE;
- status.value = stackStatusToVnfStatus(heatStack.getStatus());
- vnfId.value = heatStack.getCanonicalName();
- outputs.value = copyStringOutputs(heatStack.getOutputs());
-
- logger.debug("VNF {} found, ID = {}", vnfName, vnfId.value);
- }
- return;
- }
-
/**
* This is the "Delete VNF" web service implementation. It will delete a VNF by name or ID in the specified cloud
* and tenant.
@@ -299,7 +212,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
* @param vnfName VNF Name or Openstack ID
* @param msoRequest Request tracking information for logs
*/
- @Override
public void deleteVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest)
throws VnfException {
@@ -368,7 +280,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
* client in a successful creation response. The client can pass that object as-is back to the rollbackVnf operation
* to undo the creation.
*/
- @Override
public void rollbackVnf(VnfRollback rollback) throws VnfException {
// rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
@@ -404,19 +315,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
return;
}
- private VnfStatus stackStatusToVnfStatus(HeatStatus stackStatus) {
- switch (stackStatus) {
- case CREATED:
- return VnfStatus.ACTIVE;
- case UPDATED:
- return VnfStatus.ACTIVE;
- case FAILED:
- return VnfStatus.FAILED;
- default:
- return VnfStatus.UNKNOWN;
- }
- }
-
private Map<String, String> copyStringOutputs(Map<String, Object> stackOutputs) {
Map<String, String> stringOutputs = new HashMap<>();
for (Map.Entry<String, Object> entry : stackOutputs.entrySet()) {
@@ -444,69 +342,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
return new HashMap<>(stringInputs);
}
- private void heatbridge(StackInfo heatStack, String cloudOwner, String cloudSiteId, String tenantId,
- String genericVnfName, String vfModuleId) {
- try {
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- CloudIdentity cloudIdentity = cloudSite.getIdentityService();
- String heatStackId = heatStack.getCanonicalName().split("/")[1];
-
- List<String> oobMgtNetNames = new ArrayList<>();
-
- HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, cloudOwner,
- cloudSiteId, cloudSite.getRegionId(), tenantId);
-
- heatBridgeClient.authenticate();
-
- List<Resource> stackResources = heatBridgeClient.queryNestedHeatStackResources(heatStackId);
-
- List<Server> osServers = heatBridgeClient.getAllOpenstackServers(stackResources);
-
- heatBridgeClient.createPserversAndPinterfacesIfNotPresentInAai(stackResources);
-
- List<Image> osImages = heatBridgeClient.extractOpenstackImagesFromServers(osServers);
-
- List<Flavor> osFlavors = heatBridgeClient.extractOpenstackFlavorsFromServers(osServers);
-
- logger.debug("Successfully queried heat stack{} for resources.", heatStackId);
- // os images
- if (osImages != null && !osImages.isEmpty()) {
- heatBridgeClient.buildAddImagesToAaiAction(osImages);
- logger.debug("Successfully built AAI actions to add images.");
- } else {
- logger.debug("No images to update to AAI.");
- }
- // flavors
- if (osFlavors != null && !osFlavors.isEmpty()) {
- heatBridgeClient.buildAddFlavorsToAaiAction(osFlavors);
- logger.debug("Successfully built AAI actions to add flavors.");
- } else {
- logger.debug("No flavors to update to AAI.");
- }
-
- // compute resources
- heatBridgeClient.buildAddVserversToAaiAction(genericVnfName, vfModuleId, osServers);
- logger.debug("Successfully queried compute resources and built AAI vserver actions.");
-
- // neutron resources
- List<String> oobMgtNetIds = new ArrayList<>();
-
- // if no network-id list is provided, however network-name list is
- if (!CollectionUtils.isEmpty(oobMgtNetNames)) {
- oobMgtNetIds = heatBridgeClient.extractNetworkIds(oobMgtNetNames);
- }
- heatBridgeClient.buildAddVserverLInterfacesToAaiAction(stackResources, oobMgtNetIds);
- logger.debug(
- "Successfully queried neutron resources and built AAI actions to add l-interfaces to vservers.");
-
- // Update AAI
- heatBridgeClient.submitToAai();
- } catch (Exception ex) {
- logger.debug("Heatbrige failed for stackId: " + heatStack.getCanonicalName(), ex);
- }
- }
-
private String convertNode(final JsonNode node) {
try {
final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
@@ -570,7 +405,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
return stringMap;
}
- @Override
public void createVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfType,
String vnfVersion, String genericVnfName, String vnfName, String vfModuleId, String requestType,
String volumeGroupHeatStackId, String baseVfHeatStackId, String modelCustomizationUuid,
@@ -1128,17 +962,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
outputs.value = copyStringOutputs(heatStack.getOutputs());
rollback.value = vfRollback;
logger.debug("VF Module {} successfully created", vfModuleName);
- if (enableBridge != null && enableBridge) {
- // call heatbridge
- heatbridge(heatStack, cloudOwner, cloudSiteId, tenantId, genericVnfName, vfModuleId);
- }
} catch (Exception e) {
logger.debug("unhandled exception in create VF", e);
throw new VnfException("Exception during create VF " + e.getMessage());
}
}
- @Override
public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String vnfId,
String vfModuleId, String modelCustomizationUuid, MsoRequest msoRequest,
Holder<Map<String, String>> outputs) throws VnfException {
@@ -1204,15 +1033,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.error(error);
throw new VnfException(me);
}
- // call heatbridge delete
- try {
- new HeatBridgeImpl().deleteVfModuleData(vnfId, vfModuleId);
- } catch (HeatBridgeException e) {
- logger.error("Heatbridge failed to delete AAI data for vf-module: " + vfModuleId, e);
- }
}
- @Override
public void updateVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfType,
String vnfVersion, String vnfName, String requestType, String volumeGroupHeatStackId,
String baseVfHeatStackId, String vfModuleStackId, String modelCustomizationUuid, Map<String, Object> inputs,
@@ -1220,8 +1042,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
throws VnfException {
String vfModuleName = vnfName;
String vfModuleType = vnfType;
- String methodName = "updateVfModule";
- String serviceName = VNF_ADAPTER_SERVICE_NAME + methodName;
StringBuilder sbInit = new StringBuilder();
sbInit.append("updateVfModule: \n");
@@ -1334,7 +1154,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// 1604 Cinder Volume support - handle a nestedStackId if sent (volumeGroupHeatStackId):
StackInfo nestedHeatStack = null;
- Map<String, Object> nestedVolumeOutputs = null;
if (nestedStackId != null) {
try {
logger.debug("Querying for nestedStackId = {}", nestedStackId);
@@ -1360,13 +1179,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
logger.debug("Found nested heat stack - copying values to inputs *later*");
- nestedVolumeOutputs = nestedHeatStack.getOutputs();
msoHeatUtils.copyStringOutputsToInputs(inputs, nestedHeatStack.getOutputs(), false);
}
}
// handle a nestedBaseStackId if sent - this is the stack ID of the base.
StackInfo nestedBaseHeatStack = null;
- Map<String, Object> baseStackOutputs = null;
if (nestedBaseStackId != null) {
try {
logger.debug("Querying for nestedBaseStackId = {}", nestedBaseStackId);
@@ -1392,7 +1209,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
logger.debug("Found nested base heat stack - copying values to inputs *later*");
- baseStackOutputs = nestedBaseHeatStack.getOutputs();
msoHeatUtils.copyStringOutputsToInputs(inputs, nestedBaseHeatStack.getOutputs(), false);
}
}
@@ -1832,56 +1648,4 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
return vfModuleName;
}
- /*
- * Helper method to check a boolean property value - on error return provided default
- */
- private boolean checkBooleanProperty(String propertyName, boolean defaultValue) {
- boolean property = defaultValue;
- try {
- String propertyString = this.environment.getProperty(propertyName);
- if ("true".equalsIgnoreCase(propertyString) || "y".equalsIgnoreCase(propertyString)) {
- property = true;
- } else if ("false".equalsIgnoreCase(propertyString) || "n".equalsIgnoreCase(propertyString)) {
- property = false;
- }
- } catch (Exception e) {
- logger.debug("An exception occured trying to get property {} - defaulting to ", propertyName, defaultValue,
- e);
- property = defaultValue;
- }
- return property;
- }
-
- /*
- * Helper method to combine getFiles and nestedTemplates in to a single Map
- */
- private Map<String, Object> combineGetFilesAndNestedTemplates(Map<String, Object> getFiles,
- Map<String, Object> nestedTemplates) {
- boolean haveGetFiles = true;
- boolean haveNestedTemplates = true;
- Map<String, Object> files = new HashMap<>();
- if (getFiles == null || getFiles.isEmpty()) {
- haveGetFiles = false;
- }
- if (nestedTemplates == null || nestedTemplates.isEmpty()) {
- haveNestedTemplates = false;
- }
- if (haveGetFiles && haveNestedTemplates) {
- for (String keyString : getFiles.keySet()) {
- files.put(keyString, getFiles.get(keyString));
- }
- for (String keyString : nestedTemplates.keySet()) {
- files.put(keyString, nestedTemplates.get(keyString));
- }
- } else {
- // Handle if we only have one or neither:
- if (haveGetFiles) {
- files = getFiles;
- }
- if (haveNestedTemplates) {
- files = nestedTemplates;
- }
- }
- return files;
- }
}
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
deleted file mode 100644
index ba837a9718..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
+++ /dev/null
@@ -1,1142 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * OPENECOMP - MSO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (C) 2018 IBM.
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.vnf;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import javax.jws.WebService;
-import javax.xml.ws.Holder;
-import org.onap.so.logger.LoggingAnchor;
-import com.woorea.openstack.heat.Heat;
-import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-import org.onap.so.cloud.CloudConfig;
-import org.onap.so.db.catalog.beans.CloudSite;
-import org.onap.so.cloudify.beans.DeploymentInfo;
-import org.onap.so.cloudify.beans.DeploymentStatus;
-import org.onap.so.cloudify.exceptions.MsoCloudifyManagerNotFound;
-import org.onap.so.cloudify.utils.MsoCloudifyUtils;
-import org.onap.so.db.catalog.beans.HeatEnvironment;
-import org.onap.so.db.catalog.beans.HeatFiles;
-import org.onap.so.db.catalog.beans.HeatTemplate;
-import org.onap.so.db.catalog.beans.HeatTemplateParam;
-import org.onap.so.db.catalog.beans.VfModule;
-import org.onap.so.db.catalog.beans.VfModuleCustomization;
-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.logging.filter.base.ErrorCode;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.openstack.beans.MsoTenant;
-import org.onap.so.openstack.beans.VnfRollback;
-import org.onap.so.openstack.beans.VnfStatus;
-import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
-import org.onap.so.openstack.exceptions.MsoException;
-import org.onap.so.openstack.exceptions.MsoExceptionCategory;
-import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry;
-import org.onap.so.openstack.utils.MsoHeatEnvironmentParameter;
-import org.onap.so.openstack.utils.MsoKeystoneUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.springframework.transaction.annotation.Transactional;
-
-@Component
-@Transactional
-@WebService(serviceName = "VnfAdapter", endpointInterface = "org.onap.so.adapters.vnf.MsoVnfAdapter",
- targetNamespace = "http://org.onap.so/vnf")
-public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
-
- private static Logger logger = LoggerFactory.getLogger(MsoVnfCloudifyAdapterImpl.class);
-
- private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
- private static final String CLOUDIFY = "Cloudify";
-
- private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
- private static final String BRACKETS = LoggingAnchor.NINE;
- private static final String OPENSTACK = "OpenStack";
-
- @Autowired
- protected CloudConfig cloudConfig;
-
- @Autowired
- private VFModuleCustomizationRepository vfModuleCustomRepo;
-
- @Autowired
- private Environment environment;
-
- @Autowired
- protected MsoKeystoneUtils keystoneUtils;
-
- @Autowired
- protected MsoCloudifyUtils cloudifyUtils;
-
- /**
- * DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL.
- *
- * @see MsoVnfCloudifyAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory)
- */
- public MsoVnfCloudifyAdapterImpl() {
-
- }
-
- /**
- * Health Check web method. Does nothing but return to show the adapter is deployed.
- */
- @Override
- public void healthCheck() {
- logger.debug("Health check call in VNF Cloudify Adapter");
- }
-
- /**
- * This is the "Create VNF" web service implementation. This function is now unsupported and will return an error.
- *
- */
- @Override
- public void createVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfType, String vnfVersion,
- String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs,
- Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId,
- Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback) throws VnfException {
- // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules.
- logger.debug("CreateVNF command attempted but not supported");
- throw new VnfException("CreateVNF: Unsupported command", MsoExceptionCategory.USERDATA);
- }
-
- /**
- * This is the "Update VNF" web service implementation. This function is now unsupported and will return an error.
- *
- */
- @Override
- public void updateVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfType, String vnfVersion,
- String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs,
- MsoRequest msoRequest, Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback)
- throws VnfException {
- // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules.
- logger.debug("UpdateVNF command attempted but not supported");
- throw new VnfException("UpdateVNF: Unsupported command", MsoExceptionCategory.USERDATA);
- }
-
- /**
- * This is the "Query VNF" web service implementation.
- *
- * This really should be QueryVfModule, but nobody ever changed it.
- *
- * For Cloudify, this will look up a deployment by its deployment ID, which is really the same as deployment name,
- * since it assigned by the client when a deployment is created. Also, the input cloudSiteId is used only to
- * identify which Cloudify instance to query, and the tenantId is ignored (since that really only applies for
- * Openstack/Heat).
- *
- * The method returns an indicator that the VNF exists, along with its status and outputs. The input "vnfName" will
- * also be reflected back as its ID.
- *
- * @param cloudSiteId CLLI code of the cloud site in which to query
- * @param cloudOwner cloud owner of the cloud site in which to query
- * @param tenantId Openstack tenant identifier - ignored for Cloudify
- * @param vnfName VNF Name (should match a deployment ID)
- * @param msoRequest Request tracking information for logs
- * @param vnfExists Flag reporting the result of the query
- * @param vnfId Holder for output VNF ID
- * @param outputs Holder for Map of VNF outputs from Cloudify deployment (assigned IPs, etc)
- */
- @Override
- public void queryVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest,
- Holder<Boolean> vnfExists, Holder<String> vnfId, Holder<VnfStatus> status,
- Holder<Map<String, String>> outputs) throws VnfException {
- logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
-
- DeploymentInfo deployment = null;
-
- try {
- deployment = cloudifyUtils.queryDeployment(cloudSiteId, tenantId, vnfName);
- } catch (MsoCloudifyManagerNotFound e) {
- // This site does not have a Cloudify Manager.
- // This isn't an error, just means we won't find the VNF here.
- deployment = null;
- } catch (MsoException me) {
- // Failed to query the Deployment due to a cloudify exception.
- logger.debug("Failed to query the Deployment due to a cloudify exception");
- // Convert to a generic VnfException
- me.addContext("QueryVNF");
- String error = "Query VNF (Cloudify): " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
- + ": " + me;
- logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId,
- CLOUDIFY, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryDeployment", me);
- logger.debug(error);
- throw new VnfException(me);
- }
-
- if (deployment != null && deployment.getStatus() != DeploymentStatus.NOTFOUND) {
- vnfExists.value = Boolean.TRUE;
- status.value = deploymentStatusToVnfStatus(deployment);
- vnfId.value = deployment.getId();
- outputs.value = copyStringOutputs(deployment.getOutputs());
-
- logger.debug("VNF {} found in Cloudify, ID = {}", vnfName, vnfId.value);
- } else {
- vnfExists.value = Boolean.FALSE;
- status.value = VnfStatus.NOTFOUND;
- vnfId.value = null;
- outputs.value = new HashMap<String, String>(); // Return as an empty map
-
- logger.debug("VNF {} not found", vnfName);
- }
- }
-
-
- /**
- * This is the "Delete VNF" web service implementation. This function is now unsupported and will return an error.
- *
- */
- @Override
- public void deleteVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest)
- throws VnfException {
-
- // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules.
- logger.debug("DeleteVNF command attempted but not supported");
- throw new VnfException("DeleteVNF: Unsupported command", MsoExceptionCategory.USERDATA);
- }
-
- /**
- * This web service endpoint will rollback a previous Create VNF operation. A rollback object is returned to the
- * client in a successful creation response. The client can pass that object as-is back to the rollbackVnf operation
- * to undo the creation.
- *
- * TODO: This should be rollbackVfModule and/or rollbackVolumeGroup, but APIs were apparently never updated.
- */
- @Override
- public void rollbackVnf(VnfRollback rollback) throws VnfException {
- // rollback may be null (e.g. if stack already existed when Create was called)
- if (rollback == null) {
- logger.info(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_NULL.toString(), OPENSTACK, "rollbackVnf");
- return;
- }
-
- // Don't rollback if nothing was done originally
- if (!rollback.getVnfCreated()) {
- return;
- }
-
- // Get the elements of the VnfRollback object for easier access
- String cloudSiteId = rollback.getCloudSiteId();
- String cloudOwner = rollback.getCloudOwner();
- String tenantId = rollback.getTenantId();
- String vfModuleId = rollback.getVfModuleStackId();
-
- logger.debug("Rolling Back VF Module {} in {}", vfModuleId, cloudOwner + "/" + cloudSiteId + "/" + tenantId);
-
- DeploymentInfo deployment = null;
-
- // Use the MsoCloudifyUtils to delete the deployment. Set the polling flag to true.
- // The possible outcomes of deleteStack are a StackInfo object with status
- // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
- // could be thrown.
- try {
- // KLUDGE - Cloudify requires Tenant Name for Openstack. We have the ID.
- // Go directly to Keystone until APIs could be updated to supply the name.
- MsoTenant msoTenant = keystoneUtils.queryTenant(tenantId, cloudSiteId);
- String tenantName = (msoTenant != null ? msoTenant.getTenantName() : tenantId);
-
- // TODO: Get a reasonable timeout. Use a global property, or store the creation timeout in rollback object
- // and use that.
- deployment = cloudifyUtils.uninstallAndDeleteDeployment(cloudSiteId, tenantName, vfModuleId, 5);
- logger.debug("Rolled back deployment: {}", deployment.getId());
- } catch (MsoException me) {
- // Failed to rollback the VNF due to a cloudify exception.
- // Convert to a generic VnfException
- me.addContext("RollbackVNF");
- String error = "Rollback VF Module: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/"
- + tenantId + ": " + me;
- logger.error(BRACKETS, MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId,
- tenantId, CLOUDIFY, "DeleteDeployment", ErrorCode.DataError.getValue(),
- "Exception - DeleteDeployment", me);
- logger.debug(error);
- throw new VnfException(me);
- }
- }
-
-
- private VnfStatus deploymentStatusToVnfStatus(DeploymentInfo deployment) {
- // Determine the status based on last action & status
- // DeploymentInfo object should be enhanced to report a better status internally.
- DeploymentStatus status = deployment.getStatus();
- String lastAction = deployment.getLastAction();
-
- if (status == null || lastAction == null) {
- return VnfStatus.UNKNOWN;
- } else if (status == DeploymentStatus.NOTFOUND) {
- return VnfStatus.NOTFOUND;
- } else if (status == DeploymentStatus.INSTALLED) {
- return VnfStatus.ACTIVE;
- } else if (status == DeploymentStatus.CREATED) {
- // Should have an INACTIVE status for this case. Shouldn't really happen, but
- // Install was never run, or Uninstall was done but deployment didn't get deleted.
- return VnfStatus.UNKNOWN;
- } else if (status == DeploymentStatus.FAILED) {
- return VnfStatus.FAILED;
- }
-
- return VnfStatus.UNKNOWN;
- }
-
- private Map<String, String> copyStringOutputs(Map<String, Object> stackOutputs) {
- Map<String, String> stringOutputs = new HashMap<>();
- for (Map.Entry<String, Object> entry : stackOutputs.entrySet()) {
- if (entry.getValue() instanceof String) {
- stringOutputs.put(entry.getKey(), (String) entry.getValue());
- } else if (entry.getValue() instanceof Integer) {
- try {
- String str = "" + entry.getValue();
- stringOutputs.put(entry.getKey(), str);
- } catch (Exception e) {
- logger.error("Unable to add " + entry.getKey() + " to outputs", e);
- }
- } else if (entry.getValue() instanceof JsonNode) {
- try {
- String str = this.convertNode((JsonNode) entry.getValue());
- stringOutputs.put(entry.getKey(), str);
- } catch (Exception e) {
- logger.error("Unable to add " + entry.getKey() + " to outputs - exception converting JsonNode", e);
- }
- } else if (entry.getValue() instanceof java.util.LinkedHashMap) {
- try {
- String str = JSON_MAPPER.writeValueAsString(entry.getValue());
- stringOutputs.put(entry.getKey(), str);
- } catch (Exception e) {
- logger.error("Unable to add " + entry.getKey() + " to outputs - exception converting LinkedHashMap",
- e);
- }
- } else {
- try {
- String str = entry.getValue().toString();
- stringOutputs.put(entry.getKey(), str);
- } catch (Exception e) {
- logger.error("Unable to add " + entry.getKey() + " to outputs - unable to call .toString() ", e);
- }
- }
- }
- return stringOutputs;
- }
-
-
- private void sendMapToDebug(Map<String, Object> inputs, String optionalName) {
- int i = 0;
- StringBuilder sb = new StringBuilder(optionalName == null ? "\ninputs" : "\n" + optionalName);
- if (inputs == null) {
- sb.append("\tNULL");
- } else if (inputs.size() < 1) {
- sb.append("\tEMPTY");
- } else {
- for (Map.Entry<String, Object> entry : inputs.entrySet()) {
- String outputString;
- try {
- outputString = entry.getValue().toString();
- } catch (Exception e) {
- outputString = "Unable to call toString() on the value for " + entry.getKey();
- }
- sb.append("\t\nitem " + i++ + ": '" + entry.getKey() + "'='" + outputString + "'");
- }
- }
- logger.debug(sb.toString());
- }
-
- private void sendMapToDebug(Map<String, Object> inputs) {
- int i = 0;
- StringBuilder sb = new StringBuilder("inputs:");
- if (inputs == null) {
- sb.append("\tNULL");
- } else if (inputs.size() < 1) {
- sb.append("\tEMPTY");
- } else {
- for (Map.Entry<String, Object> entry : inputs.entrySet()) {
- sb.append("\titem " + i++ + ": " + entry.getKey() + "=" + entry.getValue());
- }
- }
- logger.debug(sb.toString());
- }
-
- private String convertNode(final JsonNode node) {
- try {
- final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
- final String json = JSON_MAPPER.writeValueAsString(obj);
- return json;
- } catch (JsonParseException jpe) {
- logger.error("Error converting json to string ", jpe);
- } catch (Exception e) {
- logger.error("Error converting json to string ", e);
- }
- return "[Error converting json to string]";
- }
-
- private Map<String, String> convertMapStringObjectToStringString(Map<String, Object> objectMap) {
- if (objectMap == null) {
- return null;
- }
- Map<String, String> stringMap = new HashMap<>();
- for (Map.Entry<String, Object> entry : objectMap.entrySet()) {
- if (!stringMap.containsKey(entry.getKey())) {
- Object obj = entry.getValue();
- if (obj instanceof String) {
- stringMap.put(entry.getKey(), (String) entry.getValue());
- } else if (obj instanceof JsonNode) {
- // This is a bit of mess - but I think it's the least impacting
- // let's convert it BACK to a string - then it will get converted back later
- try {
- String str = this.convertNode((JsonNode) obj);
- stringMap.put(entry.getKey(), str);
- } catch (Exception e) {
- logger.error("DANGER WILL ROBINSON: unable to convert value for JsonNode " + entry.getKey(), e);
- // okay in this instance - only string values (fqdn) are expected to be needed
- }
- } else if (obj instanceof java.util.LinkedHashMap) {
- logger.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode");
- try {
- String str = JSON_MAPPER.writeValueAsString(obj);
- stringMap.put(entry.getKey(), str);
- } catch (Exception e) {
- logger.error(
- "DANGER WILL ROBINSON: unable to convert value for LinkedHashMap " + entry.getKey(), e);
- }
- } else if (obj instanceof Integer) {
- try {
- String str = "" + obj;
- stringMap.put(entry.getKey(), str);
- } catch (Exception e) {
- logger.error("DANGER WILL ROBINSON: unable to convert value for Integer " + entry.getKey(), e);
- }
- } else {
- try {
- String str = obj.toString();
- stringMap.put(entry.getKey(), str);
- } catch (Exception e) {
- logger.error("DANGER WILL ROBINSON: unable to convert value " + entry.getKey(), e);
- }
- }
- }
- }
-
- return stringMap;
- }
-
- /**
- * This is the "Create VF Module" web service implementation. It will instantiate a new VF Module of the requested
- * type in the specified cloud and tenant. The tenant must exist before this service is called.
- *
- * If a VF Module with the same name already exists, this can be considered a success or failure, depending on the
- * value of the 'failIfExists' parameter.
- *
- * All VF Modules are defined in the MSO catalog. The caller must request one of the pre-defined module types or an
- * error will be returned. Within the catalog, each VF Module references (among other things) a cloud template which
- * is used to deploy the required artifacts (VMs, networks, etc.) to the cloud. In this adapter implementation, that
- * artifact is expected to be a Cloudify blueprint.
- *
- * Depending on the blueprint, a variable set of input parameters will be defined, some of which are required. The
- * caller is responsible to pass the necessary input data for the module or an error will be thrown.
- *
- * The method returns the vfModuleId, a Map of output attributes, and a VnfRollback object. This last object can be
- * passed as-is to the rollbackVnf operation to undo everything that was created for the Module. This is useful if a
- * VF module is successfully created but the orchestration fails on a subsequent step.
- *
- * @param cloudSiteId CLLI code of the cloud site in which to create the VNF
- * @param cloudOwner cloud owner of the cloud site in which to create the VNF
- * @param tenantId Openstack tenant identifier
- * @param vfModuleType VF Module type key, should match a VNF definition in catalog DB. Deprecated - should use
- * modelCustomizationUuid
- * @param vnfVersion VNF version key, should match a VNF definition in catalog DB Deprecated - VF Module versions
- * also captured by modelCustomizationUuid
- * @param genericVnfId Generic VNF ID
- * @param vfModuleName Name to be assigned to the new VF Module
- * @param vfModuleId Id of the new VF Module
- * @param requestType Indicates if this is a Volume Group or Module request
- * @param volumeGroupId Identifier (i.e. deployment ID) for a Volume Group to attach to a VF Module
- * @param baseVfModuleId Identifier (i.e. deployment ID) of the Base Module if this is an Add-on module
- * @param modelCustomizationUuid Unique ID for the VF Module's model. Replaces the use of vfModuleType.
- * @param inputs Map of key=value inputs for VNF stack creation
- * @param failIfExists Flag whether already existing VNF should be considered
- * @param backout Flag whether to suppress automatic backout (for testing)
- * @param msoRequest Request tracking information for logs
- * @param vnfId Holder for output VNF Cloudify Deployment ID
- * @param outputs Holder for Map of VNF outputs from Deployment (assigned IPs, etc)
- * @param rollback Holder for returning VnfRollback object
- */
- @Override
- public void createVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vfModuleType,
- String vnfVersion, String genericVnfId, String vfModuleName, String vfModuleId, String requestType,
- String volumeGroupId, String baseVfModuleId, String modelCustomizationUuid, Map<String, Object> inputs,
- Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId,
- Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback) throws VnfException {
-
- // Require a model customization ID. Every VF Module definition must have one.
- if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) {
- logger.debug("Missing required input: modelCustomizationUuid");
- String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
- logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
- "VF Module ModelCustomizationUuid", CLOUDIFY, ErrorCode.DataError.getValue(),
- "Create VF Module: Missing required input: modelCustomizationUuid");
- logger.debug(error);
- throw new VnfException(error, MsoExceptionCategory.USERDATA);
- }
-
- // Clean up some inputs to make comparisons easier
- if (requestType == null)
- requestType = "";
-
- if ("".equals(volumeGroupId) || "null".equals(volumeGroupId))
- volumeGroupId = null;
-
- if ("".equals(baseVfModuleId) || "null".equals(baseVfModuleId))
- baseVfModuleId = null;
-
- if (inputs == null) {
- // Create an empty set of inputs
- inputs = new HashMap<>();
- logger.debug("inputs == null - setting to empty");
- } else {
- this.sendMapToDebug(inputs);
- }
-
- // Check if this is for a "Volume" module
- boolean isVolumeRequest = false;
- if (requestType.startsWith("VOLUME")) {
- isVolumeRequest = true;
- }
-
- logger.debug("requestType = " + requestType + ", volumeGroupStackId = " + volumeGroupId + ", baseStackId = "
- + baseVfModuleId);
-
- // Build a default rollback object (no actions performed)
- VnfRollback vfRollback = new VnfRollback();
- vfRollback.setCloudSiteId(cloudSiteId);
- vfRollback.setCloudOwner(cloudOwner);
- vfRollback.setTenantId(tenantId);
- vfRollback.setMsoRequest(msoRequest);
- vfRollback.setRequestType(requestType);
- vfRollback.setIsBase(false); // Until we know better
- vfRollback.setVolumeGroupHeatStackId(volumeGroupId);
- vfRollback.setBaseGroupHeatStackId(baseVfModuleId);
- vfRollback.setModelCustomizationUuid(modelCustomizationUuid);
- vfRollback.setMode("CFY");
-
- rollback.value = vfRollback; // Default rollback - no updates performed
-
- // Get the VNF/VF Module definition from the Catalog DB first.
- // There are three relevant records: VfModule, VfModuleCustomization, VnfResource
-
- VfModule vf = null;
- VnfResource vnfResource = null;
- VfModuleCustomization vfmc = null;
-
- try {
- vfmc = vfModuleCustomRepo.findFirstByModelCustomizationUUIDOrderByCreatedDesc(modelCustomizationUuid);
-
- if (vfmc == null) {
- String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid="
- + modelCustomizationUuid;
- logger.debug(error);
- logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
- "VF Module " + "ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb",
- ErrorCode.DataError.getValue(), error);
- throw new VnfException(error, MsoExceptionCategory.USERDATA);
- } else {
- logger.debug("Found vfModuleCust entry " + vfmc.toString());
- }
-
- // Get the vfModule and vnfResource records
- vf = vfmc.getVfModule();
- vnfResource = vfmc.getVfModule().getVnfResources();
- } catch (Exception e) {
-
- logger.error("unhandled exception in create VF - [Query]", e);
- throw new VnfException("Exception during create VF " + e.getMessage());
- }
-
- // Perform a version check against cloudSite
- // Obtain the cloud site information where we will create the VF Module
- Optional<CloudSite> cloudSiteOp = cloudConfig.getCloudSite(cloudSiteId);
- if (!cloudSiteOp.isPresent()) {
- throw new VnfException(new MsoCloudSiteNotFound(cloudSiteId));
- }
- CloudSite cloudSite = cloudSiteOp.get();
- MavenLikeVersioning aicV = new MavenLikeVersioning();
- aicV.setVersion(cloudSite.getCloudVersion());
-
- String vnfMin = vnfResource.getAicVersionMin();
- String vnfMax = vnfResource.getAicVersionMax();
-
- if ((vnfMin != null && !(aicV.isMoreRecentThan(vnfMin) || aicV.isTheSameVersion(vnfMin)))
- || (vnfMax != null && aicV.isMoreRecentThan(vnfMax))) {
- // ERROR
- String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid="
- + vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax
- + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion();
- logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, OPENSTACK,
- ErrorCode.BusinessProcessError.getValue(), "Exception - setVersion");
- logger.debug(error);
- throw new VnfException(error, MsoExceptionCategory.USERDATA);
- }
- // End Version check
-
-
- DeploymentInfo cloudifyDeployment = null;
-
- // First, look up to see if the VF already exists.
-
- try {
- cloudifyDeployment = cloudifyUtils.queryDeployment(cloudSiteId, tenantId, vfModuleName);
- } catch (MsoException me) {
- // Failed to query the Deployment due to a cloudify exception.
- String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
- + tenantId + ": " + me;
- logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
- tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
- "Exception - queryDeployment", me);
- logger.debug(error);
-
- // Convert to a generic VnfException
- me.addContext("CreateVFModule");
- throw new VnfException(me);
- }
-
- // More precise handling/messaging if the Module already exists
- if (cloudifyDeployment != null && !(cloudifyDeployment.getStatus() == DeploymentStatus.NOTFOUND)) {
- // CREATED, INSTALLED, INSTALLING, FAILED, UNINSTALLING, UNKNOWN
- DeploymentStatus status = cloudifyDeployment.getStatus();
- logger.debug("Found Existing Deployment, status=" + status);
-
- if (status == DeploymentStatus.INSTALLED) {
- // fail - it exists
- if (failIfExists != null && failIfExists) {
- String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudOwner + "/"
- + cloudSiteId + "/" + tenantId;
- logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
- cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
- "Deployment " + vfModuleName + " already exists");
- logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
- cloudifyDeployment.getId());
- } else {
- // Found existing deployment and client has not requested "failIfExists".
- // Populate the outputs from the existing deployment.
-
- vnfId.value = cloudifyDeployment.getId();
- outputs.value = copyStringOutputs(cloudifyDeployment.getOutputs());
- return;
- }
- }
- // Check through various detailed error cases
- if (status == DeploymentStatus.INSTALLING || status == DeploymentStatus.UNINSTALLING) {
- // fail - it's in progress - return meaningful error
- String error = "Create VF: Deployment " + vfModuleName + " already exists and has status "
- + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
- + "; please wait for it to complete, or fix manually.";
- logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
- cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
- "Deployment " + vfModuleName + " already exists");
- logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId());
- } else if (status == DeploymentStatus.FAILED) {
- // fail - it exists and is in a FAILED state
- String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in "
- + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
- cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
- "Deployment " + vfModuleName + " already " + "exists and is in FAILED state");
- logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId());
- } else if (status == DeploymentStatus.UNKNOWN || status == DeploymentStatus.CREATED) {
- // fail - it exists and is in a UNKNOWN state
- String error = "Create VF: Deployment " + vfModuleName + " already exists and has status "
- + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
- + "; requires manual intervention.";
- logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
- cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
- "Deployment " + vfModuleName + " already " + "exists and is in " + status.toString()
- + " state");
- logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId());
- } else {
- // Unexpected, since all known status values have been tested for
- String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status "
- + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
- + "; requires manual intervention.";
- logger.error(BRACKETS, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
- cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(),
- "Deployment " + vfModuleName + " already " + "exists and is in an unknown state");
- logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId());
- }
- }
-
-
- // Collect outputs from Base Modules and Volume Modules
- Map<String, Object> baseModuleOutputs = null;
- Map<String, Object> volumeGroupOutputs = null;
-
- // If a Volume Group was provided, query its outputs for inclusion in Module input parameters
- if (volumeGroupId != null) {
- DeploymentInfo volumeDeployment = null;
- try {
- volumeDeployment = cloudifyUtils.queryDeployment(cloudSiteId, tenantId, volumeGroupId);
- } catch (MsoException me) {
- // Failed to query the Volume GroupDeployment due to a cloudify exception.
- String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudOwner + "/"
- + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner, cloudSiteId,
- tenantId, CLOUDIFY, "queryDeployment(volume)", ErrorCode.DataError.getValue(),
- "Exception - queryDeployment(volume)", me);
- logger.debug(error);
- // Convert to a generic VnfException
- me.addContext("CreateVFModule(QueryVolume)");
- throw new VnfException(me);
- }
-
- if (volumeDeployment == null || volumeDeployment.getStatus() == DeploymentStatus.NOTFOUND) {
- String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in "
- + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudSiteId, tenantId,
- error, CLOUDIFY, "queryDeployment(volume)", ErrorCode.BusinessProcessError.getValue(),
- "Create VFModule: Attached Volume Group DOES NOT EXIST");
- logger.debug(error);
- throw new VnfException(error, MsoExceptionCategory.USERDATA);
- } else {
- logger.debug("Found nested volume group");
- volumeGroupOutputs = volumeDeployment.getOutputs();
- this.sendMapToDebug(volumeGroupOutputs, "volumeGroupOutputs");
- }
- }
-
- // If this is an Add-On Module, query the Base Module outputs
- // Note: This will be performed whether or not the current request is for an
- // Add-On Volume Group or Add-On VF Module
-
- if (vf.getIsBase()) {
- logger.debug("This is a BASE Module request");
- vfRollback.setIsBase(true);
- } else {
- logger.debug("This is an Add-On Module request");
-
- // Add-On Modules should always have a Base, but just treat as a warning if not provided.
- // Add-on Volume requests may or may not specify a base.
- if (!isVolumeRequest && baseVfModuleId == null) {
- logger.debug("WARNING: Add-on Module request - no Base Module ID provided");
- }
-
- if (baseVfModuleId != null) {
- DeploymentInfo baseDeployment = null;
- try {
- baseDeployment = cloudifyUtils.queryDeployment(cloudSiteId, tenantId, baseVfModuleId);
- } catch (MsoException me) {
- // Failed to query the Volume GroupDeployment due to a cloudify exception.
- String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudOwner + "/"
- + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudOwner,
- cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)", ErrorCode.DataError.getValue(),
- "Exception - queryDeployment(Base)", me);
- logger.debug(error);
- // Convert to a generic VnfException
- me.addContext("CreateVFModule(QueryBase)");
- throw new VnfException(me);
- }
-
- if (baseDeployment == null || baseDeployment.getStatus() == DeploymentStatus.NOTFOUND) {
- String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in "
- + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudSiteId,
- tenantId, error, CLOUDIFY, "queryDeployment(Base)",
- ErrorCode.BusinessProcessError.getValue(),
- "Create VFModule: Base " + "Module DOES NOT EXIST");
- logger.debug(error);
- throw new VnfException(error, MsoExceptionCategory.USERDATA);
- } else {
- logger.debug("Found base module");
- baseModuleOutputs = baseDeployment.getOutputs();
- this.sendMapToDebug(baseModuleOutputs, "baseModuleOutputs");
- }
- }
- }
-
-
- // Ready to deploy the new VNF
-
- // NOTE: For this section, heatTemplate is used for both HEAT templates and Cloudify blueprints.
- // In final implementation (post-POC), the template object would either be generic or there would
- // be a separate DB Table/Object for Blueprints.
-
-
- // NOTE: The template is fixed for the VF Module. The environment is part of the customization.
- HeatTemplate heatTemplate = null;
- HeatEnvironment heatEnvironment = null;
- if (isVolumeRequest) {
- heatTemplate = vf.getVolumeHeatTemplate();
- heatEnvironment = vfmc.getVolumeHeatEnv();
- } else {
- heatTemplate = vf.getModuleHeatTemplate();
- heatEnvironment = vfmc.getHeatEnvironment();
- }
-
- if (heatTemplate == null) {
- String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType
- + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vf.getModelUUID()
- + ", reqType=" + requestType;
- logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
- vfModuleType, OPENSTACK, ErrorCode.DataError.getValue(), error);
- throw new VnfException(error, MsoExceptionCategory.INTERNAL);
- } else {
- logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate());
- }
-
- if (heatEnvironment == null) {
- String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid="
- + modelCustomizationUuid + ", vfModuleUuid=" + vf.getModelUUID() + ", reqType=" + requestType;
- logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
- OPENSTACK, ErrorCode.DataError.getValue(), error);
- // Alarm on this error, configuration must be fixed
- throw new VnfException(error, MsoExceptionCategory.INTERNAL);
- } else {
- logger.debug("Got Heat Environment from DB: {}", heatEnvironment.getEnvironment());
- }
-
-
- try {
- // All variables converted to their native object types
- HashMap<String, Object> goldenInputs = new HashMap<>();
- List<String> extraInputs = new ArrayList<>();
-
- // NOTE: SKIP THIS FOR CLOUDIFY for now. Just use what was passed in.
- // This whole section needs to be rewritten.
- Boolean skipInputChecks = false;
-
- if (skipInputChecks) {
- goldenInputs = new HashMap<>();
- for (Map.Entry<String, Object> entry : inputs.entrySet()) {
- goldenInputs.put(entry.getKey(), entry.getValue());
- }
- } else {
- // Build maps for the parameters (including aliases) to simplify checks
- HashMap<String, HeatTemplateParam> params = new HashMap<>();
-
- Set<HeatTemplateParam> paramSet = heatTemplate.getParameters();
- logger.debug("paramSet has {} entries", paramSet.size());
-
- for (HeatTemplateParam htp : paramSet) {
- params.put(htp.getParamName(), htp);
-
- // Include aliases.
- String alias = htp.getParamAlias();
- if (alias != null && !"".equals(alias) && !params.containsKey(alias)) {
- params.put(alias, htp);
- }
- }
-
- // First, convert all inputs to their "template" type
- for (String key : inputs.keySet()) {
- if (params.containsKey(key)) {
- Object value = cloudifyUtils.convertInputValue(inputs.get(key), params.get(key));
- if (value != null) {
- goldenInputs.put(key, value);
- } else {
- logger.debug("Failed to convert input " + key + "='" + inputs.get(key) + "' to "
- + params.get(key).getParamType());
- }
- } else {
- extraInputs.add(key);
- }
- }
-
- if (!extraInputs.isEmpty()) {
- logger.debug("Ignoring extra inputs: " + extraInputs);
- }
-
- // Next add in Volume Group Outputs if there are any. Copy directly without conversions.
- if (volumeGroupOutputs != null && !volumeGroupOutputs.isEmpty()) {
- for (Map.Entry<String, Object> entry : volumeGroupOutputs.entrySet()) {
- if (params.containsKey(entry.getKey()) && !goldenInputs.containsKey(entry.getKey())) {
- goldenInputs.put(entry.getKey(), entry.getValue());
- }
- }
- }
-
- // Next add in Base Module Outputs if there are any. Copy directly without conversions.
- if (baseModuleOutputs != null && !baseModuleOutputs.isEmpty()) {
- for (Map.Entry<String, Object> entry : baseModuleOutputs.entrySet()) {
- if (params.containsKey(entry.getKey()) && !goldenInputs.containsKey(entry.getKey())) {
- goldenInputs.put(entry.getKey(), entry.getValue());
- }
- }
- }
-
- // Last, add in values from the "environment" file.
- // These are added to the inputs, since Cloudify doesn't pass an environment file like Heat.
-
- // TODO: This may take a different form for Cloudify, but for now process it
- // with Heat environment file syntax
- StringBuilder sb = new StringBuilder(heatEnvironment.getEnvironment());
- MsoHeatEnvironmentEntry mhee = new MsoHeatEnvironmentEntry(sb);
-
- if (mhee.getParameters() != null) {
- for (MsoHeatEnvironmentParameter envParam : mhee.getParameters()) {
- // If this is a template input, copy to golden inputs
- String envKey = envParam.getName();
- if (params.containsKey(envKey) && !goldenInputs.containsKey(envKey)) {
- Object value = cloudifyUtils.convertInputValue(envParam.getValue(), params.get(envKey));
- if (value != null) {
- goldenInputs.put(envKey, value);
- } else {
- logger.debug("Failed to convert environment parameter " + envKey + "='"
- + envParam.getValue() + "' to " + params.get(envKey).getParamType());
- }
- }
- }
- }
-
- this.sendMapToDebug(goldenInputs, "Final inputs sent to Cloudify");
-
-
- // Check that required parameters have been supplied from any of the sources
- String missingParams = null;
- boolean checkRequiredParameters = true;
- try {
- String propertyString = this.environment.getProperty(MsoVnfCloudifyAdapterImpl.CHECK_REQD_PARAMS);
- if ("false".equalsIgnoreCase(propertyString) || "n".equalsIgnoreCase(propertyString)) {
- checkRequiredParameters = false;
- logger.debug("CheckRequiredParameters is FALSE. Will still check but then skip blocking... {}",
- MsoVnfCloudifyAdapterImpl.CHECK_REQD_PARAMS);
- }
- } catch (Exception e) {
- // No problem - default is true
- logger.error("An exception occured trying to get property {}",
- MsoVnfCloudifyAdapterImpl.CHECK_REQD_PARAMS, e);
- }
-
-
- for (HeatTemplateParam parm : heatTemplate.getParameters()) {
- if (parm.isRequired() && (!goldenInputs.containsKey(parm.getParamName()))) {
- logger.debug("adding to missing parameters list: {}", parm.getParamName());
- if (missingParams == null) {
- missingParams = parm.getParamName();
- } else {
- missingParams += "," + parm.getParamName();
- }
- }
- }
-
- if (missingParams != null) {
- if (checkRequiredParameters) {
- // Problem - missing one or more required parameters
- String error = "Create VFModule: Missing Required inputs: " + missingParams;
- logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams,
- CLOUDIFY, ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
- logger.debug(error);
- throw new VnfException(error, MsoExceptionCategory.USERDATA);
- } else {
- logger.debug("found missing parameters [" + missingParams
- + "] - but checkRequiredParameters is false -" + " will not block");
- }
- } else {
- logger.debug("No missing parameters found - ok to proceed");
- }
-
- } // NOTE: END PARAMETER CHECKING
-
- // Ready to deploy the VF Module.
- // *First step - make sure the blueprint is loaded into Cloudify.
- String blueprintName = heatTemplate.getTemplateName();
- String blueprint = heatTemplate.getTemplateBody();
- String blueprintId = blueprintName;
-
- // Use the main blueprint name as the blueprint ID (strip yaml extensions).
- if (blueprintId.endsWith(".yaml"))
- blueprintId = blueprintId.substring(0, blueprintId.lastIndexOf(".yaml"));
-
- try {
- if (!cloudifyUtils.isBlueprintLoaded(cloudSiteId, blueprintId)) {
- logger.debug("Blueprint " + blueprintId + " is not loaded. Will upload it now.");
-
- Map<String, byte[]> blueprintFiles = new HashMap<>();
-
- blueprintFiles.put(blueprintName, blueprint.getBytes());
-
- // TODO: Implement nested blueprint logic based on Cloudify structures.
- // For now, just use the Heat structures.
- // The query returns a map of String->Object, where the map keys provide one layer of
- // indirection from the Heat template names. For this case, assume the map key matches
- // the nested blueprint name.
- List<HeatTemplate> nestedBlueprints = heatTemplate.getChildTemplates();
- if (nestedBlueprints != null) {
- for (HeatTemplate nestedBlueprint : nestedBlueprints) {
- blueprintFiles.put(nestedBlueprint.getTemplateName(),
- nestedBlueprint.getTemplateBody().getBytes());
- }
- }
-
- // TODO: Implement file artifact logic based on Cloudify structures.
- // For now, just use the Heat structures.
- List<HeatFiles> heatFiles = vf.getHeatFiles();
- if (heatFiles != null) {
- for (HeatFiles heatFile : heatFiles) {
- blueprintFiles.put(heatFile.getFileName(), heatFile.getFileBody().getBytes());
- }
- }
-
- // Upload the blueprint package
- cloudifyUtils.uploadBlueprint(cloudSiteId, blueprintId, blueprintName, blueprintFiles, false);
-
- }
- }
-
- catch (MsoException me) {
- me.addContext("CreateVFModule");
- String error = "Create VF Module: Upload blueprint failed. Blueprint=" + blueprintName + ": " + me;
- logger.error(LoggingAnchor.SEVEN, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
- tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "MsoException - uploadBlueprint", me);
- logger.debug(error);
- throw new VnfException(me);
- }
-
- // Ignore MsoTenantNotFound and MsoStackAlreadyExists exceptions
- // because we already checked for those.
- try {
- // KLUDGE - Cloudify requires Tenant Name for Openstack. We have the ID.
- // Go directly to Keystone until APIs could be updated to supply the name.
- MsoTenant msoTenant = keystoneUtils.queryTenant(tenantId, cloudSiteId);
- String tenantName = (msoTenant != null ? msoTenant.getTenantName() : tenantId);
-
- if (backout == null) {
- backout = true;
- }
-
- cloudifyDeployment = cloudifyUtils.createAndInstallDeployment(cloudSiteId, tenantName, vfModuleName,
- blueprintId, goldenInputs, true, heatTemplate.getTimeoutMinutes(), backout.booleanValue());
-
- } catch (MsoException me) {
- me.addContext("CreateVFModule");
- String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/"
- + tenantId + ": " + me;
- logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
- cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
- "MsoException - createDeployment", me);
- logger.debug(error);
- throw new VnfException(me);
- } catch (NullPointerException npe) {
- String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/"
- + tenantId + ": " + npe;
- logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
- cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(),
- "NullPointerException - createDeployment", npe);
- logger.debug(error);
- logger.debug("NULL POINTER EXCEPTION at cloudify.createAndInstallDeployment");
- // npe.addContext ("CreateVNF");
- throw new VnfException("NullPointerException during cloudify.createAndInstallDeployment");
- } catch (Exception e) {
- logger.error("unhandled exception at cloudify.createAndInstallDeployment", e);
- throw new VnfException("Exception during cloudify.createAndInstallDeployment! " + e.getMessage());
- }
- } catch (Exception e) {
- logger.error("unhandled exception in create VF", e);
- throw new VnfException("Exception during create VF " + e.getMessage());
-
- }
-
- // Reach this point if create is successful.
- // Populate remaining rollback info and response parameters.
- vfRollback.setVnfCreated(true);
- vfRollback.setVnfId(cloudifyDeployment.getId());
- vnfId.value = cloudifyDeployment.getId();
- outputs.value = copyStringOutputs(cloudifyDeployment.getOutputs());
-
- rollback.value = vfRollback;
-
- logger.debug("VF Module successfully created {}", vfModuleName);
-
- }
-
- public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String vnfId,
- String vfModuleId, String modelCustomizationUuid, MsoRequest msoRequest,
- Holder<Map<String, String>> outputs) throws VnfException {
- logger.debug("Deleting VF " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
-
- // 1702 capture the output parameters on a delete
- // so we'll need to query first
- DeploymentInfo deployment = null;
- try {
- deployment = cloudifyUtils.queryDeployment(cloudSiteId, tenantId, vnfName);
- } catch (MsoException me) {
- // Failed to query the deployment. Convert to a generic VnfException
- me.addContext("DeleteVFModule");
- String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId
- + "/" + tenantId + ": " + me;
- logger.error(BRACKETS, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId,
- CLOUDIFY, "QueryDeployment", ErrorCode.DataError.getValue(), "Exception - QueryDeployment", me);
- logger.debug(error);
- throw new VnfException(me);
- }
- // call method which handles the conversion from Map<String,Object> to Map<String,String> for our expected
- // Object types
- outputs.value = convertMapStringObjectToStringString(deployment.getOutputs());
-
- // Use the MsoHeatUtils to delete the stack. Set the polling flag to true.
- // The possible outcomes of deleteStack are a StackInfo object with status
- // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
- // could be thrown.
- try {
- cloudifyUtils.uninstallAndDeleteDeployment(cloudSiteId, tenantId, vnfName, 5);
- } catch (MsoException me) {
- me.addContext("DeleteVfModule");
- // Convert to a generic VnfException
- String error =
- "Delete VF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error(BRACKETS, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId,
- "DeleteDeployment", "DeleteDeployment", ErrorCode.DataError.getValue(),
- "Exception - DeleteDeployment: " + me.getMessage());
- logger.debug(error);
- throw new VnfException(me);
- }
-
- // On success, nothing is returned.
- return;
- }
-
- // TODO: Should Update be supported for Cloudify? What would this look like?
- @Override
- public void updateVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfType,
- String vnfVersion, String vnfName, String requestType, String volumeGroupHeatStackId,
- String baseVfHeatStackId, String vfModuleStackId, String modelCustomizationUuid, Map<String, Object> inputs,
- MsoRequest msoRequest, Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback)
- throws VnfException {
- // This operation is not currently supported for Cloudify-orchestrated VF Modules.
- logger.debug("Update VF Module command attempted but not supported");
- throw new VnfException("UpdateVfModule: Unsupported command", MsoExceptionCategory.USERDATA);
- }
-
-}
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
deleted file mode 100644
index 0ecfd15dde..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
+++ /dev/null
@@ -1,1169 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-/**
- * This VNF Adapter implementation is based on the VDU Plugin model. It assumes that each VF Module definition in the
- * MSO catalog is expressed via a set of template and/or file artifacts that are appropriate for some specific
- * sub-orchestrator that provides an implementation of the VduPlugin interface. This adapter handles all of the common
- * VF Module logic, including: - catalog lookups for artifact retrieval - parameter filtering and validation - base and
- * volume module queries - rollback logic - logging and error handling
- *
- * Then based on the orchestration mode of the VNF, it will invoke different VDU plug-ins to perform the low level
- * instantiations, deletions, and queries. At this time, the set of available plug-ins is hard-coded, though in the
- * future a dynamic selection is expected (e.g. via a service-provider interface).
- */
-package org.onap.so.adapters.vnf;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import javax.jws.WebService;
-import javax.xml.ws.Holder;
-import org.onap.so.logger.LoggingAnchor;
-import org.onap.so.adapters.vdu.CloudInfo;
-import org.onap.so.adapters.vdu.VduException;
-import org.onap.so.adapters.vdu.VduInstance;
-import org.onap.so.adapters.vdu.VduModelInfo;
-import org.onap.so.adapters.vdu.VduPlugin;
-import org.onap.so.adapters.vdu.VduStateType;
-import org.onap.so.adapters.vdu.VduStatus;
-import org.onap.so.adapters.vdu.mapper.VfModuleCustomizationToVduMapper;
-import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-import org.onap.so.cloud.CloudConfig;
-import org.onap.so.db.catalog.beans.CloudSite;
-import org.onap.so.cloudify.utils.MsoCloudifyUtils;
-import org.onap.so.db.catalog.beans.HeatEnvironment;
-import org.onap.so.db.catalog.beans.HeatTemplate;
-import org.onap.so.db.catalog.beans.HeatTemplateParam;
-import org.onap.so.db.catalog.beans.VfModule;
-import org.onap.so.db.catalog.beans.VfModuleCustomization;
-import org.onap.so.db.catalog.beans.VnfResource;
-import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
-import org.onap.so.db.catalog.utils.MavenLikeVersioning;
-import org.onap.so.entity.MsoRequest;
-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;
-import org.onap.so.openstack.exceptions.MsoException;
-import org.onap.so.openstack.exceptions.MsoExceptionCategory;
-import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry;
-import org.onap.so.openstack.utils.MsoHeatUtils;
-import org.onap.so.openstack.utils.MsoKeystoneUtils;
-import org.onap.so.openstack.utils.MsoMulticloudUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@WebService(serviceName = "VnfAdapter", endpointInterface = "org.onap.so.adapters.vnf.MsoVnfAdapter",
- targetNamespace = "http://org.onap.so/vnf")
-@Component
-@Transactional
-public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
-
- private static Logger logger = LoggerFactory.getLogger(MsoVnfPluginAdapterImpl.class);
-
- private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
- private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
-
- @Autowired
- protected CloudConfig cloudConfig;
-
- @Autowired
- private VFModuleCustomizationRepository vfModuleCustomRepo;
-
- @Autowired
- private Environment environment;
-
- @Autowired
- protected MsoKeystoneUtils keystoneUtils;
-
- @Autowired
- protected MsoCloudifyUtils cloudifyUtils;
-
- @Autowired
- protected MsoHeatUtils heatUtils;
-
- @Autowired
- protected MsoMulticloudUtils multicloudUtils;
-
- @Autowired
- protected VfModuleCustomizationToVduMapper vduMapper;
-
- /**
- * DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL.
- *
- * @see MsoVnfPluginAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory)
- */
- public MsoVnfPluginAdapterImpl() {
-
- }
-
- /**
- * Health Check web method. Does nothing but return to show the adapter is deployed.
- */
- @Override
- public void healthCheck() {
- logger.debug("Health check call in VNF Plugin Adapter");
- }
-
- /**
- * This is the "Create VNF" web service implementation. This function is now unsupported and will return an error.
- *
- */
- @Override
- public void createVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfType, String vnfVersion,
- String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs,
- Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId,
- Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback) throws VnfException {
- // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules.
- logger.debug("CreateVNF command attempted but not supported");
- throw new VnfException("CreateVNF: Unsupported command", MsoExceptionCategory.USERDATA);
- }
-
- /**
- * This is the "Update VNF" web service implementation. This function is now unsupported and will return an error.
- *
- */
- @Override
- public void updateVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfType, String vnfVersion,
- String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs,
- MsoRequest msoRequest, Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback)
- throws VnfException {
- // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules.
- logger.debug("UpdateVNF command attempted but not supported");
- throw new VnfException("UpdateVNF: Unsupported command", MsoExceptionCategory.USERDATA);
- }
-
- /**
- * This is the "Query VNF" web service implementation.
- *
- * This really should be QueryVfModule, but nobody ever changed it.
- *
- * The method returns an indicator that the VNF exists, along with its status and outputs. The input "vnfName" will
- * also be reflected back as its ID.
- *
- * @param cloudSiteId CLLI code of the cloud site in which to query
- * @param tenantId Openstack tenant identifier
- * @param vnfNameOrId VNF Name or ID to query
- * @param msoRequest Request tracking information for logs
- * @param vnfExists Flag reporting the result of the query
- * @param vnfId Holder for output VNF ID
- * @param outputs Holder for Map of outputs from the deployed VF Module (assigned IPs, etc)
- */
- @Override
- public void queryVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfNameOrId,
- MsoRequest msoRequest, Holder<Boolean> vnfExists, Holder<String> vnfId, Holder<VnfStatus> status,
- Holder<Map<String, String>> outputs) throws VnfException {
- logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
-
- VduInstance vduInstance;
- CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null);
-
- VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
-
- try {
- vduInstance = vduPlugin.queryVdu(cloudInfo, vnfNameOrId);
- } catch (VduException e) {
- // Failed to query the VDU due to a plugin exception.
- // Convert to a generic VnfException
- e.addContext("QueryVNF");
- String error = "Query VNF (VDU): " + vnfNameOrId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
- + ": " + e;
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudOwner,
- cloudSiteId, tenantId, "VDU", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryVDU",
- e);
- logger.debug(error);
- throw new VnfException(e);
- }
-
- if (vduInstance != null && vduInstance.getStatus().getState() != VduStateType.NOTFOUND) {
- vnfExists.value = Boolean.TRUE;
- status.value = vduStatusToVnfStatus(vduInstance);
- vnfId.value = vduInstance.getVduInstanceId();
- outputs.value = copyStringOutputs(vduInstance.getOutputs());
-
- logger.debug("VNF {} found, ID = {}", vnfNameOrId, vnfId.value);
- } else {
- vnfExists.value = Boolean.FALSE;
- status.value = VnfStatus.NOTFOUND;
- vnfId.value = null;
- outputs.value = new HashMap<String, String>(); // Return as an empty map
-
- logger.debug("VNF {} not found", vnfNameOrId);
- }
- return;
- }
-
-
- /**
- * This is the "Delete VNF" web service implementation. This function is now unsupported and will return an error.
- *
- */
- @Override
- public void deleteVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest)
- throws VnfException {
-
- // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules.
- logger.debug("DeleteVNF command attempted but not supported");
- throw new VnfException("DeleteVNF: Unsupported command", MsoExceptionCategory.USERDATA);
- }
-
- /**
- * This web service endpoint will rollback a previous Create VNF operation. A rollback object is returned to the
- * client in a successful creation response. The client can pass that object as-is back to the rollbackVnf operation
- * to undo the creation.
- *
- * TODO: This should be rollbackVfModule and/or rollbackVolumeGroup, but APIs were apparently never updated.
- */
- @Override
- public void rollbackVnf(VnfRollback rollback) throws VnfException {
- // rollback may be null (e.g. if stack already existed when Create was called)
- if (rollback == null) {
- logger.info(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
- return;
- }
-
- // Don't rollback if nothing was done originally
- if (!rollback.getVnfCreated()) {
- return;
- }
-
- // Get the elements of the VnfRollback object for easier access
- String cloudSiteId = rollback.getCloudSiteId();
- String cloudOwner = rollback.getCloudOwner();
- String tenantId = rollback.getTenantId();
- CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null);
-
- String vfModuleId = rollback.getVfModuleStackId();
-
- logger.debug("Rolling Back VF Module " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
-
- VduInstance vduInstance = null;
-
- // Use the VduPlugin to delete the VF Module.
- VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
-
- try {
- // TODO: Get a reasonable timeout. Use a global property, or store the creation timeout in rollback object
- // and use that.
- vduInstance = vduPlugin.deleteVdu(cloudInfo, vfModuleId, 5);
-
- logger.debug("Rolled back VDU instantiation: {}", vduInstance.getVduInstanceId());
- } catch (VduException ve) {
- // Failed to rollback the VF Module due to a plugin exception.
- // Convert to a generic VnfException
- ve.addContext("RollbackVFModule");
- String error = "Rollback VF Module: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/"
- + tenantId + ": " + ve;
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
- cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(), "Exception - DeleteVdu",
- ve);
- logger.debug(error);
- throw new VnfException(ve);
- }
- return;
- }
-
-
- private VnfStatus vduStatusToVnfStatus(VduInstance vdu) {
- // Determine the status based on last action & status
- // DeploymentInfo object should be enhanced to report a better status internally.
- VduStatus vduStatus = vdu.getStatus();
- VduStateType status = vduStatus.getState();
-
- if (status == null) {
- return VnfStatus.UNKNOWN;
- } else if (status == VduStateType.NOTFOUND) {
- return VnfStatus.NOTFOUND;
- } else if (status == VduStateType.INSTANTIATED) {
- return VnfStatus.ACTIVE;
- } else if (status == VduStateType.FAILED) {
- return VnfStatus.FAILED;
- }
-
- return VnfStatus.UNKNOWN;
- }
-
- /*
- * Normalize an input value to an Object, based on the target parameter type. If the type is not recognized, it will
- * just be returned unchanged (as a string).
- */
- private Object convertInputValue(Object inputValue, HeatTemplateParam templateParam) {
- String type = templateParam.getParamType();
- logger.debug("Parameter: {} is of type ", templateParam.getParamName(), type);
-
- if ("number".equalsIgnoreCase(type)) {
- try {
- return Integer.valueOf(inputValue.toString());
- } catch (Exception e) {
- logger.debug("Unable to convert " + inputValue + " to an integer!", e);
- return null;
- }
- } else if ("json".equalsIgnoreCase(type)) {
- try {
- JsonNode jsonNode = JSON_MAPPER.readTree(JSON_MAPPER.writeValueAsString(inputValue));
- return jsonNode;
- } catch (Exception e) {
- logger.debug("Unable to convert " + inputValue + " to a JsonNode!", e);
- return null;
- }
- } else if ("boolean".equalsIgnoreCase(type)) {
- return Boolean.valueOf(inputValue.toString());
- }
-
- // Nothing else matched. Return the original string
- return inputValue;
- }
-
- private Map<String, String> copyStringOutputs(Map<String, Object> stackOutputs) {
- Map<String, String> stringOutputs = new HashMap<>();
- for (String key : stackOutputs.keySet()) {
- if (stackOutputs.get(key) instanceof String) {
- stringOutputs.put(key, (String) stackOutputs.get(key));
- } else if (stackOutputs.get(key) instanceof Integer) {
- try {
- String str = "" + stackOutputs.get(key);
- stringOutputs.put(key, str);
- } catch (Exception e) {
- logger.debug("Unable to add {} to outputs", key, e);
- }
- } else if (stackOutputs.get(key) instanceof JsonNode) {
- try {
- String str = this.convertNode((JsonNode) stackOutputs.get(key));
- stringOutputs.put(key, str);
- } catch (Exception e) {
- logger.debug("Unable to add {} to outputs - exception converting JsonNode", key, e);
- }
- } else if (stackOutputs.get(key) instanceof java.util.LinkedHashMap) {
- try {
- String str = JSON_MAPPER.writeValueAsString(stackOutputs.get(key));
- stringOutputs.put(key, str);
- } catch (Exception e) {
- logger.debug("Unable to add {} to outputs - exception converting LinkedHashMap", key, e);
- }
- } else {
- try {
- String str = stackOutputs.get(key).toString();
- stringOutputs.put(key, str);
- } catch (Exception e) {
- logger.debug("Unable to add " + key + " to outputs - unable to call .toString() " + e.getMessage(),
- e);
- }
- }
- }
- return stringOutputs;
- }
-
-
- private void sendMapToDebug(Map<String, Object> inputs, String optionalName) {
- int i = 0;
- StringBuilder sb = new StringBuilder(optionalName == null ? "\ninputs" : "\n" + optionalName);
- if (inputs == null) {
- sb.append("\tNULL");
- } else if (inputs.size() < 1) {
- sb.append("\tEMPTY");
- } else {
- for (String str : inputs.keySet()) {
- String outputString;
- try {
- outputString = inputs.get(str).toString();
- } catch (Exception e) {
- outputString = "Unable to call toString() on the value for " + str;
- }
- sb.append("\t\nitem " + i++ + ": '" + str + "'='" + outputString + "'");
- }
- }
- logger.debug(sb.toString());
- return;
- }
-
- private void sendMapToDebug(Map<String, Object> inputs) {
- int i = 0;
- StringBuilder sb = new StringBuilder("inputs:");
- if (inputs == null) {
- sb.append("\tNULL");
- } else if (inputs.size() < 1) {
- sb.append("\tEMPTY");
- } else {
- for (String str : inputs.keySet()) {
- sb.append("\titem " + i++ + ": " + str + "=" + inputs.get(str));
- }
- }
- logger.debug(sb.toString());
- return;
- }
-
- private String convertNode(final JsonNode node) {
- try {
- final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
- final String json = JSON_MAPPER.writeValueAsString(obj);
- return json;
- } catch (JsonParseException jpe) {
- logger.debug("Error converting json to string " + jpe.getMessage());
- } catch (Exception e) {
- logger.debug("Error converting json to string " + e.getMessage());
- }
- return "[Error converting json to string]";
- }
-
- private Map<String, String> convertMapStringObjectToStringString(Map<String, Object> objectMap) {
- if (objectMap == null) {
- return null;
- }
- Map<String, String> stringMap = new HashMap<>();
- for (String key : objectMap.keySet()) {
- if (!stringMap.containsKey(key)) {
- Object obj = objectMap.get(key);
- if (obj instanceof String) {
- stringMap.put(key, (String) objectMap.get(key));
- } else if (obj instanceof JsonNode) {
- // This is a bit of mess - but I think it's the least impacting
- // let's convert it BACK to a string - then it will get converted back later
- try {
- String str = this.convertNode((JsonNode) obj);
- stringMap.put(key, str);
- } catch (Exception e) {
- logger.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode " + key, e);
- // okay in this instance - only string values (fqdn) are expected to be needed
- }
- } else if (obj instanceof java.util.LinkedHashMap) {
- logger.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode");
- try {
- String str = JSON_MAPPER.writeValueAsString(obj);
- stringMap.put(key, str);
- } catch (Exception e) {
- logger.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap " + key, e);
- }
- } else if (obj instanceof Integer) {
- try {
- String str = "" + obj;
- stringMap.put(key, str);
- } catch (Exception e) {
- logger.debug("DANGER WILL ROBINSON: unable to convert value for Integer " + key, e);
- }
- } else {
- try {
- String str = obj.toString();
- stringMap.put(key, str);
- } catch (Exception e) {
- logger.debug(
- "DANGER WILL ROBINSON: unable to convert value " + key + " (" + e.getMessage() + ")",
- e);
- }
- }
- }
- }
-
- return stringMap;
- }
-
- /**
- * This is the "Create VF Module" web service implementation. It will instantiate a new VF Module of the requested
- * type in the specified cloud and tenant. The tenant must exist before this service is called.
- *
- * If a VF Module with the same name already exists, this can be considered a success or failure, depending on the
- * value of the 'failIfExists' parameter.
- *
- * All VF Modules are defined in the MSO catalog. The caller must request one of the pre-defined module types or an
- * error will be returned. Within the catalog, each VF Module references (among other things) a collection of
- * artifacts that are used to deploy the required cloud resources (VMs, networks, etc.).
- *
- * Depending on the module templates, a variable set of input parameters will be defined, some of which are
- * required. The caller is responsible to pass the necessary input data for the module or an error will be thrown.
- *
- * The method returns the vfModuleId, a Map of output attributes, and a VnfRollback object. This last object can be
- * passed as-is to the rollbackVnf operation to undo everything that was created for the Module. This is useful if a
- * VF module is successfully created but the orchestration fails on a subsequent step.
- *
- * @param cloudSiteId CLLI code of the cloud site in which to create the VNF
- * @param cloudOwner cloud owner of the cloud site in which to create the VNF
- * @param tenantId Openstack tenant identifier
- * @param vfModuleType VF Module type key, should match a VNF definition in catalog DB. Deprecated - should use
- * modelCustomizationUuid
- * @param vnfVersion VNF version key, should match a VNF definition in catalog DB Deprecated - VF Module versions
- * also captured by modelCustomizationUuid
- * @param vnfId - VNF ID
- * @param vfModuleName Name to be assigned to the new VF Module
- * @param vfModuleId Id fo the new VF Module
- * @param requestType Indicates if this is a Volume Group or Module request
- * @param volumeGroupId Identifier (i.e. deployment ID) for a Volume Group to attach to a VF Module
- * @param baseVfModuleId Identifier (i.e. deployment ID) of the Base Module if this is an Add-on module
- * @param modelCustomizationUuid Unique ID for the VF Module's model. Replaces the use of vfModuleType.
- * @param inputs Map of key=value inputs for VNF stack creation
- * @param failIfExists Flag whether already existing VNF should be considered
- * @param backout Flag whether to suppress automatic backout (for testing)
- * @param msoRequest Request tracking information for logs
- * @param vnfId Holder for output VF Module instance ID in the cloud
- * @param outputs Holder for Map of VNF outputs from Deployment (assigned IPs, etc)
- * @param rollback Holder for returning VnfRollback object
- */
- @Override
- public void createVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vfModuleType,
- String vnfVersion, String genericVnfId, String vfModuleName, String vfModuleId, String requestType,
- String volumeGroupId, String baseVfModuleId, String modelCustomizationUuid, Map<String, Object> inputs,
- Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId,
- Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback) throws VnfException {
-
- // Require a model customization ID. Every VF Module definition must have one.
- if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) {
- logger.debug("Missing required input: modelCustomizationUuid");
- String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
- logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
- "VF Module ModelCustomizationUuid", "VDU", ErrorCode.DataError,
- "Create VF Module: " + "Missing required input: modelCustomizationUuid");
- logger.debug(error);
- throw new VnfException(error, MsoExceptionCategory.USERDATA);
- }
-
- // Clean up some inputs to make comparisons easier
- if (requestType == null)
- requestType = "";
-
- if ("".equals(volumeGroupId) || "null".equals(volumeGroupId))
- volumeGroupId = null;
-
- if ("".equals(baseVfModuleId) || "null".equals(baseVfModuleId))
- baseVfModuleId = null;
-
- if (inputs == null) {
- // Create an empty set of inputs
- inputs = new HashMap<>();
- logger.debug("inputs == null - setting to empty");
- } else {
- this.sendMapToDebug(inputs);
- }
-
- // Check if this is for a "Volume" module
- boolean isVolumeRequest = false;
- if (requestType.startsWith("VOLUME")) {
- isVolumeRequest = true;
- }
-
- logger.debug("requestType = " + requestType + ", volumeGroupStackId = " + volumeGroupId + ", baseStackId = "
- + baseVfModuleId);
-
- // Build a default rollback object (no actions performed)
- VnfRollback vfRollback = new VnfRollback();
- vfRollback.setCloudSiteId(cloudSiteId);
- vfRollback.setCloudOwner(cloudOwner);
- vfRollback.setTenantId(tenantId);
- vfRollback.setMsoRequest(msoRequest);
- vfRollback.setRequestType(requestType);
- vfRollback.setIsBase(false); // Until we know better
- vfRollback.setVolumeGroupHeatStackId(volumeGroupId);
- vfRollback.setBaseGroupHeatStackId(baseVfModuleId);
- vfRollback.setModelCustomizationUuid(modelCustomizationUuid);
- vfRollback.setMode("CFY");
-
- rollback.value = vfRollback; // Default rollback - no updates performed
-
- // Get the VNF/VF Module definition from the Catalog DB first.
- // There are three relevant records: VfModule, VfModuleCustomization, VnfResource
-
- VfModule vfModule = null;
- VnfResource vnfResource = null;
- VfModuleCustomization vfModuleCust = null;
-
- try {
- vfModuleCust =
- vfModuleCustomRepo.findFirstByModelCustomizationUUIDOrderByCreatedDesc(modelCustomizationUuid);
-
- if (vfModuleCust == null) {
- String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid="
- + modelCustomizationUuid;
- logger.debug(error);
- logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
- "VF Module ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb", ErrorCode.DataError,
- error);
- throw new VnfException(error, MsoExceptionCategory.USERDATA);
- } else {
- logger.debug("Found vfModuleCust entry {}", vfModuleCust.toString());
- }
-
- // Get the vfModule and vnfResource records
- vfModule = vfModuleCust.getVfModule();
- vnfResource = vfModuleCust.getVfModule().getVnfResources();
- } catch (Exception e) {
-
- logger.debug("unhandled exception in create VF - [Query] {}", e.getMessage());
- throw new VnfException("Exception during create VF " + e.getMessage());
- }
-
- // Perform a version check against cloudSite
- // Obtain the cloud site information where we will create the VF Module
- Optional<CloudSite> cloudSiteOp = cloudConfig.getCloudSite(cloudSiteId);
- if (!cloudSiteOp.isPresent()) {
- // If cloudSiteId is not present in the catalog DB, then default to multicloud
- logger.debug("{} is not present in cloud_site catalog DB, defaulting to Multicloud plugin adapter",
- cloudSiteId);
- } else {
- CloudSite cloudSite = cloudSiteOp.get();
- MavenLikeVersioning aicV = new MavenLikeVersioning();
- aicV.setVersion(cloudSite.getCloudVersion());
-
- String vnfMin = vnfResource.getAicVersionMin();
- String vnfMax = vnfResource.getAicVersionMax();
-
- if ((vnfMin != null && !(aicV.isMoreRecentThan(vnfMin) || aicV.isTheSameVersion(vnfMin)))
- || (vnfMax != null && aicV.isMoreRecentThan(vnfMax))) {
- // ERROR
- String error =
- "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID()
- + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: "
- + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion();
- logger.error(LoggingAnchor.FIVE, MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
- ErrorCode.BusinessProcessError.getValue(), "Exception - setVersion");
- logger.debug(error);
- throw new VnfException(error, MsoExceptionCategory.USERDATA);
- }
- }
- // End Version check
-
-
- VduInstance vduInstance = null;
- CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null);
-
- // Use the VduPlugin.
- VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
-
- try {
- vduInstance = vduPlugin.queryVdu(cloudInfo, vfModuleName);
- } catch (VduException me) {
- // Failed to query the VDU due to a plugin exception.
- String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
- + tenantId + ": " + me;
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
- cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "Exception - queryVdu",
- me);
- logger.debug(error);
- // Convert to a generic VnfException
- me.addContext("CreateVFModule");
- throw new VnfException(me);
- }
-
- // More precise handling/messaging if the Module already exists
- if (vduInstance != null && !(vduInstance.getStatus().getState() == VduStateType.NOTFOUND)) {
- VduStateType status = vduInstance.getStatus().getState();
- logger.debug("Found Existing VDU, status=" + status);
-
- if (status == VduStateType.INSTANTIATED) {
- if (failIfExists != null && failIfExists) {
- // fail - it exists
- String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudOwner + "/"
- + cloudSiteId + "/" + tenantId;
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
- "VF Module " + vfModuleName + " already exists");
- logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
- vduInstance.getVduInstanceId());
- } else {
- // Found existing deployment and client has not requested "failIfExists".
- // Populate the outputs from the existing deployment.
-
- vnfId.value = vduInstance.getVduInstanceId();
- outputs.value = copyStringOutputs(vduInstance.getOutputs());
- return;
- }
- }
- // Check through various detailed error cases
- else if (status == VduStateType.INSTANTIATING || status == VduStateType.DELETING
- || status == VduStateType.UPDATING) {
- // fail - it's in progress - return meaningful error
- String error = "Create VF: Deployment " + vfModuleName + " already exists and has status "
- + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
- + "; please wait for it to complete, or fix manually.";
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
- cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
- "VF Module " + vfModuleName + " already exists");
- logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
- vduInstance.getVduInstanceId());
- } else if (status == VduStateType.FAILED) {
- // fail - it exists and is in a FAILED state
- String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in "
- + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
- cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
- "VF Module " + vfModuleName + " already exists and is in FAILED state");
- logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
- vduInstance.getVduInstanceId());
- } else if (status == VduStateType.UNKNOWN) {
- // fail - it exists and is in a UNKNOWN state
- String error = "Create VF: Deployment " + vfModuleName + " already exists and has status "
- + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
- + "; requires manual intervention.";
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
- cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
- "VF Module " + vfModuleName + " already exists and is in " + status.toString() + " state");
- logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
- vduInstance.getVduInstanceId());
- } else {
- // Unexpected, since all known status values have been tested for
- String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status "
- + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
- + "; requires manual intervention.";
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
- cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
- "VF Module " + vfModuleName + " already exists and is in an unknown state");
- logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
- vduInstance.getVduInstanceId());
- }
- }
-
-
- // Collect outputs from Base Modules and Volume Modules
- Map<String, Object> baseModuleOutputs = null;
- Map<String, Object> volumeGroupOutputs = null;
-
- // If a Volume Group was provided, query its outputs for inclusion in Module input parameters
- if (volumeGroupId != null) {
- VduInstance volumeVdu;
- try {
- volumeVdu = vduPlugin.queryVdu(cloudInfo, volumeGroupId);
- } catch (VduException me) {
- // Failed to query the Volume Group VDU due to a plugin exception.
- String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudOwner + "/"
- + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner,
- cloudSiteId, tenantId, "VDU", "queryVdu(volume)", ErrorCode.DataError.getValue(),
- "Exception - queryVdu(volume)", me);
- logger.debug(error);
- // Convert to a generic VnfException
- me.addContext("CreateVFModule(QueryVolume)");
- throw new VnfException(me);
- }
-
- if (volumeVdu == null || volumeVdu.getStatus().getState() == VduStateType.NOTFOUND) {
- String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in "
- + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, cloudOwner,
- cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)",
- ErrorCode.BusinessProcessError.getValue(),
- "Create VFModule: Attached Volume Group " + "DOES NOT EXIST");
- logger.debug(error);
- throw new VnfException(error, MsoExceptionCategory.USERDATA);
- } else {
- logger.debug("Found nested volume group");
- volumeGroupOutputs = volumeVdu.getOutputs();
- this.sendMapToDebug(volumeGroupOutputs, "volumeGroupOutputs");
- }
- }
-
- // If this is an Add-On Module, query the Base Module outputs
- // Note: This will be performed whether or not the current request is for an
- // Add-On Volume Group or Add-On VF Module
-
- if (vfModule.getIsBase()) {
- logger.debug("This is a BASE Module request");
- vfRollback.setIsBase(true);
- } else {
- logger.debug("This is an Add-On Module request");
-
- // Add-On Modules should always have a Base, but just treat as a warning if not provided.
- // Add-on Volume requests may or may not specify a base.
- if (!isVolumeRequest && baseVfModuleId == null) {
- logger.debug("WARNING: Add-on Module request - no Base Module ID provided");
- }
-
- if (baseVfModuleId != null) {
- VduInstance baseVdu;
- try {
- baseVdu = vduPlugin.queryVdu(cloudInfo, baseVfModuleId);
- } catch (MsoException me) {
- // Failed to query the Base VF Module due to a Vdu Plugin exception.
- String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudOwner + "/"
- + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
- cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(Base)", ErrorCode.DataError.getValue(),
- "Exception - queryVdu(Base)", me);
- logger.debug(error);
- // Convert to a generic VnfException
- me.addContext("CreateVFModule(QueryBase)");
- throw new VnfException(me);
- }
-
- if (baseVdu == null || baseVdu.getStatus().getState() == VduStateType.NOTFOUND) {
- String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudOwner
- + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
- logger.error(LoggingAnchor.TEN, MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, cloudOwner,
- cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)",
- ErrorCode.BusinessProcessError.getValue(), "Create VFModule: Base Module DOES NOT EXIST");
- logger.debug(error);
- throw new VnfException(error, MsoExceptionCategory.USERDATA);
- } else {
- logger.debug("Found base module");
- baseModuleOutputs = baseVdu.getOutputs();
- this.sendMapToDebug(baseModuleOutputs, "baseModuleOutputs");
- }
- }
- }
-
-
- // NOTE: For this section, heatTemplate is used for all template artifacts.
- // In final implementation (post-POC), the template object would either be generic or there would
- // be a separate DB Table/Object for different sub-orchestrators.
-
- // NOTE: The template is fixed for the VF Module. The environment is part of the customization.
-
- HeatTemplate heatTemplate = null;
- HeatEnvironment heatEnvironment = null;
- if (isVolumeRequest) {
- heatTemplate = vfModule.getVolumeHeatTemplate();
- heatEnvironment = vfModuleCust.getVolumeHeatEnv();
- } else {
- heatTemplate = vfModule.getModuleHeatTemplate();
- heatEnvironment = vfModuleCust.getHeatEnvironment();
- }
-
- if (heatTemplate == null) {
- String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType
- + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vfModule.getModelUUID()
- + ", reqType=" + requestType;
- logger.error(LoggingAnchor.SIX, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
- vfModuleType, "VNF", ErrorCode.DataError.getValue(), error);
- logger.debug(error);
- throw new VnfException(error, MsoExceptionCategory.INTERNAL);
- } else {
- logger.debug("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate());
- }
-
- if (heatEnvironment == null) {
- String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid="
- + modelCustomizationUuid + ", vfModuleUuid=" + vfModule.getModelUUID() + ", reqType=" + requestType;
- logger.error(LoggingAnchor.FIVE, MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
- "OpenStack", ErrorCode.DataError.getValue(), error);
- throw new VnfException(error, MsoExceptionCategory.INTERNAL);
- } else {
- logger.debug("Got Heat Environment from DB: " + heatEnvironment.getEnvironment());
- }
-
-
- // Create the combined set of parameters from the incoming request, base-module outputs,
- // volume-module outputs. Also, convert all variables to their native object types.
-
- HashMap<String, Object> goldenInputs = new HashMap<>();
- List<String> extraInputs = new ArrayList<>();
-
- Boolean skipInputChecks = false;
-
- if (skipInputChecks) {
- goldenInputs = new HashMap<>();
- for (String key : inputs.keySet()) {
- goldenInputs.put(key, inputs.get(key));
- }
- } else {
- // Build maps for the parameters (including aliases) to simplify checks
- HashMap<String, HeatTemplateParam> params = new HashMap<>();
-
- Set<HeatTemplateParam> paramSet = heatTemplate.getParameters();
- logger.debug("paramSet has " + paramSet.size() + " entries");
-
- for (HeatTemplateParam htp : paramSet) {
- params.put(htp.getParamName(), htp);
-
- // Include aliases.
- String alias = htp.getParamAlias();
- if (alias != null && !"".equals(alias) && !params.containsKey(alias)) {
- params.put(alias, htp);
- }
- }
-
- // First, convert all inputs to their "template" type
- for (String key : inputs.keySet()) {
- if (params.containsKey(key)) {
- Object value = convertInputValue(inputs.get(key), params.get(key));
- if (value != null) {
- goldenInputs.put(key, value);
- } else {
- logger.debug("Failed to convert input " + key + "='" + inputs.get(key) + "' to "
- + params.get(key).getParamType());
- }
- } else {
- extraInputs.add(key);
- }
- }
-
- if (!extraInputs.isEmpty()) {
- // Add multicloud inputs
- for (String key : MsoMulticloudUtils.MULTICLOUD_INPUTS) {
- if (extraInputs.contains(key)) {
- goldenInputs.put(key, inputs.get(key));
- extraInputs.remove(key);
- if (extraInputs.isEmpty()) {
- break;
- }
- }
- }
- logger.debug("Ignoring extra inputs: " + extraInputs);
- }
-
- // Next add in Volume Group Outputs if there are any. Copy directly without conversions.
- if (volumeGroupOutputs != null && !volumeGroupOutputs.isEmpty()) {
- for (String key : volumeGroupOutputs.keySet()) {
- if (params.containsKey(key) && !goldenInputs.containsKey(key)) {
- goldenInputs.put(key, volumeGroupOutputs.get(key));
- }
- }
- }
-
- // Next add in Base Module Outputs if there are any. Copy directly without conversions.
- if (baseModuleOutputs != null && !baseModuleOutputs.isEmpty()) {
- for (String key : baseModuleOutputs.keySet()) {
- if (params.containsKey(key) && !goldenInputs.containsKey(key)) {
- goldenInputs.put(key, baseModuleOutputs.get(key));
- }
- }
- }
-
- // TODO: The model should support a mechanism to pre-assign default parameter values
- // per "customization" (i.e. usage) of a given module. In HEAT, this is specified by
- // an Environment file. There is not a general mechanism in the model to handle this.
- // For the general case, any such parameter/values can be added dynamically to the
- // inputs (only if not already specified).
-
- // Check that required parameters have been supplied from any of the sources
- String missingParams = null;
- boolean checkRequiredParameters = true;
- try {
- String propertyString = this.environment.getProperty(MsoVnfPluginAdapterImpl.CHECK_REQD_PARAMS);
- if ("false".equalsIgnoreCase(propertyString) || "n".equalsIgnoreCase(propertyString)) {
- checkRequiredParameters = false;
- logger.debug("CheckRequiredParameters is FALSE. Will still check but then skip blocking..."
- + MsoVnfPluginAdapterImpl.CHECK_REQD_PARAMS);
- }
- } catch (Exception e) {
- // No problem - default is true
- logger.debug("An exception occured trying to get property " + MsoVnfPluginAdapterImpl.CHECK_REQD_PARAMS,
- e);
- }
-
- // Do the actual parameter checking.
- // Include looking at the ENV file as a valid definition of a parameter value.
- // TODO: This handling of ENV applies only to Heat. A general mechanism to
- // support pre-set parameter/values does not yet exist in the model.
- //
- StringBuilder sb = new StringBuilder(heatEnvironment.getEnvironment());
- MsoHeatEnvironmentEntry mhee = new MsoHeatEnvironmentEntry(sb);
- for (HeatTemplateParam parm : heatTemplate.getParameters()) {
- if (parm.isRequired() && (!goldenInputs.containsKey(parm.getParamName()))) {
- if (mhee != null && mhee.containsParameter(parm.getParamName())) {
- logger.debug("Required parameter " + parm.getParamName()
- + " appears to be in environment - do not count as missing");
- } else {
- logger.debug("adding to missing parameters list: " + parm.getParamName());
- if (missingParams == null) {
- missingParams = parm.getParamName();
- } else {
- missingParams += "," + parm.getParamName();
- }
- }
- }
- }
-
- if (missingParams != null) {
- if (checkRequiredParameters) {
- // Problem - missing one or more required parameters
- String error = "Create VFModule: Missing Required inputs: " + missingParams;
- logger.error(LoggingAnchor.FIVE, MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "VDU",
- ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
- logger.debug(error);
- throw new VnfException(error, MsoExceptionCategory.USERDATA);
- } else {
- logger.debug("found missing parameters [" + missingParams
- + "] - but checkRequiredParameters is false - " + "will not block");
- }
- } else {
- logger.debug("No missing parameters found - ok to proceed");
- }
-
- } // NOTE: END PARAMETER CHECKING
-
-
- // Here we go... ready to deploy the VF Module.
- if (backout == null)
- backout = true;
-
- try {
- // Construct the VDU Model structure to pass to the targeted VduPlugin
- VduModelInfo vduModel = null;
- if (!isVolumeRequest) {
- vduModel = vduMapper.mapVfModuleCustomizationToVdu(vfModuleCust);
- } else {
- vduModel = vduMapper.mapVfModuleCustVolumeToVdu(vfModuleCust);
- }
-
- // Invoke the VduPlugin to instantiate the VF Module
- vduInstance = vduPlugin.instantiateVdu(cloudInfo, vfModuleName, goldenInputs, vduModel, backout);
-
- } catch (VduException me) {
- // Failed to instantiate the VDU.
- me.addContext("CreateVFModule");
- String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
- + ": " + me;
- logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
- cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(), "MsoException - instantiateVdu", me);
- logger.debug(error);
- // Convert to a generic VnfException
- throw new VnfException(me);
- } catch (NullPointerException npe) {
- String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
- + ": " + npe;
- logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
- cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(),
- "NullPointerException - instantiateVdu", npe);
- logger.debug(error);
- logger.debug("NULL POINTER EXCEPTION at vduPlugin.instantiateVdu", npe);
- throw new VnfException("NullPointerException during instantiateVdu");
- } catch (Exception e) {
- String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
- + ": " + e;
- logger.debug("Unhandled exception at vduPlugin.instantiateVdu", e);
- logger.debug(error);
- throw new VnfException("Exception during instantiateVdu: " + e.getMessage());
- }
-
-
- // Reach this point if create is successful.
- // Populate remaining rollback info and response parameters.
- vfRollback.setVnfCreated(true);
- vfRollback.setVnfId(vduInstance.getVduInstanceId());
- vnfId.value = vduInstance.getVduInstanceId();
- outputs.value = copyStringOutputs(vduInstance.getOutputs());
-
- rollback.value = vfRollback;
-
- logger.debug("VF Module " + vfModuleName + " successfully created");
- return;
- }
-
-
- public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vfModuleId, String vnfId,
- String aaiVfModuleId, String modelCustomizationUuid, MsoRequest msoRequest,
- Holder<Map<String, String>> outputs) throws VnfException {
-
- logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
-
- // Capture the output parameters on a delete, so need to query first
- VduInstance vduInstance;
- CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null);
-
- // Use the VduPlugin.
- VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
-
- try {
- vduInstance = vduPlugin.queryVdu(cloudInfo, vfModuleId);
- } catch (VduException e) {
- // Failed to query the VDU due to a plugin exception.
- // Convert to a generic VnfException
- e.addContext("QueryVFModule");
- String error = "Query VfModule (VDU): " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/"
- + tenantId + ": " + e;
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudOwner,
- cloudSiteId, tenantId, "VDU", "QueryVFModule", ErrorCode.DataError.getValue(),
- "Exception - queryVDU", e);
- logger.debug(error);
- throw new VnfException(e);
- }
-
- // call method which handles the conversion from Map<String,Object> to Map<String,String> for our expected
- // Object types
- outputs.value = convertMapStringObjectToStringString(vduInstance.getOutputs());
-
- // Use the VduPlugin to delete the VDU.
- // The possible outcomes of deleteVdu are
- // - a vnfInstance object with status of DELETED (success)
- // - a vnfInstance object with status of NOTFOUND (VDU did not exist, treat as success)
- // - a vnfInstance object with status of FAILED (error)
- // Also, VduException could be thrown.
- try {
- // TODO: Get an appropriate timeout value - require access to the model
- vduPlugin.deleteVdu(cloudInfo, vfModuleId, 5);
- } catch (VduException me) {
- me.addContext("DeleteVfModule");
- // Convert to a generic VnfException
- String error =
- "Delete VF: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
- cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(),
- "Exception - DeleteVdu: " + me.getMessage());
- logger.debug(error);
- throw new VnfException(me);
- }
-
- // On success, nothing is returned.
- return;
- }
-
- // Update VF Module not yet implemented for generic VDU plug-in model.
- @Override
- public void updateVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfType,
- String vnfVersion, String vnfName, String requestType, String volumeGroupHeatStackId,
- String baseVfHeatStackId, String vfModuleStackId, String modelCustomizationUuid, Map<String, Object> inputs,
- MsoRequest msoRequest, Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback)
- throws VnfException {
- // This operation is not currently supported for VduPlugin-orchestrated VF Modules.
- logger.debug("Update VF Module command attempted but not supported");
- throw new VnfException("UpdateVfModule: Unsupported command", MsoExceptionCategory.USERDATA);
- }
-
- /*
- * Dynamic selection of a VduPlugin version. For initial tests, base on the "orchestrator" defined for the target
- * cloud. Should really be looking at the VNF Model (ochestration_mode) but we don't currently have access to that
- * in Query and Delete cases.
- */
- private VduPlugin getVduPlugin(String cloudSiteId, String cloudOwner) {
- Optional<CloudSite> cloudSiteOp = cloudConfig.getCloudSite(cloudSiteId);
- if (cloudSiteOp.isPresent()) {
- CloudSite cloudSite = cloudSiteOp.get();
- String orchestrator = cloudSite.getOrchestrator();
-
- if ("CLOUDIFY".equalsIgnoreCase(orchestrator)) {
- return cloudifyUtils;
- } else if ("HEAT".equalsIgnoreCase(orchestrator)) {
- return heatUtils;
- } else if ("MULTICLOUD".equalsIgnoreCase(orchestrator)) {
- return multicloudUtils;
- } else {
- // Default if cloudSite record exists - return HEAT plugin - will fail later
- return heatUtils;
- }
- }
- // Default if no cloudSite record exists - return multicloud plugin
- return multicloudUtils;
- }
-}
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
deleted file mode 100644
index 5b78d2f066..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
+++ /dev/null
@@ -1,578 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Modifications Copyright (C) 2018 IBM.
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.vnf;
-
-
-import java.util.Map;
-import javax.inject.Provider;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.GenericEntity;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.xml.ws.Holder;
-import org.onap.so.logger.LoggingAnchor;
-import org.apache.http.HttpStatus;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
-import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
-import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
-import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse;
-import org.onap.so.adapters.vnfrest.QueryVfModuleResponse;
-import org.onap.so.adapters.vnfrest.RollbackVfModuleRequest;
-import org.onap.so.adapters.vnfrest.RollbackVfModuleResponse;
-import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest;
-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.logging.filter.base.ErrorCode;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.openstack.beans.VnfRollback;
-import org.onap.so.openstack.beans.VnfStatus;
-import org.onap.so.openstack.exceptions.MsoExceptionCategory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-
-/**
- * This class services calls to the REST interface for VF Modules (http://host:port/vnfs/rest/v1/vnfs) Both XML and JSON
- * can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. For testing, call
- * with cloudSiteId = ___TESTING___ To test exceptions, also set tenantId = ___TESTING___
- */
-@Deprecated
-@Path("/v1/vnfs")
-@Api(value = "/v1/vnfs", description = "root of vnf adapters restful web service")
-@Transactional
-@Component
-public class VnfAdapterRest {
- private static Logger logger = LoggerFactory.getLogger(VnfAdapterRest.class);
- private static final String TESTING_KEYWORD = "___TESTING___";
- private static final String RESP = ", resp=";
-
- @Autowired
- private MsoVnfAdapterImpl vnfAdapter;
-
- @Autowired
- private Provider<BpelRestClient> bpelRestClientProvider;
-
- @DELETE
- @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "DeleteVfModule", response = Response.class,
- notes = "Delete an existing vnfModule, DeleteVfModuleRequest JSON is required")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfModule has been successfully deleted"),
- @ApiResponse(code = 202, message = "delete vnfModule request has been accepted (async only)"),
- @ApiResponse(code = 500, message = "delete vnfModule failed, examine entity object for details")})
- public Response deleteVfModule(
- @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId,
- @ApiParam(value = "aaiVfModuleId", required = true) @PathParam("aaiVfModuleId") String aaiVfModuleId,
- @ApiParam(value = "DeleteVfModuleRequest", required = true) final DeleteVfModuleRequest req) {
- logger.debug("Delete VfModule enter: " + req.toJsonString());
- if (aaiVnfId == null || !aaiVnfId.equals(req.getVnfId())) {
- logger.debug("Req rejected - aaiVnfId not provided or doesn't match URL");
- return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN)
- .entity("vnfid in URL does not match content").build();
- }
- if (aaiVfModuleId == null || !aaiVfModuleId.equals(req.getVfModuleId())) {
- logger.debug("Req rejected - aaiVfModuleId not provided or doesn't match URL");
- return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN)
- .entity("vfModuleId in URL does not match content").build();
- }
- DeleteVfModuleTask task = new DeleteVfModuleTask(req);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling delete, send generic failure as sync resp to caller
- logger.error("", MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule",
- ErrorCode.BusinessProcessError.getValue(), "Exception in deleteVfModule", e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("deleteVNFVolumes exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class DeleteVfModuleTask implements Runnable {
- private final DeleteVfModuleRequest req;
- private DeleteVfModuleResponse response = null;
- private VfModuleExceptionResponse eresp = null;
- private boolean sendxml;
-
- public DeleteVfModuleTask(DeleteVfModuleRequest req) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<DeleteVfModuleResponse>(response) {}
- : new GenericEntity<VfModuleExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- String cloudsite = req.getCloudSiteId();
- Holder<Map<String, String>> outputs = new Holder<>();
- if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) {
- vnfAdapter.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(),
- req.getModelCustomizationUuid(), req.getMsoRequest(), outputs);
- }
- response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE,
- req.getMessageId(), outputs.value);
- } catch (VnfException e) {
- logger.error(LoggingAnchor.THREE, MessageEnum.RA_DELETE_VNF_ERR.toString(),
- ErrorCode.BusinessProcessError.getValue(), "VnfException - Delete VNF Module", e);
- eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("Delete vfModule exit: code=" + getStatusCode() + RESP + getResponse());
- }
- }
-
-
- @GET
- @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "QueryVfModule", response = Response.class, notes = "Query an existing vnfModule")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfModule has been successfully queried"),
- @ApiResponse(code = 500, message = "query vnfModule failed, examine entity object for details")})
- public Response queryVfModule(@ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId,
- @ApiParam(value = "aaiVfModuleId", required = true) @PathParam("aaiVfModuleId") String aaiVfModuleId,
- @ApiParam(value = "cloudSiteId", required = true) @QueryParam("cloudSiteId") String cloudSiteId,
- @ApiParam(value = "cloudOwner", required = true) @QueryParam("cloudOwner") String cloudOwner,
- @ApiParam(value = "tenantId", required = true) @QueryParam("tenantId") String tenantId,
- @ApiParam(value = "vfModuleName", required = true) @QueryParam("vfModuleName") String vfModuleName, // RAA?
- // Id in
- // doc
- @ApiParam(value = "skipAAI", required = true) @QueryParam("skipAAI") Boolean skipAAI,
- @ApiParam(value = "msoRequest.requestId",
- required = true) @QueryParam("msoRequest.requestId") String requestId,
- @ApiParam(value = "msoRequest.serviceInstanceId",
- required = true) @QueryParam("msoRequest.serviceInstanceId") String serviceInstanceId) {
- // This request responds synchronously only
- logger.debug("Query vfModule enter:" + vfModuleName);
- MsoRequest msoRequest = new MsoRequest(requestId, serviceInstanceId);
-
- try {
- int respStatus = HttpStatus.SC_OK;
- QueryVfModuleResponse qryResp = new QueryVfModuleResponse(aaiVnfId, aaiVfModuleId, null, null, null);
- Holder<Boolean> vnfExists = new Holder<>();
- Holder<String> vfModuleId = new Holder<>();
- Holder<VnfStatus> status = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
- vnfAdapter.queryVnf(cloudSiteId, cloudOwner, tenantId, vfModuleName, msoRequest, vnfExists, vfModuleId,
- status, outputs);
- if (!vnfExists.value) {
- logger.debug("vfModule not found");
- respStatus = HttpStatus.SC_NOT_FOUND;
- } else {
- logger.debug("vfModule found" + vfModuleId.value + ", status=" + status.value);
- qryResp.setVfModuleId(vfModuleId.value);
- qryResp.setVnfStatus(status.value);
- qryResp.setVfModuleOutputs(outputs.value);
- }
- logger.debug("Query vfModule exit");
- return Response.status(respStatus).entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {}).build();
- } catch (VnfException e) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
- ErrorCode.BusinessProcessError.getValue(), "VnfException - queryVfModule", e);
- VfModuleExceptionResponse excResp =
- new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<VfModuleExceptionResponse>(excResp) {}).build();
- }
- }
-
- /*
- * URL: http://localhost:8080/vnfs/rest/v1/vnfs/<aaivnfid>/vf-modules REQUEST: {"createVfModuleRequest":
- * {"cloudSiteId": "DAN", "tenantId": "214b428a1f554c02935e66330f6a5409", "vnfId": "somevnfid", "vfModuleId":
- * "somemodid", "vfModuleName": "RaaVnf1", "vnfType": "ApacheVnf", "vfModuleParams": {"entry": [ {"key":
- * "network_id", "value": "59ed7b41-2983-413f-ba93-e7d437433916"}, {"key": "subnet_id", "value":
- * "086c9298-5c57-49b7-bb2b-6fd5730c5d92"}, {"key": "server_name_0", "value": "RaaVnf1"} ]}, "failIfExists": true,
- * "messageId": "ra.1", "notificationUrl": "http://localhost:8089/vnfmock", "skipAAI": true, "msoRequest": {
- * "requestId": "ra1", "serviceInstanceId": "sa1" }} }
- */
- @POST
- @Path("{aaiVnfId}/vf-modules")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "CreateVfModule", response = Response.class, notes = "Create a vnfModule")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfModule has been successfully created"),
- @ApiResponse(code = 202, message = "create vnfModule request has been successfully accepted (async only)"),
- @ApiResponse(code = 500, message = "create vnfModule failed, examine entity object for details")})
- public Response createVfModule(
- @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId,
- @ApiParam(value = "CreateVfModuleRequest", required = true) final CreateVfModuleRequest req) {
- logger.debug("Create VfModule enter inside VnfAdapterRest: " + req.toJsonString());
- if (aaiVnfId == null || !aaiVnfId.equals(req.getVnfId())) {
- logger.debug("Req rejected - aaiVnfId not provided or doesn't match URL");
- return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN)
- .entity("vnfid in URL does not match content").build();
- }
- CreateVfModuleTask task = new CreateVfModuleTask(req);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error(LoggingAnchor.FOUR, MessageEnum.RA_CREATE_VNF_ERR, "createVfModule",
- ErrorCode.BusinessProcessError, "Exception - createVfModule", e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("createVfModule exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class CreateVfModuleTask implements Runnable {
- private final CreateVfModuleRequest req;
- private CreateVfModuleResponse response = null;
- private VfModuleExceptionResponse eresp = null;
- private boolean sendxml;
-
- public CreateVfModuleTask(CreateVfModuleRequest req) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<CreateVfModuleResponse>(response) {}
- : new GenericEntity<VfModuleExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- logger.debug("CreateVfModuleTask start");
- try {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- // Synchronous Web Service Outputs
- Holder<String> vfModuleStackId = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
- Holder<VnfRollback> vnfRollback = new Holder<>();
- String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
- logger.debug("completeVnfVfModuleType=" + completeVnfVfModuleType);
- String cloudsite = req.getCloudSiteId();
- String cloudOwner = req.getCloudOwner();
- if (cloudsite != null && cloudsite.equals(TESTING_KEYWORD)) {
- String tenant = req.getTenantId();
- if (tenant != null && tenant.equals(TESTING_KEYWORD)) {
- throw new VnfException("testing.");
- }
- vnfRollback.value = new VnfRollback(req.getVnfId(), tenant, cloudOwner, cloudsite, true, false,
- new MsoRequest("reqid", "svcid"), req.getVolumeGroupId(), req.getVolumeGroupId(),
- req.getRequestType(), req.getModelCustomizationUuid());
- vfModuleStackId.value = "479D3D8B-6360-47BC-AB75-21CC91981484";
- outputs.value = VolumeAdapterRest.testMap();
- } else {
- vnfAdapter.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- completeVnfVfModuleType, req.getVnfVersion(), req.getVnfId(), req.getVfModuleName(),
- req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(),
- req.getBaseVfModuleStackId(), req.getModelCustomizationUuid(), req.getVfModuleParams(),
- req.getFailIfExists(), req.getBackout(), req.getEnableBridge(), req.getMsoRequest(),
- vfModuleStackId, outputs, vnfRollback);
- }
- VfModuleRollback modRollback = new VfModuleRollback(vnfRollback.value, req.getVfModuleId(),
- vfModuleStackId.value, req.getMessageId());
- response = new CreateVfModuleResponse(req.getVnfId(), req.getVfModuleId(), vfModuleStackId.value,
- Boolean.TRUE, outputs.value, modRollback, req.getMessageId());
- } catch (VnfException e) {
- logger.debug("Exception :", e);
- eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("CreateVfModuleTask exit: code=" + getStatusCode());
- }
- }
-
- @PUT
- @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "UpdateVfModule", response = Response.class, notes = "Update an existing vnfModule")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfModule has been successfully updated"),
- @ApiResponse(code = 202, message = "update vnfModule request has been successfully accepted (async only)"),
- @ApiResponse(code = 500, message = "update vnfModule failed, examine entity object for details")})
- public Response updateVfModule(
- @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId,
- @ApiParam(value = "aaiVfModuleId", required = true) @PathParam("aaiVfModuleId") String aaiVfModuleId,
- @ApiParam(value = "UpdateVfModuleRequest", required = true) final UpdateVfModuleRequest req) {
- logger.debug("Update VfModule enter: " + req.toJsonString());
- UpdateVfModulesTask task = new UpdateVfModulesTask(req);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error(LoggingAnchor.FOUR, MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
- ErrorCode.BusinessProcessError.getValue(), "Exception - updateVfModule", e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("updateVfModules exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class UpdateVfModulesTask implements Runnable {
- private final UpdateVfModuleRequest req;
- private UpdateVfModuleResponse response = null;
- private VfModuleExceptionResponse eresp = null;
- private boolean sendxml;
-
- public UpdateVfModulesTask(UpdateVfModuleRequest req) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<UpdateVfModuleResponse>(response) {}
- : new GenericEntity<VfModuleExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- Holder<String> vfModuleStackId = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
- Holder<VnfRollback> vnfRollback = new Holder<>();
- String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
- logger.debug("in updateVf - completeVnfVfModuleType=" + completeVnfVfModuleType);
-
- vnfAdapter.updateVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- // req.getVnfType(),
- completeVnfVfModuleType, req.getVnfVersion(), req.getVfModuleName(), req.getRequestType(),
- req.getVolumeGroupStackId(), req.getBaseVfModuleStackId(), req.getVfModuleStackId(),
- req.getModelCustomizationUuid(), req.getVfModuleParams(), req.getMsoRequest(), outputs,
- vnfRollback);
-
- response = new UpdateVfModuleResponse(req.getVnfId(), req.getVfModuleId(), vfModuleStackId.value,
- outputs.value, req.getMessageId());
- } catch (VnfException e) {
- logger.debug("Exception :", e);
- eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("Update VfModule exit: code=" + getStatusCode() + RESP + getResponse());
- }
- }
-
-
- @DELETE
- @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}/rollback")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "RollbackVfModule", response = Response.class, notes = "Rollback an existing vnfModule")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfModule has been successfully rolled back"),
- @ApiResponse(code = 202,
- message = "rollback vnfModule request has been successfully accepted (async only)"),
- @ApiResponse(code = 500, message = "rollback vnfModule failed, examine entity object for details")})
- public Response rollbackVfModule(
- @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId,
- @ApiParam(value = "aaiVfModuleId", required = true) @PathParam("aaiVfModuleId") String aaiVfModuleId,
- @ApiParam(value = "RollbackVfModuleRequest", required = true)
- // @QueryParam("rollback") String rollback,
- final RollbackVfModuleRequest req) {
- logger.debug("Rollback VfModule enter: " + req.toJsonString());
- RollbackVfModulesTask task = new RollbackVfModulesTask(req);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error(LoggingAnchor.FOUR, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
- ErrorCode.BusinessProcessError.getValue(), "Exception - rollbackVfModule", e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("rollbackVfModule exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class RollbackVfModulesTask implements Runnable {
- private final RollbackVfModuleRequest req;
- private RollbackVfModuleResponse response = null;
- private VfModuleExceptionResponse eresp = null;
- private boolean sendxml;
-
- public RollbackVfModulesTask(RollbackVfModuleRequest req) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<RollbackVfModuleResponse>(response) {}
- : new GenericEntity<VfModuleExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVfModuleRollback().getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- VfModuleRollback vmr = req.getVfModuleRollback();
- VnfRollback vrb = new VnfRollback(vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudOwner(),
- vmr.getCloudSiteId(), true, true, vmr.getMsoRequest(), null, null, null, null);
- vnfAdapter.rollbackVnf(vrb);
- response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId());
- } catch (VnfException e) {
- logger.error(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_VNF_ERR, ErrorCode.BusinessProcessError,
- "Exception" + " - " + "rollbackVfModule", e);
- eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("RollbackVfModulesTask exit: code=" + getStatusCode() + RESP + getResponse());
- }
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java
deleted file mode 100644
index b53ac0f899..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * OPENECOMP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.vnf;
-
-import java.util.Optional;
-import org.onap.so.cloud.CloudConfig;
-import org.onap.so.db.catalog.beans.CloudSite;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class VnfAdapterRestUtils {
- private static Logger logger = LoggerFactory.getLogger(VnfAdapterRestUtils.class);
-
- private static final String HEAT_MODE = "HEAT";
- private static final String CLOUDIFY_MODE = "CLOUDIFY";
- private static final String MULTICLOUD_MODE = "MULTICLOUD";
-
- @Autowired
- private CloudConfig cloudConfig;
-
- @Autowired
- private MsoVnfCloudifyAdapterImpl cloudifyImpl;
-
- @Autowired
- private MsoVnfAdapterImpl vnfImpl;
-
- @Autowired
- private MsoVnfPluginAdapterImpl vnfPluginImpl;
-
- /*
- * Choose which implementation of VNF Adapter to use, based on the orchestration mode. Currently, the two supported
- * orchestrators are HEAT and CLOUDIFY.
- */
- public MsoVnfAdapter getVnfAdapterImpl(String mode, String cloudSiteId) {
- // First, determine the orchestration mode to use.
- // If was explicitly provided as a parameter, use that. Else if specified for the
- // cloudsite, use that. Otherwise, the default is the (original) HEAT-based impl.
-
- logger.debug("Entered GetVnfAdapterImpl: mode=" + mode + ", cloudSite=" + cloudSiteId);
-
- if (mode == null) {
- // Didn't get an explicit mode type requested.
- // Use the CloudSite to determine which Impl to use, based on whether the target cloutSite
- // has a CloudifyManager assigned to it
- Optional<CloudSite> cloudSite = cloudConfig.getCloudSite(cloudSiteId);
- if (cloudSite.isPresent()) {
- logger.debug("Got CloudSite: " + cloudSite.toString());
- if (cloudConfig.getCloudifyManager(cloudSite.get().getCloudifyId()) != null) {
- mode = CLOUDIFY_MODE;
- } else if (MULTICLOUD_MODE.equalsIgnoreCase(cloudSite.get().getOrchestrator())) {
- mode = MULTICLOUD_MODE;
- } else {
- mode = HEAT_MODE;
- }
- }
- }
-
- logger.debug("GetVnfAdapterImpl: mode=" + mode);
-
- MsoVnfAdapter vnfAdapter = null;
-
- // TODO: Make this more dynamic (e.g. Service Loader)
- if (CLOUDIFY_MODE.equalsIgnoreCase(mode)) {
- logger.debug("GetVnfAdapterImpl: Return Cloudify Adapter");
- vnfAdapter = cloudifyImpl;
- } else if (HEAT_MODE.equalsIgnoreCase(mode)) {
- logger.debug("GetVnfAdapterImpl: Return Heat Adapter");
- vnfAdapter = vnfImpl;
- } else if (MULTICLOUD_MODE.equalsIgnoreCase(mode)) {
- logger.debug("GetVnfAdapterImpl: Return Plugin (multicloud) Adapter");
- vnfAdapter = vnfPluginImpl;
- } else {
- // Don't expect this, but default is the HEAT adapter
- logger.debug("GetVnfAdapterImpl: Return Default (Heat) Adapter");
- vnfAdapter = vnfImpl;
- }
-
- return vnfAdapter;
- }
-
-}
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
deleted file mode 100644
index 63b4c5d0f3..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
+++ /dev/null
@@ -1,626 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * OPENECOMP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (C) 2018 IBM.
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.vnf;
-
-
-import java.util.Map;
-import javax.inject.Provider;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.GenericEntity;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.xml.ws.Holder;
-import org.apache.http.HttpStatus;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
-import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
-import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
-import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse;
-import org.onap.so.adapters.vnfrest.QueryVfModuleResponse;
-import org.onap.so.adapters.vnfrest.RollbackVfModuleRequest;
-import org.onap.so.adapters.vnfrest.RollbackVfModuleResponse;
-import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest;
-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.logging.filter.base.ErrorCode;
-import org.onap.so.logger.LoggingAnchor;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.openstack.beans.VnfRollback;
-import org.onap.so.openstack.beans.VnfStatus;
-import org.onap.so.openstack.exceptions.MsoExceptionCategory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-
-/**
- * This class services calls to the REST interface for VF Modules (http://host:port/vnfs/rest/v2/vnfs) Both XML and JSON
- * can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. For testing, call
- * with cloudSiteId = ___TESTING___ To test exceptions, also set tenantId = ___TESTING___
- *
- * V2 incorporates run-time selection of sub-orchestrator implementation (Heat or Cloudify) based on the target cloud.
- */
-@Deprecated
-@Path("/v2/vnfs")
-@Api(value = "/v2/vnfs", description = "root of vnf adapters restful web service v2")
-@Component
-public class VnfAdapterRestV2 {
- private static Logger logger = LoggerFactory.getLogger(VnfAdapterRestV2.class);
- private static final String TESTING_KEYWORD = "___TESTING___";
- private static final String RESP = ", resp=";
- private static final String BRACKETS = LoggingAnchor.FOUR;
-
- @Autowired
- private VnfAdapterRestUtils vnfAdapterRestUtils;
-
- @Autowired
- private Provider<BpelRestClient> bpelRestClientProvider;
-
- /*
- * URL:http://localhost:8080/vnfs/rest/v2/vnfs/<aaivnfid>/vf-modules/<aaimodid> REQUEST: {"deleteVfModuleRequest":
- * {"cloudSiteId": "DAN", "tenantId": "214b428a1f554c02935e66330f6a5409", "vnfId": "somevnfid", "vfModuleId":
- * "somemodid", "vfModuleStackId": "4e567676-e266-4594-a3a6-131c8a2baf73", "messageId": "ra.1", "notificationUrl":
- * "http://localhost:8089/vnfmock", "skipAAI": true, "msoRequest": { "requestId": "ra1", "serviceInstanceId": "sa1"
- * }} }
- */
- @DELETE
- @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "DeleteVfModule", response = Response.class,
- notes = "Delete an existing vnfModule, DeleteVfModuleRequest JSON is required")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfModule has been successfully deleted"),
- @ApiResponse(code = 202, message = "delete vnfModule request has been accepted (async only)"),
- @ApiResponse(code = 500, message = "delete vnfModule failed, examine entity object for details")})
- public Response deleteVfModule(
- @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId,
- @ApiParam(value = "aaiVfModuleId", required = true) @PathParam("aaiVfModuleId") String aaiVfModuleId,
- @ApiParam(value = "mode", required = true) @QueryParam("mode") String mode,
- @ApiParam(value = "DeleteVfModuleRequest", required = true) final DeleteVfModuleRequest req) {
- logger.debug("Delete VfModule enter: " + req.toJsonString());
- if (aaiVnfId == null || !aaiVnfId.equals(req.getVnfId())) {
- logger.debug("Req rejected - aaiVnfId not provided or doesn't match URL");
- return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN)
- .entity("vnfid in URL does not match content").build();
- }
- if (aaiVfModuleId == null || !aaiVfModuleId.equals(req.getVfModuleId())) {
- logger.debug("Req rejected - aaiVfModuleId not provided or doesn't match URL");
- return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN)
- .entity("vfModuleId in URL does not match content").build();
- }
-
- DeleteVfModuleTask task = new DeleteVfModuleTask(req, mode);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- MDC.getCopyOfContextMap();
- t1.start();
- } catch (Exception e) {
- // problem handling delete, send generic failure as sync resp to caller
- logger.error(BRACKETS, MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule",
- ErrorCode.BusinessProcessError.getValue(), "Exception in deleteVfModule", e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("deleteVNFVolumes exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class DeleteVfModuleTask implements Runnable {
- private final DeleteVfModuleRequest req;
- private DeleteVfModuleResponse response = null;
- private VfModuleExceptionResponse eresp = null;
- private boolean sendxml;
- private String mode;
-
- public DeleteVfModuleTask(DeleteVfModuleRequest req, String mode) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- this.mode = mode;
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<DeleteVfModuleResponse>(response) {}
- : new GenericEntity<VfModuleExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- String cloudsite = req.getCloudSiteId();
- Holder<Map<String, String>> outputs = new Holder<>();
- if (cloudsite != null) {
- MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsite);
- adapter.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(),
- req.getModelCustomizationUuid(), req.getMsoRequest(), outputs);
- }
- response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE,
- req.getMessageId(), outputs.value);
- } catch (VnfException e) {
- logger.error(LoggingAnchor.THREE, MessageEnum.RA_DELETE_VNF_ERR.toString(),
- ErrorCode.BusinessProcessError.getValue(), "VnfException - " + "Delete VNF Module", e);
- eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("Delete vfModule exit: code=" + getStatusCode() + RESP + getResponse());
- MDC.clear();
- }
- }
-
- /*
- * URL:http://localhost:8080/vnfs/rest/v2/vnfs/<aaiVnfId>/vf-modules/<aaiVfModuleId>?cloudSiteId=DAN&tenantId=
- * vfModule?&skipAAI=TRUE&msoRequest.requestId=ra1&msoRequest.serviceInstanceId=si1&vfModuleName=T2N2S1 RESP:
- * {"queryVfModuleResponse": { "vfModuleId": "AvfmodId", "vfModuleOutputs": {"entry": { "key":
- * "server_private_ip_1", "value": "10.100.1.25" }}, "vfModuleStackId":
- * "RaaVnf1/abfa8a6d-feb1-40af-aea3-109403b1cf6b", "vnfId": "AvnfID", "vnfStatus": "ACTIVE" }}
- */
- @GET
- @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "QueryVfModule", response = Response.class, notes = "Query an existing vnfModule")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfModule has been successfully queried"),
- @ApiResponse(code = 500, message = "query vnfModule failed, examine entity object for details")})
- public Response queryVfModule(@ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId,
- @ApiParam(value = "aaiVfModuleId", required = true) @PathParam("aaiVfModuleId") String aaiVfModuleId,
- @ApiParam(value = "cloudSiteId", required = true) @QueryParam("cloudSiteId") String cloudSiteId,
- @ApiParam(value = "cloudOwner", required = true) @QueryParam("cloudOwner") String cloudOwner,
- @ApiParam(value = "tenantId", required = true) @QueryParam("tenantId") String tenantId,
- @ApiParam(value = "vfModuleName", required = true) @QueryParam("vfModuleName") String vfModuleName, // RAA?
- // Id in
- // doc
- @ApiParam(value = "skipAAI", required = true) @QueryParam("skipAAI") Boolean skipAAI,
- @ApiParam(value = "msoRequest.requestId",
- required = true) @QueryParam("msoRequest.requestId") String requestId,
- @ApiParam(value = "msoRequest.serviceInstanceId",
- required = true) @QueryParam("msoRequest.serviceInstanceId") String serviceInstanceId,
- @ApiParam(value = "mode", required = true) @QueryParam("mode") String mode) {
- // This request responds synchronously only
- logger.debug("Query vfModule enter:" + vfModuleName);
- MsoRequest msoRequest = new MsoRequest(requestId, serviceInstanceId);
-
- try {
- int respStatus = HttpStatus.SC_OK;
- QueryVfModuleResponse qryResp = new QueryVfModuleResponse(aaiVnfId, aaiVfModuleId, null, null, null);
- Holder<Boolean> vnfExists = new Holder<>();
- Holder<String> vfModuleId = new Holder<>();
- Holder<VnfStatus> status = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
-
- // Support different Adapter Implementations
- MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudSiteId);
- adapter.queryVnf(cloudSiteId, cloudOwner, tenantId, vfModuleName, msoRequest, vnfExists, vfModuleId, status,
- outputs);
-
- if (!vnfExists.value) {
- logger.debug("vfModule not found");
- respStatus = HttpStatus.SC_NOT_FOUND;
- } else {
- logger.debug("vfModule found" + vfModuleId.value + ", status=" + status.value);
- qryResp.setVfModuleId(vfModuleId.value);
- qryResp.setVnfStatus(status.value);
- qryResp.setVfModuleOutputs(outputs.value);
- }
- logger.debug("Query vfModule exit");
- return Response.status(respStatus).entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {}).build();
- } catch (VnfException e) {
- logger.error(LoggingAnchor.FIVE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
- ErrorCode.BusinessProcessError.getValue(), "VnfException - queryVfModule", e);
- VfModuleExceptionResponse excResp =
- new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
- return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<VfModuleExceptionResponse>(excResp) {}).build();
- }
- }
-
- /*
- * URL: http://localhost:8080/vnfs/rest/v2/vnfs/<aaivnfid>/vf-modules REQUEST: {"createVfModuleRequest":
- * {"cloudSiteId": "DAN", "tenantId": "214b428a1f554c02935e66330f6a5409", "vnfId": "somevnfid", "vfModuleId":
- * "somemodid", "vfModuleName": "RaaVnf1", "vnfType": "ApacheVnf", "vfModuleParams": {"entry": [ {"key":
- * "network_id", "value": "59ed7b41-2983-413f-ba93-e7d437433916"}, {"key": "subnet_id", "value":
- * "086c9298-5c57-49b7-bb2b-6fd5730c5d92"}, {"key": "server_name_0", "value": "RaaVnf1"} ]}, "failIfExists": true,
- * "messageId": "ra.1", "notificationUrl": "http://localhost:8089/vnfmock", "skipAAI": true, "msoRequest": {
- * "requestId": "ra1", "serviceInstanceId": "sa1" }} }
- */
- @POST
- @Path("{aaiVnfId}/vf-modules")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "CreateVfModule", response = Response.class, notes = "Create a vnfModule")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfModule has been successfully created"),
- @ApiResponse(code = 202, message = "create vnfModule request has been successfully accepted (async only)"),
- @ApiResponse(code = 500, message = "create vnfModule failed, examine entity object for details")})
- public Response createVfModule(
- @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId,
- @ApiParam(value = "mode", required = true) @QueryParam("mode") String mode,
- @ApiParam(value = "CreateVfModuleRequest", required = true) final CreateVfModuleRequest req) {
- logger.debug("Create VfModule enter inside VnfAdapterRest: " + req.toJsonString());
- if (aaiVnfId == null || !aaiVnfId.equals(req.getVnfId())) {
- logger.debug("Req rejected - aaiVnfId not provided or doesn't match URL");
- return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN)
- .entity("vnfid in URL does not match content").build();
- }
-
- CreateVfModuleTask task = new CreateVfModuleTask(req, mode);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error(BRACKETS, MessageEnum.RA_CREATE_VNF_ERR.toString(), "createVfModule",
- ErrorCode.BusinessProcessError.getValue(), "Exception - createVfModule", e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("createVfModule exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class CreateVfModuleTask implements Runnable {
- private final CreateVfModuleRequest req;
- private CreateVfModuleResponse response = null;
- private VfModuleExceptionResponse eresp = null;
- private boolean sendxml;
- private String mode;
-
- public CreateVfModuleTask(CreateVfModuleRequest req, String mode) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- this.mode = mode;
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<CreateVfModuleResponse>(response) {}
- : new GenericEntity<VfModuleExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- logger.debug("CreateVfModuleTask start");
- try {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- // Synchronous Web Service Outputs
- Holder<String> vfModuleStackId = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
- Holder<VnfRollback> vnfRollback = new Holder<>();
- String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
- logger.debug("completeVnfVfModuleType=" + completeVnfVfModuleType);
-
- String cloudsiteId = req.getCloudSiteId();
- String cloudOwner = req.getCloudOwner();
- if (cloudsiteId != null && cloudsiteId.equals(TESTING_KEYWORD)) {
- String tenant = req.getTenantId();
- if (tenant != null && tenant.equals(TESTING_KEYWORD)) {
- throw new VnfException("testing.");
- }
- vnfRollback.value = new VnfRollback(req.getVnfId(), tenant, cloudOwner, cloudsiteId, true, false,
- new MsoRequest("reqid", "svcid"), req.getVolumeGroupId(), req.getVolumeGroupId(),
- req.getRequestType(), req.getModelCustomizationUuid());
- vfModuleStackId.value = "479D3D8B-6360-47BC-AB75-21CC91981484";
- outputs.value = VolumeAdapterRest.testMap();
- } else {
- // Support different Adapter Implementations
- MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsiteId);
- adapter.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- completeVnfVfModuleType, req.getVnfVersion(), req.getVnfId(), req.getVfModuleName(),
- req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(),
- req.getBaseVfModuleStackId(), req.getModelCustomizationUuid(), req.getVfModuleParams(),
- req.getFailIfExists(), req.getBackout(), req.getEnableBridge(), req.getMsoRequest(),
- vfModuleStackId, outputs, vnfRollback);
- }
- VfModuleRollback modRollback = new VfModuleRollback(vnfRollback.value, req.getVfModuleId(),
- vfModuleStackId.value, req.getMessageId());
- response = new CreateVfModuleResponse(req.getVnfId(), req.getVfModuleId(), vfModuleStackId.value,
- Boolean.TRUE, outputs.value, modRollback, req.getMessageId());
- } catch (VnfException e) {
- eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("CreateVfModuleTask exit: code=" + getStatusCode() + RESP + getResponse());
- }
- }
-
- @PUT
- @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "UpdateVfModule", response = Response.class, notes = "Update an existing vnfModule")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfModule has been successfully updated"),
- @ApiResponse(code = 202, message = "update vnfModule request has been successfully accepted (async only)"),
- @ApiResponse(code = 500, message = "update vnfModule failed, examine entity object for details")})
- public Response updateVfModule(
- @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId,
- @ApiParam(value = "aaiVfModuleId", required = true) @PathParam("aaiVfModuleId") String aaiVfModuleId,
- @ApiParam(value = "mode", required = true) @QueryParam("mode") String mode,
- @ApiParam(value = "UpdateVfModuleRequest", required = true) final UpdateVfModuleRequest req) {
- logger.debug("Update VfModule enter: " + req.toJsonString());
- UpdateVfModulesTask task = new UpdateVfModulesTask(req, mode);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error(BRACKETS, MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
- ErrorCode.BusinessProcessError.getValue(), "Exception - updateVfModule", e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("updateVfModules exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class UpdateVfModulesTask implements Runnable {
- private final UpdateVfModuleRequest req;
- private UpdateVfModuleResponse response = null;
- private VfModuleExceptionResponse eresp = null;
- private boolean sendxml;
- private String mode;
-
- public UpdateVfModulesTask(UpdateVfModuleRequest req, String mode) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- this.mode = mode;
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<UpdateVfModuleResponse>(response) {}
- : new GenericEntity<VfModuleExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- // Synchronous Web Service Outputs
- Holder<String> vfModuleStackId = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
- Holder<VnfRollback> vnfRollback = new Holder<>();
- String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
- logger.debug("in updateVf - completeVnfVfModuleType=" + completeVnfVfModuleType);
-
- String cloudsiteId = req.getCloudSiteId();
-
- // Support different Adapter Implementations
- MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsiteId);
- adapter.updateVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- completeVnfVfModuleType, req.getVnfVersion(), req.getVfModuleName(), req.getRequestType(),
- req.getVolumeGroupStackId(), req.getBaseVfModuleId(), req.getVfModuleStackId(),
- req.getModelCustomizationUuid(), req.getVfModuleParams(), req.getMsoRequest(), outputs,
- vnfRollback);
-
- response = new UpdateVfModuleResponse(req.getVnfId(), req.getVfModuleId(), vfModuleStackId.value,
- outputs.value, req.getMessageId());
- } catch (VnfException e) {
- eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("Update VfModule exit: code=" + getStatusCode() + RESP + getResponse());
- }
- }
-
- /*
- * URL:http://localhost:8080/vnfs/rest/v2/vnfs/<aaivnfid>/vf-modules/<aaimodid>/rollback REQUEST:
- * {"deleteVfModuleRequest": {"cloudSiteId": "DAN", "tenantId": "214b428a1f554c02935e66330f6a5409", "vnfId":
- * "somevnfid", "vfModuleId": "somemodid", "vfModuleStackId": "4e567676-e266-4594-a3a6-131c8a2baf73", "messageId":
- * "ra.1", "notificationUrl": "http://localhost:8089/vnfmock", "skipAAI": true, "msoRequest": { "requestId": "ra1",
- * "serviceInstanceId": "sa1" }} }
- */
- @DELETE
- @Path("{aaiVnfId}/vf-modules/{aaiVfModuleId}/rollback")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "RollbackVfModule", response = Response.class, notes = "Rollback an existing vnfModule")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfModule has been successfully rolled back"),
- @ApiResponse(code = 202,
- message = "rollback vnfModule request has been successfully accepted (async only)"),
- @ApiResponse(code = 500, message = "rollback vnfModule failed, examine entity object for details")})
- public Response rollbackVfModule(
- @ApiParam(value = "aaiVnfId", required = true) @PathParam("aaiVnfId") String aaiVnfId,
- @ApiParam(value = "aaiVfModuleId", required = true) @PathParam("aaiVfModuleId") String aaiVfModuleId,
- @ApiParam(value = "RollbackVfModuleRequest", required = true)
- // @QueryParam("rollback") String rollback,
- final RollbackVfModuleRequest req) {
- logger.debug("Rollback VfModule enter: " + req.toJsonString());
- RollbackVfModulesTask task = new RollbackVfModulesTask(req);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error(BRACKETS, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
- ErrorCode.BusinessProcessError.getValue(), "Exception - rollbackVfModule", e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("rollbackVfModule exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class RollbackVfModulesTask implements Runnable {
- private final RollbackVfModuleRequest req;
- private RollbackVfModuleResponse response = null;
- private VfModuleExceptionResponse eresp = null;
- private boolean sendxml;
-
- public RollbackVfModulesTask(RollbackVfModuleRequest req) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<RollbackVfModuleResponse>(response) {}
- : new GenericEntity<VfModuleExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVfModuleRollback().getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- VfModuleRollback vmr = req.getVfModuleRollback();
- VnfRollback vrb = new VnfRollback(vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudOwner(),
- vmr.getCloudSiteId(), true, vmr.isVfModuleCreated(), vmr.getMsoRequest(), null, null, null,
- null);
-
- // Support multiple adapter implementations
- MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(vmr.getMode(), vmr.getCloudSiteId());
- adapter.rollbackVnf(vrb);
-
- response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId());
- } catch (VnfException e) {
- logger.error(LoggingAnchor.THREE, MessageEnum.RA_ROLLBACK_VNF_ERR.toString(),
- ErrorCode.BusinessProcessError.getValue(), "Exception - rollbackVfModule", e);
- eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("RollbackVfModulesTask exit: code=" + getStatusCode() + RESP + getResponse());
- }
- }
-}
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
deleted file mode 100644
index 7e12735e05..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java
+++ /dev/null
@@ -1,626 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Modifications Copyright (C) 2018 IBM.
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.vnf;
-
-
-import java.util.HashMap;
-import java.util.Map;
-import javax.inject.Provider;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.GenericEntity;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.xml.ws.Holder;
-import org.apache.http.HttpStatus;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.QueryVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
-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.logging.filter.base.ErrorCode;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.openstack.beans.VnfRollback;
-import org.onap.so.openstack.beans.VnfStatus;
-import org.onap.so.openstack.exceptions.MsoExceptionCategory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-
-/**
- * This class services calls to the REST interface for VNF Volumes (http://host:port/vnfs/rest/v1/volume-groups) Both
- * XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. For
- * testing, call with cloudSiteId = ___TESTING___ To test exceptions, also set tenantId = ___TESTING___
- */
-@Path("/v1/volume-groups")
-@Api(value = "/v1/volume-groups", description = "root of volume-groups adapters restful web service")
-@Component
-public class VolumeAdapterRest {
-
- private static final Logger logger = LoggerFactory.getLogger(VolumeAdapterRest.class);
- private static final String TESTING_KEYWORD = "___TESTING___";
- private static final String EXCEPTION = "Exception :";
- private static final String RESP = ", resp=";
- private static final String VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT =
- "VolumeGroupId in URL does not match content";
- @Autowired
- private MsoVnfAdapterImpl vnfAdapter;
-
- @Autowired
- private Provider<BpelRestClient> bpelRestClientProvider;
-
- @POST
- @Path("")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "CreateVNFVolumes", response = Response.class, notes = "Create a new vnfVolume")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfVolume has been successfully created"),
- @ApiResponse(code = 202, message = "create vnfVolume request has been successfully accepted (async only)"),
- @ApiResponse(code = 500, message = "create vnfVolume failed, examine entity object for details")})
- public Response createVNFVolumes(
- @ApiParam(value = "CreateVolumeGroupRequest", required = true) final CreateVolumeGroupRequest req) {
- logger.debug("createVNFVolumes enter: {}", req.toJsonString());
- CreateVNFVolumesTask task = new CreateVNFVolumesTask(req);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} Exception - createVNFVolumes: ", MessageEnum.RA_CREATE_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("createVNFVolumes exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class CreateVNFVolumesTask implements Runnable {
- private final CreateVolumeGroupRequest req;
- private CreateVolumeGroupResponse response = null;
- private VolumeGroupExceptionResponse eresp = null;
- private boolean sendxml;
-
- public CreateVNFVolumesTask(CreateVolumeGroupRequest req) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<CreateVolumeGroupResponse>(response) {}
- : new GenericEntity<VolumeGroupExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- logger.debug("CreateVFModule VolumesTask start");
- try {
- // Synchronous Web Service Outputs
- Holder<String> stackId = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
- Holder<VnfRollback> vnfRollback = new Holder<>();
- String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
- logger.debug("in createVfModuleVolumes - completeVnfVfModuleType={}", completeVnfVfModuleType);
-
- String cloudsite = req.getCloudSiteId();
- if (cloudsite != null && cloudsite.equals(TESTING_KEYWORD)) {
- String tenant = req.getTenantId();
- if (tenant != null && tenant.equals(TESTING_KEYWORD)) {
- throw new VnfException("testing.");
- }
- stackId.value = "479D3D8B-6360-47BC-AB75-21CC91981484";
- outputs.value = testMap();
- } else {
- // vnfAdapter.createVnf(
- // req.getCloudSiteId(),
- // req.getTenantId(),
- // req.getVnfType(),
- // req.getVnfVersion(),
- // req.getVolumeGroupName(),
- // "VOLUME", // request type is VOLUME
- // null, // not sure about this
- // req.getVolumeGroupParams(),
- // req.getFailIfExists(),
- // req.getSuppressBackout(),
- // req.getMsoRequest(),
- // stackId,
- // outputs,
- // vnfRollback);
- vnfAdapter.createVfModule(req.getCloudSiteId(), // cloudSiteId,
- req.getCloudOwner(), // cloudOwner,
- req.getTenantId(), // tenantId,
- // req.getVnfType(), //vnfType,
- completeVnfVfModuleType, req.getVnfVersion(), // vnfVersion,
- "", // genericVnfId
- req.getVolumeGroupName(), // vnfName,
- "", // vfModuleid
- "VOLUME", // requestType,
- null, // volumeGroupHeatStackId,
- null, // baseVfHeatStackId,
- req.getModelCustomizationUuid(), req.getVolumeGroupParams(), // inputs,
- req.getFailIfExists(), // failIfExists,
- req.getSuppressBackout(), // backout,
- req.getEnableBridge(), req.getMsoRequest(), // msoRequest,
- stackId, outputs, vnfRollback);
- }
- VolumeGroupRollback rb = new VolumeGroupRollback(req.getVolumeGroupId(), stackId.value, true, // TODO
- // boolean
- // volumeGroupCreated,
- // when
- // would
- // it be
- // false?
- req.getTenantId(), req.getCloudOwner(), req.getCloudSiteId(), req.getMsoRequest(),
- req.getMessageId());
- response = new CreateVolumeGroupResponse(req.getVolumeGroupId(), stackId.value, true, // TODO boolean
- // volumeGroupCreated,
- // when would it
- // be false?
- outputs.value, rb, req.getMessageId());
- } catch (VnfException e) {
- logger.debug(EXCEPTION, e);
- eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("CreateVFModule VolumesTask exit: code={} {} {}", getStatusCode(), RESP, getResponse());
- }
- }
-
- @DELETE
- @Path("{aaiVolumeGroupId}")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "DeleteVNFVolumes", response = Response.class, notes = "Delete an existing vnfVolume")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfVolume has been successfully deleted"),
- @ApiResponse(code = 202, message = "delete vnfVolume request has been successfully accepted (async only)"),
- @ApiResponse(code = 500, message = "delete vnfVolume failed, examine entity object for details")})
- public Response deleteVNFVolumes(
- @ApiParam(value = "aaiVolumeGroupId",
- required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId,
- @ApiParam(value = "DeleteVolumeGroupRequest", required = true) final DeleteVolumeGroupRequest req) {
- logger.debug("deleteVNFVolumes enter: {}", req.toJsonString());
- if (aaiVolumeGroupId == null || !aaiVolumeGroupId.equals(req.getVolumeGroupId())) {
- return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN)
- .entity(VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT).build();
- }
- DeleteVNFVolumesTask task = new DeleteVNFVolumesTask(req);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} Exception - deleteVNFVolumes: ", MessageEnum.RA_DELETE_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("deleteVNFVolumes exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class DeleteVNFVolumesTask implements Runnable {
- private final DeleteVolumeGroupRequest req;
- private DeleteVolumeGroupResponse response = null;
- private VolumeGroupExceptionResponse eresp = null;
- private boolean sendxml;
-
- public DeleteVNFVolumesTask(DeleteVolumeGroupRequest req) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<DeleteVolumeGroupResponse>(response) {}
- : new GenericEntity<VolumeGroupExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- logger.debug("DeleteVNFVolumesTask start");
- try {
- if (!req.getCloudSiteId().equals(TESTING_KEYWORD)) {
- vnfAdapter.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- req.getVolumeGroupStackId(), req.getMsoRequest());
- }
- response = new DeleteVolumeGroupResponse(true, req.getMessageId());
- } catch (VnfException e) {
- logger.debug(EXCEPTION, e);
- eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("DeleteVNFVolumesTask exit: code={} {} {}", getStatusCode(), RESP, getResponse());
- }
- }
-
- @DELETE
- @Path("{aaiVolumeGroupId}/rollback")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "RollbackVNFVolumes", response = Response.class, notes = "Delete an existing vnfVolume")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfVolume has been successfully rolled back"),
- @ApiResponse(code = 202,
- message = "rollback vnfVolume request has been successfully accepted (async only)"),
- @ApiResponse(code = 500, message = "rollback vnfVolume failed, examine entity object for details")})
- public Response rollbackVNFVolumes(
- @ApiParam(value = "aaiVolumeGroupId",
- required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId,
- @ApiParam(value = "RollbackVolumeGroupRequest", required = true) final RollbackVolumeGroupRequest req) {
- logger.debug("rollbackVNFVolumes enter: {}", req.toJsonString());
- if (aaiVolumeGroupId == null || req.getVolumeGroupRollback() == null
- || !aaiVolumeGroupId.equals(req.getVolumeGroupRollback().getVolumeGroupId())) {
- return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN)
- .entity(VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT).build();
- }
- RollbackVNFVolumesTask task = new RollbackVNFVolumesTask(req);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} Exception - rollbackVNFVolumes: ", MessageEnum.RA_ROLLBACK_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("rollbackVNFVolumes exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class RollbackVNFVolumesTask implements Runnable {
- private final RollbackVolumeGroupRequest req;
- private RollbackVolumeGroupResponse response = null;
- private VolumeGroupExceptionResponse eresp = null;
- private boolean sendxml;
-
- public RollbackVNFVolumesTask(RollbackVolumeGroupRequest req) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<RollbackVolumeGroupResponse>(response) {}
- : new GenericEntity<VolumeGroupExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVolumeGroupRollback().getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- logger.debug("DeleteVNFVolumesTask start");
- try {
- VolumeGroupRollback vgr = req.getVolumeGroupRollback();
- VnfRollback vrb = new VnfRollback(vgr.getVolumeGroupStackId(), vgr.getTenantId(), vgr.getCloudOwnerId(),
- vgr.getCloudSiteId(), true, true, vgr.getMsoRequest(), null, null, null, null);
- vnfAdapter.rollbackVnf(vrb);
- response = new RollbackVolumeGroupResponse(true, req.getMessageId());
- } catch (VnfException e) {
- logger.debug(EXCEPTION, e);
- eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("DeleteVNFVolumesTask exit: code={} {} {}", getStatusCode(), RESP, getResponse());
- }
-
- }
-
- @PUT
- @Path("{aaiVolumeGroupId}")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "UpdateVNFVolumes", response = Response.class, notes = "Update an existing vnfVolume")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfVolume has been successfully updated"),
- @ApiResponse(code = 202, message = "update vnfVolume request has been successfully accepted (async only)"),
- @ApiResponse(code = 500, message = "update vnfVolume failed, examine entity object for details")})
- public Response updateVNFVolumes(
- @ApiParam(value = "aaiVolumeGroupId",
- required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId,
- @ApiParam(value = "UpdateVolumeGroupRequest", required = true) final UpdateVolumeGroupRequest req) {
- logger.debug("updateVNFVolumes enter: {}", req.toJsonString());
- if (aaiVolumeGroupId == null || !aaiVolumeGroupId.equals(req.getVolumeGroupId())) {
- return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN)
- .entity(VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT).build();
- }
- UpdateVNFVolumesTask task = new UpdateVNFVolumesTask(req);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} Exception - updateVNFVolumes: ", MessageEnum.RA_UPDATE_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("updateVNFVolumes exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class UpdateVNFVolumesTask implements Runnable {
- private final UpdateVolumeGroupRequest req;
- private UpdateVolumeGroupResponse response = null;
- private VolumeGroupExceptionResponse eresp = null;
- private boolean sendxml;
-
- public UpdateVNFVolumesTask(UpdateVolumeGroupRequest req) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<UpdateVolumeGroupResponse>(response) {}
- : new GenericEntity<VolumeGroupExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- logger.debug("UpdateVNFVolumesTask start");
- try {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- Holder<Map<String, String>> outputs = new Holder<>();
- Holder<VnfRollback> vnfRollback = new Holder<>();
- String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
- logger.debug("in updateVfModuleVolume - completeVnfVfModuleType={}", completeVnfVfModuleType);
-
- if (req.getCloudSiteId().equals(TESTING_KEYWORD)) {
- outputs.value = testMap();
- } else {
- // vnfAdapter.updateVnf(
- // req.getCloudSiteId(),
- // req.getTenantId(),
- // req.getVnfType(),
- // req.getVnfVersion(),
- // req.getVfModuleType(),
- // "VOLUME", // request type is VOLUME
- // req.getVolumeGroupStackId(),
- // req.getVolumeGroupParams(),
- // req.getMsoRequest(),
- // outputs,
- // vnfRollback);
- vnfAdapter.updateVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- // req.getVnfType(),
- completeVnfVfModuleType, req.getVnfVersion(), req.getVolumeGroupStackId(), "VOLUME", null,
- null, req.getVolumeGroupStackId(), req.getModelCustomizationUuid(),
- req.getVolumeGroupParams(), req.getMsoRequest(), outputs, vnfRollback);
- }
- response = new UpdateVolumeGroupResponse(req.getVolumeGroupId(), req.getVolumeGroupStackId(),
- outputs.value, req.getMessageId());
- } catch (VnfException e) {
- logger.debug(EXCEPTION, e);
- eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("UpdateVNFVolumesTask exit: code={} {} {}", getStatusCode(), RESP, getResponse());
- }
- }
-
- @GET
- @Path("{aaiVolumeGroupId}")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "QueryVNFVolumes", response = Response.class, notes = "Query an existing vnfVolume")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfVolume has been successfully queried"),
- @ApiResponse(code = 500, message = "query vnfVolume failed, examine entity object for details")})
- public Response queryVNFVolumes(
- @ApiParam(value = "aaiVolumeGroupId",
- required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId,
- @ApiParam(value = "cloudSiteId", required = true) @QueryParam("cloudSiteId") String cloudSiteId,
- @ApiParam(value = "cloudOwner", required = true) @QueryParam("cloudOwner") String cloudOwner,
- @ApiParam(value = "tenantId", required = true) @QueryParam("tenantId") String tenantId,
- @ApiParam(value = "volumeGroupStackId",
- required = true) @QueryParam("volumeGroupStackId") String volumeGroupStackId,
- @ApiParam(value = "skipAAI", required = true) @QueryParam("skipAAI") Boolean skipAAI,
- @ApiParam(value = "msoRequest.requestId",
- required = true) @QueryParam("msoRequest.requestId") String requestId,
- @ApiParam(value = "msoRequest.serviceInstanceId",
- required = true) @QueryParam("msoRequest.serviceInstanceId") String serviceInstanceId) {
- // This request responds synchronously only
- logger.debug("queryVNFVolumes enter: {} {}", aaiVolumeGroupId, volumeGroupStackId);
- MsoRequest msoRequest = new MsoRequest(requestId, serviceInstanceId);
-
- try {
- int respStatus = HttpStatus.SC_OK;
- QueryVolumeGroupResponse qryResp =
- new QueryVolumeGroupResponse(aaiVolumeGroupId, volumeGroupStackId, null, null);
- Holder<Boolean> vnfExists = new Holder<>();
- Holder<String> vfModuleId = new Holder<>();
- Holder<VnfStatus> status = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
- if (cloudSiteId != null && cloudSiteId.equals(TESTING_KEYWORD)) {
- if (tenantId != null && tenantId.equals(TESTING_KEYWORD)) {
- throw new VnfException("testing.");
- }
- vnfExists.value = true;
- vfModuleId.value = TESTING_KEYWORD;
- status.value = VnfStatus.ACTIVE;
- outputs.value = testMap();
- } else {
- vnfAdapter.queryVnf(cloudSiteId, cloudOwner, tenantId, volumeGroupStackId, msoRequest, vnfExists,
- vfModuleId, status, outputs);
- }
- if (!vnfExists.value) {
- logger.debug("VNFVolumes not found");
- qryResp.setVolumeGroupStatus(status.value);
- respStatus = HttpStatus.SC_NOT_FOUND;
- } else {
- logger.debug("VNFVolumes found {}, status={}", vfModuleId.value, status.value);
- qryResp.setVolumeGroupStatus(status.value);
- qryResp.setVolumeGroupOutputs(outputs.value);
- }
- logger.debug("Query queryVNFVolumes exit");
- return Response.status(respStatus).entity(new GenericEntity<QueryVolumeGroupResponse>(qryResp) {}).build();
- } catch (VnfException e) {
- logger.error("{} {} AaiVolumeGroupId: {} VnfException - queryVNFVolumes", MessageEnum.RA_QUERY_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), aaiVolumeGroupId, e);
- VolumeGroupExceptionResponse excResp = new VolumeGroupExceptionResponse(e.getMessage(),
- MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
- logger.debug("Query queryVNFVolumes exit");
- return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<VolumeGroupExceptionResponse>(excResp) {}).build();
- }
- }
-
- public static Map<String, String> testMap() {
- Map<String, String> m = new HashMap<>();
- m.put("mickey", "7");
- m.put("clyde", "10");
- m.put("wayne", "99");
- return m;
- }
-}
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
deleted file mode 100644
index a424fa92fd..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
+++ /dev/null
@@ -1,606 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * OPENECOMP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (C) 2018 IBM.
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.vnf;
-
-
-import java.util.HashMap;
-import java.util.Map;
-import javax.inject.Provider;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.GenericEntity;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.xml.ws.Holder;
-import org.apache.http.HttpStatus;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.QueryVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
-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.logging.filter.base.ErrorCode;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.openstack.beans.VnfRollback;
-import org.onap.so.openstack.beans.VnfStatus;
-import org.onap.so.openstack.exceptions.MsoExceptionCategory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-
-/**
- * This class services calls to the REST interface for VNF Volumes (http://host:port/vnfs/rest/v1/volume-groups) Both
- * XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. For
- * testing, call with cloudSiteId = ___TESTING___ To test exceptions, also set tenantId = ___TESTING___
- *
- * V2 incorporates run-time selection of sub-orchestrator implementation (Heat or Cloudify) based on the target cloud.
- */
-@Path("/v2/volume-groups")
-@Api(value = "/v2/volume-groups", description = "root of volume-groups adapters restful web service v2")
-@Component
-public class VolumeAdapterRestV2 {
-
- private static final Logger logger = LoggerFactory.getLogger(VolumeAdapterRestV2.class);
- private static final String TESTING_KEYWORD = "___TESTING___";
- private static final String RESP = ", resp=";
- private static final String EXCEPTION = "Exception :";
- private static final String VOLUME_GROUPID_MISSING = "VolumeGroupId in URL does not match content";
-
- @Autowired
- private VnfAdapterRestUtils vnfAdapterRestUtils;
-
- @Autowired
- private Provider<BpelRestClient> bpelRestClientProvider;
-
- @POST
- @Path("")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "CreateVNFVolumes", response = Response.class, notes = "Create a new vnfVolume")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfVolume has been successfully created"),
- @ApiResponse(code = 202, message = "create vnfVolume request has been successfully accepted (async only)"),
- @ApiResponse(code = 500, message = "create vnfVolume failed, examine entity object for details")})
- public Response createVNFVolumes(@ApiParam(value = "mode", required = true) @QueryParam("mode") String mode,
- @ApiParam(value = "CreateVolumeGroupRequest", required = true) final CreateVolumeGroupRequest req) {
- CreateVNFVolumesTask task = new CreateVNFVolumesTask(req, mode);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} Exception - createVNFVolumes: ", MessageEnum.RA_CREATE_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("createVNFVolumes exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class CreateVNFVolumesTask implements Runnable {
- private final CreateVolumeGroupRequest req;
- private CreateVolumeGroupResponse response = null;
- private VolumeGroupExceptionResponse eresp = null;
- private boolean sendxml;
- private String mode;
-
- public CreateVNFVolumesTask(CreateVolumeGroupRequest req, String mode) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- this.mode = mode;
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<CreateVolumeGroupResponse>(response) {}
- : new GenericEntity<VolumeGroupExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- logger.debug("CreateVFModule VolumesTask start");
- try {
- // Synchronous Web Service Outputs
- Holder<String> stackId = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
- Holder<VnfRollback> vnfRollback = new Holder<>();
- String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
- logger.debug("in createVfModuleVolumes - completeVnfVfModuleType={}", completeVnfVfModuleType);
-
- String cloudsiteId = req.getCloudSiteId();
-
- // Support different Adapter Implementations
- MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsiteId);
- vnfAdapter.createVfModule(req.getCloudSiteId(), // cloudSiteId,
- req.getCloudOwner(), // cloudOwner,
- req.getTenantId(), // tenantId,
- completeVnfVfModuleType, // vnfType,
- req.getVnfVersion(), // vnfVersion,
- "", // genericVnfId
- req.getVolumeGroupName(), // vnfName,
- "", // vfModuleId
- "VOLUME", // requestType,
- null, // volumeGroupHeatStackId,
- null, // baseVfHeatStackId,
- req.getModelCustomizationUuid(), req.getVolumeGroupParams(), // inputs,
- req.getFailIfExists(), // failIfExists,
- req.getSuppressBackout(), // backout,
- req.getEnableBridge(), req.getMsoRequest(), // msoRequest,
- stackId, outputs, vnfRollback);
-
-
- VolumeGroupRollback rb = new VolumeGroupRollback(req.getVolumeGroupId(), stackId.value,
- vnfRollback.value.getVnfCreated(), req.getTenantId(), req.getCloudOwner(), req.getCloudSiteId(),
- req.getMsoRequest(), req.getMessageId());
-
- response = new CreateVolumeGroupResponse(req.getVolumeGroupId(), stackId.value,
- vnfRollback.value.getVnfCreated(), outputs.value, rb, req.getMessageId());
- } catch (VnfException e) {
- logger.debug(EXCEPTION, e);
- eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("CreateVFModule VolumesTask exit: code= {} {} {}", getStatusCode(), RESP, getResponse());
- }
- }
-
- @DELETE
- @Path("{aaiVolumeGroupId}")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "DeleteVNFVolumes", response = Response.class, notes = "Delete an existing vnfVolume")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfVolume has been successfully deleted"),
- @ApiResponse(code = 202, message = "delete vnfVolume request has been successfully accepted (async only)"),
- @ApiResponse(code = 500, message = "delete vnfVolume failed, examine entity object for details")})
- public Response deleteVNFVolumes(
- @ApiParam(value = "aaiVolumeGroupId",
- required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId,
- @ApiParam(value = "mode", required = true) @QueryParam("mode") String mode,
- @ApiParam(value = "DeleteVolumeGroupRequest", required = true) final DeleteVolumeGroupRequest req) {
- logger.debug("deleteVNFVolumes enter: {}", req.toJsonString());
- if (aaiVolumeGroupId == null || !aaiVolumeGroupId.equals(req.getVolumeGroupId())) {
- return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN).entity(VOLUME_GROUPID_MISSING)
- .build();
- }
- DeleteVNFVolumesTask task = new DeleteVNFVolumesTask(req, mode);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} Exception - deleteVNFVolumes: ", MessageEnum.RA_DELETE_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("deleteVNFVolumes exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class DeleteVNFVolumesTask implements Runnable {
- private final DeleteVolumeGroupRequest req;
- private DeleteVolumeGroupResponse response = null;
- private VolumeGroupExceptionResponse eresp = null;
- private boolean sendxml;
- private String mode;
-
- public DeleteVNFVolumesTask(DeleteVolumeGroupRequest req, String mode) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- this.mode = mode;
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<DeleteVolumeGroupResponse>(response) {}
- : new GenericEntity<VolumeGroupExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- logger.debug("DeleteVNFVolumesTask start");
- String cloudSiteId = req.getCloudSiteId();
- try {
- if (!cloudSiteId.equals(TESTING_KEYWORD)) {
- // Support different Adapter Implementations
- MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudSiteId);
- vnfAdapter.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- req.getVolumeGroupStackId(), req.getMsoRequest());
- }
- response = new DeleteVolumeGroupResponse(true, req.getMessageId());
- } catch (VnfException e) {
- logger.debug(EXCEPTION, e);
- eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("DeleteVNFVolumesTask exit: code= {} {} {}", getStatusCode(), RESP, getResponse());
- }
- }
-
- @DELETE
- @Path("{aaiVolumeGroupId}/rollback")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "RollbackVNFVolumes", response = Response.class, notes = "Delete an existing vnfVolume")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfVolume has been successfully rolled back"),
- @ApiResponse(code = 202,
- message = "rollback vnfVolume request has been successfully accepted (async only)"),
- @ApiResponse(code = 500, message = "rollback vnfVolume failed, examine entity object for details")})
- public Response rollbackVNFVolumes(
- @ApiParam(value = "aaiVolumeGroupId",
- required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId,
- @ApiParam(value = "RollbackVolumeGroupRequest", required = true) final RollbackVolumeGroupRequest req) {
- logger.debug("rollbackVNFVolumes enter: {}", req.toJsonString());
- if (aaiVolumeGroupId == null || req.getVolumeGroupRollback() == null
- || !aaiVolumeGroupId.equals(req.getVolumeGroupRollback().getVolumeGroupId())) {
- return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN).entity(VOLUME_GROUPID_MISSING)
- .build();
- }
- RollbackVNFVolumesTask task = new RollbackVNFVolumesTask(req);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} Exception - rollbackVNFVolumes: ", MessageEnum.RA_ROLLBACK_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("rollbackVNFVolumes exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class RollbackVNFVolumesTask implements Runnable {
- private final RollbackVolumeGroupRequest req;
- private RollbackVolumeGroupResponse response = null;
- private VolumeGroupExceptionResponse eresp = null;
- private boolean sendxml;
-
- public RollbackVNFVolumesTask(RollbackVolumeGroupRequest req) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<RollbackVolumeGroupResponse>(response) {}
- : new GenericEntity<VolumeGroupExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getVolumeGroupRollback().getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- logger.debug("RollbackVNFVolumesTask start");
- try {
- VolumeGroupRollback vgr = req.getVolumeGroupRollback();
- VnfRollback vrb = new VnfRollback(vgr.getVolumeGroupStackId(), vgr.getTenantId(), vgr.getCloudOwnerId(),
- vgr.getCloudSiteId(), true, true, vgr.getMsoRequest(), null, null, null, null);
-
- // Support different Adapter Implementations
- MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(vrb.getMode(), vrb.getCloudSiteId());
- vnfAdapter.rollbackVnf(vrb);
- response = new RollbackVolumeGroupResponse(true, req.getMessageId());
- } catch (VnfException e) {
- logger.debug(EXCEPTION, e);
- eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("RollbackVNFVolumesTask exit: code= {} {} {}", getStatusCode(), RESP, getResponse());
- }
-
- }
-
- @PUT
- @Path("{aaiVolumeGroupId}")
- @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "UpdateVNFVolumes", response = Response.class, notes = "Update an existing vnfVolume")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfVolume has been successfully updated"),
- @ApiResponse(code = 202, message = "update vnfVolume request has been successfully accepted (async only)"),
- @ApiResponse(code = 500, message = "update vnfVolume failed, examine entity object for details")})
- public Response updateVNFVolumes(
- @ApiParam(value = "aaiVolumeGroupId",
- required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId,
- @ApiParam(value = "mode", required = true) @QueryParam("mode") String mode,
- @ApiParam(value = "UpdateVolumeGroupRequest", required = true) final UpdateVolumeGroupRequest req) {
- logger.debug("updateVNFVolumes enter: {}", req.toJsonString());
- if (aaiVolumeGroupId == null || !aaiVolumeGroupId.equals(req.getVolumeGroupId())) {
- return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN).entity(VOLUME_GROUPID_MISSING)
- .build();
- }
- UpdateVNFVolumesTask task = new UpdateVNFVolumesTask(req, mode);
- if (req.isSynchronous()) {
- // This is a synchronous request
- task.run();
- return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build();
- } else {
- // This is an asynchronous request
- try {
- Thread t1 = new Thread(task);
- t1.start();
- } catch (Exception e) {
- // problem handling create, send generic failure as sync resp to caller
- logger.error("{} {} Exception - updateVNFVolumes: ", MessageEnum.RA_UPDATE_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- return Response.serverError().build();
- }
- // send sync response (ACK) to caller
- logger.debug("updateVNFVolumes exit");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- }
- }
-
- public class UpdateVNFVolumesTask implements Runnable {
- private final UpdateVolumeGroupRequest req;
- private UpdateVolumeGroupResponse response = null;
- private VolumeGroupExceptionResponse eresp = null;
- private boolean sendxml;
- private String mode;
-
- public UpdateVNFVolumesTask(UpdateVolumeGroupRequest req, String mode) {
- this.req = req;
- this.sendxml = true; // can be set with a field or header later
- this.mode = mode;
- }
-
- public int getStatusCode() {
- return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST;
- }
-
- public Object getGenericEntityResponse() {
- return (response != null) ? new GenericEntity<UpdateVolumeGroupResponse>(response) {}
- : new GenericEntity<VolumeGroupExceptionResponse>(eresp) {};
- }
-
- private String getResponse() {
- if (response != null) {
- return sendxml ? response.toXmlString() : response.toJsonString();
- } else {
- return sendxml ? eresp.toXmlString() : eresp.toJsonString();
- }
- }
-
- @Override
- public void run() {
- try {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId());
- } catch (Exception e) {
- logger.error("Error adding RequestId to MDC", e);
- }
- logger.debug("UpdateVNFVolumesTask start");
- try {
- Holder<Map<String, String>> outputs = new Holder<>();
- Holder<VnfRollback> vnfRollback = new Holder<>();
- String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
- logger.debug("in updateVfModuleVolume - completeVnfVfModuleType={}", completeVnfVfModuleType);
-
- if (req.getCloudSiteId().equals(TESTING_KEYWORD)) {
- outputs.value = testMap();
- } else {
- // Support different Adapter Implementations
- MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, req.getCloudSiteId());
- vnfAdapter.updateVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- // req.getVnfType(),
- completeVnfVfModuleType, req.getVnfVersion(), req.getVolumeGroupStackId(), "VOLUME", null,
- null, req.getVolumeGroupStackId(), req.getModelCustomizationUuid(),
- req.getVolumeGroupParams(), req.getMsoRequest(), outputs, vnfRollback);
- }
- response = new UpdateVolumeGroupResponse(req.getVolumeGroupId(), req.getVolumeGroupStackId(),
- outputs.value, req.getMessageId());
- } catch (VnfException e) {
- logger.debug(EXCEPTION, e);
- eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true,
- req.getMessageId());
- }
- if (!req.isSynchronous()) {
- // This is asynch, so POST response back to caller
- BpelRestClient bpelClient = bpelRestClientProvider.get();
- bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
- }
- logger.debug("UpdateVNFVolumesTask exit: code= {} {} {}", getStatusCode(), RESP, getResponse());
- }
- }
-
- @GET
- @Path("{aaiVolumeGroupId}")
- @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
- @ApiOperation(value = "QueryVNFVolumes", response = Response.class, notes = "Query an existing vnfVolume")
- @ApiResponses({@ApiResponse(code = 200, message = "vnfVolume has been successfully queried"),
- @ApiResponse(code = 500, message = "query vnfVolume failed, examine entity object for details")})
- public Response queryVNFVolumes(
- @ApiParam(value = "aaiVolumeGroupId",
- required = true) @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId,
- @ApiParam(value = "cloudSiteId", required = true) @QueryParam("cloudSiteId") String cloudSiteId,
- @ApiParam(value = "cloudOwner", required = true) @QueryParam("cloudOwner") String cloudOwner,
- @ApiParam(value = "tenantId", required = true) @QueryParam("tenantId") String tenantId,
- @ApiParam(value = "volumeGroupStackId",
- required = true) @QueryParam("volumeGroupStackId") String volumeGroupStackId,
- @ApiParam(value = "skipAAI", required = true) @QueryParam("skipAAI") Boolean skipAAI,
- @ApiParam(value = "msoRequest.requestId",
- required = true) @QueryParam("msoRequest.requestId") String requestId,
- @ApiParam(value = "msoRequest.serviceInstanceId",
- required = true) @QueryParam("msoRequest.serviceInstanceId") String serviceInstanceId,
- @ApiParam(value = "mode", required = true) @QueryParam("mode") String mode) {
- // This request responds synchronously only
- logger.debug("queryVNFVolumes enter: {} {}", aaiVolumeGroupId, volumeGroupStackId);
- MsoRequest msoRequest = new MsoRequest(requestId, serviceInstanceId);
-
- try {
- int respStatus = HttpStatus.SC_OK;
- QueryVolumeGroupResponse qryResp =
- new QueryVolumeGroupResponse(aaiVolumeGroupId, volumeGroupStackId, null, null);
- Holder<Boolean> vnfExists = new Holder<>();
- Holder<String> vfModuleId = new Holder<>();
- Holder<VnfStatus> status = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
- if (cloudSiteId != null && cloudSiteId.equals(TESTING_KEYWORD)) {
- if (tenantId != null && tenantId.equals(TESTING_KEYWORD)) {
- throw new VnfException("testing.");
- }
- vnfExists.value = true;
- vfModuleId.value = TESTING_KEYWORD;
- status.value = VnfStatus.ACTIVE;
- outputs.value = testMap();
- } else {
- // Support different Adapter Implementations
- MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudSiteId);
- vnfAdapter.queryVnf(cloudSiteId, cloudOwner, tenantId, volumeGroupStackId, msoRequest, vnfExists,
- vfModuleId, status, outputs);
- }
- if (!vnfExists.value) {
- logger.debug("VNFVolumes not found");
- qryResp.setVolumeGroupStatus(status.value);
- respStatus = HttpStatus.SC_NOT_FOUND;
- } else {
- logger.debug("VNFVolumes found {}, status={}", vfModuleId.value, status.value);
- qryResp.setVolumeGroupStatus(status.value);
- qryResp.setVolumeGroupOutputs(outputs.value);
- }
- logger.debug("Query queryVNFVolumes exit");
- return Response.status(respStatus).entity(new GenericEntity<QueryVolumeGroupResponse>(qryResp) {}).build();
- } catch (VnfException e) {
- logger.error("{} {} AaiVolumeGroupId: {} VnfException - queryVNFVolumes: ", MessageEnum.RA_QUERY_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), aaiVolumeGroupId, e);
- VolumeGroupExceptionResponse excResp = new VolumeGroupExceptionResponse(e.getMessage(),
- MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
- logger.debug("Query queryVNFVolumes exit");
- return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<VolumeGroupExceptionResponse>(excResp) {}).build();
- }
- }
-
- public static Map<String, String> testMap() {
- Map<String, String> m = new HashMap<>();
- m.put("mickey", "7");
- m.put("clyde", "10");
- m.put("wayne", "99");
- return m;
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
index 7eff09b692..d0ca87df95 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
@@ -146,10 +146,11 @@ public interface HeatBridgeApi {
/**
* Execute AAI restful API to update the Openstack resources
- *
+ *
+ * @param dryrun - this will simply log the aai transaction to log if enabled and not write any data
* @throws HeatBridgeException when failing to add openstack resource PoJos to AAI
*/
- void submitToAai() throws HeatBridgeException;
+ void submitToAai(boolean dryrun) throws HeatBridgeException;
/**
* Delete heatbridge data for a given vf-module
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 6d3b0ab680..a00b9f9002 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
@@ -55,28 +55,28 @@ import org.onap.aai.domain.yang.SriovPf;
import org.onap.aai.domain.yang.SriovPfs;
import org.onap.aai.domain.yang.SriovVf;
import org.onap.aai.domain.yang.SriovVfs;
+import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.Vlan;
import org.onap.aai.domain.yang.Vlans;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.aai.domain.yang.VfModule;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.AAISingleTransactionClient;
-import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.onap.so.client.aai.entities.Relationships;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
-import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed;
-import org.onap.so.client.PreconditionFailedException;
+import org.onap.logging.filter.base.ErrorCode;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.AAISingleTransactionClient;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.Relationships;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
+import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.ServerType;
import org.onap.so.heatbridge.constants.HeatBridgeConstants;
import org.onap.so.heatbridge.factory.MsoCloudClientFactoryImpl;
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.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.openstack4j.model.compute.Server;
@@ -134,10 +134,19 @@ public class HeatBridgeImpl implements HeatBridgeApi {
@Override
public OpenstackClient authenticate() throws HeatBridgeException {
+ String keystoneVersion = "";
+ if (ServerType.KEYSTONE.equals(cloudIdentity.getIdentityServerType()))
+ keystoneVersion = "v2.0";
+ else if (ServerType.KEYSTONE_V3.equals(cloudIdentity.getIdentityServerType())) {
+ keystoneVersion = "v3";
+ } else {
+ keystoneVersion = "UNKNOWN";
+ }
+ logger.trace("Keystone Version: {} ", keystoneVersion);
this.osClient = new MsoCloudClientFactoryImpl(new OpenstackClientFactoryImpl()).getOpenstackClient(
cloudIdentity.getIdentityUrl(), cloudIdentity.getMsoId(), cloudIdentity.getMsoPass(), regionId,
- tenantId);
- logger.debug("Successfully authenticated with keystone for tenant: " + tenantId + " and region: " + regionId);
+ tenantId, keystoneVersion);
+ logger.trace("Successfully authenticated with keystone for tenant: {} and region: {}", tenantId, regionId);
return osClient;
}
@@ -171,7 +180,6 @@ public class HeatBridgeImpl implements HeatBridgeApi {
@Override
public List<Server> getAllOpenstackServers(final List<Resource> stackResources) {
Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
-
// Filter Openstack Compute resources
List<String> serverIds =
extractStackResourceIdsByResourceType(stackResources, HeatBridgeConstants.OS_SERVER_RESOURCE_TYPE);
@@ -221,12 +229,7 @@ public class HeatBridgeImpl implements HeatBridgeApi {
try {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.FLAVOR, cloudOwner, cloudRegionId,
aaiFlavor.getFlavorId());
- if (!resourcesClient.exists(uri)) {
- transaction.create(uri, aaiFlavor);
- logger.debug("Queuing AAI command to add flavor: " + aaiFlavor.getFlavorId());
- } else {
- logger.debug("Nothing to add since flavor: " + aaiFlavor.getFlavorId() + "already exists in AAI.");
- }
+ transaction.createIfNotExists(uri, Optional.of(aaiFlavor));
} catch (WebApplicationException e) {
throw new HeatBridgeException(
"Failed to update flavor to AAI: " + aaiFlavor.getFlavorId() + ". Error" + " cause: " + e, e);
@@ -260,12 +263,23 @@ public class HeatBridgeImpl implements HeatBridgeApi {
lIf.setInterfaceId(port.getId());
lIf.setInterfaceName(port.getName());
lIf.setMacaddr(port.getMacAddress());
+ lIf.setNetworkName((String) port.getProfile().get("physical_network"));
+ lIf.setIsPortMirrored(false);
+ lIf.setIsIpUnnumbered(false);
+ lIf.setInMaint(false);
if (oobMgtNetIds != null && oobMgtNetIds.contains(port.getNetworkId())) {
lIf.setInterfaceRole(OOB_MGT_NETWORK_IDENTIFIER);
} else {
lIf.setInterfaceRole(port.getvNicType());
}
-
+ boolean isL2Multicast = false;
+ if (port.getProfile().get("trusted") != null) {
+ String trusted = port.getProfile().get("trusted").toString();
+ if (Boolean.parseBoolean(trusted)) {
+ isL2Multicast = true;
+ }
+ }
+ lIf.setL2Multicasting(isL2Multicast);
updateLInterfaceIps(port, lIf);
updateLInterfaceVlan(port, lIf);
@@ -278,6 +292,9 @@ public class HeatBridgeImpl implements HeatBridgeApi {
@Override
public void createPserversAndPinterfacesIfNotPresentInAai(final List<Resource> stackResources)
throws HeatBridgeException {
+ if (stackResources == null) {
+ return;
+ }
Map<String, Pserver> serverHostnames = getPserverMapping(stackResources);
createPServerIfNotExists(serverHostnames);
List<String> portIds =
@@ -294,8 +311,13 @@ public class HeatBridgeImpl implements HeatBridgeApi {
private Map<String, Pserver> getPserverMapping(final List<Resource> stackResources) {
List<Server> osServers = getAllOpenstackServers(stackResources);
Map<String, Pserver> pserverMap = new HashMap<>();
- for (Server server : osServers) {
- pserverMap.put(server.getHost(), aaiHelper.buildPserver(server));
+ if (osServers != null) {
+ for (Server server : osServers) {
+ Pserver pserver = aaiHelper.buildPserver(server);
+ if (pserver != null) {
+ pserverMap.put(server.getHost(), pserver);
+ }
+ }
}
return pserverMap;
}
@@ -316,9 +338,14 @@ public class HeatBridgeImpl implements HeatBridgeApi {
private void updateLInterfaceVlan(final Port port, final LInterface lIf) {
Vlan vlan = new Vlan();
Network network = osClient.getNetworkById(port.getNetworkId());
- lIf.setNetworkName(network.getName());
if (network.getNetworkType().equals(NetworkType.VLAN)) {
- vlan.setVlanInterface(network.getProviderSegID());
+ vlan.setVlanInterface(network.getName() + network.getProviderSegID());
+
+ vlan.setVlanIdOuter(Long.parseLong(network.getProviderSegID()));
+ vlan.setVlanIdInner(0L);
+ vlan.setInMaint(false);
+ vlan.setIsIpUnnumbered(false);
+ vlan.setIsPrivate(false);
Vlans vlans = new Vlans();
List<Vlan> vlanList = vlans.getVlan();
vlanList.add(vlan);
@@ -336,6 +363,8 @@ public class HeatBridgeImpl implements HeatBridgeApi {
if (port.getVifDetails() != null) {
sriovVf.setVfVlanFilter((String) port.getVifDetails().get(HeatBridgeConstants.OS_VLAN_NETWORK_KEY));
}
+ sriovVf.setVfVlanAntiSpoofCheck(false);
+ sriovVf.setVfMacAntiSpoofCheck(false);
sriovVfList.add(sriovVf);
lIf.setSriovVfs(sriovVfs);
@@ -417,9 +446,9 @@ public class HeatBridgeImpl implements HeatBridgeApi {
}
@Override
- public void submitToAai() throws HeatBridgeException {
+ public void submitToAai(boolean dryrun) throws HeatBridgeException {
try {
- transaction.execute();
+ transaction.execute(dryrun);
} catch (BulkProcessFailed e) {
String msg = "Failed to commit transaction";
logger.debug(msg + " with error: " + e);
@@ -435,15 +464,20 @@ public class HeatBridgeImpl implements HeatBridgeApi {
try {
Optional<VfModule> vfModule = resourcesClient.get(VfModule.class,
AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE));
+ logger.debug("vfModule is present: {}", vfModule.isPresent());
if (vfModule.isPresent()) {
- AAIResultWrapper resultWrapper = new AAIResultWrapper(vfModule);
+ AAIResultWrapper resultWrapper = new AAIResultWrapper(vfModule.get());
Optional<Relationships> relationships = resultWrapper.getRelationships();
+ logger.debug("relationships is present: {}", relationships.isPresent());
if (relationships.isPresent()) {
List<AAIResourceUri> vserverUris = relationships.get().getRelatedUris(AAIObjectType.VSERVER);
+ logger.debug("vserverList isEmpty: {}", vserverUris.isEmpty());
createTransactionToDeleteSriovPfFromPserver(vserverUris);
+
if (!vserverUris.isEmpty()) {
for (AAIResourceUri vserverUri : vserverUris) {
+ logger.debug("Deleting Vservers: {}", vserverUri.toString());
resourcesClient.delete(vserverUri);
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
index 0e87e1fb31..fdf7ce38f1 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/constants/HeatBridgeConstants.java
@@ -72,6 +72,8 @@ public class HeatBridgeConstants {
public static final String AAI_SRIOV_PF = "sriov-pf";
public static final String AAI_P_INTERFACE_NAME = "p-interface.interface-name";
public static final String AAI_SRIOV_PF_PCI_ID = "sriov-pf.pf-pci-id";
+ public static final String AAI_VNFC = "vnfc";
+ public static final String AAI_VNFC_ID = "vnfc.vnfc-name";
/**
* Keys for internal usage
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
index e1f363ca05..a9a63b312d 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java
@@ -54,6 +54,6 @@ public interface MsoCloudClientFactory {
*/
- OpenstackClient getOpenstackClient(String url, String msoId, String msoPass, String regionId, String tenantId)
- throws HeatBridgeException;
+ OpenstackClient getOpenstackClient(String url, String msoId, String msoPass, String regionId, String tenantId,
+ String keystoneVersion) throws HeatBridgeException;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
index 04245899aa..88a7d3dbbc 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java
@@ -32,8 +32,6 @@
*/
package org.onap.so.heatbridge.factory;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.Objects;
import javax.annotation.Nonnull;
import org.onap.so.heatbridge.HeatBridgeException;
@@ -44,6 +42,9 @@ import org.onap.so.heatbridge.openstack.api.OpenstackClient;
import org.onap.so.heatbridge.openstack.api.OpenstackClientException;
import org.onap.so.heatbridge.openstack.factory.OpenstackClientFactory;
import org.onap.so.utils.CryptoUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* This class implements {@link MsoCloudClientFactory} It loads the cloud configuration from SO and uses it to
@@ -52,6 +53,8 @@ import org.onap.so.utils.CryptoUtils;
*/
public class MsoCloudClientFactoryImpl implements MsoCloudClientFactory {
+ private static final Logger logger = LoggerFactory.getLogger(MsoCloudClientFactoryImpl.class);
+
private OpenstackClientFactory openstackClientFactory;
public MsoCloudClientFactoryImpl(@Nonnull OpenstackClientFactory openstackClientFactory) {
@@ -61,12 +64,14 @@ public class MsoCloudClientFactoryImpl implements MsoCloudClientFactory {
@Override
public OpenstackClient getOpenstackClient(@Nonnull String url, @Nonnull String msoId, @Nonnull String msoPass,
- @Nonnull String regionId, @Nonnull String tenantId) throws HeatBridgeException {
+ @Nonnull String regionId, @Nonnull String tenantId, @Nonnull String keystoneVersion)
+ throws HeatBridgeException {
Objects.requireNonNull(url, "Null openstack url!");
Objects.requireNonNull(msoId, "Null openstack user id!");
Objects.requireNonNull(msoPass, "Null openstack password!");
Objects.requireNonNull(regionId, "Null regionId ID!");
Objects.requireNonNull(tenantId, "Null tenant ID!");
+ Objects.requireNonNull(tenantId, "Null keystone version");
try {
final OpenstackAccess osAccess = new OpenstackAccessBuilder().setBaseUrl(url) // keystone URL
.setUser(msoId) // keystone username
@@ -77,17 +82,15 @@ public class MsoCloudClientFactoryImpl implements MsoCloudClientFactory {
.build();
// Identify the Keystone version
- String version = new URL(url).getPath().replace("/", "");
- if (version.equals(HeatBridgeConstants.OS_KEYSTONE_V2_KEY)) {
+ if (keystoneVersion.equals(HeatBridgeConstants.OS_KEYSTONE_V2_KEY)) {
return openstackClientFactory.createOpenstackV2Client(osAccess);
- } else if (version.equals(HeatBridgeConstants.OS_KEYSTONE_V3_KEY)) {
+ } else if (keystoneVersion.equals(HeatBridgeConstants.OS_KEYSTONE_V3_KEY)) {
return openstackClientFactory.createOpenstackV3Client(osAccess);
}
- throw new OpenstackClientException("Unsupported keystone version!");
- } catch (MalformedURLException e) {
- throw new HeatBridgeException("Malformed Keystone Endpoint in SO configuration.", e);
+ throw new OpenstackClientException("Unsupported keystone version! " + keystoneVersion);
} catch (OpenstackClientException osClientEx) {
- throw new HeatBridgeException("Client error when authenticating with the Openstack V3.", osClientEx);
+ logger.error("Error creating OS Client", osClientEx);
+ throw new HeatBridgeException("Client error when authenticating with the Openstack", osClientEx);
}
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
index c578b29664..6817be8c49 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
@@ -32,8 +32,6 @@
*/
package org.onap.so.heatbridge.helpers;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -41,6 +39,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
import org.onap.aai.domain.yang.Flavor;
import org.onap.aai.domain.yang.Image;
import org.onap.aai.domain.yang.PInterface;
@@ -50,9 +49,13 @@ import org.onap.aai.domain.yang.RelationshipData;
import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.SriovVf;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.heatbridge.constants.HeatBridgeConstants;
import org.openstack4j.model.compute.Server;
import org.openstack4j.model.network.Port;
+import com.google.common.base.Preconditions;
/**
* This class provides wrapper methods to manage creation of AAI objects and extracting objects from AAI and
@@ -75,32 +78,43 @@ public class AaiHelper {
List<Relationship> relationships = relationshipList.getRelationship();
// vserver to pserver relationship
- Relationship pserverRelationship =
- buildRelationship(HeatBridgeConstants.AAI_PSERVER, ImmutableMap.<String, String>builder()
- .put(HeatBridgeConstants.AAI_PSERVER_HOSTNAME, server.getHypervisorHostname()).build());
- relationships.add(pserverRelationship);
+ if (!StringUtils.isEmpty(server.getHypervisorHostname())) {
+ Relationship pserverRelationship = buildRelationship(
+ AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, server.getHypervisorHostname()));
+ relationships.add(pserverRelationship);
+ }
+
+ // vserver to generic-vnf relationship
+ Relationship genericVnfRelationship =
+ buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, genericVnfId));
+ relationships.add(genericVnfRelationship);
+
+ // vserver to vnfc relationship
+ if (!StringUtils.isEmpty(server.getName())) {
+ Relationship vnfcRelationship =
+ buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.VNFC, server.getName()));
+ relationships.add(vnfcRelationship);
+ }
// vserver to vf-module relationship
- Relationship vfModuleRelationship = buildRelationship(HeatBridgeConstants.AAI_VF_MODULE,
- ImmutableMap.<String, String>builder().put(HeatBridgeConstants.AAI_GENERIC_VNF_ID, genericVnfId)
- .put(HeatBridgeConstants.AAI_VF_MODULE_ID, vfModuleId).build());
+ Relationship vfModuleRelationship =
+ buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, genericVnfId, vfModuleId));
relationships.add(vfModuleRelationship);
// vserver to image relationship
if (server.getImage() != null) {
- Relationship imageRel = buildRelationship(HeatBridgeConstants.AAI_IMAGE,
- ImmutableMap.<String, String>builder().put(HeatBridgeConstants.AAI_CLOUD_OWNER, cloudOwner)
- .put(HeatBridgeConstants.AAI_CLOUD_REGION_ID, cloudRegionId)
- .put(HeatBridgeConstants.AAI_IMAGE_ID, server.getImage().getId()).build());
+ Relationship imageRel = buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.IMAGE, cloudOwner,
+ cloudRegionId, server.getImage().getId()));
relationships.add(imageRel);
}
// vserver to flavor relationship
- Relationship flavorRel = buildRelationship(HeatBridgeConstants.AAI_FLAVOR,
- ImmutableMap.<String, String>builder().put(HeatBridgeConstants.AAI_CLOUD_OWNER, cloudOwner)
- .put(HeatBridgeConstants.AAI_CLOUD_REGION_ID, cloudRegionId)
- .put(HeatBridgeConstants.AAI_FLAVOR_ID, server.getFlavor().getId()).build());
- relationships.add(flavorRel);
+ if (server.getFlavor() != null) {
+ Relationship flavorRel = buildRelationship(AAIUriFactory.createResourceUri(AAIObjectType.FLAVOR, cloudOwner,
+ cloudRegionId, server.getFlavor().getId()));
+ relationships.add(flavorRel);
+ }
+
return relationshipList;
}
@@ -110,10 +124,8 @@ public class AaiHelper {
List<Relationship> relationships = relationshipList.getRelationship();
// sriov-vf to sriov-pf relationship
- Relationship sriovPfRelationship = buildRelationship(HeatBridgeConstants.AAI_SRIOV_PF,
- ImmutableMap.<String, String>builder().put(HeatBridgeConstants.AAI_PSERVER_HOSTNAME, pserverName)
- .put(HeatBridgeConstants.AAI_P_INTERFACE_NAME, pIfName)
- .put(HeatBridgeConstants.AAI_SRIOV_PF_PCI_ID, pfPciId).build());
+ Relationship sriovPfRelationship = buildRelationship(
+ AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_PF, pserverName, pIfName, pfPciId));
relationships.add(sriovPfRelationship);
return relationshipList;
@@ -146,12 +158,18 @@ public class AaiHelper {
* @return AAI Pserver object
*/
public Pserver buildPserver(final Server server) {
+ if (server == null || server.getHypervisorHostname() == null) {
+ return null;
+ }
Pserver pserver = new Pserver();
pserver.setInMaint(false);
- pserver.setPserverId(server.getId());
pserver.setHostname(server.getHypervisorHostname());
- pserver.setPserverName2(server.getHost());
- pserver.setProvStatus(server.getStatus().value());
+ if (server.getId() != null) {
+ pserver.setPserverId(server.getId());
+ }
+ if (server.getHost() != null) {
+ pserver.setPserverName2(server.getHost());
+ }
return pserver;
}
@@ -182,8 +200,13 @@ public class AaiHelper {
aaiImage.setImageName(image.getName());
aaiImage.setImageOsDistro(HeatBridgeConstants.OS_UNKNOWN_KEY);
aaiImage.setImageOsVersion(HeatBridgeConstants.OS_UNKNOWN_KEY);
- image.getLinks().stream().filter(link -> link.getRel().equals(HeatBridgeConstants.OS_RESOURCES_SELF_LINK_KEY))
- .findFirst().ifPresent(link -> aaiImage.setImageSelflink(link.getHref()));
+
+ // application name/vendor/version needs to be set
+ if (image.getLinks() != null) {
+ image.getLinks().stream()
+ .filter(link -> link.getRel().equals(HeatBridgeConstants.OS_RESOURCES_SELF_LINK_KEY)).findFirst()
+ .ifPresent(link -> aaiImage.setImageSelflink(link.getHref()));
+ }
return aaiImage;
}
@@ -197,6 +220,13 @@ public class AaiHelper {
Flavor aaiFlavor = new Flavor();
aaiFlavor.setFlavorId(flavor.getId());
aaiFlavor.setFlavorName(flavor.getName());
+ aaiFlavor.setFlavorVcpus(flavor.getVcpus());
+ aaiFlavor.setFlavorRam(flavor.getRam());
+ aaiFlavor.setFlavorDisk(flavor.getDisk());
+ aaiFlavor.setFlavorEphemeral(flavor.getEphemeral());
+ aaiFlavor.setFlavorDisabled(flavor.isDisabled());
+ aaiFlavor.setFlavorIsPublic(flavor.isPublic());
+ aaiFlavor.setFlavorSwap(Integer.toString(flavor.getSwap()));
flavor.getLinks().stream().filter(link -> link.getRel().equals(HeatBridgeConstants.OS_RESOURCES_SELF_LINK_KEY))
.findFirst().ifPresent(link -> aaiFlavor.setFlavorSelflink(link.getHref()));
return aaiFlavor;
@@ -301,15 +331,9 @@ public class AaiHelper {
* @param relationshipKeyValues Key value pairs of relationship data
* @return AAI Relationship object
*/
- private Relationship buildRelationship(final String relatedTo, final Map<String, String> relationshipKeyValues) {
+ private Relationship buildRelationship(final AAIResourceUri relatedLink) {
Relationship relationship = new Relationship();
- relationship.setRelatedTo(relatedTo);
- relationshipKeyValues.keySet().forEach(k -> {
- RelationshipData relationshipData = new RelationshipData();
- relationshipData.setRelationshipKey(k);
- relationshipData.setRelationshipValue(relationshipKeyValues.get(k));
- relationship.getRelationshipData().add(relationshipData);
- });
+ relationship.setRelatedLink(relatedLink.build().toString());
return relationship;
}
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java
index 5bafe2b1d6..d8e1e2a9a9 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java
@@ -49,7 +49,6 @@ public class BeansTest {
@Test
public void pojoStructure() {
- test("org.onap.so.adapters.network.async.client");
test("org.onap.so.adapters.vnf.async.client");
test("org.onap.so.adapters.network");
test("org.onap.so.adapters.vnf");
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
index 2df56ede10..76bc8d2456 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
@@ -17,10 +17,10 @@ import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.CloudRegion;
-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.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.catalog.data.repository.NetworkTechnologyReferenceRepository;
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 284067a766..88c6992a0a 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
@@ -63,86 +63,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
public static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0";
-
- @Test
- public void createNetworkByModelNameNeutronModeGetNetworkException() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenstackGet(wireMockServer, "/mockPublicUrl/v2.0/networks", HttpStatus.SC_INTERNAL_SERVER_ERROR);
-
- String uri = "/services/NetworkAdapter";
- headers.set("X-ECOMP-RequestID", "123456789456127");
- ResponseEntity<String> response =
- sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST);
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void createNetworkByModelNameNeutronModeCreateNetworkException() throws IOException {
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackGetNeutronNetwork_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc");
-
- mockOpenStackGetAllNeutronNetworks_404(wireMockServer);
-
- mockOpenstackPost(wireMockServer, "/mockPublicUrl/v2.0/networks", HttpStatus.SC_INTERNAL_SERVER_ERROR);
-
- String uri = "/services/NetworkAdapter";
- headers.set("X-ECOMP-RequestID", "123456789456127");
- ResponseEntity<String> response =
- sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST);
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void createNetworkByModelNameNeutronMode() throws IOException {
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackGetNeutronNetwork_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc");
-
- mockOpenStackGetAllNeutronNetworks_404(wireMockServer);
-
- mockOpenStackPostNeutronNetwork_200(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json");
-
- String uri = "/services/NetworkAdapter";
- headers.set("X-ECOMP-RequestID", "123456789456127");
- ResponseEntity<String> response =
- sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void createNetworkByModelNameAlreadyExistNeutronMode() throws IOException {
-
- mockUpdateRequestDb(wireMockServer, "9733c8d1-2668-4e5f-8b51-2cacc9b662c0");
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackGetAllNeutronNetworks_200(wireMockServer, "OpenstackGetNeutronNetworks.json");
-
- String uri = "/services/NetworkAdapter";
- headers.set("X-ECOMP-RequestID", "123456789456127");
- ResponseEntity<String> response =
- sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void createNetworkByModelNameAlreadyExistNeutronModeFailIfExistTrue() throws IOException {
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackGetAllNeutronNetworks_200(wireMockServer, "OpenstackGetNeutronNetworks.json");
-
- String uri = "/services/NetworkAdapter";
- headers.set("X-ECOMP-RequestID", "123456789456127");
- ResponseEntity<String> response =
- sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode_Fail_If_Exist_True.xml"), uri, HttpMethod.POST);
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- }
-
@Test
public void createNetworkByModelNameHeatMode() throws IOException {
@@ -300,61 +220,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
}
-
- @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);
-
- mockOpenStackDeleteNeutronNetwork(wireMockServer, NETWORK_ID, HttpStatus.SC_OK);
-
- String uri = "/services/NetworkAdapter";
- headers.set("X-ECOMP-RequestID", "123456789456127");
- ResponseEntity<String> response =
- sendXMLRequest(inputStream("/DeleteNetwork.xml").replace("CONTRAIL30_BASIC", "CONTRAIL31_GNDIRECT"),
- uri, HttpMethod.POST);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void deleteNetworkNeutronModeDeleteStackException() throws IOException {
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", NETWORK_ID, HttpStatus.SC_OK);
-
- mockOpenStackDeleteNeutronNetwork(wireMockServer, NETWORK_ID, HttpStatus.SC_INTERNAL_SERVER_ERROR);
-
- // mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_ID);
-
- String uri = "/services/NetworkAdapter";
- headers.set("X-ECOMP-RequestID", "123456789456127");
- ResponseEntity<String> response =
- sendXMLRequest(inputStream("/DeleteNetwork.xml").replace("CONTRAIL30_BASIC", "CONTRAIL31_GNDIRECT"),
- uri, HttpMethod.POST);
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void updateNetworkNeutronModeSuccess() throws IOException {
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", NETWORK_ID, HttpStatus.SC_OK);
- mockOpenStackPutNeutronNetwork_200(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json", NETWORK_ID);
-
- String uri = "/services/NetworkAdapter";
- headers.set("X-ECOMP-RequestID", "123456789456127");
- ResponseEntity<String> response =
- sendXMLRequest(inputStream("/UpdateNetwork.xml").replace("CONTRAIL30_BASIC", "CONTRAIL31_GNDIRECT"),
- uri, HttpMethod.POST);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
@Test
public void updateNetworkNeutronUpdateException() throws IOException {
@@ -487,21 +352,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
}
- @Test
- public void queryNetworkNeutronModeException() throws IOException {
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackGetNeutronNetwork(wireMockServer, NETWORK_ID, HttpStatus.SC_INTERNAL_SERVER_ERROR);
-
- String uri = "/services/NetworkAdapter";
- headers.set("X-ECOMP-RequestID", "123456789456127");
- ResponseEntity<String> response =
- sendXMLRequest(inputStream("/QueryNetwork.xml").replace("CONTRAIL30_BASIC", "CONTRAIL31_GNDIRECT"), uri,
- HttpMethod.POST);
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- }
-
public ResponseEntity<String> sendXMLRequest(String requestJson, String uriPath, HttpMethod reqMethod) {
headers.set("Accept", MediaType.APPLICATION_XML);
headers.set("Content-Type", MediaType.APPLICATION_XML);
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
deleted file mode 100644
index 00961a16b9..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 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.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;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreatedVUSP_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreated_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackDeleteOrUpdateComplete_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostStacks_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccessQueryNetwork;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import org.apache.http.HttpStatus;
-import org.junit.Test;
-import org.onap.so.adapters.vnf.BaseRestTestUtils;
-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
- MsoNetworkAdapterAsyncImpl impl;
-
- @Test
- public void healthCheckATest() {
- MsoNetworkAdapterAsyncImpl mNAAimpl = new MsoNetworkAdapterAsyncImpl();
- mNAAimpl.healthCheckA();
- }
-
- @Test
- public void rollbackNetworkATest() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl"))
- .withRequestBody(containing("<completed>true</completed>"))
- .willReturn(aResponse().withBody(
- "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n"
- + " <soapenv:Header/>\n" + " <soapenv:Body>\n"
- + " <net:rollbackNetworkNotificationResponse>\n"
- + " </net:rollbackNetworkNotificationResponse>\n" + " </soapenv:Body>\n"
- + "</soapenv:Envelope>")
- .withStatus(HttpStatus.SC_OK)));
- NetworkRollback nrb = getNetworkRollback("mtn13");
- impl.rollbackNetworkA(nrb, "messageId", "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void rollbackNetworkATest_NotifyException() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- wireMockServer.stubFor(
- post(urlPathEqualTo("/notificationUrl")).withRequestBody(containing("<completed>true</completed>"))
- .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND)));
- NetworkRollback nrb = getNetworkRollback("mtn13");
- impl.rollbackNetworkA(nrb, "messageId", "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- private NetworkRollback getNetworkRollback(String cloudId) {
- NetworkRollback nrb = new NetworkRollback();
- nrb.setCloudId(cloudId);
- nrb.setMsoRequest(new MsoRequest());
- nrb.setModelCustomizationUuid("3bdbb104-476c-483e-9f8b-c095b3d3068c");
- nrb.setNetworkCreated(true);
- nrb.setNetworkId("networkId");
- nrb.setNetworkName("networkName");
- nrb.setNetworkStackId("networkStackId");
- nrb.setNetworkType("networkType");
- nrb.setNeutronNetworkId("neutronNetworkId");
- nrb.setPhysicalNetwork("physicalNetwork");
- nrb.setTenantId("tenantId");
- nrb.setVlans(new ArrayList<>());
- return nrb;
- }
-
- @Test
- public void rollbackNetworkATestNetworkException() {
- NetworkRollback nrb = getNetworkRollback("cloudId");
-
- impl.rollbackNetworkA(nrb, "messageId", "http://localhost");
- }
-
- @Test
- public void noRollbackNetworkATest() {
- impl.rollbackNetworkA(null, "messageId", "http://localhost");
- }
-
-
- @Test
- public void deleteNetworkATest() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl"))
- .withRequestBody(containing("<completed>true</completed>"))
- .willReturn(aResponse().withBody(
- "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n"
- + " <soapenv:Header/>\n" + " <soapenv:Body>\n"
- + " <net:deleteNetworkNotificationResponse>\n"
- + " </net:deleteNetworkNotificationResponse>\n" + " </soapenv:Body>\n"
- + "</soapenv:Envelope>")
- .withStatus(HttpStatus.SC_OK)));
- impl.deleteNetworkA("mtn13", "tenantId", "networkType", "modelCustomizationUuid", "networkId", "messageId",
- new MsoRequest(), "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void deleteNetworkATest_NotifyException() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- wireMockServer.stubFor(
- post(urlPathEqualTo("/notificationUrl")).withRequestBody(containing("<completed>true</completed>"))
- .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND)));
- impl.deleteNetworkA("mtn13", "tenantId", "networkType", "modelCustomizationUuid", "networkId", "messageId",
- new MsoRequest(), "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void deleteNetworkATest_NetworkException() {
- impl.deleteNetworkA("cloudSiteId", "tenantId", "networkType", "modelCustomizationUuid", "networkId",
- "messageId", new MsoRequest(), "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void updateNetworkATest() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json",
- "dvspg-VCE_VPE-mtjnj40avbc");
- mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_UpdateComplete.json");
- mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(wireMockServer);
- wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl"))
- .withRequestBody(containing("updateNetworkNotification"))
- .willReturn(aResponse().withBody(
- "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n"
- + " <soapenv:Header/>\n" + " <soapenv:Body>\n"
- + " <net:updateNetworkNotificationResponse>\n"
- + " </net:updateNetworkNotificationResponse>\n" + " </soapenv:Body>\n"
- + "</soapenv:Envelope>")
- .withStatus(HttpStatus.SC_OK)));
- HashMap<String, String> networkParams = new HashMap<String, String>();
- networkParams.put("shared", "true");
- networkParams.put("external", "false");
- impl.updateNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c",
- "dvspg-VCE_VPE-mtjnj40avbc", "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(),
- new ArrayList<Subnet>(), networkParams, "messageId", new MsoRequest(),
- "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void updateNetworkATest_NotifyExcpetion() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json",
- "dvspg-VCE_VPE-mtjnj40avbc");
- mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_UpdateComplete.json");
- mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(wireMockServer);
- HashMap<String, String> networkParams = new HashMap<String, String>();
- networkParams.put("shared", "true");
- networkParams.put("external", "false");
- impl.updateNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c",
- "dvspg-VCE_VPE-mtjnj40avbc", "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(),
- new ArrayList<>(), networkParams, "messageId", new MsoRequest(),
- "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void updateNetworkATest_NetworkException() {
- impl.updateNetworkA("cloudSiteId", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c",
- "networkId", "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(),
- new HashMap<String, String>(), "messageId", new MsoRequest(),
- "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void queryNetworkATest() throws IOException {
- mockOpenStackResponseAccessQueryNetwork(wireMockServer, wireMockPort);
- impl.queryNetworkA("mtn13", "tenantId", "networkId", "messageId", new MsoRequest(),
- "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void createNetworkATest() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl"))
- .withRequestBody(containing("createNetworkNotification"))
- .willReturn(aResponse().withBody(
- "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n"
- + " <soapenv:Header/>\n" + " <soapenv:Body>\n"
- + " <net:createNetworkNotificationResponse>\n"
- + " </net:createNetworkNotificationResponse>\n" + " </soapenv:Body>\n"
- + "</soapenv:Envelope>")
- .withStatus(HttpStatus.SC_OK)));
- mockOpenStackGetStackCreatedVUSP_200(wireMockServer);
- mockOpenStackPostStacks_200(wireMockServer);
- mockOpenStackPostStacks_200(wireMockServer);
- HashMap<String, String> networkParams = new HashMap<String, String>();
- impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c",
- "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", "physicalNetworkName", new ArrayList<>(), false,
- false, new ArrayList<>(), networkParams, "messageId", new MsoRequest(),
- "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void createNetworkATest_NotifyException() throws IOException {
- wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl"))
- .withStatus(HttpStatus.SC_OK)));
- mockOpenStackGetStackCreatedVUSP_200(wireMockServer);
- mockOpenStackPostStacks_200(wireMockServer);
- HashMap<String, String> networkParams = new HashMap<String, String>();
- networkParams.put("shared", "true");
- networkParams.put("external", "false");
- impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c",
- "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", "physicalNetworkName", new ArrayList<>(), false,
- false, new ArrayList<>(), networkParams, "messageId", new MsoRequest(),
- "http://localhost:" + wireMockPort + "/notificationUrl");
- }
-
- @Test
- public void createNetworkATest_NetworkException() {
- impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c",
- "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", "physicalNetworkName", new ArrayList<>(), false,
- 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/network/NetworkAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
deleted file mode 100644
index 412abeab3b..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.network;
-
-import static com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.junit.Assert.assertEquals;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeletePublicUrlStackByNameAndID_204;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetPublicUrlStackByNameAndID_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetPublicUrlStackByNameAndID_204;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackAppC_404;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreatedAppC_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreatedVUSP_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVUSP_404;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostPublicUrlWithBodyFile_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPublicUrlStackByID_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPublicUrlStackByName_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutPublicUrlStackByNameAndID_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import org.json.JSONException;
-import org.junit.Test;
-import org.onap.so.adapters.nwrest.CreateNetworkRequest;
-import org.onap.so.adapters.nwrest.CreateNetworkResponse;
-import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
-import org.onap.so.adapters.nwrest.DeleteNetworkResponse;
-import org.onap.so.adapters.nwrest.QueryNetworkError;
-import org.onap.so.adapters.nwrest.QueryNetworkResponse;
-import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
-import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
-import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
-import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
-import org.onap.so.adapters.vnf.BaseRestTestUtils;
-import org.onap.so.client.policy.JettisonStyleMapperProvider;
-import org.onap.so.entity.MsoRequest;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-
-public class NetworkAdapterRestTest extends BaseRestTestUtils {
-
- @Autowired
- private JettisonStyleMapperProvider jettisonTypeObjectMapper;
- private static final String CLOUDSITE_ID = "mtn13";
- private static final String TENANT_ID = "ba38bc24a2ef4fb2ad2810c894f1938f";
- private static final String NETWORK_ID = "da886914-efb2-4917-b335-c8381528d90b";
- private static final String NETWORK_TYPE = "CONTRAIL30_BASIC";
- private static final String MODEL_CUSTOMIZATION_UUID = "3bdbb104-476c-483e-9f8b-c095b3d308ac";
- private static final String MSO_SERVICE_INSTANCE_ID = "05869d5f-47df-4b45-bbfc-4f03ce0a50bf";
- private static final String MSO_REQUEST_ID = "requestId";
- private static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0";
-
- @Test
- public void testCreateNetwork() throws JSONException, JsonParseException, JsonMappingException, IOException {
-
- CreateNetworkRequest request = new CreateNetworkRequest();
- request.setBackout(true);
- request.setSkipAAI(true);
- request.setFailIfExists(false);
- MsoRequest msoReq = new MsoRequest();
- String networkTechnology = "CONTRAIL";
-
- msoReq.setRequestId(MSO_REQUEST_ID);
- msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
- request.setMsoRequest(msoReq);
- request.setCloudSiteId(CLOUDSITE_ID);
- request.setTenantId(TENANT_ID);
- request.setNetworkId(NETWORK_ID);
- request.setNetworkName(NETWORK_NAME);
- request.setNetworkType(NETWORK_TYPE);
- request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
- request.setNetworkTechnology(networkTechnology);
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer);
-
- mockOpenStackGetStackCreatedVUSP_200(wireMockServer);
-
- mockOpenStackGetStackVUSP_404(wireMockServer);
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
- HttpEntity<CreateNetworkRequest> entity = new HttpEntity<CreateNetworkRequest>(request, headers);
- ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class);
-
- CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/CreateNetworkResponse.json"), CreateNetworkResponse.class);
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- }
-
- @Test
- public void testCreateNetwork_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException {
-
-
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer);
-
- mockOpenStackGetStackCreatedAppC_200(wireMockServer);
-
- mockOpenStackGetStackAppC_404(wireMockServer);
-
- headers.add("Content-Type", MediaType.APPLICATION_JSON);
- headers.add("Accept", MediaType.APPLICATION_JSON);
-
- String request = readJsonFileAsString("src/test/resources/CreateNetwork.json");
- HttpEntity<String> entity = new HttpEntity<String>(request, headers);
-
- ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class);
-
- CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/CreateNetworkResponse2.json"), CreateNetworkResponse.class);
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- }
-
-
-
- @Test
- public void testDeleteNetwork() throws IOException {
-
- DeleteNetworkRequest request = new DeleteNetworkRequest();
-
- MsoRequest msoReq = new MsoRequest();
-
- msoReq.setRequestId(MSO_REQUEST_ID);
- msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
- request.setMsoRequest(msoReq);
- request.setCloudSiteId(CLOUDSITE_ID);
- request.setTenantId(TENANT_ID);
- request.setNetworkId(NETWORK_ID);
- request.setNetworkType(NETWORK_TYPE);
- request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
- request.setNetworkStackId(NETWORK_ID);
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort);
-
- mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockServer, wireMockPort);
-
- mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer);
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
-
- HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(request, headers);
-
- ResponseEntity<DeleteNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.DELETE,
- entity, DeleteNetworkResponse.class);
-
- DeleteNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/DeleteNetworkResponse.json"), DeleteNetworkResponse.class);
-
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
-
- }
-
- @Test
- public void testRollbackNetwork() throws IOException {
-
- RollbackNetworkRequest request = new RollbackNetworkRequest();
- MsoRequest msoReq = new MsoRequest();
- msoReq.setRequestId(MSO_REQUEST_ID);
- msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort);
-
- mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockServer, wireMockPort);
-
- mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer);
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
-
- HttpEntity<RollbackNetworkRequest> entity = new HttpEntity<>(request, headers);
-
- ResponseEntity<RollbackNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b/rollback"),
- HttpMethod.DELETE, entity, RollbackNetworkResponse.class);
-
- RollbackNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/RollbackNetworkResponse.json"), RollbackNetworkResponse.class);
-
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
-
- }
-
- @Test
- public void testQueryNetwork_Exception() throws IOException {
- MsoRequest msoReq = new MsoRequest();
- msoReq.setRequestId(MSO_REQUEST_ID);
- msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
- headers.add("Accept", MediaType.APPLICATION_JSON);
-
- HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(headers);
-
- ResponseEntity<QueryNetworkError> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.GET,
- entity, QueryNetworkError.class);
-
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
-
- }
-
- @Test
- public void testQueryNetwork() throws IOException {
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackVfModule_200(wireMockServer);
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
- HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(headers);
-
- ResponseEntity<QueryNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b" + "?cloudSiteId="
- + CLOUDSITE_ID + "&tenantId=" + TENANT_ID + "&aaiNetworkId=aaiNetworkId"),
- HttpMethod.GET, entity, QueryNetworkResponse.class);
-
- assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
-
- }
-
- @Test
- public void testUpdateNetwork() throws IOException {
-
- UpdateNetworkRequest request = new UpdateNetworkRequest();
-
- MsoRequest msoReq = new MsoRequest();
-
- msoReq.setRequestId(MSO_REQUEST_ID);
- msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
- request.setMsoRequest(msoReq);
- request.setCloudSiteId(CLOUDSITE_ID);
- request.setTenantId(TENANT_ID);
- request.setNetworkId(NETWORK_ID);
- request.setNetworkName(NETWORK_NAME);
- request.setNetworkType(NETWORK_TYPE);
- request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
- request.setNetworkStackId(NETWORK_ID);
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackPublicUrlStackByName_200(wireMockServer, wireMockPort);
-
- mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort);
-
- mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockServer, wireMockPort);
-
- mockOpenStackPutPublicUrlStackByNameAndID_200(wireMockServer);
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
-
- HttpEntity<UpdateNetworkRequest> entity = new HttpEntity<UpdateNetworkRequest>(request, headers);
-
- ResponseEntity<UpdateNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.PUT,
- entity, UpdateNetworkResponse.class);
-
- UpdateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/UpdateNetworkResponse.json"), UpdateNetworkResponse.class);
-
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testCreateNetworkCNRC_JSON()
- throws JSONException, JsonParseException, JsonMappingException, IOException {
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer);
-
- mockOpenStackGetStackCreatedAppC_200(wireMockServer);
-
- mockOpenStackGetStackAppC_404(wireMockServer);
-
- headers.add("Content-Type", MediaType.APPLICATION_JSON);
- headers.add("Accept", MediaType.APPLICATION_JSON);
-
- String request = readJsonFileAsString("src/test/resources/CreateNetwork3.json");
- HttpEntity<String> entity = new HttpEntity<String>(request, headers);
-
- ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class);
-
- CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/CreateNetworkResponse3.json"), CreateNetworkResponse.class);
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- }
-
- @Test
- public void testCreateNetworkNC_Shared_JSON()
- throws JSONException, JsonParseException, JsonMappingException, IOException {
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer);
-
- mockOpenStackGetStackCreatedAppC_200(wireMockServer);
-
- mockOpenStackGetStackAppC_404(wireMockServer);
-
- headers.add("Content-Type", MediaType.APPLICATION_JSON);
- headers.add("Accept", MediaType.APPLICATION_JSON);
-
- String request = readJsonFileAsString("src/test/resources/CreateNetwork4.json");
- HttpEntity<String> entity = new HttpEntity<String>(request, headers);
-
- ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class);
-
- CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/CreateNetworkResponse4.json"), CreateNetworkResponse.class);
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- }
-
- @Override
- protected String readJsonFileAsString(String fileLocation)
- throws JsonParseException, JsonMappingException, IOException {
- return new String(Files.readAllBytes(Paths.get(fileLocation)));
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
index d5f8f865a8..fd36995f3d 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
@@ -15,7 +15,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.adapters.tasks.audit.AuditDataService;
import org.onap.so.audit.beans.AuditInventory;
-import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.db.request.beans.RequestProcessingData;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.objects.audit.AAIObjectAudit;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
index af4afd41a1..e70b56dfc5 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditVServerTest.java
@@ -41,13 +41,12 @@ import org.onap.aai.domain.yang.LInterfaces;
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.adapters.tasks.audit.AuditVServer;
-import org.onap.so.client.aai.AAIObjectPlurals;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.aai.AAIObjectPlurals;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.skyscreamer.jsonassert.JSONAssert;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java
index e822f65072..1b7b5ff9a1 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventoryTest.java
@@ -20,30 +20,17 @@
package org.onap.so.adapters.tasks.inventory;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
import java.io.File;
import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
import org.camunda.bpm.client.task.ExternalTask;
-import org.hamcrest.Matchers;
import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.onap.so.adapters.tasks.inventory.CreateAAIInventory;
import org.onap.so.audit.beans.AuditInventory;
-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.aaiclient.client.aai.AAIResourcesClient;
import org.onap.so.objects.audit.AAIObjectAuditList;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
@@ -86,38 +73,4 @@ public class CreateAAIInventoryTest extends CreateAAIInventory {
doReturn(auditInventory).when(mockExternalTask).getVariable("auditInventory");
}
- @Test
- public void determineAuditResult_Test() throws Exception {
- boolean actual = createAAIInventory.didAuditFailVserverLInterfaces(auditListSuccess);
- assertEquals(false, actual);
- }
-
- @Test
- public void determineAuditResult_Failure_Test() throws Exception {
- boolean actual = createAAIInventory.didAuditFailVserverLInterfaces(auditListFailure);
- assertEquals(true, actual);
- }
-
- @Test
- public void missing_Sub_Interfaces_Test() throws Exception {
- AAIResourceUri aaiURI2 = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, "cloudOwner",
- "regionOne", "0422ffb57ba042c0800a29dc85ca70f8", "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
- "tsbc0005v_tsbc0005vm002_svc1_port_0", "tsbc0005v_tsbc0005vm002_subint_untrusted_svc1_81");
- AAIResourceUri aaiURI1 = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, "cloudOwner",
- "regionOne", "0422ffb57ba042c0800a29dc85ca70f8", "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
- "tsbc0005v_tsbc0005vm002_svc2_port_0", "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_103");
- ArgumentCaptor<Optional> captor = ArgumentCaptor.forClass(Optional.class);
- ArgumentCaptor<AAIResourceUri> uriCaptor = ArgumentCaptor.forClass(AAIResourceUri.class);
-
- createAAIInventory.setAaiClient(mockClient);
- createAAIInventory.createInventory(missingSubInterfaces);
- Mockito.verify(mockClient, times(2)).createIfNotExists(uriCaptor.capture(), captor.capture());
-
- List<AAIResourceUri> capturedURI = uriCaptor.getAllValues();
- assertTrue(capturedURI.stream().anyMatch(item -> aaiURI1.build().toString().equals(item.build().toString())));
- assertTrue(capturedURI.stream().anyMatch(item -> aaiURI2.build().toString().equals(item.build().toString())));
-
-
-
- }
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java
index fc2baefcd5..12c42877fd 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/inventory/CreateInventoryTaskTest.java
@@ -33,7 +33,7 @@ import org.mockito.MockitoAnnotations;
import org.onap.so.adapters.tasks.inventory.CreateAAIInventory;
import org.onap.so.adapters.tasks.inventory.CreateInventoryTask;
import org.onap.so.adapters.tasks.inventory.InventoryException;
-import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
@@ -76,7 +76,6 @@ public class CreateInventoryTaskTest {
object.getAuditList().add(e);
GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
doReturn(objectMapper.getMapper().writeValueAsString(e)).when(externalTask).getVariable("auditInventoryResult");
- Mockito.doThrow(InventoryException.class).when(createAAIInventory).createInventory(Mockito.any());
inventoryTask.executeExternalTask(externalTask, externalTaskService);
Mockito.verify(externalTaskService, times(1)).handleBpmnError(externalTask, "AAIInventoryFailure");
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java
index b5b0f5a8ef..8d5ab8234e 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java
@@ -44,7 +44,7 @@ public class PollServiceTest {
String xmlString =
new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
- Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(xmlString);
+ Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(xmlString);
Mockito.when(mockExternalTask.getVariable("PollRollbackStatus")).thenReturn(false);
Mockito.when(mockExternalTask.getVariable("stackId")).thenReturn("stackId/stack123");
Mockito.when(msoHeatUtils.pollStackForStatus(eq(1), any(Stack.class), eq("CREATE_IN_PROGRESS"), eq("regionOne"),
@@ -64,7 +64,7 @@ public class PollServiceTest {
String xmlString =
new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
- Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(xmlString);
+ Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(xmlString);
Mockito.when(mockExternalTask.getVariable("PollRollbackStatus")).thenReturn(true);
Mockito.when(mockExternalTask.getVariable("stackId")).thenReturn("stackId/stack123");
Mockito.when(msoHeatUtils.pollStackForStatus(eq(1), any(), eq("DELETE_IN_PROGRESS"), eq("regionOne"),
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java
index f7613909ec..1f68106f78 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java
@@ -65,7 +65,7 @@ public class RollbackServiceTest {
Stack stack = new Stack();
stack.setId("heatId");
- Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(payload);
+ Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(payload);
Mockito.doNothing().when(vnfAdapterImpl).deleteVfModule(Mockito.any(), Mockito.any(), Mockito.any(),
Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
Mockito.doNothing().when(mockExternalTaskService).complete(Mockito.any(), Mockito.any());
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
index 2f583b30a2..cc2dfa213e 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
@@ -64,7 +64,7 @@ public class StackServiceTest {
Stack stack = new Stack();
stack.setId("heatId");
- Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(payload);
+ Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(payload);
Mockito.doNothing().when(vnfAdapterImpl).createVfModule(Mockito.any(), Mockito.any(), Mockito.any(),
Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(),
Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(),
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java
index 6e3312b1d3..106a96a091 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java
@@ -16,6 +16,7 @@
package org.onap.so.adapters.tenant.exceptions;
import org.junit.Test;
+import static org.junit.Assert.*;
public class TenantAlreadyExistsTest {
@@ -23,5 +24,6 @@ public class TenantAlreadyExistsTest {
public void test() {
TenantAlreadyExists tar = new TenantAlreadyExists("name", "cloudId", "tenantId");
assert (tar != null);
+ assertNotNull(tar);
}
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java
index 7314a9f1e2..ece92b4ac0 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java
@@ -19,6 +19,7 @@ import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
+import static org.junit.Assert.*;
public class TenantExceptionBeanTest {
@@ -38,5 +39,6 @@ public class TenantExceptionBeanTest {
teb.setCategory(MsoExceptionCategory.USERDATA);
assert (teb.getMessage().equals("message"));
assert (teb.getCategory() != null);
+ assertNotNull(teb);
}
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java
index 83eb1f1bdc..1ce4c664ac 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java
@@ -19,6 +19,7 @@ import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
+import static org.junit.Assert.*;
public class TenantExceptionTest {
@@ -40,5 +41,6 @@ public class TenantExceptionTest {
te.setFaultInfo(teb);
assert (te.getFaultInfo() != null);
assert (te.getFaultInfo().equals(teb));
+ assertNotNull(teb);
}
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java
index 46d9f89303..1a308b7c4c 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -30,13 +30,11 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
import java.util.HashMap;
-import java.util.Map;
import org.apache.http.HttpStatus;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.openstack.beans.VnfRollback;
import org.springframework.beans.factory.annotation.Autowired;
public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
@@ -86,48 +84,6 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
}
@Test
- public void updateVnfTest() throws Exception {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, Object> map = new HashMap<>();
- map.put("key1", "value1");
- wireMockServer.stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))
- .withRequestBody(containing("messageId")).willReturn(aResponse().withStatus(HttpStatus.SC_OK)));
- String notificationUrl =
- "http://localhost:" + wireMockPort + "/notify/adapterNotify/updateVnfNotificationRequest";
- instance.updateVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", map, "messageId", msoRequest, notificationUrl);
- }
-
- @Test
- public void updateVnfTest_Exception() throws Exception {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, Object> map = new HashMap<>();
- map.put("key1", "value1");
- wireMockServer.stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))
- .withRequestBody(containing("messageId")).willReturn(aResponse().withStatus(HttpStatus.SC_OK)));
- String notificationUrl =
- "http://localhost:" + wireMockPort + "/notify/adapterNotify/updateVnfNotificationRequest";
- instance.updateVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", map, "messageId", msoRequest, notificationUrl);
- wireMockServer.verify(1, postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")));
- }
-
- @Test
- public void queryVnfTest() {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- instance.queryVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest,
- "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest");
- }
-
- @Test
public void deleteVnfTest() {
MsoRequest msoRequest = new MsoRequest();
msoRequest.setRequestId("12345");
@@ -136,14 +92,4 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
msoRequest, "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest");
}
- @Test
- public void rollbackVnfTest() {
- VnfRollback vnfRollBack = new VnfRollback();
- vnfRollBack.setCloudSiteId("mdt1");
- vnfRollBack.setCloudOwner("CloudOwner");
- vnfRollBack.setTenantId("88a6ca3ee0394ade9403f075db23167e");
- vnfRollBack.setVnfId("ff5256d1-5a33-55df-13ab-12abad84e7ff");
- instance.rollbackVnfA(vnfRollBack, "messageId",
- "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest");
- }
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
deleted file mode 100644
index 45504fcab5..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.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.urlMatching;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static org.junit.Assert.assertTrue;
-import java.util.HashMap;
-import java.util.Map;
-import javax.xml.ws.Holder;
-import org.apache.http.HttpStatus;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-import org.onap.so.cloud.CloudConfig;
-import org.onap.so.db.catalog.beans.CloudifyManager;
-import org.onap.so.entity.MsoRequest;
-import org.onap.so.openstack.beans.VnfRollback;
-import org.springframework.beans.factory.annotation.Autowired;
-
-public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- @Autowired
- private MsoVnfCloudifyAdapterImpl instance;
-
- @Autowired
- private CloudConfig cloudConfig;
-
- @Before
- public void before() throws Exception {
- super.setUp();
- CloudifyManager cloudifyManager = new CloudifyManager();
- cloudifyManager.setId("mtn13");
- cloudifyManager.setCloudifyUrl("http://localhost:" + wireMockPort + "/v2.0");
- cloudifyManager.setUsername("m93945");
- cloudifyManager.setPassword("93937EA01B94A10A49279D4572B48369");
- }
-
- /*
- * @Test public void queryVnfExceptionTest() throws Exception { MsoRequest msoRequest = new MsoRequest();
- * msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); Holder<Map<String, String>> outputs =
- * new Holder<>(); instance.queryVnf("siteid", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new
- * Holder<>(), new Holder<>(), outputs);
- *
- * assertTrue(outputs.value.isEmpty()); }
- */
-
- /*
- * @Test public void queryVnfTest() throws Exception {
- *
- *
- * MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345");
- * msoRequest.setServiceInstanceId("12345");
- * wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname"))
- * .willReturn(aResponse().withBody("{ \"id\": \"123\" }").withStatus(HttpStatus.SC_OK)));
- *
- * wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs"))
- * .willReturn(aResponse().withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
- * .withStatus(HttpStatus.SC_OK)));
- *
- * wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
- * .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
- * .withStatus(HttpStatus.SC_OK)));
- *
- * instance.queryVnf("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(), new
- * Holder<>(), new Holder<>());
- *
- * }
- */
-
- @Test
- public void deleteVfModuleTest_ExceptionWhileQueryDeployment() throws Exception {
- expectedException.expect(VnfException.class);
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- instance.deleteVfModule("mtn13", "CloudOwner", "1234", "vfname", "5aae1e49-805c-4f9f-bd78-055bf7451157",
- "11420693-3f69-4c61-b3ee-9787c744e760", "customizationId", msoRequest, new Holder<>());
- }
-
- @Test
- public void deleteVfModuleTest_ExceptionWhileDeleteDeployment() throws Exception {
- expectedException.expect(VnfException.class);
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname"))
- .willReturn(aResponse().withBody("{ \"id\": \"123\" }").withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs"))
- .willReturn(aResponse().withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
- .withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
- .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
- .withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens"))
- .willReturn(aResponse().withBodyFile("OpenstackResponse_Access.json").withStatus(HttpStatus.SC_OK)));
-
- instance.deleteVfModule("mtn13", "CloudOwner", "1234", "vfname", "5aae1e49-805c-4f9f-bd78-055bf7451157",
- "11420693-3f69-4c61-b3ee-9787c744e760", "customizationId", msoRequest, new Holder<>());
- }
-
- @Test
- public void deleteVnfVnfExceptionTest() throws Exception {
- expectedException.expect(VnfException.class);
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- instance.deleteVnf("12344", "CloudOwner", "234", "vnfname", msoRequest);
-
- }
-
- @Test
- public void rollbackVnf() throws Exception {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- VnfRollback vnfRollback = new VnfRollback();
- vnfRollback.setModelCustomizationUuid("1234");
- vnfRollback.setVfModuleStackId("2134");
- vnfRollback.setVnfId("123");
- vnfRollback.setModelCustomizationUuid("1234");
-
- instance.rollbackVnf(vnfRollback);
- }
-
- @Test
- public void rollbackVnf_Created() throws Exception {
- expectedException.expect(VnfException.class);
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- VnfRollback vnfRollback = new VnfRollback();
- vnfRollback.setModelCustomizationUuid("1234");
- vnfRollback.setVfModuleStackId("2134");
- vnfRollback.setVnfId("123");
- vnfRollback.setModelCustomizationUuid("1234");
- vnfRollback.setVnfCreated(true);
-
- instance.rollbackVnf(vnfRollback);
- }
-
- @Test
- public void createVfModuleVnfException() throws Exception {
- expectedException.expect(VnfException.class);
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- instance.createVfModule("123", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234",
- "123", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
- }
-
- @Test
- public void createVfModule_ModelCustUuidIsNull() throws Exception {
- expectedException.expect(VnfException.class);
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- instance.createVfModule("123", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234",
- null, new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
- }
-
- @Test
- public void createVfModule_CloudSiteIdNotFound() throws Exception {
- expectedException.expect(VnfException.class);
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- instance.createVfModule("123", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234",
- "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(),
- new Holder<>(), new Holder<>());
- }
-
- @Test
- public void createVfModule_MsoCloudifyManagerNotFound() throws Exception {
- expectedException.expect(VnfException.class);
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- instance.createVfModule("mtn13", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234",
- "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(),
- new Holder<>(), new Holder<>());
- }
-
- @Test
- public void createVfModule() throws Exception {
- expectedException.expect(VnfException.class);
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname"))
- .willReturn(aResponse().withBody("{ \"id\": \"123\" }").withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs"))
- .willReturn(aResponse().withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
- .withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
- .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
- .withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens"))
- .willReturn(aResponse().withBodyFile("OpenstackResponse_Access.json").withStatus(HttpStatus.SC_OK)));
-
- instance.createVfModule("mtn13", "CloudOwner", "123", "vf", "v1", "", "vfname", "", "create", "3245", "234",
- "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(),
- new Holder<>(), new Holder<>());
- }
-
- @Test
- public void updateVfModuleVnfException() throws Exception {
- expectedException.expect(VnfException.class);
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- instance.updateVfModule("123", "CloudOwner", "1234", "fw", "v2", "vnf1", "create", "123", "12", "233", "234",
- new HashMap<>(), msoRequest, new Holder<>(), new Holder<>());
- }
-
- @Test
- public void healthCheckVNFTest() {
- instance.healthCheck();
- }
-
- @Test
- public void createVnfTest() {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, Object> map = new HashMap<>();
- map.put("key1", "value1");
- try {
- instance.createVnf("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", map, Boolean.FALSE, Boolean.TRUE, Boolean.TRUE, msoRequest,
- new Holder<>(), new Holder<>(), new Holder<>());
- } catch (Exception e) {
- }
- }
-
- @Test
- public void updateVnfTest() {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- Map<String, Object> map = new HashMap<>();
-
- map.put("key1", "value1");
- try {
- instance.updateVnf("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
- "volumeGroupHeatStackId|1", map, msoRequest, new Holder<>(), new Holder<>());
- } catch (Exception e) {
-
- }
- }
-
- @Test
- public void deleteVnfTest() {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- try {
- instance.deleteVnf("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest);
- } catch (Exception e) {
-
- }
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java
deleted file mode 100644
index 3bf784c50b..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF 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.vnf;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import java.util.HashMap;
-import java.util.Map;
-import javax.xml.ws.Holder;
-import org.apache.http.HttpStatus;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onap.so.adapters.vdu.VduModelInfo;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-import org.onap.so.cloud.CloudConfig;
-import org.onap.so.entity.MsoRequest;
-import org.onap.so.openstack.beans.StackInfo;
-import org.onap.so.openstack.exceptions.MsoException;
-import org.springframework.beans.factory.annotation.Autowired;
-
-public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils {
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- @Autowired
- private MsoVnfPluginAdapterImpl instance;
-
- @Autowired
- private CloudConfig cloudConfig;
-
- private static final String UPDATE_STACK_RESPONSE =
- "{\"template_type\": \"heat\", \"workload_id\": " + "\"workload-id\"}";
- private static final String GET_CREATE_STACK_RESPONSE = "{\"template_type\": \"heat\", \"workload_id\": "
- + "\"workload-id\", \"workload_status\": \"CREATE_COMPLETE\"}";
- private static final String GET_UPDATE_STACK_RESPONSE = "{\"template_type\": \"heat\", \"workload_id\": "
- + "\"workload-id\", \"workload_status\": \"UPDATE_COMPLETE\"}";
-
- private static final String MULTICLOUD_CREATE_PATH = "/api/multicloud/v1/CloudOwner/MTN13/infra_workload";
- private static final String MULTICLOUD_UPDATE_PATH =
- "/api/multicloud/v1/CloudOwner/MTN13/infra_workload/workload-id";
- private static final String MULTICLOUD_GET_PATH_BY_NAME =
- "/api/multicloud/v1/CloudOwner/MTN13/infra_workload/vfname";
- private static final String MULTICLOUD_GET_PATH_BY_ID =
- "/api/multicloud/v1/CloudOwner/MTN13/infra_workload/workload-id";
-
- @Before
- public void before() throws Exception {
- super.orchestrator = "multicloud";
- super.cloudEndpoint = "/api/multicloud/v1/CloudOwner/MTN13/infra_workload";
- super.setUp();
- }
-
- @Test
- public void createVfModule() throws Exception {
-
- Map<String, Object> stackInputs = new HashMap<>();
- stackInputs.put("oof_directives", "{}");
- stackInputs.put("sdnc_directives", "{}");
- stackInputs.put("user_directives", "{}");
- stackInputs.put("generic_vnf_id", "genVNFID");
- stackInputs.put("vf_module_id", "vfMODULEID");
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH_BY_NAME)).willReturn(
- aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND)));
-
- wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH_BY_ID)).inScenario("CREATE")
- .whenScenarioStateIs("CREATING").willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(GET_CREATE_STACK_RESPONSE).withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH_BY_ID)).inScenario("CREATE")
- .whenScenarioStateIs("UPDATING").willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(GET_UPDATE_STACK_RESPONSE).withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)).inScenario("CREATE")
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("MulticloudResponse_Stack_Create.json").withStatus(HttpStatus.SC_CREATED))
- .willSetStateTo("CREATING"));
-
- wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_UPDATE_PATH))
- .inScenario("CREATE").willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(UPDATE_STACK_RESPONSE).withStatus(HttpStatus.SC_ACCEPTED))
- .willSetStateTo("UPDATING"));
-
- try {
- instance.createVfModule("MTN13", "CloudOwner", "123", "vf", "v1", "genericVnfId", "vfname", "vfModuleId",
- "create", null, "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", stackInputs, true, true, true,
- msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
- } catch (VnfException e) {
- fail("createVfModule success expected, failed with exception: " + e.toString());
- }
- wireMockServer.resetScenarios();
- }
-
- @Test
- public void createVfModule2() throws Exception {
-
- Map<String, Object> stackInputs = new HashMap<>();
- stackInputs.put("oof_directives", "{}");
- stackInputs.put("sdnc_directives", "{}");
- stackInputs.put("user_directives", "{}");
- stackInputs.put("generic_vnf_id", "genVNFID");
- stackInputs.put("vf_module_id", "vfMODULEID");
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH_BY_NAME)).willReturn(
- aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND)));
-
- wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH_BY_ID)).inScenario("CREATE")
- .whenScenarioStateIs("CREATING").willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(GET_CREATE_STACK_RESPONSE).withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH_BY_ID)).inScenario("CREATE")
- .whenScenarioStateIs("UPDATING").willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(GET_UPDATE_STACK_RESPONSE).withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)).inScenario("CREATE")
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("MulticloudResponse_Stack_Create2.json").withStatus(HttpStatus.SC_CREATED))
- .willSetStateTo("CREATING"));
-
- wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_UPDATE_PATH))
- .inScenario("CREATE").willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBody(UPDATE_STACK_RESPONSE).withStatus(HttpStatus.SC_ACCEPTED))
- .willSetStateTo("UPDATING"));
-
- try {
- instance.createVfModule("MTN13", "CloudOwner", "123", "vf", "v1", "genericVnfId", "vfname", "vfModuleId",
- "create", null, "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", stackInputs, true, true, true,
- msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
- } catch (VnfException e) {
- fail("createVfModule success expected, failed with exception: " + e.toString());
- }
- wireMockServer.resetScenarios();
- }
-
- @Test
- public void createVfModuleAlreadyExists() throws Exception {
-
- Map<String, Object> stackInputs = new HashMap<>();
- stackInputs.put("oof_directives", "{}");
- stackInputs.put("sdnc_directives", "{}");
- stackInputs.put("user_directives", "{}");
- stackInputs.put("generic_vnf_id", "genVNFID");
- stackInputs.put("vf_module_id", "vfMODULEID");
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- wireMockServer.stubFor(
- get(urlEqualTo("/api/multicloud/v1/CloudOwner/MTN13/infra_workload?name=vfname")).willReturn(aResponse()
- // .withHeader()
- .withBodyFile("MulticloudGetStackExists.json").withStatus(HttpStatus.SC_OK)));
-
- try {
- instance.createVfModule("MTN13", "CloudOwner", "123", "vf", "v1", "genericVnfId", "vfname", "vfModuleId",
- "create", null, "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", stackInputs, true, true, true,
- msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
- } catch (VnfException e) {
- assertTrue(e.toString().contains(
- "Resource vfname already exists in owner/cloud/tenant CloudOwner/MTN13/123 with ID vfname/vfname"));
- return;
- }
- fail("VnfAlreadyExists Exception expected!");
- }
-
- @Test
- public void deleteVfModule() throws Exception {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/CloudOwner/MTN13/infra_workload/workload-id"))
- .willReturn(aResponse().withBodyFile("MulticloudResponse_Stack.json").withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(delete(urlPathEqualTo("/api/multicloud/v1/CloudOwner/MTN13/infra_workload/workload-id"))
- .willReturn(aResponse().withStatus(HttpStatus.SC_NO_CONTENT)));
-
- instance.deleteVfModule("MTN13", "CloudOwner", "123", "workload-id", "5aae1e49-805c-4f9f-bd78-055bf7451157",
- "11420693-3f69-4c61-b3ee-9787c744e760", "customizationId", msoRequest, new Holder<>());
- }
-
- @Test
- public void queryVfModule() throws Exception {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
-
- wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/CloudOwner/MTN13/infra_workload/workload-id"))
- .willReturn(aResponse().withBodyFile("MulticloudResponse_Stack.json").withStatus(HttpStatus.SC_OK)));
-
- instance.queryVnf("MTN13", "CloudOwner", "123", "workload-id", msoRequest, new Holder<>(), new Holder<>(),
- new Holder<>(), new Holder<>());
- }
-
- // TODO Error Tests
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
deleted file mode 100644
index a68efbe130..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.vnf;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
-import java.util.HashMap;
-import java.util.Map;
-import javax.xml.ws.Holder;
-import org.apache.http.HttpStatus;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-import org.onap.so.entity.MsoRequest;
-import org.onap.so.openstack.beans.VnfRollback;
-import org.springframework.beans.factory.annotation.Autowired;
-
-public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- @Autowired
- MsoVnfPluginAdapterImpl msoVnfPluginAdapter;
-
- String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId";
-
- @Test
- public void createVfModule_ModelCustUuidIsNull() throws Exception {
- expectedException.expect(VnfException.class);
- MsoRequest msoRequest = getMsoRequest();
- Map<String, Object> map = new HashMap<>();
- map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "",
- vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", null, map, Boolean.FALSE,
- Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
- new Holder<VnfRollback>());
- }
-
- @Test
- public void createVfModule_ModelCustUuidIsNotFound() throws Exception {
- expectedException.expect(VnfException.class);
- MsoRequest msoRequest = getMsoRequest();
- Map<String, Object> map = new HashMap<>();
- map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "",
- vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId",
- "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest,
- new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>());
- }
-
- @Test
- public void createVfModule_VduException() throws Exception {
- expectedException.expect(VnfException.class);
- MsoRequest msoRequest = getMsoRequest();
- Map<String, Object> map = new HashMap<>();
- map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "",
- vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId",
- "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest,
- new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>());
- }
-
- @Test
- public void createVfModule_INSTANTIATED() throws Exception {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackVfModule_200(wireMockServer);
-
- MsoRequest msoRequest = getMsoRequest();
- Map<String, Object> map = new HashMap<>();
- map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "",
- vnfName, "", "VFMOD", null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map,
- Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(),
- new Holder<Map<String, String>>(), new Holder<VnfRollback>());
- }
-
- @Test
- public void createVfModule_queryVduNotFoundWithVolumeGroupId() throws Exception {
- expectedException.expect(VnfException.class);
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- MsoRequest msoRequest = getMsoRequest();
- Map<String, Object> map = new HashMap<>();
- map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "",
- vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId",
- "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest,
- new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>());
- }
-
- @Test
- public void createVfModule_CreateVduException() throws Exception {
- expectedException.expect(VnfException.class);
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackVfModule_404(wireMockServer);
- wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
- MsoRequest msoRequest = getMsoRequest();
- Map<String, Object> map = new HashMap<>();
- map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "",
- vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId",
- "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest,
- new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>());
- }
-
- @Test
- public void deleteVfModule_QueryVduException() throws Exception {
- expectedException.expect(VnfException.class);
- MsoRequest msoRequest = getMsoRequest();
- msoVnfPluginAdapter.deleteVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12",
- "5aae1e49-805c-4f9f-bd78-055bf7451157", "11420693-3f69-4c61-b3ee-9787c744e760", "customizationId",
- msoRequest, new Holder<Map<String, String>>());
- }
-
- @Test
- public void deleteVfModule_DeleteVduException() throws Exception {
- expectedException.expect(VnfException.class);
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackVfModule_200(wireMockServer);
- wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vSAMP12"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
- wireMockServer.stubFor(delete(
- urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
- MsoRequest msoRequest = getMsoRequest();
- msoVnfPluginAdapter.deleteVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12",
- "5aae1e49-805c-4f9f-bd78-055bf7451157", "11420693-3f69-4c61-b3ee-9787c744e760", "customizationId",
- msoRequest, new Holder<Map<String, String>>());
- }
-
- private MsoRequest getMsoRequest() {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- return msoRequest;
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java
deleted file mode 100644
index 7e7c130e33..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.vnf;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.Matchers.hasProperty;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-import java.util.Map;
-import javax.xml.ws.Holder;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-import org.onap.so.openstack.beans.HeatStatus;
-import org.onap.so.openstack.beans.StackInfo;
-import org.onap.so.openstack.beans.VnfStatus;
-import org.onap.so.openstack.exceptions.MsoException;
-import org.onap.so.openstack.exceptions.MsoOpenstackException;
-import org.onap.so.openstack.utils.MsoHeatUtils;
-
-@RunWith(MockitoJUnitRunner.class)
-public class QueryTest {
-
- @Mock
- private MsoHeatUtils heat;
- @InjectMocks
- private MsoVnfAdapterImpl vnfAdapter = new MsoVnfAdapterImpl();
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void testQueryCreatedVnf() throws VnfException, MsoException {
- StackInfo info = new StackInfo("stackName", HeatStatus.CREATED);
- when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info);
- String cloudId = "MT";
- String cloudOwner = "CloudOwner";
- String tenantId = "MSO_Test";
- String vnfName = "VNF_TEST1";
- Holder<Boolean> vnfExists = new Holder<>();
- Holder<String> vnfId = new Holder<>();
- Holder<VnfStatus> status = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
-
- vnfAdapter.queryVnf(cloudId, cloudOwner, tenantId, vnfName, null, vnfExists, vnfId, status, outputs);
-
- assertTrue(vnfExists.value);
- }
-
- @Test
- public void testQueryNotFoundVnf() throws VnfException, MsoException {
- StackInfo info = new StackInfo("stackName", HeatStatus.NOTFOUND);
- when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info);
- String cloudId = "MT";
- String cloudOwner = "CloudOwner";
- String tenantId = "MSO_Test";
- String vnfName = "VNF_TEST1";
- Holder<Boolean> vnfExists = new Holder<>();
- Holder<String> vnfId = new Holder<>();
- Holder<VnfStatus> status = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
-
- vnfAdapter.queryVnf(cloudId, cloudOwner, tenantId, vnfName, null, vnfExists, vnfId, status, outputs);
-
- assertFalse(vnfExists.value);
- }
-
- @Test()
- // @Ignore // 1802 merge
- public void testQueryVnfWithException() throws VnfException, MsoException {
- String cloudId = "MT";
- String cloudOwner = "CloudOwner";
- String tenantId = "MSO_Test";
- String vnfName = "VNF_TEST1";
- Holder<Boolean> vnfExists = new Holder<>();
- Holder<String> vnfId = new Holder<>();
- Holder<VnfStatus> status = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
- thrown.expect(VnfException.class);
- thrown.expectCause(hasProperty("context", is("QueryVNF")));
- when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any()))
- .thenThrow(new MsoOpenstackException(1, "test messsage", "test detail"));
- vnfAdapter.queryVnf(cloudId, cloudOwner, tenantId, vnfName, null, vnfExists, vnfId, status, outputs);
- }
-}
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
deleted file mode 100644
index 9655e90e46..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java
+++ /dev/null
@@ -1,557 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.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;
-import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
-import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
-import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
-import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse;
-import org.onap.so.adapters.vnfrest.QueryVfModuleResponse;
-import org.onap.so.adapters.vnfrest.RollbackVfModuleRequest;
-import org.onap.so.adapters.vnfrest.RollbackVfModuleResponse;
-import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest;
-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.client.policy.JettisonStyleMapperProvider;
-import org.onap.so.entity.MsoRequest;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-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;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeletePublicUrlStackByNameAndID_204;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteStacks;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetPublicUrlStackByNameAndID_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksBaseStack_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksStackId_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksStackId_404;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksVUSP_404;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksVfModuleWithLocationHeader_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksVfModule_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksWithBody_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksWithBody_404;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacks_404;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostStacks_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStacks_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
-
-public class VnfAdapterRestTest extends BaseRestTestUtils {
-
-
- @Autowired
- private JettisonStyleMapperProvider jettisonTypeObjectMapper;
- private static final String MESSAGE_ID = "62265093-277d-4388-9ba6-449838ade586-1517252396874";
- private static final String AAI_VNF_ID = "c93e0d34-5b63-45de-bbae-b0fe49dd3bd9";
- private static final String MSO_REQUEST_ID = "62265093-277d-4388-9ba6-449838ade586";
- private static final String MSO_SERVICE_INSTANCE_ID = "4147e06f-1b89-49c5-b21f-4faf8dc9805a";
- private static final String CLOUDSITE_ID = "mtn13";
- private static final String CLOUD_OWNER = "CloudOwner";
- private static final String TENANT_ID = "0422ffb57ba042c0800a29dc85ca70f8";
- private static final String VNF_TYPE = "MSOTADevInfra_vSAMP10a_Service/vSAMP10a 1";
- private static final String VNF_NAME = "MSO-DEV-VNF-1802-it3-pwt3-vSAMP10a-1XXX-Replace";
- private static final String VNF_VERSION = "1.0";
- private static final String VF_MODULE_ID = "1d48aaec-b7f3-4c24-ba4a-4e798ed3223c";
- private static final String VF_MODULE_NAME = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001";
- private static final String VF_MODULE_TYPE = "vSAMP10aDEV::PCM::module-2";
- private static final String MODEL_CUSTOMIZATION_UUID = "cb82ffd8-252a-11e7-93ae-92361f002671";
- private static final String BASE_VF_MODULE_ID = "3d7ff7b4-720b-4604-be0a-1974fc58ed96";
- // vfModuleParams specific variables
- private static final String NETWORK_NAME = "Dev-vSAMP10a-ntwk-1802-pwt3-v6-Replace-1001";
- private static final String SERVER_NAME = "Dev-vSAMP10a-addon2-1802-pwt3-v6-Replace-1001";
- private static final String IMAGE = "ubuntu_14.04_IPv6";
- private static final String EXN_DIRECT_NET_FQDN = "direct";
- private static final String EXN_HSL_NET_FQDN = "hsl";
- private static final String AVAILABILITY_ZONE_0 = "nova";
- private static final String VF_MODULE_INDEX = "0";
-
- @Test
- public void testCreateVfModule() throws JSONException, JsonParseException, JsonMappingException, IOException {
-
- CreateVfModuleRequest request = populateCreateVfModuleRequest();
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackGetStackVfModule_404(wireMockServer);
-
- mockOpenStackPostStacks_200(wireMockServer);
-
- mockOpenStackGetStackVfModule_200(wireMockServer);
-
- mockUpdateRequestDb(wireMockServer, "62265093-277d-4388-9ba6-449838ade586");
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
- HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers);
-
- ResponseEntity<CreateVfModuleResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"),
- HttpMethod.POST, entity, CreateVfModuleResponse.class);
-
- ResponseEntity<CreateVfModuleResponse> responseV2 =
- restTemplate.exchange(createURLWithPort("/services/rest/v2/vnfs/" + AAI_VNF_ID + "/vf-modules"),
- HttpMethod.POST, entity, CreateVfModuleResponse.class);
-
- CreateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/CreateVfModuleResponse.json"), CreateVfModuleResponse.class);
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
-
- assertEquals(Response.Status.OK.getStatusCode(), responseV2.getStatusCode().value());
- assertThat(responseV2.getBody(), sameBeanAs(expectedResponse));
- }
-
- @Test
- public void testCreateVfModuleAsyncCall() throws Exception {
- CreateVfModuleRequest request = populateCreateVfModuleRequest();
- request.setNotificationUrl(createURLWithPort("/mso/WorkflowMesssage"));
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStackVfModule_404(wireMockServer);
- mockOpenStackPostStacks_200(wireMockServer);
- mockOpenStackGetStackVfModule_200(wireMockServer);
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
- HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers);
-
- ResponseEntity<CreateVfModuleResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"),
- HttpMethod.POST, entity, CreateVfModuleResponse.class);
-
- CreateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/CreateVfModuleResponse.json"), CreateVfModuleResponse.class);
-
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testCreateVfModuleWithEnableBridgeNull()
- throws JSONException, JsonParseException, JsonMappingException, IOException {
-
- CreateVfModuleRequest request = new CreateVfModuleRequest();
- request.setBackout(true);
- request.setSkipAAI(true);
- request.setFailIfExists(false);
- MsoRequest msoReq = new MsoRequest();
- boolean failIfExists = true;
- Boolean enableBridge = null;
- Map<String, Object> vfModuleParams = new HashMap<>();
-
-
- vfModuleParams.put("vf_module_id", VF_MODULE_ID);
- vfModuleParams.put("vnf_id", AAI_VNF_ID);
- vfModuleParams.put("network_name", NETWORK_NAME);
- vfModuleParams.put("vnf_name", VNF_NAME);
- vfModuleParams.put("environment_context", "");
- vfModuleParams.put("server_name", SERVER_NAME);
- vfModuleParams.put("image", IMAGE);
- vfModuleParams.put("workload_context", "");
- vfModuleParams.put("vf_module_index", VF_MODULE_INDEX);
- vfModuleParams.put("vf_module_name", VF_MODULE_NAME);
- vfModuleParams.put("availability_zone_0", AVAILABILITY_ZONE_0);
- vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN);
- vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN);
-
- msoReq.setRequestId(MSO_REQUEST_ID);
- msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
- request.setMsoRequest(msoReq);
- request.setCloudSiteId(CLOUDSITE_ID);
- request.setTenantId(TENANT_ID);
- request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
- request.setVnfId(AAI_VNF_ID);
- request.setVnfVersion(VNF_VERSION);
- request.setVfModuleId(VF_MODULE_ID);
- request.setVfModuleName(VF_MODULE_NAME);
- request.setBaseVfModuleId(BASE_VF_MODULE_ID);
- request.setFailIfExists(failIfExists);
- request.setEnableBridge(enableBridge);
- request.setVfModuleParams(vfModuleParams);
- request.setMessageId(MESSAGE_ID);
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackGetStackVfModule_404(wireMockServer);
-
- mockOpenStackPostStacks_200(wireMockServer);
-
- mockOpenStackGetStackVfModule_200(wireMockServer);
-
- mockUpdateRequestDb(wireMockServer, "62265093-277d-4388-9ba6-449838ade586");
-
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
- HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers);
-
- ResponseEntity<CreateVfModuleResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"),
- HttpMethod.POST, entity, CreateVfModuleResponse.class);
-
- CreateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/CreateVfModuleResponse.json"), CreateVfModuleResponse.class);
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- }
-
- @Test
- public void testCreateVfModuleFail() throws IOException {
-
- CreateVfModuleRequest request = new CreateVfModuleRequest();
- request.setBackout(true);
- request.setSkipAAI(true);
- request.setFailIfExists(false);
- MsoRequest msoReq = new MsoRequest();
- boolean failIfExists = true;
- boolean enableBridge = false;
- Map<String, Object> vfModuleParams = new HashMap<>();
-
- vfModuleParams.put("vf_module_id", VF_MODULE_ID);
- vfModuleParams.put("vnf_id", AAI_VNF_ID);
- vfModuleParams.put("network_name", NETWORK_NAME);
- vfModuleParams.put("vnf_name", VNF_NAME);
- vfModuleParams.put("environment_context", "");
- vfModuleParams.put("server_name", SERVER_NAME);
- vfModuleParams.put("image", IMAGE);
- vfModuleParams.put("workload_context", "");
- vfModuleParams.put("vf_module_index", VF_MODULE_INDEX);
- vfModuleParams.put("vf_module_name", VF_MODULE_NAME);
- vfModuleParams.put("availability_zone_0", AVAILABILITY_ZONE_0);
- vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN);
- vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN);
-
- msoReq.setRequestId(MSO_REQUEST_ID);
- msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
- request.setMsoRequest(msoReq);
- request.setCloudSiteId(CLOUDSITE_ID);
- request.setTenantId(TENANT_ID);
- request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
- request.setVnfId(AAI_VNF_ID);
- request.setVnfType(VNF_TYPE);
- request.setVnfVersion(VNF_VERSION);
- request.setVfModuleId(VF_MODULE_ID);
- request.setVfModuleName(VF_MODULE_NAME);
- request.setVfModuleType(VF_MODULE_TYPE);
- request.setBaseVfModuleStackId(BASE_VF_MODULE_ID);
- request.setFailIfExists(failIfExists);
- request.setEnableBridge(enableBridge);
- request.setVfModuleParams(vfModuleParams);
- request.setMessageId(MESSAGE_ID);
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackGetStackVfModule_404(wireMockServer);
-
- mockOpenStackGetStacks_404(wireMockServer);
-
- mockOpenStackPostStacks_200(wireMockServer);
-
- mockOpenStackGetStackVfModule_200(wireMockServer);
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
- HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers);
-
- ResponseEntity<VfModuleExceptionResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"),
- HttpMethod.POST, entity, VfModuleExceptionResponse.class);
-
- assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
-
- mockOpenStackGetStacksWithBody_200(wireMockServer, "DELETE_IN_PROGRESS");
-
- response = restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"),
- HttpMethod.POST, entity, VfModuleExceptionResponse.class);
-
- assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
-
- mockOpenStackGetStacksWithBody_200(wireMockServer, "DELETE_FAILED");
-
- response = restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"),
- HttpMethod.POST, entity, VfModuleExceptionResponse.class);
-
- assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
-
- mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE");
-
- response = restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"),
- HttpMethod.POST, entity, VfModuleExceptionResponse.class);
-
- assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
-
- mockOpenStackGetStacksWithBody_404(wireMockServer);
-
- response = restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"),
- HttpMethod.POST, entity, VfModuleExceptionResponse.class);
-
- assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
-
- }
-
- @Test
- public void testDeleteVfModule() throws IOException {
-
- DeleteVfModuleRequest request = new DeleteVfModuleRequest();
- MsoRequest msoRequest = new MsoRequest();
- String vfModuleStackId = "stackId";
-
- msoRequest.setRequestId(MSO_REQUEST_ID);
- msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
- request.setCloudSiteId(CLOUDSITE_ID);
- request.setTenantId(TENANT_ID);
- request.setVfModuleId(VF_MODULE_ID);
- request.setVfModuleStackId(vfModuleStackId);
- request.setVnfId(AAI_VNF_ID);
- request.setMsoRequest(msoRequest);
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackPostStacks_200(wireMockServer);
-
- mockOpenStackGetStacksStackId_404(wireMockServer);
-
- mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockServer, wireMockPort);
-
- mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer);
-
- mockUpdateRequestDb(wireMockServer, "62265093-277d-4388-9ba6-449838ade586");
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
- HttpEntity<DeleteVfModuleRequest> entity = new HttpEntity<DeleteVfModuleRequest>(request, headers);
-
- ResponseEntity<DeleteVfModuleResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID),
- HttpMethod.DELETE, entity, DeleteVfModuleResponse.class);
-
- ResponseEntity<DeleteVfModuleResponse> responseV2 = restTemplate.exchange(
- createURLWithPort("/services/rest/v2/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID),
- HttpMethod.DELETE, entity, DeleteVfModuleResponse.class);
-
-
- DeleteVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/DeleteVfModuleResponse.json"), DeleteVfModuleResponse.class);
-
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
-
- assertEquals(Response.Status.OK.getStatusCode(), responseV2.getStatusCode().value());
- assertThat(responseV2.getBody(), sameBeanAs(expectedResponse));
- }
-
- @Test
- public void testUpdateVfModule() throws IOException {
-
- UpdateVfModuleRequest request = new UpdateVfModuleRequest();
- MsoRequest msoRequest = new MsoRequest();
- String vfModuleStackId = "vfModuleStackId";
- Boolean failIfExists = false;
- Boolean backout = false;
- msoRequest.setRequestId(MSO_REQUEST_ID);
- msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
-
- Map<String, Object> vfModuleParams = new HashMap<>();
-
- vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN);
- vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN);
-
- Map<String, String> vfModuleOutputs = new HashMap<String, String>();
-
- vfModuleOutputs.put("output name", "output value");
-
- request.setBackout(backout);
- request.setCloudSiteId(CLOUDSITE_ID);
- request.setFailIfExists(failIfExists);
- request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
- request.setMsoRequest(msoRequest);
- request.setTenantId(TENANT_ID);
- request.setVfModuleId(VF_MODULE_ID);
- request.setVfModuleName(VF_MODULE_NAME);
- request.setVfModuleStackId(vfModuleStackId);
- request.setBackout(backout);
- request.setVfModuleParams(vfModuleParams);
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackGetStacksVfModuleWithLocationHeader_200(wireMockServer, wireMockPort);
-
- mockOpenStackGetStacksVfModule_200(wireMockServer, wireMockPort);
-
- mockOpenStackGetStacksBaseStack_200(wireMockServer, wireMockPort);
-
- mockOpenStackPutStacks_200(wireMockServer);
-
- UpdateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/UpdateVfModuleResponse.json"), UpdateVfModuleResponse.class);
- expectedResponse.setVfModuleOutputs(vfModuleOutputs);
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
- HttpEntity<UpdateVfModuleRequest> entity = new HttpEntity<UpdateVfModuleRequest>(request, headers);
-
- ResponseEntity<UpdateVfModuleResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_TYPE),
- HttpMethod.PUT, entity, UpdateVfModuleResponse.class);
-
- ResponseEntity<UpdateVfModuleResponse> responseV2 = restTemplate.exchange(
- createURLWithPort("/services/rest/v2/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_TYPE),
- HttpMethod.PUT, entity, UpdateVfModuleResponse.class);
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
-
- assertEquals(Response.Status.OK.getStatusCode(), responseV2.getStatusCode().value());
- assertThat(responseV2.getBody(), sameBeanAs(expectedResponse));
-
- }
-
- @Test
- public void testRollbackVfModule() throws IOException {
-
-
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId(MSO_REQUEST_ID);
- msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
-
- VfModuleRollback vfModuleRollback = new VfModuleRollback(AAI_VNF_ID, VF_MODULE_ID, "StackId", false, TENANT_ID,
- CLOUD_OWNER, CLOUDSITE_ID, msoRequest, "messageId");
-
- RollbackVfModuleRequest request = new RollbackVfModuleRequest();
- request.setVfModuleRollback(vfModuleRollback);
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- mockOpenStackGetStacksStackId_200(wireMockServer, wireMockPort);
-
- mockOpenStackDeleteStacks(wireMockServer);
-
- mockOpenStackGetStacksVUSP_404(wireMockServer);
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
- HttpEntity<RollbackVfModuleRequest> entity = new HttpEntity<RollbackVfModuleRequest>(request, headers);
-
- ResponseEntity<RollbackVfModuleResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID + "/rollback"),
- HttpMethod.DELETE, entity, RollbackVfModuleResponse.class);
-
- RollbackVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/RollbackVfModuleResponse.json"), RollbackVfModuleResponse.class);
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
-
- }
-
- @Ignore
- @Test
- public void testQueryVfModule() throws IOException {
-
- String testUrl = createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID);
- String testUri = UriBuilder.fromPath("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID)
- .host("localhost").port(wireMockPort).scheme("http")
- // .queryParam("cloudSiteId", CLOUDSITE_ID).queryParam("tenantId", TENANT_ID)
- .build().toString();
- System.out.println(testUri);
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
-
- headers.add("Accept", MediaType.APPLICATION_JSON);
- // HttpEntity entity = new HttpEntity(null, headers);
- ResponseEntity<QueryVfModuleResponse> response =
- restTemplate.getForEntity(testUri, QueryVfModuleResponse.class);
- // System.out.println(response);
-
- QueryVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue(
- new File("src/test/resources/__files/QueryVfModuleResponse.json"), QueryVfModuleResponse.class);
-
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- assertThat(response.getBody(), sameBeanAs(expectedResponse));
- }
-
- private CreateVfModuleRequest populateCreateVfModuleRequest() {
- CreateVfModuleRequest request = new CreateVfModuleRequest();
- request.setBackout(true);
- request.setSkipAAI(true);
- request.setFailIfExists(false);
- MsoRequest msoReq = new MsoRequest();
- boolean failIfExists = true;
- boolean enableBridge = false;
- Map<String, Object> vfModuleParams = new HashMap<>();
-
- vfModuleParams.put("vf_module_id", VF_MODULE_ID);
- vfModuleParams.put("vnf_id", AAI_VNF_ID);
- vfModuleParams.put("network_name", NETWORK_NAME);
- vfModuleParams.put("vnf_name", VNF_NAME);
- vfModuleParams.put("environment_context", "");
- vfModuleParams.put("server_name", SERVER_NAME);
- vfModuleParams.put("image", IMAGE);
- vfModuleParams.put("workload_context", "");
- vfModuleParams.put("vf_module_index", VF_MODULE_INDEX);
- vfModuleParams.put("vf_module_name", VF_MODULE_NAME);
- vfModuleParams.put("availability_zone_0", AVAILABILITY_ZONE_0);
- vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN);
- vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN);
-
- msoReq.setRequestId(MSO_REQUEST_ID);
- msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
- request.setMsoRequest(msoReq);
- request.setCloudSiteId(CLOUDSITE_ID);
- request.setTenantId(TENANT_ID);
- request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
- request.setVnfId(AAI_VNF_ID);
- request.setVnfType(VNF_TYPE);
- request.setVnfVersion(VNF_VERSION);
- request.setVfModuleId(VF_MODULE_ID);
- request.setVfModuleName(VF_MODULE_NAME);
- request.setVfModuleType(VF_MODULE_TYPE);
- request.setBaseVfModuleId(BASE_VF_MODULE_ID);
- request.setFailIfExists(failIfExists);
- request.setEnableBridge(enableBridge);
- request.setVfModuleParams(vfModuleParams);
- request.setMessageId(MESSAGE_ID);
-
- 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
deleted file mode 100644
index c2e2b567f1..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.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;
-import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.QueryVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.VolumeGroupExceptionResponse;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-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;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksWithBody_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostStacks_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
-
-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);
- CreateVolumeGroupRequest request = buildCreateVfModuleRequest();
-
- HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
- ResponseEntity<CreateVolumeGroupResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v1/volume-groups"), HttpMethod.POST, entity,
- CreateVolumeGroupResponse.class);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testCreateVNFVolumesAsync() throws IOException {
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackPostStacks_200(wireMockServer);
- mockOpenStackGetStackVfModule_200(wireMockServer);
- CreateVolumeGroupRequest request = buildCreateVfModuleRequest();
- request.setNotificationUrl("http://localhost:8080");
-
- HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
- ResponseEntity<CreateVolumeGroupResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v1/volume-groups"), HttpMethod.POST, entity,
- CreateVolumeGroupResponse.class);
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testDeleteVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest();
- HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
- ResponseEntity<DeleteVolumeGroupResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID),
- HttpMethod.DELETE, entity, DeleteVolumeGroupResponse.class);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testDeleteVNFVolumesAsync() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest();
- request.setNotificationUrl("http://localhost:8080");
- HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
- ResponseEntity<DeleteVolumeGroupResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID),
- HttpMethod.DELETE, entity, DeleteVolumeGroupResponse.class);
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testRollbackVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest();
- HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
- ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID + "/rollback"),
- HttpMethod.DELETE, entity, RollbackVolumeGroupResponse.class);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testRollbackVNFVolumesAsync() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest();
- request.setNotificationUrl("http://localhost:8080");
- HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
- ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID + "/rollback"),
- HttpMethod.DELETE, entity, RollbackVolumeGroupResponse.class);
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testQueryVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE");
- javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID);
- builder.queryParam("cloudSiteId", CLOUDSITE_ID).queryParam("tenantId", TENANT_ID)
- .queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true)
- .queryParam("msoRequest.requestId", MSO_REQUEST_ID)
- .queryParam("msoRequest.serviceInstanceId", MSO_SERVICE_INSTANCE_ID);
-
- ResponseEntity<QueryVolumeGroupResponse> response = restTemplate.exchange(
- createURLWithPort(builder.build().toString()), HttpMethod.GET, null, QueryVolumeGroupResponse.class);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testQueryVNFVolumesError() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE");
- javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID);
- builder.queryParam("tenantId", TENANT_ID).queryParam("volumeGroupStackId", VOUME_GROUP_NAME)
- .queryParam("skipAAI", true).queryParam("msoRequest.requestId", MSO_REQUEST_ID)
- .queryParam("msoRequest.serviceInstanceId", MSO_SERVICE_INSTANCE_ID);
-
- ResponseEntity<VolumeGroupExceptionResponse> response =
- restTemplate.exchange(createURLWithPort(builder.build().toString()), HttpMethod.GET, null,
- VolumeGroupExceptionResponse.class);
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testUpdateVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE");
- mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME + "/stackId", 200);
- mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE");
- UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest();
- HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
- ResponseEntity<UpdateVolumeGroupResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID),
- HttpMethod.PUT, entity, UpdateVolumeGroupResponse.class);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testUpdateVNFVolumesAsync() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE");
- mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME + "/stackId", 200);
- mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE");
- UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest();
- request.setNotificationUrl("http://localhost:8080");
- HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
- ResponseEntity<UpdateVolumeGroupResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID),
- HttpMethod.PUT, entity, UpdateVolumeGroupResponse.class);
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- }
-
-
-}
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
deleted file mode 100644
index 6fd9f02cfe..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.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;
-import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.QueryVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
-import org.onap.so.adapters.vnfrest.VolumeGroupExceptionResponse;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-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;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStacksWithBody_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostStacks_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
-
-public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon {
-
- @Test
- public void testCreateVNFVolumes() throws IOException {
- 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);
- ResponseEntity<CreateVolumeGroupResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v2/volume-groups"), HttpMethod.POST, entity,
- CreateVolumeGroupResponse.class);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testCreateVNFVolumesAsync() throws IOException {
-
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackPostStacks_200(wireMockServer);
- mockOpenStackGetStackVfModule_200(wireMockServer);
- CreateVolumeGroupRequest request = buildCreateVfModuleRequest();
- request.setNotificationUrl("http://localhost:8080");
- HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
- ResponseEntity<CreateVolumeGroupResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v2/volume-groups"), HttpMethod.POST, entity,
- CreateVolumeGroupResponse.class);
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testDeleteVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest();
- HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
- ResponseEntity<DeleteVolumeGroupResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID),
- HttpMethod.DELETE, entity, DeleteVolumeGroupResponse.class);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testDeleteVNFVolumesAsync() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest();
- request.setNotificationUrl("http://localhost:8080");
- HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
- ResponseEntity<DeleteVolumeGroupResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID),
- HttpMethod.DELETE, entity, DeleteVolumeGroupResponse.class);
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testRollbackVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest();
- HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
- ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID + "/rollback"),
- HttpMethod.DELETE, entity, RollbackVolumeGroupResponse.class);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testRollbackVNFVolumesAsync() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest();
- request.setNotificationUrl("http://localhost:8080");
- HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
- ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange(
- createURLWithPort("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID + "/rollback"),
- HttpMethod.DELETE, entity, RollbackVolumeGroupResponse.class);
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testQueryVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE");
- javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID);
- builder.queryParam("cloudSiteId", CLOUDSITE_ID).queryParam("tenantId", TENANT_ID)
- .queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true)
- .queryParam("msoRequest.requestId", MSO_REQUEST_ID)
- .queryParam("msoRequest.serviceInstanceId", MSO_SERVICE_INSTANCE_ID);
-
- ResponseEntity<QueryVolumeGroupResponse> response = restTemplate.exchange(
- createURLWithPort(builder.build().toString()), HttpMethod.GET, null, QueryVolumeGroupResponse.class);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testQueryVNFVolumesError() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE");
- javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID);
- builder.queryParam("tenantId", TENANT_ID).queryParam("volumeGroupStackId", VOUME_GROUP_NAME)
- .queryParam("skipAAI", true).queryParam("msoRequest.requestId", MSO_REQUEST_ID)
- .queryParam("msoRequest.serviceInstanceId", MSO_SERVICE_INSTANCE_ID);
-
- ResponseEntity<VolumeGroupExceptionResponse> response =
- restTemplate.exchange(createURLWithPort(builder.build().toString()), HttpMethod.GET, null,
- VolumeGroupExceptionResponse.class);
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testUpdateVNFVolumes() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE");
- mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME + "/stackId", 200);
- mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE");
- UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest();
- HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
- ResponseEntity<UpdateVolumeGroupResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID),
- HttpMethod.PUT, entity, UpdateVolumeGroupResponse.class);
- assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- }
-
- @Test
- public void testUpdateVNFVolumesAsync() throws IOException {
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
- mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE");
- mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME + "/stackId", 200);
- mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE");
- UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest();
- request.setNotificationUrl("http://localhost:8080");
- HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers);
- ResponseEntity<UpdateVolumeGroupResponse> response =
- restTemplate.exchange(createURLWithPort("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID),
- HttpMethod.PUT, entity, UpdateVolumeGroupResponse.class);
- assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java
deleted file mode 100644
index 14fa1df6c9..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.vnf;
-
-import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.VolumeGroupRollback;
-import org.onap.so.entity.MsoRequest;
-import java.util.HashMap;
-import java.util.Map;
-
-public class VolumeGroupAdapterCommon extends BaseRestTestUtils {
-
-
-
- protected static final String MSO_REQUEST_ID = "62265093-277d-4388-9ba6-449838ade586";
- protected static final String MSO_SERVICE_INSTANCE_ID = "4147e06f-1b89-49c5-b21f-4faf8dc9805a";
- protected static final String CLOUDSITE_ID = "mtn13";
- protected static final String TENANT_ID = "0422ffb57ba042c0800a29dc85ca70f8";
- protected static final String VOUME_GROUP_NAME = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001";
- protected static final String VOLUME_GROUP_ID = "0422ffb57ba042c0800a29dc85ca70v1";
- protected static final String VNF_TYPE = "TestVnfType";
- protected static final String VNF_VERSION = "1.0";
- protected static final String VF_MODULE_TYPE = "TestModule-0";
- protected static final String MODEL_CUSTOMIZATION_UUID = "9b339a61-69ca-465f-86b8-1c72c582b8e8";
-
- protected UpdateVolumeGroupRequest buildUpdateVolumeGroupRequest() {
- UpdateVolumeGroupRequest request = new UpdateVolumeGroupRequest();
- request.setCloudSiteId(CLOUDSITE_ID);
- request.setTenantId(TENANT_ID);
- request.setVolumeGroupId(VOLUME_GROUP_ID);
- request.setVnfType(VNF_TYPE);
- request.setVnfVersion(VNF_VERSION);
- request.setVfModuleType(VF_MODULE_TYPE);
- request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
- request.setSkipAAI(true);
- request.setVolumeGroupStackId(VOUME_GROUP_NAME);
- Map<String, Object> volumeGroupParams = getVolumeGroupParamsMap();
- request.setVolumeGroupParams(volumeGroupParams);
- MsoRequest msoReq = getMsoRequest();
- request.setMsoRequest(msoReq);
- return request;
- }
-
- protected RollbackVolumeGroupRequest buildRollbackVolumeGroupRequest() {
- RollbackVolumeGroupRequest request = new RollbackVolumeGroupRequest();
- VolumeGroupRollback volumeGroupRollback = new VolumeGroupRollback();
- volumeGroupRollback.setCloudSiteId(CLOUDSITE_ID);
- volumeGroupRollback.setMessageId(MSO_REQUEST_ID);
- volumeGroupRollback.setTenantId(TENANT_ID);
- MsoRequest msoReq = getMsoRequest();
- volumeGroupRollback.setVolumeGroupCreated(true);
- volumeGroupRollback.setVolumeGroupId(VOLUME_GROUP_ID);
- volumeGroupRollback.setVolumeGroupStackId(VOLUME_GROUP_ID);
- volumeGroupRollback.setMsoRequest(msoReq);
- request.setVolumeGroupRollback(volumeGroupRollback);
- return request;
- }
-
- protected DeleteVolumeGroupRequest buildDeleteVolumeGroupRequest() {
- DeleteVolumeGroupRequest request = new DeleteVolumeGroupRequest();
- request.setCloudSiteId(CLOUDSITE_ID);
- request.setTenantId(TENANT_ID);
- request.setVolumeGroupStackId("testStackId");
- request.setVolumeGroupId(VOLUME_GROUP_ID);
- MsoRequest msoReq = getMsoRequest();
- request.setMsoRequest(msoReq);
- return request;
- }
-
- protected CreateVolumeGroupRequest buildCreateVfModuleRequest() {
- CreateVolumeGroupRequest request = new CreateVolumeGroupRequest();
- request.setCloudSiteId(CLOUDSITE_ID);
- request.setTenantId(TENANT_ID);
- request.setVolumeGroupName(VOUME_GROUP_NAME);
- request.setVolumeGroupId(VOLUME_GROUP_ID);
- request.setVnfType(VNF_TYPE);
- request.setVnfVersion(VNF_VERSION);
- request.setVfModuleType(VF_MODULE_TYPE);
- request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID);
- request.setSkipAAI(true);
- request.setFailIfExists(false);
- request.setFailIfExists(true);
- request.setEnableBridge(false);
- request.setSuppressBackout(true);
- Map<String, Object> volumeGroupParams = getVolumeGroupParamsMap();
- request.setVolumeGroupParams(volumeGroupParams);
- MsoRequest msoReq = getMsoRequest();
- request.setMsoRequest(msoReq);
-
- return request;
- }
-
- private Map<String, Object> getVolumeGroupParamsMap() {
- Map<String, Object> volumeGroupParams = new HashMap<>();
- volumeGroupParams.put("fsb_volume_type_0", "volume_type");
- volumeGroupParams.put("fsb_volume_image_name_1", "vol_img_1");
- volumeGroupParams.put("fsb_volume_image_name_0", "vol_img_0");
- volumeGroupParams.put("fsb_volume_size_0", "100");
- return volumeGroupParams;
- }
-
- private MsoRequest getMsoRequest() {
- MsoRequest msoReq = new MsoRequest();
- msoReq.setRequestId(MSO_REQUEST_ID);
- msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
- return msoReq;
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
index e2f5531280..464a17d2a5 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -64,14 +64,15 @@ import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.PInterface;
import org.onap.aai.domain.yang.SriovPf;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.AAISingleTransactionClient;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.AAISingleTransactionClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.heatbridge.constants.HeatBridgeConstants;
+import org.onap.so.heatbridge.helpers.AaiHelper;
import org.onap.so.heatbridge.openstack.api.OpenstackClient;
import org.onap.so.heatbridge.openstack.api.OpenstackClientException;
import org.openstack4j.model.compute.Flavor;
@@ -228,7 +229,7 @@ public class HeatBridgeImplTest {
Server server2 = mock(Server.class);
when(server2.getId()).thenReturn("test-server2-id");
- when(server2.getHypervisorHostname()).thenReturn("test-hypervisor");
+ when(server2.getHypervisorHostname()).thenReturn("");
when(server2.getName()).thenReturn("test-server2-name");
when(server2.getStatus()).thenReturn(Status.ACTIVE);
when(server2.getLinks()).thenReturn(new ArrayList<>());
@@ -262,6 +263,90 @@ public class HeatBridgeImplTest {
}
@Test
+ public void testUpdateVserversToAaiNoHypervisorName() throws HeatBridgeException {
+ // Arrange
+ Server server1 = mock(Server.class);
+
+ when(server1.getId()).thenReturn("test-server1-id");
+ when(server1.getHypervisorHostname()).thenReturn("");
+ when(server1.getName()).thenReturn("test-server1-name");
+ when(server1.getStatus()).thenReturn(Status.ACTIVE);
+ when(server1.getLinks()).thenReturn(new ArrayList<>());
+
+ Server server2 = mock(Server.class);
+ when(server2.getId()).thenReturn("test-server2-id");
+ when(server2.getName()).thenReturn("test-server2-name");
+ when(server2.getStatus()).thenReturn(Status.ACTIVE);
+ when(server2.getLinks()).thenReturn(new ArrayList<>());
+
+ List<Server> servers = Arrays.asList(server1, server2);
+
+ Image image = mock(Image.class);
+ when(server1.getImage()).thenReturn(image);
+ when(server2.getImage()).thenReturn(image);
+ when(image.getId()).thenReturn("test-image-id");
+
+ Flavor flavor = mock(Flavor.class);
+ when(server1.getFlavor()).thenReturn(flavor);
+ when(server2.getFlavor()).thenReturn(flavor);
+ when(flavor.getId()).thenReturn("test-flavor-id");
+
+ // Act
+ heatbridge.buildAddVserversToAaiAction("test-genericVnf-id", "test-vfModule-id", servers);
+
+ // Assert
+ ArgumentCaptor<AAIResourceUri> captor = ArgumentCaptor.forClass(AAIResourceUri.class);
+ verify(transaction, times(2)).create(captor.capture(), any(Vserver.class));
+
+ List<AAIResourceUri> uris = captor.getAllValues();
+ assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
+ server1.getId()), uris.get(0));
+ assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
+ server2.getId()), uris.get(1));
+ }
+
+ @Test
+ public void testCreateRelationships() throws HeatBridgeException {
+ AaiHelper aaiHelper = new AaiHelper();
+ // Arrange
+ Server server1 = mock(Server.class);
+
+ when(server1.getId()).thenReturn("test-server1-id");
+ when(server1.getHypervisorHostname()).thenReturn("test-hypervisor");
+ when(server1.getName()).thenReturn("test-server1-name");
+ when(server1.getStatus()).thenReturn(Status.ACTIVE);
+ when(server1.getLinks()).thenReturn(new ArrayList<>());
+
+ // HypervisorHostname is not set
+ Server server2 = mock(Server.class);
+ when(server2.getId()).thenReturn("test-server1-id");
+ when(server2.getName()).thenReturn("test-server1-name");
+ when(server2.getStatus()).thenReturn(Status.ACTIVE);
+ when(server2.getLinks()).thenReturn(new ArrayList<>());
+
+ // HypervisorHostname is empty string
+ Server server3 = mock(Server.class);
+ when(server3.getId()).thenReturn("test-server1-id");
+ when(server3.getHypervisorHostname()).thenReturn("");
+ when(server3.getName()).thenReturn("test-server1-name");
+ when(server3.getStatus()).thenReturn(Status.ACTIVE);
+ when(server3.getLinks()).thenReturn(new ArrayList<>());
+
+ org.onap.aai.domain.yang.RelationshipList relList = aaiHelper.getVserverRelationshipList(CLOUD_OWNER, REGION_ID,
+ "test-genericVnf-id", "test-vfModule-id", server1);
+ assertEquals(4, relList.getRelationship().size());
+
+ org.onap.aai.domain.yang.RelationshipList relList2 = aaiHelper.getVserverRelationshipList(CLOUD_OWNER,
+ REGION_ID, "test-genericVnf-id", "test-vfModule-id", server2);
+ assertEquals(3, relList2.getRelationship().size());
+
+ org.onap.aai.domain.yang.RelationshipList relList3 = aaiHelper.getVserverRelationshipList(CLOUD_OWNER,
+ REGION_ID, "test-genericVnf-id", "test-vfModule-id", server3);
+ assertEquals(3, relList3.getRelationship().size());
+ }
+
+
+ @Test
public void testUpdateImagesToAai() throws HeatBridgeException {
// Arrange
Image image1 = mock(Image.class);
@@ -308,13 +393,7 @@ public class HeatBridgeImplTest {
heatbridge.buildAddFlavorsToAaiAction(flavors);
// Assert #1
- verify(transaction, times(2)).create(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Flavor.class));
-
- // Act #2
- heatbridge.buildAddFlavorsToAaiAction(flavors);
-
- // Assert #2
- verify(transaction, times(4)).create(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Flavor.class));
+ verify(transaction, times(2)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
}
@Ignore
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java
index 4eeb1c03a3..86400c2190 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java
@@ -52,19 +52,20 @@ public class MsoCloudClientFactoryImplTest {
@Test
public void getOpenstackClientWithVersion2() throws Exception {
- testedObject.getOpenstackClient(URL_V2, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID);
+ testedObject.getOpenstackClient(URL_V2, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID, "v2.0");
verify(openstackClientFactoryMock).createOpenstackV2Client(any(OpenstackAccess.class));
}
@Test
public void getOpenstackClientWithVersion3() throws Exception {
- testedObject.getOpenstackClient(URL_V3, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID);
+ testedObject.getOpenstackClient(URL_V3, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID, "v3");
verify(openstackClientFactoryMock).createOpenstackV3Client(any(OpenstackAccess.class));
}
@Test(expected = HeatBridgeException.class)
public void getOpenstackClient_unsupportedVersion() throws Exception {
- testedObject.getOpenstackClient(URL_WITH_UNSUPPORTED_VERSION, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID);
+ testedObject.getOpenstackClient(URL_WITH_UNSUPPORTED_VERSION, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID,
+ "UNKNOWN");
}
}
diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml
index 2354272756..f9026d82c8 100644
--- a/adapters/mso-requests-db-adapter/pom.xml
+++ b/adapters/mso-requests-db-adapter/pom.xml
@@ -186,7 +186,7 @@
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
- <artifactId>fabric8-maven-plugin</artifactId>
+ <artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>
@@ -243,6 +243,19 @@
</ignore>
</action>
</pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <versionRange>[1.0.0,)</versionRange>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute />
+ </action>
+ </pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
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 9f48144eb8..4fe49e38dd 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
@@ -143,6 +143,8 @@ public class ArchiveInfraRequestsScheduler {
archivedInfra.setProductFamilyName(iar.getProductFamilyName());
archivedInfra.setTenantName(iar.getTenantName());
archivedInfra.setResourceStatusMessage(iar.getResourceStatusMessage());
+ archivedInfra.setWorkflowName(iar.getWorkflowName());
+ archivedInfra.setOperationName(iar.getOperationName());
newArchivedReqs.add(archivedInfra);
oldInfraReqs.add(iar);
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomController.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomController.java
index 28e931a3e1..2adba81f9e 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomController.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomController.java
@@ -29,6 +29,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@@ -39,27 +41,25 @@ public class InfraActiveRequestsRepositoryCustomController {
@Autowired
InfraActiveRequestsRepository infraActiveRequestsRepository;
- @RequestMapping(method = RequestMethod.POST,
- value = "/infraActiveRequests/getCloudOrchestrationFiltersFromInfraActive")
+ @PostMapping(value = "/infraActiveRequests/getCloudOrchestrationFiltersFromInfraActive")
public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive(
@RequestBody Map<String, String> orchestrationMap) {
return infraActiveRequestsRepository.getCloudOrchestrationFiltersFromInfraActive(orchestrationMap);
}
- @RequestMapping(method = RequestMethod.POST, value = "/infraActiveRequests/getOrchestrationFiltersFromInfraActive")
+ @PostMapping(value = "/infraActiveRequests/getOrchestrationFiltersFromInfraActive")
public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive(
@RequestBody Map<String, List<String>> orchestrationMap) {
return infraActiveRequestsRepository.getOrchestrationFiltersFromInfraActive(orchestrationMap);
}
- @RequestMapping(method = RequestMethod.GET,
- value = "/infraActiveRequests/checkVnfIdStatus/{operationalEnvironmentId}")
+ @GetMapping(value = "/infraActiveRequests/checkVnfIdStatus/{operationalEnvironmentId}")
public InfraActiveRequests checkVnfIdStatus(
@PathVariable("operationalEnvironmentId") String operationalEnvironmentId) {
return infraActiveRequestsRepository.checkVnfIdStatus(operationalEnvironmentId);
}
- @RequestMapping(method = RequestMethod.POST, value = "/infraActiveRequests/checkInstanceNameDuplicate")
+ @PostMapping(value = "/infraActiveRequests/checkInstanceNameDuplicate")
public InfraActiveRequests checkInstanceNameDuplicate(
@RequestBody InstanceNameDuplicateCheckRequest instanceNameDuplicateCheckRequest) {
return infraActiveRequestsRepository.checkInstanceNameDuplicate(
@@ -68,14 +68,14 @@ public class InfraActiveRequestsRepositoryCustomController {
instanceNameDuplicateCheckRequest.getRequestScope());
}
- @RequestMapping(method = RequestMethod.POST, value = "/infraActiveRequests/v1/getInfraActiveRequests")
+ @PostMapping(value = "/infraActiveRequests/v1/getInfraActiveRequests")
public List<InfraActiveRequests> getInfraActiveRequests(@RequestBody Map<String, String[]> filters,
@RequestParam("from") long startTime, @RequestParam("to") long endTime,
@RequestParam(value = "maxResult", required = false) Integer maxResult) {
return infraActiveRequestsRepository.getInfraActiveRequests(filters, startTime, endTime, maxResult);
}
- @RequestMapping(method = RequestMethod.GET, value = "/infraActiveRequests/getInProgressVolumeGroupsAndVfModules")
+ @GetMapping(value = "/infraActiveRequests/getInProgressVolumeGroupsAndVfModules")
public List<InfraActiveRequests> getInProgressVolumeGroupsAndVfModules() {
return infraActiveRequestsRepository.getInProgressVolumeGroupsAndVfModules();
}
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 84ff054a7c..7feaa9c4c3 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
@@ -27,6 +27,7 @@ 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.OperationStatus;
import org.onap.so.db.request.beans.ResourceOperationStatus;
/**
@@ -77,6 +78,12 @@ public interface MsoRequestsDbAdapter {
public boolean getSiteStatus(@WebParam(name = "siteName") @XmlElement(required = true) String siteName);
@WebMethod
+ public OperationStatus getServiceOperationStatus(
+ @WebParam(name = "serviceId") @XmlElement(required = true) String serviceId,
+ @WebParam(name = "operationId") @XmlElement(required = false) String operationId)
+ throws MsoRequestsDbException;
+
+ @WebMethod
public void updateServiceOperationStatus(
@WebParam(name = "serviceId") @XmlElement(required = true) String serviceId,
@WebParam(name = "operationId") @XmlElement(required = false) String operationId,
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 b262cb21cb..8782cce34a 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
@@ -222,6 +222,27 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
}
/**
+ * get the operation status
+ *
+ * @param serviceId
+ * @param operationId
+ * @return operationStatus
+ * @throws MsoRequestsDbException
+ */
+ @Override
+ @Transactional
+ public OperationStatus getServiceOperationStatus(String serviceId, String operationId)
+ throws MsoRequestsDbException {
+ OperationStatus operationStatus;
+ if (operationId.isEmpty()) {
+ operationStatus = operationStatusRepository.findOneByServiceId(serviceId);
+ } else {
+ operationStatus = operationStatusRepository.findOneByServiceIdAndOperationId(serviceId, operationId);
+ }
+ return operationStatus;
+ }
+
+ /**
* update operation status <br>
*
* @param serviceId
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
index e32d90b137..29585b94eb 100644
--- 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
@@ -33,29 +33,29 @@ public class OrchestrationTaskRepositoryCustomController {
@Autowired
private OrchestrationTaskRepository orchestrationTaskRepository;
- @RequestMapping(method = RequestMethod.GET, value = "/orchestrationTask")
+ @GetMapping(value = "/orchestrationTask")
public List<OrchestrationTask> getAllOrchestrationTask() {
return orchestrationTaskRepository.findAll();
}
- @RequestMapping(method = RequestMethod.GET, value = "/orchestrationTask/{taskId}")
+ @GetMapping(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/")
+ @PostMapping(value = "/orchestrationTask/")
public OrchestrationTask createOrchestrationTask(@RequestBody OrchestrationTask orchestrationTask) {
return orchestrationTaskRepository.save(orchestrationTask);
}
- @RequestMapping(method = RequestMethod.PUT, value = "/orchestrationTask/{taskId}")
+ @PutMapping(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}")
+ @DeleteMapping(value = "/orchestrationTask/{taskId}")
public void deleteOrchestrationTask(@PathVariable("taskId") String taskId) {
orchestrationTaskRepository.deleteById(taskId);
}
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.3__Add_Columns_Workflow_Name_Operation_Name.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.3__Add_Columns_Workflow_Name_Operation_Name.sql
new file mode 100644
index 0000000000..d493bc01ac
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V8.3__Add_Columns_Workflow_Name_Operation_Name.sql
@@ -0,0 +1,7 @@
+use requestdb;
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS WORKFLOW_NAME varchar(200);
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS WORKFLOW_NAME varchar(200);
+
+ALTER TABLE infra_active_requests ADD COLUMN IF NOT EXISTS OPERATION_NAME varchar(200);
+ALTER TABLE archived_infra_requests ADD COLUMN IF NOT EXISTS OPERATION_NAME varchar(200); \ No newline at end of file
diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml
index 7fd1aa62d4..f54c2ec568 100644
--- a/adapters/mso-sdnc-adapter/pom.xml
+++ b/adapters/mso-sdnc-adapter/pom.xml
@@ -16,6 +16,34 @@
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <versionRange>[1.0.0,)</versionRange>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
@@ -63,7 +91,7 @@
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
- <artifactId>fabric8-maven-plugin</artifactId>
+ <artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>
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
deleted file mode 100644
index 9b2a8c3d62..0000000000
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/aai/AaiConnection.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*-
- * ============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 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;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-@Service
-public class AaiConnection {
-
- private static final Logger logger = LoggerFactory.getLogger(AaiConnection.class);
-
- private static final int FIRST_INDEX = 0;
-
- 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 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();
-
- final List<EsrSystemInfo> infos = new LinkedList<>();
-
- for (final EsrVnfm vnfm : esrVnfm) {
- final String vnfmId = vnfm.getVnfmId();
- infos.addAll(receiveVnfmServiceUrl(resourcesClient, vnfmId));
- }
-
- return infos;
- }
-
- return null;
- }
-
- 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);
- return esrVnfm.getEsrSystemInfoList().getEsrSystemInfo();
- }
-
- return Collections.emptyList();
- }
-}
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
index 83a8a56756..e66bb90bbd 100644
--- 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
@@ -13,7 +13,6 @@ package org.onap.so.adapters.vfc.model;
import javax.validation.constraints.NotNull;
import java.util.List;
-import java.util.Map;
public class InstantiatedVnfInfo {
@NotNull
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
index 20c8972c98..2dff432c3b 100644
--- 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
@@ -12,7 +12,6 @@
package org.onap.so.adapters.vfc.model;
import javax.validation.constraints.NotNull;
-import java.util.List;
public class NsLinkPortInfo {
@NotNull
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 a708c2641c..54a2a98a00 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
@@ -28,7 +28,6 @@ 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;
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
deleted file mode 100644
index ab524ca808..0000000000
--- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/pom.xml
+++ /dev/null
@@ -1,325 +0,0 @@
-<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.adapters</groupId>
- <artifactId>mso-vnfm-adapter</artifactId>
- <version>1.6.0-SNAPSHOT</version>
- </parent>
- <artifactId>mso-vnfm-adapter-ext-clients</artifactId>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <swagger-core-version>1.5.15</swagger-core-version>
- <okhttp-version>2.7.5</okhttp-version>
- <gson-fire-version>1.8.2</gson-fire-version>
- <threetenbp-version>1.3.5</threetenbp-version>
- <retrofit2-version>2.4.0</retrofit2-version>
- <okhttp3-version>3.14.0</okhttp3-version>
- <oltu-version>1.0.1</oltu-version>
- </properties>
- <name>mso-vnfm-adapter-ext-clients</name>
- <description>Clients for the vnfm adpater to use towards REST endpoints which are external to the VNFM adapter/</description>
-
- <build>
- <plugins>
- <plugin>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-codegen-maven-plugin</artifactId>
- <version>2.3.1</version>
- <executions>
- <execution>
- <id>sol003-vnf-lcm-api</id>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <inputSpec>${basedir}/src/main/resources/SOL003-VNFLifecycleManagement-API.json</inputSpec>
- <language>java</language>
- <library>okhttp-gson</library>
- <output>${project.build.directory}/generated-sources/sol003-vnf-lcm</output>
- <apiPackage>org.onap.so.adapters.vnfmadapter.extclients.vnfm.api</apiPackage>
- <modelPackage>org.onap.so.adapters.vnfmadapter.extclients.vnfm.model</modelPackage>
- <configOptions>
- <jackson>true</jackson>
- <sourceFolder>src/gen/java/main</sourceFolder>
- <withXml>true</withXml>
- <useRxJava2>true</useRxJava2>
- <serializableModel>true</serializableModel>
- </configOptions>
- </configuration>
- </execution>
- <execution>
- <id>sol003-vnf-lcn-api</id>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <inputSpec>${basedir}/src/main/resources/SOL003-VNFLifecycleManagementNotification-API.json</inputSpec>
- <language>java</language>
- <library>okhttp-gson</library>
- <output>${project.build.directory}/generated-sources/sol003-vnf-lcn</output>
- <apiPackage>org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.api</apiPackage>
- <modelPackage>org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model</modelPackage>
- <configOptions>
- <sourceFolder>src/gen/java/main</sourceFolder>
- <withXml>true</withXml>
- <useRxJava2>true</useRxJava2>
- <serializableModel>true</serializableModel>
- </configOptions>
- </configuration>
- </execution>
- <execution>
- <id>sol003-vnf-grant-api</id>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <inputSpec>${basedir}/src/main/resources/SOL003-VNFLifecycleOperationGranting-API.json</inputSpec>
- <language>java</language>
- <library>okhttp-gson</library>
- <output>${project.build.directory}/generated-sources/sol003-vnf-grant</output>
- <apiPackage>org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.api</apiPackage>
- <modelPackage>org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model</modelPackage>
- <configOptions>
- <generateSupportingFiles>false</generateSupportingFiles>
- <sourceFolder>src/gen/java/main</sourceFolder>
- <withXml>true</withXml>
- <useRxJava2>true</useRxJava2>
- <serializableModel>true</serializableModel>
- </configOptions>
- </configuration>
- </execution>
- <execution>
- <id>sol003-vnf-packagemanagement-api</id>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <inputSpec>${basedir}/src/main/resources/SOL003-VNFPackageManagement-API.json</inputSpec>
- <language>java</language>
- <library>okhttp-gson</library>
- <output>${project.build.directory}/generated-sources/sol003-vnf-packagemanagement</output>
- <apiPackage>org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.api</apiPackage>
- <modelPackage>org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model</modelPackage>
- <configOptions>
- <sourceFolder>src/gen/java/main</sourceFolder>
- <withXml>true</withXml>
- <useRxJava2>true</useRxJava2>
- <serializableModel>true</serializableModel>
- </configOptions>
- </configuration>
- </execution>
- <execution>
- <id>etsicatalog-api</id>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <inputSpec>${basedir}/src/main/resources/ETSI-Catalog-API.json</inputSpec>
- <language>java</language>
- <library>okhttp-gson</library>
- <output>${project.build.directory}/generated-sources/etsicatalog</output>
- <apiPackage>org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.api</apiPackage>
- <modelPackage>org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model</modelPackage>
- <configOptions>
- <sourceFolder>src/gen/java/main</sourceFolder>
- <withXml>true</withXml>
- <useRxJava2>true</useRxJava2>
- <serializableModel>true</serializableModel>
- </configOptions>
- </configuration>
- </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>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-codegen-maven-plugin</artifactId>
- <goals>
- <goal>generate</goal>
- </goals>
- <versionRange>[2.2.0,)</versionRange>
- </pluginExecutionFilter>
- <action>
- <execute>
- <runOnIncremental>false</runOnIncremental>
- </execute>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-annotations</artifactId>
- <version>${swagger-core-version}</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.okhttp</groupId>
- <artifactId>okhttp</artifactId>
- <version>${okhttp-version}</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.okhttp</groupId>
- <artifactId>logging-interceptor</artifactId>
- <version>${okhttp-version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
- <dependency>
- <groupId>io.gsonfire</groupId>
- <artifactId>gson-fire</artifactId>
- <version>${gson-fire-version}</version>
- </dependency>
- <dependency>
- <groupId>org.threeten</groupId>
- <artifactId>threetenbp</artifactId>
- <version>${threetenbp-version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <!-- the test code is generated into the main source code :( -->
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.squareup.retrofit2</groupId>
- <artifactId>converter-gson</artifactId>
- <version>${retrofit2-version}</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.retrofit2</groupId>
- <artifactId>retrofit</artifactId>
- <version>${retrofit2-version}</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.retrofit2</groupId>
- <artifactId>converter-scalars</artifactId>
- <version>${retrofit2-version}</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.retrofit2</groupId>
- <artifactId>adapter-rxjava2</artifactId>
- <version>${retrofit2-version}</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.okhttp3</groupId>
- <artifactId>okhttp</artifactId>
- <version>${okhttp3-version}</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.okhttp3</groupId>
- <artifactId>logging-interceptor</artifactId>
- <version>${okhttp3-version}</version>
- </dependency>
- <dependency>
- <groupId>com.squareup.okhttp</groupId>
- <artifactId>logging-interceptor</artifactId>
- <version>${okhttp-version}</version>
- </dependency>
-
- <!-- Will clean these dependencies before commit From here-->
- <dependency>
- <groupId>org.apache.oltu.oauth2</groupId>
- <artifactId>org.apache.oltu.oauth2.client</artifactId>
- <version>${oltu-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oltu.oauth2</groupId>
- <artifactId>org.apache.oltu.oauth2.common</artifactId>
- <version>${oltu-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oltu.oauth2</groupId>
- <artifactId>org.apache.oltu.oauth2.client</artifactId>
- <version>${oltu-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oltu.oauth2</groupId>
- <artifactId>org.apache.oltu.oauth2.httpclient4</artifactId>
- <version>${oltu-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oltu.oauth2</groupId>
- <artifactId>org.apache.oltu.oauth2.dynamicreg.client</artifactId>
- <version>${oltu-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oltu.oauth2</groupId>
- <artifactId>org.apache.oltu.oauth2.dynamicreg.common</artifactId>
- <version>${oltu-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oltu.oauth2</groupId>
- <artifactId>org.apache.oltu.oauth2.authzserver</artifactId>
- <version>${oltu-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oltu.oauth2</groupId>
- <artifactId>org.apache.oltu.oauth2.resourceserver</artifactId>
- <version>${oltu-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oltu.oauth2</groupId>
- <artifactId>org.apache.oltu.oauth2.resourceserver-filter</artifactId>
- <version>${oltu-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oltu.oauth2</groupId>
- <artifactId>org.apache.oltu.oauth2.dynamicreg.server</artifactId>
- <version>${oltu-version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.oltu.oauth2</groupId>
- <artifactId>org.apache.oltu.oauth2.jwt</artifactId>
- <version>${oltu-version}</version>
- </dependency>
- <!-- To here-->
-
-
-
- </dependencies>
-</project>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
deleted file mode 100644
index 86cc3f0a0e..0000000000
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
+++ /dev/null
@@ -1 +0,0 @@
-org.onap.so.adapters.vnfmadapter.extclients.aai.AaiPropertiesImpl \ No newline at end of file
diff --git a/adapters/mso-vnfm-adapter/pom.xml b/adapters/mso-vnfm-adapter/pom.xml
deleted file mode 100644
index 3e295aa184..0000000000
--- a/adapters/mso-vnfm-adapter/pom.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<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-vnfm-adapter</artifactId>
- <name>MSO VNFM Adapter</name>
- <description>MSO Adapter for VNFM</description>
- <packaging>pom</packaging>
-
- <modules>
- <module>mso-vnfm-adapter-api</module>
- <module>mso-vnfm-adapter-ext-clients</module>
- <module>mso-vnfm-etsi-adapter</module>
- </modules>
-</project>
diff --git a/adapters/pom.xml b/adapters/pom.xml
index 5d382fd4dd..76b4a58af6 100644
--- a/adapters/pom.xml
+++ b/adapters/pom.xml
@@ -21,8 +21,8 @@
<module>mso-catalog-db-adapter</module>
<module>mso-vfc-adapter</module>
<module>mso-openstack-adapters</module>
- <module>mso-vnfm-adapter</module>
- <module>mso-ve-vnfm-adapter</module>
+ <module>etsi-sol003-adapter</module>
+ <module>etsi-sol002-adapter</module>
<module>mso-nssmf-adapter</module>
<module>so-appc-orchestrator</module>
</modules>
@@ -41,5 +41,10 @@
<artifactId>spring-cloud-contract-wiremock</artifactId>
<version>1.2.4.RELEASE</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>aai-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/adapters/so-appc-orchestrator/pom.xml b/adapters/so-appc-orchestrator/pom.xml
index 66dcc4dd30..f8d8fabcf7 100644
--- a/adapters/so-appc-orchestrator/pom.xml
+++ b/adapters/so-appc-orchestrator/pom.xml
@@ -14,7 +14,6 @@
<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.7.1-SNAPSHOT</appc.client.version>
</properties>
<name>so-appc-orchestrator</name>
<description>MSO APPC-C Orchestrator</description>
@@ -46,7 +45,7 @@
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
- <artifactId>fabric8-maven-plugin</artifactId>
+ <artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>
@@ -98,6 +97,19 @@
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <versionRange>[1.0.0,)</versionRange>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute />
+ </action>
+ </pluginExecution>
+ <pluginExecution>
+ <pluginExecutionFilter>
<groupId>
org.jvnet.jax-ws-commons
</groupId>
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
index 99d6b4dc12..8e38935441 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
@@ -11,7 +11,7 @@ import org.onap.so.adapters.appc.orchestrator.client.beans.Parameters;
import org.onap.so.adapters.appc.orchestrator.client.beans.RequestParameters;
import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest;
import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVm;
-import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java
index 3eac851f13..82b0695ed9 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java
@@ -23,7 +23,7 @@ import org.onap.so.adapters.appc.orchestrator.client.beans.RequestParameters;
import org.onap.so.adapters.appc.orchestrator.service.ApplicationControllerTaskImpl;
import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest;
import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVnf;
-import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
index 973430c37e..ff979acf7b 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
@@ -22,7 +22,7 @@ import org.onap.so.adapters.appc.orchestrator.client.beans.RequestParameters;
import org.onap.so.adapters.appc.orchestrator.service.ApplicationControllerTaskImpl;
import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest;
import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVnf;
-import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.onap.appc.client.lcm.model.Action;